KwsMenuRightsDao.xml 6.1 KB

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