TaskMapper.xml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  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.management.platform.mapper.TaskMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.management.platform.entity.Task">
  6. <id column="id" property="id" />
  7. <result column="task_name" property="taskName" />
  8. <result column="company_id" property="companyId" />
  9. <result column="owner_id" property="ownerId" />
  10. <result column="contacts_id" property="contactsId" />
  11. <result column="executor_id" property="executorId" />
  12. <result column="clue_id" property="clueId" />
  13. <result column="custom_id" property="customId" />
  14. <result column="business_opportunity_id" property="businessOpportunityId" />
  15. <result column="order_id" property="orderId" />
  16. <result column="product_id" property="productId" />
  17. <result column="status" property="status" />
  18. <result column="priority" property="priority" />
  19. <result column="is_repeat" property="isRepeat" />
  20. <result column="repeat_type" property="repeatType" />
  21. <result column="repeat_end_never" property="repeatEndNever" />
  22. <result column="repeat_end_count" property="repeatEndCount" />
  23. <result column="repeat_end_date" property="repeatEndDate" />
  24. <result column="repeat_design_day" property="repeatDesignDay" />
  25. <result column="repeat_design_sameday" property="repeatDesignSameday" />
  26. <result column="task_desc" property="taskDesc" />
  27. <result column="creater_id" property="createrId" />
  28. <result column="creater_name" property="createrName" />
  29. <result column="create_date" property="createDate" />
  30. <result column="end_date" property="endDate" />
  31. <result column="start_date" property="startDate" />
  32. <result column="finish_date" property="finishDate" />
  33. <result column="is_delete" property="isDelete" />
  34. <result column="task_type" property="taskType" />
  35. <result column="end_type" property="endType" />
  36. <result column="plate1" property="plate1" />
  37. <result column="plate2" property="plate2" />
  38. <result column="plate3" property="plate3" />
  39. <result column="plate4" property="plate4" />
  40. <result column="plate5" property="plate5" />
  41. </resultMap>
  42. <!-- 通用查询结果列 -->
  43. <sql id="Base_Column_List">
  44. id, task_name, company_id, owner_id, contacts_id, executor_id, clue_id, custom_id, business_opportunity_id, order_id, product_id, status, priority, is_repeat, repeat_type, repeat_end_never, repeat_end_count, repeat_end_date, repeat_design_day, repeat_design_sameday, task_desc, creater_id, creater_name, create_date, end_date, start_date, finish_date, is_delete, task_type, end_type, plate1, plate2, plate3, plate4, plate5
  45. </sql>
  46. <resultMap id="TaskVoMap" type="com.management.platform.entity.vo.TasKVo">
  47. <id column="id" property="id" />
  48. <result column="task_name" property="taskName" />
  49. <result column="company_id" property="companyId" />
  50. <result column="owner_id" property="ownerId" />
  51. <result column="contacts_id" property="contactsId" />
  52. <result column="executor_id" property="executorId" />
  53. <result column="clue_id" property="clueId" />
  54. <result column="custom_id" property="customId" />
  55. <result column="business_opportunity_id" property="businessOpportunityId" />
  56. <result column="order_id" property="orderId" />
  57. <result column="product_id" property="productId" />
  58. <result column="status" property="status" />
  59. <result column="priority" property="priority" />
  60. <result column="is_repeat" property="isRepeat" />
  61. <result column="repeat_type" property="repeatType" />
  62. <result column="repeat_end_never" property="repeatEndNever" />
  63. <result column="repeat_end_count" property="repeatEndCount" />
  64. <result column="repeat_end_date" property="repeatEndDate" />
  65. <result column="repeat_design_day" property="repeatDesignDay" />
  66. <result column="repeat_design_sameday" property="repeatDesignSameday" />
  67. <result column="task_desc" property="taskDesc" />
  68. <result column="creater_id" property="createrId" />
  69. <result column="creater_name" property="createrName" />
  70. <result column="create_date" property="createDate" />
  71. <result column="end_date" property="endDate" />
  72. <result column="start_date" property="startDate" />
  73. <result column="finish_date" property="finishDate" />
  74. <result column="is_delete" property="isDelete" />
  75. <result column="task_type" property="taskType" />
  76. <result column="end_type" property="endType" />
  77. <result column="plate1" property="plate1" />
  78. <result column="plate2" property="plate2" />
  79. <result column="plate3" property="plate3" />
  80. <result column="plate4" property="plate4" />
  81. <result column="plate5" property="plate5" />
  82. <result column="custom_name" property="customName"/>
  83. <result column="businessName" property="businessName"/>
  84. <result column="order_name" property="orderName"/>
  85. <result column="clue_name" property="clueName"/>
  86. <result column="contacts_name" property="contactsName"/>
  87. <result column="contacts_phone" property="contactsPhone"/>
  88. </resultMap>
  89. <resultMap id="TaskPinVoMap" type="com.management.platform.entity.vo.TasKVo">
  90. <id column="id" property="id" />
  91. <result column="task_name" property="taskName" />
  92. <result column="company_id" property="companyId" />
  93. <result column="owner_id" property="ownerId" />
  94. <result column="contacts_id" property="contactsId" />
  95. <result column="executor_id" property="executorId" />
  96. <result column="clue_id" property="clueId" />
  97. <result column="custom_id" property="customId" />
  98. <result column="business_opportunity_id" property="businessOpportunityId" />
  99. <result column="order_id" property="orderId" />
  100. <result column="product_id" property="productId" />
  101. <result column="status" property="status" />
  102. <result column="priority" property="priority" />
  103. <result column="is_repeat" property="isRepeat" />
  104. <result column="repeat_type" property="repeatType" />
  105. <result column="repeat_end_never" property="repeatEndNever" />
  106. <result column="repeat_end_count" property="repeatEndCount" />
  107. <result column="repeat_end_date" property="repeatEndDate" />
  108. <result column="repeat_design_day" property="repeatDesignDay" />
  109. <result column="repeat_design_sameday" property="repeatDesignSameday" />
  110. <result column="task_desc" property="taskDesc" />
  111. <result column="creater_id" property="createrId" />
  112. <result column="creater_name" property="createrName" />
  113. <result column="create_date" property="createDate" />
  114. <result column="end_date" property="endDate" />
  115. <result column="start_date" property="startDate" />
  116. <result column="finish_date" property="finishDate" />
  117. <result column="is_delete" property="isDelete" />
  118. <result column="task_type" property="taskType" />
  119. <result column="end_type" property="endType" />
  120. <result column="plate1" property="plate1" />
  121. <result column="plate2" property="plate2" />
  122. <result column="plate3" property="plate3" />
  123. <result column="plate4" property="plate4" />
  124. <result column="plate5" property="plate5" />
  125. <result column="need_pin" property="needPin"></result>
  126. <result column="pin_time" property="pinTime"></result>
  127. <result column="custom_name" property="customName"/>
  128. <result column="businessName" property="businessName"/>
  129. <result column="order_name" property="orderName"/>
  130. <result column="clue_name" property="clueName"/>
  131. <result column="contacts_name" property="contactsName"/>
  132. <result column="contacts_phone" property="contactsPhone"/>
  133. </resultMap>
  134. <select id="getPageListTask" resultMap="TaskVoMap">
  135. select DISTINCT task.* ,
  136. custom.custom_name,
  137. business_opportunity.name businessName,
  138. `sales_order`.order_name ,
  139. clue.clue_name,
  140. contacts.name contacts_name ,contacts.phone contacts_phone
  141. from task
  142. left join custom on task.custom_id=custom.id
  143. left join business_opportunity on task.business_opportunity_id=business_opportunity.id
  144. left join `sales_order` on task.order_id=`sales_order`.id
  145. left join clue on task.clue_id=clue.id
  146. left join contacts on task.contacts_id=contacts.id
  147. <if test=" executorName!= null and executorName != '' " >
  148. inner join task_executor te on task.id=te.task_id
  149. </if>
  150. <if test=" departmentId!= null " >
  151. inner join task_executor on task.id=task_executor.task_id
  152. </if>
  153. <if test=" departmentIdByMyselfOrNull!= null and departmentIdByMyselfOrNull != '' " >
  154. inner join task_executor on task.id=task_executor.task_id
  155. </if>
  156. <where>
  157. and 1=1 and task.is_delete=0
  158. <if test=" taskName!= null and taskName != ''">
  159. AND task.task_name LIKE CONCAT('%', #{taskName}, '%')
  160. </if>
  161. <if test=" priority!= null ">
  162. AND task.priority =#{priority}
  163. </if>
  164. <if test=" customName!= null and customName != ''">
  165. AND custom.custom_name LIKE CONCAT('%', #{customName}, '%')
  166. </if>
  167. <if test=" contactsName!= null and contactsName != ''">
  168. AND contacts.name LIKE CONCAT('%', #{contactsName}, '%')
  169. </if>
  170. <if test=" businessName!= null and businessName != ''">
  171. AND business_opportunity.name LIKE CONCAT('%', #{businessName}, '%')
  172. </if>
  173. <if test=" orderName!= null and orderName != ''">
  174. AND `sales_order`.order_name LIKE CONCAT('%', #{orderName}, '%')
  175. </if>
  176. <if test=" clueName!= null and clueName != ''">
  177. AND clue.clue_name LIKE CONCAT('%', #{clueName}, '%')
  178. </if>
  179. <if test=" phone!= null and phone != ''">
  180. AND contacts.phone LIKE CONCAT('%', #{phone}, '%')
  181. </if>
  182. <if test=" status!= null ">
  183. AND task.status = #{status}
  184. </if>
  185. <if test=" executorName!= null and executorName != '' ">
  186. AND te.executor_name LIKE CONCAT('%', #{executorName}, '%')
  187. </if>
  188. <!--<if test=" startDate!= null">
  189. AND task.start_date &gt; #{startDate}
  190. </if>
  191. <if test=" endDate!= null">
  192. AND task.end_date &lt; #{endDate}
  193. </if>-->
  194. <if test=" startDate!= null and endDate!= null">
  195. AND
  196. (
  197. (
  198. (task.start_date IS NULL OR task.start_date &lt;= #{startDate}) AND (task.end_date &gt;= #{startDate} AND task.end_date &lt;= #{endDate})
  199. )
  200. OR
  201. (
  202. (task.end_date IS NULL OR task.end_date &gt;= #{endDate}) AND (task.start_date &gt;= #{startDate} AND task.start_date &lt;= #{endDate})
  203. )
  204. OR
  205. (
  206. task.start_date IS NOT NULL AND task.end_date IS NOT NULL AND task.start_date &gt;= #{startDate}
  207. AND task.start_date &lt;= #{endDate} AND task.end_date &gt;= #{startDate} AND task.end_date &lt;= #{endDate}
  208. )
  209. )
  210. </if>
  211. <if test=" startDate != null and endDate == null">
  212. AND (task.end_date IS NOT NULL and task.end_date &gt;= #{startDate})
  213. </if>
  214. <if test=" startDate == null and endDate != null">
  215. AND (task.start_date IS NOT NULL and task.start_date &lt;= #{endDate})
  216. </if>
  217. <if test=" companyId!= null ">
  218. AND task.company_id = #{companyId}
  219. </if>
  220. <if test=" departmentId!= null " >
  221. AND task_executor.task_id in ( SELECT DISTINCT te.task_id FROM task_executor te
  222. LEFT JOIN `user` u ON u.id=te.executor_id
  223. where u.department_id = #{departmentId} )
  224. </if>
  225. <if test=" departmentIdByMyselfOrNull!= null and departmentIdByMyselfOrNull != '' " >
  226. AND task_executor.task_id in ( SELECT DISTINCT te.task_id FROM task_executor te
  227. where te.executor_id= #{departmentIdByMyselfOrNull } or te.executor_id is null )
  228. </if>
  229. </where>
  230. order by task.create_date desc
  231. <if test="pageIndex != null and pageSize != null">
  232. LIMIT #{pageIndex}, #{pageSize}
  233. </if>
  234. </select>
  235. <select id="getPageListTotalTask" resultMap="TaskVoMap">
  236. select DISTINCT task.id
  237. from task
  238. left join custom on task.custom_id=custom.id
  239. left join business_opportunity on task.business_opportunity_id=business_opportunity.id
  240. left join `sales_order` on task.order_id=`sales_order`.id
  241. left join clue on task.clue_id=clue.id
  242. left join contacts on task.contacts_id=contacts.id
  243. <if test=" executorName!= null and executorName != '' " >
  244. inner join task_executor te on task.id=te.task_id
  245. </if>
  246. <if test=" departmentId!= null " >
  247. inner join task_executor on task.id=task_executor.task_id
  248. </if>
  249. <if test=" departmentIdByMyselfOrNull!= null and departmentIdByMyselfOrNull != '' " >
  250. inner join task_executor on task.id=task_executor.task_id
  251. </if>
  252. <where>
  253. and 1=1 and task.is_delete=0
  254. <if test=" taskName!= null and taskName != ''">
  255. AND task.task_name LIKE CONCAT('%', #{taskName}, '%')
  256. </if>
  257. <if test=" priority!= null ">
  258. AND task.priority =#{priority}
  259. </if>
  260. <if test=" customName!= null and customName != ''">
  261. AND custom.custom_name LIKE CONCAT('%', #{customName}, '%')
  262. </if>
  263. <if test=" contactsName!= null and contactsName != ''">
  264. AND contacts.name LIKE CONCAT('%', #{contactsName}, '%')
  265. </if>
  266. <if test=" businessName!= null and businessName != ''">
  267. AND business_opportunity.name LIKE CONCAT('%', #{businessName}, '%')
  268. </if>
  269. <if test=" orderName!= null and orderName != ''">
  270. AND `sales_order`.order_name LIKE CONCAT('%', #{orderName}, '%')
  271. </if>
  272. <if test=" clueName!= null and clueName != ''">
  273. AND clue.clue_name LIKE CONCAT('%', #{clueName}, '%')
  274. </if>
  275. <if test=" phone!= null and phone != ''">
  276. AND contacts.phone LIKE CONCAT('%', #{phone}, '%')
  277. </if>
  278. <if test=" status!= null ">
  279. AND task.status = #{status}
  280. </if>
  281. <if test=" executorName!= null and executorName != '' ">
  282. AND te.executor_name LIKE CONCAT('%', #{executorName}, '%')
  283. </if>
  284. <!--<if test=" startDate!= null ">
  285. AND task.start_date &gt; #{startDate}
  286. </if>
  287. <if test=" endDate!= null ">
  288. AND task.end_date &lt; #{endDate}
  289. </if>-->
  290. <if test=" startDate!= null and endDate!= null">
  291. AND
  292. (
  293. (
  294. (task.start_date IS NULL OR task.start_date &lt;= #{startDate}) AND (task.end_date &gt;= #{startDate} AND task.end_date &lt;= #{endDate})
  295. )
  296. OR
  297. (
  298. (task.end_date IS NULL OR task.end_date &gt;= #{endDate}) AND (task.start_date &gt;= #{startDate} AND task.start_date &lt;= #{endDate})
  299. )
  300. OR
  301. (
  302. task.start_date IS NOT NULL AND task.end_date IS NOT NULL AND task.start_date &gt;= #{startDate}
  303. AND task.start_date &lt;= #{endDate} AND task.end_date &gt;= #{startDate} AND task.end_date &lt;= #{endDate}
  304. )
  305. )
  306. </if>
  307. <if test=" startDate != null and endDate == null">
  308. AND (task.end_date IS NOT NULL and task.end_date &gt;= #{startDate})
  309. </if>
  310. <if test=" startDate == null and endDate != null">
  311. AND (task.start_date IS NOT NULL and task.start_date &lt;= #{endDate})
  312. </if>
  313. <if test=" companyId!= null ">
  314. AND task.company_id = #{companyId}
  315. </if>
  316. <if test=" departmentId!= null " >
  317. AND task_executor.task_id in ( SELECT DISTINCT te.task_id FROM task_executor te
  318. LEFT JOIN `user` u ON u.id=te.executor_id
  319. where u.department_id = #{departmentId} )
  320. </if>
  321. <if test=" departmentIdByMyselfOrNull!= null and departmentIdByMyselfOrNull != '' " >
  322. AND task_executor.task_id in ( SELECT DISTINCT te.task_id FROM task_executor te
  323. where te.executor_id= #{departmentIdByMyselfOrNull} or te.executor_id is null )
  324. </if>
  325. </where>
  326. </select>
  327. <select id="getListByTaskIds" resultType="com.management.platform.entity.vo.TasKVo">
  328. select task.* ,
  329. custom.custom_name,
  330. business_opportunity.name businessName,
  331. `sales_order`.order_name ,
  332. clue.clue_name,
  333. contacts.name contacts_name ,contacts.phone
  334. from task
  335. left join custom on task.custom_id=custom.id
  336. left join business_opportunity on task.business_opportunity_id=business_opportunity.id
  337. left join `sales_order` on task.order_id=`sales_order`.id
  338. left join clue on task.clue_id=clue.id
  339. left join contacts on task.contacts_id=contacts.id
  340. WHERE task.id IN
  341. <foreach item="taskId" collection="taskIdArray" open="(" separator="," close=")">
  342. #{taskId}
  343. </foreach>
  344. </select>
  345. <select id="getPageListTaskByPin" resultMap="TaskPinVoMap">
  346. select DISTINCT task.* ,
  347. custom.custom_name,
  348. business_opportunity.name businessName,
  349. `sales_order`.order_name ,
  350. clue.clue_name,
  351. contacts.name contacts_name ,contacts.phone contacts_phone
  352. from task
  353. left join custom on task.custom_id=custom.id
  354. left join business_opportunity on task.business_opportunity_id=business_opportunity.id
  355. left join `sales_order` on task.order_id=`sales_order`.id
  356. left join clue on task.clue_id=clue.id
  357. left join contacts on task.contacts_id=contacts.id
  358. <if test=" executorName!= null and executorName != '' " >
  359. inner join task_executor te on task.id=te.task_id
  360. </if>
  361. <if test=" departmentId!= null " >
  362. inner join task_executor on task.id=task_executor.task_id
  363. </if>
  364. <if test=" departmentIdByMyselfOrNull!= null and departmentIdByMyselfOrNull != '' " >
  365. inner join task_executor on task.id=task_executor.task_id
  366. </if>
  367. <where>
  368. and 1=1 and task.is_delete=0
  369. <if test=" taskName!= null and taskName != ''">
  370. AND task.task_name LIKE CONCAT('%', #{taskName}, '%')
  371. </if>
  372. <if test=" priority!= null ">
  373. AND task.priority =#{priority}
  374. </if>
  375. <if test=" customName!= null and customName != ''">
  376. AND custom.custom_name LIKE CONCAT('%', #{customName}, '%')
  377. </if>
  378. <if test=" contactsName!= null and contactsName != ''">
  379. AND contacts.name LIKE CONCAT('%', #{contactsName}, '%')
  380. </if>
  381. <if test=" businessName!= null and businessName != ''">
  382. AND business_opportunity.name LIKE CONCAT('%', #{businessName}, '%')
  383. </if>
  384. <if test=" orderName!= null and orderName != ''">
  385. AND `sales_order`.order_name LIKE CONCAT('%', #{orderName}, '%')
  386. </if>
  387. <if test=" clueName!= null and clueName != ''">
  388. AND clue.clue_name LIKE CONCAT('%', #{clueName}, '%')
  389. </if>
  390. <if test=" phone!= null and phone != ''">
  391. AND contacts.phone LIKE CONCAT('%', #{phone}, '%')
  392. </if>
  393. <if test=" status!= null ">
  394. AND task.status = #{status}
  395. </if>
  396. <if test=" executorName!= null and executorName != '' ">
  397. AND te.executor_name LIKE CONCAT('%', #{executorName}, '%')
  398. </if>
  399. <!--<if test=" startDate!= null">
  400. AND task.start_date &gt; #{startDate}
  401. </if>
  402. <if test=" endDate!= null">
  403. AND task.end_date &lt; #{endDate}
  404. </if>-->
  405. <if test=" startDate!= null and endDate!= null">
  406. AND
  407. (
  408. (
  409. (task.start_date IS NULL OR task.start_date &lt;= #{startDate}) AND (task.end_date &gt;= #{startDate} AND task.end_date &lt;= #{endDate})
  410. )
  411. OR
  412. (
  413. (task.end_date IS NULL OR task.end_date &gt;= #{endDate}) AND (task.start_date &gt;= #{startDate} AND task.start_date &lt;= #{endDate})
  414. )
  415. OR
  416. (
  417. task.start_date IS NOT NULL AND task.end_date IS NOT NULL AND task.start_date &gt;= #{startDate}
  418. AND task.start_date &lt;= #{endDate} AND task.end_date &gt;= #{startDate} AND task.end_date &lt;= #{endDate}
  419. )
  420. )
  421. </if>
  422. <if test=" startDate != null and endDate == null">
  423. AND (task.end_date IS NOT NULL and task.end_date &gt;= #{startDate})
  424. </if>
  425. <if test=" startDate == null and endDate != null">
  426. AND (task.start_date IS NOT NULL and task.start_date &lt;= #{endDate})
  427. </if>
  428. <if test=" companyId!= null ">
  429. AND task.company_id = #{companyId}
  430. </if>
  431. <if test=" departmentId!= null " >
  432. AND task_executor.task_id in ( SELECT DISTINCT te.task_id FROM task_executor te
  433. LEFT JOIN `user` u ON u.id=te.executor_id
  434. where u.department_id = #{departmentId} )
  435. </if>
  436. <if test=" departmentIdByMyselfOrNull!= null and departmentIdByMyselfOrNull != '' " >
  437. AND task_executor.task_id in ( SELECT DISTINCT te.task_id FROM task_executor te
  438. where te.executor_id= #{departmentIdByMyselfOrNull } or te.executor_id is null )
  439. </if>
  440. </where>
  441. order by task.need_pin desc,task.pin_time desc,task.create_date desc
  442. <if test="pageIndex != null and pageSize != null">
  443. LIMIT #{pageIndex}, #{pageSize}
  444. </if>
  445. </select>
  446. <select id="getTaskListByStartAndEnd" resultType="com.management.platform.entity.dto.TaskDto">
  447. select DISTINCT task.id,task.task_name,task.start_date,task.end_date
  448. from task
  449. left join custom on task.custom_id=custom.id
  450. left join business_opportunity on task.business_opportunity_id=business_opportunity.id
  451. left join `sales_order` on task.order_id=`sales_order`.id
  452. left join clue on task.clue_id=clue.id
  453. left join contacts on task.contacts_id=contacts.id
  454. <if test=" departmentId!= null " >
  455. inner join task_executor on task.id=task_executor.task_id
  456. </if>
  457. <if test=" executor!= null and executor != '' " >
  458. inner join task_executor on task.id=task_executor.task_id
  459. </if>
  460. <where>
  461. and 1=1 and task.is_delete=0
  462. <if test=" startDate!= null and endDate!= null">
  463. AND
  464. (
  465. (
  466. (task.start_date IS NULL OR task.start_date &lt;= #{startDate}) AND (task.end_date &gt; #{startDate} AND task.end_date &lt; #{endDate})
  467. )
  468. OR
  469. (
  470. (task.end_date IS NULL OR task.end_date &gt; #{endDate}) AND (task.start_date &gt;= #{startDate} AND task.start_date &lt; #{endDate})
  471. )
  472. OR
  473. (
  474. task.start_date IS NOT NULL AND task.end_date IS NOT NULL AND task.start_date &gt;= #{startDate}
  475. AND task.start_date &lt; #{endDate} AND task.end_date &gt; #{startDate} AND task.end_date &lt; #{endDate}
  476. )
  477. )
  478. </if>
  479. <if test=" companyId!= null ">
  480. AND task.company_id = #{companyId}
  481. </if>
  482. <if test=" departmentId!= null " >
  483. AND task_executor.task_id in ( SELECT DISTINCT te.task_id FROM task_executor te
  484. LEFT JOIN `user` u ON u.id=te.executor_id
  485. where u.department_id = #{departmentId} )
  486. </if>
  487. <if test=" executor!= null and executor != '' " >
  488. AND task_executor.task_id in ( SELECT DISTINCT te.task_id FROM task_executor te
  489. where te.executor_id= #{executor} or te.executor_id is null )
  490. </if>
  491. </where>
  492. order by task.create_date desc
  493. </select>
  494. <update id="updateRepeatConfig">
  495. update task
  496. <set>
  497. repeat_type=#{repeatType},repeat_end_never=#{repeatEndNever},repeat_end_count=#{repeatEndCount},
  498. repeat_end_date=#{repeatEndDate},repeat_design_day=#{repeatDesignDay},repeat_design_sameday=#{repeatDesignSameday},
  499. custom_id=#{customId},business_opportunity_id=#{businessOpportunityId},order_id=#{orderId},clue_id=#{clueId},contacts_id=#{contactsId}
  500. </set>
  501. where id=#{id}
  502. </update>
  503. </mapper>