SysWardPermissionMapper.xml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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.pubservice.mysqlmapper.SysWardPermissionMapper" >
  4. <resultMap id="BaseResultMap" type="com.xinxin.topro.pubservice.mysqlModel.SysWardPermission" >
  5. <id column="SWP_ID" property="swpId" jdbcType="INTEGER" />
  6. <result column="HI_ID" property="hiId" jdbcType="INTEGER" />
  7. <result column="DW_WardDm" property="dwWarddm" jdbcType="VARCHAR" />
  8. <result column="UI_Code" property="uiCode" jdbcType="VARCHAR" />
  9. <result column="SS_ID" property="ssId" jdbcType="INTEGER" />
  10. <result column="SWP_Recordor" property="swpRecordor" jdbcType="VARCHAR" />
  11. <result column="SWP_Record_Time" property="swpRecordTime" jdbcType="TIMESTAMP" />
  12. <result column="SWP_IsDel" property="swpIsdel" jdbcType="INTEGER" />
  13. <result column="SWP_IsDefault" property="swpIsdefault" jdbcType="INTEGER" />
  14. </resultMap>
  15. <resultMap id="ExtendsMap" type="com.xinxin.topro.pubservice.mysqlModel.SysWardPermissionVO" extends="BaseResultMap">
  16. <result column="RecordorName" property="recorderName" jdbcType="VARCHAR" />
  17. <result column="DW_WardName" property="wardName" jdbcType="VARCHAR" />
  18. </resultMap>
  19. <sql id="Base_Column_List" >
  20. SWP_ID, HI_ID, DW_WardDm, UI_Code, SS_ID, SWP_Recordor, SWP_Record_Time, SWP_IsDel,
  21. SWP_IsDefault
  22. </sql>
  23. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  24. select
  25. <include refid="Base_Column_List" />
  26. from sys_ward_permission
  27. where SWP_ID = #{swpId,jdbcType=INTEGER}
  28. </select>
  29. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  30. delete from sys_ward_permission
  31. where SWP_ID = #{swpId,jdbcType=INTEGER}
  32. </delete>
  33. <insert id="insert" parameterType="com.xinxin.topro.pubservice.mysqlModel.SysWardPermission" >
  34. insert into sys_ward_permission (SWP_ID, HI_ID, DW_WardDm,
  35. UI_Code, SS_ID, SWP_Recordor,
  36. SWP_Record_Time, SWP_IsDel, SWP_IsDefault
  37. )
  38. values (#{swpId,jdbcType=INTEGER}, #{hiId,jdbcType=INTEGER}, #{dwWarddm,jdbcType=VARCHAR},
  39. #{uiCode,jdbcType=VARCHAR}, #{ssId,jdbcType=INTEGER}, #{swpRecordor,jdbcType=VARCHAR},
  40. #{swpRecordTime,jdbcType=TIMESTAMP}, #{swpIsdel,jdbcType=INTEGER}, #{swpIsdefault,jdbcType=INTEGER}
  41. )
  42. </insert>
  43. <insert id="insertSelective" parameterType="com.xinxin.topro.pubservice.mysqlModel.SysWardPermission" >
  44. insert into sys_ward_permission
  45. <trim prefix="(" suffix=")" suffixOverrides="," >
  46. <if test="swpId != null" >
  47. SWP_ID,
  48. </if>
  49. <if test="hiId != null" >
  50. HI_ID,
  51. </if>
  52. <if test="dwWarddm != null" >
  53. DW_WardDm,
  54. </if>
  55. <if test="uiCode != null" >
  56. UI_Code,
  57. </if>
  58. <if test="ssId != null" >
  59. SS_ID,
  60. </if>
  61. <if test="swpRecordor != null" >
  62. SWP_Recordor,
  63. </if>
  64. <if test="swpRecordTime != null" >
  65. SWP_Record_Time,
  66. </if>
  67. <if test="swpIsdel != null" >
  68. SWP_IsDel,
  69. </if>
  70. <if test="swpIsdefault != null" >
  71. SWP_IsDefault,
  72. </if>
  73. </trim>
  74. <trim prefix="values (" suffix=")" suffixOverrides="," >
  75. <if test="swpId != null" >
  76. #{swpId,jdbcType=INTEGER},
  77. </if>
  78. <if test="hiId != null" >
  79. #{hiId,jdbcType=INTEGER},
  80. </if>
  81. <if test="dwWarddm != null" >
  82. #{dwWarddm,jdbcType=VARCHAR},
  83. </if>
  84. <if test="uiCode != null" >
  85. #{uiCode,jdbcType=VARCHAR},
  86. </if>
  87. <if test="ssId != null" >
  88. #{ssId,jdbcType=INTEGER},
  89. </if>
  90. <if test="swpRecordor != null" >
  91. #{swpRecordor,jdbcType=VARCHAR},
  92. </if>
  93. <if test="swpRecordTime != null" >
  94. #{swpRecordTime,jdbcType=TIMESTAMP},
  95. </if>
  96. <if test="swpIsdel != null" >
  97. #{swpIsdel,jdbcType=INTEGER},
  98. </if>
  99. <if test="swpIsdefault != null" >
  100. #{swpIsdefault,jdbcType=INTEGER},
  101. </if>
  102. </trim>
  103. </insert>
  104. <update id="updateByPrimaryKeySelective" parameterType="com.xinxin.topro.pubservice.mysqlModel.SysWardPermission" >
  105. update sys_ward_permission
  106. <set >
  107. <if test="hiId != null" >
  108. HI_ID = #{hiId,jdbcType=INTEGER},
  109. </if>
  110. <if test="dwWarddm != null" >
  111. DW_WardDm = #{dwWarddm,jdbcType=VARCHAR},
  112. </if>
  113. <if test="uiCode != null" >
  114. UI_Code = #{uiCode,jdbcType=VARCHAR},
  115. </if>
  116. <if test="ssId != null" >
  117. SS_ID = #{ssId,jdbcType=INTEGER},
  118. </if>
  119. <if test="swpRecordor != null" >
  120. SWP_Recordor = #{swpRecordor,jdbcType=VARCHAR},
  121. </if>
  122. <if test="swpRecordTime != null" >
  123. SWP_Record_Time = #{swpRecordTime,jdbcType=TIMESTAMP},
  124. </if>
  125. <if test="swpIsdel != null" >
  126. SWP_IsDel = #{swpIsdel,jdbcType=INTEGER},
  127. </if>
  128. <if test="swpIsdefault != null" >
  129. SWP_IsDefault = #{swpIsdefault,jdbcType=INTEGER},
  130. </if>
  131. </set>
  132. where SWP_ID = #{swpId,jdbcType=INTEGER}
  133. </update>
  134. <update id="updateByPrimaryKey" parameterType="com.xinxin.topro.pubservice.mysqlModel.SysWardPermission" >
  135. update sys_ward_permission
  136. set HI_ID = #{hiId,jdbcType=INTEGER},
  137. DW_WardDm = #{dwWarddm,jdbcType=VARCHAR},
  138. UI_Code = #{uiCode,jdbcType=VARCHAR},
  139. SS_ID = #{ssId,jdbcType=INTEGER},
  140. SWP_Recordor = #{swpRecordor,jdbcType=VARCHAR},
  141. SWP_Record_Time = #{swpRecordTime,jdbcType=TIMESTAMP},
  142. SWP_IsDel = #{swpIsdel,jdbcType=INTEGER},
  143. SWP_IsDefault = #{swpIsdefault,jdbcType=INTEGER}
  144. where SWP_ID = #{swpId,jdbcType=INTEGER}
  145. </update>
  146. <update id="updateByUiCode">
  147. update sys_ward_permission
  148. set SWP_IsDefault = 0
  149. where UI_Code = #{uiCode,jdbcType=VARCHAR} and SWP_IsDel = 0
  150. </update>
  151. <update id="updateByUiCodeAndWardDm">
  152. update sys_ward_permission
  153. set SWP_IsDefault = 1
  154. where UI_Code = #{uiCode,jdbcType=VARCHAR} and DW_WardDm = #{wardDm,jdbcType=VARCHAR} and SWP_IsDel = 0
  155. </update>
  156. <select id="selectByUiCode" resultMap="BaseResultMap" parameterType="java.lang.String" >
  157. select
  158. <include refid="Base_Column_List" />
  159. from sys_ward_permission
  160. where SWP_IsDel = 0 and UI_Code = #{uiCode,jdbcType=VARCHAR}
  161. </select>
  162. <select id="selectByUICode" resultMap="ExtendsMap" parameterType="java.lang.String">
  163. select <include refid="Base_Column_List"/>,
  164. (SELECT c.UI_Name from sys_userinfo c where c.UI_Code=a.SWP_Recordor) RecordorName,
  165. (SELECT b.DW_WardName from dic_ward b where b.DW_WardDm=a.DW_WardDm) DW_WardName
  166. from sys_ward_permission a
  167. where a.UI_Code = #{uiCode,jdbcType=VARCHAR} and SWP_IsDel=0
  168. </select>
  169. <insert id="addPermission" parameterType="com.xinxin.topro.pubservice.mysqlModel.SysWardPermission" >
  170. insert into sys_ward_permission (HI_ID, DW_WardDm,
  171. UI_Code, SS_ID, SWP_Recordor,
  172. SWP_Record_Time, SWP_IsDel, SWP_IsDefault
  173. )
  174. values (#{hiId,jdbcType=INTEGER}, #{dwWarddm,jdbcType=VARCHAR},
  175. #{uiCode,jdbcType=VARCHAR}, #{ssId,jdbcType=INTEGER}, #{swpRecordor,jdbcType=VARCHAR},
  176. now(), #{swpIsdel,jdbcType=INTEGER}, #{swpIsdefault,jdbcType=INTEGER}
  177. )
  178. </insert>
  179. <update id="delPermission" parameterType="java.lang.Integer">
  180. update sys_ward_permission set SWP_IsDel = -1 where SWP_ID = #{swpId,jdbcType=INTEGER}
  181. </update>
  182. </mapper>