RoleInfoMapper.xml 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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.chinaitop.depot.business.mapper.RoleInfoMapper" >
  4. <resultMap id="BaseResultMap" type="com.chinaitop.depot.business.model.RoleInfo" >
  5. <id column="role_id" property="roleId" jdbcType="INTEGER" />
  6. <result column="role_name" property="roleName" jdbcType="VARCHAR" />
  7. <result column="parent_id" property="parentId" jdbcType="INTEGER" />
  8. <result column="remark" property="remark" jdbcType="VARCHAR" />
  9. <result column="del_flag" property="delFlag" jdbcType="INTEGER" />
  10. <result column="org_id" property="orgId" jdbcType="INTEGER" />
  11. </resultMap>
  12. <sql id="Example_Where_Clause" >
  13. <where >
  14. <foreach collection="oredCriteria" item="criteria" separator="or" >
  15. <if test="criteria.valid" >
  16. <trim prefix="(" suffix=")" prefixOverrides="and" >
  17. <foreach collection="criteria.criteria" item="criterion" >
  18. <choose >
  19. <when test="criterion.noValue" >
  20. and ${criterion.condition}
  21. </when>
  22. <when test="criterion.singleValue" >
  23. and ${criterion.condition} #{criterion.value}
  24. </when>
  25. <when test="criterion.betweenValue" >
  26. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  27. </when>
  28. <when test="criterion.listValue" >
  29. and ${criterion.condition}
  30. <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
  31. #{listItem}
  32. </foreach>
  33. </when>
  34. </choose>
  35. </foreach>
  36. </trim>
  37. </if>
  38. </foreach>
  39. </where>
  40. </sql>
  41. <sql id="Update_By_Example_Where_Clause" >
  42. <where >
  43. <foreach collection="example.oredCriteria" item="criteria" separator="or" >
  44. <if test="criteria.valid" >
  45. <trim prefix="(" suffix=")" prefixOverrides="and" >
  46. <foreach collection="criteria.criteria" item="criterion" >
  47. <choose >
  48. <when test="criterion.noValue" >
  49. and ${criterion.condition}
  50. </when>
  51. <when test="criterion.singleValue" >
  52. and ${criterion.condition} #{criterion.value}
  53. </when>
  54. <when test="criterion.betweenValue" >
  55. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  56. </when>
  57. <when test="criterion.listValue" >
  58. and ${criterion.condition}
  59. <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
  60. #{listItem}
  61. </foreach>
  62. </when>
  63. </choose>
  64. </foreach>
  65. </trim>
  66. </if>
  67. </foreach>
  68. </where>
  69. </sql>
  70. <sql id="Base_Column_List" >
  71. role_id, role_name, parent_id, remark, del_flag, org_id
  72. </sql>
  73. <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.business.model.RoleInfoExample" >
  74. select
  75. <if test="distinct" >
  76. distinct
  77. </if>
  78. <include refid="Base_Column_List" />
  79. from role_info
  80. <if test="_parameter != null" >
  81. <include refid="Example_Where_Clause" />
  82. </if>
  83. <if test="orderByClause != null" >
  84. order by ${orderByClause}
  85. </if>
  86. </select>
  87. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  88. select
  89. <include refid="Base_Column_List" />
  90. from role_info
  91. where role_id = #{roleId,jdbcType=INTEGER}
  92. </select>
  93. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  94. delete from role_info
  95. where role_id = #{roleId,jdbcType=INTEGER}
  96. </delete>
  97. <delete id="deleteByExample" parameterType="com.chinaitop.depot.business.model.RoleInfoExample" >
  98. delete from role_info
  99. <if test="_parameter != null" >
  100. <include refid="Example_Where_Clause" />
  101. </if>
  102. </delete>
  103. <insert id="insert" parameterType="com.chinaitop.depot.business.model.RoleInfo" >
  104. insert into role_info (role_id, role_name, parent_id,
  105. remark, del_flag, org_id
  106. )
  107. values (#{roleId,jdbcType=INTEGER}, #{roleName,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER},
  108. #{remark,jdbcType=VARCHAR}, #{delFlag,jdbcType=INTEGER}, #{orgId,jdbcType=INTEGER}
  109. )
  110. </insert>
  111. <insert id="insertSelective" parameterType="com.chinaitop.depot.business.model.RoleInfo" >
  112. insert into role_info
  113. <trim prefix="(" suffix=")" suffixOverrides="," >
  114. <if test="roleId != null" >
  115. role_id,
  116. </if>
  117. <if test="roleName != null" >
  118. role_name,
  119. </if>
  120. <if test="parentId != null" >
  121. parent_id,
  122. </if>
  123. <if test="remark != null" >
  124. remark,
  125. </if>
  126. <if test="delFlag != null" >
  127. del_flag,
  128. </if>
  129. <if test="orgId != null" >
  130. org_id,
  131. </if>
  132. </trim>
  133. <trim prefix="values (" suffix=")" suffixOverrides="," >
  134. <if test="roleId != null" >
  135. #{roleId,jdbcType=INTEGER},
  136. </if>
  137. <if test="roleName != null" >
  138. #{roleName,jdbcType=VARCHAR},
  139. </if>
  140. <if test="parentId != null" >
  141. #{parentId,jdbcType=INTEGER},
  142. </if>
  143. <if test="remark != null" >
  144. #{remark,jdbcType=VARCHAR},
  145. </if>
  146. <if test="delFlag != null" >
  147. #{delFlag,jdbcType=INTEGER},
  148. </if>
  149. <if test="orgId != null" >
  150. #{orgId,jdbcType=INTEGER},
  151. </if>
  152. </trim>
  153. </insert>
  154. <select id="countByExample" parameterType="com.chinaitop.depot.business.model.RoleInfoExample" resultType="java.lang.Integer" >
  155. select count(*) from role_info
  156. <if test="_parameter != null" >
  157. <include refid="Example_Where_Clause" />
  158. </if>
  159. </select>
  160. <update id="updateByExampleSelective" parameterType="map" >
  161. update role_info
  162. <set >
  163. <if test="record.roleId != null" >
  164. role_id = #{record.roleId,jdbcType=INTEGER},
  165. </if>
  166. <if test="record.roleName != null" >
  167. role_name = #{record.roleName,jdbcType=VARCHAR},
  168. </if>
  169. <if test="record.parentId != null" >
  170. parent_id = #{record.parentId,jdbcType=INTEGER},
  171. </if>
  172. <if test="record.remark != null" >
  173. remark = #{record.remark,jdbcType=VARCHAR},
  174. </if>
  175. <if test="record.delFlag != null" >
  176. del_flag = #{record.delFlag,jdbcType=INTEGER},
  177. </if>
  178. <if test="record.orgId != null" >
  179. org_id = #{record.orgId,jdbcType=INTEGER},
  180. </if>
  181. </set>
  182. <if test="_parameter != null" >
  183. <include refid="Update_By_Example_Where_Clause" />
  184. </if>
  185. </update>
  186. <update id="updateByExample" parameterType="map" >
  187. update role_info
  188. set role_id = #{record.roleId,jdbcType=INTEGER},
  189. role_name = #{record.roleName,jdbcType=VARCHAR},
  190. parent_id = #{record.parentId,jdbcType=INTEGER},
  191. remark = #{record.remark,jdbcType=VARCHAR},
  192. del_flag = #{record.delFlag,jdbcType=INTEGER},
  193. org_id = #{record.orgId,jdbcType=INTEGER}
  194. <if test="_parameter != null" >
  195. <include refid="Update_By_Example_Where_Clause" />
  196. </if>
  197. </update>
  198. <update id="updateByPrimaryKeySelective" parameterType="com.chinaitop.depot.business.model.RoleInfo" >
  199. update role_info
  200. <set >
  201. <if test="roleName != null" >
  202. role_name = #{roleName,jdbcType=VARCHAR},
  203. </if>
  204. <if test="parentId != null" >
  205. parent_id = #{parentId,jdbcType=INTEGER},
  206. </if>
  207. <if test="remark != null" >
  208. remark = #{remark,jdbcType=VARCHAR},
  209. </if>
  210. <if test="delFlag != null" >
  211. del_flag = #{delFlag,jdbcType=INTEGER},
  212. </if>
  213. <if test="orgId != null" >
  214. org_id = #{orgId,jdbcType=INTEGER},
  215. </if>
  216. </set>
  217. where role_id = #{roleId,jdbcType=INTEGER}
  218. </update>
  219. <update id="updateByPrimaryKey" parameterType="com.chinaitop.depot.business.model.RoleInfo" >
  220. update role_info
  221. set role_name = #{roleName,jdbcType=VARCHAR},
  222. parent_id = #{parentId,jdbcType=INTEGER},
  223. remark = #{remark,jdbcType=VARCHAR},
  224. del_flag = #{delFlag,jdbcType=INTEGER},
  225. org_id = #{orgId,jdbcType=INTEGER}
  226. where role_id = #{roleId,jdbcType=INTEGER}
  227. </update>
  228. </mapper>