Commit 3974d2b1 by wenyang

基础标签不能新增相同的标签类别的标签名称

parent 2d8e96f8
...@@ -68,6 +68,23 @@ public class AgmsTagServiceImpl implements AgmsTagService { ...@@ -68,6 +68,23 @@ public class AgmsTagServiceImpl implements AgmsTagService {
} }
} }
List<MdTagNew> tagNameCheck = mdTagNewDALService.selectByIdOrTagName(1L, requestVO.getTagName(), requestVO.getTagType(),null);
if(tagNameCheck != null && tagNameCheck.size() > 0){
if(!CommonUtil.isNullOrZero(requestVO.getId())){
if(!tagNameCheck.get(0).getId().toString().equals(requestVO.getId().toString())){
commonResult.setSuccess(false);
commonResult.setMessage(ZHBErrorConfig.getErrorInfo("830038"));
responseVO.setCommonResult(commonResult);
return responseVO;
}
}else{
commonResult.setSuccess(false);
commonResult.setMessage(ZHBErrorConfig.getErrorInfo("830038"));
responseVO.setCommonResult(commonResult);
return responseVO;
}
}
MdTagNew mdTagNew = new MdTagNew(); MdTagNew mdTagNew = new MdTagNew();
BeanUtils.copyProperties(requestVO,mdTagNew); BeanUtils.copyProperties(requestVO,mdTagNew);
if (CommonUtil.isNullOrZero(requestVO.getId())){ if (CommonUtil.isNullOrZero(requestVO.getId())){
......
...@@ -26,4 +26,7 @@ public interface MdTagNewMapper { ...@@ -26,4 +26,7 @@ public interface MdTagNewMapper {
List<MdTagNew> selectByIsActive(@Param("isActive")Long isActive,@Param("configLevel")Long configLevel,@Param("upperTagId")Long upperTagId,@Param("tagName")String tagName,@Param("tagType")Long tagType); List<MdTagNew> selectByIsActive(@Param("isActive")Long isActive,@Param("configLevel")Long configLevel,@Param("upperTagId")Long upperTagId,@Param("tagName")String tagName,@Param("tagType")Long tagType);
List<MdTagNew> selectByConfigLevelAndtagType(@Param("configLevel")Long configLevel,@Param("tagType")Long tagType); List<MdTagNew> selectByConfigLevelAndtagType(@Param("configLevel")Long configLevel,@Param("tagType")Long tagType);
List<MdTagNew> selectByIdOrTagName(@Param("isActive")Long isActive,@Param("tagName")String tagName,@Param("tagType")Long tagType,@Param("id")Long id);
} }
\ No newline at end of file
...@@ -17,4 +17,6 @@ public interface MdTagNewDALService { ...@@ -17,4 +17,6 @@ public interface MdTagNewDALService {
MdTagNew selectByPrimaryKey(Long id); MdTagNew selectByPrimaryKey(Long id);
List<MdTagNew> selectByConfigLevelAndtagType(Long configLevel, Long tagType); List<MdTagNew> selectByConfigLevelAndtagType(Long configLevel, Long tagType);
List<MdTagNew> selectByIdOrTagName(Long isActive,String tagName,Long tagType,Long id);
} }
...@@ -4,6 +4,7 @@ import java.util.List; ...@@ -4,6 +4,7 @@ import java.util.List;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.yd.dal.entity.meta.MdTagNew; import com.yd.dal.entity.meta.MdTagNew;
...@@ -44,5 +45,9 @@ public class MdTagNewDALServiceImpl implements MdTagNewDALService { ...@@ -44,5 +45,9 @@ public class MdTagNewDALServiceImpl implements MdTagNewDALService {
return mapper.selectByConfigLevelAndtagType(configLevel, tagType); return mapper.selectByConfigLevelAndtagType(configLevel, tagType);
} }
@Override
public List<MdTagNew> selectByIdOrTagName(Long isActive,String tagName,Long tagType,Long id) {
return mapper.selectByIdOrTagName(isActive,tagName,tagType,id);
}
} }
...@@ -52,3 +52,4 @@ ...@@ -52,3 +52,4 @@
830035=根据基础标签ID查找不到有效的基础标签! 830035=根据基础标签ID查找不到有效的基础标签!
830036=标签名称有值时标签级别不能为空! 830036=标签名称有值时标签级别不能为空!
830037=该标签类别已经有一级标签! 830037=该标签类别已经有一级标签!
830038=该标签类别已存在相同的标签名称!
\ No newline at end of file
...@@ -341,4 +341,26 @@ ...@@ -341,4 +341,26 @@
from ag_md_tag_new where is_active = 1 and config_level = #{configLevel,jdbcType=BIGINT} and tag_type = #{tagType,jdbcType=BIGINT} from ag_md_tag_new where is_active = 1 and config_level = #{configLevel,jdbcType=BIGINT} and tag_type = #{tagType,jdbcType=BIGINT}
</select> </select>
<select id="selectByIdOrTagName" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ag_md_tag_new t
<where>
1 = 1
<if test="isActive != null">
and t.is_active = #{isActive,jdbcType=BIGINT}
</if>
<if test="tagName != null">
and t.tag_name = #{tagName,jdbcType=VARCHAR}
</if>
<if test="tagType != null">
and t.tag_type = #{tagType,jdbcType=BIGINT}
</if>
<if test="id != null">
and t.id =#{id,jdbcType=BIGINT}
</if>
</where>
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment