OperationConfigMapper.xml 5.01 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.OperationConfigMapper">
    <resultMap id="BaseResultMap" type="cn.com.glsx.entmicro.entity.OperationConfig">
        <!--
          WARNING - @mbg.generated
        -->
        <result column="id" jdbcType="INTEGER" property="id"/>
        <result column="merchant_id" jdbcType="INTEGER" property="merchantId"/>
        <result column="staff_id" jdbcType="INTEGER" property="staffId"/>
        <result column="business_type" jdbcType="VARCHAR" property="businessType"/>
        <result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
        <result column="status" jdbcType="VARCHAR" property="status"/>
        <result column="updated_time" jdbcType="VARCHAR" property="updatedTime"/>
        <result column="updated_by" jdbcType="TIMESTAMP" property="updatedBy"/>
        <result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
        <result column="created_by" jdbcType="VARCHAR" property="createdBy"/>
    </resultMap>

    <resultMap id="operationListMap" type="cn.com.glsx.entmicro.model.response.operation.OperationListRpcResponse">
        <result column="id" jdbcType="INTEGER" property="id"/>
        <result column="state_id" jdbcType="VARCHAR" property="stateId"/>
        <result column="staff_name" jdbcType="INTEGER" property="staffName"/>
        <result column="business_type" jdbcType="VARCHAR" property="businessType"/>
        <result column="status" jdbcType="VARCHAR" property="status"/>
        <result column="department_name" jdbcType="VARCHAR" property="departmentName"/>
        <result column="business_uuid" jdbcType="VARCHAR" property="businessUuid"/>
        <result column="qr_code" jdbcType="VARCHAR" property="qrCode"/>
        <result column="config_id" jdbcType="VARCHAR" property="configId"/>
        <result column="expert_type" jdbcType="INTEGER" property="expertType"/>
        <result column="merchant_id" jdbcType="INTEGER" property="merchantId"/>
    </resultMap>

    <resultMap id="operationDetailMap" type="cn.com.glsx.entmicro.model.response.operation.OperationDetailRpcResponse">
      <result column="id" jdbcType="INTEGER" property="id"/>
      <result column="state_id" jdbcType="VARCHAR" property="stateId"/>
      <result column="staff_name" jdbcType="INTEGER" property="staffName"/>
      <result column="business_type" jdbcType="VARCHAR" property="businessType"/>
      <result column="status" jdbcType="VARCHAR" property="status"/>
      <result column="department_name" jdbcType="VARCHAR" property="departmentName"/>
    </resultMap>

    <!--删除运营配置-->
    <update id="deleteOperationConfig">
     update scrm_operation_config
     set del_flag = -1,
            updated_time = now()
     where id = #{id}
  </update>

  <!--轻改运营配置详情-->
    <select id="getDetail" resultType="cn.com.glsx.entmicro.model.response.operation.OperationDetailRpcResponse">
        select soc.id,
            soc.state_id stateId,
            soc.status status,
            soc.business_type businessType,
            soc.staff_id staffId,
            soc.business_uuid businessUuid,
            GROUP_CONCAT(DISTINCT ed.department_name) departmentName,
            es.staff_name staffName,
            soc.qr_code qrCode,
	        soc.config_id configId,
	        soc.expert_type expertType,
	        soc.merchant_id merchantId
         from scrm_operation_config soc
         left join entmicro_staff es on soc.staff_id = es.id
         LEFT JOIN `entmicro_staff_depart_relation` esdr ON es.id = esdr.staff_id
         LEFT JOIN entmicro_department ed ON esdr.department_id = ed.id
        where soc.id = #{id}
        group by soc.id
    </select>

    <!--分页列表-->
    <select id="getPageList" resultMap="operationListMap">
    SELECT soc.id,
        soc.state_id,
        soc.status,
        soc.business_type,
	    es.staff_name,
	    soc.business_uuid,
	    GROUP_CONCAT(DISTINCT ed.department_name) department_name,
	    -1 isWelcomeWord,
	    soc.qr_code,
	    soc.config_id,
	    soc.expert_type,
	    soc.merchant_id
	FROM `scrm_operation_config` soc
        LEFT JOIN entmicro_staff es ON soc.staff_id = es.id
        LEFT JOIN `entmicro_staff_depart_relation` esdr ON es.id = esdr.staff_id
        LEFT JOIN entmicro_department ed ON esdr.department_id = ed.id
    WHERE
        soc.del_flag = 0
    <if test="departmentId != null and departmentId != ''">
        and ed.id = #{departmentId}
    </if>
    <if test="staffName != null and staffName != ''">
        AND es.staff_name LIKE concat('%',#{staffName},'%')
    </if>
    <if test="businessType != null">
        AND soc.business_type = #{businessType}
    </if>
    <if test="merchant != null">
        and soc.merchant_id  = #{merchant}
    </if>
        <if test="staffId != null">
            and soc.staff_id  = #{staffId}
        </if>
        and soc.created_by = #{merchantId}
    GROUP BY soc.id
    ORDER BY soc.created_time DESC
    </select>
</mapper>