DracStaffScrmWorkCustomerMapper.xml 3.06 KB
<?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="cn.com.glsx.entmicro.mapper.DracStaffScrmWorkCustomerMapper">
    <resultMap id="BaseResultMap" type="cn.com.glsx.entmicro.entity.DracStaffScrmWorkCustomer">
        <!--
          WARNING - @mbg.generated
        -->
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="work_relation_id" jdbcType="INTEGER" property="workRelationId"/>
        <result column="customer_id" jdbcType="INTEGER" property="customerId"/>
        <result column="customer_name" jdbcType="VARCHAR" property="customerName"/>
        <result column="customer_phone" jdbcType="VARCHAR" property="customerPhone"/>
        <result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
        <result column="created_by" jdbcType="INTEGER" property="createdBy"/>
        <result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
        <result column="updated_by" jdbcType="INTEGER" property="updatedBy"/>
        <result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime"/>
    </resultMap>
    <sql id="Base_Column_List">
        <!--
          WARNING - @mbg.generated
        -->
        id, work_relation_id, customer_id, customer_name, customer_phone, del_flag, created_by,
        created_time, updated_by, updated_time
    </sql>
    <update id="updateCustomerById">
        update drac_staff_scrm_work_customer set
        task_status=2,
        updated_time=now()
        where customer_id=#{id}
    </update>
    <update id="updateCustomerWork">
       update drac_staff_scrm_work_customer set
        task_status=1,
        updated_time=now()
        where customer_id=#{customerId}
    </update>
    <select id="findTaskingCustomer" resultType="cn.com.glsx.entmicro.entity.DracStaffScrmWorkCustomer">
        select t1.customer_phone as customerPhone,t1.customer_id as customerId from drac_staff_scrm_work_customer t1
        left join drac_staff_scrm_work_follow t2 on t1.work_relation_id=t2.id
        left join drac_staff_scrm_work t3 on t2.work_id=t3.id
        where t3.work_type=#{status} and t1.task_status!=2
        and t3.merchant_Id=#{merchantId}
    </select>
    <select id="findTaskingByContion" resultType="cn.com.glsx.entmicro.entity.DracStaffScrmWorkCustomer">
        select t3.work_relation_id as workRelationId,t1.work_uid as imUUid,t2.staff_id as staffId from
        drac_staff_scrm_work t1
        left join drac_staff_scrm_work_follow t2 on t1.id=t2.work_id
        left join drac_staff_scrm_work_customer t3 on t2.id=t3.work_relation_id
        where t1.merchant_Id in
        <foreach collection="merchantId" open="(" separator="," close=")" item="item">
            #{item}
        </foreach>
        and t3.customer_id=#{customerId}
        group by t1.id
    </select>


    <select id="findTaskingCustomerCount" resultType="java.lang.Integer">
        SELECT COUNT(1) from drac_staff_scrm_work_customer WHERE  work_relation_id=#{workRelationId}  AND task_status!=2
    </select>
</mapper>