KwsMenuDao.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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.KwsMenuDao">
  4. <resultMap id="BaseResultMap" type="com.sckw.system.model.KwsMenu">
  5. <id column="id" jdbcType="BIGINT" property="id" />
  6. <result column="client_type" jdbcType="INTEGER" property="clientType" />
  7. <result column="parent_id" jdbcType="BIGINT" property="parentId" />
  8. <result column="name" jdbcType="VARCHAR" property="name" />
  9. <result column="url" jdbcType="VARCHAR" property="url" />
  10. <result column="perms" jdbcType="VARCHAR" property="perms" />
  11. <result column="type" jdbcType="INTEGER" property="type" />
  12. <result column="icon" jdbcType="VARCHAR" property="icon" />
  13. <result column="sort" jdbcType="INTEGER" property="sort" />
  14. <result column="level" jdbcType="INTEGER" property="level" />
  15. <result column="custom" jdbcType="INTEGER" property="custom" />
  16. <result column="is_main" jdbcType="INTEGER" property="isMain" />
  17. <result column="is_display" jdbcType="INTEGER" property="isDisplay" />
  18. <result column="using_roles" jdbcType="VARCHAR" property="usingRoles" />
  19. <result column="remark" jdbcType="VARCHAR" property="remark" />
  20. <result column="status" jdbcType="INTEGER" property="status" />
  21. <result column="create_by" jdbcType="BIGINT" property="createBy" />
  22. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  23. <result column="update_by" jdbcType="BIGINT" property="updateBy" />
  24. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  25. <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
  26. </resultMap>
  27. <sql id="Base_Column_List">
  28. sm.id,
  29. sm.client_type,
  30. sm.parent_id,
  31. sm.name,
  32. sm.url,
  33. sm.perms,
  34. sm.type,
  35. sm.icon,
  36. sm.sort,
  37. sm.level,
  38. sm.custom,
  39. sm.links,
  40. sm.is_main,
  41. sm.using_roles,
  42. sm.remark,
  43. sm.status,
  44. sm.create_by,
  45. sm.create_time,
  46. sm.update_by,
  47. sm.update_time,
  48. sm.del_flag
  49. </sql>
  50. <select id="selectByKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  51. select
  52. <include refid="Base_Column_List" />
  53. from kws_menu sm
  54. where id = #{id,jdbcType=BIGINT}
  55. </select>
  56. <insert id="insert" parameterType="com.sckw.system.model.KwsMenu">
  57. insert into kws_menu
  58. <trim prefix="(" suffix=")" suffixOverrides=",">
  59. <if test="id != null">
  60. id,
  61. </if>
  62. <if test="clientType != null">
  63. client_type,
  64. </if>
  65. <if test="parentId != null">
  66. parent_id,
  67. </if>
  68. <if test="name != null">
  69. name,
  70. </if>
  71. <if test="url != null">
  72. url,
  73. </if>
  74. <if test="links != null">
  75. links,
  76. </if>
  77. <if test="perms != null">
  78. perms,
  79. </if>
  80. <if test="type != null">
  81. type,
  82. </if>
  83. <if test="icon != null">
  84. icon,
  85. </if>
  86. <if test="sort != null">
  87. sort,
  88. </if>
  89. <if test="level != null">
  90. level,
  91. </if>
  92. <if test="custom != null">
  93. custom,
  94. </if>
  95. <if test="isMain != null">
  96. is_main,
  97. </if>
  98. <if test="isDisplay != null">
  99. is_display,
  100. </if>
  101. <if test="usingRoles != null">
  102. using_roles,
  103. </if>
  104. <if test="remark != null">
  105. remark,
  106. </if>
  107. <if test="status != null">
  108. status,
  109. </if>
  110. <if test="createBy != null">
  111. create_by,
  112. </if>
  113. <if test="createTime != null">
  114. create_time,
  115. </if>
  116. <if test="updateBy != null">
  117. update_by,
  118. </if>
  119. <if test="updateTime != null">
  120. update_time,
  121. </if>
  122. <if test="delFlag != null">
  123. del_flag,
  124. </if>
  125. </trim>
  126. <trim prefix="values (" suffix=")" suffixOverrides=",">
  127. <if test="id != null">
  128. #{id,jdbcType=BIGINT},
  129. </if>
  130. <if test="clientType != null">
  131. #{clientType,jdbcType=INTEGER},
  132. </if>
  133. <if test="parentId != null">
  134. #{parentId,jdbcType=BIGINT},
  135. </if>
  136. <if test="name != null">
  137. #{name,jdbcType=VARCHAR},
  138. </if>
  139. <if test="url != null">
  140. #{url,jdbcType=VARCHAR},
  141. </if>
  142. <if test="links != null">
  143. #{links,jdbcType=VARCHAR},
  144. </if>
  145. <if test="perms != null">
  146. #{perms,jdbcType=VARCHAR},
  147. </if>
  148. <if test="type != null">
  149. #{type,jdbcType=INTEGER},
  150. </if>
  151. <if test="icon != null">
  152. #{icon,jdbcType=VARCHAR},
  153. </if>
  154. <if test="sort != null">
  155. #{sort,jdbcType=INTEGER},
  156. </if>
  157. <if test="level != null">
  158. #{level,jdbcType=INTEGER},
  159. </if>
  160. <if test="custom != null">
  161. #{custom,jdbcType=INTEGER},
  162. </if>
  163. <if test="isDisplay != null">
  164. #{isDisplay,jdbcType=INTEGER},
  165. </if>
  166. <if test="isMain != null">
  167. #{isMain,jdbcType=INTEGER},
  168. </if>
  169. <if test="usingRoles != null">
  170. #{usingRoles,jdbcType=VARCHAR},
  171. </if>
  172. <if test="remark != null">
  173. #{remark,jdbcType=VARCHAR},
  174. </if>
  175. <if test="status != null">
  176. #{status,jdbcType=INTEGER},
  177. </if>
  178. <if test="createBy != null">
  179. #{createBy,jdbcType=BIGINT},
  180. </if>
  181. <if test="createTime != null">
  182. #{createTime,jdbcType=TIMESTAMP},
  183. </if>
  184. <if test="updateBy != null">
  185. #{updateBy,jdbcType=BIGINT},
  186. </if>
  187. <if test="updateTime != null">
  188. #{updateTime,jdbcType=TIMESTAMP},
  189. </if>
  190. <if test="delFlag != null">
  191. #{delFlag,jdbcType=INTEGER},
  192. </if>
  193. </trim>
  194. </insert>
  195. <update id="update" parameterType="com.sckw.system.model.KwsMenu">
  196. update kws_menu
  197. <set>
  198. <if test="clientType != null">
  199. client_type = #{clientType,jdbcType=INTEGER},
  200. </if>
  201. <if test="parentId != null">
  202. parent_id = #{parentId,jdbcType=BIGINT},
  203. </if>
  204. <if test="name != null">
  205. name = #{name,jdbcType=VARCHAR},
  206. </if>
  207. <if test="url != null">
  208. url = #{url,jdbcType=VARCHAR},
  209. </if>
  210. <if test="perms != null">
  211. perms = #{perms,jdbcType=VARCHAR},
  212. </if>
  213. <if test="type != null">
  214. type = #{type,jdbcType=INTEGER},
  215. </if>
  216. <if test="icon != null">
  217. icon = #{icon,jdbcType=VARCHAR},
  218. </if>
  219. <if test="sort != null">
  220. sort = #{sort,jdbcType=INTEGER},
  221. </if>
  222. <if test="level != null">
  223. level = #{level,jdbcType=INTEGER},
  224. </if>
  225. <if test="custom != null">
  226. custom = #{custom,jdbcType=INTEGER},
  227. </if>
  228. <if test="isDisplay != null">
  229. is_display = #{isDisplay,jdbcType=INTEGER},
  230. </if>
  231. <if test="isMain != null">
  232. is_main = #{isMain,jdbcType=INTEGER},
  233. </if>
  234. <if test="usingRoles != null">
  235. using_roles = #{usingRoles,jdbcType=VARCHAR},
  236. </if>
  237. <if test="remark != null">
  238. remark = #{remark,jdbcType=VARCHAR},
  239. </if>
  240. <if test="status != null">
  241. status = #{status,jdbcType=INTEGER},
  242. </if>
  243. <if test="createBy != null">
  244. create_by = #{createBy,jdbcType=BIGINT},
  245. </if>
  246. <if test="createTime != null">
  247. create_time = #{createTime,jdbcType=TIMESTAMP},
  248. </if>
  249. <if test="updateBy != null">
  250. update_by = #{updateBy,jdbcType=BIGINT},
  251. </if>
  252. <if test="updateTime != null">
  253. update_time = #{updateTime,jdbcType=TIMESTAMP},
  254. </if>
  255. <if test="delFlag != null">
  256. del_flag = #{delFlag,jdbcType=INTEGER},
  257. </if>
  258. </set>
  259. where id = #{id,jdbcType=BIGINT}
  260. </update>
  261. <select id="findList" resultType="com.sckw.system.model.vo.res.KwsMenuResVo"
  262. parameterType="com.sckw.system.model.pojo.FindMenuTreePojo" >
  263. select distinct
  264. <include refid="Base_Column_List" />
  265. from kws_menu sm
  266. left join kws_menu_rights smr on sm.id = smr.menu_id
  267. where sm.del_flag = 0
  268. <if test="clientType != null and clientType != ''">
  269. and sm.client_type = #{clientType, jdbcType=VARCHAR}
  270. </if>
  271. <if test="name != null and name != ''">
  272. and sm.name = #{name, jdbcType=VARCHAR}
  273. </if>
  274. <if test="entId != null">
  275. and smr.ent_id = #{entId}
  276. and smr.role_id is null
  277. </if>
  278. <if test="roleIds != null and roleIds.size() > 0">
  279. and smr.role_id in
  280. <foreach collection="roleIds" separator="," open="(" close=")" item="item">
  281. #{item}
  282. </foreach>
  283. </if>
  284. <if test="type != null">
  285. and sm.type = #{type}
  286. </if>
  287. ORDER BY sm.level, sm.sort
  288. </select>
  289. <select id="selectByKeys" resultType="com.sckw.system.model.KwsMenu">
  290. select
  291. <include refid="Base_Column_List" />
  292. from kws_menu sm
  293. where del_flag = 0
  294. and id in
  295. <foreach collection="list" item="item" open="(" close=")" separator=",">
  296. #{item}
  297. </foreach>
  298. </select>
  299. <select id="selectAll" resultType="com.sckw.system.model.KwsMenu">
  300. select * from kws_menu where del_flag = 0
  301. </select>
  302. <select id="select" resultType="com.sckw.system.model.KwsMenu">
  303. select *
  304. from kws_menu
  305. where del_flag = 0
  306. <if test="id != null">
  307. and id = #{id,jdbcType=BIGINT}
  308. </if>
  309. <if test="clientType != null">
  310. and client_type = #{clientType,jdbcType=INTEGER}
  311. </if>
  312. <if test="parentId != null">
  313. and parent_id = #{parentId,jdbcType=BIGINT}
  314. </if>
  315. <if test="name != null">
  316. and name = #{name,jdbcType=VARCHAR}
  317. </if>
  318. <if test="url != null">
  319. and url = #{url,jdbcType=VARCHAR}
  320. </if>
  321. <if test="links != null">
  322. and links = #{links,jdbcType=VARCHAR}
  323. </if>
  324. <if test="perms != null">
  325. and perms = #{perms,jdbcType=VARCHAR}
  326. </if>
  327. <if test="type != null">
  328. and type = #{type,jdbcType=INTEGER}
  329. </if>
  330. <if test="icon != null">
  331. and icon = #{icon,jdbcType=VARCHAR}
  332. </if>
  333. <if test="sort != null">
  334. and sort = #{sort,jdbcType=INTEGER}
  335. </if>
  336. <if test="level != null">
  337. and level = #{level,jdbcType=INTEGER}
  338. </if>
  339. <if test="custom != null">
  340. and custom = #{custom,jdbcType=INTEGER}
  341. </if>
  342. <if test="isDisplay != null">
  343. and is_display = #{isDisplay,jdbcType=INTEGER}
  344. </if>
  345. <if test="isMain != null">
  346. and is_main = #{isMain,jdbcType=INTEGER}
  347. </if>
  348. <if test="usingRoles != null">
  349. and using_roles = #{usingRoles,jdbcType=VARCHAR}
  350. </if>
  351. <if test="remark != null">
  352. and remark = #{remark,jdbcType=VARCHAR}
  353. </if>
  354. order by sort
  355. </select>
  356. <select id="queryChildMenu" resultType="com.sckw.system.model.KwsMenu">
  357. select *
  358. from kws_menu
  359. where del_flag = 0
  360. <if test="parentId != null">
  361. and parent_id = #{parentId,jdbcType=BIGINT}
  362. </if>
  363. <if test="type != null">
  364. and type = #{type,jdbcType=INTEGER}
  365. </if>
  366. <if test="perms != null">
  367. and perms like concat('%', #{perms,jdbcType=VARCHAR}, '%')
  368. </if>
  369. <if test="name != null">
  370. and name like concat('%', #{name,jdbcType=VARCHAR}, '%')
  371. </if>
  372. </select>
  373. </mapper>