SysDictionaryDetailMapper.xml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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.inpnurseservice.mysqlmapper.SysDictionaryDetailInpMapper" >
  4. <resultMap id="BaseResultMap" type="com.xinxin.topro.inpnurseservice.mysqlmodel.SysDictionaryDetail" >
  5. <id column="SDD_ID" property="sddId" jdbcType="INTEGER" />
  6. <result column="SD_ID" property="sdId" jdbcType="INTEGER" />
  7. <result column="SDD_Detail_Code" property="sddDetailCode" jdbcType="VARCHAR" />
  8. <result column="SDD_Detail_Name" property="sddDetailName" jdbcType="VARCHAR" />
  9. <result column="SDD_PinyinCode" property="sddPinyincode" jdbcType="VARCHAR" />
  10. <result column="SDD_WubiCode" property="sddWubicode" jdbcType="VARCHAR" />
  11. <result column="SDD_OtherCode" property="sddOthercode" jdbcType="VARCHAR" />
  12. <result column="SDD_Sort" property="sddSort" jdbcType="INTEGER" />
  13. <result column="UI_ID" property="uiId" jdbcType="VARCHAR" />
  14. <result column="SDD_Update_Time" property="sddUpdateTime" jdbcType="TIMESTAMP" />
  15. <result column="SDD_IsDel" property="sddIsdel" jdbcType="INTEGER" />
  16. <result column="HI_ID" property="hiId" jdbcType="INTEGER" />
  17. <result column="pop_up" property="popUp" jdbcType="INTEGER" />
  18. <result column="sdd_remark" property="sddRemark" jdbcType="VARCHAR" />
  19. </resultMap>
  20. <sql id="Base_Column_List" >
  21. SDD_ID, SD_ID, SDD_Detail_Code, SDD_Detail_Name, SDD_PinyinCode, SDD_WubiCode, SDD_OtherCode,
  22. SDD_Sort, UI_ID, SDD_Update_Time, SDD_IsDel, HI_ID, pop_up, sdd_remark
  23. </sql>
  24. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  25. select
  26. <include refid="Base_Column_List" />
  27. from sys_dictionary_detail
  28. where SDD_IsDel = 0 and SDD_ID = #{sddId,jdbcType=INTEGER}
  29. </select>
  30. <select id="selectByDetailCode" resultMap="BaseResultMap" parameterType="java.lang.String" >
  31. select
  32. <include refid="Base_Column_List" />
  33. from sys_dictionary_detail
  34. where SDD_IsDel = 0 and SDD_Detail_Code = #{code,jdbcType=VARCHAR}
  35. and SD_ID in (45, 50) limit 1
  36. </select>
  37. <select id="selectBySDID" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  38. select
  39. <include refid="Base_Column_List" />
  40. from sys_dictionary_detail
  41. where SDD_IsDel = 0 and SD_ID = #{SD_ID,jdbcType=INTEGER}
  42. </select>
  43. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  44. delete from sys_dictionary_detail
  45. where SDD_ID = #{sddId,jdbcType=INTEGER}
  46. </delete>
  47. <insert id="insertSelective" parameterType="com.xinxin.topro.inpnurseservice.mysqlmodel.SysDictionaryDetail" >
  48. insert into sys_dictionary_detail
  49. <trim prefix="(" suffix=")" suffixOverrides="," >
  50. <if test="sddId != null" >
  51. SDD_ID,
  52. </if>
  53. <if test="sdId != null" >
  54. SD_ID,
  55. </if>
  56. <if test="sddDetailCode != null" >
  57. SDD_Detail_Code,
  58. </if>
  59. <if test="sddDetailName != null" >
  60. SDD_Detail_Name,
  61. </if>
  62. <if test="sddPinyincode != null" >
  63. SDD_PinyinCode,
  64. </if>
  65. <if test="sddWubicode != null" >
  66. SDD_WubiCode,
  67. </if>
  68. <if test="sddOthercode != null" >
  69. SDD_OtherCode,
  70. </if>
  71. <if test="sddSort != null" >
  72. SDD_Sort,
  73. </if>
  74. <if test="uiId != null" >
  75. UI_ID,
  76. </if>
  77. <if test="sddUpdateTime != null" >
  78. SDD_Update_Time,
  79. </if>
  80. <if test="sddIsdel != null" >
  81. SDD_IsDel,
  82. </if>
  83. <if test="hiId != null" >
  84. HI_ID,
  85. </if>
  86. <if test="popUp != null" >
  87. pop_up,
  88. </if>
  89. <if test="sddRemark != null" >
  90. sdd_remark,
  91. </if>
  92. </trim>
  93. <trim prefix="values (" suffix=")" suffixOverrides="," >
  94. <if test="sddId != null" >
  95. #{sddId,jdbcType=INTEGER},
  96. </if>
  97. <if test="sdId != null" >
  98. #{sdId,jdbcType=INTEGER},
  99. </if>
  100. <if test="sddDetailCode != null" >
  101. #{sddDetailCode,jdbcType=VARCHAR},
  102. </if>
  103. <if test="sddDetailName != null" >
  104. #{sddDetailName,jdbcType=VARCHAR},
  105. </if>
  106. <if test="sddPinyincode != null" >
  107. #{sddPinyincode,jdbcType=VARCHAR},
  108. </if>
  109. <if test="sddWubicode != null" >
  110. #{sddWubicode,jdbcType=VARCHAR},
  111. </if>
  112. <if test="sddOthercode != null" >
  113. #{sddOthercode,jdbcType=VARCHAR},
  114. </if>
  115. <if test="sddSort != null" >
  116. #{sddSort,jdbcType=INTEGER},
  117. </if>
  118. <if test="uiId != null" >
  119. #{uiId,jdbcType=VARCHAR},
  120. </if>
  121. <if test="sddUpdateTime != null" >
  122. #{sddUpdateTime,jdbcType=TIMESTAMP},
  123. </if>
  124. <if test="sddIsdel != null" >
  125. #{sddIsdel,jdbcType=INTEGER},
  126. </if>
  127. <if test="hiId != null" >
  128. #{hiId,jdbcType=INTEGER},
  129. </if>
  130. <if test="popUp != null" >
  131. #{popUp,jdbcType=INTEGER},
  132. </if>
  133. <if test="sddRemark != null" >
  134. #{sddRemark,jdbcType=VARCHAR},
  135. </if>
  136. </trim>
  137. </insert>
  138. <insert id="batchInsert">
  139. INSERT INTO sys_dictionary_detail ( SD_ID, SDD_Detail_Code, SDD_Detail_Name, SDD_PinyinCode, SDD_WubiCode, SDD_OtherCode,
  140. SDD_Sort, UI_ID, SDD_Update_Time, SDD_IsDel, HI_ID, pop_up, sdd_remark)
  141. VALUES
  142. <foreach collection="list" item="item" separator=",">
  143. ( #{item.sdId,jdbcType=INTEGER}, #{item.sddDetailCode,jdbcType=VARCHAR},
  144. #{item.sddDetailName,jdbcType=VARCHAR}, #{item.sddPinyincode,jdbcType=VARCHAR}, #{item.sddWubicode,jdbcType=VARCHAR},
  145. #{item.sddOthercode,jdbcType=VARCHAR}, #{item.sddSort,jdbcType=INTEGER}, #{item.uiId,jdbcType=VARCHAR},
  146. #{item.sddUpdateTime,jdbcType=TIMESTAMP}, #{item.sddIsdel,jdbcType=INTEGER},#{item.hiId,jdbcType=INTEGER}, #{item.popUp,jdbcType=INTEGER}, #{item.sddRemark,jdbcType=VARCHAR})
  147. </foreach>
  148. </insert>
  149. <update id="updateByPrimaryKeySelective" parameterType="com.xinxin.topro.inpnurseservice.mysqlmodel.SysDictionaryDetail" >
  150. update sys_dictionary_detail
  151. <set >
  152. <if test="sdId != null" >
  153. SD_ID = #{sdId,jdbcType=INTEGER},
  154. </if>
  155. <if test="sddDetailCode != null" >
  156. SDD_Detail_Code = #{sddDetailCode,jdbcType=VARCHAR},
  157. </if>
  158. <if test="sddDetailName != null" >
  159. SDD_Detail_Name = #{sddDetailName,jdbcType=VARCHAR},
  160. </if>
  161. <if test="sddPinyincode != null" >
  162. SDD_PinyinCode = #{sddPinyincode,jdbcType=VARCHAR},
  163. </if>
  164. <if test="sddWubicode != null" >
  165. SDD_WubiCode = #{sddWubicode,jdbcType=VARCHAR},
  166. </if>
  167. <if test="sddOthercode != null" >
  168. SDD_OtherCode = #{sddOthercode,jdbcType=VARCHAR},
  169. </if>
  170. <if test="sddSort != null" >
  171. SDD_Sort = #{sddSort,jdbcType=INTEGER},
  172. </if>
  173. <if test="uiId != null" >
  174. UI_ID = #{uiId,jdbcType=VARCHAR},
  175. </if>
  176. <if test="sddUpdateTime != null" >
  177. SDD_Update_Time = #{sddUpdateTime,jdbcType=TIMESTAMP},
  178. </if>
  179. <if test="sddIsdel != null" >
  180. SDD_IsDel = #{sddIsdel,jdbcType=INTEGER},
  181. </if>
  182. <if test="hiId != null" >
  183. HI_ID = #{hiId,jdbcType=INTEGER},
  184. </if>
  185. <if test="popUp != null" >
  186. pop_up = #{popUp,jdbcType=INTEGER},
  187. </if>
  188. <if test="sddRemark != null" >
  189. sdd_remark = #{sddRemark,jdbcType=VARCHAR},
  190. </if>
  191. </set>
  192. where SDD_ID = #{sddId,jdbcType=INTEGER}
  193. </update>
  194. <select id="getDetailByCode" resultMap="BaseResultMap">
  195. select <include refid="Base_Column_List"/>
  196. from sys_dictionary_detail sdd
  197. where sdd.SDD_IsDel = 0
  198. and exists(select 1 from sys_dictionary sd
  199. where sd.SD_DicDM = #{sdDicDM,jdbcType=VARCHAR}
  200. and sd.SD_IsDel = 0
  201. and (sd.HI_ID = #{hiId,jdbcType=INTEGER} or sd.HI_ID = 0)
  202. and sd.SD_ID = sdd.SD_ID
  203. )
  204. order by SDD_Sort
  205. </select>
  206. <select id="getResponse" resultType="com.xinxin.topro.inpnurseservice.response.DictinoryResponse">
  207. SELECT sd.SD_DicDM AS sdDicDm, sdd.SDD_Detail_Code AS sddDetailCode, sdd.SDD_Detail_Name AS sddDetailName FROM sys_dictionary sd
  208. INNER JOIN sys_dictionary_detail sdd ON sd.SD_ID = sdd.SD_ID
  209. WHERE sd.SD_IsDel = 0
  210. AND sdd.SDD_IsDel = 0
  211. AND (sd.HI_ID = #{hiId,jdbcType=INTEGER} OR sd.HI_ID = 0)
  212. AND sd.SD_DicDM IN
  213. <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
  214. #{item, jdbcType=VARCHAR}
  215. </foreach>
  216. </select>
  217. </mapper>