Compare commits

..

No commits in common. "6ec984c510f2cf548dcbae4d818b9c8c49d622b4" and "c8f7b6baffc1255f67abd667b6506451f22cb6fe" have entirely different histories.

3 changed files with 0 additions and 24 deletions

View File

@ -2,7 +2,6 @@ package com.zhyc.module.base.mapper;
import com.zhyc.module.base.domain.BasSheepGroup; import com.zhyc.module.base.domain.BasSheepGroup;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
@ -65,8 +64,4 @@ public interface BasSheepGroupMapper
List<BasSheepGroup> selectLeafNodes(); List<BasSheepGroup> selectLeafNodes();
// 新增方法根据父节点和分组名称查询是否存在
BasSheepGroup selectByParentIdAndGroupName(@Param("parentId") Long parentId, @Param("groupName") String groupName);
} }

View File

@ -1,6 +1,5 @@
package com.zhyc.module.base.service.impl; package com.zhyc.module.base.service.impl;
import com.zhyc.common.exception.ServiceException;
import com.zhyc.common.utils.DateUtils; import com.zhyc.common.utils.DateUtils;
import com.zhyc.module.base.domain.BasSheepGroup; import com.zhyc.module.base.domain.BasSheepGroup;
import com.zhyc.module.base.mapper.BasSheepGroupMapper; import com.zhyc.module.base.mapper.BasSheepGroupMapper;
@ -69,12 +68,6 @@ public class BasSheepGroupServiceImpl implements IBasSheepGroupService
@Override @Override
public int insertBasSheepGroup(BasSheepGroup basSheepGroup) public int insertBasSheepGroup(BasSheepGroup basSheepGroup)
{ {
// 新增唯一性校验
BasSheepGroup existing = basSheepGroupMapper.selectByParentIdAndGroupName(
basSheepGroup.getParentId(), basSheepGroup.getGroupName());
if (existing != null) {
throw new ServiceException("同一分支下已存在该分组名称");
}
basSheepGroup.setCreateTime(DateUtils.getNowDate()); basSheepGroup.setCreateTime(DateUtils.getNowDate());
return basSheepGroupMapper.insertBasSheepGroup(basSheepGroup); return basSheepGroupMapper.insertBasSheepGroup(basSheepGroup);
} }
@ -88,12 +81,6 @@ public class BasSheepGroupServiceImpl implements IBasSheepGroupService
@Override @Override
public int updateBasSheepGroup(BasSheepGroup basSheepGroup) public int updateBasSheepGroup(BasSheepGroup basSheepGroup)
{ {
// 新增唯一性校验排除当前记录
BasSheepGroup existing = basSheepGroupMapper.selectByParentIdAndGroupName(
basSheepGroup.getParentId(), basSheepGroup.getGroupName());
if (existing != null && !existing.getGroupId().equals(basSheepGroup.getGroupId())) {
throw new ServiceException("同一分支下已存在该分组名称");
}
basSheepGroup.setUpdateTime(DateUtils.getNowDate()); basSheepGroup.setUpdateTime(DateUtils.getNowDate());
return basSheepGroupMapper.updateBasSheepGroup(basSheepGroup); return basSheepGroupMapper.updateBasSheepGroup(basSheepGroup);
} }

View File

@ -126,11 +126,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</delete> </delete>
<select id="selectByParentIdAndGroupName" resultMap="BasSheepGroupResult">
SELECT * FROM bas_sheep_group
WHERE parent_id = #{parentId} AND group_name = #{groupName}
LIMIT 1
</select>
</mapper> </mapper>