123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.management.platform.mapper.TaskMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.management.platform.entity.Task">
- <id column="id" property="id" />
- <result column="task_name" property="taskName" />
- <result column="company_id" property="companyId" />
- <result column="owner_id" property="ownerId" />
- <result column="contacts_id" property="contactsId" />
- <result column="executor_id" property="executorId" />
- <result column="clue_id" property="clueId" />
- <result column="custom_id" property="customId" />
- <result column="business_opportunity_id" property="businessOpportunityId" />
- <result column="order_id" property="orderId" />
- <result column="product_id" property="productId" />
- <result column="status" property="status" />
- <result column="priority" property="priority" />
- <result column="is_repeat" property="isRepeat" />
- <result column="repeat_type" property="repeatType" />
- <result column="repeat_end_never" property="repeatEndNever" />
- <result column="repeat_end_count" property="repeatEndCount" />
- <result column="repeat_end_date" property="repeatEndDate" />
- <result column="repeat_design_day" property="repeatDesignDay" />
- <result column="repeat_design_sameday" property="repeatDesignSameday" />
- <result column="task_desc" property="taskDesc" />
- <result column="creater_id" property="createrId" />
- <result column="creater_name" property="createrName" />
- <result column="create_date" property="createDate" />
- <result column="end_date" property="endDate" />
- <result column="start_date" property="startDate" />
- <result column="finish_date" property="finishDate" />
- <result column="is_delete" property="isDelete" />
- <result column="task_type" property="taskType" />
- <result column="end_type" property="endType" />
- <result column="plate1" property="plate1" />
- <result column="plate2" property="plate2" />
- <result column="plate3" property="plate3" />
- <result column="plate4" property="plate4" />
- <result column="plate5" property="plate5" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- 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
- </sql>
- <resultMap id="TaskVoMap" type="com.management.platform.entity.vo.TasKVo">
- <id column="id" property="id" />
- <result column="task_name" property="taskName" />
- <result column="company_id" property="companyId" />
- <result column="owner_id" property="ownerId" />
- <result column="contacts_id" property="contactsId" />
- <result column="executor_id" property="executorId" />
- <result column="clue_id" property="clueId" />
- <result column="custom_id" property="customId" />
- <result column="business_opportunity_id" property="businessOpportunityId" />
- <result column="order_id" property="orderId" />
- <result column="product_id" property="productId" />
- <result column="status" property="status" />
- <result column="priority" property="priority" />
- <result column="is_repeat" property="isRepeat" />
- <result column="repeat_type" property="repeatType" />
- <result column="repeat_end_never" property="repeatEndNever" />
- <result column="repeat_end_count" property="repeatEndCount" />
- <result column="repeat_end_date" property="repeatEndDate" />
- <result column="repeat_design_day" property="repeatDesignDay" />
- <result column="repeat_design_sameday" property="repeatDesignSameday" />
- <result column="task_desc" property="taskDesc" />
- <result column="creater_id" property="createrId" />
- <result column="creater_name" property="createrName" />
- <result column="create_date" property="createDate" />
- <result column="end_date" property="endDate" />
- <result column="start_date" property="startDate" />
- <result column="finish_date" property="finishDate" />
- <result column="is_delete" property="isDelete" />
- <result column="task_type" property="taskType" />
- <result column="end_type" property="endType" />
- <result column="plate1" property="plate1" />
- <result column="plate2" property="plate2" />
- <result column="plate3" property="plate3" />
- <result column="plate4" property="plate4" />
- <result column="plate5" property="plate5" />
- <result column="custom_name" property="customName"/>
- <result column="businessName" property="businessName"/>
- <result column="order_name" property="orderName"/>
- <result column="clue_name" property="clueName"/>
- <result column="contacts_name" property="contactsName"/>
- <result column="contacts_phone" property="contactsPhone"/>
- </resultMap>
- <resultMap id="TaskPinVoMap" type="com.management.platform.entity.vo.TasKVo">
- <id column="id" property="id" />
- <result column="task_name" property="taskName" />
- <result column="company_id" property="companyId" />
- <result column="owner_id" property="ownerId" />
- <result column="contacts_id" property="contactsId" />
- <result column="executor_id" property="executorId" />
- <result column="clue_id" property="clueId" />
- <result column="custom_id" property="customId" />
- <result column="business_opportunity_id" property="businessOpportunityId" />
- <result column="order_id" property="orderId" />
- <result column="product_id" property="productId" />
- <result column="status" property="status" />
- <result column="priority" property="priority" />
- <result column="is_repeat" property="isRepeat" />
- <result column="repeat_type" property="repeatType" />
- <result column="repeat_end_never" property="repeatEndNever" />
- <result column="repeat_end_count" property="repeatEndCount" />
- <result column="repeat_end_date" property="repeatEndDate" />
- <result column="repeat_design_day" property="repeatDesignDay" />
- <result column="repeat_design_sameday" property="repeatDesignSameday" />
- <result column="task_desc" property="taskDesc" />
- <result column="creater_id" property="createrId" />
- <result column="creater_name" property="createrName" />
- <result column="create_date" property="createDate" />
- <result column="end_date" property="endDate" />
- <result column="start_date" property="startDate" />
- <result column="finish_date" property="finishDate" />
- <result column="is_delete" property="isDelete" />
- <result column="task_type" property="taskType" />
- <result column="end_type" property="endType" />
- <result column="plate1" property="plate1" />
- <result column="plate2" property="plate2" />
- <result column="plate3" property="plate3" />
- <result column="plate4" property="plate4" />
- <result column="plate5" property="plate5" />
- <result column="need_pin" property="needPin"></result>
- <result column="pin_time" property="pinTime"></result>
- <result column="custom_name" property="customName"/>
- <result column="businessName" property="businessName"/>
- <result column="order_name" property="orderName"/>
- <result column="clue_name" property="clueName"/>
- <result column="contacts_name" property="contactsName"/>
- <result column="contacts_phone" property="contactsPhone"/>
- </resultMap>
- <select id="getPageListTask" resultMap="TaskVoMap">
- select DISTINCT task.* ,
- custom.custom_name,
- business_opportunity.name businessName,
- `sales_order`.order_name ,
- clue.clue_name,
- contacts.name contacts_name ,contacts.phone contacts_phone
- from task
- left join custom on task.custom_id=custom.id
- left join business_opportunity on task.business_opportunity_id=business_opportunity.id
- left join `sales_order` on task.order_id=`sales_order`.id
- left join clue on task.clue_id=clue.id
- left join contacts on task.contacts_id=contacts.id
- <if test=" executorName!= null and executorName != '' " >
- inner join task_executor te on task.id=te.task_id
- </if>
- <if test=" departmentId!= null " >
- inner join task_executor on task.id=task_executor.task_id
- </if>
- <if test=" departmentIdByMyselfOrNull!= null and departmentIdByMyselfOrNull != '' " >
- inner join task_executor on task.id=task_executor.task_id
- </if>
- <where>
- and 1=1 and task.is_delete=0
- <if test=" taskName!= null and taskName != ''">
- AND task.task_name LIKE CONCAT('%', #{taskName}, '%')
- </if>
- <if test=" priority!= null ">
- AND task.priority =#{priority}
- </if>
- <if test=" customName!= null and customName != ''">
- AND custom.custom_name LIKE CONCAT('%', #{customName}, '%')
- </if>
- <if test=" contactsName!= null and contactsName != ''">
- AND contacts.name LIKE CONCAT('%', #{contactsName}, '%')
- </if>
- <if test=" businessName!= null and businessName != ''">
- AND business_opportunity.name LIKE CONCAT('%', #{businessName}, '%')
- </if>
- <if test=" orderName!= null and orderName != ''">
- AND `sales_order`.order_name LIKE CONCAT('%', #{orderName}, '%')
- </if>
- <if test=" clueName!= null and clueName != ''">
- AND clue.clue_name LIKE CONCAT('%', #{clueName}, '%')
- </if>
- <if test=" phone!= null and phone != ''">
- AND contacts.phone LIKE CONCAT('%', #{phone}, '%')
- </if>
- <if test=" status!= null ">
- AND task.status = #{status}
- </if>
- <if test=" executorName!= null and executorName != '' ">
- AND te.executor_name LIKE CONCAT('%', #{executorName}, '%')
- </if>
- <if test=" startDate!= null">
- AND task.start_date > #{startDate}
- </if>
- <if test=" endDate!= null">
- AND task.end_date < #{endDate}
- </if>
- <if test=" companyId!= null ">
- AND task.company_id = #{companyId}
- </if>
- <if test=" departmentId!= null " >
- AND task_executor.task_id in ( SELECT DISTINCT te.task_id FROM task_executor te
- LEFT JOIN `user` u ON u.id=te.executor_id
- where u.department_id = #{departmentId} )
- </if>
- <if test=" departmentIdByMyselfOrNull!= null and departmentIdByMyselfOrNull != '' " >
- AND task_executor.task_id in ( SELECT DISTINCT te.task_id FROM task_executor te
- where te.executor_id= #{departmentIdByMyselfOrNull } or te.executor_id is null )
- </if>
- </where>
- order by task.create_date desc
- <if test="pageIndex != null and pageSize != null">
- LIMIT #{pageIndex}, #{pageSize}
- </if>
- </select>
- <select id="getPageListTotalTask" resultMap="TaskVoMap">
- select DISTINCT task.id
- from task
- left join custom on task.custom_id=custom.id
- left join business_opportunity on task.business_opportunity_id=business_opportunity.id
- left join `sales_order` on task.order_id=`sales_order`.id
- left join clue on task.clue_id=clue.id
- left join contacts on task.contacts_id=contacts.id
- <if test=" executorName!= null and executorName != '' " >
- inner join task_executor te on task.id=te.task_id
- </if>
- <if test=" departmentId!= null " >
- inner join task_executor on task.id=task_executor.task_id
- </if>
- <if test=" departmentIdByMyselfOrNull!= null and departmentIdByMyselfOrNull != '' " >
- inner join task_executor on task.id=task_executor.task_id
- </if>
- <where>
- and 1=1 and task.is_delete=0
- <if test=" taskName!= null and taskName != ''">
- AND task.task_name LIKE CONCAT('%', #{taskName}, '%')
- </if>
- <if test=" priority!= null ">
- AND task.priority =#{priority}
- </if>
- <if test=" customName!= null and customName != ''">
- AND custom.custom_name LIKE CONCAT('%', #{customName}, '%')
- </if>
- <if test=" contactsName!= null and contactsName != ''">
- AND contacts.name LIKE CONCAT('%', #{contactsName}, '%')
- </if>
- <if test=" businessName!= null and businessName != ''">
- AND business_opportunity.name LIKE CONCAT('%', #{businessName}, '%')
- </if>
- <if test=" orderName!= null and orderName != ''">
- AND `sales_order`.order_name LIKE CONCAT('%', #{orderName}, '%')
- </if>
- <if test=" clueName!= null and clueName != ''">
- AND clue.clue_name LIKE CONCAT('%', #{clueName}, '%')
- </if>
- <if test=" phone!= null and phone != ''">
- AND contacts.phone LIKE CONCAT('%', #{phone}, '%')
- </if>
- <if test=" status!= null ">
- AND task.status = #{status}
- </if>
- <if test=" executorName!= null and executorName != '' ">
- AND te.executor_name LIKE CONCAT('%', #{executorName}, '%')
- </if>
- <if test=" startDate!= null ">
- AND task.start_date > #{startDate}
- </if>
- <if test=" endDate!= null ">
- AND task.end_date < #{endDate}
- </if>
- <if test=" companyId!= null ">
- AND task.company_id = #{companyId}
- </if>
- <if test=" departmentId!= null " >
- AND task_executor.task_id in ( SELECT DISTINCT te.task_id FROM task_executor te
- LEFT JOIN `user` u ON u.id=te.executor_id
- where u.department_id = #{departmentId} )
- </if>
- <if test=" departmentIdByMyselfOrNull!= null and departmentIdByMyselfOrNull != '' " >
- AND task_executor.task_id in ( SELECT DISTINCT te.task_id FROM task_executor te
- where te.executor_id= #{departmentIdByMyselfOrNull} or te.executor_id is null )
- </if>
- </where>
- </select>
- <select id="getListByTaskIds" resultType="com.management.platform.entity.vo.TasKVo">
- select task.* ,
- custom.custom_name,
- business_opportunity.name businessName,
- `sales_order`.order_name ,
- clue.clue_name,
- contacts.name contacts_name ,contacts.phone
- from task
- left join custom on task.custom_id=custom.id
- left join business_opportunity on task.business_opportunity_id=business_opportunity.id
- left join `sales_order` on task.order_id=`sales_order`.id
- left join clue on task.clue_id=clue.id
- left join contacts on task.contacts_id=contacts.id
- WHERE task.id IN
- <foreach item="taskId" collection="taskIdArray" open="(" separator="," close=")">
- #{taskId}
- </foreach>
- </select>
- <select id="getPageListTaskByPin" resultMap="TaskPinVoMap">
- select DISTINCT task.* ,
- custom.custom_name,
- business_opportunity.name businessName,
- `sales_order`.order_name ,
- clue.clue_name,
- contacts.name contacts_name ,contacts.phone contacts_phone
- from task
- left join custom on task.custom_id=custom.id
- left join business_opportunity on task.business_opportunity_id=business_opportunity.id
- left join `sales_order` on task.order_id=`sales_order`.id
- left join clue on task.clue_id=clue.id
- left join contacts on task.contacts_id=contacts.id
- <if test=" executorName!= null and executorName != '' " >
- inner join task_executor te on task.id=te.task_id
- </if>
- <if test=" departmentId!= null " >
- inner join task_executor on task.id=task_executor.task_id
- </if>
- <if test=" departmentIdByMyselfOrNull!= null and departmentIdByMyselfOrNull != '' " >
- inner join task_executor on task.id=task_executor.task_id
- </if>
- <where>
- and 1=1 and task.is_delete=0
- <if test=" taskName!= null and taskName != ''">
- AND task.task_name LIKE CONCAT('%', #{taskName}, '%')
- </if>
- <if test=" priority!= null ">
- AND task.priority =#{priority}
- </if>
- <if test=" customName!= null and customName != ''">
- AND custom.custom_name LIKE CONCAT('%', #{customName}, '%')
- </if>
- <if test=" contactsName!= null and contactsName != ''">
- AND contacts.name LIKE CONCAT('%', #{contactsName}, '%')
- </if>
- <if test=" businessName!= null and businessName != ''">
- AND business_opportunity.name LIKE CONCAT('%', #{businessName}, '%')
- </if>
- <if test=" orderName!= null and orderName != ''">
- AND `sales_order`.order_name LIKE CONCAT('%', #{orderName}, '%')
- </if>
- <if test=" clueName!= null and clueName != ''">
- AND clue.clue_name LIKE CONCAT('%', #{clueName}, '%')
- </if>
- <if test=" phone!= null and phone != ''">
- AND contacts.phone LIKE CONCAT('%', #{phone}, '%')
- </if>
- <if test=" status!= null ">
- AND task.status = #{status}
- </if>
- <if test=" executorName!= null and executorName != '' ">
- AND te.executor_name LIKE CONCAT('%', #{executorName}, '%')
- </if>
- <if test=" startDate!= null">
- AND task.start_date > #{startDate}
- </if>
- <if test=" endDate!= null">
- AND task.end_date < #{endDate}
- </if>
- <if test=" companyId!= null ">
- AND task.company_id = #{companyId}
- </if>
- <if test=" departmentId!= null " >
- AND task_executor.task_id in ( SELECT DISTINCT te.task_id FROM task_executor te
- LEFT JOIN `user` u ON u.id=te.executor_id
- where u.department_id = #{departmentId} )
- </if>
- <if test=" departmentIdByMyselfOrNull!= null and departmentIdByMyselfOrNull != '' " >
- AND task_executor.task_id in ( SELECT DISTINCT te.task_id FROM task_executor te
- where te.executor_id= #{departmentIdByMyselfOrNull } or te.executor_id is null )
- </if>
- </where>
- order by task.need_pin desc,task.pin_time desc,task.create_date desc
- <if test="pageIndex != null and pageSize != null">
- LIMIT #{pageIndex}, #{pageSize}
- </if>
- </select>
- <update id="updateRepeatConfig">
- update task
- <set>
- repeat_type=#{repeatType},repeat_end_never=#{repeatEndNever},repeat_end_count=#{repeatEndCount},
- repeat_end_date=#{repeatEndDate},repeat_design_day=#{repeatDesignDay},repeat_design_sameday=#{repeatDesignSameday},
- custom_id=#{customId},business_opportunity_id=#{businessOpportunityId},order_id=#{orderId},clue_id=#{clueId},contacts_id=#{contactsId}
- </set>
- where id=#{id}
- </update>
- </mapper>
|