测试修改

This commit is contained in:
mashuai 2024-06-25 09:45:51 +08:00
parent 1311fea613
commit 2df173ba58
3 changed files with 15 additions and 7 deletions

View File

@ -82,5 +82,5 @@ public interface MaTypeMapper {
int deletePropSetByTypeId(Long typeId); int deletePropSetByTypeId(Long typeId);
int getMaType(MaType maType); MaType getMaType(MaType maType);
} }

View File

@ -72,8 +72,8 @@ public class MaTypeServiceImpl implements ITypeService {
maType.setCreateTime(DateUtils.getNowDate()); maType.setCreateTime(DateUtils.getNowDate());
//根据类型名称判重 //根据类型名称判重
if (maType.getTypeName() != null && maType.getParentId() != null) { if (maType.getTypeName() != null && maType.getParentId() != null) {
int num = maTypeMapper.getMaType(maType); MaType mapperMaType = maTypeMapper.getMaType(maType);
if (num > 0) { if (mapperMaType != null) {
throw new ServiceException("机具类型名称与库中重复,请修改后重新提交!"); throw new ServiceException("机具类型名称与库中重复,请修改后重新提交!");
} }
} }
@ -132,8 +132,8 @@ public class MaTypeServiceImpl implements ITypeService {
maType.setUpdateTime(DateUtils.getNowDate()); maType.setUpdateTime(DateUtils.getNowDate());
//根据类型名称判重 //根据类型名称判重
if (maType.getTypeName() != null && maType.getParentId() != null) { if (maType.getTypeName() != null && maType.getParentId() != null) {
int num = maTypeMapper.getMaType(maType); MaType mapperMaType = maTypeMapper.getMaType(maType);
if (num > 0) { if (mapperMaType != null && mapperMaType.getTypeId() != null && !mapperMaType.getTypeId().equals(maType.getTypeId())) {
throw new ServiceException("机具类型名称与库中重复,请修改后重新提交!"); throw new ServiceException("机具类型名称与库中重复,请修改后重新提交!");
} }
} }

View File

@ -416,8 +416,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
</where> </where>
</select> </select>
<select id="getMaType" resultType="java.lang.Integer"> <select id="getMaType" resultType="com.bonus.sgzb.base.api.domain.MaType">
select count(1) from ma_type where parent_id = #{parentId} and type_name = #{typeName} SELECT
type_id AS typeId,
type_name AS typeName,
parent_id AS parentId
FROM
ma_type
WHERE
parent_id = #{parentId} and type_name = #{typeName}
</select> </select>
</mapper> </mapper>