MassDetailStaffMapper.xml 2.51 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.MassDetailStaffMapper">
  <resultMap id="BaseResultMap" type="cn.com.glsx.entmicro.entity.MassDetailStaff">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="mass_id" jdbcType="INTEGER" property="massId" />
    <result column="user_id" jdbcType="VARCHAR" property="userId" />
    <result column="customer_num" jdbcType="INTEGER" property="customerNum" />
    <result column="status" jdbcType="INTEGER" property="status" />
    <result column="send_time" jdbcType="TIMESTAMP" property="sendTime" />
    <result column="del_flag" jdbcType="TINYINT" property="delFlag" />
    <result column="msg_id" jdbcType="VARCHAR" property="msgId" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
    -->
    id, mass_id, user_id, customer_num, `status`, send_time, del_flag, msg_id
  </sql>

  <select id="countStaffSender" resultType="cn.com.glsx.entmicro.entity.mass.MassStatisticItemEntity">
    SELECT COUNT(*) AS dataCount,`status` as dataType FROM `scrm_mass_detail_staff`
    <where>
      mass_id=#{massId}
      GROUP BY `status`
    </where>
  </select>

  <select id="getStaffCustomerCount" resultType="cn.com.glsx.entmicro.entity.mass.MassStatisticItemEntity">
    SELECT COUNT(*) AS dataCount,a.`staff_id` AS dataType
    FROM `scrm_mass_detail_staff` a,`scrm_mass_detail_customer` b
    <where>
      a.`id`=b.`staff_relation_id` AND a.`mass_id`=#{massId}
      <if test="status!=null">
        and a.`status` = #{status}
      </if>
      GROUP BY a.`staff_id`
    </where>
  </select>
    <select id="getSucessStaffListByMass" resultType="java.lang.Integer">
      SELECT s.`staff_id` FROM `scrm_mass_detail_staff` s WHERE s.`mass_id`=#{massId} AND s.`status` IN (0,1) AND s.`del_flag`=0
    </select>
  <select id="selectMassStaffDetail"
          resultType="cn.com.glsx.entmicro.model.response.MassStaffSendStatusResponse" parameterType="cn.com.glsx.entmicro.model.request.mass.MassStaffDetailListRpcRequest">
    SELECT s.mass_id massId,s.`staff_id` staffId,s.`status` staffStatus,s.`send_time` sendTime,
    s.`del_flag` delFlag,s.`msg_id` msgId,m.`status` massStatus
    FROM `scrm_mass_detail_staff` s
    LEFT JOIN `scrm_mass` m ON m.`id`=s.`mass_id`
    WHERE s.`mass_id`=#{request.massId} AND s.`staff_id`= #{request.staffId}
  </select>

</mapper>