UserArchivesMapper.xml 16 KB

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