085e91df3ea005c6ae39e4a8e4a431fd9a6cd00a.svn-base 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. package cn.com.goldenwater.dcproj.controller.zhejiang;
  2. import cn.com.goldenwater.dcproj.model.AttZhejiangJgBase;
  3. import cn.com.goldenwater.dcproj.param.AttZhejiangJgBaseParam;
  4. import cn.com.goldenwater.dcproj.service.AttZhejiangJgBaseService;
  5. import cn.com.goldenwater.core.web.BaseController;
  6. import cn.com.goldenwater.core.web.BaseResponse;
  7. import cn.com.goldenwater.id.util.UuidUtil;
  8. import io.swagger.annotations.Api;
  9. import io.swagger.annotations.ApiOperation;
  10. import io.swagger.annotations.ApiParam;
  11. import org.apache.commons.lang3.StringUtils;
  12. import com.github.pagehelper.PageInfo;
  13. import org.slf4j.Logger;
  14. import org.slf4j.LoggerFactory;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.web.bind.annotation.PathVariable;
  17. import org.springframework.web.bind.annotation.RequestBody;
  18. import org.springframework.web.bind.annotation.RequestMapping;
  19. import org.springframework.web.bind.annotation.RequestMethod;
  20. import org.springframework.web.bind.annotation.RestController;
  21. import java.util.List;
  22. /**
  23. * @author lune
  24. * @date 2020-5-12
  25. */
  26. @Api(value = "ATT 浙江监管基本信息管理",tags="ATT 浙江监管基本信息管理")
  27. @RestController
  28. @RequestMapping("/att/zhejiang/jg/base")
  29. public class AttZhejiangJgBaseController extends BaseController {
  30. private Logger logger = LoggerFactory.getLogger(getClass());
  31. @Autowired
  32. private AttZhejiangJgBaseService attZhejiangJgBaseService;
  33. @ApiOperation(value = "添加/修改")
  34. @RequestMapping(value = "", method = RequestMethod.POST)
  35. public BaseResponse<AttZhejiangJgBase> insert(@ApiParam(name = "attZhejiangJgBase", value = "AttZhejiangJgBase", required = true) @RequestBody AttZhejiangJgBase attZhejiangJgBase) {
  36. if(StringUtils.isBlank(attZhejiangJgBase.getId())) {
  37. String uuid = UuidUtil.uuid(); // 生成uuid
  38. attZhejiangJgBase.setId(uuid);
  39. attZhejiangJgBaseService.insert(attZhejiangJgBase);
  40. }else{
  41. attZhejiangJgBaseService.update(attZhejiangJgBase);
  42. }
  43. return buildSuccessResponse(attZhejiangJgBase);
  44. }
  45. @ApiOperation(value = "根据ID删除")
  46. @RequestMapping(value = "/del/{id}", method = RequestMethod.GET)
  47. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  48. int ret = attZhejiangJgBaseService.delete(id);
  49. return buildSuccessResponse();
  50. }
  51. @ApiOperation(value = "根据ID获取(单表)")
  52. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  53. public BaseResponse<AttZhejiangJgBase> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  54. AttZhejiangJgBase attZhejiangJgBase = attZhejiangJgBaseService.get(id);
  55. return buildSuccessResponse(attZhejiangJgBase);
  56. }
  57. @ApiOperation(value = "获取(列表所有)")
  58. @RequestMapping(value = "/list", method = RequestMethod.POST)
  59. public BaseResponse<List<AttZhejiangJgBase>> list(@ApiParam(name = "attZhejiangJgBaseParam", value = "attZhejiangJgBaseParam", required = true) @RequestBody AttZhejiangJgBaseParam attZhejiangJgBaseParam) {
  60. List<AttZhejiangJgBase> attZhejiangJgBaseList = attZhejiangJgBaseService.findList(attZhejiangJgBaseParam);
  61. return buildSuccessResponse(attZhejiangJgBaseList);
  62. }
  63. @ApiOperation(value = "获取(列表--分页)")
  64. @RequestMapping(value = "/page", method = RequestMethod.POST)
  65. public BaseResponse<PageInfo<AttZhejiangJgBase>> page(@ApiParam(name = "attZhejiangJgBaseParam", value = "attZhejiangJgBaseParam", required = true) @RequestBody AttZhejiangJgBaseParam attZhejiangJgBaseParam) {
  66. PageInfo<AttZhejiangJgBase> attZhejiangJgBaseList = attZhejiangJgBaseService.findPageInfo(attZhejiangJgBaseParam);
  67. return buildSuccessResponse(attZhejiangJgBaseList);
  68. }
  69. }