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.WxMall;
  10. import com.simple.service.WxMallService;
  11. import io.swagger.annotations.ApiImplicitParam;
  12. import io.swagger.annotations.ApiImplicitParams;
  13. @RestController
  14. @RequestMapping("wxMall")
  15. public class WxMallController extends BaseController
  16. {
  17. @Autowired
  18. private WxMallService wxMallService;
  19. private Logger logger = Logger.getLogger(WxMallController.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 WxMall wxMall,Integer pageNum, Integer pageSize) {
  25. if (null == wxMall) wxMall = new WxMall();
  26. final PageInfo<WxMall> page = wxMallService.listAsPage(wxMall, pageNum, pageSize);
  27. return new ResultData(page);
  28. }
  29. @PostMapping("add")
  30. public ResultData add(@RequestBody WxMall wxMall) {
  31. //Assert.notNull(wxMall.getName(), "角色名不能为空");
  32. //Assert.isTrue(!checkUnique(sysRole.getName(), null), "重复的角色名");
  33. wxMallService.saveOrUpdate(wxMall);
  34. return new ResultData();
  35. }
  36. @PostMapping("update")
  37. public ResultData update(@RequestBody WxMall wxMall) {
  38. wxMallService.saveOrUpdate(wxMall);
  39. return new ResultData();
  40. }
  41. @GetMapping("/del")
  42. @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true)
  43. public ResultData delete(Long id) {
  44. wxMallService.deleteById(id);
  45. return new ResultData(Result.SUCCESS, "删除成功", null);
  46. }
  47. @GetMapping("/findById")
  48. @ApiImplicitParam(name="id",value="id",dataType="Long", paramType = "query",required=true)
  49. public ResultData findById(Long id) {
  50. return new ResultData(Result.SUCCESS,"查询成功",wxMallService.getById(id));
  51. }
  52. }