DictBizMapper.xml 2.4 KB

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