PracticeGroupSellPriceController.java 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package com.ym.mec.web.controller;
  2. import com.ym.mec.biz.dal.entity.PracticeGroupSellPrice;
  3. import com.ym.mec.biz.dal.page.BaseOrganQueryInfo;
  4. import com.ym.mec.biz.service.OrganizationService;
  5. import com.ym.mec.biz.service.PracticeGroupSellPriceService;
  6. import com.ym.mec.common.controller.BaseController;
  7. import com.ym.mec.common.exception.BizException;
  8. import com.ym.mec.common.page.QueryInfo;
  9. import io.swagger.annotations.Api;
  10. import io.swagger.annotations.ApiImplicitParam;
  11. import io.swagger.annotations.ApiOperation;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.http.MediaType;
  14. import org.springframework.security.access.prepost.PreAuthorize;
  15. import org.springframework.web.bind.annotation.GetMapping;
  16. import org.springframework.web.bind.annotation.PostMapping;
  17. import org.springframework.web.bind.annotation.RequestMapping;
  18. import org.springframework.web.bind.annotation.RestController;
  19. import java.util.Date;
  20. @RequestMapping("practiceGroupSellPrice")
  21. @Api(tags = "网管课价格配置")
  22. @RestController
  23. public class PracticeGroupSellPriceController extends BaseController {
  24. @Autowired
  25. private PracticeGroupSellPriceService practiceGroupSellPriceService;
  26. @Autowired
  27. private OrganizationService organizationService;
  28. @ApiOperation("分页查询")
  29. @GetMapping(value = "/list")
  30. @PreAuthorize("@pcs.hasPermissions('practiceGroupSellPrice/list')")
  31. public Object getList(BaseOrganQueryInfo queryInfo) {
  32. queryInfo.setOrganId(organizationService.getEmployeeOrgan(queryInfo.getOrganId()));
  33. return succeed(practiceGroupSellPriceService.queryPage(queryInfo));
  34. }
  35. @ApiOperation("单查询")
  36. @ApiImplicitParam(name = "organId", value = "分部编号", required = true, dataType = "Integer", paramType = "path")
  37. @GetMapping(value = "/query")
  38. @PreAuthorize("@pcs.hasPermissions('practiceGroupSellPrice/query')")
  39. public Object query(Integer organId) {
  40. return succeed(practiceGroupSellPriceService.get(organId));
  41. }
  42. @ApiOperation("新增")
  43. @PostMapping(value = "/add", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
  44. @PreAuthorize("@pcs.hasPermissions('practiceGroupSellPrice/add')")
  45. public Object add(PracticeGroupSellPrice practiceGroupSellPrice) {
  46. PracticeGroupSellPrice practiceGroupSellPrice1 = practiceGroupSellPriceService.get(practiceGroupSellPrice.getOrganId());
  47. if(practiceGroupSellPrice1 != null){
  48. throw new BizException("数据已存在");
  49. }
  50. Date date = new Date();
  51. practiceGroupSellPrice.setCreateTime(date);
  52. practiceGroupSellPrice.setUpdateTime(date);
  53. practiceGroupSellPriceService.insert(practiceGroupSellPrice);
  54. return succeed();
  55. }
  56. @ApiOperation("更新")
  57. @PostMapping(value = "/update", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
  58. @PreAuthorize("@pcs.hasPermissions('practiceGroupSellPrice/update')")
  59. public Object update(PracticeGroupSellPrice practiceGroupSellPrice) {
  60. practiceGroupSellPrice.setUpdateTime(new Date());
  61. practiceGroupSellPriceService.update(practiceGroupSellPrice);
  62. return succeed();
  63. }
  64. @ApiOperation("删除")
  65. @PostMapping(value = "/del")
  66. @ApiImplicitParam(name = "organId", value = "分部编号", required = true, dataType = "Integer", paramType = "path")
  67. @PreAuthorize("@pcs.hasPermissions('practiceGroupSellPrice/del')")
  68. public Object del(Integer organId) {
  69. practiceGroupSellPriceService.delete(organId);
  70. return succeed();
  71. }
  72. }