dictionaryItemDao.xml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="platform.common.base.dao.DictionaryItemDao">
  4. <select id="getDictionaryItem" resultType="platform.common.base.model.DictionaryItem">
  5. select * from dictionary_item
  6. where del_flag=0
  7. <if test="name!=null and name!=''">
  8. and name=#{name}
  9. </if>
  10. <if test="value!=null and value!=''">
  11. and value=#{value}
  12. </if>
  13. <if test="typeId!=null">
  14. and tid=#{typeId}
  15. </if>
  16. limit 0,1
  17. </select>
  18. <select id="findByTypeAndValue" resultType="platform.common.base.model.DictionaryItem">
  19. select *
  20. from dictionary_item item
  21. left join dictionary_type dtype on item.tid = dtype.id
  22. where item.value=#{value} and dtype.name = #{typeName} and item.del_flag=0
  23. limit 0,1
  24. </select>
  25. <select id="findByTypeAndCondition" resultType="platform.common.base.model.DictionaryItem">
  26. select *
  27. from dictionary_item item
  28. left join dictionary_type dtype on item.tid = dtype.id
  29. where
  30. dtype.name = #{typeName}
  31. and item.del_flag=0
  32. <if test="itemCondition.name!=null and itemCondition.name!=''">
  33. and item.name=#{itemCondition.name}
  34. </if>
  35. <if test="itemCondition.is_active != null and itemCondition.is_active != '' ">
  36. and item.is_active=#{itemCondition.is_active}
  37. </if>
  38. <if test="itemCondition.value!=null and itemCondition.value!=''">
  39. and item.value=#{itemCondition.value}
  40. </if>
  41. order by item.create_time desc
  42. limit 0,1
  43. </select>
  44. </mapper>