TaskMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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="plate1" property="plate1" />
  35. <result column="plate2" property="plate2" />
  36. <result column="plate3" property="plate3" />
  37. <result column="plate4" property="plate4" />
  38. <result column="plate5" property="plate5" />
  39. </resultMap>
  40. <!-- 通用查询结果列 -->
  41. <sql id="Base_Column_List">
  42. 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, plate1, plate2, plate3, plate4, plate5
  43. </sql>
  44. <resultMap id="TaskVoMap" type="com.management.platform.entity.vo.TasKVo">
  45. <id column="id" property="id" />
  46. <result column="task_name" property="taskName" />
  47. <result column="company_id" property="companyId" />
  48. <result column="owner_id" property="ownerId" />
  49. <result column="contacts_id" property="contactsId" />
  50. <result column="executor_id" property="executorId" />
  51. <result column="clue_id" property="clueId" />
  52. <result column="custom_id" property="customId" />
  53. <result column="business_opportunity_id" property="businessOpportunityId" />
  54. <result column="order_id" property="orderId" />
  55. <result column="product_id" property="productId" />
  56. <result column="status" property="status" />
  57. <result column="priority" property="priority" />
  58. <result column="is_repeat" property="isRepeat" />
  59. <result column="repeat_type" property="repeatType" />
  60. <result column="repeat_end_never" property="repeatEndNever" />
  61. <result column="repeat_end_count" property="repeatEndCount" />
  62. <result column="repeat_end_date" property="repeatEndDate" />
  63. <result column="repeat_design_day" property="repeatDesignDay" />
  64. <result column="repeat_design_sameday" property="repeatDesignSameday" />
  65. <result column="task_desc" property="taskDesc" />
  66. <result column="creater_id" property="createrId" />
  67. <result column="creater_name" property="createrName" />
  68. <result column="create_date" property="createDate" />
  69. <result column="end_date" property="endDate" />
  70. <result column="start_date" property="startDate" />
  71. <result column="finish_date" property="finishDate" />
  72. <result column="is_delete" property="isDelete" />
  73. <result column="plate1" property="plate1" />
  74. <result column="plate2" property="plate2" />
  75. <result column="plate3" property="plate3" />
  76. <result column="plate4" property="plate4" />
  77. <result column="plate5" property="plate5" />
  78. <association property="custom" javaType="com.management.platform.entity.Custom">
  79. <id column="custom_id" property="id"/>
  80. <result column="custom_name" property="customName"/>
  81. </association>
  82. <association property="businessOpportunity" javaType="com.management.platform.entity.BusinessOpportunity">
  83. <id column="business_opportunity_id" property="id"/>
  84. <result column="businessName" property="name"/>
  85. </association>
  86. <association property="order" javaType="com.management.platform.entity.Order">
  87. <id column="order_id" property="id"/>
  88. <result column="order_name" property="orderName"/>
  89. </association>
  90. <association property="clue" javaType="com.management.platform.entity.Clue">
  91. <id column="clue_id" property="id"/>
  92. <result column="clue_name" property="clueName"/>
  93. </association>
  94. <association property="contacts" javaType="com.management.platform.entity.Contacts">
  95. <id column="contacts_id" property="id"/>
  96. <result column="contacts_name" property="name"/>
  97. <result column="phone" property="phone"/>
  98. </association>
  99. <collection property="taskExecutors" ofType="com.management.platform.entity.TaskExecutor">
  100. <id column="task_executor_id" property="taskExecutorId"/>
  101. <result column="taskExecutor_executor_id" property="executorId"/>
  102. <result column="executor_name" property="executorName"/>
  103. </collection>
  104. </resultMap>
  105. <select id="getPageListTask" resultMap="TaskVoMap">
  106. select task.* ,
  107. custom.custom_name,
  108. business_opportunity.name businessName,
  109. `order`.order_name ,
  110. clue.clue_name,
  111. contacts.name contacts_name ,contacts.phone,
  112. task_executor.task_executor_id, task_executor.executor_id taskExecutor_executor_id,task_executor.executor_name
  113. from task
  114. left join custom on task.custom_id=custom.id
  115. left join business_opportunity on task.business_opportunity_id=business_opportunity.id
  116. left join `order` on task.order_id=`order`.id
  117. left join clue on task.clue_id=clue.id
  118. left join contacts on task.contacts_id=contacts.id
  119. left join task_executor on task.id=task_executor.task_id
  120. <where>
  121. and 1=1 and task.is_delete=0
  122. <if test=" taskName!= null and taskName != ''">
  123. AND task.task_name LIKE CONCAT('%', #{taskName}, '%')
  124. </if>
  125. <if test=" priority!= null ">
  126. AND task.priority =#{priority}
  127. </if>
  128. <if test=" customName!= null and customName != ''">
  129. AND custom.custom_name LIKE CONCAT('%', #{customName}, '%')
  130. </if>
  131. <if test=" contactsName!= null and contactsName != ''">
  132. AND contacts.name LIKE CONCAT('%', #{contactsName}, '%')
  133. </if>
  134. <if test=" businessName!= null and businessName != ''">
  135. AND business_opportunity.name LIKE CONCAT('%', #{businessName}, '%')
  136. </if>
  137. <if test=" orderName!= null and orderName != ''">
  138. AND `order`.order_name LIKE CONCAT('%', #{orderName}, '%')
  139. </if>
  140. <if test=" clueName!= null and clueName != ''">
  141. AND clue.clue_name LIKE CONCAT('%', #{clueName}, '%')
  142. </if>
  143. <if test=" phone!= null and phone != ''">
  144. AND contacts.phone LIKE CONCAT('%', #{phone}, '%')
  145. </if>
  146. <if test=" status!= null ">
  147. AND task.status = #{status}
  148. </if>
  149. <if test=" executorName!= null and executorName != '' ">
  150. AND task_executor.executor_name LIKE CONCAT('%', #{executorName}, '%')
  151. </if>
  152. <if test=" startDate!= null and startDate != '' ">
  153. AND task.start_date &gt; #{startDate}
  154. </if>
  155. <if test=" endDate!= null and endDate != '' ">
  156. AND task.end_date &lt; #{endDate}
  157. </if>
  158. <if test=" companyId!= null ">
  159. AND task.company_id = #{companyId}
  160. </if>
  161. </where>
  162. <if test="pageIndex != null and pageSize != null">
  163. LIMIT #{pageIndex}, #{pageSize}
  164. </if>
  165. </select>
  166. <select id="getPageListTotalTask" resultMap="TaskVoMap">
  167. select task.* ,
  168. custom.custom_name,
  169. business_opportunity.name businessName,
  170. `order`.order_name ,
  171. clue.clue_name,
  172. contacts.name contacts_name ,contacts.phone,
  173. task_executor.task_executor_id, task_executor.executor_id taskExecutor_executor_id,task_executor.executor_name
  174. from task
  175. left join custom on task.custom_id=custom.id
  176. left join business_opportunity on task.business_opportunity_id=business_opportunity.id
  177. left join `order` on task.order_id=`order`.id
  178. left join clue on task.clue_id=clue.id
  179. left join contacts on task.contacts_id=contacts.id
  180. left join task_executor on task.id=task_executor.task_id
  181. <where>
  182. and 1=1 and task.is_delete=0
  183. <if test=" taskName!= null and taskName != ''">
  184. AND task.task_name LIKE CONCAT('%', #{taskName}, '%')
  185. </if>
  186. <if test=" priority!= null ">
  187. AND task.priority =#{priority}
  188. </if>
  189. <if test=" customName!= null and customName != ''">
  190. AND custom.custom_name LIKE CONCAT('%', #{customName}, '%')
  191. </if>
  192. <if test=" contactsName!= null and contactsName != ''">
  193. AND contacts.name LIKE CONCAT('%', #{contactsName}, '%')
  194. </if>
  195. <if test=" businessName!= null and businessName != ''">
  196. AND business_opportunity.name LIKE CONCAT('%', #{businessName}, '%')
  197. </if>
  198. <if test=" orderName!= null and orderName != ''">
  199. AND `order`.order_name LIKE CONCAT('%', #{orderName}, '%')
  200. </if>
  201. <if test=" clueName!= null and clueName != ''">
  202. AND clue.clue_name LIKE CONCAT('%', #{clueName}, '%')
  203. </if>
  204. <if test=" phone!= null and phone != ''">
  205. AND contacts.phone LIKE CONCAT('%', #{phone}, '%')
  206. </if>
  207. <if test=" status!= null ">
  208. AND task.status = #{status}
  209. </if>
  210. <if test=" executorName!= null and executorName != '' ">
  211. AND task_executor.executor_name LIKE CONCAT('%', #{executorName}, '%')
  212. </if>
  213. <if test=" startDate!= null and startDate != '' ">
  214. AND task.start_date &gt; #{startDate}
  215. </if>
  216. <if test=" endDate!= null and endDate != '' ">
  217. AND task.end_date &lt; #{endDate}
  218. </if>
  219. <if test=" companyId!= null ">
  220. AND task.company_id = #{companyId}
  221. </if>
  222. </where>
  223. </select>
  224. <update id="updateRepeatConfig">
  225. update task
  226. <set>
  227. repeat_type=#{repeatType},repeat_end_never=#{repeatEndNever},repeat_end_count=#{repeatEndCount},
  228. repeat_end_date=#{repeatEndDate},repeat_design_day=#{repeatDesignDay},repeat_design_sameday=#{repeatDesignSameday}
  229. </set>
  230. where id=#{id}
  231. </update>
  232. </mapper>