TaskMapper.xml 11 KB

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