d0c7eb45868a99a029c876d6629d3990040334f4.svn-base 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package cn.com.goldenwater.dcproj.controller.weixin;
  2. import cn.com.goldenwater.dcproj.model.ExtWeiXinMessage;
  3. import cn.com.goldenwater.dcproj.param.ExtWeiXinMessageParam;
  4. import cn.com.goldenwater.dcproj.service.ExtWeiXinMessageService;
  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 org.slf4j.Logger;
  13. import org.slf4j.LoggerFactory;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.util.Assert;
  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.RequestParam;
  21. import org.springframework.web.bind.annotation.RestController;
  22. import java.util.List;
  23. /**
  24. * @author lhc
  25. * @date 2023-10-18
  26. */
  27. @Api(value = "xxx管理",tags="xxx管理")
  28. @RestController
  29. @RequestMapping("/wei/xin/message")
  30. public class ExtWeiXinMessageController extends BaseController {
  31. private Logger logger = LoggerFactory.getLogger(getClass());
  32. @Autowired
  33. private ExtWeiXinMessageService extWeiXinMessageService;
  34. @ApiOperation(value = "添加xxx")
  35. @RequestMapping(value = "/", method = RequestMethod.POST)
  36. public BaseResponse<ExtWeiXinMessage> insert(@ApiParam(name = "extWeiXinMessage", value = "ExtWeiXinMessage", required = true) @RequestBody ExtWeiXinMessage extWeiXinMessage) {
  37. if(StringUtils.isBlank(extWeiXinMessage.getId())) {
  38. extWeiXinMessageService.insert(extWeiXinMessage);
  39. }
  40. else{
  41. extWeiXinMessageService.update(extWeiXinMessage);
  42. }
  43. return buildSuccessResponse(extWeiXinMessage);
  44. }
  45. @ApiOperation(value = "根据ID删除xxx")
  46. @RequestMapping(value = "delete/{id}", method = RequestMethod.POST)
  47. public BaseResponse delete(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  48. int ret = extWeiXinMessageService.delete(id);
  49. return buildSuccessResponse();
  50. }
  51. @ApiOperation(value = "更新xxx信息")
  52. @RequestMapping(value = "/update", method = RequestMethod.POST)
  53. public BaseResponse<ExtWeiXinMessage> update(@ApiParam(name = "extWeiXinMessage", value = "ExtWeiXinMessage", required = true) @RequestBody ExtWeiXinMessage extWeiXinMessage) {
  54. Assert.notNull(extWeiXinMessage.getId(), "主键id为必填参数");
  55. int ret = extWeiXinMessageService.update(extWeiXinMessage);
  56. return buildSuccessResponse(extWeiXinMessage);
  57. }
  58. @ApiOperation(value = "根据ID获取xxx(单表)")
  59. @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  60. public BaseResponse<ExtWeiXinMessage> get(@ApiParam(name = "id", value = "id", required = true) @PathVariable String id) {
  61. ExtWeiXinMessage extWeiXinMessage = extWeiXinMessageService.get(id);
  62. return buildSuccessResponse(extWeiXinMessage);
  63. }
  64. }