MerchantWechatAuthMapper.xml 2.15 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.dj.wechat.mapper.MerchantWechatAuthMapper">
  <resultMap id="BaseResultMap" type="cn.com.glsx.dj.wechat.model.MerchantWechatAuth">
    <id column="ID" jdbcType="INTEGER" property="id" />
    <result column="MERCHANT_ID" jdbcType="INTEGER" property="merchantId" />
    <result column="BIZ_APP_ID" jdbcType="VARCHAR" property="bizAppId" />
    <result column="WE_APP_ID" jdbcType="VARCHAR" property="weAppId" />
    <result column="AUTH_STATUS" jdbcType="SMALLINT" property="authStatus" />
    <result column="REMARK" jdbcType="VARCHAR" property="remark" />
    <result column="CREATED_BY" jdbcType="VARCHAR" property="createdBy" />
    <result column="CREATED_DATE" jdbcType="TIMESTAMP" property="createdDate" />
    <result column="UPDATED_BY" jdbcType="VARCHAR" property="updatedBy" />
    <result column="UPDATED_DATE" jdbcType="TIMESTAMP" property="updatedDate" />
    <result column="DELETED_FLAG" jdbcType="CHAR" property="deletedFlag" />
  </resultMap>
  <sql id="Base_Column_List">
    ID, MERCHANT_ID, BIZ_APP_ID, WE_APP_ID, AUTH_STATUS, REMARK, CREATED_BY, CREATED_DATE, 
    UPDATED_BY, UPDATED_DATE, DELETED_FLAG
  </sql>
  
  <sql id="get_wechat_auth_merchant_sql">
  	select 
  		mwa.merchant_id merchantId,
  		sm.merchant_name merchantName,
  		mwa.we_app_id weappId,
  		wbi.nickname weappName
  	from 
  		dj_merchant_wechat_auth mwa
  	left join
  		dj_system_merchant sm
  	on
  		mwa.merchant_id = sm.merchant_id
  	left join
  		dj_weapp_base_info wbi
  	on
  		mwa.we_app_id = wbi.app_id
  	where mwa.deleted_flag = 'N'
  </sql>
  
  <select id="getAll" resultType="cn.com.glsx.dj.wechat.dto.WechatAuthMerchantDTO">
  	<include refid="get_wechat_auth_merchant_sql" />
  	and mwa.we_app_id is not null
  </select>
  
  <select id="getByAppId" resultType="cn.com.glsx.dj.wechat.dto.WechatAuthMerchantDTO" parameterType="java.lang.String">
  	<include refid="get_wechat_auth_merchant_sql" />
	and mwa.we_app_id = #{appId}
	and wbi.nickname is not null
	and sm.merchant_name is not null
  </select>
</mapper>