Role.xml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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.RoleDAO">
  6. <resultMap id="RoleMap" type="com.jpsoft.picc.modules.sys.entity.Role">
  7. <id property="id" column="id_"/>
  8. <result property="name" column="name_"/>
  9. <result property="description" column="description_"/>
  10. <result property="createTime" column="create_time"/>
  11. <result property="updateTime" column="update_time"/>
  12. <result property="delFlag" column="del_flag"/>
  13. <result property="createBy" column="create_by"/>
  14. <result property="updateBy" column="update_by"/>
  15. </resultMap>
  16. <insert id="insert" parameterType="com.jpsoft.picc.modules.sys.entity.Role">
  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
  24. (id_,name_,description_,create_time,update_time,del_flag,create_by,update_by)
  25. values
  26. (
  27. #{id,jdbcType=VARCHAR}
  28. ,#{name,jdbcType=VARCHAR}
  29. ,#{description,jdbcType=VARCHAR}
  30. ,#{createTime,jdbcType= TIMESTAMP }
  31. ,#{updateTime,jdbcType= TIMESTAMP }
  32. ,#{delFlag,jdbcType= NUMERIC }
  33. ,#{createBy,jdbcType=VARCHAR}
  34. ,#{updateBy,jdbcType=VARCHAR}
  35. )
  36. ]]>
  37. </insert>
  38. <delete id="delete" parameterType="string">
  39. delete from sys_role where id_=#{id,jdbcType=VARCHAR}
  40. </delete>
  41. <update id="update" parameterType="com.jpsoft.picc.modules.sys.entity.Role">
  42. update sys_role
  43. <set>
  44. <if test="name!=null">
  45. name_=#{name,jdbcType=VARCHAR},
  46. </if>
  47. <if test="description!=null">
  48. description_=#{description,jdbcType=VARCHAR},
  49. </if>
  50. <if test="createTime!=null">
  51. create_time=#{createTime,jdbcType= TIMESTAMP },
  52. </if>
  53. <if test="updateTime!=null">
  54. update_time=#{updateTime,jdbcType= TIMESTAMP },
  55. </if>
  56. <if test="delFlag!=null">
  57. del_flag=#{delFlag,jdbcType= NUMERIC },
  58. </if>
  59. <if test="createBy!=null">
  60. create_by=#{createBy,jdbcType=VARCHAR},
  61. </if>
  62. <if test="updateBy!=null">
  63. update_by=#{updateBy,jdbcType=VARCHAR},
  64. </if>
  65. </set>
  66. where id_=#{id}
  67. </update>
  68. <select id="get" parameterType="string" resultMap="RoleMap">
  69. select
  70. id_,name_,description_,create_time,update_time,del_flag,create_by,update_by from sys_role where id_=#{0}
  71. </select>
  72. <select id="exist" parameterType="string" resultType="int">
  73. select count(*) from sys_role where id_=#{0}
  74. </select>
  75. <select id="list" resultMap="RoleMap">
  76. select * from sys_role where del_flag=0 order by create_time asc
  77. </select>
  78. <select id="search" parameterType="hashmap" resultMap="RoleMap">
  79. <![CDATA[
  80. select * from sys_role
  81. ]]>
  82. where del_flag=0
  83. <if test="searchParams.roleName != null">
  84. and name_ like #{searchParams.roleName}
  85. </if>
  86. <if test="searchParams.roleDesc != null">
  87. and description_ like #{searchParams.roleDesc}
  88. </if>
  89. <foreach item="sort" collection="sortList" open="order by" separator=",">
  90. ${sort.name} ${sort.order}
  91. </foreach>
  92. </select>
  93. </mapper>