KwsMenuRightsDao.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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. <insert id="insert" parameterType="com.sckw.system.model.KwsMenuRights">
  48. insert into kws_menu_rights
  49. <trim prefix="(" suffix=")" suffixOverrides=",">
  50. <if test="id != null">
  51. id,
  52. </if>
  53. <if test="entId != null">
  54. ent_id,
  55. </if>
  56. <if test="menuId != null">
  57. menu_id,
  58. </if>
  59. <if test="roleId != null">
  60. role_id,
  61. </if>
  62. <if test="remark != null">
  63. remark,
  64. </if>
  65. <if test="status != null">
  66. status,
  67. </if>
  68. <if test="createBy != null">
  69. create_by,
  70. </if>
  71. <if test="createTime != null">
  72. create_time,
  73. </if>
  74. <if test="updateBy != null">
  75. update_by,
  76. </if>
  77. <if test="updateTime != null">
  78. update_time,
  79. </if>
  80. <if test="delFlag != null">
  81. del_flag,
  82. </if>
  83. </trim>
  84. <trim prefix="values (" suffix=")" suffixOverrides=",">
  85. <if test="id != null">
  86. #{id,jdbcType=BIGINT},
  87. </if>
  88. <if test="entId != null">
  89. #{entId,jdbcType=BIGINT},
  90. </if>
  91. <if test="menuId != null">
  92. #{menuId,jdbcType=BIGINT},
  93. </if>
  94. <if test="roleId != null">
  95. #{roleId,jdbcType=BIGINT},
  96. </if>
  97. <if test="remark != null">
  98. #{remark,jdbcType=VARCHAR},
  99. </if>
  100. <if test="status != null">
  101. #{status,jdbcType=INTEGER},
  102. </if>
  103. <if test="createBy != null">
  104. #{createBy,jdbcType=BIGINT},
  105. </if>
  106. <if test="createTime != null">
  107. #{createTime,jdbcType=TIMESTAMP},
  108. </if>
  109. <if test="updateBy != null">
  110. #{updateBy,jdbcType=BIGINT},
  111. </if>
  112. <if test="updateTime != null">
  113. #{updateTime,jdbcType=TIMESTAMP},
  114. </if>
  115. <if test="delFlag != null">
  116. #{delFlag,jdbcType=INTEGER},
  117. </if>
  118. </trim>
  119. </insert>
  120. <insert id="saveBatch" parameterType="com.sckw.system.model.KwsMenuRights">
  121. insert into kws_menu_rights
  122. <trim prefix="(" suffix=")" suffixOverrides=",">
  123. id,
  124. ent_id,
  125. menu_id,
  126. role_id,
  127. remark,
  128. status,
  129. create_by,
  130. create_time,
  131. update_by,
  132. update_time,
  133. del_flag
  134. </trim>
  135. values
  136. <foreach collection="list" item="item" separator=",">
  137. <trim prefix="(" suffix=")" suffixOverrides=",">
  138. #{item.id,jdbcType=BIGINT},
  139. #{item.entId,jdbcType=BIGINT},
  140. #{item.menuId,jdbcType=BIGINT},
  141. #{item.roleId,jdbcType=BIGINT},
  142. #{item.remark,jdbcType=VARCHAR},
  143. #{item.status,jdbcType=INTEGER},
  144. #{item.createBy,jdbcType=BIGINT},
  145. #{item.createTime,jdbcType=TIMESTAMP},
  146. #{item.updateBy,jdbcType=BIGINT},
  147. #{item.updateTime,jdbcType=TIMESTAMP},
  148. #{item.delFlag,jdbcType=INTEGER}
  149. </trim>
  150. </foreach>
  151. </insert>
  152. <update id="update" parameterType="com.sckw.system.model.KwsMenuRights">
  153. update kws_menu_rights
  154. <set>
  155. <if test="entId != null">
  156. ent_id = #{entId,jdbcType=BIGINT},
  157. </if>
  158. <if test="menuId != null">
  159. menu_id = #{menuId,jdbcType=BIGINT},
  160. </if>
  161. <if test="roleId != null">
  162. role_id = #{roleId,jdbcType=BIGINT},
  163. </if>
  164. <if test="remark != null">
  165. remark = #{remark,jdbcType=VARCHAR},
  166. </if>
  167. <if test="status != null">
  168. status = #{status,jdbcType=INTEGER},
  169. </if>
  170. <if test="createBy != null">
  171. create_by = #{createBy,jdbcType=BIGINT},
  172. </if>
  173. <if test="createTime != null">
  174. create_time = #{createTime,jdbcType=TIMESTAMP},
  175. </if>
  176. <if test="updateBy != null">
  177. update_by = #{updateBy,jdbcType=BIGINT},
  178. </if>
  179. <if test="updateTime != null">
  180. update_time = #{updateTime,jdbcType=TIMESTAMP},
  181. </if>
  182. <if test="delFlag != null">
  183. del_flag = #{delFlag,jdbcType=INTEGER},
  184. </if>
  185. </set>
  186. where id = #{id,jdbcType=BIGINT}
  187. </update>
  188. </mapper>