没有的字典值新增
This commit is contained in:
parent
d815c57f12
commit
7c6617626a
|
@ -64,4 +64,6 @@ public interface AchievementDictDataMapper
|
||||||
public int deleteAchievementDictDataByDictCodes(Long[] dictCodes);
|
public int deleteAchievementDictDataByDictCodes(Long[] dictCodes);
|
||||||
|
|
||||||
List<KeyValueVo> selectDictDataByType(@Param("dictType") String dictType);
|
List<KeyValueVo> selectDictDataByType(@Param("dictType") String dictType);
|
||||||
|
|
||||||
|
int selectDictDataByLabel(@Param("label") String label,@Param("type") String type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,8 +56,15 @@ public class AchievementDictDataServiceImpl implements IAchievementDictDataServi
|
||||||
public int insertAchievementDictData(AchievementDictData achievementDictData)
|
public int insertAchievementDictData(AchievementDictData achievementDictData)
|
||||||
{
|
{
|
||||||
//判断字典是否存在,存在则不管,不存在则新增
|
//判断字典是否存在,存在则不管,不存在则新增
|
||||||
achievementDictData.setCreateTime(DateUtils.getNowDate());
|
String label = achievementDictData.getDictLabel();
|
||||||
return achievementDictDataMapper.insertAchievementDictData(achievementDictData);
|
String type = achievementDictData.getDictType();
|
||||||
|
int num = achievementDictDataMapper.selectDictDataByLabel(label,type);
|
||||||
|
if (num > 0){
|
||||||
|
return 0;
|
||||||
|
}else{
|
||||||
|
achievementDictData.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return achievementDictDataMapper.insertAchievementDictData(achievementDictData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -95,6 +95,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="selectDictDataByType" resultType="com.microservices.dms.achievementLibrary.domain.KeyValueVo">
|
<select id="selectDictDataByType" resultType="com.microservices.dms.achievementLibrary.domain.KeyValueVo">
|
||||||
select dict_value as "key",dict_label as "value" from achievement_dict_data where dict_type = #{dictType}
|
select dict_code as "key",dict_label as "value" from achievement_dict_data where dict_type = #{dictType}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDictDataByLabel" resultType="int">
|
||||||
|
select count(1) from achievement_dict_data where dict_type = #{type} and dict_label = #{label}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue