Commit d124ac74 by yao.xiao

优化sql

parent 87108f78
......@@ -522,12 +522,14 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
for (ObjectCollectionTagged tagged: taggeds) {
tagIds.add(Long.valueOf(tagged.getMdTagId()));
}
List<MdTag> mdTags = mdTagDALService.findByTagIdIn(tagIds);
for (MdTag mdTag:mdTags) {
OpportunityCustomerTag tag = new OpportunityCustomerTag();
tag.setTagId(mdTag.getId());
tag.setTagName(mdTag.getTagName());
tags.add(tag);
if (!tagIds.isEmpty()){
List<MdTag> mdTags = mdTagDALService.findByTagIdIn(tagIds);
for (MdTag mdTag:mdTags) {
OpportunityCustomerTag tag = new OpportunityCustomerTag();
tag.setTagId(mdTag.getId());
tag.setTagName(mdTag.getTagName());
tags.add(tag);
}
}
return tags;
}
......
......@@ -124,17 +124,12 @@
<include refid="Base_Column_List" />
from ag_md_tag
<where>
<choose>
<when test="tagIds != null and tagIds.size() > 0">
id in
<foreach item="item" collection="tagIds" separator="," open="(" close=")" index="index">
#{item}
</foreach>
</when>
<otherwise>
1 = 2
</otherwise>
</choose>
<if test="tagIds != null and tagIds.size() > 0">
id in
<foreach item="item" collection="tagIds" separator="," open="(" close=")" index="index">
#{item}
</foreach>
</if>
</where>
</select>
</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