UserMapper.xml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. <mapper namespace="com.yaorong.eai.web.regist.mapper.UserMapper">
  5. <resultMap id="userResultMap" type="com.yaorong.eai.web.regist.vo.UserVo">
  6. <id property="id" column="id" jdbcType="BIGINT"/>
  7. <result property="username" column="username" jdbcType="VARCHAR"/>
  8. <result property="password" column="password" jdbcType="VARCHAR"/>
  9. <result property="phone" column="phone" jdbcType="VARCHAR"/>
  10. <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
  11. <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
  12. <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
  13. <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
  14. <result property="age" column="age" jdbcType="INTEGER"/>
  15. <result property="sex" column="sex" jdbcType="INTEGER"/>
  16. </resultMap>
  17. <select id="findAll" resultType="map">
  18. SELECT * FROM ea_user
  19. </select>
  20. <select id="selectByColumn" resultMap="userResultMap" parameterType="com.yaorong.eai.web.regist.vo.UserVo">
  21. select * from ea_user where 1=1
  22. <if test="null != phone">
  23. and phone = #{phone}
  24. </if>
  25. <if test="null != password">
  26. and password=#{password}
  27. </if>
  28. </select>
  29. <select id="countByColumn" resultType="integer" parameterType="com.yaorong.eai.web.regist.vo.UserVo">
  30. select count(1) from ea_user where 1=1
  31. <if test="null != phone">
  32. and phone = #{phone}
  33. </if>
  34. <!-- <if test="null != password">-->
  35. <!-- and password=#{password}-->
  36. <!-- </if>-->
  37. </select>
  38. <insert id="insertSelective" parameterType="com.yaorong.eai.web.regist.vo.UserVo">
  39. insert into ea_user
  40. <trim prefix="(" suffix=")" suffixOverrides=",">
  41. <if test="id != null">
  42. id,
  43. </if>
  44. <if test="name != null">
  45. name,
  46. </if>
  47. <if test="phone != null">
  48. phone,
  49. </if>
  50. <if test="password != null">
  51. password,
  52. </if>
  53. <if test="createTime != null">
  54. create_time,
  55. </if>
  56. <if test="updateTime != null">
  57. update_time,
  58. </if>
  59. <if test="createBy != null">
  60. create_by,
  61. </if>
  62. <if test="updateBy != null">
  63. update_by,
  64. </if>
  65. <if test="age != null">
  66. age,
  67. </if>
  68. <if test="sex != null">
  69. sex,
  70. </if>
  71. </trim>
  72. <trim prefix="values (" suffix=")" suffixOverrides=",">
  73. <if test="id != null">
  74. #{id,jdbcType=BIGINT},
  75. </if>
  76. <if test="name != null">
  77. #{name,jdbcType=VARCHAR},
  78. </if>
  79. <if test="phone != null">
  80. #{phone,jdbcType=VARCHAR},
  81. </if>
  82. <if test="password != null">
  83. #{password,jdbcType=VARCHAR},
  84. </if>
  85. <if test="createTime != null">
  86. #{createTime,jdbcType=TIMESTAMP},
  87. </if>
  88. <if test="updateTime != null">
  89. #{updateTime,jdbcType=TIMESTAMP},
  90. </if>
  91. <if test="createBy != null">
  92. #{createBy,jdbcType=VARCHAR},
  93. </if>
  94. <if test="updateBy != null">
  95. #{updateBy,jdbcType=VARCHAR},
  96. </if>
  97. <if test="age != null">
  98. #{age,jdbcType=INTEGER},
  99. </if>
  100. <if test="sex != null">
  101. #{sex,jdbcType=INTEGER},
  102. </if>
  103. </trim>
  104. </insert>
  105. </mapper>