UserFirstInterviewMapper.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.goafanti.common.dao.UserFirstInterviewMapper">
  4. <resultMap type="com.goafanti.common.model.UserFirstInterview" id="UserFirstInterviewMap">
  5. <result property="id" column="id" jdbcType="INTEGER"/>
  6. <result property="uid" column="uid" jdbcType="VARCHAR"/>
  7. <result property="aid" column="aid" jdbcType="VARCHAR"/>
  8. <result property="prid" column="prid" jdbcType="VARCHAR"/>
  9. <result property="firstTime" column="first_time" jdbcType="TIMESTAMP"/>
  10. </resultMap>
  11. <sql id="UserFirstInterviewAllSql">
  12. id, uid, aid, prid, first_time
  13. </sql>
  14. <!--查询单个-->
  15. <select id="selectById" resultMap="UserFirstInterviewMap">
  16. select
  17. <include refid="UserFirstInterviewAllSql"/>
  18. from user_first_interview
  19. where id = #{id}
  20. </select>
  21. <!--新增所有列-->
  22. <insert id="insert" keyProperty="id" useGeneratedKeys="true">
  23. insert into user_first_interview(uid, aid, prid, first_time)
  24. values (#{uid}, #{aid}, #{prid}, #{firstTime})
  25. </insert>
  26. <insert id="insertBatch">
  27. insert into user_first_interview(uid, aid, prid, first_time)
  28. values
  29. <foreach collection="entities" item="entity" separator=",">
  30. (#{entity.uid}, #{entity.aid}, #{entity.prid}, #{entity.firstTime})
  31. </foreach>
  32. </insert>
  33. <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
  34. insert into user_first_interview(uid, aid, prid, first_time)
  35. values
  36. <foreach collection="entities" item="entity" separator=",">
  37. (#{entity.uid}, #{entity.aid}, #{entity.prid}, #{entity.firstTime})
  38. </foreach>
  39. on duplicate key update
  40. uid = values(uid),
  41. aid = values(aid),
  42. prid = values(prid),
  43. first_time = values(first_time)
  44. </insert>
  45. <!--通过主键修改数据-->
  46. <update id="update">
  47. update user_first_interview
  48. <set>
  49. <if test="uid != null and uid != ''">
  50. uid = #{uid},
  51. </if>
  52. <if test="aid != null and aid != ''">
  53. aid = #{aid},
  54. </if>
  55. <if test="prid != null and prid != ''">
  56. prid = #{prid},
  57. </if>
  58. <if test="firstTime != null">
  59. first_time = #{firstTime},
  60. </if>
  61. </set>
  62. where id = #{id}
  63. </update>
  64. <!--查询指定行数据-->
  65. <select id="findUserFirstInterviewList" resultMap="UserFirstInterviewMap">
  66. select
  67. <include refid="UserFirstInterviewAllSql"/>
  68. from user_first_interview
  69. <where>
  70. <if test="id != null">
  71. and id = #{id}
  72. </if>
  73. <if test="uid != null and uid != ''">
  74. and uid = #{uid}
  75. </if>
  76. <if test="aid != null and aid != ''">
  77. and aid = #{aid}
  78. </if>
  79. <if test="prid != null and prid != ''">
  80. and prid = #{prid}
  81. </if>
  82. <if test="firstTime != null">
  83. and first_time = #{firstTime}
  84. </if>
  85. </where>
  86. <if test="page_sql != null">
  87. ${page_sql}
  88. </if>
  89. </select>
  90. <!--统计总行数-->
  91. <select id="findUserFirstInterviewCount" resultType="java.lang.Integer">
  92. select count(1)
  93. from user_first_interview
  94. <where>
  95. <if test="id != null">
  96. and id = #{id}
  97. </if>
  98. <if test="uid != null and uid != ''">
  99. and uid = #{uid}
  100. </if>
  101. <if test="aid != null and aid != ''">
  102. and aid = #{aid}
  103. </if>
  104. <if test="prid != null and prid != ''">
  105. and prid = #{prid}
  106. </if>
  107. <if test="firstTime != null">
  108. and first_time = #{firstTime}
  109. </if>
  110. </where>
  111. </select>
  112. <!--通过主键删除-->
  113. <delete id="deleteById">
  114. delete
  115. from user_first_interview
  116. where id = #{id}
  117. </delete>
  118. </mapper>