DictMapper.xml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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="org.springblade.system.mapper.DictMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="dictResultMap" type="org.springblade.system.entity.Dict">
  6. <id column="id" property="id"/>
  7. <result column="parent_id" property="parentId"/>
  8. <result column="code" property="code"/>
  9. <result column="dict_key" property="dictKey"/>
  10. <result column="dict_value" property="dictValue"/>
  11. <result column="sort" property="sort"/>
  12. <result column="remark" property="remark"/>
  13. <result column="is_deleted" property="isDeleted"/>
  14. </resultMap>
  15. <resultMap id="treeNodeResultMap" type="org.springblade.core.tool.node.TreeNode">
  16. <id column="id" property="id"/>
  17. <result column="parent_id" property="parentId"/>
  18. <result column="title" property="title"/>
  19. <result column="value" property="value"/>
  20. <result column="key" property="key"/>
  21. </resultMap>
  22. <select id="selectDictPage" resultMap="dictResultMap">
  23. select * from blade_dict where is_deleted = 0
  24. </select>
  25. <select id="getValue" resultType="java.lang.String">
  26. select dict_value
  27. from blade_dict where code = #{param1} and dict_key = #{param2} and is_deleted = 0
  28. </select>
  29. <!-- oracle 版本 -->
  30. <!--<select id="getValue" resultType="java.lang.String">
  31. select
  32. dict_value
  33. from blade_dict where code = #{param1, jdbcType=VARCHAR} and dict_key = #{param2} and dict_key >= 0 rownum 1
  34. </select>-->
  35. <select id="getList" resultMap="dictResultMap">
  36. select id, parent_id, code, dict_key, dict_value, sort, remark
  37. from blade_dict
  38. where code = #{param1}
  39. and parent_id > 0
  40. and is_sealed = 0
  41. and is_deleted = 0
  42. order by sort
  43. </select>
  44. <select id="tree" resultMap="treeNodeResultMap">
  45. select id, parent_id, dict_value as title, id as "value", id as "key" from blade_dict where is_deleted = 0
  46. </select>
  47. <select id="parentTree" resultMap="treeNodeResultMap">
  48. select id, parent_id, dict_value as title, id as "value", id as "key"
  49. from blade_dict
  50. where is_deleted = 0
  51. and parent_id = 0
  52. </select>
  53. <select id="getList2" resultType="org.springblade.system.vo.DictVO02">
  54. select dict_key AS "id", dict_value AS "title"
  55. from blade_dict
  56. where code = #{param1}
  57. and parent_id > 0
  58. and is_sealed = 0
  59. and is_deleted = 0
  60. </select>
  61. </mapper>