| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- package com.ym.mec.web.controller;
- import com.ym.mec.biz.dal.entity.PracticeGroupSellPrice;
- import com.ym.mec.biz.dal.page.BaseOrganQueryInfo;
- import com.ym.mec.biz.service.OrganizationService;
- import com.ym.mec.biz.service.PracticeGroupSellPriceService;
- import com.ym.mec.common.controller.BaseController;
- import com.ym.mec.common.exception.BizException;
- import com.ym.mec.common.page.QueryInfo;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiImplicitParam;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.http.MediaType;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import java.util.Date;
- @RequestMapping("practiceGroupSellPrice")
- @Api(tags = "网管课价格配置")
- @RestController
- public class PracticeGroupSellPriceController extends BaseController {
- @Autowired
- private PracticeGroupSellPriceService practiceGroupSellPriceService;
- @Autowired
- private OrganizationService organizationService;
- @ApiOperation("分页查询")
- @GetMapping(value = "/list")
- @PreAuthorize("@pcs.hasPermissions('practiceGroupSellPrice/list')")
- public Object getList(BaseOrganQueryInfo queryInfo) {
- queryInfo.setOrganId(organizationService.getEmployeeOrgan(queryInfo.getOrganId()));
- return succeed(practiceGroupSellPriceService.queryPage(queryInfo));
- }
- @ApiOperation("单查询")
- @ApiImplicitParam(name = "organId", value = "分部编号", required = true, dataType = "Integer", paramType = "path")
- @GetMapping(value = "/query")
- @PreAuthorize("@pcs.hasPermissions('practiceGroupSellPrice/query')")
- public Object query(Integer organId) {
- return succeed(practiceGroupSellPriceService.get(organId));
- }
- @ApiOperation("新增")
- @PostMapping(value = "/add", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
- @PreAuthorize("@pcs.hasPermissions('practiceGroupSellPrice/add')")
- public Object add(PracticeGroupSellPrice practiceGroupSellPrice) {
- PracticeGroupSellPrice practiceGroupSellPrice1 = practiceGroupSellPriceService.get(practiceGroupSellPrice.getOrganId());
- if(practiceGroupSellPrice1 != null){
- throw new BizException("数据已存在");
- }
- Date date = new Date();
- practiceGroupSellPrice.setCreateTime(date);
- practiceGroupSellPrice.setUpdateTime(date);
- practiceGroupSellPriceService.insert(practiceGroupSellPrice);
- return succeed();
- }
- @ApiOperation("更新")
- @PostMapping(value = "/update", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
- @PreAuthorize("@pcs.hasPermissions('practiceGroupSellPrice/update')")
- public Object update(PracticeGroupSellPrice practiceGroupSellPrice) {
- practiceGroupSellPrice.setUpdateTime(new Date());
- practiceGroupSellPriceService.update(practiceGroupSellPrice);
- return succeed();
- }
- @ApiOperation("删除")
- @PostMapping(value = "/del")
- @ApiImplicitParam(name = "organId", value = "分部编号", required = true, dataType = "Integer", paramType = "path")
- @PreAuthorize("@pcs.hasPermissions('practiceGroupSellPrice/del')")
- public Object del(Integer organId) {
- practiceGroupSellPriceService.delete(organId);
- return succeed();
- }
- }
|