RoleMenu.xml 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <!-- namespace必须指向DAO接口 -->
  5. <mapper namespace="com.jpsoft.picc.modules.sys.dao.RoleMenuDAO">
  6. <resultMap id="RoleMenuMap" type="com.jpsoft.picc.modules.sys.entity.RoleMenu">
  7. <id property="id" column="id_" />
  8. <result property="roleId" column="role_id" />
  9. <result property="menuId" column="menu_id" />
  10. <result property="delFlag" column="del_flag" />
  11. <result property="createBy" column="create_by" />
  12. <result property="createTime" column="create_time" />
  13. <result property="updateBy" column="update_by" />
  14. <result property="updateTime" column="update_time" />
  15. </resultMap>
  16. <insert id="insert" parameterType="com.jpsoft.picc.modules.sys.entity.RoleMenu">
  17. <!--
  18. <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
  19. select sys_guid() from dual
  20. </selectKey>
  21. -->
  22. <![CDATA[
  23. insert into sys_role_menu
  24. (id_,role_id,menu_id,del_flag,create_by,create_time,update_by,update_time)
  25. values
  26. (
  27. #{id,jdbcType=VARCHAR}
  28. ,#{roleId,jdbcType=VARCHAR}
  29. ,#{menuId,jdbcType=VARCHAR}
  30. ,#{delFlag,jdbcType= NUMERIC }
  31. ,#{createBy,jdbcType=VARCHAR}
  32. ,#{createTime,jdbcType= TIMESTAMP }
  33. ,#{updateBy,jdbcType=VARCHAR}
  34. ,#{updateTime,jdbcType= TIMESTAMP }
  35. )
  36. ]]>
  37. </insert>
  38. <delete id="delete" parameterType="string">
  39. delete from sys_role_menu where id_=#{id,jdbcType=VARCHAR}
  40. </delete>
  41. <delete id="deleteByRoleId" parameterType="string">
  42. delete from sys_role_menu where role_id=#{0}
  43. </delete>
  44. <update id="update" parameterType="com.jpsoft.picc.modules.sys.entity.RoleMenu">
  45. update sys_role_menu
  46. <set>
  47. <if test="roleId!=null">
  48. role_id=#{roleId,jdbcType=VARCHAR},
  49. </if>
  50. <if test="menuId!=null">
  51. menu_id=#{menuId,jdbcType=VARCHAR},
  52. </if>
  53. <if test="delFlag!=null">
  54. del_flag=#{delFlag,jdbcType= NUMERIC },
  55. </if>
  56. <if test="createBy!=null">
  57. create_by=#{createBy,jdbcType=VARCHAR},
  58. </if>
  59. <if test="createTime!=null">
  60. create_time=#{createTime,jdbcType= TIMESTAMP },
  61. </if>
  62. <if test="updateBy!=null">
  63. update_by=#{updateBy,jdbcType=VARCHAR},
  64. </if>
  65. <if test="updateTime!=null">
  66. update_time=#{updateTime,jdbcType= TIMESTAMP },
  67. </if>
  68. </set>
  69. where id_=#{id}
  70. </update>
  71. <select id="get" parameterType="string" resultMap="RoleMenuMap">
  72. select
  73. id_,role_id,menu_id,del_flag,create_by,create_time,update_by,update_time from sys_role_menu where id_=#{0}
  74. </select>
  75. <select id="exist" parameterType="string" resultType="int">
  76. select count(*) from sys_role_menu where id_=#{0}
  77. </select>
  78. <select id="list" resultMap="RoleMenuMap">
  79. select * from sys_role_menu
  80. </select>
  81. <select id="search" parameterType="hashmap" resultMap="RoleMenuMap">
  82. <![CDATA[
  83. select * from sys_role_menu
  84. ]]>
  85. <where>
  86. <if test="searchParams.id != null">
  87. and ID_ like #{searchParams.id}
  88. </if>
  89. </where>
  90. <foreach item="sort" collection="sortList" open="order by" separator=",">
  91. ${sort.name} ${sort.order}
  92. </foreach>
  93. </select>
  94. <select id="findByRoleId" parameterType="string" resultMap="RoleMenuMap">
  95. select * from sys_role_menu where role_id=#{0}
  96. </select>
  97. </mapper>