EntmicroAuthorizeMapper.xml 4.18 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.EntmicroAuthorizeMapper">
    <resultMap id="BaseResultMap" type="cn.com.glsx.entmicro.entity.EntmicroAuthorize">
        <!--
          WARNING - @mbg.generated
        -->
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="merchant_id" jdbcType="INTEGER" property="merchantId"/>
        <result column="entmicro_name" jdbcType="VARCHAR" property="entmicroName"/>
        <result column="entmicro_id" jdbcType="VARCHAR" property="entmicroId"/>
        <result column="entid_bef_encryption" jdbcType="VARCHAR" property="entidBefEncryption"/>
        <result column="access_scrm_flag" jdbcType="VARCHAR" property="accessScrmFlag"/>
    </resultMap>
    <sql id="Base_Column_List">
        <!--
          WARNING - @mbg.generated
        -->
        id, merchant_id, entmicro_name, entmicro_id
    </sql>
    <select id="findEntmicroId" resultType="java.lang.String">
      SELECT entmicro_id FROM entmicro_authorize WHERE merchant_id=#{merchantNo}
      GROUP BY merchant_id
    </select>

    <select id="findEntmicroName" resultType="java.lang.String">
      SELECT entmicro_name FROM entmicro_authorize WHERE merchant_id=#{merchantNo}
      GROUP BY merchant_id
    </select>

    <select id="findAllAuthMerchant" resultType="java.lang.Integer">
         SELECT merchant_id FROM entmicro_authorize group by merchant_id
    </select>

    <select id="selectEntmicroAuthorizeByMerchantName" resultMap="BaseResultMap">
        SELECT ea.merchant_id,ea.entmicro_name FROM entmicro_authorize ea
        WHERE entid_bef_encryption is not null
        <if test="merchantName != null and merchantName != ''">
            and ea.entmicro_name like '%${merchantName}%'
        </if>
        <if test="excludeList != null and excludeList.size > 0">
            and ea.merchant_id not in
            <foreach collection="excludeList" index="index" open="(" close=")" separator="," item="id">
                #{id}
            </foreach>
        </if>
        group by merchant_id
    </select>

    <select id="findByCondition" resultMap="BaseResultMap">
        select * from entmicro_authorize
        where
        <choose>
            <when test="loginCallBackModel.corpFullName != null and loginCallBackModel.corpFullName != ''">
                entmicro_name=#{loginCallBackModel.corpFullName}
                <if test="loginCallBackModel.corpShortName != null and loginCallBackModel.corpShortName != ''">
                    OR entmicro_name=#{loginCallBackModel.corpShortName}
                </if>
            </when>
            <otherwise>
                <if test="loginCallBackModel.corpShortName != null and loginCallBackModel.corpShortName != ''">
                    entmicro_name=#{loginCallBackModel.corpShortName}
                </if>
            </otherwise>
        </choose>
    </select>

    <select id="findEntmicroEntmicroId" resultMap="BaseResultMap">
             select * from entmicro_authorize
        where merchant_id=#{merchantNo} limit 1
    </select>

    <select id="selectSubscribeMerchantPage"
            resultType="cn.com.glsx.entmicro.model.response.subscribe.SubscribeMerchantResponse">
        SELECT ea.merchant_id merchantId,ea.entmicro_name merchantName
        FROM entmicro_authorize ea
        left join scrm_subscribe_merchant ssm on ea.merchant_id = ssm.merchant_id and ssm.del_flag = 0
        WHERE ssm.id is null
        <if test="includeList != null and includeList.size > 0">
            and ea.merchant_id in
            <foreach collection="includeList" index="index" open="(" close=")" separator="," item="id">
                #{id}
            </foreach>
        </if>
        <if test="excludeList != null and excludeList.size > 0">
            and ea.merchant_id not in
            <foreach collection="excludeList" index="index" open="(" close=")" separator="," item="id">
                #{id}
            </foreach>
        </if>
        <if test="selectMerchantId != null">
            and ea.merchant_id = #{selectMerchantId}
        </if>
        group by ea.merchant_id
    </select>
</mapper>