User.xml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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.UserDAO">
  6. <resultMap id="UserMap" type="com.jpsoft.picc.modules.sys.entity.User">
  7. <id property="id" column="id_"/>
  8. <result property="userName" column="user_name"/>
  9. <result property="password" column="password_"/>
  10. <result property="realName" column="real_name"/>
  11. <result property="createTime" column="create_time"/>
  12. <result property="updateTime" column="update_time"/>
  13. <result property="delFlag" column="del_flag"/>
  14. <result property="createBy" column="create_by"/>
  15. <result property="updateBy" column="update_by"/>
  16. </resultMap>
  17. <insert id="insert" parameterType="com.jpsoft.picc.modules.sys.entity.User">
  18. <!--
  19. <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
  20. select sys_guid() from dual
  21. </selectKey>
  22. -->
  23. <![CDATA[
  24. insert into sys_user
  25. (id_,user_name,password_,real_name,create_time,update_time,del_flag,create_by,update_by)
  26. values
  27. (
  28. #{id,jdbcType=VARCHAR}
  29. ,#{userName,jdbcType=VARCHAR}
  30. ,#{password,jdbcType=VARCHAR}
  31. ,#{realName,jdbcType=VARCHAR}
  32. ,#{createTime,jdbcType= TIMESTAMP }
  33. ,#{updateTime,jdbcType= TIMESTAMP }
  34. ,#{delFlag,jdbcType= NUMERIC }
  35. ,#{createBy,jdbcType=VARCHAR}
  36. ,#{updateBy,jdbcType=VARCHAR}
  37. )
  38. ]]>
  39. </insert>
  40. <delete id="delete" parameterType="string">
  41. delete from sys_user where id_=#{id,jdbcType=VARCHAR}
  42. </delete>
  43. <update id="update" parameterType="com.jpsoft.picc.modules.sys.entity.User">
  44. update sys_user
  45. <set>
  46. <if test="userName!=null">
  47. user_name=#{userName,jdbcType=VARCHAR},
  48. </if>
  49. <if test="password!=null">
  50. password_=#{password,jdbcType=VARCHAR},
  51. </if>
  52. <if test="realName!=null">
  53. real_name=#{realName,jdbcType=VARCHAR},
  54. </if>
  55. <if test="createTime!=null">
  56. create_time=#{createTime,jdbcType= TIMESTAMP },
  57. </if>
  58. <if test="updateTime!=null">
  59. update_time=#{updateTime,jdbcType= TIMESTAMP },
  60. </if>
  61. <if test="delFlag!=null">
  62. del_flag=#{delFlag,jdbcType= NUMERIC },
  63. </if>
  64. <if test="createBy!=null">
  65. create_by=#{createBy,jdbcType=VARCHAR},
  66. </if>
  67. <if test="updateBy!=null">
  68. update_by=#{updateBy,jdbcType=VARCHAR},
  69. </if>
  70. </set>
  71. where id_=#{id}
  72. </update>
  73. <select id="get" parameterType="string" resultMap="UserMap">
  74. select
  75. id_,user_name,password_,real_name,create_time,update_time,del_flag,create_by,update_by from sys_user where
  76. id_=#{0}
  77. </select>
  78. <select id="exist" parameterType="string" resultType="int">
  79. select count(*) from sys_user where id_=#{0}
  80. </select>
  81. <select id="list" resultMap="UserMap">
  82. select * from sys_user
  83. </select>
  84. <select id="findByUserName" parameterType="string" resultMap="UserMap">
  85. select * from sys_user where user_name=#{userName} and del_flag=0 limit 1
  86. </select>
  87. <select id="search" parameterType="hashmap" resultMap="UserMap">
  88. <![CDATA[
  89. select * from sys_user
  90. where del_flag=0
  91. ]]>
  92. <if test="searchParams.userName != null">
  93. and user_name like #{searchParams.userName}
  94. </if>
  95. <if test="searchParams.realName != null">
  96. and real_name like #{searchParams.realName}
  97. </if>
  98. <foreach item="sort" collection="sortList" open="order by" separator=",">
  99. ${sort.name} ${sort.order}
  100. </foreach>
  101. </select>
  102. </mapper>