SysMenuMapper.xml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.mofangchuxing.aska.dao.mapper.SysMenuMapper">
  6. <resultMap id="BaseResultMap" type="com.mofangchuxing.aska.dao.domain.SysMenu">
  7. <id property="menuId" column="menu_id" jdbcType="BIGINT"/>
  8. <result property="parentId" column="parent_id" jdbcType="BIGINT"/>
  9. <result property="name" column="name" jdbcType="VARCHAR"/>
  10. <result property="url" column="url" jdbcType="VARCHAR"/>
  11. <result property="perms" column="perms" jdbcType="VARCHAR"/>
  12. <result property="type" column="type" jdbcType="INTEGER"/>
  13. <result property="icon" column="icon" jdbcType="VARCHAR"/>
  14. <result property="orderNum" column="order_num" jdbcType="INTEGER"/>
  15. <result property="htmlPath" column="html_path" jdbcType="VARCHAR"/>
  16. <result property="htmlClass" column="html_class" jdbcType="VARCHAR"/>
  17. <result property="state" column="state" jdbcType="TINYINT"/>
  18. <result property="createId" column="create_id" jdbcType="BIGINT"/>
  19. <result property="createName" column="create_name" jdbcType="VARCHAR"/>
  20. <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
  21. <result property="menuLevel" column="menu_level" jdbcType="INTEGER"/>
  22. <result property="englishName" column="english_name" jdbcType="VARCHAR"/>
  23. <result property="role" column="role" jdbcType="VARCHAR"/>
  24. </resultMap>
  25. <sql id="Base_Column_List">
  26. menu_id,parent_id,name,
  27. url,perms,type,
  28. icon,order_num,html_path,
  29. html_class,state,create_id,
  30. create_name,create_time,menu_level,
  31. english_name,role
  32. </sql>
  33. <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  34. select
  35. <include refid="Base_Column_List" />
  36. from sys_menu
  37. where menu_id = #{menuId,jdbcType=BIGINT}
  38. </select>
  39. <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  40. delete from sys_menu
  41. where menu_id = #{menuId,jdbcType=BIGINT}
  42. </delete>
  43. <insert id="insert" keyColumn="menu_id" keyProperty="menuId" parameterType="com.mofangchuxing.aska.dao.domain.SysMenu" useGeneratedKeys="true">
  44. insert into sys_menu
  45. ( menu_id,parent_id,name
  46. ,url,perms,type
  47. ,icon,order_num,html_path
  48. ,html_class,state,create_id
  49. ,create_name,create_time,menu_level
  50. ,english_name,role)
  51. values (#{menuId,jdbcType=BIGINT},#{parentId,jdbcType=BIGINT},#{name,jdbcType=VARCHAR}
  52. ,#{url,jdbcType=VARCHAR},#{perms,jdbcType=VARCHAR},#{type,jdbcType=INTEGER}
  53. ,#{icon,jdbcType=VARCHAR},#{orderNum,jdbcType=INTEGER},#{htmlPath,jdbcType=VARCHAR}
  54. ,#{htmlClass,jdbcType=VARCHAR},#{state,jdbcType=TINYINT},#{createId,jdbcType=BIGINT}
  55. ,#{createName,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{menuLevel,jdbcType=INTEGER}
  56. ,#{englishName,jdbcType=VARCHAR},#{role,jdbcType=VARCHAR})
  57. </insert>
  58. <insert id="insertSelective" keyColumn="menu_id" keyProperty="menuId" parameterType="com.mofangchuxing.aska.dao.domain.SysMenu" useGeneratedKeys="true">
  59. insert into sys_menu
  60. <trim prefix="(" suffix=")" suffixOverrides=",">
  61. <if test="menuId != null">menu_id,</if>
  62. <if test="parentId != null">parent_id,</if>
  63. <if test="name != null">name,</if>
  64. <if test="url != null">url,</if>
  65. <if test="perms != null">perms,</if>
  66. <if test="type != null">type,</if>
  67. <if test="icon != null">icon,</if>
  68. <if test="orderNum != null">order_num,</if>
  69. <if test="htmlPath != null">html_path,</if>
  70. <if test="htmlClass != null">html_class,</if>
  71. <if test="state != null">state,</if>
  72. <if test="createId != null">create_id,</if>
  73. <if test="createName != null">create_name,</if>
  74. <if test="createTime != null">create_time,</if>
  75. <if test="menuLevel != null">menu_level,</if>
  76. <if test="englishName != null">english_name,</if>
  77. <if test="role != null">role,</if>
  78. </trim>
  79. <trim prefix="values (" suffix=")" suffixOverrides=",">
  80. <if test="menuId != null">#{menuId,jdbcType=BIGINT},</if>
  81. <if test="parentId != null">#{parentId,jdbcType=BIGINT},</if>
  82. <if test="name != null">#{name,jdbcType=VARCHAR},</if>
  83. <if test="url != null">#{url,jdbcType=VARCHAR},</if>
  84. <if test="perms != null">#{perms,jdbcType=VARCHAR},</if>
  85. <if test="type != null">#{type,jdbcType=INTEGER},</if>
  86. <if test="icon != null">#{icon,jdbcType=VARCHAR},</if>
  87. <if test="orderNum != null">#{orderNum,jdbcType=INTEGER},</if>
  88. <if test="htmlPath != null">#{htmlPath,jdbcType=VARCHAR},</if>
  89. <if test="htmlClass != null">#{htmlClass,jdbcType=VARCHAR},</if>
  90. <if test="state != null">#{state,jdbcType=TINYINT},</if>
  91. <if test="createId != null">#{createId,jdbcType=BIGINT},</if>
  92. <if test="createName != null">#{createName,jdbcType=VARCHAR},</if>
  93. <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
  94. <if test="menuLevel != null">#{menuLevel,jdbcType=INTEGER},</if>
  95. <if test="englishName != null">#{englishName,jdbcType=VARCHAR},</if>
  96. <if test="role != null">#{role,jdbcType=VARCHAR},</if>
  97. </trim>
  98. </insert>
  99. <update id="updateByPrimaryKeySelective" parameterType="com.mofangchuxing.aska.dao.domain.SysMenu">
  100. update sys_menu
  101. <set>
  102. <if test="parentId != null">
  103. parent_id = #{parentId,jdbcType=BIGINT},
  104. </if>
  105. <if test="name != null">
  106. name = #{name,jdbcType=VARCHAR},
  107. </if>
  108. <if test="url != null">
  109. url = #{url,jdbcType=VARCHAR},
  110. </if>
  111. <if test="perms != null">
  112. perms = #{perms,jdbcType=VARCHAR},
  113. </if>
  114. <if test="type != null">
  115. type = #{type,jdbcType=INTEGER},
  116. </if>
  117. <if test="icon != null">
  118. icon = #{icon,jdbcType=VARCHAR},
  119. </if>
  120. <if test="orderNum != null">
  121. order_num = #{orderNum,jdbcType=INTEGER},
  122. </if>
  123. <if test="htmlPath != null">
  124. html_path = #{htmlPath,jdbcType=VARCHAR},
  125. </if>
  126. <if test="htmlClass != null">
  127. html_class = #{htmlClass,jdbcType=VARCHAR},
  128. </if>
  129. <if test="state != null">
  130. state = #{state,jdbcType=TINYINT},
  131. </if>
  132. <if test="createId != null">
  133. create_id = #{createId,jdbcType=BIGINT},
  134. </if>
  135. <if test="createName != null">
  136. create_name = #{createName,jdbcType=VARCHAR},
  137. </if>
  138. <if test="createTime != null">
  139. create_time = #{createTime,jdbcType=TIMESTAMP},
  140. </if>
  141. <if test="menuLevel != null">
  142. menu_level = #{menuLevel,jdbcType=INTEGER},
  143. </if>
  144. <if test="englishName != null">
  145. english_name = #{englishName,jdbcType=VARCHAR},
  146. </if>
  147. <if test="role != null">
  148. role = #{role,jdbcType=VARCHAR},
  149. </if>
  150. </set>
  151. where menu_id = #{menuId,jdbcType=BIGINT}
  152. </update>
  153. <update id="updateByPrimaryKey" parameterType="com.mofangchuxing.aska.dao.domain.SysMenu">
  154. update sys_menu
  155. set
  156. parent_id = #{parentId,jdbcType=BIGINT},
  157. name = #{name,jdbcType=VARCHAR},
  158. url = #{url,jdbcType=VARCHAR},
  159. perms = #{perms,jdbcType=VARCHAR},
  160. type = #{type,jdbcType=INTEGER},
  161. icon = #{icon,jdbcType=VARCHAR},
  162. order_num = #{orderNum,jdbcType=INTEGER},
  163. html_path = #{htmlPath,jdbcType=VARCHAR},
  164. html_class = #{htmlClass,jdbcType=VARCHAR},
  165. state = #{state,jdbcType=TINYINT},
  166. create_id = #{createId,jdbcType=BIGINT},
  167. create_name = #{createName,jdbcType=VARCHAR},
  168. create_time = #{createTime,jdbcType=TIMESTAMP},
  169. menu_level = #{menuLevel,jdbcType=INTEGER},
  170. english_name = #{englishName,jdbcType=VARCHAR},
  171. role = #{role,jdbcType=VARCHAR}
  172. where menu_id = #{menuId,jdbcType=BIGINT}
  173. </update>
  174. <select id="listMenuAll" parameterType="java.util.Map"
  175. resultType="com.mofangchuxing.aska.domain.entity.SysMenuEntity">
  176. SELECT mu.menu_id AS menuId,
  177. mu.`name` AS name,
  178. mu.html_path AS htmlPath,
  179. mu.html_class AS htmlClass,
  180. mu.type AS type,
  181. mu.order_num as orderNum,
  182. mu.state as state,
  183. mu.url as url,
  184. mu.perms as perms,
  185. mu.menu_id AS id,
  186. mu.`name` AS label,
  187. mu.parent_id AS parentId,
  188. mu.menu_level as menuLevel,
  189. mu.english_name as englishName
  190. FROM sys_menu mu
  191. WHERE mu.role = #{role}
  192. ORDER BY mu.order_num ASC
  193. </select>
  194. </mapper>