|
@@ -1,35 +1,78 @@
|
|
|
package com.its.op.controller.database;
|
|
package com.its.op.controller.database;
|
|
|
|
|
|
|
|
-import com.its.op.controller.AbstractRepositoryController;
|
|
|
|
|
|
|
+import com.its.op.model.dto.UserInfrDto;
|
|
|
import com.its.op.model.entity.UserInfr;
|
|
import com.its.op.model.entity.UserInfr;
|
|
|
-import com.its.op.service.database.impl.TbUserInfrServiceImpl;
|
|
|
|
|
|
|
+import com.its.op.service.database.TbUserInfrService;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.web.bind.annotation.PutMapping;
|
|
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
|
+import javax.validation.Valid;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
|
|
+@RequiredArgsConstructor
|
|
|
@RestController
|
|
@RestController
|
|
|
-@RequestMapping("/api/database//tb-user-infr")
|
|
|
|
|
|
|
+@RequestMapping("/api/database/tb-user-infr")
|
|
|
@Api(tags = "09.기초데이터관리-10.운영자관리", description="운영자관리")
|
|
@Api(tags = "09.기초데이터관리-10.운영자관리", description="운영자관리")
|
|
|
-public class TbUserInfrController extends AbstractRepositoryController<UserInfr, String> {
|
|
|
|
|
|
|
+public class TbUserInfrController {
|
|
|
|
|
|
|
|
- private final TbUserInfrServiceImpl service;
|
|
|
|
|
|
|
+ private final TbUserInfrService service;
|
|
|
|
|
|
|
|
- public TbUserInfrController(TbUserInfrServiceImpl service) {
|
|
|
|
|
- super(service);
|
|
|
|
|
- this.service = service;
|
|
|
|
|
|
|
+ @ApiOperation(value = "전체조회(TB_USER_INFR)", response = UserInfrDto.UserInfo.class)
|
|
|
|
|
+ @GetMapping(value = "", produces = {"application/json; charset=utf8"})
|
|
|
|
|
+ public ResponseEntity<List<UserInfrDto.UserInfo>> findAll() {
|
|
|
|
|
+ List<UserInfr> data = this.service.findAll();
|
|
|
|
|
+ List<UserInfrDto.UserInfo> result = new ArrayList<>();
|
|
|
|
|
+ for (UserInfr obj: data) {
|
|
|
|
|
+ result.add(new UserInfrDto.UserInfo(obj));
|
|
|
|
|
+ }
|
|
|
|
|
+ return new ResponseEntity<>(result, HttpStatus.OK);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @ApiOperation(value = "개별조회(TB_USER_INFR)", response = UserInfrDto.UserInfo.class)
|
|
|
|
|
+ @GetMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
|
|
|
|
|
+ public ResponseEntity<UserInfrDto.UserInfo> findById(@PathVariable final String id) {
|
|
|
|
|
+ UserInfr obj = this.service.findById(id);
|
|
|
|
|
+ if (obj != null) {
|
|
|
|
|
+ return new ResponseEntity<>(new UserInfrDto.UserInfo(obj), HttpStatus.OK);
|
|
|
|
|
+ }
|
|
|
|
|
+ return new ResponseEntity<>(null, HttpStatus.NOT_FOUND);//NO_CONTENT);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "정보변경/생성(TB_USER_INFR)", response = UserInfrDto.UserInfo.class)
|
|
|
|
|
+ @PostMapping(value = "", produces = {"application/json; charset=utf8"})
|
|
|
|
|
+ public ResponseEntity<UserInfrDto.UserInfo> mergeInfo(@RequestBody @Valid final UserInfrDto.UserInfoUpdateReq req) {
|
|
|
|
|
+ UserInfr obj = this.service.mergeInfo(req);
|
|
|
|
|
+ if (obj != null) {
|
|
|
|
|
+ return new ResponseEntity<>(new UserInfrDto.UserInfo(obj), HttpStatus.OK);
|
|
|
|
|
+ }
|
|
|
|
|
+ return new ResponseEntity<>(null, HttpStatus.NOT_FOUND);//NO_CONTENT);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "정보삭제(TB_USER_INFR)", response = UserInfrDto.UserInfo.class)
|
|
|
|
|
+ @DeleteMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
|
|
|
|
|
+ public ResponseEntity<UserInfrDto.UserInfo> deleteDataById(@PathVariable("id") String id) {
|
|
|
|
|
+ UserInfr obj = this.service.deleteById(id);
|
|
|
|
|
+ if (obj != null) {
|
|
|
|
|
+ return new ResponseEntity<>(new UserInfrDto.UserInfo(obj), HttpStatus.OK);
|
|
|
|
|
+ }
|
|
|
|
|
+ return new ResponseEntity<>(null, HttpStatus.NOT_FOUND);//NO_CONTENT);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@ApiOperation(value = "비밀번호변경(TB_USER_INFR)", response = UserInfr.class)
|
|
@ApiOperation(value = "비밀번호변경(TB_USER_INFR)", response = UserInfr.class)
|
|
|
- @PutMapping(value = "/pswd/", produces = {"application/json; charset=utf8"})
|
|
|
|
|
- public int updatePswdById(@RequestBody UserInfr obj, HttpServletRequest request) {
|
|
|
|
|
- return this.service.updatePswdById(obj);
|
|
|
|
|
|
|
+ @PutMapping(value = "/pswd/{id}", produces = {"application/json; charset=utf8"})
|
|
|
|
|
+ public ResponseEntity<UserInfrDto.UserInfo> updatePswdById(@PathVariable("id") String id, @RequestBody UserInfrDto.UserPswdUpdateReq req) {
|
|
|
|
|
+ UserInfr obj = this.service.updatePswdById(id, req);
|
|
|
|
|
+ if (obj != null) {
|
|
|
|
|
+ return new ResponseEntity<>(new UserInfrDto.UserInfo(obj), HttpStatus.OK);
|
|
|
|
|
+ }
|
|
|
|
|
+ return new ResponseEntity<>(null, HttpStatus.NOT_FOUND);//NO_CONTENT);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|