UserArchivesMapper.xml 20 KB

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