SysDictionaryMapper.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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="com.xinxin.topro.sysservice.dao.mysqlmapper.SysDictionaryInpMapper" >
  4. <resultMap id="BaseResultMap" type="com.xinxin.topro.sysservice.dao.mysqlmodel.SysDictionary" >
  5. <id column="SD_ID" property="sdId" jdbcType="INTEGER" />
  6. <result column="HI_ID" property="hiId" jdbcType="INTEGER" />
  7. <result column="SD_DicDM" property="sdDicDM" jdbcType="VARCHAR"/>
  8. <result column="SD_DicName" property="sdDicName" jdbcType="VARCHAR"/>
  9. <result column="SD_SupID" property="sdSupID" jdbcType="INTEGER"/>
  10. <result column="SD_IsDel" property="sdIsDel" jdbcType="INTEGER"/>
  11. <result column="SD_PinyinCode" property="sdPinyinCode" jdbcType="VARCHAR"/>
  12. <result column="SD_WubiCode" property="sdWubiCode" jdbcType="VARCHAR"/>
  13. <result column="SD_OtherCode" property="sdOtherCode" jdbcType="VARCHAR"/>
  14. <result column="SD_Sort" property="sdSort" jdbcType="INTEGER" />
  15. <result column="UI_ID" property="uiId" jdbcType="VARCHAR" />
  16. <result column="SD_Update_Time" property="sdUpdateTime" jdbcType="TIMESTAMP" />
  17. </resultMap>
  18. <resultMap id="HashMap" type="com.xinxin.topro.sysservice.vo.SysDictionaryVO" >
  19. <collection property="list" ofType="com.xinxin.topro.sysservice.dao.mysqlmodel.SysDictionaryDetail">
  20. <id column="SDD_ID" property="sddId" jdbcType="INTEGER" />
  21. <result column="SD_ID" property="sdId" jdbcType="INTEGER" />
  22. <result column="SDD_Detail_Code" property="sddDetailCode" jdbcType="VARCHAR" />
  23. <result column="SDD_Detail_Name" property="sddDetailName" jdbcType="VARCHAR" />
  24. <result column="SDD_PinyinCode" property="sddPinyincode" jdbcType="VARCHAR" />
  25. <result column="SDD_WubiCode" property="sddWubicode" jdbcType="VARCHAR" />
  26. <result column="SDD_OtherCode" property="sddOthercode" jdbcType="VARCHAR" />
  27. <result column="SDD_Sort" property="sddSort" jdbcType="INTEGER" />
  28. <result column="UI_ID" property="uiId" jdbcType="VARCHAR" />
  29. <result column="SDD_Update_Time" property="sddUpdateTime" jdbcType="TIMESTAMP" />
  30. <result column="SDD_IsDel" property="sddIsdel" jdbcType="INTEGER" />
  31. </collection>
  32. </resultMap>
  33. <sql id="Base_Column_List" >
  34. SD_ID, HI_ID, SD_DicDM, SD_DicName, SD_SupID, SD_IsDel, SD_PinyinCode, SD_WubiCode,
  35. SD_OtherCode, SD_Sort, UI_ID, SD_Update_Time
  36. </sql>
  37. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  38. select
  39. <include refid="Base_Column_List" />
  40. from sys_dictionary
  41. where SD_IsDel = 0 and SD_ID = #{sdId,jdbcType=INTEGER}
  42. </select>
  43. <select id="selectBySDDicDM" resultMap="BaseResultMap" parameterType="java.lang.String" >
  44. select
  45. <include refid="Base_Column_List" />
  46. from sys_dictionary
  47. where SD_IsDel = 0 and SD_DicDM = #{SD_DicDM,jdbcType=VARCHAR}
  48. </select>
  49. <select id="selectBySDDicCode" resultType="com.xinxin.topro.sysservice.response.DictionaryInfoResponse"
  50. parameterType="java.lang.String">
  51. select T2.SDD_Detail_Code AS sddCode,T2.SDD_ID AS sddID,T2.SDD_Detail_Name AS sddName from sys_dictionary T
  52. LEFT JOIN sys_dictionary_detail T2
  53. on T2.SD_ID = T.SD_ID
  54. where T.SD_IsDel = 0 and T.SD_DicDM=#{sdDicDM,jdbcType=VARCHAR}
  55. </select>
  56. <select id="selectNameBySdcode" resultType="java.lang.String" parameterType="java.lang.String">
  57. select T2.SDD_Detail_Name from sys_dictionary T
  58. LEFT JOIN sys_dictionary_detail T2
  59. on T2.SD_ID = T.SD_ID
  60. where T.SD_IsDel = 0 and T2.SDD_Detail_Code=#{sdDicDM,jdbcType=VARCHAR}
  61. </select>
  62. <select id="selectAll" resultMap="BaseResultMap">
  63. select
  64. <include refid="Base_Column_List" />
  65. from sys_dictionary
  66. where SD_IsDel = 0
  67. and (HI_ID = #{hiId,jdbcType=INTEGER} or HI_ID = 0)
  68. </select>
  69. <insert id="insert" parameterType="com.xinxin.topro.sysservice.dao.mysqlmodel.SysDictionary" useGeneratedKeys="true" keyProperty="sdId">
  70. insert into sys_dictionary(HI_ID, SD_DicDM, SD_DicName, SD_SupID, SD_IsDel, SD_PinyinCode, SD_WubiCode,
  71. SD_OtherCode, SD_Sort, UI_ID, SD_Update_Time)
  72. values(#{hiId,jdbcType=INTEGER},#{sdDicDM,jdbcType=VARCHAR},#{sdDicName,jdbcType=VARCHAR},
  73. #{sdSupID,jdbcType=INTEGER},0,#{sdPinyinCode,jdbcType=VARCHAR},#{sdWubiCode,jdbcType=VARCHAR},
  74. #{sdOtherCode,jdbcType=VARCHAR},#{sdSort,jdbcType=INTEGER}, #{uiId,jdbcType=VARCHAR},now())
  75. </insert>
  76. <update id="updateByPrimaryKeySelective" parameterType="com.xinxin.topro.sysservice.dao.mysqlmodel.SysDictionary" >
  77. update sys_dictionary
  78. <set >
  79. <if test="sdDicDM != null">
  80. SD_DicDM = #{sdDicDM,jdbcType=VARCHAR},
  81. </if>
  82. <if test="sdDicName != null">
  83. SD_DicName = #{sdDicName,jdbcType=VARCHAR},
  84. </if>
  85. <if test="sdSupID != null">
  86. SD_SupID = #{sdSupID,jdbcType=INTEGER},
  87. </if>
  88. <if test="sdIsDel != null">
  89. SD_IsDel = #{sdIsDel,jdbcType=INTEGER},
  90. </if>
  91. <if test="sdPinyinCode != null">
  92. SD_PinyinCode = #{sdPinyinCode,jdbcType=VARCHAR},
  93. </if>
  94. <if test="sdWubiCode != null">
  95. SD_WubiCode = #{sdWubiCode,jdbcType=VARCHAR},
  96. </if>
  97. <if test="sdOtherCode != null">
  98. SD_OtherCode = #{sdOtherCode,jdbcType=VARCHAR},
  99. </if>
  100. <if test="sdSort != null" >
  101. SD_Sort = #{sdSort,jdbcType=INTEGER},
  102. </if>
  103. <if test="uiId != null" >
  104. UI_ID = #{uiId,jdbcType=VARCHAR},
  105. </if>
  106. SD_Update_Time = now()
  107. </set>
  108. where SD_ID = #{sdId,jdbcType=INTEGER}
  109. </update>
  110. <select id="selectByCode" resultMap="BaseResultMap">
  111. select
  112. <include refid="Base_Column_List" />
  113. from sys_dictionary
  114. where SD_IsDel = 0
  115. AND
  116. SD_DicDM = #{sdDicDM,jdbcType=VARCHAR}
  117. </select>
  118. <select id="selectPart" resultMap="HashMap">
  119. SELECT
  120. sdd.SDD_Detail_Code,
  121. sdd.SDD_Detail_Name,
  122. sd.SD_DicDM,
  123. sd.SD_DicName,
  124. sd.SD_ID,
  125. sdd.SDD_ID
  126. FROM
  127. sys_dictionary sd,
  128. sys_dictionary_detail sdd
  129. <where>
  130. sd.SD_ID = sdd.SD_ID
  131. AND sdd.SDD_IsDel = 0
  132. AND sd.SD_IsDel = 0
  133. and (sd.HI_ID = #{hiId,jdbcType=INTEGER} or sd.HI_ID = 0)
  134. <if test="sddDetailName != null and sddDetailName != '' ">
  135. and (SDD_Detail_Name like concat('%',#{sddDetailName,jdbcType=VARCHAR},'%')
  136. or SDD_Detail_Code like concat('%',#{sddDetailName,jdbcType=VARCHAR},'%')
  137. or SDD_PinyinCode like concat('%',#{sddDetailName,jdbcType=VARCHAR},'%')
  138. or SDD_WubiCode like concat('%',#{sddDetailName,jdbcType=VARCHAR},'%'))
  139. </if>
  140. AND sd.SD_DicDM in
  141. <foreach collection="list" separator="," open="(" close=")" item="item">
  142. #{item}
  143. </foreach>
  144. order by sd.SD_Sort
  145. </where>
  146. </select>
  147. <select id="selectByHiId" resultMap="BaseResultMap">
  148. select
  149. <include refid="Base_Column_List" />
  150. from sys_dictionary
  151. where (HI_ID = #{hiId,jdbcType=INTEGER} or HI_ID = 0)
  152. and SD_IsDel = 0
  153. order by SD_Sort
  154. </select>
  155. <select id="countByCodeExcludeId" resultType="java.lang.Integer">
  156. select count(1) from sys_dictionary
  157. where SD_DicDM = #{sdDicCode,jdbcType=VARCHAR}
  158. <if test="sdId != null">
  159. and SD_ID != #{sdId,jdbcType=INTEGER}
  160. </if>
  161. </select>
  162. <select id="countBySupId" resultType="java.lang.Integer">
  163. select count(1) from sys_dictionary
  164. where SD_SupID = #{sdSupId,jdbcType=INTEGER}
  165. and SD_IsDel = 0
  166. </select>
  167. <update id="deleteBySdId">
  168. update sys_dictionary set
  169. SD_IsDel = -1,
  170. SD_Update_Time = now(),
  171. UI_ID = #{uiId,jdbcType=VARCHAR}
  172. where SD_ID = #{sdId,jdbcType=INTEGER}
  173. </update>
  174. </mapper>