KwsMenuRightsDao.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  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.sckw.system.dao.KwsMenuRightsDao">
  4. <resultMap id="BaseResultMap" type="com.sckw.system.model.KwsMenuRights">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="ent_id" jdbcType="BIGINT" property="entId" />
  7. <result column="menu_id" jdbcType="BIGINT" property="menuId" />
  8. <result column="role_id" jdbcType="BIGINT" property="roleId" />
  9. <result column="remark" jdbcType="VARCHAR" property="remark" />
  10. <result column="status" jdbcType="INTEGER" property="status" />
  11. <result column="create_by" jdbcType="BIGINT" property="createBy" />
  12. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  13. <result column="update_by" jdbcType="BIGINT" property="updateBy" />
  14. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  15. <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
  16. </resultMap>
  17. <sql id="Base_Column_List">
  18. id, ent_id, menu_id, role_id, remark, status, create_by, create_time, update_by,
  19. update_time, del_flag
  20. </sql>
  21. <delete id="deleteByIds">
  22. update kws_menu_rights
  23. set del_flag = 1
  24. where id in
  25. <foreach collection="list" open="(" close=")" separator="," item="item">
  26. #{item}
  27. </foreach>
  28. </delete>
  29. <select id="selectByKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  30. select
  31. <include refid="Base_Column_List" />
  32. from kws_menu_rights
  33. where id = #{id,jdbcType=BIGINT}
  34. </select>
  35. <select id="selectByRoleIds" resultType="com.sckw.system.model.KwsMenuRights">
  36. select
  37. <include refid="Base_Column_List" />
  38. from kws_menu_rights
  39. where del_flag = 0
  40. and role_id in
  41. <foreach collection="list" separator="," open="(" close=")" item="item">
  42. #{item}
  43. </foreach>
  44. </select>
  45. <select id="selectByMenuIds" resultType="com.sckw.system.model.KwsMenuRights">
  46. select
  47. <include refid="Base_Column_List" />
  48. from kws_menu_rights
  49. where del_flag = 0
  50. and menu_id in
  51. <foreach collection="list" separator="," open="(" close=")" item="item">
  52. #{item}
  53. </foreach>
  54. </select>
  55. <select id="selectEntMenus" resultType="com.sckw.system.model.KwsMenuRights">
  56. select * from kws_menu_rights where ent_id = #{id} and role_id is null and del_flag = 0
  57. </select>
  58. <insert id="insert" parameterType="com.sckw.system.model.KwsMenuRights">
  59. insert into kws_menu_rights
  60. <trim prefix="(" suffix=")" suffixOverrides=",">
  61. <if test="id != null">
  62. id,
  63. </if>
  64. <if test="entId != null">
  65. ent_id,
  66. </if>
  67. <if test="menuId != null">
  68. menu_id,
  69. </if>
  70. <if test="roleId != null">
  71. role_id,
  72. </if>
  73. <if test="remark != null">
  74. remark,
  75. </if>
  76. <if test="status != null">
  77. status,
  78. </if>
  79. <if test="createBy != null">
  80. create_by,
  81. </if>
  82. <if test="createTime != null">
  83. create_time,
  84. </if>
  85. <if test="updateBy != null">
  86. update_by,
  87. </if>
  88. <if test="updateTime != null">
  89. update_time,
  90. </if>
  91. <if test="delFlag != null">
  92. del_flag,
  93. </if>
  94. </trim>
  95. <trim prefix="values (" suffix=")" suffixOverrides=",">
  96. <if test="id != null">
  97. #{id,jdbcType=BIGINT},
  98. </if>
  99. <if test="entId != null">
  100. #{entId,jdbcType=BIGINT},
  101. </if>
  102. <if test="menuId != null">
  103. #{menuId,jdbcType=BIGINT},
  104. </if>
  105. <if test="roleId != null">
  106. #{roleId,jdbcType=BIGINT},
  107. </if>
  108. <if test="remark != null">
  109. #{remark,jdbcType=VARCHAR},
  110. </if>
  111. <if test="status != null">
  112. #{status,jdbcType=INTEGER},
  113. </if>
  114. <if test="createBy != null">
  115. #{createBy,jdbcType=BIGINT},
  116. </if>
  117. <if test="createTime != null">
  118. #{createTime,jdbcType=TIMESTAMP},
  119. </if>
  120. <if test="updateBy != null">
  121. #{updateBy,jdbcType=BIGINT},
  122. </if>
  123. <if test="updateTime != null">
  124. #{updateTime,jdbcType=TIMESTAMP},
  125. </if>
  126. <if test="delFlag != null">
  127. #{delFlag,jdbcType=INTEGER},
  128. </if>
  129. </trim>
  130. </insert>
  131. <insert id="saveBatch" parameterType="com.sckw.system.model.KwsMenuRights">
  132. insert into kws_menu_rights
  133. <trim prefix="(" suffix=")" suffixOverrides=",">
  134. id,
  135. ent_id,
  136. menu_id,
  137. role_id,
  138. remark,
  139. status,
  140. create_by,
  141. create_time,
  142. update_by,
  143. update_time,
  144. del_flag
  145. </trim>
  146. values
  147. <foreach collection="list" item="item" separator=",">
  148. <trim prefix="(" suffix=")" suffixOverrides=",">
  149. #{item.id,jdbcType=BIGINT},
  150. #{item.entId,jdbcType=BIGINT},
  151. #{item.menuId,jdbcType=BIGINT},
  152. <choose>
  153. <when test="item.roleId != null">
  154. #{item.roleId,jdbcType=BIGINT},
  155. </when>
  156. <otherwise>
  157. null,
  158. </otherwise>
  159. </choose>
  160. #{item.remark,jdbcType=VARCHAR},
  161. #{item.status,jdbcType=INTEGER},
  162. #{item.createBy,jdbcType=BIGINT},
  163. #{item.createTime,jdbcType=TIMESTAMP},
  164. #{item.updateBy,jdbcType=BIGINT},
  165. #{item.updateTime,jdbcType=TIMESTAMP},
  166. #{item.delFlag,jdbcType=INTEGER}
  167. </trim>
  168. </foreach>
  169. </insert>
  170. <update id="update" parameterType="com.sckw.system.model.KwsMenuRights">
  171. update kws_menu_rights
  172. <set>
  173. <if test="entId != null">
  174. ent_id = #{entId,jdbcType=BIGINT},
  175. </if>
  176. <if test="menuId != null">
  177. menu_id = #{menuId,jdbcType=BIGINT},
  178. </if>
  179. <if test="roleId != null">
  180. role_id = #{roleId,jdbcType=BIGINT},
  181. </if>
  182. <if test="remark != null">
  183. remark = #{remark,jdbcType=VARCHAR},
  184. </if>
  185. <if test="status != null">
  186. status = #{status,jdbcType=INTEGER},
  187. </if>
  188. <if test="createBy != null">
  189. create_by = #{createBy,jdbcType=BIGINT},
  190. </if>
  191. <if test="createTime != null">
  192. create_time = #{createTime,jdbcType=TIMESTAMP},
  193. </if>
  194. <if test="updateBy != null">
  195. update_by = #{updateBy,jdbcType=BIGINT},
  196. </if>
  197. <if test="updateTime != null">
  198. update_time = #{updateTime,jdbcType=TIMESTAMP},
  199. </if>
  200. <if test="delFlag != null">
  201. del_flag = #{delFlag,jdbcType=INTEGER},
  202. </if>
  203. </set>
  204. where id = #{id,jdbcType=BIGINT}
  205. </update>
  206. </mapper>