DataDictionary.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <!-- namespace必须指向DAO接口 -->
  5. <mapper namespace="com.jpsoft.picc.modules.sys.dao.DataDictionaryDAO">
  6. <resultMap id="DataDictionaryMap" type="com.jpsoft.picc.modules.sys.entity.DataDictionary">
  7. <id property="id" column="id_" />
  8. <result property="name" column="name_" />
  9. <result property="value" column="value_" />
  10. <result property="sortNo" column="sort_no" />
  11. <result property="parentId" column="parent_id" />
  12. <result property="parentName" column="parent_name"/>
  13. <result property="dataType" column="data_type" />
  14. <result property="createBy" column="create_by" />
  15. <result property="createDate" column="create_date" />
  16. <result property="updateBy" column="update_by" />
  17. <result property="updateDate" column="update_date" />
  18. <result property="activated" column="activated_" />
  19. <result property="delFlag" column="del_flag"/>
  20. </resultMap>
  21. <insert id="insert" parameterType="com.jpsoft.picc.modules.sys.entity.DataDictionary">
  22. <!--
  23. <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
  24. select sys_guid() from dual
  25. </selectKey>
  26. -->
  27. <![CDATA[
  28. insert into sys_data_dictionary
  29. (id_,name_,value_,sort_no,parent_id,data_type,create_by,create_date,update_by,update_date,activated_,del_flag)
  30. values
  31. (
  32. #{id,jdbcType=VARCHAR}
  33. ,#{name,jdbcType=VARCHAR}
  34. ,#{value,jdbcType=VARCHAR}
  35. ,#{sortNo,jdbcType= NUMERIC }
  36. ,#{parentId,jdbcType=VARCHAR}
  37. ,#{dataType,jdbcType= NUMERIC }
  38. ,#{createBy,jdbcType=VARCHAR}
  39. ,#{createDate,jdbcType= TIMESTAMP }
  40. ,#{updateBy,jdbcType=VARCHAR}
  41. ,#{updateDate,jdbcType= TIMESTAMP }
  42. ,#{activated,jdbcType= NUMERIC }
  43. ,#{delFlag,jdbcType= NUMERIC }
  44. )
  45. ]]>
  46. </insert>
  47. <delete id="delete" parameterType="string">
  48. delete from sys_data_dictionary where id_=#{id,jdbcType=VARCHAR}
  49. </delete>
  50. <update id="update" parameterType="com.jpsoft.picc.modules.sys.entity.DataDictionary">
  51. update sys_data_dictionary
  52. <set>
  53. <if test="userName!=null">
  54. name_=#{name,jdbcType=VARCHAR},
  55. </if>
  56. <if test="value!=null">
  57. value_=#{value,jdbcType=VARCHAR},
  58. </if>
  59. <if test="sortNo!=null">
  60. sort_no=#{sortNo,jdbcType= NUMERIC },
  61. </if>
  62. <if test="parentId!=null">
  63. parent_id=#{parentId,jdbcType=VARCHAR},
  64. </if>
  65. <if test="dataType!=null">
  66. data_type=#{dataType,jdbcType= NUMERIC },
  67. </if>
  68. <if test="createBy!=null">
  69. create_by=#{createBy,jdbcType=VARCHAR},
  70. </if>
  71. <if test="createDate!=null">
  72. create_date=#{createDate,jdbcType= TIMESTAMP },
  73. </if>
  74. <if test="updateBy!=null">
  75. update_by=#{updateBy,jdbcType=VARCHAR},
  76. </if>
  77. <if test="updateDate!=null">
  78. update_date=#{updateDate,jdbcType= TIMESTAMP },
  79. </if>
  80. <if test="activated!=null">
  81. activated_=#{activated,jdbcType= NUMERIC },
  82. </if>
  83. <if test="delFlag!=null">
  84. del_flag=#{delFlag,jdbcType= NUMERIC },
  85. </if>
  86. </set>
  87. where id_=#{id}
  88. </update>
  89. <select id="get" parameterType="string" resultMap="DataDictionaryMap">
  90. select a.*,b.name_ as parent_name
  91. from sys_data_dictionary a left join sys_data_dictionary b on a.parent_id = b.id_
  92. where a.id_=#{0} and a.del_flag = 0
  93. </select>
  94. <select id="exist" parameterType="string" resultType="int">
  95. select count(*) from sys_data_dictionary where id_=#{0} and del_flag = 0
  96. </select>
  97. <select id="list" resultMap="DataDictionaryMap">
  98. select * from sys_data_dictionary where del_flag = 0
  99. </select>
  100. <select id="search" parameterType="hashmap" resultMap="DataDictionaryMap">
  101. <![CDATA[
  102. SELECT
  103. a.*,b.name_ AS parent_name
  104. FROM
  105. sys_data_dictionary a
  106. LEFT JOIN sys_data_dictionary b ON a.parent_id = b.id_
  107. ]]>
  108. <where>
  109. a.del_flag = 0
  110. <if test="searchParams.id != null">
  111. and a.ID_ like #{searchParams.id}
  112. </if>
  113. <if test="searchParams.userName != null">
  114. and a.name_ like #{searchParams.userName}
  115. </if>
  116. <if test="searchParams.excludeId != null">
  117. <![CDATA[
  118. and a.ID_ <> #{searchParams.excludeId}
  119. ]]>
  120. </if>
  121. <if test="searchParams.dataType != null">
  122. and a.data_type = #{searchParams.dataType}
  123. </if>
  124. </where>
  125. <foreach item="sort" collection="sortList" open="order by" separator=",">
  126. ${sort.name} ${sort.order}
  127. </foreach>
  128. </select>
  129. <select id="queryChildren" resultType="java.util.HashMap" parameterType="string" >
  130. SELECT
  131. a.id_ as id,a.name_ as userName,a.value_ as value
  132. FROM
  133. sys_data_dictionary a where a.del_flag = 0
  134. and data_type = 2
  135. and a.parent_id = #{0}
  136. </select>
  137. <select id="getName" parameterType="string" resultType="string">
  138. select a.name_ as userName
  139. from sys_data_dictionary a
  140. where a.id_=#{0} and a.del_flag = 0
  141. </select>
  142. <select id="getValue" parameterType="string" resultType="string">
  143. select a.value_ as value
  144. from sys_data_dictionary a
  145. where a.id_=#{0} and a.del_flag = 0
  146. </select>
  147. </mapper>