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.
 
 
 
 
 

68 lines
2.3 KiB

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