UserArchivesMapper.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  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.UserArchivesMapper">
  4. <resultMap type="com.goafanti.common.model.UserArchives" id="UserArchivesMap">
  5. <result property="id" column="id" jdbcType="INTEGER"/>
  6. <result property="uid" column="uid" jdbcType="VARCHAR"/>
  7. <result property="patentCount" column="patent_count" jdbcType="INTEGER"/>
  8. <result property="inventionPatentCount" column="invention_patent_count" jdbcType="INTEGER"/>
  9. <result property="utilityModelCount" column="utility_model_count" jdbcType="INTEGER"/>
  10. <result property="appearancePatentCount" column="appearance_patent_count" jdbcType="INTEGER"/>
  11. <result property="softwareWorksCount" column="software_works_count" jdbcType="INTEGER"/>
  12. <result property="otherCount" column="other_count" jdbcType="INTEGER"/>
  13. <result property="financialData" column="financial_data" jdbcType="VARCHAR"/>
  14. <result property="earlyCommunication" column="early_communication" jdbcType="VARCHAR"/>
  15. <result property="interviewIdeas" column="interview_ideas" jdbcType="VARCHAR"/>
  16. <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
  17. <result property="enterpriseCount" column="enterprise_count" jdbcType="INTEGER"/>
  18. <result property="channelIndicators" column="channel_indicators" jdbcType="VARCHAR"/>
  19. <result property="interviewDistribution" column="interview_distribution" jdbcType="VARCHAR"/>
  20. <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
  21. <result property="awardsTime" column="awards_time" jdbcType="TIMESTAMP"/>
  22. <result property="awardsStatus" column="awards_status" jdbcType="INTEGER"/>
  23. </resultMap>
  24. <sql id="UserArchivesAllSql">
  25. id, uid, patent_count, invention_patent_count, utility_model_count, appearance_patent_count, software_works_count, other_count, financial_data, early_communication, interview_ideas, create_time, enterprise_count, channel_indicators, interview_distribution, update_time, awards_time, awards_status
  26. </sql>
  27. <!--查询单个-->
  28. <select id="queryById" resultMap="UserArchivesMap">
  29. select
  30. <include refid="UserArchivesAllSql"/>
  31. from user_archives
  32. where id = #{id}
  33. </select>
  34. <!--查询指定行数据-->
  35. <select id="findUserArchivesList" resultMap="UserArchivesMap">
  36. select
  37. <include refid="UserArchivesAllSql"/>
  38. from user_archives
  39. <where>
  40. <if test="id != null">
  41. and id = #{id}
  42. </if>
  43. <if test="uid != null and uid != ''">
  44. and uid = #{uid}
  45. </if>
  46. <if test="patentCount != null">
  47. and patent_count = #{patentCount}
  48. </if>
  49. <if test="inventionPatentCount != null">
  50. and invention_patent_count = #{inventionPatentCount}
  51. </if>
  52. <if test="utilityModelCount != null">
  53. and utility_model_count = #{utilityModelCount}
  54. </if>
  55. <if test="appearancePatentCount != null">
  56. and appearance_patent_count = #{appearancePatentCount}
  57. </if>
  58. <if test="softwareWorksCount != null">
  59. and software_works_count = #{softwareWorksCount}
  60. </if>
  61. <if test="otherCount != null">
  62. and other_count = #{otherCount}
  63. </if>
  64. <if test="financialData != null and financialData != ''">
  65. and financial_data = #{financialData}
  66. </if>
  67. <if test="earlyCommunication != null and earlyCommunication != ''">
  68. and early_communication = #{earlyCommunication}
  69. </if>
  70. <if test="interviewIdeas != null and interviewIdeas != ''">
  71. and interview_ideas = #{interviewIdeas}
  72. </if>
  73. <if test="createTime != null">
  74. and create_time = #{createTime}
  75. </if>
  76. <if test="enterpriseCount != null">
  77. and enterprise_count = #{enterpriseCount}
  78. </if>
  79. <if test="channelIndicators != null and channelIndicators != ''">
  80. and channel_indicators = #{channelIndicators}
  81. </if>
  82. <if test="interviewDistribution != null and interviewDistribution != ''">
  83. and interview_distribution = #{interviewDistribution}
  84. </if>
  85. <if test="updateTime != null">
  86. and update_time = #{updateTime}
  87. </if>
  88. <if test="awardsTime != null">
  89. and awards_time = #{awardsTime}
  90. </if>
  91. <if test="awardsStatus != null">
  92. and awards_status = #{awardsStatus}
  93. </if>
  94. </where>
  95. <if test="page_sql != null">
  96. ${page_sql}
  97. </if>
  98. </select>
  99. <!--统计总行数-->
  100. <select id="findUserArchivesCount" resultType="java.lang.Integer">
  101. select count(1)
  102. from user_archives
  103. <where>
  104. <if test="id != null">
  105. and id = #{id}
  106. </if>
  107. <if test="uid != null and uid != ''">
  108. and uid = #{uid}
  109. </if>
  110. <if test="patentCount != null">
  111. and patent_count = #{patentCount}
  112. </if>
  113. <if test="inventionPatentCount != null">
  114. and invention_patent_count = #{inventionPatentCount}
  115. </if>
  116. <if test="utilityModelCount != null">
  117. and utility_model_count = #{utilityModelCount}
  118. </if>
  119. <if test="appearancePatentCount != null">
  120. and appearance_patent_count = #{appearancePatentCount}
  121. </if>
  122. <if test="softwareWorksCount != null">
  123. and software_works_count = #{softwareWorksCount}
  124. </if>
  125. <if test="otherCount != null">
  126. and other_count = #{otherCount}
  127. </if>
  128. <if test="financialData != null and financialData != ''">
  129. and financial_data = #{financialData}
  130. </if>
  131. <if test="earlyCommunication != null and earlyCommunication != ''">
  132. and early_communication = #{earlyCommunication}
  133. </if>
  134. <if test="interviewIdeas != null and interviewIdeas != ''">
  135. and interview_ideas = #{interviewIdeas}
  136. </if>
  137. <if test="createTime != null">
  138. and create_time = #{createTime}
  139. </if>
  140. <if test="enterpriseCount != null">
  141. and enterprise_count = #{enterpriseCount}
  142. </if>
  143. <if test="channelIndicators != null and channelIndicators != ''">
  144. and channel_indicators = #{channelIndicators}
  145. </if>
  146. <if test="interviewDistribution != null and interviewDistribution != ''">
  147. and interview_distribution = #{interviewDistribution}
  148. </if>
  149. <if test="updateTime != null">
  150. and update_time = #{updateTime}
  151. </if>
  152. <if test="awardsTime != null">
  153. and awards_time = #{awardsTime}
  154. </if>
  155. <if test="awardsStatus != null">
  156. and awards_status = #{awardsStatus}
  157. </if>
  158. </where>
  159. </select>
  160. <!--新增所有列-->
  161. <insert id="insert" keyProperty="id" useGeneratedKeys="true">
  162. insert into user_archives(uid, patent_count, invention_patent_count, utility_model_count,
  163. appearance_patent_count, software_works_count, other_count, financial_data,
  164. early_communication, interview_ideas, create_time, enterprise_count,
  165. channel_indicators, interview_distribution, update_time, awards_time, awards_status)
  166. values (#{uid}, #{patentCount}, #{inventionPatentCount}, #{utilityModelCount}, #{appearancePatentCount},
  167. #{softwareWorksCount}, #{otherCount}, #{financialData}, #{earlyCommunication}, #{interviewIdeas},
  168. #{createTime}, #{enterpriseCount}, #{channelIndicators}, #{interviewDistribution}, #{updateTime},
  169. #{awardsTime}, #{awardsStatus})
  170. </insert>
  171. <insert id="insertBatch">
  172. insert into user_archives(uid, patent_count, invention_patent_count, utility_model_count,
  173. appearance_patent_count, software_works_count, other_count, financial_data, early_communication,
  174. interview_ideas, create_time, enterprise_count, channel_indicators, interview_distribution, update_time,
  175. awards_time, awards_status)
  176. values
  177. <foreach collection="entities" item="entity" separator=",">
  178. (#{entity.uid}, #{entity.patentCount}, #{entity.inventionPatentCount}, #{entity.utilityModelCount},
  179. #{entity.appearancePatentCount}, #{entity.softwareWorksCount}, #{entity.otherCount},
  180. #{entity.financialData}, #{entity.earlyCommunication}, #{entity.interviewIdeas}, #{entity.createTime},
  181. #{entity.enterpriseCount}, #{entity.channelIndicators}, #{entity.interviewDistribution},
  182. #{entity.updateTime}, #{entity.awardsTime}, #{entity.awardsStatus})
  183. </foreach>
  184. </insert>
  185. <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
  186. insert into user_archives(uid, patent_count, invention_patent_count, utility_model_count,
  187. appearance_patent_count, software_works_count, other_count, financial_data, early_communication,
  188. interview_ideas, create_time, enterprise_count, channel_indicators, interview_distribution, update_time,
  189. awards_time, awards_status)
  190. values
  191. <foreach collection="entities" item="entity" separator=",">
  192. (#{entity.uid}, #{entity.patentCount}, #{entity.inventionPatentCount}, #{entity.utilityModelCount},
  193. #{entity.appearancePatentCount}, #{entity.softwareWorksCount}, #{entity.otherCount},
  194. #{entity.financialData}, #{entity.earlyCommunication}, #{entity.interviewIdeas}, #{entity.createTime},
  195. #{entity.enterpriseCount}, #{entity.channelIndicators}, #{entity.interviewDistribution},
  196. #{entity.updateTime}, #{entity.awardsTime}, #{entity.awardsStatus})
  197. </foreach>
  198. on duplicate key update
  199. uid = values(uid),
  200. patent_count = values(patent_count),
  201. invention_patent_count = values(invention_patent_count),
  202. utility_model_count = values(utility_model_count),
  203. appearance_patent_count = values(appearance_patent_count),
  204. software_works_count = values(software_works_count),
  205. other_count = values(other_count),
  206. financial_data = values(financial_data),
  207. early_communication = values(early_communication),
  208. interview_ideas = values(interview_ideas),
  209. create_time = values(create_time),
  210. enterprise_count = values(enterprise_count),
  211. channel_indicators = values(channel_indicators),
  212. interview_distribution = values(interview_distribution),
  213. update_time = values(update_time),
  214. awards_time = values(awards_time),
  215. awards_status = values(awards_status)
  216. </insert>
  217. <!--通过主键修改数据-->
  218. <update id="update">
  219. update user_archives
  220. <set>
  221. <if test="uid != null and uid != ''">
  222. uid = #{uid},
  223. </if>
  224. <if test="patentCount != null">
  225. patent_count = #{patentCount},
  226. </if>
  227. <if test="inventionPatentCount != null">
  228. invention_patent_count = #{inventionPatentCount},
  229. </if>
  230. <if test="utilityModelCount != null">
  231. utility_model_count = #{utilityModelCount},
  232. </if>
  233. <if test="appearancePatentCount != null">
  234. appearance_patent_count = #{appearancePatentCount},
  235. </if>
  236. <if test="softwareWorksCount != null">
  237. software_works_count = #{softwareWorksCount},
  238. </if>
  239. <if test="otherCount != null">
  240. other_count = #{otherCount},
  241. </if>
  242. <if test="financialData != null and financialData != ''">
  243. financial_data = #{financialData},
  244. </if>
  245. <if test="earlyCommunication != null and earlyCommunication != ''">
  246. early_communication = #{earlyCommunication},
  247. </if>
  248. <if test="interviewIdeas != null and interviewIdeas != ''">
  249. interview_ideas = #{interviewIdeas},
  250. </if>
  251. <if test="createTime != null">
  252. create_time = #{createTime},
  253. </if>
  254. <if test="enterpriseCount != null">
  255. enterprise_count = #{enterpriseCount},
  256. </if>
  257. <if test="channelIndicators != null and channelIndicators != ''">
  258. channel_indicators = #{channelIndicators},
  259. </if>
  260. <if test="interviewDistribution != null and interviewDistribution != ''">
  261. interview_distribution = #{interviewDistribution},
  262. </if>
  263. <if test="updateTime != null">
  264. update_time = #{updateTime},
  265. </if>
  266. <if test="awardsTime != null">
  267. awards_time = #{awardsTime},
  268. </if>
  269. <if test="awardsStatus != null">
  270. awards_status = #{awardsStatus},
  271. </if>
  272. </set>
  273. where id = #{id}
  274. </update>
  275. <!--通过主键删除-->
  276. <delete id="deleteById">
  277. delete
  278. from user_archives
  279. where id = #{id}
  280. </delete>
  281. <select id="queryByUid" resultMap="UserArchivesMap">
  282. select
  283. <include refid="UserArchivesAllSql"/>
  284. from user_archives
  285. where uid = #{id}
  286. </select>
  287. <select id="selectUserArchivesList" resultType="com.goafanti.customer.bo.OutSelectUserArchives">
  288. select a.id , a.nickname ,d1.name as province ,d2.name as city ,d3.name area ,a.sign_bills signBills,
  289. a.share_type as shareType ,d.channel_type as channelType ,e.enterprise_count as enterpriseCount,
  290. c.name contactName,f.name adminName,e.channel_indicators as channelIndicators,e.update_time as updateTime,
  291. e.interview_ideas as interviewIdeas ,b.intended_project as intendedProject,
  292. e.interview_distribution as interviewDistribution, g.name depName,
  293. ic.name as industry ,b.business_scope as businessScope ,e.financial_data as financialData,
  294. e.early_communication as earlyCommunication,e.patent_count as patentCount,
  295. e.invention_patent_count as inventionPatentCount,e.utility_model_count as utilityModelCount,
  296. e.appearance_patent_count as appearancePatentCount,e.software_works_count as softwareWorksCount,
  297. e.other_count as otherCount,e.create_time as createTime,e.update_time as updateTime
  298. from user a left join organization_identity b on a.id =b.uid
  299. left join organization_contact_book c on a.id =c.uid and c.major =1
  300. left join user_mid d on a.id =d.uid
  301. left join user_archives e on a.id =e.uid
  302. left join admin f on a.aid =f.id
  303. left join department g on f.department_id =g.id
  304. left join district_glossory d1 on b.location_province=d1.id
  305. left join district_glossory d2 on b.location_city=d2.id
  306. left join district_glossory d3 on b.location_area=d3.id
  307. left join industry_category ic on b.industry=ic.id
  308. <where>
  309. <if test="newChannel !=null">
  310. and a.new_channel = #{newChannel}
  311. </if>
  312. <if test="name !=null">
  313. and a.nickname like concat('%',#{name},'%')
  314. </if>
  315. <if test="aid !=null">
  316. and a.aid = #{aid}
  317. </if>
  318. <if test="channelType !=null">
  319. and d.channel_type in
  320. <foreach collection="channelType" item="item" separator="," open="(" close=")">
  321. #{item}
  322. </foreach>
  323. </if>
  324. <if test="shareType !=null">
  325. <if test="shareType &lt; 4">
  326. and a.share_type = #{shareType}
  327. </if>
  328. <if test="shareType == 4">
  329. and a.share_type in (0,2)
  330. </if>
  331. </if>
  332. <if test="signBills !=null">
  333. and a.sign_bills = #{signBills}
  334. </if>
  335. <if test="businessScope !=null">
  336. and find_in_set(#{businessScope},b.business_scope)
  337. </if>
  338. <if test="industry !=null">
  339. and b.industry in
  340. <foreach collection="industry" item="item" separator="," open="(" close=")">
  341. #{item}
  342. </foreach>
  343. </if>
  344. <if test="startTime !=null and endTime !=null">
  345. and e.update_time between #{startTime} and #{endTime}
  346. </if>
  347. </where>
  348. <if test="page_sql != null">
  349. ${page_sql}
  350. </if>
  351. </select>
  352. <select id="selectUserArchivesCount" resultType="java.lang.Integer">
  353. select count(*)
  354. from user a
  355. left join organization_identity b on a.id =b.uid
  356. left join user_mid d on a.id =d.uid
  357. left join user_archives e on a.id =e.uid
  358. <where>
  359. <if test="newChannel !=null">
  360. and a.new_channel = #{newChannel}
  361. </if>
  362. <if test="name !=null">
  363. and a.nickname like concat('%',#{name},'%')
  364. </if>
  365. <if test="aid !=null">
  366. and a.aid = #{aid}
  367. </if>
  368. <if test="channelType !=null">
  369. and d.channel_type in
  370. <foreach collection="channelType" item="item" separator="," open="(" close=")">
  371. #{item}
  372. </foreach>
  373. </if>
  374. <if test="shareType !=null">
  375. <if test="shareType &lt; 4">
  376. and a.share_type = #{shareType}
  377. </if>
  378. <if test="shareType == 4">
  379. and a.share_type in (0,2)
  380. </if>
  381. </if>
  382. <if test="signBills !=null">
  383. and a.sign_bills = #{signBills}
  384. </if>
  385. <if test="businessScope !=null">
  386. and find_in_set(#{businessScope},b.business_scope)
  387. </if>
  388. <if test="industry !=null">
  389. and b.industry in
  390. <foreach collection="industry" item="item" separator="," open="(" close=")">
  391. #{item}
  392. </foreach>
  393. </if>
  394. <if test="startTime !=null and endTime !=null">
  395. and e.update_time between #{startTime} and #{endTime}
  396. </if>
  397. </where>
  398. </select>
  399. <update id="updateStatus">
  400. update user_archives
  401. set awards_status = 3
  402. where awards_status = 1
  403. </update>
  404. </mapper>