RolePermitMapper.xml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  4. <mapper namespace="com.zhyc.xps.sys.mapper.RolePermitMapper">
  5. <resultMap id="RolePermitDtoResultMap" type="com.zhyc.xps.sys.dto.RolePermitDto" >
  6. <result column="client_id" property="clientId" jdbcType="BIGINT" />
  7. <result column="role_id" property="roleId" jdbcType="BIGINT" />
  8. <result column="permit_id" property="permitId" jdbcType="BIGINT" />
  9. <result column="permit_title" property="permitTitle" jdbcType="VARCHAR"/>
  10. <result column="permit_code" property="permitCode" jdbcType="VARCHAR"/>
  11. <result column="permit_entry" property="permitEntry" jdbcType="VARCHAR"/>
  12. <result column="permit_desc" property="permitDesc" jdbcType="VARCHAR"/>
  13. <result column="permit_type" property="permitType" jdbcType="BIGINT"/>
  14. <result column="parent_id" property="parentId" jdbcType="BIGINT" />
  15. <result column="root_id" property="rootId" jdbcType="BIGINT" />
  16. <result column="sort_no" property="sortNo" jdbcType="BIGINT" />
  17. <result column="is_home" property="isHome" jdbcType="BIGINT" />
  18. </resultMap>
  19. <sql id="RolePermitDto_Cols">
  20. A.client_id,
  21. A.role_id,
  22. A.permit_id,
  23. A.permit_title,
  24. A.permit_code,
  25. A.permit_entry,
  26. A.permit_desc,
  27. A.permit_type,
  28. A.parent_id,
  29. A.root_id,
  30. A.sort_no,
  31. A.is_home
  32. </sql>
  33. <!--列表查询-->
  34. <select id="getByList" resultMap="RolePermitDtoResultMap" >
  35. SELECT
  36. <include refid="RolePermitDto_Cols"/>
  37. FROM s_role_permit AS A
  38. WHERE 1 = 1
  39. <if test="clientId != null">
  40. AND A.client_id = #{clientId,jdbcType=BIGINT}
  41. </if>
  42. <if test="roleId != null">
  43. AND A.role_id = #{roleId,jdbcType=BIGINT}
  44. </if>
  45. <if test="permitId != null">
  46. AND A.permit_id = #{permitId ,jdbcType=BIGINT}
  47. </if>
  48. ORDER BY A.parent_id ASC ,A.sort_no ASC
  49. </select>
  50. <!--基于ID查询-->
  51. <select id="getById" resultMap="RolePermitDtoResultMap" >
  52. SELECT
  53. <include refid="RolePermitDto_Cols"/>
  54. FROM s_role_permit AS A
  55. WHERE 1 = 1
  56. <if test="clientId != null">
  57. AND A.client_id = #{clientId,jdbcType=BIGINT}
  58. </if>
  59. <if test="roleId != null">
  60. AND A.role_id = #{roleId,jdbcType=BIGINT}
  61. </if>
  62. <if test="permitId != null">
  63. AND A.permit_id = #{permitId ,jdbcType=BIGINT}
  64. </if>
  65. ORDER BY A.parent_id ASC ,A.sort_no ASC
  66. </select>
  67. <!--新增-->
  68. <insert id="create" parameterType="com.zhyc.xps.sys.entity.RolePermit">
  69. INSERT INTO s_role_permit
  70. <trim prefix="(" suffix=")" suffixOverrides=",">
  71. <if test="clientId != null">
  72. client_id,
  73. </if>
  74. <if test="roleId != null">
  75. role_id,
  76. </if>
  77. <if test="permitId != null">
  78. permit_id,
  79. </if>
  80. <if test="permitTitle != null and permitTitle != ''">
  81. permit_title,
  82. </if>
  83. <if test="permitCode != null and permitCode != ''">
  84. permit_code,
  85. </if>
  86. <if test="permitEntry != null and permitEntry != ''">
  87. permit_entry,
  88. </if>
  89. <if test="permitDesc != null and permitDesc != ''">
  90. permit_desc,
  91. </if>
  92. <if test="permitType != null">
  93. permit_type,
  94. </if>
  95. <if test="parentId != null">
  96. parent_id,
  97. </if>
  98. <if test="rootId != null">
  99. root_id,
  100. </if>
  101. <if test="sortNo != null">
  102. sort_no,
  103. </if>
  104. <if test="createdBy != null">
  105. created_by,
  106. </if>
  107. <if test="createdAt != null">
  108. created_at,
  109. </if>
  110. </trim>
  111. <trim prefix="values (" suffix=")" suffixOverrides=",">
  112. <if test="clientId != null">
  113. #{clientId ,jdbcType=BIGINT},
  114. </if>
  115. <if test="roleId != null">
  116. #{roleId ,jdbcType=BIGINT},
  117. </if>
  118. <if test="permitId != null">
  119. #{permitId ,jdbcType=BIGINT},
  120. </if>
  121. <if test="permitTitle != null and permitTitle != ''">
  122. #{permitTitle ,jdbcType=VARCHAR},
  123. </if>
  124. <if test="permitCode != null and permitCode != ''">
  125. #{permitCode ,jdbcType=VARCHAR},
  126. </if>
  127. <if test="permitEntry != null and permitEntry != ''">
  128. #{permitEntry ,jdbcType=VARCHAR},
  129. </if>
  130. <if test="permitDesc != null and permitDesc != ''">
  131. #{permitDesc ,jdbcType=VARCHAR},
  132. </if>
  133. <if test="permitType != null">
  134. #{permitType ,jdbcType=BIGINT},
  135. </if>
  136. <if test="parentId != null">
  137. #{parentId ,jdbcType=BIGINT},
  138. </if>
  139. <if test="rootId != null">
  140. #{rootId ,jdbcType=BIGINT},
  141. </if>
  142. <if test="sortNo != null">
  143. #{sortNo ,jdbcType=BIGINT},
  144. </if>
  145. <if test="createdBy != null">
  146. #{createdBy ,jdbcType=BIGINT},
  147. </if>
  148. <if test="createdAt != null">
  149. #{createdAt ,jdbcType=TIMESTAMP},
  150. </if>
  151. </trim>
  152. </insert>
  153. <!--更新-->
  154. <update id="update" parameterType="com.zhyc.xps.sys.entity.RolePermit">
  155. update s_role_permit
  156. <set>
  157. <if test="permitTitle != null and permitTitle != ''">
  158. permit_title = #{permitTitle, jdbcType=VARCHAR},
  159. </if>
  160. <if test="permitCode != null and permitCode != ''">
  161. permit_code = #{permitCode, jdbcType=VARCHAR},
  162. </if>
  163. <if test="permitEntry != null and permitEntry != ''">
  164. permit_entry = #{permitEntry ,jdbcType=VARCHAR},
  165. </if>
  166. <if test="permitDesc != null and permitDesc != ''">
  167. permit_desc = #{permitDesc, jdbcType=VARCHAR},
  168. </if>
  169. <if test="permitType != null">
  170. permit_type = #{permitType ,jdbcType=BIGINT},
  171. </if>
  172. <if test="parentId != null">
  173. parent_id = #{parentId ,jdbcType=BIGINT},
  174. </if>
  175. <if test="rootId != null">
  176. root_id = #{rootId ,jdbcType=BIGINT},
  177. </if>
  178. <if test="sortNo != null">
  179. sort_no = #{sortNo ,jdbcType=BIGINT},
  180. </if>
  181. <if test="updatedBy != null">
  182. updated_by = #{updatedBy ,jdbcType=BIGINT},
  183. </if>
  184. <if test="updatedAt != null">
  185. updated_at = #{updatedAt ,jdbcType=TIMESTAMP},
  186. </if>
  187. </set>
  188. WHERE 1 = 1
  189. <if test="clientId != null">
  190. AND client_id = #{clientId , jdbcType=BIGINT}
  191. </if>
  192. <if test="roleId != null">
  193. AND role_id = #{roleId , jdbcType=BIGINT}
  194. </if>
  195. <if test="permitId != null">
  196. AND permit_id = #{permitId , jdbcType=BIGINT}
  197. </if>
  198. </update>
  199. <!--删除-->
  200. <delete id="delete" parameterType="java.util.Map">
  201. DELETE
  202. FROM s_role_permit
  203. WHERE 1 = 1
  204. <if test="clientId != null">
  205. AND client_id = #{clientId , jdbcType=BIGINT}
  206. </if>
  207. <if test="roleId != null">
  208. AND role_id = #{roleId , jdbcType=BIGINT}
  209. </if>
  210. <if test="permitId != null">
  211. AND permit_id = #{permitId , jdbcType=BIGINT}
  212. </if>
  213. </delete>
  214. </mapper>