Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 

68 wiersze
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.WxChannel;
  6. import com.simple.service.WxChannelService;
  7. import io.swagger.annotations.ApiImplicitParam;
  8. import io.swagger.annotations.ApiImplicitParams;
  9. import io.swagger.annotations.ApiOperation;
  10. import org.slf4j.Logger;
  11. import org.slf4j.LoggerFactory;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.web.bind.annotation.*;
  14. @RestController
  15. @RequestMapping("wxChannel")
  16. public class WxChannelController extends BaseController {
  17. private final Logger logger = LoggerFactory.getLogger(this.getClass());
  18. @Autowired
  19. private WxChannelService wxChannelService;
  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 WxChannel wxChannel, Integer pageNum, Integer pageSize) {
  26. if (null == wxChannel) wxChannel = new WxChannel();
  27. final PageInfo<WxChannel> page = wxChannelService.listAsPage(wxChannel, pageNum, pageSize);
  28. return new ResultData(page);
  29. }
  30. @ApiOperation("新增接口")
  31. @PostMapping("add")
  32. public ResultData add(@RequestBody WxChannel wxChannel) {
  33. //Assert.notNull(wxChannel.getName(), "角色名不能为空");
  34. //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名");
  35. wxChannelService.saveOrUpdate(wxChannel);
  36. return new ResultData();
  37. }
  38. @ApiOperation("根据id更新接口")
  39. @PostMapping("update")
  40. public ResultData update(@RequestBody WxChannel wxChannel) {
  41. wxChannelService.saveOrUpdate(wxChannel);
  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. wxChannelService.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, "查询成功", wxChannelService.getById(id));
  56. }
  57. }