没有的字典值新增
This commit is contained in:
parent
d815c57f12
commit
7c6617626a
|
@ -64,4 +64,6 @@ public interface AchievementDictDataMapper
|
|||
public int deleteAchievementDictDataByDictCodes(Long[] dictCodes);
|
||||
|
||||
List<KeyValueVo> selectDictDataByType(@Param("dictType") String dictType);
|
||||
|
||||
int selectDictDataByLabel(@Param("label") String label,@Param("type") String type);
|
||||
}
|
||||
|
|
|
@ -56,9 +56,16 @@ public class AchievementDictDataServiceImpl implements IAchievementDictDataServi
|
|||
public int insertAchievementDictData(AchievementDictData achievementDictData)
|
||||
{
|
||||
//判断字典是否存在,存在则不管,不存在则新增
|
||||
String label = achievementDictData.getDictLabel();
|
||||
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>
|
||||
|
||||
<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>
|
||||
</mapper>
|
Loading…
Reference in New Issue