From 703f9b7aed5f59a656132f881e233a2511604b1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=A3=95=E8=B4=A2?= Date: Fri, 27 Jan 2023 11:22:23 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=BA=E9=99=B7=E5=9B=9E=E5=BD=92=E5=88=86?= =?UTF-8?q?=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xm/core/ctrl/XmFuncController.java | 20 ++++++++++++++++++- .../main/java/com/xm/core/entity/XmFunc.java | 5 ++++- .../mapper/xm/core/dao/XmFuncMapper.xml | 12 +++++++---- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/xm-core/src/main/java/com/xm/core/ctrl/XmFuncController.java b/xm-core/src/main/java/com/xm/core/ctrl/XmFuncController.java index 40613a0e..33fe7714 100644 --- a/xm-core/src/main/java/com/xm/core/ctrl/XmFuncController.java +++ b/xm-core/src/main/java/com/xm/core/ctrl/XmFuncController.java @@ -9,7 +9,10 @@ import com.mdp.safe.client.utils.LoginUtils; import com.mdp.sensitive.SensitiveWordService; import com.mdp.swagger.ApiEntityParams; import com.xm.core.entity.XmFunc; +import com.xm.core.entity.XmProduct; import com.xm.core.service.XmFuncService; +import com.xm.core.service.XmProductQxService; +import com.xm.core.service.XmProductService; import io.swagger.annotations.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,6 +42,12 @@ public class XmFuncController { @Autowired private XmFuncService xmFuncService; + + @Autowired + private XmProductService xmProductService; + @Autowired + private XmProductQxService productQxService; + @Autowired SensitiveWordService sensitiveWordService; @@ -97,7 +106,16 @@ public class XmFuncController { if(words!=null && words.size()>0){ return failed("name-sensitive-word","名字有敏感词"+words+",请修改后再提交"); } - + if(!StringUtils.hasText(xmFunc.getProductId())){ + return failed("productId-0","产品编号不能为空"); + } + User user=LoginUtils.getCurrentUserInfo(); + XmProduct xmProduct=xmProductService.getProductFromCache(xmFunc.getProductId()); + tips=productQxService.checkProductQx(xmProduct,2,user); + if(!tips.isOk()){ + return failed(tips); + } + xmFunc.setPbranchId(xmProduct.getBranchId()); xmFuncService.parentIdPathsCalcBeforeSave(xmFunc); xmFuncService.insert(xmFunc); m.put("data",xmFunc); diff --git a/xm-core/src/main/java/com/xm/core/entity/XmFunc.java b/xm-core/src/main/java/com/xm/core/entity/XmFunc.java index 93473e06..cdca8530 100644 --- a/xm-core/src/main/java/com/xm/core/entity/XmFunc.java +++ b/xm-core/src/main/java/com/xm/core/entity/XmFunc.java @@ -7,7 +7,7 @@ import io.swagger.annotations.ApiModelProperty; /** * 组织 com 顶级模块 xm 大模块 core 小模块
* 实体 XmFunc所有属性名:
- * "id","主键","name","名称","pid","上级编号","pname","上级名称","pidPaths","上级路径,直到自身,逗号分割,包含自身","productId","产品编号","lvl","菜单级别0-根,1,2,3,4,5依次类推";
+ * "id","主键","name","名称","pid","上级编号","pname","上级名称","pidPaths","上级路径,直到自身,逗号分割,包含自身","productId","产品编号","lvl","菜单级别0-根,1,2,3,4,5依次类推","pbranchId","产品归属企业";
* 当前主键(包括多主键):
* id;
*/ @@ -38,6 +38,9 @@ public class XmFunc implements java.io.Serializable { @ApiModelProperty(notes="菜单级别0-根,1,2,3,4,5依次类推",allowEmptyValue=true,example="",allowableValues="") Integer lvl; + + @ApiModelProperty(notes="产品归属企业",allowEmptyValue=true,example="",allowableValues="") + String pbranchId; /** *主键 diff --git a/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmFuncMapper.xml b/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmFuncMapper.xml index 696c97a8..37add42f 100644 --- a/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmFuncMapper.xml +++ b/xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmFuncMapper.xml @@ -67,7 +67,7 @@ insert into xm_func( ) values ( - #{id},#{name},#{pid},#{pname},#{pidPaths},#{productId},#{lvl} + #{id},#{name},#{pid},#{pname},#{pidPaths},#{productId},#{lvl},#{pbranchId} ) @@ -142,7 +142,7 @@ - id,name,pid,pname,pid_paths,product_id,lvl + id,name,pid,pname,pid_paths,product_id,lvl,pbranch_id @@ -154,6 +154,7 @@ and res.pid_paths = #{pidPaths} and res.product_id = #{productId} and res.lvl = #{lvl} + and res.pbranch_id = #{pbranchId} @@ -162,7 +163,8 @@ pname = #{pname}, pid_paths = #{pidPaths}, product_id = #{productId}, - lvl = #{lvl} + lvl = #{lvl}, + pbranch_id = #{pbranchId} name = #{name}, @@ -171,6 +173,7 @@ pid_paths = #{pidPaths}, product_id = #{productId}, lvl = #{lvl}, + pbranch_id = #{pbranchId}, @@ -179,6 +182,7 @@ pname = #{item.pname}, pid_paths = #{item.pidPaths}, product_id = #{item.productId}, - lvl = #{item.lvl} + lvl = #{item.lvl}, + pbranch_id = #{item.pbranchId} \ No newline at end of file