1246 lines
41 KiB
XML
1246 lines
41 KiB
XML
<?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.pluss.platform.mapper.MerchantMenberMapper">
|
|
|
|
<insert id="saveMerchantMenber" parameterType="cn.pluss.platform.entity.MerchantMenber" keyProperty="id" useGeneratedKeys="true">
|
|
insert into tb_pluss_merchant_menber(merchantCode,merchantName,storeId,storeName,status,createDt,logo,memberCode,nickName,phone,openid,alipayUserId,comsumeMoney,profitMoney,orderNumber,totalRechargeFee,usableRechargeFee,totalGiveFee,usableGiveFee,cardNo,birthdayDt,memberName,provinces,sex,bindingUrl,appOpenId,unionId)VALUES(#{merchantCode},#{merchantName},#{storeId},#{storeName},#{status},now(),#{logo},#{memberCode},#{nickName},#{phone},#{openid},#{alipayUserId},#{comsumeMoney},#{profitMoney},#{orderNumber},#{totalRechargeFee},#{usableRechargeFee},#{totalGiveFee},#{usableGiveFee},#{cardNo},#{birthdayDt},#{memberName},#{provinces},#{sex},#{bindingUrl},#{appOpenId},#{unionId})
|
|
</insert>
|
|
|
|
<insert id="saveMerchantMenberBatch">
|
|
insert into tb_pluss_merchant_menber(merchantCode,merchantName,storeId,storeName,status,createDt,logo,memberCode,nickName,phone,openid,alipayUserId,comsumeMoney,profitMoney,orderNumber,totalRechargeFee,usableRechargeFee,totalGiveFee,usableGiveFee) VALUES
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
(#{merchantCode},#{merchantName},#{storeId},#{storeName},#{status},#{createDt},#{logo},#{memberCode},#{nickName},#{phone},#{openid},#{alipayUserId},#{comsumeMoney},#{profitMoney},#{orderNumber},#{totalRechargeFee},#{usableRechargeFee},#{totalGiveFee},#{usableGiveFee} )
|
|
</foreach>
|
|
</insert>
|
|
|
|
<select id="queryMerchantMenber" parameterType="cn.pluss.platform.entity.MerchantMenber" resultType="cn.pluss.platform.entity.MerchantMenber">
|
|
SELECT * from tb_pluss_merchant_menber
|
|
<where>
|
|
<if test="id!= null">
|
|
and id = #{id}
|
|
</if>
|
|
<if test="nickName== null">
|
|
and nickName !='null'
|
|
</if>
|
|
<if test="merchantCode!= null">
|
|
and merchantCode = #{merchantCode}
|
|
</if>
|
|
<if test="merchantName!= null">
|
|
and merchantName = #{merchantName}
|
|
</if>
|
|
<if test="storeId!= null">
|
|
and storeId = #{storeId}
|
|
</if>
|
|
<if test="storeName!= null">
|
|
and storeName = #{storeName}
|
|
</if>
|
|
<if test="status!= null">
|
|
and status = #{status}
|
|
</if>
|
|
<if test="createDt!= null">
|
|
and createDt = #{createDt}
|
|
</if>
|
|
<if test="logo!= null">
|
|
and logo = #{logo}
|
|
</if>
|
|
<if test="memberCode!= null">
|
|
and memberCode = #{memberCode}
|
|
</if>
|
|
<if test="nickName!= null">
|
|
and nickName = #{nickName}
|
|
</if>
|
|
<if test="phone!= null">
|
|
and phone = #{phone}
|
|
</if>
|
|
<if test="openid!= null">
|
|
and openid = #{openid}
|
|
</if>
|
|
<if test="alipayUserId!= null">
|
|
and alipayUserId = #{alipayUserId}
|
|
</if>
|
|
<if test="comsumeMoney!= null">
|
|
and comsumeMoney = #{comsumeMoney}
|
|
</if>
|
|
<if test="profitMoney!= null">
|
|
and profitMoney = #{profitMoney}
|
|
</if>
|
|
<if test="orderNumber!= null">
|
|
and orderNumber = #{orderNumber}
|
|
</if>
|
|
<if test="totalRechargeFee!= null">
|
|
and totalRechargeFee = #{totalRechargeFee}
|
|
</if>
|
|
<if test="usableRechargeFee!= null">
|
|
and usableRechargeFee = #{usableRechargeFee}
|
|
</if>
|
|
<if test="totalGiveFee!= null">
|
|
and totalGiveFee = #{totalGiveFee}
|
|
</if>
|
|
<if test="usableGiveFee!= null">
|
|
and usableGiveFee = #{usableGiveFee}
|
|
</if>
|
|
<if test="cardNo!= null">
|
|
and cardNo = #{cardNo}
|
|
</if>
|
|
<if test="birthdayDt!= null">
|
|
and birthdayDt = #{birthdayDt}
|
|
</if>
|
|
<if test="memberName!= null">
|
|
and memberName = #{memberName}
|
|
</if>
|
|
<if test="provinces!= null">
|
|
and provinces = #{provinces}
|
|
</if>
|
|
<if test="sex!= null">
|
|
and sex = #{sex}
|
|
</if>
|
|
<if test="bindingUrl!= null">
|
|
and bindingUrl = #{bindingUrl}
|
|
</if>
|
|
<if test="appOpenId != null">
|
|
and appOpenId = #{appOpenId}
|
|
</if>
|
|
<if test="unionId != null">
|
|
and unionId = #{unionId}
|
|
</if>
|
|
|
|
</where>
|
|
</select>
|
|
|
|
<select id="queryMerchantMenberList" parameterType="cn.pluss.platform.entity.MerchantMenber" resultType="cn.pluss.platform.entity.MerchantMenber">
|
|
SELECT * from tb_pluss_merchant_menber
|
|
<where>
|
|
<if test="id!= null">
|
|
and id = #{id}
|
|
</if>
|
|
<if test="nickName== null">
|
|
and nickName !='null'
|
|
</if>
|
|
<if test="merchantCode!= null">
|
|
and merchantCode = #{merchantCode}
|
|
</if>
|
|
<if test="merchantName!= null">
|
|
and merchantName = #{merchantName}
|
|
</if>
|
|
<if test="storeId!= null">
|
|
and storeId = #{storeId}
|
|
</if>
|
|
<if test="storeName!= null">
|
|
and storeName = #{storeName}
|
|
</if>
|
|
<if test="status!= null">
|
|
and status = #{status}
|
|
</if>
|
|
<if test="createDt!= null">
|
|
and createDt = #{createDt}
|
|
</if>
|
|
<if test="logo!= null">
|
|
and logo = #{logo}
|
|
</if>
|
|
<if test="memberCode!= null">
|
|
and memberCode = #{memberCode}
|
|
</if>
|
|
<if test="nickName!= null">
|
|
and nickName = #{nickName}
|
|
</if>
|
|
<if test="phone!= null">
|
|
and phone = #{phone}
|
|
</if>
|
|
<if test="openid!= null">
|
|
and openid = #{openid}
|
|
</if>
|
|
<if test="alipayUserId!= null">
|
|
and alipayUserId = #{alipayUserId}
|
|
</if>
|
|
<if test="comsumeMoney!= null">
|
|
and comsumeMoney = #{comsumeMoney}
|
|
</if>
|
|
<if test="profitMoney!= null">
|
|
and profitMoney = #{profitMoney}
|
|
</if>
|
|
<if test="orderNumber!= null">
|
|
and orderNumber = #{orderNumber}
|
|
</if>
|
|
<if test="totalRechargeFee!= null">
|
|
and totalRechargeFee = #{totalRechargeFee}
|
|
</if>
|
|
<if test="usableRechargeFee!= null">
|
|
and usableRechargeFee = #{usableRechargeFee}
|
|
</if>
|
|
<if test="totalGiveFee!= null">
|
|
and totalGiveFee = #{totalGiveFee}
|
|
</if>
|
|
<if test="usableGiveFee!= null">
|
|
and usableGiveFee = #{usableGiveFee}
|
|
</if>
|
|
<if test="cardNo!= null">
|
|
and cardNo = #{cardNo}
|
|
</if>
|
|
<if test="birthdayDt!= null">
|
|
and birthdayDt = #{birthdayDt}
|
|
</if>
|
|
<if test="memberName!= null">
|
|
and memberName = #{memberName}
|
|
</if>
|
|
<if test="provinces!= null">
|
|
and provinces = #{provinces}
|
|
</if>
|
|
<if test="sex!= null">
|
|
and sex = #{sex}
|
|
</if>
|
|
<if test="bindingUrl!= null">
|
|
and bindingUrl = #{bindingUrl}
|
|
</if>
|
|
<if test="appOpenId!= null">
|
|
and appOpenId = #{appOpenId}
|
|
</if>
|
|
<if test="unionId!= null">
|
|
and unionId = #{unionId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<update id="updateMerchantMenber" parameterType="cn.pluss.platform.entity.MerchantMenber" >
|
|
update tb_pluss_merchant_menber
|
|
<set>
|
|
<if test="merchantCode!= null">
|
|
merchantCode = #{merchantCode},
|
|
</if>
|
|
<if test="merchantName!= null">
|
|
merchantName = #{merchantName},
|
|
</if>
|
|
<if test="storeId!= null">
|
|
storeId = #{storeId},
|
|
</if>
|
|
<if test="storeName!= null">
|
|
storeName = #{storeName},
|
|
</if>
|
|
<if test="status!= null">
|
|
status = #{status},
|
|
</if>
|
|
<if test="createDt!= null">
|
|
createDt = #{createDt},
|
|
</if>
|
|
<if test="logo!= null">
|
|
logo = #{logo},
|
|
</if>
|
|
<if test="memberCode!= null">
|
|
memberCode = #{memberCode},
|
|
</if>
|
|
<if test="nickName!= null">
|
|
nickName = #{nickName},
|
|
</if>
|
|
<if test="phone!= null">
|
|
phone = #{phone},
|
|
</if>
|
|
<if test="openid!= null">
|
|
openid = #{openid},
|
|
</if>
|
|
<if test="alipayUserId!= null">
|
|
alipayUserId = #{alipayUserId},
|
|
</if>
|
|
<if test="comsumeMoney!= null">
|
|
comsumeMoney = #{comsumeMoney},
|
|
</if>
|
|
<if test="profitMoney!= null">
|
|
profitMoney = #{profitMoney},
|
|
</if>
|
|
<if test="orderNumber!= null">
|
|
orderNumber = #{orderNumber},
|
|
</if>
|
|
<if test="totalRechargeFee!= null">
|
|
totalRechargeFee = #{totalRechargeFee},
|
|
</if>
|
|
<if test="usableRechargeFee!= null">
|
|
usableRechargeFee = #{usableRechargeFee},
|
|
</if>
|
|
<if test="totalGiveFee!= null">
|
|
totalGiveFee = #{totalGiveFee},
|
|
</if>
|
|
<if test="usableGiveFee!= null">
|
|
usableGiveFee = #{usableGiveFee},
|
|
</if>
|
|
<if test="cardNo!= null">
|
|
cardNo = #{cardNo},
|
|
</if>
|
|
<if test="birthdayDt!= null">
|
|
birthdayDt = #{birthdayDt},
|
|
</if>
|
|
<if test="memberName!= null">
|
|
memberName = #{memberName},
|
|
</if>
|
|
<if test="provinces!= null">
|
|
provinces = #{provinces},
|
|
</if>
|
|
<if test="sex!= null">
|
|
sex = #{sex},
|
|
</if>
|
|
<if test="bindingUrl!= null">
|
|
bindingUrl = #{bindingUrl},
|
|
</if>
|
|
<if test="appOpenId!= null">
|
|
appOpenId = #{appOpenId},
|
|
</if>
|
|
<if test="unionId!= null">
|
|
unionId = #{unionId}
|
|
</if>
|
|
</set>
|
|
where id=#{id}
|
|
</update>
|
|
|
|
<delete id="deleteMerchantMenber" parameterType="cn.pluss.platform.entity.MerchantMenber" >
|
|
DELETE FROM tb_pluss_merchant_menber where id=#{id}
|
|
</delete>
|
|
|
|
<select id="queryMerchantMenberPage" parameterType="java.util.Map" resultType="cn.pluss.platform.entity.MerchantMenber">
|
|
SELECT * from tb_pluss_merchant_menber
|
|
<where>
|
|
<if test="id!= null">
|
|
and id = #{id}
|
|
</if>
|
|
<if test="merchantCode!= null">
|
|
and merchantCode = #{merchantCode}
|
|
</if>
|
|
<if test="merchantName!= null">
|
|
and merchantName = #{merchantName}
|
|
</if>
|
|
<if test="storeId!= null">
|
|
and storeId = #{storeId}
|
|
</if>
|
|
<if test="storeName!= null">
|
|
and storeName = #{storeName}
|
|
</if>
|
|
<if test="status!= null">
|
|
and status = #{status}
|
|
</if>
|
|
<if test="createDt!= null">
|
|
and createDt = #{createDt}
|
|
</if>
|
|
<if test="logo!= null">
|
|
and logo = #{logo}
|
|
</if>
|
|
<if test="memberCode!= null">
|
|
and memberCode = #{memberCode}
|
|
</if>
|
|
<if test="keyWord!=null">
|
|
and (
|
|
<if test="nickName!= null">
|
|
nickName like CONCAT("%",#{nickName},"%")
|
|
</if>
|
|
<if test="phone!= null">
|
|
or phone like CONCAT("%",#{phone},"%")
|
|
</if>
|
|
)
|
|
</if>
|
|
<if test="nickName== null">
|
|
and nickName !='null'
|
|
</if>
|
|
<if test="openid!= null">
|
|
and openid = #{openid}
|
|
</if>
|
|
<if test="alipayUserId!= null">
|
|
and alipayUserId = #{alipayUserId}
|
|
</if>
|
|
<if test="comsumeMoney!= null">
|
|
and comsumeMoney = #{comsumeMoney}
|
|
</if>
|
|
<if test="profitMoney!= null">
|
|
and profitMoney = #{profitMoney}
|
|
</if>
|
|
<if test="orderNumber!= null">
|
|
and orderNumber = #{orderNumber}
|
|
</if>
|
|
<if test="totalRechargeFee!= null">
|
|
and totalRechargeFee = #{totalRechargeFee}
|
|
</if>
|
|
<if test="usableRechargeFee!= null">
|
|
and usableRechargeFee = #{usableRechargeFee}
|
|
</if>
|
|
<if test="totalGiveFee!= null">
|
|
and totalGiveFee = #{totalGiveFee}
|
|
</if>
|
|
<if test="usableGiveFee!= null">
|
|
and usableGiveFee = #{usableGiveFee}
|
|
</if>
|
|
<if test="cardNo!= null">
|
|
and cardNo = #{cardNo}
|
|
</if>
|
|
<if test="birthdayDt!= null">
|
|
and birthdayDt = #{birthdayDt}
|
|
</if>
|
|
<if test="provinces!= null">
|
|
and provinces = #{provinces}
|
|
</if>
|
|
<if test="sex!= null">
|
|
and sex = #{sex}
|
|
</if>
|
|
<if test="bindingUrl!= null">
|
|
and bindingUrl = #{bindingUrl}
|
|
</if>
|
|
<if test="appOpenId!= null">
|
|
and appOpenId = #{appOpenId}
|
|
</if>
|
|
<if test="unionId!= null">
|
|
and unionId = #{unionId}
|
|
</if>
|
|
</where>
|
|
order by id desc limit #{pageSize} offset #{offset}
|
|
</select>
|
|
|
|
|
|
<select id="manageQueryMerchantMenberPage" parameterType="java.util.Map" resultType="cn.pluss.platform.entity.MerchantMenber">
|
|
SELECT mm.*,mbi.userId ,mbi.alias from tb_pluss_merchant_menber mm
|
|
LEFT JOIN tb_pluss_merchant_base_info mbi on mbi.merchantCode = mm.merchantCode
|
|
<where>
|
|
<if test="id!= null">
|
|
and mm.id = #{id}
|
|
</if>
|
|
<if test="userId!= null">
|
|
and mbi.userId = #{userId}
|
|
</if>
|
|
<if test="alias != null and alias != ''">
|
|
and mbi.alias like concat('%',#{alias},'%')
|
|
</if>
|
|
<if test="merchantCode!= null">
|
|
and mm.merchantCode = #{merchantCode}
|
|
</if>
|
|
<if test="merchantName!= null">
|
|
and mm.merchantName = #{merchantName}
|
|
</if>
|
|
<if test="storeId!= null">
|
|
and mm.storeId = #{storeId}
|
|
</if>
|
|
<if test="storeName!= null">
|
|
and mm.storeName = #{storeName}
|
|
</if>
|
|
<if test="status!= null">
|
|
and mm.status = #{status}
|
|
</if>
|
|
<if test="createDt!= null">
|
|
and mm.createDt = #{createDt}
|
|
</if>
|
|
<if test="logo!= null">
|
|
and mm.logo = #{logo}
|
|
</if>
|
|
<if test="memberCode!= null">
|
|
and mm.memberCode = #{memberCode}
|
|
</if>
|
|
<if test="nickName!= null">
|
|
and mm.nickName like CONCAT("%",#{nickName},"%")
|
|
</if>
|
|
<if test="nickName== null">
|
|
and mm.nickName !='null'
|
|
</if>
|
|
<if test="phone!= null">
|
|
and mm.phone like CONCAT("%",#{phone},"%")
|
|
</if>
|
|
<if test="openid!= null">
|
|
and mm.openid = #{openid}
|
|
</if>
|
|
<if test="alipayUserId!= null">
|
|
and mm.alipayUserId = #{alipayUserId}
|
|
</if>
|
|
<if test="comsumeMoney!= null">
|
|
and mm.comsumeMoney = #{comsumeMoney}
|
|
</if>
|
|
<if test="profitMoney!= null">
|
|
and mm.profitMoney = #{profitMoney}
|
|
</if>
|
|
<if test="orderNumber!= null">
|
|
and mm.orderNumber = #{orderNumber}
|
|
</if>
|
|
<if test="totalRechargeFee!= null">
|
|
and mm.totalRechargeFee = #{totalRechargeFee}
|
|
</if>
|
|
<if test="usableRechargeFee!= null">
|
|
and mm.usableRechargeFee = #{usableRechargeFee}
|
|
</if>
|
|
<if test="totalGiveFee!= null">
|
|
and mm.totalGiveFee = #{totalGiveFee}
|
|
</if>
|
|
<if test="usableGiveFee!= null">
|
|
and mm.usableGiveFee = #{usableGiveFee}
|
|
</if>
|
|
<if test="cardNo!= null">
|
|
and mm.cardNo = #{cardNo}
|
|
</if>
|
|
<if test="birthdayDt!= null">
|
|
and mm.birthdayDt = #{birthdayDt}
|
|
</if>
|
|
<if test="memberName!= null">
|
|
and mm.memberName Like CONCAT('%',#{memberName},'%')
|
|
</if>
|
|
<if test="provinces!= null">
|
|
and mm.provinces = #{provinces}
|
|
</if>
|
|
<if test="sex!= null">
|
|
and mm.sex = #{sex}
|
|
</if>
|
|
<if test="bindingUrl!= null">
|
|
and mm.bindingUrl = #{bindingUrl}
|
|
</if>
|
|
<if test="appOpenId!= null">
|
|
and mm.appOpenId = #{appOpenId}
|
|
</if>
|
|
<if test="unionId!= null">
|
|
and mm.unionId = #{unionId}
|
|
</if>
|
|
|
|
</where>
|
|
order by id desc limit #{pageSize} offset #{offset}
|
|
</select>
|
|
|
|
<select id="manageQueryMerchantNoMenberPage" parameterType="java.util.Map" resultType="cn.pluss.platform.entity.MerchantMenber">
|
|
SELECT mm.*,mbi.userId ,mbi.alias from tb_pluss_merchant_menber mm
|
|
LEFT JOIN tb_pluss_merchant_base_info mbi on mbi.merchantCode = mm.merchantCode
|
|
<where>
|
|
<if test="id!= null">
|
|
and mm.id = #{id}
|
|
</if>
|
|
<if test="userId!= null">
|
|
and mbi.userId = #{userId}
|
|
</if>
|
|
<if test="alias != null and alias != ''">
|
|
and mbi.alias like concat('%',#{alias},'%')
|
|
</if>
|
|
<if test="merchantCode!= null">
|
|
and mm.merchantCode IN (SELECT merchantCode
|
|
FROM tb_pluss_merchant_base_info
|
|
WHERE bindingCode = (SELECT bindingCode
|
|
FROM tb_pluss_merchant_base_info
|
|
where merchantCode = #{merchantCode}))
|
|
</if>
|
|
<if test="merchantName!= null">
|
|
and mm.merchantName = #{merchantName}
|
|
</if>
|
|
<if test="storeId!= null">
|
|
and mm.storeId = #{storeId}
|
|
</if>
|
|
<if test="storeName!= null">
|
|
and mm.storeName = #{storeName}
|
|
</if>
|
|
<if test="status!= null">
|
|
and mm.status = #{status}
|
|
</if>
|
|
<if test="createDt!= null">
|
|
and mm.createDt = #{createDt}
|
|
</if>
|
|
<if test="logo!= null">
|
|
and mm.logo = #{logo}
|
|
</if>
|
|
<if test="memberCode!= null">
|
|
and mm.memberCode = #{memberCode}
|
|
</if>
|
|
<if test="nickName!= null">
|
|
and mm.nickName like CONCAT("%",#{nickName},"%")
|
|
</if>
|
|
<if test="nickName== null">
|
|
and mm.nickName !='null'
|
|
</if>
|
|
<if test="phone!= null">
|
|
and mm.phone like CONCAT("%",#{phone},"%")
|
|
</if>
|
|
<if test="openid!= null">
|
|
and mm.openid = #{openid}
|
|
</if>
|
|
<if test="alipayUserId!= null">
|
|
and mm.alipayUserId = #{alipayUserId}
|
|
</if>
|
|
<if test="comsumeMoney!= null">
|
|
and mm.comsumeMoney = #{comsumeMoney}
|
|
</if>
|
|
<if test="profitMoney!= null">
|
|
and mm.profitMoney = #{profitMoney}
|
|
</if>
|
|
<if test="orderNumber!= null">
|
|
and mm.orderNumber = #{orderNumber}
|
|
</if>
|
|
<if test="totalRechargeFee!= null">
|
|
and mm.totalRechargeFee = #{totalRechargeFee}
|
|
</if>
|
|
<if test="usableRechargeFee!= null">
|
|
and mm.usableRechargeFee = #{usableRechargeFee}
|
|
</if>
|
|
<if test="totalGiveFee!= null">
|
|
and mm.totalGiveFee = #{totalGiveFee}
|
|
</if>
|
|
<if test="usableGiveFee!= null">
|
|
and mm.usableGiveFee = #{usableGiveFee}
|
|
</if>
|
|
<if test="cardNo!= null">
|
|
and mm.cardNo = #{cardNo}
|
|
</if>
|
|
<if test="birthdayDt!= null">
|
|
and mm.birthdayDt = #{birthdayDt}
|
|
</if>
|
|
<if test="memberName!= null">
|
|
and mm.memberName Like CONCAT('%',#{memberName},'%')
|
|
</if>
|
|
<if test="provinces!= null">
|
|
and mm.provinces = #{provinces}
|
|
</if>
|
|
<if test="sex!= null">
|
|
and mm.sex = #{sex}
|
|
</if>
|
|
<if test="bindingUrl!= null">
|
|
and mm.bindingUrl = #{bindingUrl}
|
|
</if>
|
|
<if test="appOpenId!= null">
|
|
and mm.appOpenId = #{appOpenId}
|
|
</if>
|
|
<if test="unionId!= null">
|
|
and mm.unionId = #{unionId}
|
|
</if>
|
|
</where>
|
|
order by id desc limit #{pageSize} offset #{offset}
|
|
</select>
|
|
|
|
<select id="manageMerchantMenberSum" parameterType="java.util.Map" resultType="cn.pluss.platform.entity.MerchantMenber">
|
|
SELECT usableRechargeFee,totalGiveFee
|
|
FROM tb_pluss_merchant_menber mm
|
|
WHERE id in ( SELECT
|
|
mm.id
|
|
FROM tb_pluss_merchant_menber mm
|
|
LEFT JOIN tb_pluss_merchant_base_info mbi ON mbi.merchantCode = mm.merchantCode
|
|
WHERE mm.merchantCode=#{merchantCode})
|
|
</select>
|
|
|
|
<select id="manageQueryMerchantMenberPageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
|
|
SELECT count(*) from tb_pluss_merchant_menber mm LEFT JOIN tb_pluss_merchant_base_info mbi on mbi.merchantCode = mm.merchantCode
|
|
<where>
|
|
<if test="id!= null">
|
|
and mm.id = #{id}
|
|
</if>
|
|
<if test="userId != null">
|
|
and mbi.userId = #{userId}
|
|
</if>
|
|
<if test="alias!= null">
|
|
and mbi.alias like concat('%',#{alias},'%')
|
|
</if>
|
|
<if test="merchantCode!= null">
|
|
and mm.merchantCode = #{merchantCode}
|
|
</if>
|
|
<if test="merchantName!= null">
|
|
and mm.merchantName = #{merchantName}
|
|
</if>
|
|
<if test="storeId!= null">
|
|
and mm.storeId = #{storeId}
|
|
</if>
|
|
<if test="storeName!= null">
|
|
and mm.storeName = #{storeName}
|
|
</if>
|
|
<if test="status!= null">
|
|
and mm.status = #{status}
|
|
</if>
|
|
<if test="createDt!= null">
|
|
and mm.createDt = #{createDt}
|
|
</if>
|
|
<if test="logo!= null">
|
|
and mm.logo = #{logo}
|
|
</if>
|
|
<if test="memberCode!= null">
|
|
and mm.memberCode = #{memberCode}
|
|
</if>
|
|
<if test="nickName!= null">
|
|
and mm.nickName like CONCAT("%",#{nickName},"%")
|
|
</if>
|
|
<if test="nickName== null">
|
|
and mm.nickName !='null'
|
|
</if>
|
|
<if test="phone!= null">
|
|
and mm.phone like CONCAT("%",#{phone},"%")
|
|
</if>
|
|
<if test="openid!= null">
|
|
and mm.openid = #{openid}
|
|
</if>
|
|
<if test="alipayUserId!= null">
|
|
and mm.alipayUserId = #{alipayUserId}
|
|
</if>
|
|
<if test="comsumeMoney!= null">
|
|
and mm.comsumeMoney = #{comsumeMoney}
|
|
</if>
|
|
<if test="profitMoney!= null">
|
|
and mm.profitMoney = #{profitMoney}
|
|
</if>
|
|
<if test="orderNumber!= null">
|
|
and mm.orderNumber = #{orderNumber}
|
|
</if>
|
|
<if test="totalRechargeFee!= null">
|
|
and mm.totalRechargeFee = #{totalRechargeFee}
|
|
</if>
|
|
<if test="usableRechargeFee!= null">
|
|
and mm.usableRechargeFee = #{usableRechargeFee}
|
|
</if>
|
|
<if test="totalGiveFee!= null">
|
|
and mm.totalGiveFee = #{totalGiveFee}
|
|
</if>
|
|
<if test="usableGiveFee!= null">
|
|
and mm.usableGiveFee = #{usableGiveFee}
|
|
</if>
|
|
<if test="cardNo!= null">
|
|
and mm.cardNo = #{cardNo}
|
|
</if>
|
|
<if test="birthdayDt!= null">
|
|
and mm.birthdayDt = #{birthdayDt}
|
|
</if>
|
|
<if test="memberName!= null">
|
|
and mm.memberName Like CONCAT('%',#{memberName},'%')
|
|
</if>
|
|
<if test="provinces!= null">
|
|
and mm.provinces = #{provinces}
|
|
</if>
|
|
<if test="sex!= null">
|
|
and mm.sex = #{sex}
|
|
</if>
|
|
<if test="bindingUrl!= null">
|
|
and mm.bindingUrl = #{bindingUrl}
|
|
</if>
|
|
<if test="appOpenId!= null">
|
|
and mm.appOpenId = #{appOpenId}
|
|
</if>
|
|
<if test="unionId!= null">
|
|
and mm.unionId = #{unionId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<select id="queryMerchantMenberPageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
|
|
SELECT count(*) from tb_pluss_merchant_menber
|
|
<where>
|
|
<if test="id!= null">
|
|
and id = #{id}
|
|
</if>
|
|
<if test="nickName== null">
|
|
and nickName !='null'
|
|
</if>
|
|
<if test="merchantCode!= null">
|
|
and merchantCode = #{merchantCode}
|
|
</if>
|
|
<if test="merchantName!= null">
|
|
and merchantName = #{merchantName}
|
|
</if>
|
|
<if test="storeId!= null">
|
|
and storeId = #{storeId}
|
|
</if>
|
|
<if test="storeName!= null">
|
|
and storeName = #{storeName}
|
|
</if>
|
|
<if test="status!= null">
|
|
and status = #{status}
|
|
</if>
|
|
<if test="createDt!= null">
|
|
and createDt = #{createDt}
|
|
</if>
|
|
<if test="stTime!= null">
|
|
and createDt >= #{stTime}
|
|
</if>
|
|
<if test="endTime!= null">
|
|
and createDt <= #{endTime}
|
|
</if>
|
|
<if test="logo!= null">
|
|
and logo = #{logo}
|
|
</if>
|
|
<if test="memberCode!= null">
|
|
and memberCode = #{memberCode}
|
|
</if>
|
|
|
|
<if test="keyWord!=null">
|
|
and (
|
|
<if test="nickName!= null">
|
|
nickName like CONCAT("%",#{nickName},"%")
|
|
</if>
|
|
<if test="phone!= null">
|
|
or phone like CONCAT("%",#{phone},"%")
|
|
</if>
|
|
)
|
|
</if>
|
|
<if test="openid!= null">
|
|
and openid = #{openid}
|
|
</if>
|
|
<if test="alipayUserId!= null">
|
|
and alipayUserId = #{alipayUserId}
|
|
</if>
|
|
<if test="comsumeMoney!= null">
|
|
and comsumeMoney = #{comsumeMoney}
|
|
</if>
|
|
<if test="profitMoney!= null">
|
|
and profitMoney = #{profitMoney}
|
|
</if>
|
|
<if test="orderNumber!= null">
|
|
and orderNumber = #{orderNumber}
|
|
</if>
|
|
<if test="totalRechargeFee!= null">
|
|
and totalRechargeFee = #{totalRechargeFee}
|
|
</if>
|
|
<if test="usableRechargeFee!= null">
|
|
and usableRechargeFee = #{usableRechargeFee}
|
|
</if>
|
|
<if test="totalGiveFee!= null">
|
|
and totalGiveFee = #{totalGiveFee}
|
|
</if>
|
|
<if test="usableGiveFee!= null">
|
|
and usableGiveFee = #{usableGiveFee}
|
|
</if>
|
|
<if test="cardNo!= null">
|
|
and cardNo = #{cardNo}
|
|
</if>
|
|
<if test="birthdayDt!= null">
|
|
and birthdayDt = #{birthdayDt}
|
|
</if>
|
|
<if test="memberName!= null">
|
|
and memberName Like CONCAT('%',#{memberName},'%')
|
|
</if>
|
|
<if test="provinces!= null">
|
|
and provinces = #{provinces}
|
|
</if>
|
|
<if test="sex!= null">
|
|
and sex = #{sex}
|
|
</if>
|
|
<if test="bindingUrl!= null">
|
|
and bindingUrl = #{bindingUrl}
|
|
</if>
|
|
<if test="appOpenId!= null">
|
|
and appOpenId = #{appOpenId}
|
|
</if>
|
|
<if test="unionId!= null">
|
|
and unionId = #{unionId}
|
|
</if>
|
|
|
|
</where>
|
|
</select>
|
|
|
|
<select id="queryMerchantMenberTotalRechargeFee" parameterType="java.util.Map" resultType="java.lang.Double">
|
|
SELECT sum(totalRechargeFee) from tb_pluss_merchant_menber
|
|
<where>
|
|
<if test="id!= null">
|
|
and id = #{id}
|
|
</if>
|
|
<if test="nickName== null">
|
|
and nickName !='null'
|
|
</if>
|
|
<if test="merchantCode!= null">
|
|
and merchantCode = #{merchantCode}
|
|
</if>
|
|
<if test="merchantName!= null">
|
|
and merchantName = #{merchantName}
|
|
</if>
|
|
<if test="storeId!= null">
|
|
and storeId = #{storeId}
|
|
</if>
|
|
<if test="storeName!= null">
|
|
and storeName = #{storeName}
|
|
</if>
|
|
<if test="status!= null">
|
|
and status = #{status}
|
|
</if>
|
|
<if test="createDt!= null">
|
|
and createDt = #{createDt}
|
|
</if>
|
|
<if test="logo!= null">
|
|
and logo = #{logo}
|
|
</if>
|
|
<if test="memberCode!= null">
|
|
and memberCode = #{memberCode}
|
|
</if>
|
|
<if test="nickName!= null">
|
|
and nickName like CONCAT("%",#{nickName},"%")
|
|
</if>
|
|
<if test="phone!= null">
|
|
and phone like CONCAT("%",#{phone},"%")
|
|
</if>
|
|
<if test="openid!= null">
|
|
and openid = #{openid}
|
|
</if>
|
|
<if test="alipayUserId!= null">
|
|
and alipayUserId = #{alipayUserId}
|
|
</if>
|
|
<if test="comsumeMoney!= null">
|
|
and comsumeMoney = #{comsumeMoney}
|
|
</if>
|
|
<if test="profitMoney!= null">
|
|
and profitMoney = #{profitMoney}
|
|
</if>
|
|
<if test="orderNumber!= null">
|
|
and orderNumber = #{orderNumber}
|
|
</if>
|
|
<if test="totalRechargeFee!= null">
|
|
and totalRechargeFee = #{totalRechargeFee}
|
|
</if>
|
|
<if test="usableRechargeFee!= null">
|
|
and usableRechargeFee = #{usableRechargeFee}
|
|
</if>
|
|
<if test="totalGiveFee!= null">
|
|
and totalGiveFee = #{totalGiveFee}
|
|
</if>
|
|
<if test="usableGiveFee!= null">
|
|
and usableGiveFee = #{usableGiveFee}
|
|
</if>
|
|
<if test="cardNo!= null">
|
|
and cardNo = #{cardNo}
|
|
</if>
|
|
<if test="birthdayDt!= null">
|
|
and birthdayDt = #{birthdayDt}
|
|
</if>
|
|
<if test="memberName!= null">
|
|
and memberName = #{memberName}
|
|
</if>
|
|
<if test="provinces!= null">
|
|
and provinces = #{provinces}
|
|
</if>
|
|
<if test="sex!= null">
|
|
and sex = #{sex}
|
|
</if>
|
|
<if test="bindingUrl!= null">
|
|
and bindingUrl = #{bindingUrl}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="queryMerchantMenberUsableRechargeFee" parameterType="java.util.Map" resultType="java.lang.Double">
|
|
SELECT round(sum(usableRechargeFee),2) from tb_pluss_merchant_menber
|
|
<where>
|
|
<if test="id!= null">
|
|
and id = #{id}
|
|
</if>
|
|
<if test="nickName== null">
|
|
and nickName !='null'
|
|
</if>
|
|
<if test="merchantCode!= null">
|
|
and merchantCode = #{merchantCode}
|
|
</if>
|
|
<if test="merchantName!= null">
|
|
and merchantName = #{merchantName}
|
|
</if>
|
|
<if test="storeId!= null">
|
|
and storeId = #{storeId}
|
|
</if>
|
|
<if test="storeName!= null">
|
|
and storeName = #{storeName}
|
|
</if>
|
|
<if test="status!= null">
|
|
and status = #{status}
|
|
</if>
|
|
<if test="createDt!= null">
|
|
and createDt = #{createDt}
|
|
</if>
|
|
<if test="logo!= null">
|
|
and logo = #{logo}
|
|
</if>
|
|
<if test="memberCode!= null">
|
|
and memberCode = #{memberCode}
|
|
</if>
|
|
<if test="nickName!= null">
|
|
and nickName like CONCAT("%",#{nickName},"%")
|
|
</if>
|
|
<if test="phone!= null">
|
|
and phone like CONCAT("%",#{phone},"%")
|
|
</if>
|
|
<if test="openid!= null">
|
|
and openid = #{openid}
|
|
</if>
|
|
<if test="alipayUserId!= null">
|
|
and alipayUserId = #{alipayUserId}
|
|
</if>
|
|
<if test="comsumeMoney!= null">
|
|
and comsumeMoney = #{comsumeMoney}
|
|
</if>
|
|
<if test="profitMoney!= null">
|
|
and profitMoney = #{profitMoney}
|
|
</if>
|
|
<if test="orderNumber!= null">
|
|
and orderNumber = #{orderNumber}
|
|
</if>
|
|
<if test="totalRechargeFee!= null">
|
|
and totalRechargeFee = #{totalRechargeFee}
|
|
</if>
|
|
<if test="usableRechargeFee!= null">
|
|
and usableRechargeFee = #{usableRechargeFee}
|
|
</if>
|
|
<if test="totalGiveFee!= null">
|
|
and totalGiveFee = #{totalGiveFee}
|
|
</if>
|
|
<if test="usableGiveFee!= null">
|
|
and usableGiveFee = #{usableGiveFee}
|
|
</if>
|
|
<if test="cardNo!= null">
|
|
and cardNo = #{cardNo}
|
|
</if>
|
|
<if test="birthdayDt!= null">
|
|
and birthdayDt = #{birthdayDt}
|
|
</if>
|
|
<if test="memberName!= null">
|
|
and memberName = #{memberName}
|
|
</if>
|
|
<if test="provinces!= null">
|
|
and provinces = #{provinces}
|
|
</if>
|
|
<if test="sex!= null">
|
|
and sex = #{sex}
|
|
</if>
|
|
<if test="bindingUrl!= null">
|
|
and bindingUrl = #{bindingUrl}
|
|
</if>
|
|
<if test="appOpenId!= null">
|
|
and appOpenId = #{appOpenId}
|
|
</if>
|
|
<if test="unionId!= null">
|
|
and unionId = #{unionId}
|
|
</if>
|
|
|
|
</where>
|
|
</select>
|
|
|
|
<select id="queryMerchantMenberNumByTime" parameterType="java.util.Map" resultType="java.lang.Integer">
|
|
SELECT count(*) from tb_pluss_merchant_menber
|
|
<where>
|
|
<if test="id!= null">
|
|
and id = #{id}
|
|
</if>
|
|
<if test="nickName== null">
|
|
and nickName !='null'
|
|
</if>
|
|
<if test="merchantCode!= null">
|
|
and merchantCode = #{merchantCode}
|
|
</if>
|
|
<if test="merchantName!= null">
|
|
and merchantName = #{merchantName}
|
|
</if>
|
|
<if test="storeId!= null">
|
|
and storeId = #{storeId}
|
|
</if>
|
|
<if test="storeName!= null">
|
|
and storeName = #{storeName}
|
|
</if>
|
|
<if test="status!= null">
|
|
and status = #{status}
|
|
</if>
|
|
<if test="createDt!= null">
|
|
and createDt = #{createDt}
|
|
</if>
|
|
<if test="logo!= null">
|
|
and logo = #{logo}
|
|
</if>
|
|
<if test="memberCode!= null">
|
|
and memberCode = #{memberCode}
|
|
</if>
|
|
<if test="nickName!= null">
|
|
and nickName like CONCAT("%",#{nickName},"%")
|
|
</if>
|
|
<if test="phone!= null">
|
|
and phone like CONCAT("%",#{phone},"%")
|
|
</if>
|
|
<if test="openid!= null">
|
|
and openid = #{openid}
|
|
</if>
|
|
<if test="alipayUserId!= null">
|
|
and alipayUserId = #{alipayUserId}
|
|
</if>
|
|
<if test="comsumeMoney!= null">
|
|
and comsumeMoney = #{comsumeMoney}
|
|
</if>
|
|
<if test="profitMoney!= null">
|
|
and profitMoney = #{profitMoney}
|
|
</if>
|
|
<if test="orderNumber!= null">
|
|
and orderNumber = #{orderNumber}
|
|
</if>
|
|
<if test="totalRechargeFee!= null">
|
|
and totalRechargeFee = #{totalRechargeFee}
|
|
</if>
|
|
<if test="usableRechargeFee!= null">
|
|
and usableRechargeFee = #{usableRechargeFee}
|
|
</if>
|
|
<if test="totalGiveFee!= null">
|
|
and totalGiveFee = #{totalGiveFee}
|
|
</if>
|
|
<if test="usableGiveFee!= null">
|
|
and usableGiveFee = #{usableGiveFee}
|
|
</if>
|
|
<if test="cardNo!= null">
|
|
and cardNo = #{cardNo}
|
|
</if>
|
|
<if test="birthdayDt!= null">
|
|
and birthdayDt = #{birthdayDt}
|
|
</if>
|
|
<if test="memberName!= null">
|
|
and memberName = #{memberName}
|
|
</if>
|
|
<if test="provinces!= null">
|
|
and provinces = #{provinces}
|
|
</if>
|
|
<if test="sex!= null">
|
|
and sex = #{sex}
|
|
</if>
|
|
<if test="bindingUrl!= null">
|
|
and bindingUrl = #{bindingUrl}
|
|
</if>
|
|
<if test="startTime!= null">
|
|
and createDt >= #{startTime}
|
|
</if>
|
|
<if test="endTime != null">
|
|
and createDt <= #{endTime}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="queryMerchantMemberBill" resultType="java.lang.Double">
|
|
select round(sum(orderFee),2) from tb_pluss_member_order
|
|
<where>
|
|
<if test="rechargeType">
|
|
and rechargeType=#{rechargeType}
|
|
</if>
|
|
<if test="orderType">
|
|
and orderType=#{orderType}
|
|
</if>
|
|
<if test="merchantCode">
|
|
and merchantCode=#{merchantCode}
|
|
</if>
|
|
<if test="startTime!= null">
|
|
<![CDATA[
|
|
and DATE_FORMAT(createDt, '%Y-%m-%d %H:%i:%S')>=DATE_FORMAT(#{startTime}, '%Y-%m-%d %H:%i:%S')
|
|
]]>
|
|
</if>
|
|
<if test="endTime!= null">
|
|
<![CDATA[
|
|
and DATE_FORMAT(createDt, '%Y-%m-%d %H:%i:%S')<=DATE_FORMAT(#{endTime}, '%Y-%m-%d %H:%i:%S')
|
|
]]>
|
|
</if>
|
|
and orderStatus='1'
|
|
</where>
|
|
</select>
|
|
|
|
<select id="queryMerchantGiveMoney" resultType="java.lang.Double">
|
|
select round(sum(totalGiveFee),2) from tb_pluss_merchant_menber
|
|
where merchantCode=#{merchantCode}
|
|
</select>
|
|
|
|
<select id="manageQueryMerchantNoMenberPageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
|
|
SELECT count(*) from tb_pluss_merchant_menber mm LEFT JOIN tb_pluss_merchant_base_info mbi on mbi.merchantCode =
|
|
mm.merchantCode
|
|
<where>
|
|
<if test="id!= null">
|
|
and mm.id = #{id}
|
|
</if>
|
|
<if test="userId != null">
|
|
and mbi.userId = #{userId}
|
|
</if>
|
|
<if test="alias!= null">
|
|
and mbi.alias like concat('%',#{alias},'%')
|
|
</if>
|
|
<if test="merchantCode!= null">
|
|
and mm.merchantCode = #{merchantCode}
|
|
</if>
|
|
<if test="merchantName!= null">
|
|
and mm.merchantName = #{merchantName}
|
|
</if>
|
|
<if test="storeId!= null">
|
|
and mm.storeId = #{storeId}
|
|
</if>
|
|
<if test="storeName!= null">
|
|
and mm.storeName = #{storeName}
|
|
</if>
|
|
<if test="status!= null">
|
|
and mm.status = #{status}
|
|
</if>
|
|
<if test="createDt!= null">
|
|
and mm.createDt = #{createDt}
|
|
</if>
|
|
<if test="logo!= null">
|
|
and mm.logo = #{logo}
|
|
</if>
|
|
<if test="memberCode!= null">
|
|
and mm.memberCode in (SELECT merchantCode
|
|
FROM tb_pluss_merchant_base_info
|
|
WHERE bindingCode =(SELECT bindingCode
|
|
FROM tb_pluss_merchant_base_info
|
|
where merchantCode = #{merchantCode}))
|
|
</if>
|
|
<if test="nickName!= null">
|
|
and mm.nickName like CONCAT("%",#{nickName},"%")
|
|
</if>
|
|
<if test="nickName== null">
|
|
and mm.nickName !='null'
|
|
</if>
|
|
<if test="phone!= null">
|
|
and mm.phone like CONCAT("%",#{phone},"%")
|
|
</if>
|
|
<if test="openid!= null">
|
|
and mm.openid = #{openid}
|
|
</if>
|
|
<if test="alipayUserId!= null">
|
|
and mm.alipayUserId = #{alipayUserId}
|
|
</if>
|
|
<if test="comsumeMoney!= null">
|
|
and mm.comsumeMoney = #{comsumeMoney}
|
|
</if>
|
|
<if test="profitMoney!= null">
|
|
and mm.profitMoney = #{profitMoney}
|
|
</if>
|
|
<if test="orderNumber!= null">
|
|
and mm.orderNumber = #{orderNumber}
|
|
</if>
|
|
<if test="totalRechargeFee!= null">
|
|
and mm.totalRechargeFee = #{totalRechargeFee}
|
|
</if>
|
|
<if test="usableRechargeFee!= null">
|
|
and mm.usableRechargeFee = #{usableRechargeFee}
|
|
</if>
|
|
<if test="totalGiveFee!= null">
|
|
and mm.totalGiveFee = #{totalGiveFee}
|
|
</if>
|
|
<if test="usableGiveFee!= null">
|
|
and mm.usableGiveFee = #{usableGiveFee}
|
|
</if>
|
|
<if test="cardNo!= null">
|
|
and mm.cardNo = #{cardNo}
|
|
</if>
|
|
<if test="birthdayDt!= null">
|
|
and mm.birthdayDt = #{birthdayDt}
|
|
</if>
|
|
<if test="memberName!= null">
|
|
and mm.memberName Like CONCAT('%',#{memberName},'%')
|
|
</if>
|
|
<if test="provinces!= null">
|
|
and mm.provinces = #{provinces}
|
|
</if>
|
|
<if test="sex!= null">
|
|
and mm.sex = #{sex}
|
|
</if>
|
|
<if test="bindingUrl!= null">
|
|
and mm.bindingUrl = #{bindingUrl}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<select id="pageJoinData" resultType="cn.pluss.platform.entity.MerchantMenber" parameterType="cn.pluss.platform.entity.MerchantMenber">
|
|
SELECT
|
|
ROUND(IFNULL(mm.usableRechargeFee,0.00) + IFNULL(mm.usableGiveFee,0.00),2) AS 'useAmt',
|
|
mm.storeName,
|
|
ms.id AS storeId,
|
|
mi.picUrl as 'storeLogo',
|
|
mm.phone
|
|
FROM
|
|
tb_pluss_merchant_menber mm
|
|
LEFT JOIN tb_pluss_merchant_store ms
|
|
on mm.storeId = ms.storeId
|
|
LEFT JOIN tb_pluss_merchant_image mi
|
|
ON ms.merchantCode = mi.merchantCode
|
|
WHERE
|
|
mi.photoType = '06'
|
|
<choose>
|
|
<when test="menber.unionId != null and menber.unionId != ''">
|
|
and mm.unionId = #{menber.unionId}
|
|
</when>
|
|
<otherwise>
|
|
and mm.appOpenId = #{menber.appOpenId}
|
|
</otherwise>
|
|
</choose>
|
|
ORDER BY mm.createDt desc
|
|
</select>
|
|
|
|
</mapper>
|