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.
 
 
 
 
 

66 lines
2.3 KiB

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