TechProjectMapper.xml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  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. p.serial_number as serialNumber, p.create_time as createTime, p.approved_date as approvedDate,
  335. p.accept_date as acceptDate, a.name as consultant, p.contacts,
  336. p.project_name as projectName, p.project_catagory as projectCatagory, p.tech_field as techField, p.state
  337. FROM tech_project p
  338. LEFT JOIN organization_identity i on i.uid = p.uid
  339. LEFT JOIN admin a on p.consultant = a.id
  340. where p.deleted_sign = 0
  341. <if test ="uid != null">
  342. and p.uid = #{uid,jdbcType=VARCHAR}
  343. </if>
  344. order by p.serial_number desc
  345. <if test="page_sql!=null">
  346. ${page_sql}
  347. </if>
  348. </select>
  349. <select id="findTechProjectClientCount" resultType="java.lang.Integer" parameterType="String">
  350. select count(1)
  351. FROM tech_project p
  352. LEFT JOIN organization_identity i on i.uid = p.uid
  353. LEFT JOIN admin a on p.consultant = a.id
  354. where p.deleted_sign = 0
  355. <if test ="uid != null">
  356. and p.uid = #{uid,jdbcType=VARCHAR}
  357. </if>
  358. </select>
  359. <select id ="findTechProjectManageListByPage" parameterType="java.lang.String"
  360. resultType="com.goafanti.techproject.bo.TechProjectManageListBo">
  361. select p.id, p.uid, i.licence_province as province, p.contract_id as contractId,
  362. i.unit_name as unitName,
  363. p.serial_number as serialNumber, p.create_time as createTime, p.approved_date as approvedDate,
  364. p.accept_date as acceptDate, a.name as consultant, p.contacts, ad.name as founder,
  365. p.project_name as projectName, p.project_catagory as projectCatagory, p.tech_field as techField, p.state,
  366. w.id as wid, w.website, w.account_number as accountNumber, w.department,
  367. w.password, c.serial_number as contractNumber
  368. FROM tech_project p
  369. LEFT JOIN organization_identity i on i.uid = p.uid
  370. LEFT JOIN admin a on p.consultant = a.id
  371. LEFT JOIN admin ad on p.founder = ad.id
  372. LEFT JOIN tech_website w on p.department = w.id
  373. LEFT JOIN contract c on c.id = p.contract_id
  374. <if test="principal != null">
  375. left join contract_log l on p.contract_id=l.cid
  376. </if>
  377. where p.deleted_sign = 0 and (w.deleted_sign is null or w.deleted_sign = 0)
  378. <if test="principal != null">
  379. and l.principal = #{principal,jdbcType=VARCHAR}
  380. </if>
  381. <if test="contractId != null">
  382. and p.contract_id = #{contractId,jdbcType=VARCHAR}
  383. </if>
  384. <if test="province != null">
  385. and i.licence_province = #{province,jdbcType=INTEGER}
  386. </if>
  387. <if test="uid != null">
  388. and p.uid = #{uid,jdbcType=VARCHAR}
  389. </if>
  390. <if test="unitName != null" >
  391. and i.unit_name like CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')
  392. </if>
  393. <if test="principal != null">
  394. group by p.id,i.id
  395. </if>
  396. order by p.serial_number desc
  397. <if test="page_sql!=null">
  398. ${page_sql}
  399. </if>
  400. </select>
  401. <select id="findTechProjectManageCount" resultType="java.lang.Integer" parameterType="String">
  402. select count(distinct(p.id))
  403. FROM tech_project p
  404. LEFT JOIN organization_identity i on i.uid = p.uid
  405. LEFT JOIN tech_website w on p.department = w.id
  406. <if test="principal != null">
  407. left join contract_log l on p.contract_id=l.cid
  408. </if>
  409. where p.deleted_sign = 0 and (w.deleted_sign is null or w.deleted_sign = 0)
  410. <if test="principal != null">
  411. and l.principal = #{principal,jdbcType=VARCHAR}
  412. </if>
  413. <if test="contractId != null">
  414. and p.contract_id = #{contractId,jdbcType=VARCHAR}
  415. </if>
  416. <if test="province != null">
  417. and i.licence_province = #{province,jdbcType=INTEGER}
  418. </if>
  419. <if test="uid != null">
  420. and p.uid = #{uid,jdbcType=VARCHAR}
  421. </if>
  422. <if test="unitName != null" >
  423. and i.unit_name like CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')
  424. </if>
  425. </select>
  426. <select id="selectProjectDetail" resultType="com.goafanti.techproject.bo.TechProjectDetailBo" parameterType="java.lang.String">
  427. select
  428. p.id, p.uid, i.licence_province as province,
  429. i.licence_city as city, i.licence_area as area, i.postal_address as postalAddress,
  430. i.unit_name as unitName, i.org_code as orgCode, p.serial_number as serialNumber,
  431. a.name as consultant, p.contacts, p.project_des as projectDes,
  432. p.subsidy, p.dispatch_info as dispatchInfo, p.project_mode as projectMode,
  433. p.project_approval as projectApproval, p.approval_url as approvalUrl , p.department,
  434. p.project_name as projectName, p.project_catagory as projectCatagory, p.tech_field as techField,
  435. p.state
  436. FROM tech_project p
  437. LEFT JOIN organization_identity i on i.uid = p.uid
  438. LEFT JOIN admin a on p.consultant = a.id
  439. where p.deleted_sign = 0 and p.id = #{uid,jdbcType=VARCHAR}
  440. </select>
  441. <update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
  442. update tech_project set deleted_sign = 1
  443. where id in
  444. <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
  445. #{item}
  446. </foreach>
  447. </update>
  448. <select id="countTechProjectDone" resultType="java.lang.Integer">
  449. select
  450. count(1)
  451. from tech_project
  452. where uid = #{uid,jdbcType=VARCHAR}
  453. and
  454. deleted_sign = 0
  455. and state in (6,8)
  456. and approved_date >=
  457. (
  458. select
  459. str_to_date(CONCAT(#{year,jdbcType=INTEGER}-3,'-01-01'), '%Y-%m-%d %H')
  460. )
  461. and approved_date <![CDATA[ < ]]>
  462. (
  463. select
  464. str_to_date(CONCAT(#{year,jdbcType=INTEGER},'-01-01'), '%Y-%m-%d %H')
  465. )
  466. </select>
  467. <select id="countTechProjectUndone" resultType="java.lang.Integer">
  468. select
  469. count(1)
  470. from tech_project
  471. where uid = #{uid,jdbcType=VARCHAR}
  472. and deleted_sign = 0
  473. and state in (1,2,3,4,5,7)
  474. and approved_date >=
  475. (
  476. select
  477. str_to_date(CONCAT(#{year,jdbcType=INTEGER}-3,'-01-01'), '%Y-%m-%d %H')
  478. )
  479. and approved_date <![CDATA[ < ]]>
  480. (
  481. select
  482. str_to_date(CONCAT(#{year,jdbcType=INTEGER},'-01-01'), '%Y-%m-%d %H')
  483. )
  484. </select>
  485. <select id="selectWebsiteUnitNames" parameterType="java.lang.String" resultType="com.goafanti.user.bo.OrgUnitNames">
  486. select distinct(oi.uid), oi.unit_name as unitName
  487. from tech_project tp
  488. LEFT JOIN organization_identity oi on oi.uid = tp.uid
  489. <if test="_parameter != null">
  490. LEFT JOIN tech_project_log tpl on tp.id = tpl.pid
  491. </if>
  492. where tp.deleted_sign = 0
  493. <if test="_parameter != null">
  494. and tpl.principal = #{principal,jdbcType=VARCHAR}
  495. </if>
  496. <if test="_parameter != null">
  497. group by tp.id,oi.id
  498. </if>
  499. </select>
  500. <select id="listContractTechProjectByContractId" parameterType="java.lang.String" resultType="com.goafanti.techproject.bo.TechProjectContractListBo">
  501. select
  502. tp.id, tp.uid, tp.contract_id as contractId,
  503. tp.project_name as projectName, tp.project_catagory as projectCatagory, tp.state,
  504. tp.tech_field as techField, a.name as principle
  505. from tech_project tp
  506. left join admin a on a.id = tp.principal
  507. where tp.contract_id = #{contractId,jdbcType=VARCHAR}
  508. </select>
  509. <insert id="batchInsert" parameterType="com.goafanti.common.model.TechProject">
  510. insert into tech_project (id, uid, serial_number,
  511. contacts, department, dispatch_info,
  512. project_name, project_catagory, tech_field,
  513. project_des, project_mode, project_approval,
  514. subsidy, consultant, approval_url,
  515. state, create_time, accept_date,
  516. approved_date, record_time, deleted_sign, founder, contract_id, principal
  517. )
  518. values
  519. <foreach item="item" index="index" collection="list" separator=",">
  520. (
  521. #{item.id,jdbcType=VARCHAR}, #{item.uid,jdbcType=VARCHAR},
  522. #{item.serialNumber,jdbcType=INTEGER},
  523. #{item.contacts,jdbcType=INTEGER}, #{item.department,jdbcType=VARCHAR}, #{item.dispatchInfo,jdbcType=VARCHAR},
  524. #{item.projectName,jdbcType=VARCHAR}, #{item.projectCatagory,jdbcType=VARCHAR},
  525. #{item.techField,jdbcType=VARCHAR},
  526. #{item.projectDes,jdbcType=VARCHAR}, #{item.projectMode,jdbcType=INTEGER}, #{item.projectApproval,jdbcType=DECIMAL},
  527. #{item.subsidy,jdbcType=INTEGER}, #{item.consultant,jdbcType=VARCHAR},
  528. #{item.approvalUrl,jdbcType=VARCHAR},
  529. #{item.state,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.acceptDate,jdbcType=TIMESTAMP},
  530. #{item.approvedDate,jdbcType=TIMESTAMP}, #{item.recordTime,jdbcType=TIMESTAMP},
  531. #{item.deletedSign,jdbcType=INTEGER}, #{item.founder,jdbcType=VARCHAR}, #{item.contractId,jdbcType=VARCHAR},
  532. #{item.principal,jdbcType=VARCHAR}
  533. )
  534. </foreach>
  535. </insert>
  536. <select id="findTechProjectNumByUid" parameterType="java.lang.String" resultType="java.lang.Integer">
  537. select
  538. count(1)
  539. from tech_project
  540. where
  541. deleted_sign = 0
  542. and uid = #{uid,jdbcType=VARCHAR}
  543. </select>
  544. <update id="batchDeleteByContractId" parameterType="java.util.List">
  545. update tech_project set deleted_sign = 1
  546. where contract_id in
  547. <foreach item="item" index="index" collection="list" open="("
  548. separator="," close=")">
  549. #{item}
  550. </foreach>
  551. </update>
  552. <select id="listProjectByPage" resultType="com.goafanti.techproject.bo.ProjectListBo">
  553. select
  554. a.id,
  555. a.serial_number as serialNumber,
  556. a.sign_date as signDate,
  557. a.uid,
  558. a.status as projectStatus,
  559. a.deleted_sign as deleteSign,
  560. a.order_no as orderNo,
  561. a.type as projectType,
  562. a.create_time as projectTime,
  563. b.nickname as buyerName,
  564. c.create_time as orderTime,
  565. c.order_status as orderStatus,
  566. c.liquidation_status as liquidationStatus,
  567. c.approval,
  568. d.name as salesmanName
  569. from
  570. contract a left join user b on
  571. a.uid = b.id left join t_order c on
  572. a.order_no = c.order_no left join admin d on
  573. c.salesman_id = d.id
  574. where 1=1
  575. <if test="deleteSign != null">
  576. a.delete_sign = #{deleteSign,jdbcType=INTEGER}
  577. </if>
  578. <if test="orderNo != null and orderNo != ''">
  579. a.order_no = #{orderNo,jdbcType=VARCHAR}
  580. </if>
  581. <if test="setUpStartDate != null and setUpStartDate != ''">
  582. a.create_time &gt; #{setUpStartDate,jdbcType=TIMESTAMP}
  583. </if>
  584. <if test="setUpEndDate != null and setUpEndDate != ''">
  585. a.create_time &lt; #{setUpEndDate,jdbcType=TIMESTAMP}
  586. </if>
  587. <if test="buyerName != null and buyerName != ''">
  588. b.nickname = #{buyerName,jdbcType=VARCHAR}
  589. </if>
  590. <if test="salesmanName != null and salesmanName !=''">
  591. and d.name = #{salesmanName,jdbcType=VARCHAR}
  592. </if>
  593. <if test="depId != null adn depId != ''">
  594. and d.department_id = #{depId,jdbcType=VARCHAR}
  595. </if>
  596. <if test="orderStartDate != null and orderStartDate != ''">
  597. and c.create_time &gt; #{orderStartDate,jdbcType=TIMESTAMP}
  598. </if>
  599. <if test="orderEndDate != null and orderEndDate != ''">
  600. and c.create_time &lt; #{orderEndDate,jdbcType=TIMESTAMP}
  601. </if>
  602. <if test="page_sql != null">
  603. ${page_sql}
  604. </if>
  605. </select>
  606. <select id="listProjectCount" parameterType="java.lang.Integer">
  607. select
  608. count(0)
  609. from
  610. contract a left join user b on
  611. a.uid = b.id left join t_order c on
  612. a.order_no = c.order_no left join admin d on
  613. c.salesman_id = d.id
  614. where 1=1
  615. <if test="deleteSign != null">
  616. a.delete_sign = #{deleteSign,jdbcType=INTEGER}
  617. </if>
  618. <if test="orderNo != null and orderNo != ''">
  619. a.order_no = #{orderNo,jdbcType=VARCHAR}
  620. </if>
  621. <if test="setUpStartDate != null and setUpStartDate != ''">
  622. a.create_time &gt; #{setUpStartDate,jdbcType=TIMESTAMP}
  623. </if>
  624. <if test="setUpEndDate != null and setUpEndDate != ''">
  625. a.create_time &lt; #{setUpEndDate,jdbcType=TIMESTAMP}
  626. </if>
  627. <if test="buyerName != null and buyerName != ''">
  628. b.nickname = #{buyerName,jdbcType=VARCHAR}
  629. </if>
  630. <if test="salesmanName != null and salesmanName !=''">
  631. and d.name = #{salesmanName,jdbcType=VARCHAR}
  632. </if>
  633. <if test="depId != null adn depId != ''">
  634. and d.department_id = #{depId,jdbcType=VARCHAR}
  635. </if>
  636. <if test="orderStartDate != null and orderStartDate != ''">
  637. and c.create_time &gt; #{orderStartDate,jdbcType=TIMESTAMP}
  638. </if>
  639. <if test="orderEndDate != null and orderEndDate != ''">
  640. and c.create_time &lt; #{orderEndDate,jdbcType=TIMESTAMP}
  641. </if>
  642. </select>
  643. </mapper>