MassMapper.xml 4.24 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.MassMapper">
  <resultMap id="BaseResultMap" type="cn.com.glsx.entmicro.entity.Mass">
    <!--@Table scrm_mass-->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="uuid" jdbcType="VARCHAR" property="uuid" />
    <result column="type" jdbcType="TINYINT" property="type" />
    <result column="select_type" jdbcType="TINYINT" property="selectType" />
    <result column="send_type" jdbcType="TINYINT" property="sendType" />
    <result column="mass_name" jdbcType="VARCHAR" property="massName" />
    <!--<result column="send_user_num" jdbcType="INTEGER" property="sendUserNum" />
    <result column="unsend_user_num" jdbcType="INTEGER" property="unsendUserNum" />
    <result column="send_customer_num" jdbcType="INTEGER" property="sendCustomerNum" />
    <result column="unsend_customer_num" jdbcType="INTEGER" property="unsendCustomerNum" />
    <result column="send_fail_num" jdbcType="INTEGER" property="sendFailNum" />-->
    <result column="crowd_funding" jdbcType="BOOLEAN" property="crowdFunding" />
    <result column="send_time" jdbcType="TIMESTAMP" property="sendTime" />
    <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" />
    <result column="remind_time" jdbcType="TIMESTAMP" property="remindTime" />
    <result column="is_remind" jdbcType="TINYINT" property="isRemind" />
    <result column="status" jdbcType="TINYINT" property="status" />
    <result column="del_flag" jdbcType="TINYINT" property="delFlag" />
    <result column="merchant_id" jdbcType="INTEGER" property="merchantId" />
  </resultMap>
  <resultMap id="ResultMap" type="cn.com.glsx.entmicro.model.response.MassResponse"
        extends="BaseResultMap">
  </resultMap>

  <sql id="Base_Column_List">
    id,crowd_funding, uuid, `type`, select_type, send_type, mass_name, send_time, created_by,
    created_time, updated_by, updated_time, is_remind, remind_time, `status`, del_flag, merchant_id
  </sql>

  <select id="selectByCondition" resultMap="ResultMap" parameterType="cn.com.glsx.entmicro.model.request.MassRequest">
    select <include refid="Base_Column_List" /> from scrm_mass
    where 1 = 1 and merchant_id = #{obj.merchantId}
    <if test="obj.massName != null and obj.massName != ''">
        and mass_name like CONCAT('%',#{obj.massName,jdbcType=VARCHAR},'%')
    </if>
    <if test="obj.selectType != null">
        and select_type = #{obj.selectType,jdbcType=TINYINT}
    </if>
    <if test="obj.sendType != null">
        and send_type = #{obj.sendType,jdbcType=TINYINT}
    </if>
    <if test="obj.type != null">
        and type = #{obj.type,jdbcType=TINYINT}
    </if>
    order by created_time desc
  </select>

  <select id="getMassDetailSendResultJobList" resultType="cn.com.glsx.entmicro.entity.mass.MassDetailQyMsgSendResultEntity">
    SELECT b.id,b.`uuid`,b.merchant_id AS merchantId,b.type AS massType,a.`id` AS staffRelationId,a.`staff_id` AS staffId,a.`msg_id` AS msgId
    FROM `scrm_mass_detail_staff` a,`scrm_mass` b
    WHERE a.`mass_id`=b.id AND a.`status`=0 AND a.`msg_id` IS NOT NULL
  </select>
  <select id="getMassDetailSendResultByMassId"
          resultType="cn.com.glsx.entmicro.entity.mass.MassDetailQyMsgSendResultEntity">
    SELECT b.id,b.`uuid`,b.merchant_id AS merchantId,b.type AS massType,a.`id` AS staffRelationId,a.`staff_id` AS staffId,a.`msg_id` AS msgId
    FROM `scrm_mass_detail_staff` a,`scrm_mass` b
    WHERE a.`mass_id`=b.id AND b.id=#{massId}
  </select>
  <select id="getMassDetailSendResultJobListByMerchantId"
          resultType="cn.com.glsx.entmicro.entity.mass.MassDetailQyMsgSendResultEntity">
    SELECT b.id,b.`uuid`,b.merchant_id AS merchantId,b.type AS massType,a.`id` AS staffRelationId,a.`staff_id` AS staffId,a.`msg_id` AS msgId
    FROM `scrm_mass_detail_staff` a,`scrm_mass` b
    WHERE a.`mass_id`=b.id AND merchant_id =#{merchantId} AND a.`status`=0 AND a.`msg_id` IS NOT NULL
  </select>

</mapper>