SysDictionaryMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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.SysDictionaryInpMapper" >
  4. <resultMap id="BaseResultMap" type="com.xinxin.topro.inpnurseservice.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. <sql id="Base_Column_List" >
  19. SD_ID, HI_ID, SD_DicDM, SD_DicName, SD_SupID, SD_IsDel, SD_PinyinCode, SD_WubiCode,
  20. SD_OtherCode, SD_Sort, UI_ID, SD_Update_Time
  21. </sql>
  22. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  23. select
  24. <include refid="Base_Column_List" />
  25. from sys_dictionary
  26. where SD_IsDel = 0 and SD_ID = #{sdId,jdbcType=INTEGER}
  27. </select>
  28. <select id="selectBySDDicDM" resultMap="BaseResultMap">
  29. select
  30. <include refid="Base_Column_List" />
  31. from sys_dictionary
  32. where SD_IsDel = 0 and SD_DicDM = #{SD_DicDM,jdbcType=VARCHAR} and (HI_ID = #{hiId,jdbcType=INTEGER} or HI_ID = 0 )
  33. </select>
  34. <select id="selectBySDDicCode" resultType="com.xinxin.topro.inpnurseservice.response.DictionaryInfoResponse"
  35. parameterType="java.lang.String">
  36. select T2.SDD_Detail_Code AS sddCode,T2.SDD_ID AS sddID,T2.SDD_Detail_Name AS sddName from sys_dictionary T
  37. LEFT JOIN sys_dictionary_detail T2
  38. on T2.SD_ID = T.SD_ID
  39. where T.SD_IsDel = 0 and T.SD_DicDM=#{sdDicDM,jdbcType=VARCHAR}
  40. and T2.SDD_IsDel = 0
  41. </select>
  42. <select id="selectNameBySdcode" resultType="java.lang.String"
  43. parameterType="com.xinxin.topro.inpnurseservice.vo.InpDictionarySelectNameByCodeVo">
  44. select T2.SDD_Detail_Name from sys_dictionary T
  45. LEFT JOIN sys_dictionary_detail T2
  46. on T2.SD_ID = T.SD_ID
  47. where T.SD_IsDel = 0
  48. and T2.SDD_Detail_Code=#{SdDicDM,jdbcType=VARCHAR}
  49. </select>
  50. <select id="selectAll" resultMap="BaseResultMap">
  51. select
  52. <include refid="Base_Column_List" />
  53. from sys_dictionary
  54. where SD_IsDel = 0
  55. </select>
  56. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  57. delete from sys_dictionary
  58. where SD_ID = #{sdId,jdbcType=INTEGER}
  59. </delete>
  60. <insert id="insertSelective" parameterType="com.xinxin.topro.inpnurseservice.mysqlmodel.SysDictionary" >
  61. insert into sys_dictionary
  62. <trim prefix="(" suffix=")" suffixOverrides="," >
  63. <if test="sdId != null" >
  64. SD_ID,
  65. </if>
  66. <if test="hiId != null" >
  67. HI_ID,
  68. </if>
  69. <if test="sdDicDM != null">
  70. SD_DicDM,
  71. </if>
  72. <if test="sdDicName != null">
  73. SD_DicName,
  74. </if>
  75. <if test="sdSupID != null">
  76. SD_SupID,
  77. </if>
  78. <if test="sdIsDel != null">
  79. SD_IsDel,
  80. </if>
  81. <if test="sdPinyinCode != null">
  82. SD_PinyinCode,
  83. </if>
  84. <if test="sdWubiCode != null">
  85. SD_WubiCode,
  86. </if>
  87. <if test="sdOtherCode != null">
  88. SD_OtherCode,
  89. </if>
  90. <if test="sdSort != null" >
  91. SD_Sort,
  92. </if>
  93. <if test="uiId != null" >
  94. UI_ID,
  95. </if>
  96. <if test="sdUpdateTime != null" >
  97. SD_Update_Time,
  98. </if>
  99. </trim>
  100. <trim prefix="values (" suffix=")" suffixOverrides="," >
  101. <if test="sdId != null" >
  102. #{sdId,jdbcType=INTEGER},
  103. </if>
  104. <if test="hiId != null" >
  105. #{hiId,jdbcType=INTEGER},
  106. </if>
  107. <if test="sdDicDM != null">
  108. #{sdDicDM,jdbcType=VARCHAR},
  109. </if>
  110. <if test="sdDicName != null">
  111. #{sdDicName,jdbcType=VARCHAR},
  112. </if>
  113. <if test="sdSupID != null">
  114. #{sdSupID,jdbcType=INTEGER},
  115. </if>
  116. <if test="sdIsDel != null">
  117. #{sdIsDel,jdbcType=INTEGER},
  118. </if>
  119. <if test="sdPinyinCode != null">
  120. #{sdPinyinCode,jdbcType=VARCHAR},
  121. </if>
  122. <if test="sdWubiCode != null">
  123. #{sdWubiCode,jdbcType=VARCHAR},
  124. </if>
  125. <if test="sdOtherCode != null">
  126. #{sdOtherCode,jdbcType=VARCHAR},
  127. </if>
  128. <if test="sdSort != null" >
  129. #{sdSort,jdbcType=INTEGER}, UPDATE
  130. </if>
  131. <if test="uiId != null" >
  132. #{uiId,jdbcType=VARCHAR},
  133. </if>
  134. <if test="sdUpdateTime != null" >
  135. #{sdUpdateTime,jdbcType=TIMESTAMP},
  136. </if>
  137. </trim>
  138. </insert>
  139. <update id="updateByPrimaryKeySelective" parameterType="com.xinxin.topro.inpnurseservice.mysqlmodel.SysDictionary" >
  140. update sys_dictionary
  141. <set >
  142. <if test="hiId != null" >
  143. HI_ID = #{hiId,jdbcType=INTEGER},
  144. </if>
  145. <if test="sdDicDM != null">
  146. SD_DicDM = #{sdDicDM,jdbcType=VARCHAR},
  147. </if>
  148. <if test="sdDicName != null">
  149. SD_DicName = #{sdDicName,jdbcType=VARCHAR},
  150. </if>
  151. <if test="sdSupID != null">
  152. SD_SupID = #{sdSupID,jdbcType=INTEGER},
  153. </if>
  154. <if test="sdIsDel != null">
  155. SD_IsDel = #{sdIsDel,jdbcType=INTEGER},
  156. </if>
  157. <if test="sdPinyinCode != null">
  158. SD_PinyinCode = #{sdPinyinCode,jdbcType=VARCHAR},
  159. </if>
  160. <if test="sdWubiCode != null">
  161. SD_WubiCode = #{sdWubiCode,jdbcType=VARCHAR},
  162. </if>
  163. <if test="sdOtherCode != null">
  164. SD_OtherCode = #{sdOtherCode,jdbcType=VARCHAR},
  165. </if>
  166. <if test="sdSort != null" >
  167. SD_Sort = #{sdSort,jdbcType=INTEGER},
  168. </if>
  169. <if test="uiId != null" >
  170. UI_ID = #{uiId,jdbcType=VARCHAR},
  171. </if>
  172. <if test="sdUpdateTime != null" >
  173. SD_Update_Time = #{sdUpdateTime,jdbcType=TIMESTAMP},
  174. </if>
  175. </set>
  176. where SD_ID = #{sdId,jdbcType=INTEGER}
  177. </update>
  178. <select id="selectByCode" resultMap="BaseResultMap">
  179. select
  180. <include refid="Base_Column_List" />
  181. from sys_dictionary
  182. where SD_IsDel = 0
  183. AND
  184. SD_DicDM = #{sdDicDM,jdbcType=VARCHAR}
  185. </select>
  186. <select id="selectListBySDDicCode" resultType="com.xinxin.topro.inpnurseservice.vo.DictionaryInfoResponseVo"
  187. parameterType="java.util.List">
  188. select T.SD_DicDM as sdCode,T2.SDD_Detail_Code AS sddCode,T2.SDD_ID AS sddID,T2.SDD_Detail_Name AS sddName from sys_dictionary T
  189. LEFT JOIN sys_dictionary_detail T2
  190. on T2.SD_ID = T.SD_ID
  191. <if test="sdDicDmList != null">
  192. where T.SD_IsDel = 0
  193. and T2.SDD_IsDel= 0
  194. and (T2.HI_ID = #{hiId,jdbcType=INTEGER} or T2.HI_ID = 0 )
  195. and T.SD_DicDM in
  196. <foreach item="sdDicDmList" index="index" collection="sdDicDmList" open="(" separator="," close=")">
  197. #{sdDicDmList}
  198. </foreach>
  199. </if>
  200. </select>
  201. <resultMap id="VOResultMap" type="com.xinxin.topro.inpnurseservice.vo.SysDictionaryVO" extends="BaseResultMap">
  202. <collection property="detailList" ofType="com.xinxin.topro.inpnurseservice.vo.SysDictionaryDetailVO">
  203. <result column="SDD_ID" property="sddId" jdbcType="INTEGER" />
  204. <result column="SDD_Detail_Code" property="sddDetailCode" jdbcType="VARCHAR" />
  205. <result column="SDD_Detail_Name" property="sddDetailName" jdbcType="VARCHAR" />
  206. <result column="SDD_PinyinCode" property="sddPinyincode" jdbcType="VARCHAR" />
  207. <result column="SDD_WubiCode" property="sddWubicode" jdbcType="VARCHAR" />
  208. <result column="SDD_OtherCode" property="sddOthercode" jdbcType="VARCHAR" />
  209. <result column="SDD_Sort" property="sddSort" jdbcType="INTEGER" />
  210. <result column="UI_ID" property="uiId" jdbcType="VARCHAR" />
  211. <result column="SDD_Update_Time" property="sddUpdateTime" jdbcType="TIMESTAMP" />
  212. <result column="SDD_IsDel" property="sddIsdel" jdbcType="INTEGER" />
  213. <result column="HI_ID" property="hiId" jdbcType="INTEGER" />
  214. </collection>
  215. </resultMap>
  216. <select id="getDetailByCodeList" resultMap="VOResultMap">
  217. select sd.SD_ID, SD_DicDM, SD_DicName, SDD_ID, SDD_Detail_Code, SDD_Detail_Name
  218. from sys_dictionary sd left join sys_dictionary_detail sdd on sd.SD_ID = sdd.SD_ID and sdd.SDD_IsDel = 0
  219. where sd.SD_DicDM in
  220. <foreach collection="list" item="item" separator="," open="(" close=")">
  221. #{item,jdbcType=VARCHAR}
  222. </foreach>
  223. and sd.SD_IsDel = 0
  224. and (sd.HI_ID = #{hiId,jdbcType=INTEGER} or sd.HI_ID = 0)
  225. order by sd.SD_ID, sdd.SDD_Sort
  226. </select>
  227. <select id="selectAllByHiId" resultType="com.xinxin.topro.base.vo.DictionaryPubVo">
  228. SELECT
  229. sd.SD_DicDM sdCode,
  230. sdd.SDD_Detail_Code sddCode,
  231. sdd.SDD_Detail_Name sddName
  232. FROM
  233. sys_dictionary sd
  234. INNER JOIN sys_dictionary_detail sdd ON sd.SD_ID = sdd.SD_ID
  235. WHERE sd.SD_IsDel = 0
  236. AND sdd.SDD_IsDel =0
  237. and (sd.HI_ID=0 or sd.HI_ID = #{hiId,jdbcType=INTEGER})
  238. </select>
  239. <select id="selectAllByHiIdAndCode" resultType="com.xinxin.topro.inpnurseservice.vo.DictionaryCodeVo">
  240. SELECT
  241. sd.SD_DicDM sdCode,
  242. sdd.SDD_Detail_Code sddCode,
  243. sdd.SDD_Detail_Name sddName,
  244. sdd.SDD_OtherCode sddOtherCode
  245. FROM
  246. sys_dictionary sd
  247. INNER JOIN sys_dictionary_detail sdd ON sd.SD_ID = sdd.SD_ID
  248. WHERE sd.SD_IsDel = 0
  249. AND sdd.SDD_IsDel =0
  250. and (sd.HI_ID=0 or sd.HI_ID = #{hiId,jdbcType=INTEGER})
  251. and sd.SD_DicDM in
  252. <foreach item="sdDicDmList" index="index" collection="sdDicDmList" open="(" separator="," close=")">
  253. #{sdDicDmList}
  254. </foreach>
  255. </select>
  256. <select id="selectListByCode" resultType="com.xinxin.topro.base.vo.DictionaryPubVo">
  257. SELECT
  258. sd.SD_DicDM sdCode,
  259. sdd.SDD_Detail_Code sddCode,
  260. sdd.SDD_Detail_Name sddName
  261. FROM
  262. sys_dictionary sd
  263. INNER JOIN sys_dictionary_detail sdd ON sd.SD_ID = sdd.SD_ID
  264. WHERE
  265. sd.SD_DicDM = #{sdDicDM,jdbcType=VARCHAR}
  266. AND sd.SD_IsDel = 0
  267. AND sdd.SDD_IsDel = 0
  268. AND (
  269. sdd.SDD_PinyinCode LIKE CONCAT(#{keyword,jdbcType=VARCHAR}, '%')
  270. OR sdd.SDD_WubiCode LIKE CONCAT(#{keyword,jdbcType=VARCHAR}, '%')
  271. OR sdd.SDD_Detail_Name LIKE CONCAT(#{keyword,jdbcType=VARCHAR}, '%')
  272. )
  273. </select>
  274. <select id="selectByCodes" resultType="java.lang.String">
  275. SELECT
  276. sdd.SDD_Detail_Code
  277. FROM
  278. sys_dictionary sd
  279. INNER JOIN sys_dictionary_detail sdd ON sd.SD_ID = sdd.SD_ID
  280. WHERE sd.SD_IsDel = 0
  281. AND sdd.SDD_IsDel =0
  282. AND sd.SD_DicDM in
  283. <foreach item="item" index="index" collection="codes" open="(" separator="," close=")">
  284. #{item}
  285. </foreach>
  286. </select>
  287. </mapper>