sysGroupDao.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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="cn.ourwill.module.sys.dao.SysGroupDao">
  4. <resultMap type="cn.ourwill.module.sys.entity.SysGroup" id="baseMap">
  5. <result column="id" property="id"/>
  6. <result column="name" property="name"/>
  7. <result column="parentId" property="parentId"/>
  8. <result column="sort" property="sort"/>
  9. <result column="cTime" property="cTime"/>
  10. <result column="cId" property="cId"/>
  11. <result column="uTime" property="uTime"/>
  12. <result column="uId" property="uId"/>
  13. <result column="version" property="version"/>
  14. <result column="uuid" property="uuid"/>
  15. <result column="level" property="level"/>
  16. </resultMap>
  17. <sql id="columns">
  18. id ,
  19. name ,
  20. parentId ,
  21. sort ,
  22. cTime ,
  23. cId ,
  24. uTime ,
  25. uId ,
  26. version ,
  27. uuid,
  28. level
  29. </sql>
  30. <sql id="joinCols">
  31. </sql>
  32. <select id="get" resultMap="baseMap">
  33. SELECT
  34. <include refid="columns"/>
  35. FROM sys_group a
  36. <include refid="joinCols"/>
  37. WHERE a.id = #{id}
  38. </select>
  39. <select id="findList" resultMap="baseMap">
  40. SELECT
  41. <include refid="columns"/>
  42. FROM sys_group a
  43. <include refid="joinCols"/>
  44. <where>
  45. <if test="id !=null">
  46. and id = #{id}
  47. </if>
  48. <if test="name !=null">
  49. and `name` = #{name}
  50. </if>
  51. <if test="parentId !=null">
  52. and parentId = #{parentId}
  53. </if>
  54. <if test="sort !=null">
  55. and sort = #{sort}
  56. </if>
  57. <if test="cTime !=null">
  58. and cTime = #{cTime}
  59. </if>
  60. <if test="cId !=null">
  61. and cId = #{cId}
  62. </if>
  63. <if test="uTime !=null">
  64. and uTime = #{uTime}
  65. </if>
  66. <if test="uId !=null">
  67. and uId = #{uId}
  68. </if>
  69. <if test="version !=null">
  70. and version = #{version}
  71. </if>
  72. <if test="uuid !=null">
  73. and uuid = #{uuid}
  74. </if>
  75. <if test="uuid !=null">
  76. and level = #{level}
  77. </if>
  78. </where>
  79. <choose>
  80. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  81. ORDER BY ${page.orderBy}
  82. </when>
  83. <otherwise>
  84. </otherwise>
  85. </choose>
  86. </select>
  87. <select id="findAllList" resultMap="baseMap">
  88. SELECT
  89. <include refid="columns"/>
  90. FROM sys_group a
  91. <include refid="joinCols"/>
  92. <where>
  93. <if test="id !=null">
  94. and id = #{id}
  95. </if>
  96. <if test="name !=null">
  97. and `name` = #{name}
  98. </if>
  99. <if test="parentId !=null">
  100. and parentId = #{parentId}
  101. </if>
  102. <if test="sort !=null">
  103. and sort = #{sort}
  104. </if>
  105. <if test="cTime !=null">
  106. and cTime = #{cTime}
  107. </if>
  108. <if test="cId !=null">
  109. and cId = #{cId}
  110. </if>
  111. <if test="uTime !=null">
  112. and uTime = #{uTime}
  113. </if>
  114. <if test="uId !=null">
  115. and uId = #{uId}
  116. </if>
  117. <if test="version !=null">
  118. and version = #{version}
  119. </if>
  120. <if test="uuid !=null">
  121. and uuid = #{uuid}
  122. </if>
  123. <if test="uuid !=null">
  124. and level = #{level}
  125. </if>
  126. </where>
  127. <choose>
  128. <when test="page !=null and page.orderBy != null and page.orderBy != ''">
  129. ORDER BY ${page.orderBy}
  130. </when>
  131. <otherwise>
  132. </otherwise>
  133. </choose>
  134. </select>
  135. <insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true"
  136. parameterType="cn.ourwill.module.sys.entity.SysGroup">
  137. INSERT INTO sys_group
  138. <trim prefix="(" suffix=")" suffixOverrides=",">
  139. <if test=" id != null">
  140. id,
  141. </if>
  142. <if test=" name != null">
  143. name,
  144. </if>
  145. <if test=" parentId != null">
  146. parentId,
  147. </if>
  148. <if test=" sort != null">
  149. sort,
  150. </if>
  151. <if test=" cTime != null">
  152. cTime,
  153. </if>
  154. <if test=" cId != null">
  155. cId,
  156. </if>
  157. <if test=" uTime != null">
  158. uTime,
  159. </if>
  160. <if test=" uId != null">
  161. uId,
  162. </if>
  163. <if test=" version != null">
  164. version,
  165. </if>
  166. <if test=" uuid != null">
  167. uuid,
  168. </if>
  169. <if test="level !=null">
  170. level
  171. </if>
  172. </trim>
  173. <trim prefix="values (" suffix=")" suffixOverrides=",">
  174. <if test=" id != null">
  175. #{id}, </if>
  176. <if test=" name != null">
  177. #{name}, </if>
  178. <if test=" parentId != null">
  179. #{parentId}, </if>
  180. <if test=" sort != null">
  181. #{sort}, </if>
  182. <if test=" cTime != null">
  183. #{cTime}, </if>
  184. <if test=" cId != null">
  185. #{cId}, </if>
  186. <if test=" uTime != null">
  187. #{uTime}, </if>
  188. <if test=" uId != null">
  189. #{uId}, </if>
  190. <if test=" version != null">
  191. #{version}, </if>
  192. <if test=" uuid != null">
  193. #{uuid} </if>
  194. <if test=" level != null">
  195. #{level} </if>
  196. </trim>
  197. </insert>
  198. <update id="update" parameterType="cn.ourwill.module.sys.entity.SysGroup">
  199. UPDATE sys_group <set>
  200. <if test="id != null">
  201. id= #{id} ,
  202. </if>
  203. <if test="name != null">
  204. `name`= #{name} ,
  205. </if>
  206. <if test="parentId != null">
  207. parentId= #{parentId} ,
  208. </if>
  209. <if test="sort != null">
  210. sort= #{sort} ,
  211. </if>
  212. <if test="cTime != null">
  213. cTime= #{cTime} ,
  214. </if>
  215. <if test="cId != null">
  216. cId= #{cId} ,
  217. </if>
  218. <if test="uTime != null">
  219. uTime= #{uTime} ,
  220. </if>
  221. <if test="uId != null">
  222. uId= #{uId} ,
  223. </if>
  224. <if test="version != null">
  225. version= #{version} ,
  226. </if>
  227. <if test="uuid != null">
  228. uuid= #{uuid}
  229. </if>
  230. <if test=" level != null">
  231. level= #{level} </if>
  232. </set>
  233. WHERE id = #{id}
  234. </update>
  235. <delete id="deleteById" parameterType="java.lang.Long">
  236. DELETE FROM sys_group WHERE id = #{id}
  237. </delete>
  238. <delete id="deleteByIds" parameterType="java.util.List">
  239. DELETE FROM sys_group WHERE id IN
  240. <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  241. #{item}
  242. </foreach>
  243. </delete>
  244. <select id="getByParentId" resultMap="baseMap">
  245. SELECT
  246. <include refid="columns"/>
  247. FROM sys_group
  248. WHERE parentId = #{value}
  249. </select>
  250. <select id="getMaxId" resultType="Integer">
  251. SELECT
  252. max(id)
  253. FROM sys_group
  254. </select>
  255. </mapper>