| | |
| | | import com.core.common.R; |
| | | import com.core.domain.KeyValueVo; |
| | | import com.zy.crm.common.web.BaseController; |
| | | import com.zy.crm.manager.entity.OrderProductType; |
| | | import com.zy.crm.manager.entity.PlanType; |
| | | import com.zy.crm.manager.service.OrderProductTypeService; |
| | | import com.zy.crm.manager.service.PlanTypeService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | @Autowired |
| | | private PlanTypeService planTypeService; |
| | | @Autowired |
| | | private OrderProductTypeService orderProductTypeService; |
| | | |
| | | @GetMapping(value = "/planType/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") String id) { |
| | | return R.ok(planTypeService.selectById(String.valueOf(id))); |
| | | } |
| | | |
| | | @GetMapping(value = "/planType/{id}/plan/auth") |
| | | @ManagerAuth |
| | | public R getPlanTypeOfAdd(@PathVariable("id") String id) { |
| | | return R.ok().add(Cools |
| | | .add("planType", planTypeService.selectById(String.valueOf(id))) |
| | | .add("userId", getUserId()) |
| | | .add("nickName", getUser().getNickname()) |
| | | .add("mobile",getUser().getMobile()) |
| | | ); |
| | | } |
| | | |
| | | @PostMapping(value = "/planType/list/auth") |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/planType/add/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "添加规划单类型") |
| | | public R add(PlanType planType) { |
| | | int OPTCOUNT = planTypeService.selectCount(new EntityWrapper<PlanType>().eq("order_product_type_id", planType.getOrderProductTypeId())); |
| | | if (OPTCOUNT!=0) return R.error("重复添加"); |
| | | OrderProductType orderProductType = orderProductTypeService.selectById(planType.getOrderProductTypeId()); |
| | | planType.setName(orderProductType.getName()); |
| | | planType.setType(orderProductType.getType()); |
| | | planType.setOrderProductTypeId(planType.getOrderProductTypeId()); |
| | | planType.setHostId(getHostId()); |
| | | planType.setCreateBy(getUserId()); |
| | | planType.setCreateTime(new Date()); |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/planType/update/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "更新规划单类型") |
| | | public R update(PlanType planType){ |
| | | if (Cools.isEmpty(planType) || null==planType.getId()){ |
| | | return R.error(); |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "/planType/delete/auth") |
| | | @ManagerAuth |
| | | @ManagerAuth(memo = "删除规划单类型") |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | planTypeService.deleteById(id); |