SysMenuMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  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.izouma.awesomeadmin.dao.SysMenuMapper" >
  4. <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.SysMenu" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="parent_id" property="parentId" jdbcType="INTEGER" />
  7. <result column="parent_ids" property="parentIds" jdbcType="VARCHAR" />
  8. <result column="name" property="name" jdbcType="VARCHAR" />
  9. <result column="sort" property="sort" jdbcType="DECIMAL" />
  10. <result column="href" property="href" jdbcType="VARCHAR" />
  11. <result column="target" property="target" jdbcType="VARCHAR" />
  12. <result column="icon" property="icon" jdbcType="VARCHAR" />
  13. <result column="is_show" property="isShow" jdbcType="CHAR" />
  14. <result column="permission" property="permission" jdbcType="VARCHAR" />
  15. <result column="create_by" property="createBy" jdbcType="VARCHAR" />
  16. <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
  17. <result column="update_by" property="updateBy" jdbcType="VARCHAR" />
  18. <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
  19. <result column="remarks" property="remarks" jdbcType="VARCHAR" />
  20. <result column="del_flag" property="delFlag" jdbcType="CHAR" />
  21. <result column="menu_type" property="menuType" jdbcType="CHAR" />
  22. </resultMap>
  23. <sql id="Base_Column_List" >
  24. id, parent_id, parent_ids, name, sort, href, target, icon, is_show, permission, create_by, create_date, update_by, update_date, remarks, del_flag, menu_type
  25. </sql>
  26. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  27. select
  28. <include refid="Base_Column_List" />
  29. from sys_menu
  30. where id = #{id,jdbcType=INTEGER}
  31. </select>
  32. <select id="selectByPrimaryKeys" resultMap="BaseResultMap" parameterType="java.lang.String" >
  33. select
  34. <include refid="Base_Column_List" />
  35. from sys_menu
  36. where FIND_IN_SET(id, #{ids,jdbcType=INTEGER}) and del_flag = 'N'
  37. </select>
  38. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  39. delete from sys_menu
  40. where id = #{id,jdbcType=INTEGER}
  41. </delete>
  42. <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.SysMenu" useGeneratedKeys="true" keyProperty="id">
  43. insert into sys_menu
  44. <trim prefix="(" suffix=")" suffixOverrides="," >
  45. <if test="id != null" >
  46. id,
  47. </if>
  48. <if test="parentId != null" >
  49. parent_id,
  50. </if>
  51. <if test="parentIds != null" >
  52. parent_ids,
  53. </if>
  54. <if test="name != null" >
  55. name,
  56. </if>
  57. <if test="sort != null" >
  58. sort,
  59. </if>
  60. <if test="href != null" >
  61. href,
  62. </if>
  63. <if test="target != null" >
  64. target,
  65. </if>
  66. <if test="icon != null" >
  67. icon,
  68. </if>
  69. <if test="isShow != null" >
  70. is_show,
  71. </if>
  72. <if test="permission != null" >
  73. permission,
  74. </if>
  75. <if test="createBy != null" >
  76. create_by,
  77. </if>
  78. <if test="createDate != null" >
  79. create_date,
  80. </if>
  81. <if test="updateBy != null" >
  82. update_by,
  83. </if>
  84. <if test="updateDate != null" >
  85. update_date,
  86. </if>
  87. <if test="remarks != null" >
  88. remarks,
  89. </if>
  90. <if test="delFlag != null" >
  91. del_flag,
  92. </if>
  93. <if test="menuType != null" >
  94. menu_type,
  95. </if>
  96. </trim>
  97. <trim prefix="values (" suffix=")" suffixOverrides="," >
  98. <if test="id != null" >
  99. #{id,jdbcType=INTEGER},
  100. </if>
  101. <if test="parentId != null" >
  102. #{parentId,jdbcType=INTEGER},
  103. </if>
  104. <if test="parentIds != null" >
  105. #{parentIds,jdbcType=VARCHAR},
  106. </if>
  107. <if test="name != null" >
  108. #{name,jdbcType=VARCHAR},
  109. </if>
  110. <if test="sort != null" >
  111. #{sort,jdbcType=DECIMAL},
  112. </if>
  113. <if test="href != null" >
  114. #{href,jdbcType=VARCHAR},
  115. </if>
  116. <if test="target != null" >
  117. #{target,jdbcType=VARCHAR},
  118. </if>
  119. <if test="icon != null" >
  120. #{icon,jdbcType=VARCHAR},
  121. </if>
  122. <if test="isShow != null" >
  123. #{isShow,jdbcType=CHAR},
  124. </if>
  125. <if test="permission != null" >
  126. #{permission,jdbcType=VARCHAR},
  127. </if>
  128. <if test="createBy != null" >
  129. #{createBy,jdbcType=VARCHAR},
  130. </if>
  131. <if test="createDate != null" >
  132. #{createDate,jdbcType=TIMESTAMP},
  133. </if>
  134. <if test="updateBy != null" >
  135. #{updateBy,jdbcType=VARCHAR},
  136. </if>
  137. <if test="updateDate != null" >
  138. #{updateDate,jdbcType=TIMESTAMP},
  139. </if>
  140. <if test="remarks != null" >
  141. #{remarks,jdbcType=VARCHAR},
  142. </if>
  143. <if test="delFlag != null" >
  144. #{delFlag,jdbcType=CHAR},
  145. </if>
  146. <if test="menuType != null" >
  147. #{menuType,jdbcType=CHAR},
  148. </if>
  149. </trim>
  150. </insert>
  151. <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.SysMenu" >
  152. update sys_menu
  153. <set >
  154. <if test="parentId != null" >
  155. parent_id = #{parentId,jdbcType=INTEGER},
  156. </if>
  157. <if test="parentIds != null" >
  158. parent_ids = #{parentIds,jdbcType=VARCHAR},
  159. </if>
  160. <if test="name != null" >
  161. name = #{name,jdbcType=VARCHAR},
  162. </if>
  163. <if test="sort != null" >
  164. sort = #{sort,jdbcType=DECIMAL},
  165. </if>
  166. <if test="href != null" >
  167. href = #{href,jdbcType=VARCHAR},
  168. </if>
  169. <if test="target != null" >
  170. target = #{target,jdbcType=VARCHAR},
  171. </if>
  172. <if test="icon != null" >
  173. icon = #{icon,jdbcType=VARCHAR},
  174. </if>
  175. <if test="isShow != null" >
  176. is_show = #{isShow,jdbcType=CHAR},
  177. </if>
  178. <if test="permission != null" >
  179. permission = #{permission,jdbcType=VARCHAR},
  180. </if>
  181. <if test="createBy != null" >
  182. create_by = #{createBy,jdbcType=VARCHAR},
  183. </if>
  184. <if test="createDate != null" >
  185. create_date = #{createDate,jdbcType=TIMESTAMP},
  186. </if>
  187. <if test="updateBy != null" >
  188. update_by = #{updateBy,jdbcType=VARCHAR},
  189. </if>
  190. <if test="updateDate != null" >
  191. update_date = #{updateDate,jdbcType=TIMESTAMP},
  192. </if>
  193. <if test="remarks != null" >
  194. remarks = #{remarks,jdbcType=VARCHAR},
  195. </if>
  196. <if test="delFlag != null" >
  197. del_flag = #{delFlag,jdbcType=CHAR},
  198. </if>
  199. <if test="menuType != null" >
  200. menu_type = #{menuType,jdbcType=CHAR},
  201. </if>
  202. </set>
  203. where id = #{id,jdbcType=INTEGER}
  204. </update>
  205. <select id="querySysMenusByPage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.SysMenu">
  206. select <include refid="Base_Column_List"/> from sys_menu
  207. <where>
  208. and del_flag = 'N'
  209. <if test="record.id != null and !&quot;&quot;.equals(record.id)">
  210. and id = #{record.id}
  211. </if>
  212. <if test="record.parentId != null and !&quot;&quot;.equals(record.parentId)">
  213. and parent_id = #{record.parentId}
  214. </if>
  215. <if test="record.parentIds != null and !&quot;&quot;.equals(record.parentIds)">
  216. and parent_ids = #{record.parentIds}
  217. </if>
  218. <if test="record.name != null and !&quot;&quot;.equals(record.name)">
  219. and name = #{record.name}
  220. </if>
  221. <if test="record.sort != null and !&quot;&quot;.equals(record.sort)">
  222. and sort = #{record.sort}
  223. </if>
  224. <if test="record.href != null and !&quot;&quot;.equals(record.href)">
  225. and href = #{record.href}
  226. </if>
  227. <if test="record.target != null and !&quot;&quot;.equals(record.target)">
  228. and target = #{record.target}
  229. </if>
  230. <if test="record.icon != null and !&quot;&quot;.equals(record.icon)">
  231. and icon = #{record.icon}
  232. </if>
  233. <if test="record.isShow != null and !&quot;&quot;.equals(record.isShow)">
  234. and is_show = #{record.isShow}
  235. </if>
  236. <if test="record.permission != null and !&quot;&quot;.equals(record.permission)">
  237. and permission = #{record.permission}
  238. </if>
  239. <if test="record.createBy != null and !&quot;&quot;.equals(record.createBy)">
  240. and create_by = #{record.createBy}
  241. </if>
  242. <if test="record.createDate != null and !&quot;&quot;.equals(record.createDate)">
  243. and create_date = #{record.createDate}
  244. </if>
  245. <if test="record.updateBy != null and !&quot;&quot;.equals(record.updateBy)">
  246. and update_by = #{record.updateBy}
  247. </if>
  248. <if test="record.updateDate != null and !&quot;&quot;.equals(record.updateDate)">
  249. and update_date = #{record.updateDate}
  250. </if>
  251. <if test="record.remarks != null and !&quot;&quot;.equals(record.remarks)">
  252. and remarks = #{record.remarks}
  253. </if>
  254. <if test="record.delFlag != null and !&quot;&quot;.equals(record.delFlag)">
  255. and del_flag = #{record.delFlag}
  256. </if>
  257. <if test="record.menuType != null and !&quot;&quot;.equals(record.menuType)">
  258. and menu_type = #{record.menuType}
  259. </if>
  260. </where>
  261. order by id desc
  262. </select>
  263. <select id="queryAllSysMenu" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.SysMenu">
  264. select <include refid="Base_Column_List"/> from sys_menu
  265. <where>
  266. and del_flag = 'N'
  267. <if test="id != null and !&quot;&quot;.equals(id)">
  268. and id = #{id}
  269. </if>
  270. <if test="parentId != null and !&quot;&quot;.equals(parentId)">
  271. and parent_id = #{parentId}
  272. </if>
  273. <if test="parentIds != null and !&quot;&quot;.equals(parentIds)">
  274. and parent_ids = #{parentIds}
  275. </if>
  276. <if test="name != null and !&quot;&quot;.equals(name)">
  277. and name = #{name}
  278. </if>
  279. <if test="sort != null and !&quot;&quot;.equals(sort)">
  280. and sort = #{sort}
  281. </if>
  282. <if test="href != null and !&quot;&quot;.equals(href)">
  283. and href = #{href}
  284. </if>
  285. <if test="target != null and !&quot;&quot;.equals(target)">
  286. and target = #{target}
  287. </if>
  288. <if test="icon != null and !&quot;&quot;.equals(icon)">
  289. and icon = #{icon}
  290. </if>
  291. <if test="isShow != null and !&quot;&quot;.equals(isShow)">
  292. and is_show = #{isShow}
  293. </if>
  294. <if test="permission != null and !&quot;&quot;.equals(permission)">
  295. and permission = #{permission}
  296. </if>
  297. <if test="createBy != null and !&quot;&quot;.equals(createBy)">
  298. and create_by = #{createBy}
  299. </if>
  300. <if test="createDate != null and !&quot;&quot;.equals(createDate)">
  301. and create_date = #{createDate}
  302. </if>
  303. <if test="updateBy != null and !&quot;&quot;.equals(updateBy)">
  304. and update_by = #{updateBy}
  305. </if>
  306. <if test="updateDate != null and !&quot;&quot;.equals(updateDate)">
  307. and update_date = #{updateDate}
  308. </if>
  309. <if test="remarks != null and !&quot;&quot;.equals(remarks)">
  310. and remarks = #{remarks}
  311. </if>
  312. <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
  313. and del_flag = #{delFlag}
  314. </if>
  315. <if test="menuType != null and !&quot;&quot;.equals(menuType)">
  316. and menu_type = #{menuType}
  317. </if>
  318. </where>
  319. order by id desc
  320. </select>
  321. <select id="querySysMenu" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.SysMenu">
  322. select <include refid="Base_Column_List"/> from sys_menu
  323. <where>
  324. and del_flag = 'N'
  325. <if test="id != null and !&quot;&quot;.equals(id)">
  326. and id = #{id}
  327. </if>
  328. <if test="parentId != null and !&quot;&quot;.equals(parentId)">
  329. and parent_id = #{parentId}
  330. </if>
  331. <if test="parentIds != null and !&quot;&quot;.equals(parentIds)">
  332. and parent_ids = #{parentIds}
  333. </if>
  334. <if test="name != null and !&quot;&quot;.equals(name)">
  335. and name = #{name}
  336. </if>
  337. <if test="sort != null and !&quot;&quot;.equals(sort)">
  338. and sort = #{sort}
  339. </if>
  340. <if test="href != null and !&quot;&quot;.equals(href)">
  341. and href = #{href}
  342. </if>
  343. <if test="target != null and !&quot;&quot;.equals(target)">
  344. and target = #{target}
  345. </if>
  346. <if test="icon != null and !&quot;&quot;.equals(icon)">
  347. and icon = #{icon}
  348. </if>
  349. <if test="isShow != null and !&quot;&quot;.equals(isShow)">
  350. and is_show = #{isShow}
  351. </if>
  352. <if test="permission != null and !&quot;&quot;.equals(permission)">
  353. and permission = #{permission}
  354. </if>
  355. <if test="createBy != null and !&quot;&quot;.equals(createBy)">
  356. and create_by = #{createBy}
  357. </if>
  358. <if test="createDate != null and !&quot;&quot;.equals(createDate)">
  359. and create_date = #{createDate}
  360. </if>
  361. <if test="updateBy != null and !&quot;&quot;.equals(updateBy)">
  362. and update_by = #{updateBy}
  363. </if>
  364. <if test="updateDate != null and !&quot;&quot;.equals(updateDate)">
  365. and update_date = #{updateDate}
  366. </if>
  367. <if test="remarks != null and !&quot;&quot;.equals(remarks)">
  368. and remarks = #{remarks}
  369. </if>
  370. <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
  371. and del_flag = #{delFlag}
  372. </if>
  373. <if test="menuType != null and !&quot;&quot;.equals(menuType)">
  374. and menu_type = #{menuType}
  375. </if>
  376. </where>
  377. LIMIT 1
  378. </select>
  379. <update id="delete">
  380. UPDATE sys_menu SET del_flag = 'Y'
  381. <where>
  382. AND id = #{id}
  383. </where>
  384. </update>
  385. </mapper>