bc49ea10136cc14f944165303d5e4189a0d867cd.svn-base 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. package cn.com.goldenwater.dcproj.controller.tac;
  2. import cn.com.goldenwater.core.web.BaseController;
  3. import cn.com.goldenwater.core.web.BaseResponse;
  4. import cn.com.goldenwater.dcproj.constValue.SplitValue;
  5. import cn.com.goldenwater.dcproj.model.TacObjSubject;
  6. import cn.com.goldenwater.dcproj.param.TacObjSubjectParam;
  7. import cn.com.goldenwater.dcproj.service.TacObjSubjectService;
  8. import cn.com.goldenwater.dcproj.utils.InspUtils;
  9. import io.swagger.annotations.Api;
  10. import io.swagger.annotations.ApiOperation;
  11. import io.swagger.annotations.ApiParam;
  12. import org.apache.commons.lang3.StringUtils;
  13. import org.slf4j.Logger;
  14. import org.slf4j.LoggerFactory;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.util.Assert;
  17. import org.springframework.web.bind.annotation.*;
  18. import java.util.Date;
  19. import java.util.List;
  20. /**
  21. * @author lune
  22. * @date 2019-6-19
  23. */
  24. @Api(value = "TAC 稽察单位责任主体性质列表管理", tags = "TAC 稽察单位责任主体性质列表管理")
  25. @RestController
  26. @RequestMapping("/tac/obj/subject")
  27. public class TacObjSubjectController extends BaseController {
  28. private Logger logger = LoggerFactory.getLogger(getClass());
  29. @Autowired
  30. private TacObjSubjectService tacObjSubjectService;
  31. @ApiOperation(value = "添加/修改稽察单位责任主体性质")
  32. @RequestMapping(value = "", method = RequestMethod.POST)
  33. public BaseResponse<TacObjSubject> insert(@ApiParam(name = "tacObjSubject", value = "TacObjSubject", required = true) @RequestBody TacObjSubject tacObjSubject) {
  34. if (StringUtils.isNotBlank(tacObjSubject.getId())) {
  35. tacObjSubjectService.update(tacObjSubject);
  36. } else {
  37. String uuid = tacObjSubjectService.selectCount();
  38. tacObjSubject.setId(uuid);
  39. tacObjSubject.setIntm(new Date());
  40. int ret = tacObjSubjectService.insert(tacObjSubject);
  41. }
  42. return buildSuccessResponse(tacObjSubject);
  43. }
  44. @ApiOperation(value = "根据ID删除稽察单位责任主体性质")
  45. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  46. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  47. int ret = tacObjSubjectService.delete(id);
  48. return buildSuccessResponse();
  49. }
  50. @ApiOperation(value = "更新稽察单位责任主体性质信息")
  51. @RequestMapping(value = "/update", method = RequestMethod.POST)
  52. public BaseResponse<TacObjSubject> update(@ApiParam(name = "tacObjSubject", value = "TacObjSubject", required = true) @RequestBody TacObjSubject tacObjSubject) {
  53. Assert.notNull(tacObjSubject.getId(), "主键id为必填参数");
  54. int ret = tacObjSubjectService.update(tacObjSubject);
  55. return buildSuccessResponse(tacObjSubject);
  56. }
  57. @ApiOperation(value = "根据ID获取稽察单位责任主体性质(单表)")
  58. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  59. public BaseResponse<TacObjSubject> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  60. TacObjSubject tacObjSubject = tacObjSubjectService.get(id);
  61. return buildSuccessResponse(tacObjSubject);
  62. }
  63. @ApiOperation(value = "获取最大ID序号")
  64. @RequestMapping(value = "/selectmax", method = RequestMethod.GET)
  65. public BaseResponse<String> selectmax() {
  66. String id = tacObjSubjectService.selectCount();
  67. return buildSuccessResponse(id);
  68. }
  69. @ApiOperation(value = "获取稽察单位责任主体性质(列表)")
  70. @RequestMapping(value = "/list", method = RequestMethod.POST)
  71. public BaseResponse<List<TacObjSubject>> list(@RequestBody TacObjSubjectParam objSubjectParam) {
  72. if (StringUtils.isNotBlank(objSubjectParam.getNote())) {
  73. objSubjectParam.setNote(InspUtils.getPblmType(objSubjectParam.getNote()) + SplitValue.DOUHAO_SPLIT);
  74. }
  75. List<TacObjSubject> tacObjSubject = tacObjSubjectService.findList(objSubjectParam);
  76. return buildSuccessResponse(tacObjSubject);
  77. }
  78. @ApiOperation(value = "获取稽察单位责任主体性质所属类型(列表)")
  79. @RequestMapping(value = "/listType", method = RequestMethod.GET)
  80. public BaseResponse<List<TacObjSubject>> listType() {
  81. List<TacObjSubject> objSubjects = tacObjSubjectService.listType();
  82. return buildSuccessResponse(objSubjects);
  83. }
  84. }