TechProjectMapper.xml 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175
  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. <result column="publish_status" property="publishStatus" jdbcType="INTEGER" />
  35. </resultMap>
  36. <sql id="Base_Column_List">
  37. id, uid, serial_number, contacts, department, dispatch_info,
  38. project_name, project_catagory,
  39. tech_field, project_des, project_mode, project_approval, subsidy, consultant,
  40. approval_url,
  41. state, create_time, accept_date, approved_date, record_time, deleted_sign,
  42. founder, contract_id, principal
  43. </sql>
  44. <select id="selectByPrimaryKey" resultMap="BaseResultMap"
  45. parameterType="java.lang.String">
  46. select
  47. <include refid="Base_Column_List" />
  48. from tech_project
  49. where id = #{id,jdbcType=VARCHAR}
  50. </select>
  51. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  52. delete from tech_project
  53. where id = #{id,jdbcType=VARCHAR}
  54. </delete>
  55. <insert id="insert" parameterType="com.goafanti.common.model.TechProject">
  56. insert into tech_project (id, uid, serial_number,
  57. contacts, department, dispatch_info,
  58. project_name, project_catagory, tech_field,
  59. project_des, project_mode, project_approval,
  60. subsidy, consultant, approval_url,
  61. state, create_time, accept_date,
  62. approved_date, record_time, deleted_sign, founder, contract_id, principal
  63. )
  64. values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR},
  65. #{serialNumber,jdbcType=INTEGER},
  66. #{contacts,jdbcType=INTEGER}, #{department,jdbcType=VARCHAR}, #{dispatchInfo,jdbcType=VARCHAR},
  67. #{projectName,jdbcType=VARCHAR}, #{projectCatagory,jdbcType=VARCHAR},
  68. #{techField,jdbcType=VARCHAR},
  69. #{projectDes,jdbcType=VARCHAR}, #{projectMode,jdbcType=INTEGER}, #{projectApproval,jdbcType=DECIMAL},
  70. #{subsidy,jdbcType=INTEGER}, #{consultant,jdbcType=VARCHAR},
  71. #{approvalUrl,jdbcType=VARCHAR},
  72. #{state,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{acceptDate,jdbcType=TIMESTAMP},
  73. #{approvedDate,jdbcType=TIMESTAMP}, #{recordTime,jdbcType=TIMESTAMP},
  74. #{deletedSign,jdbcType=INTEGER}, #{founder,jdbcType=VARCHAR}, #{contractId,jdbcType=VARCHAR},
  75. #{principal,jdbcType=VARCHAR}
  76. )
  77. </insert>
  78. <insert id="insertSelective" parameterType="com.goafanti.common.model.TechProject">
  79. insert into tech_project
  80. <trim prefix="(" suffix=")" suffixOverrides=",">
  81. <if test="id != null">
  82. id,
  83. </if>
  84. <if test="uid != null">
  85. uid,
  86. </if>
  87. <if test="serialNumber != null">
  88. serial_number,
  89. </if>
  90. <if test="contacts != null">
  91. contacts,
  92. </if>
  93. <if test="department != null">
  94. department,
  95. </if>
  96. <if test="dispatchInfo != null">
  97. dispatch_info,
  98. </if>
  99. <if test="projectName != null">
  100. project_name,
  101. </if>
  102. <if test="projectCatagory != null">
  103. project_catagory,
  104. </if>
  105. <if test="techField != null">
  106. tech_field,
  107. </if>
  108. <if test="projectDes != null">
  109. project_des,
  110. </if>
  111. <if test="projectMode != null">
  112. project_mode,
  113. </if>
  114. <if test="projectApproval != null">
  115. project_approval,
  116. </if>
  117. <if test="subsidy != null">
  118. subsidy,
  119. </if>
  120. <if test="consultant != null">
  121. consultant,
  122. </if>
  123. <if test="approvalUrl != null">
  124. approval_url,
  125. </if>
  126. <if test="state != null">
  127. state,
  128. </if>
  129. <if test="createTime != null">
  130. create_time,
  131. </if>
  132. <if test="acceptDate != null">
  133. accept_date,
  134. </if>
  135. <if test="approvedDate != null">
  136. approved_date,
  137. </if>
  138. <if test="recordTime != null">
  139. record_time,
  140. </if>
  141. <if test="deletedSign != null">
  142. deleted_sign,
  143. </if>
  144. <if test="founder != null">
  145. founder,
  146. </if>
  147. <if test="contractId != null">
  148. contract_id,
  149. </if>
  150. <if test="principal != null">
  151. principal,
  152. </if>
  153. </trim>
  154. <trim prefix="values (" suffix=")" suffixOverrides=",">
  155. <if test="id != null">
  156. #{id,jdbcType=VARCHAR},
  157. </if>
  158. <if test="uid != null">
  159. #{uid,jdbcType=VARCHAR},
  160. </if>
  161. <if test="serialNumber != null">
  162. #{serialNumber,jdbcType=INTEGER},
  163. </if>
  164. <if test="contacts != null">
  165. #{contacts,jdbcType=INTEGER},
  166. </if>
  167. <if test="department != null">
  168. #{department,jdbcType=VARCHAR},
  169. </if>
  170. <if test="dispatchInfo != null">
  171. #{dispatchInfo,jdbcType=VARCHAR},
  172. </if>
  173. <if test="projectName != null">
  174. #{projectName,jdbcType=VARCHAR},
  175. </if>
  176. <if test="projectCatagory != null">
  177. #{projectCatagory,jdbcType=VARCHAR},
  178. </if>
  179. <if test="techField != null">
  180. #{techField,jdbcType=VARCHAR},
  181. </if>
  182. <if test="projectDes != null">
  183. #{projectDes,jdbcType=VARCHAR},
  184. </if>
  185. <if test="projectMode != null">
  186. #{projectMode,jdbcType=INTEGER},
  187. </if>
  188. <if test="projectApproval != null">
  189. #{projectApproval,jdbcType=DECIMAL},
  190. </if>
  191. <if test="subsidy != null">
  192. #{subsidy,jdbcType=INTEGER},
  193. </if>
  194. <if test="consultant != null">
  195. #{consultant,jdbcType=VARCHAR},
  196. </if>
  197. <if test="approvalUrl != null">
  198. #{approvalUrl,jdbcType=VARCHAR},
  199. </if>
  200. <if test="state != null">
  201. #{state,jdbcType=INTEGER},
  202. </if>
  203. <if test="createTime != null">
  204. #{createTime,jdbcType=TIMESTAMP},
  205. </if>
  206. <if test="acceptDate != null">
  207. #{acceptDate,jdbcType=TIMESTAMP},
  208. </if>
  209. <if test="approvedDate != null">
  210. #{approvedDate,jdbcType=TIMESTAMP},
  211. </if>
  212. <if test="recordTime != null">
  213. #{recordTime,jdbcType=TIMESTAMP},
  214. </if>
  215. <if test="deletedSign != null">
  216. #{deletedSign,jdbcType=INTEGER},
  217. </if>
  218. <if test="founder != null">
  219. #{founder,jdbcType=VARCHAR},
  220. </if>
  221. <if test="contractId != null">
  222. #{contractId,jdbcType=VARCHAR},
  223. </if>
  224. <if test="principal != null">
  225. #{principal,jdbcType=VARCHAR},
  226. </if>
  227. </trim>
  228. </insert>
  229. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TechProject">
  230. update tech_project
  231. <set>
  232. <if test="uid != null">
  233. uid = #{uid,jdbcType=VARCHAR},
  234. </if>
  235. <if test="serialNumber != null">
  236. serial_number = #{serialNumber,jdbcType=INTEGER},
  237. </if>
  238. <if test="contacts != null">
  239. contacts = #{contacts,jdbcType=INTEGER},
  240. </if>
  241. <if test="department != null">
  242. department = #{department,jdbcType=VARCHAR},
  243. </if>
  244. <if test="dispatchInfo != null">
  245. dispatch_info = #{dispatchInfo,jdbcType=VARCHAR},
  246. </if>
  247. <if test="projectName != null">
  248. project_name = #{projectName,jdbcType=VARCHAR},
  249. </if>
  250. <if test="projectCatagory != null">
  251. project_catagory = #{projectCatagory,jdbcType=VARCHAR},
  252. </if>
  253. <if test="techField != null">
  254. tech_field = #{techField,jdbcType=VARCHAR},
  255. </if>
  256. <if test="projectDes != null">
  257. project_des = #{projectDes,jdbcType=VARCHAR},
  258. </if>
  259. <if test="projectMode != null">
  260. project_mode = #{projectMode,jdbcType=INTEGER},
  261. </if>
  262. <if test="projectApproval != null">
  263. project_approval = #{projectApproval,jdbcType=DECIMAL},
  264. </if>
  265. <if test="subsidy != null">
  266. subsidy = #{subsidy,jdbcType=INTEGER},
  267. </if>
  268. <if test="consultant != null">
  269. consultant = #{consultant,jdbcType=VARCHAR},
  270. </if>
  271. <if test="approvalUrl != null">
  272. approval_url = #{approvalUrl,jdbcType=VARCHAR},
  273. </if>
  274. <if test="state != null">
  275. state = #{state,jdbcType=INTEGER},
  276. </if>
  277. <if test="createTime != null">
  278. create_time = #{createTime,jdbcType=TIMESTAMP},
  279. </if>
  280. <if test="acceptDate != null">
  281. accept_date = #{acceptDate,jdbcType=TIMESTAMP},
  282. </if>
  283. <if test="approvedDate != null">
  284. approved_date = #{approvedDate,jdbcType=TIMESTAMP},
  285. </if>
  286. <if test="recordTime != null">
  287. record_time = #{recordTime,jdbcType=TIMESTAMP},
  288. </if>
  289. <if test="deletedSign != null">
  290. deleted_sign = #{deletedSign,jdbcType=INTEGER},
  291. </if>
  292. <if test="founder != null">
  293. founder = #{founder,jdbcType=VARCHAR},
  294. </if>
  295. <if test="contractId != null">
  296. contract_id = #{contractId,jdbcType=VARCHAR},
  297. </if>
  298. <if test="principal != null">
  299. principal = #{principal,jdbcType=VARCHAR},
  300. </if>
  301. </set>
  302. where id = #{id,jdbcType=VARCHAR}
  303. </update>
  304. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TechProject">
  305. update tech_project
  306. set uid = #{uid,jdbcType=VARCHAR},
  307. serial_number = #{serialNumber,jdbcType=INTEGER},
  308. contacts = #{contacts,jdbcType=INTEGER},
  309. department = #{department,jdbcType=VARCHAR},
  310. dispatch_info = #{dispatchInfo,jdbcType=VARCHAR},
  311. project_name = #{projectName,jdbcType=VARCHAR},
  312. project_catagory = #{projectCatagory,jdbcType=VARCHAR},
  313. tech_field = #{techField,jdbcType=VARCHAR},
  314. project_des = #{projectDes,jdbcType=VARCHAR},
  315. project_mode = #{projectMode,jdbcType=INTEGER},
  316. project_approval = #{projectApproval,jdbcType=DECIMAL},
  317. subsidy = #{subsidy,jdbcType=INTEGER},
  318. consultant = #{consultant,jdbcType=VARCHAR},
  319. approval_url = #{approvalUrl,jdbcType=VARCHAR},
  320. state = #{state,jdbcType=INTEGER},
  321. create_time = #{createTime,jdbcType=TIMESTAMP},
  322. accept_date = #{acceptDate,jdbcType=TIMESTAMP},
  323. approved_date = #{approvedDate,jdbcType=TIMESTAMP},
  324. record_time = #{recordTime,jdbcType=TIMESTAMP},
  325. deleted_sign = #{deletedSign,jdbcType=INTEGER},
  326. founder = #{founder,jdbcType=VARCHAR},
  327. contract_id = #{contractId,jdbcType=VARCHAR},
  328. principal = #{principal,jdbcType=VARCHAR}
  329. where id = #{id,jdbcType=VARCHAR}
  330. </update>
  331. <select id="findTechProjectClientListByPage" parameterType="java.lang.String"
  332. resultType="com.goafanti.techproject.bo.TechProjectClientListBo">
  333. select p.id, p.uid, i.location_province as province,
  334. i.unit_name as unitName,
  335. p.serial_number as serialNumber, p.create_time as createTime, p.approved_date as approvedDate,
  336. p.accept_date as acceptDate, a.name as consultant, p.contacts,
  337. p.project_name as projectName, p.project_catagory as projectCatagory, p.tech_field as techField, p.state
  338. FROM tech_project p
  339. LEFT JOIN organization_identity i on i.uid = p.uid
  340. LEFT JOIN admin a on p.consultant = a.id
  341. where p.deleted_sign = 0
  342. <if test ="uid != null">
  343. and p.uid = #{uid,jdbcType=VARCHAR}
  344. </if>
  345. order by p.serial_number desc
  346. <if test="page_sql!=null">
  347. ${page_sql}
  348. </if>
  349. </select>
  350. <select id="findTechProjectClientCount" resultType="java.lang.Integer" parameterType="String">
  351. select count(1)
  352. FROM tech_project p
  353. LEFT JOIN organization_identity i on i.uid = p.uid
  354. LEFT JOIN admin a on p.consultant = a.id
  355. where p.deleted_sign = 0
  356. <if test ="uid != null">
  357. and p.uid = #{uid,jdbcType=VARCHAR}
  358. </if>
  359. </select>
  360. <select id ="findTechProjectManageListByPage" parameterType="java.lang.String"
  361. resultType="com.goafanti.techproject.bo.TechProjectManageListBo">
  362. select p.id, p.uid, i.licence_province as province, p.contract_id as contractId,
  363. i.unit_name as unitName,
  364. p.serial_number as serialNumber, p.create_time as createTime, p.approved_date as approvedDate,
  365. p.accept_date as acceptDate, a.name as consultant, p.contacts, ad.name as founder,
  366. p.project_name as projectName, p.project_catagory as projectCatagory, p.tech_field as techField, p.state,
  367. w.id as wid, w.website, w.account_number as accountNumber, w.department,
  368. w.password, c.serial_number as contractNumber
  369. FROM tech_project p
  370. LEFT JOIN organization_identity i on i.uid = p.uid
  371. LEFT JOIN admin a on p.consultant = a.id
  372. LEFT JOIN admin ad on p.founder = ad.id
  373. LEFT JOIN tech_website w on p.department = w.id
  374. LEFT JOIN contract c on c.id = p.contract_id
  375. <if test="principal != null">
  376. left join contract_log l on p.contract_id=l.cid
  377. </if>
  378. where p.deleted_sign = 0 and (w.deleted_sign is null or w.deleted_sign = 0)
  379. <if test="principal != null">
  380. and l.principal = #{principal,jdbcType=VARCHAR}
  381. </if>
  382. <if test="contractId != null">
  383. and p.contract_id = #{contractId,jdbcType=VARCHAR}
  384. </if>
  385. <if test="province != null">
  386. and i.licence_province = #{province,jdbcType=INTEGER}
  387. </if>
  388. <if test="uid != null">
  389. and p.uid = #{uid,jdbcType=VARCHAR}
  390. </if>
  391. <if test="unitName != null" >
  392. and i.unit_name like CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')
  393. </if>
  394. <if test="principal != null">
  395. group by p.id,i.id
  396. </if>
  397. order by p.serial_number desc
  398. <if test="page_sql!=null">
  399. ${page_sql}
  400. </if>
  401. </select>
  402. <select id="findTechProjectManageCount" resultType="java.lang.Integer" parameterType="String">
  403. select count(distinct(p.id))
  404. FROM tech_project p
  405. LEFT JOIN organization_identity i on i.uid = p.uid
  406. LEFT JOIN tech_website w on p.department = w.id
  407. <if test="principal != null">
  408. left join contract_log l on p.contract_id=l.cid
  409. </if>
  410. where p.deleted_sign = 0 and (w.deleted_sign is null or w.deleted_sign = 0)
  411. <if test="principal != null">
  412. and l.principal = #{principal,jdbcType=VARCHAR}
  413. </if>
  414. <if test="contractId != null">
  415. and p.contract_id = #{contractId,jdbcType=VARCHAR}
  416. </if>
  417. <if test="province != null">
  418. and i.licence_province = #{province,jdbcType=INTEGER}
  419. </if>
  420. <if test="uid != null">
  421. and p.uid = #{uid,jdbcType=VARCHAR}
  422. </if>
  423. <if test="unitName != null" >
  424. and i.unit_name like CONCAT('%', #{unitName,jdbcType=VARCHAR}, '%')
  425. </if>
  426. </select>
  427. <select id="selectProjectDetail" resultType="com.goafanti.techproject.bo.TechProjectDetailBo" parameterType="java.lang.String">
  428. select
  429. p.id, p.uid, i.licence_province as province,
  430. i.licence_city as city, i.licence_area as area, i.postal_address as postalAddress,
  431. i.unit_name as unitName, i.org_code as orgCode, p.serial_number as serialNumber,
  432. a.name as consultant, p.contacts, p.project_des as projectDes,
  433. p.subsidy, p.dispatch_info as dispatchInfo, p.project_mode as projectMode,
  434. p.project_approval as projectApproval, p.approval_url as approvalUrl , p.department,
  435. p.project_name as projectName, p.project_catagory as projectCatagory, p.tech_field as techField,
  436. p.state
  437. FROM tech_project p
  438. LEFT JOIN organization_identity i on i.uid = p.uid
  439. LEFT JOIN admin a on p.consultant = a.id
  440. where p.deleted_sign = 0 and p.id = #{uid,jdbcType=VARCHAR}
  441. </select>
  442. <update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
  443. update tech_project set deleted_sign = 1
  444. where id in
  445. <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
  446. #{item}
  447. </foreach>
  448. </update>
  449. <select id="countTechProjectDone" resultType="java.lang.Integer">
  450. select
  451. count(1)
  452. from tech_project
  453. where uid = #{uid,jdbcType=VARCHAR}
  454. and
  455. deleted_sign = 0
  456. and state in (6,8)
  457. and approved_date >=
  458. (
  459. select
  460. str_to_date(CONCAT(#{year,jdbcType=INTEGER}-3,'-01-01'), '%Y-%m-%d %H')
  461. )
  462. and approved_date <![CDATA[ < ]]>
  463. (
  464. select
  465. str_to_date(CONCAT(#{year,jdbcType=INTEGER},'-01-01'), '%Y-%m-%d %H')
  466. )
  467. </select>
  468. <select id="countTechProjectUndone" resultType="java.lang.Integer">
  469. select
  470. count(1)
  471. from tech_project
  472. where uid = #{uid,jdbcType=VARCHAR}
  473. and deleted_sign = 0
  474. and state in (1,2,3,4,5,7)
  475. and approved_date >=
  476. (
  477. select
  478. str_to_date(CONCAT(#{year,jdbcType=INTEGER}-3,'-01-01'), '%Y-%m-%d %H')
  479. )
  480. and approved_date <![CDATA[ < ]]>
  481. (
  482. select
  483. str_to_date(CONCAT(#{year,jdbcType=INTEGER},'-01-01'), '%Y-%m-%d %H')
  484. )
  485. </select>
  486. <select id="selectWebsiteUnitNames" parameterType="java.lang.String" resultType="com.goafanti.user.bo.OrgUnitNames">
  487. select distinct(oi.uid), oi.unit_name as unitName
  488. from tech_project tp
  489. LEFT JOIN organization_identity oi on oi.uid = tp.uid
  490. <if test="_parameter != null">
  491. LEFT JOIN tech_project_log tpl on tp.id = tpl.pid
  492. </if>
  493. where tp.deleted_sign = 0
  494. <if test="_parameter != null">
  495. and tpl.principal = #{principal,jdbcType=VARCHAR}
  496. </if>
  497. <if test="_parameter != null">
  498. group by tp.id,oi.id
  499. </if>
  500. </select>
  501. <select id="listContractTechProjectByContractId" parameterType="java.lang.String" resultType="com.goafanti.techproject.bo.TechProjectContractListBo">
  502. select
  503. tp.id, tp.uid, tp.contract_id as contractId,
  504. tp.project_name as projectName, tp.project_catagory as projectCatagory, tp.state,
  505. tp.tech_field as techField, a.name as principle
  506. from tech_project tp
  507. left join admin a on a.id = tp.principal
  508. where tp.contract_id = #{contractId,jdbcType=VARCHAR}
  509. </select>
  510. <insert id="batchInsert" parameterType="com.goafanti.common.model.TechProject">
  511. insert into tech_project (id, uid, serial_number,
  512. contacts, department, dispatch_info,
  513. project_name, project_catagory, tech_field,
  514. project_des, project_mode, project_approval,
  515. subsidy, consultant, approval_url,
  516. state, create_time, accept_date,
  517. approved_date, record_time, deleted_sign, founder, contract_id, principal
  518. )
  519. values
  520. <foreach item="item" index="index" collection="list" separator=",">
  521. (
  522. #{item.id,jdbcType=VARCHAR}, #{item.uid,jdbcType=VARCHAR},
  523. #{item.serialNumber,jdbcType=INTEGER},
  524. #{item.contacts,jdbcType=INTEGER}, #{item.department,jdbcType=VARCHAR}, #{item.dispatchInfo,jdbcType=VARCHAR},
  525. #{item.projectName,jdbcType=VARCHAR}, #{item.projectCatagory,jdbcType=VARCHAR},
  526. #{item.techField,jdbcType=VARCHAR},
  527. #{item.projectDes,jdbcType=VARCHAR}, #{item.projectMode,jdbcType=INTEGER}, #{item.projectApproval,jdbcType=DECIMAL},
  528. #{item.subsidy,jdbcType=INTEGER}, #{item.consultant,jdbcType=VARCHAR},
  529. #{item.approvalUrl,jdbcType=VARCHAR},
  530. #{item.state,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.acceptDate,jdbcType=TIMESTAMP},
  531. #{item.approvedDate,jdbcType=TIMESTAMP}, #{item.recordTime,jdbcType=TIMESTAMP},
  532. #{item.deletedSign,jdbcType=INTEGER}, #{item.founder,jdbcType=VARCHAR}, #{item.contractId,jdbcType=VARCHAR},
  533. #{item.principal,jdbcType=VARCHAR}
  534. )
  535. </foreach>
  536. </insert>
  537. <select id="findTechProjectNumByUid" parameterType="java.lang.String" resultType="java.lang.Integer">
  538. select
  539. count(1)
  540. from tech_project
  541. where
  542. deleted_sign = 0
  543. and uid = #{uid,jdbcType=VARCHAR}
  544. </select>
  545. <update id="batchDeleteByContractId" parameterType="java.util.List">
  546. update tech_project set deleted_sign = 1
  547. where contract_id in
  548. <foreach item="item" index="index" collection="list" open="("
  549. separator="," close=")">
  550. #{item}
  551. </foreach>
  552. </update>
  553. <select id="listProjectByPage" resultType="com.goafanti.techproject.bo.ProjectListBo">
  554. select
  555. a.id,
  556. a.serial_number as serialNumber,
  557. date_format(a.sign_date,'%Y-%m-%d %H:%i:%S') as signDate,
  558. date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as projectTime,
  559. a.uid,
  560. a.status as projectStatus,
  561. a.task_distribution as taskDistribution,
  562. a.deleted_sign as deletedSign,
  563. a.order_no as orderNo,
  564. b.nickname as buyerName,
  565. b.type as buyerType,
  566. f.cname as projectType,
  567. c.create_time as orderTime,
  568. c.order_status as orderStatus,
  569. c.liquidation_status as liquidationStatus,
  570. c.approval,
  571. d.name as salesmanName,
  572. e.name as departmentName,
  573. g.name as principalName
  574. from
  575. contract a left join user b on
  576. a.uid = b.id left join t_order c on
  577. a.order_no = c.order_no left join admin d on
  578. c.salesman_id = d.id left join department_management e on
  579. d.department_id = e.id left join business_varieties f on
  580. a.type = f.id left join admin g on
  581. a.principal = g.id
  582. where 1=1
  583. <if test="deletedSign != null">
  584. and a.deleted_sign = #{deletedSign,jdbcType=INTEGER}
  585. </if>
  586. <if test="orderNo != null and orderNo != ''">
  587. and a.order_no = #{orderNo,jdbcType=VARCHAR}
  588. </if>
  589. <if test="serialNumber != null and serialNumber != ''">
  590. and a.serial_number = #{serialNumber,jdbcType=VARCHAR}
  591. </if>
  592. <if test="setUpStartDate != null and setUpStartDate != ''">
  593. and a.create_time &gt; #{setUpStartDate,jdbcType=TIMESTAMP}
  594. </if>
  595. <if test="setUpEndDate != null and setUpEndDate != ''">
  596. and a.create_time &lt; #{setUpEndDate,jdbcType=TIMESTAMP}
  597. </if>
  598. <if test="taskDistribution != null">
  599. and a.task_distribution = #{taskDistribution,jdbcType=INTEGER}
  600. </if>
  601. <if test="buyerName != null and buyerName != ''">
  602. and b.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
  603. </if>
  604. <if test="salesmanName != null and salesmanName !=''">
  605. and d.name = #{salesmanName,jdbcType=VARCHAR}
  606. </if>
  607. <if test="depId != null and depId != ''">
  608. and d.department_id = #{depId,jdbcType=VARCHAR}
  609. </if>
  610. <if test="orderStartDate != null and orderStartDate != ''">
  611. and c.create_time &gt; #{orderStartDate,jdbcType=TIMESTAMP}
  612. </if>
  613. <if test="orderEndDate != null and orderEndDate != ''">
  614. and c.create_time &lt; #{orderEndDate,jdbcType=TIMESTAMP}
  615. </if>
  616. <if test="principalName != null and principalName != ''">
  617. and g.name = #{principalName,jdbcType=VARCHAR}
  618. </if>
  619. order by a.create_time desc
  620. <if test="page_sql != null">
  621. ${page_sql}
  622. </if>
  623. </select>
  624. <select id="listProjectCount" resultType="java.lang.Integer">
  625. select
  626. count(0)
  627. from
  628. contract a left join user b on
  629. a.uid = b.id left join t_order c on
  630. a.order_no = c.order_no left join admin d on
  631. c.salesman_id = d.id left join department_management e on
  632. d.department_id = e.id left join business_varieties f on
  633. a.type = f.id left join admin g on
  634. a.principal = g.id
  635. where 1=1
  636. <if test="deletedSign != null">
  637. and a.deleted_sign = #{deletedSign,jdbcType=INTEGER}
  638. </if>
  639. <if test="orderNo != null and orderNo != ''">
  640. and a.order_no = #{orderNo,jdbcType=VARCHAR}
  641. </if>
  642. <if test="serialNumber != null and serialNumber != ''">
  643. and a.serial_number = #{serialNumber,jdbcType=VARCHAR}
  644. </if>
  645. <if test="setUpStartDate != null and setUpStartDate != ''">
  646. and a.create_time &gt; #{setUpStartDate,jdbcType=TIMESTAMP}
  647. </if>
  648. <if test="setUpEndDate != null and setUpEndDate != ''">
  649. and a.create_time &lt; #{setUpEndDate,jdbcType=TIMESTAMP}
  650. </if>
  651. <if test="taskDistribution != null">
  652. and a.task_distribution = #{taskDistribution,jdbcType=INTEGER}
  653. </if>
  654. <if test="buyerName != null and buyerName != ''">
  655. and b.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
  656. </if>
  657. <if test="salesmanName != null and salesmanName !=''">
  658. and d.name = #{salesmanName,jdbcType=VARCHAR}
  659. </if>
  660. <if test="depId != null and depId != ''">
  661. and d.department_id = #{depId,jdbcType=VARCHAR}
  662. </if>
  663. <if test="orderStartDate != null and orderStartDate != ''">
  664. and c.create_time &gt; #{orderStartDate,jdbcType=TIMESTAMP}
  665. </if>
  666. <if test="orderEndDate != null and orderEndDate != ''">
  667. and c.create_time &lt; #{orderEndDate,jdbcType=TIMESTAMP}
  668. </if>
  669. <if test="principalName != null and principalName != ''">
  670. and g.name = #{principalName,jdbcType=VARCHAR}
  671. </if>
  672. </select>
  673. <select id="selectTechProjectDetail" resultType="com.goafanti.techproject.bo.ProjectDetailBo">
  674. <choose>
  675. <when test="buyerType == 0">
  676. select
  677. a.id,
  678. a.serial_number as serialNumber,
  679. date_format( a.sign_date, '%Y-%m-%d %H:%i:%S' ) as signDate,
  680. a.sign_comment as signComment,
  681. date_format( a.complete_date, '%Y-%m-%d %H:%i:%S' ) as completeDate,
  682. a.complete_comment as completeComment,
  683. a.uid,
  684. a.status as projectStatus,
  685. a.deleted_sign as deletedSign,
  686. a.order_no as orderNo,
  687. b.nickname as buyerName,
  688. d.name as principalName,
  689. f.name as buyerProvince,
  690. g.cname as projectType,
  691. t.contract_no as contractNo,
  692. h.name as salesmanName
  693. from
  694. contract a left join user b on
  695. a.uid = b.id left join admin d on
  696. a.principal = d.id left join user_identity e on
  697. a.uid = e.uid left join district_glossory f on
  698. e.province = f.id left join business_varieties g on
  699. a.type = g.id left join t_order t on
  700. a.order_no=t.order_no left join admin h on
  701. t.salesman_id=h.id
  702. where a.id = #{contractId,jdbcType=VARCHAR}
  703. </when>
  704. <when test="buyerType == 1">
  705. select
  706. a.id,
  707. a.serial_number as serialNumber,
  708. date_format(a.sign_date,'%Y-%m-%d %H:%i:%S') as signDate,
  709. a.sign_comment as signComment,
  710. date_format(a.complete_date,'%Y-%m-%d %H:%i:%S') as completeDate,
  711. a.complete_comment as completeComment,
  712. a.uid,
  713. a.status as projectStatus,
  714. a.deleted_sign as deletedSign,
  715. a.order_no as orderNo,
  716. b.nickname as buyerName,
  717. d.name as principalName,
  718. f.name as buyerProvince,
  719. g.cname as projectType,
  720. t.contract_no as contractNo,
  721. h.name as salesmanName
  722. from
  723. contract a left join user b on
  724. a.uid = b.id left join admin d on
  725. a.principal = d.id left join organization_identity e on
  726. a.uid = e.uid left join district_glossory f on
  727. e.location_province = f.id left join business_varieties g on
  728. a.type = g.id left join t_order t on
  729. a.order_no=t.order_no left join admin h on
  730. t.salesman_id=h.id
  731. where a.id = #{contractId,jdbcType=VARCHAR}
  732. </when>
  733. </choose>
  734. </select>
  735. <select id="selectProjectTask" resultType="com.goafanti.techproject.bo.TaskListBo">
  736. select
  737. a.id as taskId,
  738. a.commodity_name as commodityName,
  739. a.commodity_quantity as commodityQuantity,
  740. a.task_status as taskStatus,
  741. a.deleted_sign as deletedSign,
  742. a.task_comment as taskComment,
  743. a.publish_status as publishStatus,
  744. b.name as technicianName,
  745. b.mobile as technicianMobile
  746. from
  747. contract_task a left join admin b on
  748. a.task_receiver = b.id
  749. where a.contract_id = #{contractId,jdbcType=VARCHAR}
  750. </select>
  751. <select id="selectMyProjectTaskByPage" resultType="com.goafanti.techproject.bo.TaskListBo">
  752. select
  753. a.id as taskId,
  754. a.commodity_id as commodityId,
  755. a.serial_number as taskNo,
  756. a.task_status as taskStatus,
  757. a.deleted_sign as deleteSign,
  758. date_format(a.task_distribution_time,'%Y-%m-%d %H:%i:%S') as taskDistributionTimes,
  759. a.task_comment as taskComment,
  760. a.publish_status as publishStatus,
  761. b.bname as commodityName ,
  762. c.cname as categoryName,
  763. c.id as categoryId,
  764. d.serial_number as projectNo,
  765. d.status,
  766. d.deleted_sign as deletedSign,
  767. e.nickname as buyerName,
  768. f.name as taskReceiverName
  769. from
  770. contract_task a left join business_project b on
  771. a.commodity_id = b.id left join business_varieties c on
  772. b.cid = c.id left join contract d on
  773. a.contract_id = d.id left join user e on
  774. d.uid = e.id left join admin f on
  775. a.task_receiver = f.id
  776. where 1=1
  777. <if test="taskReceiverId != null and taskReceiverId != ''">
  778. and a.task_receiver = #{taskReceiverId,jdbcType=VARCHAR}
  779. </if>
  780. <if test="deleteSign != null">
  781. and a.deleted_sign = #{deleteSign,jdbcType=VARCHAR}
  782. </if>
  783. <if test="publishStatus != null">
  784. and a.publish_status = #{publishStatus,jdbcType=VARCHAR}
  785. </if>
  786. <if test="taskStatus != null">
  787. and a.task_status = #{taskStatus,jdbcType=VARCHAR}
  788. </if>
  789. <if test="startDate != null">
  790. and a.task_distribution_time &gt; #{startDate,jdbcType=TIMESTAMP}
  791. </if>
  792. <if test="endDate != null">
  793. and a.task_distribution_time &lt; #{endDate,jdbcType=TIMESTAMP}
  794. </if>
  795. <if test="projectNo != null and projectNo != ''">
  796. and d.serial_number = #{projectNo,jdbcType=VARCHAR}
  797. </if>
  798. <if test="buyerName != null and buyerName != ''">
  799. and e.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
  800. </if>
  801. <if test="taskReceiverName != null and taskReceiverName != ''">
  802. and f.name = #{taskReceiverName,jdbcType=VARCHAR}
  803. </if>
  804. <if test="categoryId != null and categoryId != ''">
  805. and c.id = #{categoryId,jdbcType=VARCHAR}
  806. </if>
  807. order by a.task_distribution_time desc
  808. <if test="page_sql != null">
  809. ${page_sql}
  810. </if>
  811. </select>
  812. <select id="selectMyProjectTaskCount" resultType="java.lang.Integer">
  813. select
  814. count(0)
  815. from
  816. contract_task a left join business_project b on
  817. a.commodity_id = b.id left join business_varieties c on
  818. b.cid = c.id left join contract d on
  819. a.contract_id = d.id left join user e on
  820. d.uid = e.id left join admin f on
  821. a.task_receiver = f.id
  822. where 1=1
  823. <if test="taskReceiverId != null and taskReceiverId != ''">
  824. and a.task_receiver = #{taskReceiverId,jdbcType=VARCHAR}
  825. </if>
  826. <if test="deleteSign != null">
  827. and a.deleted_sign = #{deleteSign,jdbcType=VARCHAR}
  828. </if>
  829. <if test="publishStatus != null">
  830. and a.publish_status = #{publishStatus,jdbcType=VARCHAR}
  831. </if>
  832. <if test="taskStatus != null">
  833. and a.task_status = #{taskStatus,jdbcType=VARCHAR}
  834. </if>
  835. <if test="startDate != null">
  836. and a.task_distribution_time &gt; #{startDate,jdbcType=TIMESTAMP}
  837. </if>
  838. <if test="endDate != null">
  839. and a.task_distribution_time &lt; #{endDate,jdbcType=TIMESTAMP}
  840. </if>
  841. <if test="projectNo != null and projectNo != ''">
  842. and d.serial_number = #{projectNo,jdbcType=VARCHAR}
  843. </if>
  844. <if test="buyerName != null and buyerName != ''">
  845. and e.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
  846. </if>
  847. <if test="taskReceiverName != null and taskReceiverName != ''">
  848. and f.name = #{taskReceiverName,jdbcType=VARCHAR}
  849. </if>
  850. <if test="categoryId != null and categoryId != ''">
  851. and c.id = #{categoryId,jdbcType=VARCHAR}
  852. </if>
  853. <if test="taskReceiverId != null and taskReceiverId != ''">
  854. and a.task_receiver = #{taskReceiverId,jdbcType=VARCHAR}
  855. </if>
  856. <if test="deleteSign != null">
  857. and a.deleted_sign = #{deleteSign,jdbcType=VARCHAR}
  858. </if>
  859. <if test="publishStatus != null">
  860. and a.publish_status = #{publishStatus,jdbcType=VARCHAR}
  861. </if>
  862. <if test="taskStatus != null">
  863. and a.task_status = #{taskStatus,jdbcType=VARCHAR}
  864. </if>
  865. <if test="startDate != null">
  866. and a.task_distribution_time &gt; #{startDate,jdbcType=TIMESTAMP}
  867. </if>
  868. <if test="endDate != null">
  869. and a.task_distribution_time &lt; #{endDate,jdbcType=TIMESTAMP}
  870. </if>
  871. <if test="projectNo != null and projectNo != ''">
  872. and d.serial_number = #{projectNo,jdbcType=VARCHAR}
  873. </if>
  874. <if test="buyerName != null and buyerName != ''">
  875. and e.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
  876. </if>
  877. <if test="taskReceiverName != null and taskReceiverName != ''">
  878. and f.name = #{taskReceiverName,jdbcType=VARCHAR}
  879. </if>
  880. <if test="categoryId != null and categoryId != ''">
  881. and c.id = #{categoryId,jdbcType=VARCHAR}
  882. </if>
  883. order by a.task_distribution_time desc
  884. <if test="page_sql != null">
  885. ${page_sql}
  886. </if>
  887. </select>
  888. <select id="salesmanListProjectByPage" resultType="com.goafanti.techproject.bo.ProjectListBo">
  889. select
  890. a.id,
  891. a.serial_number as serialNumber,
  892. date_format(a.sign_date,'%Y-%m-%d %H:%i:%S') as signDate,
  893. date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as projectTime,
  894. a.uid,
  895. a.status as projectStatus,
  896. a.task_distribution as taskDistribution,
  897. a.deleted_sign as deletedSign,
  898. a.order_no as orderNo,
  899. b.nickname as buyerName,
  900. b.type as buyerType,
  901. f.cname as projectType,
  902. c.create_time as orderTime,
  903. c.order_status as orderStatus,
  904. c.liquidation_status as liquidationStatus,
  905. c.approval,
  906. d.name as salesmanName,
  907. e.name as departmentName,
  908. g.name as principalName
  909. from
  910. contract a left join user b on
  911. a.uid = b.id left join t_order c on
  912. a.order_no = c.order_no left join admin d on
  913. c.salesman_id = d.id left join department_management e on
  914. d.department_id = e.id left join business_varieties f on
  915. a.type = f.id left join admin g on
  916. a.principal = g.id
  917. where 1=1
  918. and c.salesman_id= #{salesmanId,jdbcType=VARCHAR}
  919. <if test="deletedSign != null">
  920. and a.deleted_sign = #{deletedSign,jdbcType=INTEGER}
  921. </if>
  922. <if test="orderNo != null and orderNo != ''">
  923. and a.order_no = #{orderNo,jdbcType=VARCHAR}
  924. </if>
  925. <if test="serialNumber != null and serialNumber != ''">
  926. and a.serial_number = #{serialNumber,jdbcType=VARCHAR}
  927. </if>
  928. <if test="setUpStartDate != null and setUpStartDate != ''">
  929. and a.create_time &gt; #{setUpStartDate,jdbcType=TIMESTAMP}
  930. </if>
  931. <if test="setUpEndDate != null and setUpEndDate != ''">
  932. and a.create_time &lt; #{setUpEndDate,jdbcType=TIMESTAMP}
  933. </if>
  934. <if test="taskDistribution != null">
  935. and a.task_distribution = #{taskDistribution,jdbcType=INTEGER}
  936. </if>
  937. <if test="buyerName != null and buyerName != ''">
  938. and b.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
  939. </if>
  940. <if test="salesmanName != null and salesmanName !=''">
  941. and d.name = #{salesmanName,jdbcType=VARCHAR}
  942. </if>
  943. <if test="depId != null and depId != ''">
  944. and d.department_id = #{depId,jdbcType=VARCHAR}
  945. </if>
  946. <if test="orderStartDate != null and orderStartDate != ''">
  947. and c.create_time &gt; #{orderStartDate,jdbcType=TIMESTAMP}
  948. </if>
  949. <if test="orderEndDate != null and orderEndDate != ''">
  950. and c.create_time &lt; #{orderEndDate,jdbcType=TIMESTAMP}
  951. </if>
  952. <if test="principalName != null and principalName != ''">
  953. and g.name = #{principalName,jdbcType=VARCHAR}
  954. </if>
  955. order by a.create_time desc
  956. <if test="page_sql != null">
  957. ${page_sql}
  958. </if>
  959. </select>
  960. <select id="salesmanListProjectCount" resultType="java.lang.Integer">
  961. select
  962. count(0)
  963. from
  964. contract a left join user b on
  965. a.uid = b.id left join t_order c on
  966. a.order_no = c.order_no left join admin d on
  967. c.salesman_id = d.id left join department_management e on
  968. d.department_id = e.id left join business_varieties f on
  969. a.type = f.id left join admin g on
  970. a.principal = g.id
  971. where 1=1
  972. and c.salesman_id= #{salesmanId,jdbcType=VARCHAR}
  973. <if test="deletedSign != null">
  974. and a.deleted_sign = #{deletedSign,jdbcType=INTEGER}
  975. </if>
  976. <if test="orderNo != null and orderNo != ''">
  977. and a.order_no = #{orderNo,jdbcType=VARCHAR}
  978. </if>
  979. <if test="serialNumber != null and serialNumber != ''">
  980. and a.serial_number = #{serialNumber,jdbcType=VARCHAR}
  981. </if>
  982. <if test="setUpStartDate != null and setUpStartDate != ''">
  983. and a.create_time &gt; #{setUpStartDate,jdbcType=TIMESTAMP}
  984. </if>
  985. <if test="setUpEndDate != null and setUpEndDate != ''">
  986. and a.create_time &lt; #{setUpEndDate,jdbcType=TIMESTAMP}
  987. </if>
  988. <if test="taskDistribution != null">
  989. and a.task_distribution = #{taskDistribution,jdbcType=INTEGER}
  990. </if>
  991. <if test="buyerName != null and buyerName != ''">
  992. and b.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
  993. </if>
  994. <if test="salesmanName != null and salesmanName !=''">
  995. and d.name = #{salesmanName,jdbcType=VARCHAR}
  996. </if>
  997. <if test="depId != null and depId != ''">
  998. and d.department_id = #{depId,jdbcType=VARCHAR}
  999. </if>
  1000. <if test="orderStartDate != null and orderStartDate != ''">
  1001. and c.create_time &gt; #{orderStartDate,jdbcType=TIMESTAMP}
  1002. </if>
  1003. <if test="orderEndDate != null and orderEndDate != ''">
  1004. and c.create_time &lt; #{orderEndDate,jdbcType=TIMESTAMP}
  1005. </if>
  1006. <if test="principalName != null and principalName != ''">
  1007. and g.name = #{principalName,jdbcType=VARCHAR}
  1008. </if>
  1009. </select>
  1010. <select id="selectProjectTaskByPage" resultType="com.goafanti.techproject.bo.TaskListBo">
  1011. select
  1012. a.id as taskId,
  1013. a.commodity_id as commodityId,
  1014. a.serial_number as taskNo,
  1015. a.task_status as taskStatus,
  1016. a.deleted_sign as deleteSign,
  1017. date_format(a.task_distribution_time,'%Y-%m-%d %H:%i:%S') as taskDistributionTimes,
  1018. a.task_comment as taskComment,
  1019. a.publish_status as publishStatus,
  1020. b.bname as commodityName ,
  1021. c.cname as categoryName,
  1022. c.id as categoryId,
  1023. d.serial_number as projectNo,
  1024. d.status,
  1025. d.deleted_sign as deletedSign,
  1026. e.nickname as buyerName,
  1027. f.name as taskReceiverName,
  1028. ifnull(g.sign_total_amount,0) as signTotalAmount
  1029. from
  1030. (select *
  1031. from contract_task_log
  1032. where task_receiver=#{taskReceiver,jdbcType=VARCHAR}) x left join contract_task a on
  1033. x.contract_task_id=a.id left join business_project b on
  1034. a.commodity_id = b.id left join business_varieties c on
  1035. b.cid = c.id left join contract d on
  1036. a.contract_id = d.id left join user e on
  1037. d.uid = e.id left join admin f on
  1038. a.task_receiver = f.id left join t_order g on
  1039. d.order_no=g.order_no
  1040. where 1=1
  1041. <if test="taskReceiverId != null and taskReceiverId != ''">
  1042. and a.task_receiver = #{taskReceiverId,jdbcType=VARCHAR}
  1043. </if>
  1044. <if test="deleteSign != null">
  1045. and a.deleted_sign = #{deleteSign,jdbcType=VARCHAR}
  1046. </if>
  1047. <if test="publishStatus != null">
  1048. and a.publish_status = #{publishStatus,jdbcType=VARCHAR}
  1049. </if>
  1050. <if test="taskStatus != null">
  1051. and a.task_status = #{taskStatus,jdbcType=VARCHAR}
  1052. </if>
  1053. <if test="startDate != null">
  1054. and a.task_distribution_time &gt; #{startDate,jdbcType=TIMESTAMP}
  1055. </if>
  1056. <if test="endDate != null">
  1057. and a.task_distribution_time &lt; #{endDate,jdbcType=TIMESTAMP}
  1058. </if>
  1059. <if test="projectNo != null and projectNo != ''">
  1060. and d.serial_number = #{projectNo,jdbcType=VARCHAR}
  1061. </if>
  1062. <if test="buyerName != null and buyerName != ''">
  1063. and e.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
  1064. </if>
  1065. <if test="taskReceiverName != null and taskReceiverName != ''">
  1066. and f.name = #{taskReceiverName,jdbcType=VARCHAR}
  1067. </if>
  1068. <if test="categoryId != null and categoryId != ''">
  1069. and c.id = #{categoryId,jdbcType=VARCHAR}
  1070. </if>
  1071. order by a.task_distribution_time desc
  1072. <if test="page_sql != null">
  1073. ${page_sql}
  1074. </if>
  1075. </select>
  1076. <select id="selectProjectTaskCount" resultType="java.lang.Integer">
  1077. select
  1078. count(0)
  1079. from
  1080. (select *
  1081. from contract_task_log
  1082. where task_receiver=#{taskReceiver,jdbcType=VARCHAR}) x left join contract_task a on
  1083. x.contract_task_id=a.id left join business_project b on
  1084. a.commodity_id = b.id left join business_varieties c on
  1085. b.cid = c.id left join contract d on
  1086. a.contract_id = d.id left join user e on
  1087. d.uid = e.id left join admin f on
  1088. a.task_receiver = f.id left join t_order g on
  1089. d.order_no=g.order_no
  1090. where 1=1
  1091. <if test="taskReceiverId != null and taskReceiverId != ''">
  1092. and a.task_receiver = #{taskReceiverId,jdbcType=VARCHAR}
  1093. </if>
  1094. <if test="deleteSign != null">
  1095. and a.deleted_sign = #{deleteSign,jdbcType=VARCHAR}
  1096. </if>
  1097. <if test="publishStatus != null">
  1098. and a.publish_status = #{publishStatus,jdbcType=VARCHAR}
  1099. </if>
  1100. <if test="taskStatus != null">
  1101. and a.task_status = #{taskStatus,jdbcType=VARCHAR}
  1102. </if>
  1103. <if test="startDate != null">
  1104. and a.task_distribution_time &gt; #{startDate,jdbcType=TIMESTAMP}
  1105. </if>
  1106. <if test="endDate != null">
  1107. and a.task_distribution_time &lt; #{endDate,jdbcType=TIMESTAMP}
  1108. </if>
  1109. <if test="projectNo != null and projectNo != ''">
  1110. and d.serial_number = #{projectNo,jdbcType=VARCHAR}
  1111. </if>
  1112. <if test="buyerName != null and buyerName != ''">
  1113. and e.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
  1114. </if>
  1115. <if test="taskReceiverName != null and taskReceiverName != ''">
  1116. and f.name = #{taskReceiverName,jdbcType=VARCHAR}
  1117. </if>
  1118. <if test="categoryId != null and categoryId != ''">
  1119. and c.id = #{categoryId,jdbcType=VARCHAR}
  1120. </if>
  1121. <if test="taskReceiverId != null and taskReceiverId != ''">
  1122. and a.task_receiver = #{taskReceiverId,jdbcType=VARCHAR}
  1123. </if>
  1124. <if test="deleteSign != null">
  1125. and a.deleted_sign = #{deleteSign,jdbcType=VARCHAR}
  1126. </if>
  1127. <if test="publishStatus != null">
  1128. and a.publish_status = #{publishStatus,jdbcType=VARCHAR}
  1129. </if>
  1130. <if test="taskStatus != null">
  1131. and a.task_status = #{taskStatus,jdbcType=VARCHAR}
  1132. </if>
  1133. <if test="startDate != null">
  1134. and a.task_distribution_time &gt; #{startDate,jdbcType=TIMESTAMP}
  1135. </if>
  1136. <if test="endDate != null">
  1137. and a.task_distribution_time &lt; #{endDate,jdbcType=TIMESTAMP}
  1138. </if>
  1139. <if test="projectNo != null and projectNo != ''">
  1140. and d.serial_number = #{projectNo,jdbcType=VARCHAR}
  1141. </if>
  1142. <if test="buyerName != null and buyerName != ''">
  1143. and e.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
  1144. </if>
  1145. <if test="taskReceiverName != null and taskReceiverName != ''">
  1146. and f.name = #{taskReceiverName,jdbcType=VARCHAR}
  1147. </if>
  1148. <if test="categoryId != null and categoryId != ''">
  1149. and c.id = #{categoryId,jdbcType=VARCHAR}
  1150. </if>
  1151. </select>
  1152. </mapper>