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.
 
 
 
 
 

74 lines
2.7 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. }
  37. @ApiOperation("根据id更新接口")
  38. @PostMapping("update")
  39. public ResultData update(@RequestBody WxMsgModel wxMsgModel) {
  40. return wxMsgModelService.saveOrUpdate(wxMsgModel);
  41. }
  42. @ApiOperation("根据id删除接口")
  43. @GetMapping("/del")
  44. @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true)
  45. public ResultData delete(Long id) {
  46. wxMsgModelService.deleteById(id);
  47. return new ResultData(Result.SUCCESS, "删除成功", null);
  48. }
  49. @ApiOperation("根据id查询接口")
  50. @GetMapping("/findById")
  51. @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true)
  52. public ResultData findById(Long id) {
  53. return new ResultData(Result.SUCCESS,"查询成功",wxMsgModelService.getById(id));
  54. }
  55. @ApiOperation("获取所有数据")
  56. @GetMapping("getmodellist")
  57. public ResultData getmodellist() {
  58. return wxMsgModelService.getmodellist();
  59. }
  60. }