TechProjectMapper.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  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. <result column="contract_id" property="contractId" jdbcType="VARCHAR" />
  33. <result column="principal" property="principal" jdbcType="VARCHAR" />
  34. </resultMap>
  35. <sql id="Base_Column_List">
  36. id, uid, serial_number, contacts, department, dispatch_info,
  37. project_name, project_catagory,
  38. tech_field, project_des, project_mode, project_approval, subsidy, consultant,
  39. approval_url,
  40. state, create_time, accept_date, approved_date, record_time, deleted_sign,
  41. founder, contract_id, principal
  42. </sql>
  43. <select id="selectByPrimaryKey" resultMap="BaseResultMap"
  44. parameterType="java.lang.String">
  45. select
  46. <include refid="Base_Column_List" />
  47. from tech_project
  48. where id = #{id,jdbcType=VARCHAR}
  49. </select>
  50. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  51. delete from tech_project
  52. where id = #{id,jdbcType=VARCHAR}
  53. </delete>
  54. <insert id="insert" parameterType="com.goafanti.common.model.TechProject">
  55. insert into tech_project (id, uid, serial_number,
  56. contacts, department, dispatch_info,
  57. project_name, project_catagory, tech_field,
  58. project_des, project_mode, project_approval,
  59. subsidy, consultant, approval_url,
  60. state, create_time, accept_date,
  61. approved_date, record_time, deleted_sign, founder, contract_id, principal
  62. )
  63. values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR},
  64. #{serialNumber,jdbcType=INTEGER},
  65. #{contacts,jdbcType=INTEGER}, #{department,jdbcType=VARCHAR}, #{dispatchInfo,jdbcType=VARCHAR},
  66. #{projectName,jdbcType=VARCHAR}, #{projectCatagory,jdbcType=VARCHAR},
  67. #{techField,jdbcType=VARCHAR},
  68. #{projectDes,jdbcType=VARCHAR}, #{projectMode,jdbcType=INTEGER}, #{projectApproval,jdbcType=DECIMAL},
  69. #{subsidy,jdbcType=INTEGER}, #{consultant,jdbcType=VARCHAR},
  70. #{approvalUrl,jdbcType=VARCHAR},
  71. #{state,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{acceptDate,jdbcType=TIMESTAMP},
  72. #{approvedDate,jdbcType=TIMESTAMP}, #{recordTime,jdbcType=TIMESTAMP},
  73. #{deletedSign,jdbcType=INTEGER}, #{founder,jdbcType=VARCHAR}, #{contractId,jdbcType=VARCHAR},
  74. #{principal,jdbcType=VARCHAR}
  75. )
  76. </insert>
  77. <insert id="insertSelective" parameterType="com.goafanti.common.model.TechProject">
  78. insert into tech_project
  79. <trim prefix="(" suffix=")" suffixOverrides=",">
  80. <if test="id != null">
  81. id,
  82. </if>
  83. <if test="uid != null">
  84. uid,
  85. </if>
  86. <if test="serialNumber != null">
  87. serial_number,
  88. </if>
  89. <if test="contacts != null">
  90. contacts,
  91. </if>
  92. <if test="department != null">
  93. department,
  94. </if>
  95. <if test="dispatchInfo != null">
  96. dispatch_info,
  97. </if>
  98. <if test="projectName != null">
  99. project_name,
  100. </if>
  101. <if test="projectCatagory != null">
  102. project_catagory,
  103. </if>
  104. <if test="techField != null">
  105. tech_field,
  106. </if>
  107. <if test="projectDes != null">
  108. project_des,
  109. </if>
  110. <if test="projectMode != null">
  111. project_mode,
  112. </if>
  113. <if test="projectApproval != null">
  114. project_approval,
  115. </if>
  116. <if test="subsidy != null">
  117. subsidy,
  118. </if>
  119. <if test="consultant != null">
  120. consultant,
  121. </if>
  122. <if test="approvalUrl != null">
  123. approval_url,
  124. </if>
  125. <if test="state != null">
  126. state,
  127. </if>
  128. <if test="createTime != null">
  129. create_time,
  130. </if>
  131. <if test="acceptDate != null">
  132. accept_date,
  133. </if>
  134. <if test="approvedDate != null">
  135. approved_date,
  136. </if>
  137. <if test="recordTime != null">
  138. record_time,
  139. </if>
  140. <if test="deletedSign != null">
  141. deleted_sign,
  142. </if>
  143. <if test="founder != null">
  144. founder,
  145. </if>
  146. <if test="contractId != null">
  147. contract_id,
  148. </if>
  149. <if test="principal != null">
  150. principal,
  151. </if>
  152. </trim>
  153. <trim prefix="values (" suffix=")" suffixOverrides=",">
  154. <if test="id != null">
  155. #{id,jdbcType=VARCHAR},
  156. </if>
  157. <if test="uid != null">
  158. #{uid,jdbcType=VARCHAR},
  159. </if>
  160. <if test="serialNumber != null">
  161. #{serialNumber,jdbcType=INTEGER},
  162. </if>
  163. <if test="contacts != null">
  164. #{contacts,jdbcType=INTEGER},
  165. </if>
  166. <if test="department != null">
  167. #{department,jdbcType=VARCHAR},
  168. </if>
  169. <if test="dispatchInfo != null">
  170. #{dispatchInfo,jdbcType=VARCHAR},
  171. </if>
  172. <if test="projectName != null">
  173. #{projectName,jdbcType=VARCHAR},
  174. </if>
  175. <if test="projectCatagory != null">
  176. #{projectCatagory,jdbcType=VARCHAR},
  177. </if>
  178. <if test="techField != null">
  179. #{techField,jdbcType=VARCHAR},
  180. </if>
  181. <if test="projectDes != null">
  182. #{projectDes,jdbcType=VARCHAR},
  183. </if>
  184. <if test="projectMode != null">
  185. #{projectMode,jdbcType=INTEGER},
  186. </if>
  187. <if test="projectApproval != null">
  188. #{projectApproval,jdbcType=DECIMAL},
  189. </if>
  190. <if test="subsidy != null">
  191. #{subsidy,jdbcType=INTEGER},
  192. </if>
  193. <if test="consultant != null">
  194. #{consultant,jdbcType=VARCHAR},
  195. </if>
  196. <if test="approvalUrl != null">
  197. #{approvalUrl,jdbcType=VARCHAR},
  198. </if>
  199. <if test="state != null">
  200. #{state,jdbcType=INTEGER},
  201. </if>
  202. <if test="createTime != null">
  203. #{createTime,jdbcType=TIMESTAMP},
  204. </if>
  205. <if test="acceptDate != null">
  206. #{acceptDate,jdbcType=TIMESTAMP},
  207. </if>
  208. <if test="approvedDate != null">
  209. #{approvedDate,jdbcType=TIMESTAMP},
  210. </if>
  211. <if test="recordTime != null">
  212. #{recordTime,jdbcType=TIMESTAMP},
  213. </if>
  214. <if test="deletedSign != null">
  215. #{deletedSign,jdbcType=INTEGER},
  216. </if>
  217. <if test="founder != null">
  218. #{founder,jdbcType=VARCHAR},
  219. </if>
  220. <if test="contractId != null">
  221. #{contractId,jdbcType=VARCHAR},
  222. </if>
  223. <if test="principal != null">
  224. #{principal,jdbcType=VARCHAR},
  225. </if>
  226. </trim>
  227. </insert>
  228. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TechProject">
  229. update tech_project
  230. <set>
  231. <if test="uid != null">
  232. uid = #{uid,jdbcType=VARCHAR},
  233. </if>
  234. <if test="serialNumber != null">
  235. serial_number = #{serialNumber,jdbcType=INTEGER},
  236. </if>
  237. <if test="contacts != null">
  238. contacts = #{contacts,jdbcType=INTEGER},
  239. </if>
  240. <if test="department != null">
  241. department = #{department,jdbcType=VARCHAR},
  242. </if>
  243. <if test="dispatchInfo != null">
  244. dispatch_info = #{dispatchInfo,jdbcType=VARCHAR},
  245. </if>
  246. <if test="projectName != null">
  247. project_name = #{projectName,jdbcType=VARCHAR},
  248. </if>
  249. <if test="projectCatagory != null">
  250. project_catagory = #{projectCatagory,jdbcType=VARCHAR},
  251. </if>
  252. <if test="techField != null">
  253. tech_field = #{techField,jdbcType=VARCHAR},
  254. </if>
  255. <if test="projectDes != null">
  256. project_des = #{projectDes,jdbcType=VARCHAR},
  257. </if>
  258. <if test="projectMode != null">
  259. project_mode = #{projectMode,jdbcType=INTEGER},
  260. </if>
  261. <if test="projectApproval != null">
  262. project_approval = #{projectApproval,jdbcType=DECIMAL},
  263. </if>
  264. <if test="subsidy != null">
  265. subsidy = #{subsidy,jdbcType=INTEGER},
  266. </if>
  267. <if test="consultant != null">
  268. consultant = #{consultant,jdbcType=VARCHAR},
  269. </if>
  270. <if test="approvalUrl != null">
  271. approval_url = #{approvalUrl,jdbcType=VARCHAR},
  272. </if>
  273. <if test="state != null">
  274. state = #{state,jdbcType=INTEGER},
  275. </if>
  276. <if test="createTime != null">
  277. create_time = #{createTime,jdbcType=TIMESTAMP},
  278. </if>
  279. <if test="acceptDate != null">
  280. accept_date = #{acceptDate,jdbcType=TIMESTAMP},
  281. </if>
  282. <if test="approvedDate != null">
  283. approved_date = #{approvedDate,jdbcType=TIMESTAMP},
  284. </if>
  285. <if test="recordTime != null">
  286. record_time = #{recordTime,jdbcType=TIMESTAMP},
  287. </if>
  288. <if test="deletedSign != null">
  289. deleted_sign = #{deletedSign,jdbcType=INTEGER},
  290. </if>
  291. <if test="founder != null">
  292. founder = #{founder,jdbcType=VARCHAR},
  293. </if>
  294. <if test="contractId != null">
  295. contract_id = #{contractId,jdbcType=VARCHAR},
  296. </if>
  297. <if test="principal != null">
  298. principal = #{principal,jdbcType=VARCHAR},
  299. </if>
  300. </set>
  301. where id = #{id,jdbcType=VARCHAR}
  302. </update>
  303. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TechProject">
  304. update tech_project
  305. set uid = #{uid,jdbcType=VARCHAR},
  306. serial_number = #{serialNumber,jdbcType=INTEGER},
  307. contacts = #{contacts,jdbcType=INTEGER},
  308. department = #{department,jdbcType=VARCHAR},
  309. dispatch_info = #{dispatchInfo,jdbcType=VARCHAR},
  310. project_name = #{projectName,jdbcType=VARCHAR},
  311. project_catagory = #{projectCatagory,jdbcType=VARCHAR},
  312. tech_field = #{techField,jdbcType=VARCHAR},
  313. project_des = #{projectDes,jdbcType=VARCHAR},
  314. project_mode = #{projectMode,jdbcType=INTEGER},
  315. project_approval = #{projectApproval,jdbcType=DECIMAL},
  316. subsidy = #{subsidy,jdbcType=INTEGER},
  317. consultant = #{consultant,jdbcType=VARCHAR},
  318. approval_url = #{approvalUrl,jdbcType=VARCHAR},
  319. state = #{state,jdbcType=INTEGER},
  320. create_time = #{createTime,jdbcType=TIMESTAMP},
  321. accept_date = #{acceptDate,jdbcType=TIMESTAMP},
  322. approved_date = #{approvedDate,jdbcType=TIMESTAMP},
  323. record_time = #{recordTime,jdbcType=TIMESTAMP},
  324. deleted_sign = #{deletedSign,jdbcType=INTEGER},
  325. founder = #{founder,jdbcType=VARCHAR},
  326. contract_id = #{contractId,jdbcType=VARCHAR},
  327. principal = #{principal,jdbcType=VARCHAR}
  328. where id = #{id,jdbcType=VARCHAR}
  329. </update>
  330. <select id="findTechProjectClientListByPage" parameterType="java.lang.String"
  331. resultType="com.goafanti.techproject.bo.TechProjectClientListBo">
  332. select p.id, p.uid, i.location_province as province,
  333. i.unit_name as unitName,
  334. CONCAT(i.first_contacts,' ', i.first_mobile) as firstContacts,
  335. CONCAT(i.second_contacts,' ', i.second_mobile) as secondContacts,
  336. CONCAT(i.third_contacts,' ', i.third_mobile) as thirdContacts,
  337. p.serial_number as serialNumber, p.create_time as createTime, p.approved_date as approvedDate,
  338. p.accept_date as acceptDate, a.name as consultant, p.contacts,
  339. p.project_name as projectName, p.project_catagory as projectCatagory, p.tech_field as techField, p.state
  340. FROM tech_project p
  341. LEFT JOIN organization_identity i on i.uid = p.uid
  342. LEFT JOIN admin a on p.consultant = a.id
  343. where p.deleted_sign = 0
  344. <if test ="uid != null">
  345. and p.uid = #{uid,jdbcType=VARCHAR}
  346. </if>
  347. order by p.serial_number desc
  348. <if test="page_sql!=null">
  349. ${page_sql}
  350. </if>
  351. </select>
  352. <select id="findTechProjectClientCount" resultType="java.lang.Integer" parameterType="String">
  353. select count(1)
  354. FROM tech_project p
  355. LEFT JOIN organization_identity i on i.uid = p.uid
  356. LEFT JOIN admin a on p.consultant = a.id
  357. where p.deleted_sign = 0
  358. <if test ="uid != null">
  359. and p.uid = #{uid,jdbcType=VARCHAR}
  360. </if>
  361. </select>
  362. <select id ="findTechProjectManageListByPage" parameterType="java.lang.String"
  363. resultType="com.goafanti.techproject.bo.TechProjectManageListBo">
  364. select p.id, p.uid, i.licence_province as province, p.contract_id as contractId,
  365. i.unit_name as unitName,
  366. CONCAT(i.first_contacts,' ', i.first_mobile) as firstContacts,
  367. CONCAT(i.second_contacts,' ', i.second_mobile) as secondContacts,
  368. CONCAT(i.third_contacts,' ', i.third_mobile) as thirdContacts,
  369. p.serial_number as serialNumber, p.create_time as createTime, p.approved_date as approvedDate,
  370. p.accept_date as acceptDate, a.name as consultant, p.contacts, ad.name as founder,
  371. p.project_name as projectName, p.project_catagory as projectCatagory, p.tech_field as techField, p.state,
  372. w.id as wid, w.website, w.account_number as accountNumber, w.department,
  373. w.password, c.serial_number as contractNumber
  374. FROM tech_project p
  375. LEFT JOIN organization_identity i on i.uid = p.uid
  376. LEFT JOIN admin a on p.consultant = a.id
  377. LEFT JOIN admin ad on p.founder = ad.id
  378. LEFT JOIN tech_website w on p.department = w.id
  379. LEFT JOIN contract c on c.id = p.contract_id
  380. <if test="principal != null">
  381. left join contract_log l on p.contract_id=l.cid
  382. </if>
  383. where p.deleted_sign = 0 and (w.deleted_sign is null or w.deleted_sign = 0)
  384. <if test="principal != null">
  385. and l.principal = #{principal,jdbcType=VARCHAR}
  386. </if>
  387. <if test="contractId != null">
  388. and p.contract_id = #{contractId,jdbcType=VARCHAR}
  389. </if>
  390. <if test="province != null">
  391. and i.licence_province = #{province,jdbcType=INTEGER}
  392. </if>
  393. <if test="uid != null">
  394. and p.uid = #{uid,jdbcType=VARCHAR}
  395. </if>
  396. <if test="unitName != null" >
  397. and i.unit_name like CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')
  398. </if>
  399. <if test="principal != null">
  400. group by p.id
  401. </if>
  402. order by p.serial_number desc
  403. <if test="page_sql!=null">
  404. ${page_sql}
  405. </if>
  406. </select>
  407. <select id="findTechProjectManageCount" resultType="java.lang.Integer" parameterType="String">
  408. select count(1)
  409. FROM tech_project p
  410. LEFT JOIN organization_identity i on i.uid = p.uid
  411. LEFT JOIN tech_website w on p.department = w.id
  412. <if test="principal != null">
  413. left join contract_log l on p.contract_id=l.cid
  414. </if>
  415. where p.deleted_sign = 0 and (w.deleted_sign is null or w.deleted_sign = 0)
  416. <if test="principal != null">
  417. and l.principal = #{principal,jdbcType=VARCHAR}
  418. </if>
  419. <if test="contractId != null">
  420. and p.contract_id = #{contractId,jdbcType=VARCHAR}
  421. </if>
  422. <if test="province != null">
  423. and i.licence_province = #{province,jdbcType=INTEGER}
  424. </if>
  425. <if test="uid != null">
  426. and p.uid = #{uid,jdbcType=VARCHAR}
  427. </if>
  428. <if test="unitName != null" >
  429. and i.unit_name like CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')
  430. </if>
  431. <if test="principal != null">
  432. group by p.id
  433. </if>
  434. </select>
  435. <select id="selectProjectDetail" resultType="com.goafanti.techproject.bo.TechProjectDetailBo" parameterType="java.lang.String">
  436. select
  437. p.id, p.uid, i.licence_province as province,
  438. i.licence_city as city, i.licence_area as area, i.postal_address as postalAddress,
  439. i.unit_name as unitName, i.org_code as orgCode, p.serial_number as serialNumber,
  440. a.name as consultant, p.contacts, p.project_des as projectDes,
  441. p.subsidy, p.dispatch_info as dispatchInfo, p.project_mode as projectMode,
  442. p.project_approval as projectApproval, p.approval_url as approvalUrl , p.department,
  443. p.project_name as projectName, p.project_catagory as projectCatagory, p.tech_field as techField,
  444. p.state
  445. FROM tech_project p
  446. LEFT JOIN organization_identity i on i.uid = p.uid
  447. LEFT JOIN admin a on p.consultant = a.id
  448. where p.deleted_sign = 0 and p.id = #{uid,jdbcType=VARCHAR}
  449. </select>
  450. <update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
  451. update tech_project set deleted_sign = 1
  452. where id in
  453. <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
  454. #{item}
  455. </foreach>
  456. </update>
  457. <select id="countTechProjectDone" resultType="java.lang.Integer">
  458. select
  459. count(1)
  460. from tech_project
  461. where uid = #{uid,jdbcType=VARCHAR}
  462. and
  463. deleted_sign = 0
  464. and state in (6,8)
  465. and approved_date >=
  466. (
  467. select
  468. str_to_date(CONCAT(#{year,jdbcType=INTEGER}-3,'-01-01'), '%Y-%m-%d %H')
  469. )
  470. and approved_date <![CDATA[ < ]]>
  471. (
  472. select
  473. str_to_date(CONCAT(#{year,jdbcType=INTEGER},'-01-01'), '%Y-%m-%d %H')
  474. )
  475. </select>
  476. <select id="countTechProjectUndone" resultType="java.lang.Integer">
  477. select
  478. count(1)
  479. from tech_project
  480. where uid = #{uid,jdbcType=VARCHAR}
  481. and deleted_sign = 0
  482. and state in (1,2,3,4,5,7)
  483. and approved_date >=
  484. (
  485. select
  486. str_to_date(CONCAT(#{year,jdbcType=INTEGER}-3,'-01-01'), '%Y-%m-%d %H')
  487. )
  488. and approved_date <![CDATA[ < ]]>
  489. (
  490. select
  491. str_to_date(CONCAT(#{year,jdbcType=INTEGER},'-01-01'), '%Y-%m-%d %H')
  492. )
  493. </select>
  494. <select id="selectWebsiteUnitNames" parameterType="java.lang.String" resultType="com.goafanti.user.bo.OrgUnitNames">
  495. select distinct(oi.uid), oi.unit_name as unitName
  496. from tech_project tp
  497. LEFT JOIN organization_identity oi on oi.uid = tp.uid
  498. <if test="_parameter != null">
  499. LEFT JOIN tech_project_log tpl on tp.id = tpl.pid
  500. </if>
  501. where tp.deleted_sign = 0
  502. <if test="_parameter != null">
  503. and tpl.principal = #{principal,jdbcType=VARCHAR}
  504. </if>
  505. <if test="_parameter != null">
  506. group by tp.id
  507. </if>
  508. </select>
  509. <select id="listContractTechProjectByContractId" parameterType="java.lang.String" resultType="com.goafanti.techproject.bo.TechProjectContractListBo">
  510. select
  511. tp.id, tp.uid, tp.contract_id as contractId,
  512. tp.project_name as projectName, tp.project_catagory as projectCatagory, tp.state,
  513. tp.tech_field as techField, a.name as principle
  514. from tech_project tp
  515. left join admin a on a.id = tp.principal
  516. where tp.contract_id = #{contractId,jdbcType=VARCHAR}
  517. </select>
  518. <insert id="batchInsert" parameterType="com.goafanti.common.model.TechProject">
  519. insert into tech_project (id, uid, serial_number,
  520. contacts, department, dispatch_info,
  521. project_name, project_catagory, tech_field,
  522. project_des, project_mode, project_approval,
  523. subsidy, consultant, approval_url,
  524. state, create_time, accept_date,
  525. approved_date, record_time, deleted_sign, founder, contract_id, principal
  526. )
  527. values
  528. <foreach item="item" index="index" collection="list" separator=",">
  529. (
  530. #{item.id,jdbcType=VARCHAR}, #{item.uid,jdbcType=VARCHAR},
  531. #{item.serialNumber,jdbcType=INTEGER},
  532. #{item.contacts,jdbcType=INTEGER}, #{item.department,jdbcType=VARCHAR}, #{item.dispatchInfo,jdbcType=VARCHAR},
  533. #{item.projectName,jdbcType=VARCHAR}, #{item.projectCatagory,jdbcType=VARCHAR},
  534. #{item.techField,jdbcType=VARCHAR},
  535. #{item.projectDes,jdbcType=VARCHAR}, #{item.projectMode,jdbcType=INTEGER}, #{item.projectApproval,jdbcType=DECIMAL},
  536. #{item.subsidy,jdbcType=INTEGER}, #{item.consultant,jdbcType=VARCHAR},
  537. #{item.approvalUrl,jdbcType=VARCHAR},
  538. #{item.state,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.acceptDate,jdbcType=TIMESTAMP},
  539. #{item.approvedDate,jdbcType=TIMESTAMP}, #{item.recordTime,jdbcType=TIMESTAMP},
  540. #{item.deletedSign,jdbcType=INTEGER}, #{item.founder,jdbcType=VARCHAR}, #{item.contractId,jdbcType=VARCHAR},
  541. #{item.principal,jdbcType=VARCHAR}
  542. )
  543. </foreach>
  544. </insert>
  545. <select id="findTechProjectNumByUid" parameterType="java.lang.String" resultType="java.lang.Integer">
  546. select
  547. count(1)
  548. from tech_project
  549. where
  550. deleted_sign = 0
  551. and uid = #{uid,jdbcType=VARCHAR}
  552. </select>
  553. <update id="batchDeleteByContractId" parameterType="java.util.List">
  554. update tech_project set deleted_sign = 1
  555. where contract_id in
  556. <foreach item="item" index="index" collection="list" open="("
  557. separator="," close=")">
  558. #{item}
  559. </foreach>
  560. </update>
  561. </mapper>