Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

79 строки
3.1 KiB

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