解决业务字典模块mapper层小bug。
This commit is contained in:
parent
bb2def0f4a
commit
dee2ecf79f
@ -234,16 +234,15 @@ public class XhpcDictBizServiceImpl implements IXhpcDictBizService{
|
||||
String value=xhpcDictionary.getDictValue();
|
||||
String codeValue=xhpcDictionary.getCode();
|
||||
|
||||
|
||||
// Judging the father item whether could insert.
|
||||
if(!value.equals(dictValue)){
|
||||
if(value!=null&&!value.equals(dictValue)){
|
||||
//Ensuring the name(dict_value) has existed.
|
||||
int size=xhpcDictBizMapper.countParentNameQuantity(dictValue);
|
||||
if(size>0){
|
||||
return AjaxResult.error("您输入的字典名称已经存在。");
|
||||
}
|
||||
}
|
||||
if(!codeValue.equals(code)){
|
||||
if(codeValue!=null&&!codeValue.equals(code)){
|
||||
//Ensuring the code whether has existed.
|
||||
int quantity=xhpcDictBizQuantityCheckMapper.countCodeRows(code);
|
||||
if(quantity>0){
|
||||
@ -324,12 +323,12 @@ public class XhpcDictBizServiceImpl implements IXhpcDictBizService{
|
||||
for(String value:idsArray){
|
||||
idsList.add(Long.parseLong(value));
|
||||
}
|
||||
|
||||
int size=xhpcDictBizMapper.deleteChildItemByIds(idsList);
|
||||
if(size==0){
|
||||
return AjaxResult.error("删除失败");
|
||||
}else {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -348,10 +347,12 @@ public class XhpcDictBizServiceImpl implements IXhpcDictBizService{
|
||||
}
|
||||
|
||||
//Deleting the parent's child.
|
||||
int sizeChild=xhpcDictBizMapper.deleteChildItemsAfterTheirParentDied(idsList);
|
||||
if(sizeChild==0){
|
||||
try {
|
||||
xhpcDictBizMapper.deleteChildItemsAfterTheirParentDied(idsList);
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("删除失败");
|
||||
}
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,11 +25,11 @@
|
||||
</select>
|
||||
|
||||
<select id="countParentNameColumns" resultType="java.lang.Integer">
|
||||
select count(dict_value) from xhpc_dict_biz where dict_value=#{name} and dict_biz_id=#{id};
|
||||
select count(dict_value) from xhpc_dict_biz where dict_value=#{name} and dict_biz_id=#{id} and del_flag=0
|
||||
</select>
|
||||
|
||||
<select id="countSameParentChildNameColumns" resultType="java.lang.Integer">
|
||||
select count(dict_value) from xhpc_dict_biz where parent_id=#{id} and dict_value=#{name}
|
||||
select count(dict_value) from xhpc_dict_biz where parent_id=#{id} and dict_value=#{name} and del_flag=0
|
||||
</select>
|
||||
|
||||
<insert id="insertAParentItemToTable">
|
||||
@ -88,17 +88,17 @@
|
||||
update xhpc_dict_biz set dict_key=#{key},dict_value=#{value},sort=#{sort} where dict_biz_id=#{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteChildItemByIds">
|
||||
<update id="deleteChildItemByIds">
|
||||
update xhpc_dict_biz set del_flag=1
|
||||
where
|
||||
dict_biz_id in
|
||||
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
</update>
|
||||
|
||||
<select id="countParentNameQuantity" resultType="java.lang.Integer">
|
||||
select count(dict_biz_id) from xhpc_dict_biz where dict_value=#{name}
|
||||
select count(dict_biz_id) from xhpc_dict_biz where dict_value=#{name} and del_flag=0
|
||||
</select>
|
||||
|
||||
<update id="updateChildCodeAfterParentChanged">
|
||||
@ -113,9 +113,4 @@
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -3,20 +3,18 @@
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.general.mapper.XhpcDictBizQuantityCheckMapper">
|
||||
<select id="countCodeRows" resultType="java.lang.Integer">
|
||||
select count(code) from xhpc_dict_biz where code=#{code}
|
||||
select count(code) from xhpc_dict_biz where code=#{code} and del_flag=0
|
||||
</select>
|
||||
|
||||
<select id="countSameParentChildValueColumns" resultType="java.lang.Integer">
|
||||
select count(dict_biz_id) from xhpc_dict_biz where parent_id=#{id} and dict_value=#{key}
|
||||
select count(dict_biz_id) from xhpc_dict_biz where parent_id=#{id} and dict_value=#{key} and del_flag=0
|
||||
</select>
|
||||
|
||||
<select id="countSameParentChildKeyColumns" resultType="java.lang.Integer">
|
||||
select count(dict_biz_id) from xhpc_dict_biz where parent_id=#{id} and dict_key=#{key}
|
||||
select count(dict_biz_id) from xhpc_dict_biz where parent_id=#{id} and dict_key=#{key} and del_flag=0
|
||||
</select>
|
||||
|
||||
<select id="countParentName" resultType="java.lang.Integer">
|
||||
select count(dict_biz_id) from xhpc_dict_biz where parent_id=0 and dict_value=#{name}
|
||||
select count(dict_biz_id) from xhpc_dict_biz where parent_id=0 and dict_value=#{name} and del_flag=0
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user