TechProjectMapper.xml 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174
  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. date_format(a.sign_date,'%Y-%m-%d %H:%i:%S') as signDate,
  557. date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as projectTime,
  558. a.uid,
  559. a.status as projectStatus,
  560. a.task_distribution as taskDistribution,
  561. a.deleted_sign as deletedSign,
  562. a.order_no as orderNo,
  563. b.nickname as buyerName,
  564. b.type as buyerType,
  565. f.cname as projectType,
  566. c.create_time as orderTime,
  567. c.order_status as orderStatus,
  568. c.liquidation_status as liquidationStatus,
  569. c.approval,
  570. d.name as salesmanName,
  571. e.name as departmentName,
  572. g.name as principalName
  573. from
  574. contract a left join user b on
  575. a.uid = b.id left join t_order c on
  576. a.order_no = c.order_no left join admin d on
  577. c.salesman_id = d.id left join department e on
  578. d.department_id = e.id left join business_category f on
  579. a.type = f.id left join admin g on
  580. a.principal = g.id
  581. where 1=1
  582. <if test="deletedSign != null">
  583. and a.deleted_sign = #{deletedSign,jdbcType=INTEGER}
  584. </if>
  585. <if test="orderNo != null and orderNo != ''">
  586. and a.order_no = #{orderNo,jdbcType=VARCHAR}
  587. </if>
  588. <if test="serialNumber != null and serialNumber != ''">
  589. and a.serial_number = #{serialNumber,jdbcType=VARCHAR}
  590. </if>
  591. <if test="setUpStartDate != null and setUpStartDate != ''">
  592. and a.create_time &gt; #{setUpStartDate,jdbcType=TIMESTAMP}
  593. </if>
  594. <if test="setUpEndDate != null and setUpEndDate != ''">
  595. and a.create_time &lt; #{setUpEndDate,jdbcType=TIMESTAMP}
  596. </if>
  597. <if test="taskDistribution != null">
  598. and a.task_distribution = #{taskDistribution,jdbcType=INTEGER}
  599. </if>
  600. <if test="buyerName != null and buyerName != ''">
  601. and b.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
  602. </if>
  603. <if test="salesmanName != null and salesmanName !=''">
  604. and d.name = #{salesmanName,jdbcType=VARCHAR}
  605. </if>
  606. <if test="depId != null and depId != ''">
  607. and d.department_id = #{depId,jdbcType=VARCHAR}
  608. </if>
  609. <if test="orderStartDate != null and orderStartDate != ''">
  610. and c.create_time &gt; #{orderStartDate,jdbcType=TIMESTAMP}
  611. </if>
  612. <if test="orderEndDate != null and orderEndDate != ''">
  613. and c.create_time &lt; #{orderEndDate,jdbcType=TIMESTAMP}
  614. </if>
  615. <if test="principalName != null and principalName != ''">
  616. and g.name = #{principalName,jdbcType=VARCHAR}
  617. </if>
  618. order by a.create_time desc
  619. <if test="page_sql != null">
  620. ${page_sql}
  621. </if>
  622. </select>
  623. <select id="listProjectCount" resultType="java.lang.Integer">
  624. select
  625. count(0)
  626. from
  627. contract a left join user b on
  628. a.uid = b.id left join t_order c on
  629. a.order_no = c.order_no left join admin d on
  630. c.salesman_id = d.id left join department e on
  631. d.department_id = e.id left join business_category f on
  632. a.type = f.id left join admin g on
  633. a.principal = g.id
  634. where 1=1
  635. <if test="deletedSign != null">
  636. and a.deleted_sign = #{deletedSign,jdbcType=INTEGER}
  637. </if>
  638. <if test="orderNo != null and orderNo != ''">
  639. and a.order_no = #{orderNo,jdbcType=VARCHAR}
  640. </if>
  641. <if test="serialNumber != null and serialNumber != ''">
  642. and a.serial_number = #{serialNumber,jdbcType=VARCHAR}
  643. </if>
  644. <if test="setUpStartDate != null and setUpStartDate != ''">
  645. and a.create_time &gt; #{setUpStartDate,jdbcType=TIMESTAMP}
  646. </if>
  647. <if test="setUpEndDate != null and setUpEndDate != ''">
  648. and a.create_time &lt; #{setUpEndDate,jdbcType=TIMESTAMP}
  649. </if>
  650. <if test="taskDistribution != null">
  651. and a.task_distribution = #{taskDistribution,jdbcType=INTEGER}
  652. </if>
  653. <if test="buyerName != null and buyerName != ''">
  654. and b.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
  655. </if>
  656. <if test="salesmanName != null and salesmanName !=''">
  657. and d.name = #{salesmanName,jdbcType=VARCHAR}
  658. </if>
  659. <if test="depId != null and depId != ''">
  660. and d.department_id = #{depId,jdbcType=VARCHAR}
  661. </if>
  662. <if test="orderStartDate != null and orderStartDate != ''">
  663. and c.create_time &gt; #{orderStartDate,jdbcType=TIMESTAMP}
  664. </if>
  665. <if test="orderEndDate != null and orderEndDate != ''">
  666. and c.create_time &lt; #{orderEndDate,jdbcType=TIMESTAMP}
  667. </if>
  668. <if test="principalName != null and principalName != ''">
  669. and g.name = #{principalName,jdbcType=VARCHAR}
  670. </if>
  671. </select>
  672. <select id="selectTechProjectDetail" resultType="com.goafanti.techproject.bo.ProjectDetailBo">
  673. <choose>
  674. <when test="buyerType == 0">
  675. select
  676. a.id,
  677. a.serial_number as serialNumber,
  678. date_format( a.sign_date, '%Y-%m-%d %H:%i:%S' ) as signDate,
  679. a.sign_comment as signComment,
  680. date_format( a.complete_date, '%Y-%m-%d %H:%i:%S' ) as completeDate,
  681. a.complete_comment as completeComment,
  682. a.uid,
  683. a.status as projectStatus,
  684. a.deleted_sign as deletedSign,
  685. a.order_no as orderNo,
  686. b.nickname as buyerName,
  687. d.name as principalName,
  688. f.name as buyerProvince,
  689. g.cname as projectType,
  690. t.contract_no as contractNo,
  691. h.name as salesmanName
  692. from
  693. contract a left join user b on
  694. a.uid = b.id left join admin d on
  695. a.principal = d.id left join user_identity e on
  696. a.uid = e.uid left join district_glossory f on
  697. e.province = f.id left join business_category g on
  698. a.type = g.id left join t_order t on
  699. a.order_no=t.order_no left join admin h on
  700. t.salesman_id=h.id
  701. where a.id = #{contractId,jdbcType=VARCHAR}
  702. </when>
  703. <when test="buyerType == 1">
  704. select
  705. a.id,
  706. a.serial_number as serialNumber,
  707. date_format(a.sign_date,'%Y-%m-%d %H:%i:%S') as signDate,
  708. a.sign_comment as signComment,
  709. date_format(a.complete_date,'%Y-%m-%d %H:%i:%S') as completeDate,
  710. a.complete_comment as completeComment,
  711. a.uid,
  712. a.status as projectStatus,
  713. a.deleted_sign as deletedSign,
  714. a.order_no as orderNo,
  715. b.nickname as buyerName,
  716. d.name as principalName,
  717. f.name as buyerProvince,
  718. g.cname as projectType,
  719. t.contract_no as contractNo,
  720. h.name as salesmanName
  721. from
  722. contract a left join user b on
  723. a.uid = b.id left join admin d on
  724. a.principal = d.id left join organization_identity e on
  725. a.uid = e.uid left join district_glossory f on
  726. e.location_province = f.id left join business_category g on
  727. a.type = g.id left join t_order t on
  728. a.order_no=t.order_no left join admin h on
  729. t.salesman_id=h.id
  730. where a.id = #{contractId,jdbcType=VARCHAR}
  731. </when>
  732. </choose>
  733. </select>
  734. <select id="selectProjectTask" resultType="com.goafanti.techproject.bo.TaskListBo">
  735. select
  736. a.id as taskId,
  737. a.commodity_name as commodityName,
  738. a.commodity_quantity as commodityQuantity,
  739. a.task_status as taskStatus,
  740. a.deleted_sign as deletedSign,
  741. a.task_comment as taskComment,
  742. a.publish_status as publishStatus,
  743. ifnull(b.name,'暂无') as technicianName,
  744. ifnull(b.contact_mobile,'暂无') as technicianMobile
  745. from
  746. contract_task a left join admin b on
  747. a.task_receiver = b.id
  748. where a.contract_id = #{contractId,jdbcType=VARCHAR}
  749. </select>
  750. <select id="selectMyProjectTaskByPage" resultType="com.goafanti.techproject.bo.TaskListBo">
  751. select
  752. a.id as taskId,
  753. a.commodity_id as commodityId,
  754. a.serial_number as taskNo,
  755. a.task_status as taskStatus,
  756. a.deleted_sign as deleteSign,
  757. date_format(a.task_distribution_time,'%Y-%m-%d %H:%i:%S') as taskDistributionTimes,
  758. a.task_comment as taskComment,
  759. a.publish_status as publishStatus,
  760. b.bname as commodityName ,
  761. c.cname as categoryName,
  762. c.id as categoryId,
  763. d.serial_number as projectNo,
  764. d.status,
  765. d.deleted_sign as deletedSign,
  766. e.nickname as buyerName,
  767. f.name as taskReceiverName
  768. from
  769. contract_task a left join business_project b on
  770. a.commodity_id = b.id left join business_category c on
  771. b.cid = c.id left join contract d on
  772. a.contract_id = d.id left join user e on
  773. d.uid = e.id left join admin f on
  774. a.task_receiver = f.id
  775. where 1=1
  776. <if test="taskReceiverId != null and taskReceiverId != ''">
  777. and a.task_receiver = #{taskReceiverId,jdbcType=VARCHAR}
  778. </if>
  779. <if test="deleteSign != null">
  780. and a.deleted_sign = #{deleteSign,jdbcType=VARCHAR}
  781. </if>
  782. <if test="publishStatus != null">
  783. and a.publish_status = #{publishStatus,jdbcType=VARCHAR}
  784. </if>
  785. <if test="taskStatus != null">
  786. and a.task_status = #{taskStatus,jdbcType=VARCHAR}
  787. </if>
  788. <if test="startDate != null">
  789. and a.task_distribution_time &gt; #{startDate,jdbcType=TIMESTAMP}
  790. </if>
  791. <if test="endDate != null">
  792. and a.task_distribution_time &lt; #{endDate,jdbcType=TIMESTAMP}
  793. </if>
  794. <if test="projectNo != null and projectNo != ''">
  795. and d.serial_number = #{projectNo,jdbcType=VARCHAR}
  796. </if>
  797. <if test="buyerName != null and buyerName != ''">
  798. and e.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
  799. </if>
  800. <if test="taskReceiverName != null and taskReceiverName != ''">
  801. and f.name = #{taskReceiverName,jdbcType=VARCHAR}
  802. </if>
  803. <if test="categoryId != null and categoryId != ''">
  804. and c.id = #{categoryId,jdbcType=VARCHAR}
  805. </if>
  806. order by a.task_distribution_time desc
  807. <if test="page_sql != null">
  808. ${page_sql}
  809. </if>
  810. </select>
  811. <select id="selectMyProjectTaskCount" resultType="java.lang.Integer">
  812. select
  813. count(0)
  814. from
  815. contract_task a left join business_project b on
  816. a.commodity_id = b.id left join business_category c on
  817. b.cid = c.id left join contract d on
  818. a.contract_id = d.id left join user e on
  819. d.uid = e.id left join admin f on
  820. a.task_receiver = f.id
  821. where 1=1
  822. <if test="taskReceiverId != null and taskReceiverId != ''">
  823. and a.task_receiver = #{taskReceiverId,jdbcType=VARCHAR}
  824. </if>
  825. <if test="deleteSign != null">
  826. and a.deleted_sign = #{deleteSign,jdbcType=VARCHAR}
  827. </if>
  828. <if test="publishStatus != null">
  829. and a.publish_status = #{publishStatus,jdbcType=VARCHAR}
  830. </if>
  831. <if test="taskStatus != null">
  832. and a.task_status = #{taskStatus,jdbcType=VARCHAR}
  833. </if>
  834. <if test="startDate != null">
  835. and a.task_distribution_time &gt; #{startDate,jdbcType=TIMESTAMP}
  836. </if>
  837. <if test="endDate != null">
  838. and a.task_distribution_time &lt; #{endDate,jdbcType=TIMESTAMP}
  839. </if>
  840. <if test="projectNo != null and projectNo != ''">
  841. and d.serial_number = #{projectNo,jdbcType=VARCHAR}
  842. </if>
  843. <if test="buyerName != null and buyerName != ''">
  844. and e.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
  845. </if>
  846. <if test="taskReceiverName != null and taskReceiverName != ''">
  847. and f.name = #{taskReceiverName,jdbcType=VARCHAR}
  848. </if>
  849. <if test="categoryId != null and categoryId != ''">
  850. and c.id = #{categoryId,jdbcType=VARCHAR}
  851. </if>
  852. <if test="taskReceiverId != null and taskReceiverId != ''">
  853. and a.task_receiver = #{taskReceiverId,jdbcType=VARCHAR}
  854. </if>
  855. <if test="deleteSign != null">
  856. and a.deleted_sign = #{deleteSign,jdbcType=VARCHAR}
  857. </if>
  858. <if test="publishStatus != null">
  859. and a.publish_status = #{publishStatus,jdbcType=VARCHAR}
  860. </if>
  861. <if test="taskStatus != null">
  862. and a.task_status = #{taskStatus,jdbcType=VARCHAR}
  863. </if>
  864. <if test="startDate != null">
  865. and a.task_distribution_time &gt; #{startDate,jdbcType=TIMESTAMP}
  866. </if>
  867. <if test="endDate != null">
  868. and a.task_distribution_time &lt; #{endDate,jdbcType=TIMESTAMP}
  869. </if>
  870. <if test="projectNo != null and projectNo != ''">
  871. and d.serial_number = #{projectNo,jdbcType=VARCHAR}
  872. </if>
  873. <if test="buyerName != null and buyerName != ''">
  874. and e.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
  875. </if>
  876. <if test="taskReceiverName != null and taskReceiverName != ''">
  877. and f.name = #{taskReceiverName,jdbcType=VARCHAR}
  878. </if>
  879. <if test="categoryId != null and categoryId != ''">
  880. and c.id = #{categoryId,jdbcType=VARCHAR}
  881. </if>
  882. order by a.task_distribution_time desc
  883. <if test="page_sql != null">
  884. ${page_sql}
  885. </if>
  886. </select>
  887. <select id="salesmanListProjectByPage" resultType="com.goafanti.techproject.bo.ProjectListBo">
  888. select
  889. a.id,
  890. a.serial_number as serialNumber,
  891. date_format(a.sign_date,'%Y-%m-%d %H:%i:%S') as signDate,
  892. date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as projectTime,
  893. a.uid,
  894. a.status as projectStatus,
  895. a.task_distribution as taskDistribution,
  896. a.deleted_sign as deletedSign,
  897. a.order_no as orderNo,
  898. b.nickname as buyerName,
  899. b.type as buyerType,
  900. f.cname as projectType,
  901. c.create_time as orderTime,
  902. c.order_status as orderStatus,
  903. c.liquidation_status as liquidationStatus,
  904. c.approval,
  905. d.name as salesmanName,
  906. e.name as departmentName,
  907. g.name as principalName
  908. from
  909. contract a left join user b on
  910. a.uid = b.id left join t_order c on
  911. a.order_no = c.order_no left join admin d on
  912. c.salesman_id = d.id left join department e on
  913. d.department_id = e.id left join business_category f on
  914. a.type = f.id left join admin g on
  915. a.principal = g.id
  916. where 1=1
  917. and c.salesman_id= #{salesmanId,jdbcType=VARCHAR}
  918. <if test="deletedSign != null">
  919. and a.deleted_sign = #{deletedSign,jdbcType=INTEGER}
  920. </if>
  921. <if test="orderNo != null and orderNo != ''">
  922. and a.order_no = #{orderNo,jdbcType=VARCHAR}
  923. </if>
  924. <if test="serialNumber != null and serialNumber != ''">
  925. and a.serial_number = #{serialNumber,jdbcType=VARCHAR}
  926. </if>
  927. <if test="setUpStartDate != null and setUpStartDate != ''">
  928. and a.create_time &gt; #{setUpStartDate,jdbcType=TIMESTAMP}
  929. </if>
  930. <if test="setUpEndDate != null and setUpEndDate != ''">
  931. and a.create_time &lt; #{setUpEndDate,jdbcType=TIMESTAMP}
  932. </if>
  933. <if test="taskDistribution != null">
  934. and a.task_distribution = #{taskDistribution,jdbcType=INTEGER}
  935. </if>
  936. <if test="buyerName != null and buyerName != ''">
  937. and b.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
  938. </if>
  939. <if test="salesmanName != null and salesmanName !=''">
  940. and d.name = #{salesmanName,jdbcType=VARCHAR}
  941. </if>
  942. <if test="depId != null and depId != ''">
  943. and d.department_id = #{depId,jdbcType=VARCHAR}
  944. </if>
  945. <if test="orderStartDate != null and orderStartDate != ''">
  946. and c.create_time &gt; #{orderStartDate,jdbcType=TIMESTAMP}
  947. </if>
  948. <if test="orderEndDate != null and orderEndDate != ''">
  949. and c.create_time &lt; #{orderEndDate,jdbcType=TIMESTAMP}
  950. </if>
  951. <if test="principalName != null and principalName != ''">
  952. and g.name = #{principalName,jdbcType=VARCHAR}
  953. </if>
  954. order by a.create_time desc
  955. <if test="page_sql != null">
  956. ${page_sql}
  957. </if>
  958. </select>
  959. <select id="salesmanListProjectCount" resultType="java.lang.Integer">
  960. select
  961. count(0)
  962. from
  963. contract a left join user b on
  964. a.uid = b.id left join t_order c on
  965. a.order_no = c.order_no left join admin d on
  966. c.salesman_id = d.id left join department e on
  967. d.department_id = e.id left join business_category f on
  968. a.type = f.id left join admin g on
  969. a.principal = g.id
  970. where 1=1
  971. and c.salesman_id= #{salesmanId,jdbcType=VARCHAR}
  972. <if test="deletedSign != null">
  973. and a.deleted_sign = #{deletedSign,jdbcType=INTEGER}
  974. </if>
  975. <if test="orderNo != null and orderNo != ''">
  976. and a.order_no = #{orderNo,jdbcType=VARCHAR}
  977. </if>
  978. <if test="serialNumber != null and serialNumber != ''">
  979. and a.serial_number = #{serialNumber,jdbcType=VARCHAR}
  980. </if>
  981. <if test="setUpStartDate != null and setUpStartDate != ''">
  982. and a.create_time &gt; #{setUpStartDate,jdbcType=TIMESTAMP}
  983. </if>
  984. <if test="setUpEndDate != null and setUpEndDate != ''">
  985. and a.create_time &lt; #{setUpEndDate,jdbcType=TIMESTAMP}
  986. </if>
  987. <if test="taskDistribution != null">
  988. and a.task_distribution = #{taskDistribution,jdbcType=INTEGER}
  989. </if>
  990. <if test="buyerName != null and buyerName != ''">
  991. and b.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
  992. </if>
  993. <if test="salesmanName != null and salesmanName !=''">
  994. and d.name = #{salesmanName,jdbcType=VARCHAR}
  995. </if>
  996. <if test="depId != null and depId != ''">
  997. and d.department_id = #{depId,jdbcType=VARCHAR}
  998. </if>
  999. <if test="orderStartDate != null and orderStartDate != ''">
  1000. and c.create_time &gt; #{orderStartDate,jdbcType=TIMESTAMP}
  1001. </if>
  1002. <if test="orderEndDate != null and orderEndDate != ''">
  1003. and c.create_time &lt; #{orderEndDate,jdbcType=TIMESTAMP}
  1004. </if>
  1005. <if test="principalName != null and principalName != ''">
  1006. and g.name = #{principalName,jdbcType=VARCHAR}
  1007. </if>
  1008. </select>
  1009. <select id="selectProjectTaskByPage" resultType="com.goafanti.techproject.bo.TaskListBo">
  1010. select
  1011. a.id as taskId,
  1012. a.commodity_id as commodityId,
  1013. a.serial_number as taskNo,
  1014. a.task_status as taskStatus,
  1015. a.deleted_sign as deleteSign,
  1016. date_format(a.task_distribution_time,'%Y-%m-%d %H:%i:%S') as taskDistributionTimes,
  1017. a.task_comment as taskComment,
  1018. a.publish_status as publishStatus,
  1019. b.bname as commodityName ,
  1020. c.cname as categoryName,
  1021. c.id as categoryId,
  1022. d.serial_number as projectNo,
  1023. d.status,
  1024. d.deleted_sign as deletedSign,
  1025. e.nickname as buyerName,
  1026. f.name as taskReceiverName,
  1027. ifnull(g.sign_total_amount,0) as signTotalAmount
  1028. from
  1029. (select *
  1030. from contract_task_log
  1031. where task_receiver=#{taskReceiver,jdbcType=VARCHAR}) x left join contract_task a on
  1032. x.contract_task_id=a.id left join business_project b on
  1033. a.commodity_id = b.id left join business_category c on
  1034. b.cid = c.id left join contract d on
  1035. a.contract_id = d.id left join user e on
  1036. d.uid = e.id left join admin f on
  1037. a.task_receiver = f.id left join t_order g on
  1038. d.order_no=g.order_no
  1039. where 1=1
  1040. <if test="taskReceiverId != null and taskReceiverId != ''">
  1041. and a.task_receiver = #{taskReceiverId,jdbcType=VARCHAR}
  1042. </if>
  1043. <if test="deleteSign != null">
  1044. and a.deleted_sign = #{deleteSign,jdbcType=VARCHAR}
  1045. </if>
  1046. <if test="publishStatus != null">
  1047. and a.publish_status = #{publishStatus,jdbcType=VARCHAR}
  1048. </if>
  1049. <if test="taskStatus != null">
  1050. and a.task_status = #{taskStatus,jdbcType=VARCHAR}
  1051. </if>
  1052. <if test="startDate != null">
  1053. and a.task_distribution_time &gt; #{startDate,jdbcType=TIMESTAMP}
  1054. </if>
  1055. <if test="endDate != null">
  1056. and a.task_distribution_time &lt; #{endDate,jdbcType=TIMESTAMP}
  1057. </if>
  1058. <if test="projectNo != null and projectNo != ''">
  1059. and d.serial_number = #{projectNo,jdbcType=VARCHAR}
  1060. </if>
  1061. <if test="buyerName != null and buyerName != ''">
  1062. and e.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
  1063. </if>
  1064. <if test="taskReceiverName != null and taskReceiverName != ''">
  1065. and f.name = #{taskReceiverName,jdbcType=VARCHAR}
  1066. </if>
  1067. <if test="categoryId != null and categoryId != ''">
  1068. and c.id = #{categoryId,jdbcType=VARCHAR}
  1069. </if>
  1070. order by a.task_distribution_time desc
  1071. <if test="page_sql != null">
  1072. ${page_sql}
  1073. </if>
  1074. </select>
  1075. <select id="selectProjectTaskCount" resultType="java.lang.Integer">
  1076. select
  1077. count(0)
  1078. from
  1079. (select *
  1080. from contract_task_log
  1081. where task_receiver=#{taskReceiver,jdbcType=VARCHAR}) x left join contract_task a on
  1082. x.contract_task_id=a.id left join business_project b on
  1083. a.commodity_id = b.id left join business_category c on
  1084. b.cid = c.id left join contract d on
  1085. a.contract_id = d.id left join user e on
  1086. d.uid = e.id left join admin f on
  1087. a.task_receiver = f.id left join t_order g on
  1088. d.order_no=g.order_no
  1089. where 1=1
  1090. <if test="taskReceiverId != null and taskReceiverId != ''">
  1091. and a.task_receiver = #{taskReceiverId,jdbcType=VARCHAR}
  1092. </if>
  1093. <if test="deleteSign != null">
  1094. and a.deleted_sign = #{deleteSign,jdbcType=VARCHAR}
  1095. </if>
  1096. <if test="publishStatus != null">
  1097. and a.publish_status = #{publishStatus,jdbcType=VARCHAR}
  1098. </if>
  1099. <if test="taskStatus != null">
  1100. and a.task_status = #{taskStatus,jdbcType=VARCHAR}
  1101. </if>
  1102. <if test="startDate != null">
  1103. and a.task_distribution_time &gt; #{startDate,jdbcType=TIMESTAMP}
  1104. </if>
  1105. <if test="endDate != null">
  1106. and a.task_distribution_time &lt; #{endDate,jdbcType=TIMESTAMP}
  1107. </if>
  1108. <if test="projectNo != null and projectNo != ''">
  1109. and d.serial_number = #{projectNo,jdbcType=VARCHAR}
  1110. </if>
  1111. <if test="buyerName != null and buyerName != ''">
  1112. and e.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
  1113. </if>
  1114. <if test="taskReceiverName != null and taskReceiverName != ''">
  1115. and f.name = #{taskReceiverName,jdbcType=VARCHAR}
  1116. </if>
  1117. <if test="categoryId != null and categoryId != ''">
  1118. and c.id = #{categoryId,jdbcType=VARCHAR}
  1119. </if>
  1120. <if test="taskReceiverId != null and taskReceiverId != ''">
  1121. and a.task_receiver = #{taskReceiverId,jdbcType=VARCHAR}
  1122. </if>
  1123. <if test="deleteSign != null">
  1124. and a.deleted_sign = #{deleteSign,jdbcType=VARCHAR}
  1125. </if>
  1126. <if test="publishStatus != null">
  1127. and a.publish_status = #{publishStatus,jdbcType=VARCHAR}
  1128. </if>
  1129. <if test="taskStatus != null">
  1130. and a.task_status = #{taskStatus,jdbcType=VARCHAR}
  1131. </if>
  1132. <if test="startDate != null">
  1133. and a.task_distribution_time &gt; #{startDate,jdbcType=TIMESTAMP}
  1134. </if>
  1135. <if test="endDate != null">
  1136. and a.task_distribution_time &lt; #{endDate,jdbcType=TIMESTAMP}
  1137. </if>
  1138. <if test="projectNo != null and projectNo != ''">
  1139. and d.serial_number = #{projectNo,jdbcType=VARCHAR}
  1140. </if>
  1141. <if test="buyerName != null and buyerName != ''">
  1142. and e.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
  1143. </if>
  1144. <if test="taskReceiverName != null and taskReceiverName != ''">
  1145. and f.name = #{taskReceiverName,jdbcType=VARCHAR}
  1146. </if>
  1147. <if test="categoryId != null and categoryId != ''">
  1148. and c.id = #{categoryId,jdbcType=VARCHAR}
  1149. </if>
  1150. </select>
  1151. </mapper>