Commit d124ac74 by yao.xiao

优化sql

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