UserArchivesInterviewMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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.UserArchivesInterviewMapper">
  4. <resultMap type="com.goafanti.common.model.UserArchivesInterview" id="UserArchivesInterviewMap">
  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="prdid" column="prdid" jdbcType="INTEGER"/>
  9. <result property="counts" column="counts" jdbcType="INTEGER"/>
  10. <result property="earlyCommunication" column="early_communication" jdbcType="VARCHAR"/>
  11. <result property="customerDemand" column="customer_demand" jdbcType="VARCHAR"/>
  12. <result property="interviewIdeas" column="interview_ideas" jdbcType="VARCHAR"/>
  13. <result property="interviewPurpose" column="interview_purpose" jdbcType="VARCHAR"/>
  14. <result property="interviewRecommend" column="interview_recommend" jdbcType="VARCHAR"/>
  15. <result property="interviewFeedback" column="interview_feedback" jdbcType="VARCHAR"/>
  16. <result property="followUpPlan" column="follow_up_plan" jdbcType="VARCHAR"/>
  17. <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
  18. </resultMap>
  19. <sql id="UserArchivesInterviewAllSql">
  20. id, uid, aid, prdid, counts, early_communication, customer_demand, interview_ideas, interview_purpose, interview_recommend, interview_feedback, follow_up_plan, create_time
  21. </sql>
  22. <!--查询单个-->
  23. <select id="selectById" resultMap="UserArchivesInterviewMap">
  24. select
  25. <include refid="UserArchivesInterviewAllSql"/>
  26. from user_archives_interview
  27. where id = #{id}
  28. </select>
  29. <!--新增所有列-->
  30. <insert id="insert" keyProperty="id" useGeneratedKeys="true">
  31. insert into user_archives_interview(uid, aid, prdid, counts, early_communication, customer_demand,
  32. interview_ideas, interview_purpose, interview_recommend, interview_feedback,
  33. follow_up_plan, create_time)
  34. values (#{uid}, #{aid}, #{prdid}, #{counts}, #{earlyCommunication}, #{customerDemand}, #{interviewIdeas},
  35. #{interviewPurpose}, #{interviewRecommend}, #{interviewFeedback}, #{followUpPlan}, #{createTime})
  36. </insert>
  37. <insert id="insertBatch">
  38. insert into user_archives_interview(uid, aid, prdid, counts, early_communication, customer_demand,
  39. interview_ideas, interview_purpose, interview_recommend, interview_feedback, follow_up_plan, create_time)
  40. values
  41. <foreach collection="entities" item="entity" separator=",">
  42. (#{entity.uid}, #{entity.aid}, #{entity.prdid}, #{entity.counts}, #{entity.earlyCommunication},
  43. #{entity.customerDemand}, #{entity.interviewIdeas}, #{entity.interviewPurpose},
  44. #{entity.interviewRecommend}, #{entity.interviewFeedback}, #{entity.followUpPlan}, #{entity.createTime})
  45. </foreach>
  46. </insert>
  47. <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
  48. insert into user_archives_interview(uid, aid, prdid, counts, early_communication, customer_demand,
  49. interview_ideas, interview_purpose, interview_recommend, interview_feedback, follow_up_plan, create_time)
  50. values
  51. <foreach collection="entities" item="entity" separator=",">
  52. (#{entity.uid}, #{entity.aid}, #{entity.prdid}, #{entity.counts}, #{entity.earlyCommunication},
  53. #{entity.customerDemand}, #{entity.interviewIdeas}, #{entity.interviewPurpose},
  54. #{entity.interviewRecommend}, #{entity.interviewFeedback}, #{entity.followUpPlan}, #{entity.createTime})
  55. </foreach>
  56. on duplicate key update
  57. uid = values(uid),
  58. aid = values(aid),
  59. prdid = values(prdid),
  60. counts = values(counts),
  61. early_communication = values(early_communication),
  62. customer_demand = values(customer_demand),
  63. interview_ideas = values(interview_ideas),
  64. interview_purpose = values(interview_purpose),
  65. interview_recommend = values(interview_recommend),
  66. interview_feedback = values(interview_feedback),
  67. follow_up_plan = values(follow_up_plan),
  68. create_time = values(create_time)
  69. </insert>
  70. <!--通过主键修改数据-->
  71. <update id="update">
  72. update user_archives_interview
  73. <set>
  74. <if test="uid != null and uid != ''">
  75. uid = #{uid},
  76. </if>
  77. <if test="aid != null and aid != ''">
  78. aid = #{aid},
  79. </if>
  80. <if test="prdid != null">
  81. prdid = #{prdid},
  82. </if>
  83. <if test="counts != null">
  84. counts = #{counts},
  85. </if>
  86. <if test="earlyCommunication != null and earlyCommunication != ''">
  87. early_communication = #{earlyCommunication},
  88. </if>
  89. <if test="customerDemand != null and customerDemand != ''">
  90. customer_demand = #{customerDemand},
  91. </if>
  92. <if test="interviewIdeas != null and interviewIdeas != ''">
  93. interview_ideas = #{interviewIdeas},
  94. </if>
  95. <if test="interviewPurpose != null and interviewPurpose != ''">
  96. interview_purpose = #{interviewPurpose},
  97. </if>
  98. <if test="interviewRecommend != null and interviewRecommend != ''">
  99. interview_recommend = #{interviewRecommend},
  100. </if>
  101. <if test="interviewFeedback != null and interviewFeedback != ''">
  102. interview_feedback = #{interviewFeedback},
  103. </if>
  104. <if test="followUpPlan != null and followUpPlan != ''">
  105. follow_up_plan = #{followUpPlan},
  106. </if>
  107. <if test="createTime != null">
  108. create_time = #{createTime},
  109. </if>
  110. </set>
  111. where id = #{id}
  112. </update>
  113. <!--查询指定行数据-->
  114. <select id="findUserArchivesInterviewList" resultMap="UserArchivesInterviewMap">
  115. select
  116. <include refid="UserArchivesInterviewAllSql"/>
  117. from user_archives_interview
  118. <where>
  119. <if test="id != null">
  120. and id = #{id}
  121. </if>
  122. <if test="uid != null and uid != ''">
  123. and uid = #{uid}
  124. </if>
  125. <if test="aid != null and aid != ''">
  126. and aid = #{aid}
  127. </if>
  128. <if test="prdid != null">
  129. and prdid = #{prdid}
  130. </if>
  131. <if test="counts != null">
  132. and counts = #{counts}
  133. </if>
  134. <if test="earlyCommunication != null and earlyCommunication != ''">
  135. and early_communication = #{earlyCommunication}
  136. </if>
  137. <if test="customerDemand != null and customerDemand != ''">
  138. and customer_demand = #{customerDemand}
  139. </if>
  140. <if test="interviewIdeas != null and interviewIdeas != ''">
  141. and interview_ideas = #{interviewIdeas}
  142. </if>
  143. <if test="interviewPurpose != null and interviewPurpose != ''">
  144. and interview_purpose = #{interviewPurpose}
  145. </if>
  146. <if test="interviewRecommend != null and interviewRecommend != ''">
  147. and interview_recommend = #{interviewRecommend}
  148. </if>
  149. <if test="interviewFeedback != null and interviewFeedback != ''">
  150. and interview_feedback = #{interviewFeedback}
  151. </if>
  152. <if test="followUpPlan != null and followUpPlan != ''">
  153. and follow_up_plan = #{followUpPlan}
  154. </if>
  155. <if test="createTime != null">
  156. and create_time = #{createTime}
  157. </if>
  158. </where>
  159. <if test="page_sql != null">
  160. ${page_sql}
  161. </if>
  162. </select>
  163. <!--统计总行数-->
  164. <select id="findUserArchivesInterviewCount" resultType="java.lang.Integer">
  165. select count(1)
  166. from user_archives_interview
  167. <where>
  168. <if test="id != null">
  169. and id = #{id}
  170. </if>
  171. <if test="uid != null and uid != ''">
  172. and uid = #{uid}
  173. </if>
  174. <if test="aid != null and aid != ''">
  175. and aid = #{aid}
  176. </if>
  177. <if test="prdid != null">
  178. and prdid = #{prdid}
  179. </if>
  180. <if test="counts != null">
  181. and counts = #{counts}
  182. </if>
  183. <if test="earlyCommunication != null and earlyCommunication != ''">
  184. and early_communication = #{earlyCommunication}
  185. </if>
  186. <if test="customerDemand != null and customerDemand != ''">
  187. and customer_demand = #{customerDemand}
  188. </if>
  189. <if test="interviewIdeas != null and interviewIdeas != ''">
  190. and interview_ideas = #{interviewIdeas}
  191. </if>
  192. <if test="interviewPurpose != null and interviewPurpose != ''">
  193. and interview_purpose = #{interviewPurpose}
  194. </if>
  195. <if test="interviewRecommend != null and interviewRecommend != ''">
  196. and interview_recommend = #{interviewRecommend}
  197. </if>
  198. <if test="interviewFeedback != null and interviewFeedback != ''">
  199. and interview_feedback = #{interviewFeedback}
  200. </if>
  201. <if test="followUpPlan != null and followUpPlan != ''">
  202. and follow_up_plan = #{followUpPlan}
  203. </if>
  204. <if test="createTime != null">
  205. and create_time = #{createTime}
  206. </if>
  207. </where>
  208. </select>
  209. <!--通过主键删除-->
  210. <delete id="deleteById">
  211. delete
  212. from user_archives_interview
  213. where id = #{id}
  214. </delete>
  215. <resultMap type="com.goafanti.Interview.bo.selectByUidAidBo" id="selectByUidAidBoMap">
  216. <result property="id" column="id" jdbcType="INTEGER"/>
  217. <result property="uid" column="uid" jdbcType="VARCHAR"/>
  218. <result property="aid" column="aid" jdbcType="VARCHAR"/>
  219. <result property="prdid" column="prdid" jdbcType="INTEGER"/>
  220. <result property="counts" column="counts" jdbcType="INTEGER"/>
  221. <result property="earlyCommunication" column="early_communication" jdbcType="VARCHAR"/>
  222. <result property="customerDemand" column="customer_demand" jdbcType="VARCHAR"/>
  223. <result property="interviewIdeas" column="interview_ideas" jdbcType="VARCHAR"/>
  224. <result property="interviewPurpose" column="interview_purpose" jdbcType="VARCHAR"/>
  225. <result property="interviewRecommend" column="interview_recommend" jdbcType="VARCHAR"/>
  226. <result property="interviewFeedback" column="interview_feedback" jdbcType="VARCHAR"/>
  227. <result property="followUpPlan" column="follow_up_plan" jdbcType="VARCHAR"/>
  228. <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
  229. <result property="prStatus" column="prStatus" jdbcType="INTEGER"/>
  230. <result property="adminName" column="name" jdbcType="VARCHAR"/>
  231. </resultMap>
  232. <select id="selectByUidAid" resultMap="selectByUidAidBoMap">
  233. select
  234. a.* ,c.status prStatus,d.name
  235. from user_archives_interview a left join public_release_details b on a.prdid=b.id
  236. left join public_release c on b.prid=c.id left join admin d on a.aid=d.id
  237. <where>
  238. <if test="uid != null and uid != ''">
  239. and a.uid = #{uid}
  240. </if>
  241. <if test="aid != null and aid != ''">
  242. and a.aid = #{aid}
  243. </if>
  244. </where>
  245. order by a.counts desc
  246. </select>
  247. <select id="selectByIds" resultMap="UserArchivesInterviewMap">
  248. select
  249. <include refid="UserArchivesInterviewAllSql"/>
  250. from user_archives_interview
  251. where id in
  252. <foreach collection="array" item="id" open="(" close=")" separator=",">
  253. #{id}
  254. </foreach>
  255. </select>
  256. <select id="selectByPrdid" resultMap="UserArchivesInterviewMap">
  257. select
  258. <include refid="UserArchivesInterviewAllSql"/>
  259. from user_archives_interview
  260. where prdid = #{prdid}
  261. </select>
  262. </mapper>