You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

69 lines
2.6 KiB

  1. package com.simple.controller;
  2. import com.github.pagehelper.PageInfo;
  3. import com.simple.common.Result;
  4. import com.simple.common.ResultData;
  5. import com.simple.domain.po.WxMsgModel;
  6. import com.simple.service.WxMsgModelService;
  7. import io.swagger.annotations.ApiImplicitParam;
  8. import io.swagger.annotations.ApiImplicitParams;
  9. import io.swagger.annotations.ApiOperation;
  10. import org.apache.log4j.Logger;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.web.bind.annotation.*;
  13. @RestController
  14. @RequestMapping("wxMsgModel")
  15. public class WxMsgModelController extends BaseController
  16. {
  17. @Autowired
  18. private WxMsgModelService wxMsgModelService;
  19. private Logger logger = Logger.getLogger(WxMsgModelController.class);
  20. @ApiOperation("分页列表接口")
  21. @GetMapping("list")
  22. @ApiImplicitParams({
  23. @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true),
  24. @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true)})
  25. public ResultData list(@ModelAttribute WxMsgModel wxMsgModel,Integer pageNum, Integer pageSize) {
  26. if (null == wxMsgModel) wxMsgModel = new WxMsgModel();
  27. final PageInfo<WxMsgModel> page = wxMsgModelService.listAsPage(wxMsgModel, pageNum, pageSize);
  28. return new ResultData(page);
  29. }
  30. @ApiOperation("新增接口")
  31. @PostMapping("add")
  32. public ResultData add(@RequestBody WxMsgModel wxMsgModel) {
  33. //Assert.notNull(wxMsgModel.getName(), "角色名不能为空");
  34. //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名");
  35. //return wxMsgModelService.saveOrUpdate(wxMsgModel);
  36. return new ResultData();
  37. }
  38. @ApiOperation("根据id更新接口")
  39. @PostMapping("update")
  40. public ResultData update(@RequestBody WxMsgModel wxMsgModel) {
  41. wxMsgModelService.saveOrUpdate(wxMsgModel);
  42. return new ResultData();
  43. }
  44. @ApiOperation("根据id删除接口")
  45. @GetMapping("/del")
  46. @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true)
  47. public ResultData delete(Long id) {
  48. wxMsgModelService.deleteById(id);
  49. return new ResultData(Result.SUCCESS, "删除成功", null);
  50. }
  51. @ApiOperation("根据id查询接口")
  52. @GetMapping("/findById")
  53. @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true)
  54. public ResultData findById(Long id) {
  55. return new ResultData(Result.SUCCESS,"查询成功",wxMsgModelService.getById(id));
  56. }
  57. }