配件管理新增重复数据问题修改

This commit is contained in:
liang.chao 2024-10-22 20:49:38 +08:00
parent a83665da93
commit 1a1607f8cc
3 changed files with 15 additions and 1 deletions

View File

@ -56,5 +56,7 @@ public interface MaPartTypeMapper {
int checkPartName(String paName);
List<MaPartType> selectPartName(String paName);
List<MaPartType> selectPartNameByLevel(MaPartType maPartType);
}

View File

@ -42,6 +42,13 @@ public class MaPartTypeServiceImpl implements IPartTypeService {
// if (StringUtils.isNotNull(info) && info.getPaId().longValue() != paId.longValue()) {
// return UserConstants.NOT_UNIQUE;
// }
// 查询具有相同paName的所有MaPartType对象
if (maPartType.getLevel() != null && maPartType.getParentId() != null) {
List<MaPartType> maPartTypes = maPartTypeMapper.selectPartNameByLevel(maPartType);
if (maPartTypes.size() > 0) {
return UserConstants.NOT_UNIQUE;
}
}
// 查询具有相同paName的所有MaPartType对象
List<MaPartType> maPartTypes = maPartTypeMapper.selectPartName(maPartType.getPaName());
@ -142,7 +149,7 @@ public class MaPartTypeServiceImpl implements IPartTypeService {
String templateName = "template.xlsx";
OutputStream out = null;
InputStream input =null;
InputStream input = null;
try {
// ApplicationHome h = new ApplicationHome(getClass());
// String dirPath = h.getSource().toString();

View File

@ -197,5 +197,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from ma_part_type
where pa_name = #{paName}
</select>
<select id="selectPartNameByLevel" resultType="com.bonus.sgzb.base.domain.MaPartType">
select pa_id, pa_name, parent_id, status, num, unit_id, buy_price, level, warn_num, del_flag, create_by, create_time, remark, company_id
from ma_part_type
where pa_name = #{paName} and level = #{level} and parent_id = #{parentId}
</select>
</mapper>