Browse Source

缺陷回归分布

master
陈裕财 3 years ago
parent
commit
703f9b7aed
  1. 20
      xm-core/src/main/java/com/xm/core/ctrl/XmFuncController.java
  2. 5
      xm-core/src/main/java/com/xm/core/entity/XmFunc.java
  3. 12
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmFuncMapper.xml

20
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.sensitive.SensitiveWordService;
import com.mdp.swagger.ApiEntityParams; import com.mdp.swagger.ApiEntityParams;
import com.xm.core.entity.XmFunc; import com.xm.core.entity.XmFunc;
import com.xm.core.entity.XmProduct;
import com.xm.core.service.XmFuncService; import com.xm.core.service.XmFuncService;
import com.xm.core.service.XmProductQxService;
import com.xm.core.service.XmProductService;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -39,6 +42,12 @@ public class XmFuncController {
@Autowired @Autowired
private XmFuncService xmFuncService; private XmFuncService xmFuncService;
@Autowired
private XmProductService xmProductService;
@Autowired
private XmProductQxService productQxService;
@Autowired @Autowired
SensitiveWordService sensitiveWordService; SensitiveWordService sensitiveWordService;
@ -97,7 +106,16 @@ public class XmFuncController {
if(words!=null && words.size()>0){ if(words!=null && words.size()>0){
return failed("name-sensitive-word","名字有敏感词"+words+",请修改后再提交"); 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.parentIdPathsCalcBeforeSave(xmFunc);
xmFuncService.insert(xmFunc); xmFuncService.insert(xmFunc);
m.put("data",xmFunc); m.put("data",xmFunc);

5
xm-core/src/main/java/com/xm/core/entity/XmFunc.java

@ -7,7 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
/** /**
* 组织 com 顶级模块 xm 大模块 core 小模块 <br> * 组织 com 顶级模块 xm 大模块 core 小模块 <br>
* 实体 XmFunc所有属性名: <br> * 实体 XmFunc所有属性名: <br>
* "id","主键","name","名称","pid","上级编号","pname","上级名称","pidPaths","上级路径,直到自身,逗号分割,包含自身","productId","产品编号","lvl","菜单级别0-根,1,2,3,4,5依次类推";<br>
* "id","主键","name","名称","pid","上级编号","pname","上级名称","pidPaths","上级路径,直到自身,逗号分割,包含自身","productId","产品编号","lvl","菜单级别0-根,1,2,3,4,5依次类推","pbranchId","产品归属企业";<br>
* 当前主键(包括多主键):<br> * 当前主键(包括多主键):<br>
* id;<br> * id;<br>
*/ */
@ -38,6 +38,9 @@ public class XmFunc implements java.io.Serializable {
@ApiModelProperty(notes="菜单级别0-根,1,2,3,4,5依次类推",allowEmptyValue=true,example="",allowableValues="") @ApiModelProperty(notes="菜单级别0-根,1,2,3,4,5依次类推",allowEmptyValue=true,example="",allowableValues="")
Integer lvl; Integer lvl;
@ApiModelProperty(notes="产品归属企业",allowEmptyValue=true,example="",allowableValues="")
String pbranchId;
/** /**
*主键 *主键

12
xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmFuncMapper.xml

@ -67,7 +67,7 @@
insert into xm_func( insert into xm_func(
<include refid="columns"/> <include refid="columns"/>
) values ( ) values (
#{id},#{name},#{pid},#{pname},#{pidPaths},#{productId},#{lvl}
#{id},#{name},#{pid},#{pname},#{pidPaths},#{productId},#{lvl},#{pbranchId}
) )
</insert> </insert>
@ -142,7 +142,7 @@
<!--sql片段 列--> <!--sql片段 列-->
<sql id="columns"> <sql id="columns">
id,name,pid,pname,pid_paths,product_id,lvl
id,name,pid,pname,pid_paths,product_id,lvl,pbranch_id
</sql> </sql>
<!--sql片段 动态条件 YYYY-MM-DD HH24:MI:SS--> <!--sql片段 动态条件 YYYY-MM-DD HH24:MI:SS-->
@ -154,6 +154,7 @@
<if test="pidPaths != null and pidPaths != ''"> and res.pid_paths = #{pidPaths} </if> <if test="pidPaths != null and pidPaths != ''"> and res.pid_paths = #{pidPaths} </if>
<if test="productId != null and productId != ''"> and res.product_id = #{productId} </if> <if test="productId != null and productId != ''"> and res.product_id = #{productId} </if>
<if test="lvl != null and lvl != ''"> and res.lvl = #{lvl} </if> <if test="lvl != null and lvl != ''"> and res.lvl = #{lvl} </if>
<if test="pbranchId != null and pbranchId != ''"> and res.pbranch_id = #{pbranchId} </if>
</sql> </sql>
<!--sql片段 更新字段 --> <!--sql片段 更新字段 -->
<sql id="set"> <sql id="set">
@ -162,7 +163,8 @@
pname = #{pname}, pname = #{pname},
pid_paths = #{pidPaths}, pid_paths = #{pidPaths},
product_id = #{productId}, product_id = #{productId},
lvl = #{lvl}
lvl = #{lvl},
pbranch_id = #{pbranchId}
</sql> </sql>
<sql id="someFieldSet"> <sql id="someFieldSet">
<if test="name != null and name != ''"> name = #{name}, </if> <if test="name != null and name != ''"> name = #{name}, </if>
@ -171,6 +173,7 @@
<if test="pidPaths != null and pidPaths != ''"> pid_paths = #{pidPaths}, </if> <if test="pidPaths != null and pidPaths != ''"> pid_paths = #{pidPaths}, </if>
<if test="productId != null and productId != ''"> product_id = #{productId}, </if> <if test="productId != null and productId != ''"> product_id = #{productId}, </if>
<if test="lvl != null and lvl != ''"> lvl = #{lvl}, </if> <if test="lvl != null and lvl != ''"> lvl = #{lvl}, </if>
<if test="pbranchId != null and pbranchId != ''"> pbranch_id = #{pbranchId}, </if>
</sql> </sql>
<!--sql片段 批量更新 --> <!--sql片段 批量更新 -->
<sql id="batchSet"> <sql id="batchSet">
@ -179,6 +182,7 @@
pname = #{item.pname}, pname = #{item.pname},
pid_paths = #{item.pidPaths}, pid_paths = #{item.pidPaths},
product_id = #{item.productId}, product_id = #{item.productId},
lvl = #{item.lvl}
lvl = #{item.lvl},
pbranch_id = #{item.pbranchId}
</sql> </sql>
</mapper> </mapper>
Loading…
Cancel
Save