From 8b109f923dc7c2d5c5bd351a03a5277670962aac Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期一, 04 十二月 2023 13:05:04 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/crm/manager/controller/PlanTypeController.java | 51 +++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 45 insertions(+), 6 deletions(-)
diff --git a/src/main/java/com/zy/crm/manager/controller/PlanTypeController.java b/src/main/java/com/zy/crm/manager/controller/PlanTypeController.java
index 5608d40..647d6a6 100644
--- a/src/main/java/com/zy/crm/manager/controller/PlanTypeController.java
+++ b/src/main/java/com/zy/crm/manager/controller/PlanTypeController.java
@@ -11,7 +11,9 @@
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.*;
@@ -23,16 +25,47 @@
@Autowired
private PlanTypeService planTypeService;
+ @Autowired
+ private OrderProductTypeService orderProductTypeService;
- @RequestMapping(value = "/planType/{id}/auth")
+ @GetMapping(value = "/planType/{id}/auth")
@ManagerAuth
public R get(@PathVariable("id") String id) {
return R.ok(planTypeService.selectById(String.valueOf(id)));
}
- @RequestMapping(value = "/planType/list/auth")
+ @GetMapping(value = "/planType/{id}/plan/auth")
@ManagerAuth
- public R list(@RequestParam(defaultValue = "1")Integer curr,
+ 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")
+ public R list() {
+ return R.ok().add(planTypeService.selectList(new EntityWrapper<PlanType>().orderBy("id")));
+ }
+
+ @PostMapping(value = "/planType/list/radio/auth")
+ public R listRadio() {
+ List<PlanType> planTypes = planTypeService.selectList(new EntityWrapper<PlanType>().orderBy("id"));
+ for (int i = 0; i<planTypes.size(); i++) {
+ planTypes.get(i).setData("");
+ planTypes.get(i).setHtml("");
+ if (i == 0) {
+ planTypes.get(i).setChecked("checked");
+ }
+ }
+ return R.ok().add(planTypes);
+ }
+
+ @RequestMapping(value = "/planType/page/auth")
+ @ManagerAuth
+ public R page(@RequestParam(defaultValue = "1")Integer curr,
@RequestParam(defaultValue = "10")Integer limit,
@RequestParam(required = false)String orderByField,
@RequestParam(required = false)String orderByType,
@@ -60,8 +93,14 @@
}
@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());
@@ -73,7 +112,7 @@
}
@RequestMapping(value = "/planType/update/auth")
- @ManagerAuth
+ @ManagerAuth(memo = "鏇存柊瑙勫垝鍗曠被鍨�")
public R update(PlanType planType){
if (Cools.isEmpty(planType) || null==planType.getId()){
return R.error();
@@ -85,7 +124,7 @@
}
@RequestMapping(value = "/planType/delete/auth")
- @ManagerAuth
+ @ManagerAuth(memo = "鍒犻櫎瑙勫垝鍗曠被鍨�")
public R delete(@RequestParam(value="ids[]") Long[] ids){
for (Long id : ids){
planTypeService.deleteById(id);
--
Gitblit v1.9.1