TechProjectMapper.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  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.TechProjectMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.TechProject">
  5. <id column="id" property="id" jdbcType="VARCHAR" />
  6. <result column="uid" property="uid" jdbcType="VARCHAR" />
  7. <result column="serial_number" property="serialNumber"
  8. jdbcType="INTEGER" />
  9. <result column="contacts" property="contacts" jdbcType="INTEGER" />
  10. <result column="department" property="department" jdbcType="VARCHAR" />
  11. <result column="dispatch_info" property="dispatchInfo"
  12. jdbcType="VARCHAR" />
  13. <result column="project_name" property="projectName" jdbcType="VARCHAR" />
  14. <result column="project_catagory" property="projectCatagory"
  15. jdbcType="VARCHAR" />
  16. <result column="tech_field" property="techField" jdbcType="VARCHAR" />
  17. <result column="project_des" property="projectDes" jdbcType="VARCHAR" />
  18. <result column="project_mode" property="projectMode" jdbcType="INTEGER" />
  19. <result column="project_approval" property="projectApproval"
  20. jdbcType="DECIMAL" />
  21. <result column="subsidy" property="subsidy" jdbcType="INTEGER" />
  22. <result column="consultant" property="consultant" jdbcType="VARCHAR" />
  23. <result column="approval_url" property="approvalUrl" jdbcType="VARCHAR" />
  24. <result column="state" property="state" jdbcType="INTEGER" />
  25. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  26. <result column="accept_date" property="acceptDate" jdbcType="TIMESTAMP" />
  27. <result column="approved_date" property="approvedDate"
  28. jdbcType="TIMESTAMP" />
  29. <result column="record_time" property="recordTime" jdbcType="TIMESTAMP" />
  30. <result column="deleted_sign" property="deletedSign" jdbcType="INTEGER" />
  31. <result column="founder" property="founder" jdbcType="VARCHAR" />
  32. </resultMap>
  33. <sql id="Base_Column_List">
  34. id, uid, serial_number, contacts, department, dispatch_info,
  35. project_name, project_catagory,
  36. tech_field, project_des, project_mode, project_approval, subsidy, consultant,
  37. approval_url,
  38. state, create_time, accept_date, approved_date, record_time, deleted_sign,
  39. founder
  40. </sql>
  41. <select id="selectByPrimaryKey" resultMap="BaseResultMap"
  42. parameterType="java.lang.String">
  43. select
  44. <include refid="Base_Column_List" />
  45. from tech_project
  46. where id = #{id,jdbcType=VARCHAR}
  47. </select>
  48. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  49. delete from tech_project
  50. where id = #{id,jdbcType=VARCHAR}
  51. </delete>
  52. <insert id="insert" parameterType="com.goafanti.common.model.TechProject">
  53. insert into tech_project (id, uid, serial_number,
  54. contacts, department, dispatch_info,
  55. project_name, project_catagory, tech_field,
  56. project_des, project_mode, project_approval,
  57. subsidy, consultant, approval_url,
  58. state, create_time, accept_date,
  59. approved_date, record_time, deleted_sign, founder
  60. )
  61. values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR},
  62. #{serialNumber,jdbcType=INTEGER},
  63. #{contacts,jdbcType=INTEGER}, #{department,jdbcType=VARCHAR}, #{dispatchInfo,jdbcType=VARCHAR},
  64. #{projectName,jdbcType=VARCHAR}, #{projectCatagory,jdbcType=VARCHAR},
  65. #{techField,jdbcType=VARCHAR},
  66. #{projectDes,jdbcType=VARCHAR}, #{projectMode,jdbcType=INTEGER}, #{projectApproval,jdbcType=DECIMAL},
  67. #{subsidy,jdbcType=INTEGER}, #{consultant,jdbcType=VARCHAR},
  68. #{approvalUrl,jdbcType=VARCHAR},
  69. #{state,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{acceptDate,jdbcType=TIMESTAMP},
  70. #{approvedDate,jdbcType=TIMESTAMP}, #{recordTime,jdbcType=TIMESTAMP},
  71. #{deletedSign,jdbcType=INTEGER}, #{founder,jdbcType=VARCHAR}
  72. )
  73. </insert>
  74. <insert id="insertSelective" parameterType="com.goafanti.common.model.TechProject">
  75. insert into tech_project
  76. <trim prefix="(" suffix=")" suffixOverrides=",">
  77. <if test="id != null">
  78. id,
  79. </if>
  80. <if test="uid != null">
  81. uid,
  82. </if>
  83. <if test="serialNumber != null">
  84. serial_number,
  85. </if>
  86. <if test="contacts != null">
  87. contacts,
  88. </if>
  89. <if test="department != null">
  90. department,
  91. </if>
  92. <if test="dispatchInfo != null">
  93. dispatch_info,
  94. </if>
  95. <if test="projectName != null">
  96. project_name,
  97. </if>
  98. <if test="projectCatagory != null">
  99. project_catagory,
  100. </if>
  101. <if test="techField != null">
  102. tech_field,
  103. </if>
  104. <if test="projectDes != null">
  105. project_des,
  106. </if>
  107. <if test="projectMode != null">
  108. project_mode,
  109. </if>
  110. <if test="projectApproval != null">
  111. project_approval,
  112. </if>
  113. <if test="subsidy != null">
  114. subsidy,
  115. </if>
  116. <if test="consultant != null">
  117. consultant,
  118. </if>
  119. <if test="approvalUrl != null">
  120. approval_url,
  121. </if>
  122. <if test="state != null">
  123. state,
  124. </if>
  125. <if test="createTime != null">
  126. create_time,
  127. </if>
  128. <if test="acceptDate != null">
  129. accept_date,
  130. </if>
  131. <if test="approvedDate != null">
  132. approved_date,
  133. </if>
  134. <if test="recordTime != null">
  135. record_time,
  136. </if>
  137. <if test="deletedSign != null">
  138. deleted_sign,
  139. </if>
  140. <if test="founder != null">
  141. founder,
  142. </if>
  143. </trim>
  144. <trim prefix="values (" suffix=")" suffixOverrides=",">
  145. <if test="id != null">
  146. #{id,jdbcType=VARCHAR},
  147. </if>
  148. <if test="uid != null">
  149. #{uid,jdbcType=VARCHAR},
  150. </if>
  151. <if test="serialNumber != null">
  152. #{serialNumber,jdbcType=INTEGER},
  153. </if>
  154. <if test="contacts != null">
  155. #{contacts,jdbcType=INTEGER},
  156. </if>
  157. <if test="department != null">
  158. #{department,jdbcType=VARCHAR},
  159. </if>
  160. <if test="dispatchInfo != null">
  161. #{dispatchInfo,jdbcType=VARCHAR},
  162. </if>
  163. <if test="projectName != null">
  164. #{projectName,jdbcType=VARCHAR},
  165. </if>
  166. <if test="projectCatagory != null">
  167. #{projectCatagory,jdbcType=VARCHAR},
  168. </if>
  169. <if test="techField != null">
  170. #{techField,jdbcType=VARCHAR},
  171. </if>
  172. <if test="projectDes != null">
  173. #{projectDes,jdbcType=VARCHAR},
  174. </if>
  175. <if test="projectMode != null">
  176. #{projectMode,jdbcType=INTEGER},
  177. </if>
  178. <if test="projectApproval != null">
  179. #{projectApproval,jdbcType=DECIMAL},
  180. </if>
  181. <if test="subsidy != null">
  182. #{subsidy,jdbcType=INTEGER},
  183. </if>
  184. <if test="consultant != null">
  185. #{consultant,jdbcType=VARCHAR},
  186. </if>
  187. <if test="approvalUrl != null">
  188. #{approvalUrl,jdbcType=VARCHAR},
  189. </if>
  190. <if test="state != null">
  191. #{state,jdbcType=INTEGER},
  192. </if>
  193. <if test="createTime != null">
  194. #{createTime,jdbcType=TIMESTAMP},
  195. </if>
  196. <if test="acceptDate != null">
  197. #{acceptDate,jdbcType=TIMESTAMP},
  198. </if>
  199. <if test="approvedDate != null">
  200. #{approvedDate,jdbcType=TIMESTAMP},
  201. </if>
  202. <if test="recordTime != null">
  203. #{recordTime,jdbcType=TIMESTAMP},
  204. </if>
  205. <if test="deletedSign != null">
  206. #{deletedSign,jdbcType=INTEGER},
  207. </if>
  208. <if test="founder != null">
  209. #{founder,jdbcType=VARCHAR},
  210. </if>
  211. </trim>
  212. </insert>
  213. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TechProject">
  214. update tech_project
  215. <set>
  216. <if test="uid != null">
  217. uid = #{uid,jdbcType=VARCHAR},
  218. </if>
  219. <if test="serialNumber != null">
  220. serial_number = #{serialNumber,jdbcType=INTEGER},
  221. </if>
  222. <if test="contacts != null">
  223. contacts = #{contacts,jdbcType=INTEGER},
  224. </if>
  225. <if test="department != null">
  226. department = #{department,jdbcType=VARCHAR},
  227. </if>
  228. <if test="dispatchInfo != null">
  229. dispatch_info = #{dispatchInfo,jdbcType=VARCHAR},
  230. </if>
  231. <if test="projectName != null">
  232. project_name = #{projectName,jdbcType=VARCHAR},
  233. </if>
  234. <if test="projectCatagory != null">
  235. project_catagory = #{projectCatagory,jdbcType=VARCHAR},
  236. </if>
  237. <if test="techField != null">
  238. tech_field = #{techField,jdbcType=VARCHAR},
  239. </if>
  240. <if test="projectDes != null">
  241. project_des = #{projectDes,jdbcType=VARCHAR},
  242. </if>
  243. <if test="projectMode != null">
  244. project_mode = #{projectMode,jdbcType=INTEGER},
  245. </if>
  246. <if test="projectApproval != null">
  247. project_approval = #{projectApproval,jdbcType=DECIMAL},
  248. </if>
  249. <if test="subsidy != null">
  250. subsidy = #{subsidy,jdbcType=INTEGER},
  251. </if>
  252. <if test="consultant != null">
  253. consultant = #{consultant,jdbcType=VARCHAR},
  254. </if>
  255. <if test="approvalUrl != null">
  256. approval_url = #{approvalUrl,jdbcType=VARCHAR},
  257. </if>
  258. <if test="state != null">
  259. state = #{state,jdbcType=INTEGER},
  260. </if>
  261. <if test="createTime != null">
  262. create_time = #{createTime,jdbcType=TIMESTAMP},
  263. </if>
  264. <if test="acceptDate != null">
  265. accept_date = #{acceptDate,jdbcType=TIMESTAMP},
  266. </if>
  267. <if test="approvedDate != null">
  268. approved_date = #{approvedDate,jdbcType=TIMESTAMP},
  269. </if>
  270. <if test="recordTime != null">
  271. record_time = #{recordTime,jdbcType=TIMESTAMP},
  272. </if>
  273. <if test="deletedSign != null">
  274. deleted_sign = #{deletedSign,jdbcType=INTEGER},
  275. </if>
  276. <if test="founder != null">
  277. founder = #{founder,jdbcType=VARCHAR},
  278. </if>
  279. </set>
  280. where id = #{id,jdbcType=VARCHAR}
  281. </update>
  282. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TechProject">
  283. update tech_project
  284. set uid = #{uid,jdbcType=VARCHAR},
  285. serial_number = #{serialNumber,jdbcType=INTEGER},
  286. contacts = #{contacts,jdbcType=INTEGER},
  287. department = #{department,jdbcType=VARCHAR},
  288. dispatch_info = #{dispatchInfo,jdbcType=VARCHAR},
  289. project_name = #{projectName,jdbcType=VARCHAR},
  290. project_catagory = #{projectCatagory,jdbcType=VARCHAR},
  291. tech_field = #{techField,jdbcType=VARCHAR},
  292. project_des = #{projectDes,jdbcType=VARCHAR},
  293. project_mode = #{projectMode,jdbcType=INTEGER},
  294. project_approval = #{projectApproval,jdbcType=DECIMAL},
  295. subsidy = #{subsidy,jdbcType=INTEGER},
  296. consultant = #{consultant,jdbcType=VARCHAR},
  297. approval_url = #{approvalUrl,jdbcType=VARCHAR},
  298. state = #{state,jdbcType=INTEGER},
  299. create_time = #{createTime,jdbcType=TIMESTAMP},
  300. accept_date = #{acceptDate,jdbcType=TIMESTAMP},
  301. approved_date = #{approvedDate,jdbcType=TIMESTAMP},
  302. record_time = #{recordTime,jdbcType=TIMESTAMP},
  303. deleted_sign = #{deletedSign,jdbcType=INTEGER},
  304. founder = #{founder,jdbcType=VARCHAR}
  305. where id = #{id,jdbcType=VARCHAR}
  306. </update>
  307. <select id="findTechProjectClientListByPage" parameterType="java.lang.String"
  308. resultType="com.goafanti.techproject.bo.TechProjectClientListBo">
  309. select p.id, p.uid, i.location_province as province,
  310. i.unit_name as unitName,
  311. CONCAT(i.first_contacts,' ', i.first_mobile) as firstContacts,
  312. CONCAT(i.second_contacts,' ', i.second_mobile) as secondContacts,
  313. CONCAT(i.third_contacts,' ', i.third_mobile) as thirdContacts,
  314. p.serial_number as serialNumber, p.create_time as createTime, p.approved_date as approvedDate,
  315. p.accept_date as acceptDate, a.name as consultant, p.contacts,
  316. p.project_name as projectName, p.project_catagory as projectCatagory, p.tech_field as techField, p.state
  317. FROM tech_project p
  318. LEFT JOIN organization_identity i on i.uid = p.uid
  319. LEFT JOIN admin a on p.consultant = a.id
  320. where p.deleted_sign = 0
  321. <if test ="uid != null">
  322. and p.uid = #{uid,jdbcType=VARCHAR}
  323. </if>
  324. order by p.serial_number desc
  325. <if test="page_sql!=null">
  326. ${page_sql}
  327. </if>
  328. </select>
  329. <select id="findTechProjectClientCount" resultType="java.lang.Integer" parameterType="String">
  330. select count(1)
  331. FROM tech_project p
  332. LEFT JOIN organization_identity i on i.uid = p.uid
  333. LEFT JOIN admin a on p.consultant = a.id
  334. where p.deleted_sign = 0
  335. <if test ="uid != null">
  336. and p.uid = #{uid,jdbcType=VARCHAR}
  337. </if>
  338. </select>
  339. <select id ="findTechProjectManageListByPage" parameterType="java.lang.String"
  340. resultType="com.goafanti.techproject.bo.TechProjectManageListBo">
  341. select x.* from (select p.id, p.uid, i.licence_province as province,
  342. i.unit_name as unitName,
  343. CONCAT(i.first_contacts,' ', i.first_mobile) as firstContacts,
  344. CONCAT(i.second_contacts,' ', i.second_mobile) as secondContacts,
  345. CONCAT(i.third_contacts,' ', i.third_mobile) as thirdContacts,
  346. p.serial_number as serialNumber, p.create_time as createTime, p.approved_date as approvedDate,
  347. p.accept_date as acceptDate, a.name as consultant, p.contacts, ad.name as founder,
  348. p.project_name as projectName, p.project_catagory as projectCatagory, p.tech_field as techField, p.state,
  349. w.id as wid, w.website, w.account_number as accountNumber, w.department, w.password, p.deleted_sign as pd, w.deleted_sign as wd
  350. FROM tech_project p
  351. LEFT JOIN organization_identity i on i.uid = p.uid
  352. LEFT JOIN admin a on p.consultant = a.id
  353. LEFT JOIN admin ad on p.founder = ad.id
  354. LEFT JOIN tech_website w on p.department = w.id
  355. <if test="principal != null">
  356. left join tech_project_log l on p.id=l.pid
  357. </if>
  358. where p.deleted_sign = 0
  359. <if test="principal != null">
  360. and l.principal = #{principal,jdbcType=VARCHAR}
  361. </if>
  362. <if test="principal != null">
  363. group by p.id
  364. </if>
  365. ) x where x.wd = 0 or x.wd is null
  366. <if test="province != null">
  367. and x.province = #{province,jdbcType=VARCHAR}
  368. </if>
  369. <if test="unitName != null" >
  370. and x.unitName like CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')
  371. </if>
  372. order by x.serialNumber desc
  373. <if test="page_sql!=null">
  374. ${page_sql}
  375. </if>
  376. </select>
  377. <select id="findTechProjectManageCount" resultType="java.lang.Integer" parameterType="String">
  378. select count(1) from ( select x.* from (select p.id, p.uid, i.licence_province as province,
  379. i.unit_name as unitName,
  380. CONCAT(i.first_contacts,' ', i.first_mobile) as firstContacts,
  381. CONCAT(i.second_contacts,' ', i.second_mobile) as secondContacts,
  382. CONCAT(i.third_contacts,' ', i.third_mobile) as thirdContacts,
  383. p.serial_number as serialNumber, p.create_time as createTime, p.approved_date as approvedDate,
  384. p.accept_date as acceptDate, a.name as consultant, p.contacts,
  385. p.project_name as projectName, p.project_catagory as projectCatagory, p.tech_field as techField, p.state,
  386. w.id as wid, w.website, w.account_number as accountNumber, w.department, w.password, p.deleted_sign as pd, w.deleted_sign as wd
  387. FROM tech_project p
  388. LEFT JOIN organization_identity i on i.uid = p.uid
  389. LEFT JOIN admin a on p.consultant = a.id
  390. LEFT JOIN tech_website w on p.department = w.id
  391. <if test="principal != null">
  392. left join tech_project_log l on p.id=l.pid
  393. </if>
  394. where p.deleted_sign = 0
  395. <if test="principal != null">
  396. and l.principal = #{principal,jdbcType=VARCHAR}
  397. </if>
  398. <if test="principal != null">
  399. group by p.id
  400. </if>
  401. ) x where x.wd = 0 or x.wd is null
  402. <if test="province != null">
  403. and x.province = #{province,jdbcType=VARCHAR}
  404. </if>
  405. <if test="unitName != null" >
  406. and x.unitName like CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')
  407. </if>
  408. ) y
  409. </select>
  410. <select id="selectProjectDetail" resultType="com.goafanti.techproject.bo.TechProjectDetailBo" parameterType="java.lang.String">
  411. select
  412. p.id, p.uid, i.licence_province as province, i.licence_city as city, i.licence_area as area, i.postal_address as postalAddress,
  413. i.unit_name as unitName, i.org_code as orgCode,
  414. p.serial_number as serialNumber,
  415. a.name as consultant, p.contacts, p.project_des as projectDes, p.subsidy, p.dispatch_info as dispatchInfo,
  416. p.project_mode as projectMode, p.project_approval as projectApproval, p.approval_url as approvalUrl , p.department,
  417. p.project_name as projectName, p.project_catagory as projectCatagory, p.tech_field as techField, p.state
  418. FROM tech_project p
  419. LEFT JOIN organization_identity i on i.uid = p.uid
  420. LEFT JOIN admin a on p.consultant = a.id
  421. where p.deleted_sign = 0 and p.id = #{uid,jdbcType=VARCHAR}
  422. </select>
  423. <update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
  424. update tech_project set deleted_sign = 1
  425. where id in
  426. <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
  427. #{item}
  428. </foreach>
  429. </update>
  430. </mapper>