Files
chaozhanggui/pluss-dao-bundle/target/classes/mapper/HomeMapper-sqlmap.xml
2023-01-28 15:57:27 +08:00

951 lines
35 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.HomeMapper">
<select id="queryMerchantBaseInfoPageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(*) from tb_pluss_merchant_base_info
</select>
<select id="queryMerchantFansCount" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM tb_pluss_fans pf
LEFT JOIN tb_pluss_merchant_base_info mbi
ON mbi.merchantCode = pf.merchantCode
<where>
pf.nickName is not null and pf.nickName!=''
<if test="merchantCode!=null and merchantCode!=''">
and mbi.bindingCode =( SELECT bindingCode FROM tb_pluss_merchant_base_info WHERE merchantCode = #{merchantCode})
</if>
</where>
</select>
<select id="queryTodayFanCount" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(*) from tb_pluss_fans
<where>
nickName is not null and nickName!=''
<if test="merchantCode!= null">
and 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="stTime != null ">
<![CDATA[
and DATE_FORMAT(consumTime, '%Y-%m-%d %H:%i:%S')>=DATE_FORMAT(#{stTime}, '%Y-%m-%d %H:%i:%S')
]]>
</if>
<if test="endTime != null ">
<![CDATA[
and DATE_FORMAT(consumTime, '%Y-%m-%d %H:%i:%S')<=DATE_FORMAT(#{endTime}, '%Y-%m-%d %H:%i:%S')
]]>
</if>
</where>
</select>
<select id="getOrderFeeSum1" parameterType="java.util.Map" resultType="java.lang.Double">
SELECT sum(consumeFee) from tb_pluss_merchant_order
<where>
<include refid="commom_where_if"/>
</where>
</select>
<select id="queryMerchantOrderPageCount"
parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(1) from tb_pluss_merchant_order
<where>
<include refid="commom_where_if"/>
<if test="stTime != null ">
<![CDATA[
and DATE_FORMAT(transDt, '%Y-%m-%d %H:%i:%S')>=DATE_FORMAT(#{stTime}, '%Y-%m-%d %H:%i:%S')
]]>
</if>
<if test="endTime != null ">
<![CDATA[
and DATE_FORMAT(transDt, '%Y-%m-%d %H:%i:%S')<=DATE_FORMAT(#{endTime}, '%Y-%m-%d %H:%i:%S')
]]>
</if>
</where>
</select>
<select id="manageQueryMerchantMenberPageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(1) from tb_pluss_merchant_menber mm LEFT JOIN tb_pluss_merchant_base_info mbi on mbi.merchantCode = mm.merchantCode
<where>
<if test="merchantCode!= null">
and mbi.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="nickName == null">
and mm.nickName !='null'
</if>
</where>
</select>
<select id="manageMerchantMenberSum" parameterType="java.util.Map" resultType="java.lang.Double">
SELECT SUM(mm.usableRechargeFee+mm.usableGiveFee)
FROM tb_pluss_merchant_menber mm
LEFT JOIN tb_pluss_merchant_base_info mbi ON mbi.merchantCode = mm.merchantCode
WHERE mm.merchantCode in (SELECT merchantCode
FROM tb_pluss_merchant_base_info
WHERE bindingCode = (SELECT bindingCode
FROM tb_pluss_merchant_base_info
where merchantCode = #{merchantCode}))
</select>
<select id="queryFansList" parameterType="cn.pluss.platform.entity.Fans" resultType="cn.pluss.platform.entity.Fans">
SELECT * from tb_pluss_fans
<where>
lastMerchantCode IS NOT NULL
<if test="merchantCode!= null">
and lastMerchantCode in (SELECT merchantCode
FROM tb_pluss_merchant_base_info
WHERE bindingCode =(SELECT bindingCode
FROM tb_pluss_merchant_base_info
where merchantCode = #{merchantCode}))
</if>
</where>
</select>
<select id="getToDayTransSum1" parameterType="java.util.Map" resultType="java.lang.Double">
SELECT sum(consumeFee) from tb_pluss_merchant_order
<where>
<if test="merchantCode!= null">
and 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="consumeFee!= null">
and consumeFee = #{consumeFee}
</if>
<if test="createDt!= null">
and createDt = #{createDt}
</if>
<if test="status!= null">
and status = #{status}
</if>
<if test="endTime != null">
and createDt <![CDATA[<=]]> #{endTime}
</if>
<if test="transDt!= null">
and transDt = #{transDt}
</if>
<if test="staffName!= null">
and staffName = #{staffName}
</if>
<if test="stTime!= null">
and transDt <![CDATA[>=]]> #{stTime}
</if>
<if test="endTime!= null">
and transDt <![CDATA[<=]]> #{endTime}
</if>
</where>
</select>
<select id="toDayTransZfbSum" parameterType="java.util.Map" resultType="java.lang.Double">
SELECT sum(consumeFee) from tb_pluss_merchant_order
<where>
<if test="merchantCode!= null">
and 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="consumeFee!= null">
and consumeFee = #{consumeFee}
</if>
<if test="createDt!= null">
and createDt = #{createDt}
</if>
<if test="status!= null">
and status = #{status}
</if>
<if test="endTime != null">
and createDt &lt;= #{endTime}
</if>
<if test="transDt!= null">
and transDt = #{transDt}
</if>
<if test="staffName!= null">
and staffName = #{staffName}
</if>
<if test="stTime!= null">
and transDt <![CDATA[>=]]> #{stTime}
</if>
<if test="endTime!= null">
and transDt <![CDATA[<=]]> #{endTime}
</if>
and (payTypeCode='leshuaPay0' or payTypeCode= 'aliPay' or payTypeCode='sxfPay0')
</where>
</select>
<select id="toDayTransWxSum" parameterType="java.util.Map" resultType="java.lang.Double">
SELECT sum(consumeFee) from tb_pluss_merchant_order
<where>
<if test="merchantCode!= null">
and 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="consumeFee!= null">
and consumeFee = #{consumeFee}
</if>
<if test="createDt!= null">
and createDt = #{createDt}
</if>
<if test="status!= null">
and status = #{status}
</if>
<if test="endTime != null">
and createDt &lt;= #{endTime}
</if>
<if test="transDt!= null">
and transDt = #{transDt}
</if>
<if test="staffName!= null">
and staffName = #{staffName}
</if>
<if test="stTime!= null">
and transDt <![CDATA[>=]]> #{stTime}
</if>
<if test="endTime!= null">
and transDt <![CDATA[<=]]> #{endTime}
</if>
and (payTypeCode='leshuaPay1' or payTypeCode= 'wechatPay' or payTypeCode='sxfPay1')
</where>
</select>
<select id="toDayTransYsfSum" parameterType="java.util.Map" resultType="java.lang.Double">
SELECT sum(consumeFee) from tb_pluss_merchant_order
<where>
<if test="merchantCode!= null">
and 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="consumeFee!= null">
and consumeFee = #{consumeFee}
</if>
<if test="createDt!= null">
and createDt = #{createDt}
</if>
<if test="status!= null">
and status = #{status}
</if>
<if test="endTime != null">
and createDt &lt;= #{endTime}
</if>
<if test="transDt!= null">
and transDt = #{transDt}
</if>
<if test="staffName!= null">
and staffName = #{staffName}
</if>
<if test="stTime!= null">
and transDt <![CDATA[>=]]> #{stTime}
</if>
<if test="endTime!= null">
and transDt <![CDATA[<=]]> #{endTime}
</if>
and payTypeCode='sxfPay2'
</where>
</select>
<select id="toDayTransZfbCount"
parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(*) from tb_pluss_merchant_order
<where>
<if test="id!= null">
and id = #{id}
</if>
<if test="orderNumber!= null">
and orderNumber like CONCAT("%",#{orderNumber},"%")
</if>
<if test="merchantCode!= null">
and 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 merchantName = #{merchantName}
</if>
<if test="payTypeCode!= null">
and payTypeCode = #{payTypeCode}
</if>
<if test="payTypeName!= null">
and payTypeName = #{payTypeName}
</if>
<if test="consumeFee!= null">
and consumeFee = #{consumeFee}
</if>
<if test="transNo!= null">
and transNo like CONCAT("%",#{transNo},"%")
</if>
<if test="memberCode!= null">
and memberCode like CONCAT("%",#{memberCode},"%")
</if>
<if test="storeId!= null">
and storeId = #{storeId}
</if>
<if test="storeName!= null">
and storeName like CONCAT("%",#{storeName},"%")
</if>
<if test="createDt!= null">
and createDt = #{createDt}
</if>
<if test="staffCode!= null">
and staffCode = #{staffCode}
</if>
<if test="status!= null">
and status = #{status}
</if>
<if test="shareMoney!= null">
and shareMoney = #{shareMoney}
</if>
<if test="aliPayTransNo!= null">
and aliPayTransNo = #{aliPayTransNo}
</if>
<if test="enterFee!= null">
and enterFee = #{enterFee}
</if>
<if test="weChatTransNo!= null">
and weChatTransNo = #{weChatTransNo}
</if>
<if test="aisleSwitch!= null">
and aisleSwitch = #{aisleSwitch}
</if>
<if test="leshuaMerchantRefundId!= null">
and leshuaMerchantRefundId = #{leshuaMerchantRefundId}
</if>
<if test="leshuaTransNo!= null">
and leshuaTransNo = #{leshuaTransNo}
</if>
<if test="orderType!= null">
and orderType = #{orderType}
</if>
<if test="promoteruserId!= null">
and promoteruserId = #{promoteruserId}
</if>
<if test="userImg!= null">
and userImg = #{userImg}
</if>
<if test="nickName!= null">
and nickName = #{nickName}
</if>
<if test="remark!= null">
and remark = #{remark}
</if>
<if test="transDt!= null">
and transDt = #{transDt}
</if>
<if test="staffName!= null">
and staffName = #{staffName}
</if>
<if test="stTime!= null">
and transDt <![CDATA[>=]]> #{stTime}
</if>
<if test="endTime!= null">
and transDt <![CDATA[<=]]> #{endTime}
</if>
and (payTypeCode='leshuaPay0' or payTypeCode= 'aliPay' or payTypeCode='sxfPay0')
</where>
</select>
<!-- 今日微信收款笔数 -->
<select id="toDayTransWxCount"
parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(*) from tb_pluss_merchant_order
<where>
<if test="id!= null">
and id = #{id}
</if>
<if test="orderNumber!= null">
and orderNumber like CONCAT("%",#{orderNumber},"%")
</if>
<if test="merchantCode!= null">
and 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 merchantName = #{merchantName}
</if>
<if test="payTypeCode!= null">
and payTypeCode = #{payTypeCode}
</if>
<if test="payTypeName!= null">
and payTypeName = #{payTypeName}
</if>
<if test="consumeFee!= null">
and consumeFee = #{consumeFee}
</if>
<if test="transNo!= null">
and transNo like CONCAT("%",#{transNo},"%")
</if>
<if test="memberCode!= null">
and memberCode like CONCAT("%",#{memberCode},"%")
</if>
<if test="storeId!= null">
and storeId = #{storeId}
</if>
<if test="storeName!= null">
and storeName like CONCAT("%",#{storeName},"%")
</if>
<if test="createDt!= null">
and createDt = #{createDt}
</if>
<if test="staffCode!= null">
and staffCode = #{staffCode}
</if>
<if test="status!= null">
and status = #{status}
</if>
<if test="shareMoney!= null">
and shareMoney = #{shareMoney}
</if>
<if test="aliPayTransNo!= null">
and aliPayTransNo = #{aliPayTransNo}
</if>
<if test="enterFee!= null">
and enterFee = #{enterFee}
</if>
<if test="weChatTransNo!= null">
and weChatTransNo = #{weChatTransNo}
</if>
<if test="aisleSwitch!= null">
and aisleSwitch = #{aisleSwitch}
</if>
<if test="leshuaMerchantRefundId!= null">
and leshuaMerchantRefundId = #{leshuaMerchantRefundId}
</if>
<if test="leshuaTransNo!= null">
and leshuaTransNo = #{leshuaTransNo}
</if>
<if test="orderType!= null">
and orderType = #{orderType}
</if>
<if test="promoteruserId!= null">
and promoteruserId = #{promoteruserId}
</if>
<if test="userImg!= null">
and userImg = #{userImg}
</if>
<if test="nickName!= null">
and nickName = #{nickName}
</if>
<if test="remark!= null">
and remark = #{remark}
</if>
<if test="transDt!= null">
and transDt = #{transDt}
</if>
<if test="staffName!= null">
and staffName = #{staffName}
</if>
<if test="stTime!= null">
and transDt <![CDATA[>=]]> #{stTime}
</if>
<if test="endTime!= null">
and transDt <![CDATA[<=]]> #{endTime}
</if>
and (payTypeCode='leshuaPay1' or payTypeCode= 'wechatPay' or payTypeCode='sxfPay1')
</where>
</select>
<select id="toDayTransYsfCount"
parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(1) from tb_pluss_merchant_order
<where>
<if test="id!= null">
and id = #{id}
</if>
<if test="orderNumber!= null">
and orderNumber like CONCAT("%",#{orderNumber},"%")
</if>
<if test="merchantCode!= null">
and 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 merchantName = #{merchantName}
</if>
<if test="payTypeCode!= null">
and payTypeCode = #{payTypeCode}
</if>
<if test="payTypeName!= null">
and payTypeName = #{payTypeName}
</if>
<if test="consumeFee!= null">
and consumeFee = #{consumeFee}
</if>
<if test="transNo!= null">
and transNo like CONCAT("%",#{transNo},"%")
</if>
<if test="memberCode!= null">
and memberCode like CONCAT("%",#{memberCode},"%")
</if>
<if test="storeId!= null">
and storeId = #{storeId}
</if>
<if test="storeName!= null">
and storeName like CONCAT("%",#{storeName},"%")
</if>
<if test="createDt!= null">
and createDt = #{createDt}
</if>
<if test="staffCode!= null">
and staffCode = #{staffCode}
</if>
<if test="status!= null">
and status = #{status}
</if>
<if test="shareMoney!= null">
and shareMoney = #{shareMoney}
</if>
<if test="aliPayTransNo!= null">
and aliPayTransNo = #{aliPayTransNo}
</if>
<if test="enterFee!= null">
and enterFee = #{enterFee}
</if>
<if test="weChatTransNo!= null">
and weChatTransNo = #{weChatTransNo}
</if>
<if test="aisleSwitch!= null">
and aisleSwitch = #{aisleSwitch}
</if>
<if test="leshuaMerchantRefundId!= null">
and leshuaMerchantRefundId = #{leshuaMerchantRefundId}
</if>
<if test="leshuaTransNo!= null">
and leshuaTransNo = #{leshuaTransNo}
</if>
<if test="orderType!= null">
and orderType = #{orderType}
</if>
<if test="promoteruserId!= null">
and promoteruserId = #{promoteruserId}
</if>
<if test="userImg!= null">
and userImg = #{userImg}
</if>
<if test="nickName!= null">
and nickName = #{nickName}
</if>
<if test="remark!= null">
and remark = #{remark}
</if>
<if test="transDt!= null">
and transDt = #{transDt}
</if>
<if test="staffName!= null">
and staffName = #{staffName}
</if>
<if test="stTime!= null">
and transDt <![CDATA[>=]]> #{stTime}
</if>
<if test="endTime!= null">
and transDt <![CDATA[<=]]> #{endTime}
</if>
and payTypeCode='sxfPay2'
</where>
</select>
<select id="queryMerchantOrderPage"
parameterType="java.util.Map"
resultType="cn.pluss.platform.entity.MerchantOrder">
SELECT * from tb_pluss_merchant_order
<where>
<if test="id!= null">
and id = #{id}
</if>
<if test="orderNumber!= null">
and orderNumber like CONCAT("%",#{orderNumber},"%")
</if>
<if test="merchantCode!= null">
and 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 merchantName like CONCAT("%",#{merchantName},"%")
</if>
<if test="payTypeCode!= null">
and payTypeCode = #{payTypeCode}
</if>
<if test="payTypeName!= null">
and payTypeName = #{payTypeName}
</if>
<if test="consumeFee!= null">
and consumeFee = #{consumeFee}
</if>
<if test="transNo!= null">
and transNo like CONCAT("%",#{transNo},"%")
</if>
<if test="memberCode!= null">
and memberCode like CONCAT("%",#{memberCode},"%")
</if>
<if test="storeId!= null">
and storeId = #{storeId}
</if>
<if test="storeName!= null">
and storeName like CONCAT("%",#{storeName},"%")
</if>
<if test="createDt!= null">
and createDt = #{createDt}
</if>
<if test="staffCode!= null">
and staffCode = #{staffCode}
</if>
<if test="status!= null">
and status = #{status}
</if>
<if test="shareMoney!= null">
and shareMoney = #{shareMoney}
</if>
<if test="aliPayTransNo!= null">
and aliPayTransNo = #{aliPayTransNo}
</if>
<if test="enterFee!= null">
and enterFee = #{enterFee}
</if>
<if test="weChatTransNo!= null">
and weChatTransNo = #{weChatTransNo}
</if>
<if test="aisleSwitch!= null">
and aisleSwitch = #{aisleSwitch}
</if>
<if test="leshuaMerchantRefundId!= null">
and leshuaMerchantRefundId = #{leshuaMerchantRefundId}
</if>
<if test="leshuaTransNo!= null">
and leshuaTransNo = #{leshuaTransNo}
</if>
<if test="orderType!= null">
and orderType = #{orderType}
</if>
<if test="promoteruserId!= null">
and promoteruserId = #{promoteruserId}
</if>
<if test="userImg!= null">
and userImg = #{userImg}
</if>
<if test="nickName!= null">
and nickName = #{nickName}
</if>
<if test="startTime != null">
and createDt <![CDATA[>=]]> #{startTime}
</if>
<if test="remark!= null">
and remark = #{remark}
</if>
<if test="endTime != null">
and createDt <![CDATA[<=]]> #{endTime}
</if>
<if test="transDt!= null">
and transDt = #{transDt}
</if>
<if test="staffName!= null">
and staffName = #{staffName}
</if>
<if test="stTime!= null">
and transDt <![CDATA[>=]]> #{stTime}
</if>
<if test="endTime!= null">
and transDt <![CDATA[<=]]> #{endTime}
</if>
</where>
<!-- order by id desc limit #{pageSize} offset #{offset} -->
</select>
<select id="queryFansTodayCount" parameterType="cn.pluss.platform.entity.Fans" resultType="java.lang.Double">
select sum(shareMoney) from tb_pluss_fans
<where>
<if test="merchantCode!= null">
and 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="stTime!= null">
and createDt <![CDATA[>=]]> #{stTime}
</if>
<if test="endTime!= null">
and createDt <![CDATA[<=]]> #{endTime}
</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 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 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 <![CDATA[>=]]> #{stTime}
</if>
<if test="endTime!= null">
and createDt <![CDATA[<=]]> #{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>
</where>
</select>
<select id="queryMerchantProfitSumPrice" parameterType="java.util.Map" resultType="java.lang.Double">
SELECT sum(price) from tb_pluss_merchant_profit profit
<where>
<if test="id!= null">
and profit.id = #{id}
</if>
<if test="agentStaffId != null">
and profit.agentStaffId = #{agentStaffId}
</if>
<if test="userId!= null">
and profit.userId = #{userId}
</if>
<if test="type!= null">
and profit.type = #{type}
</if>
<if test="price!= null">
and profit.price = #{price}
</if>
<if test="orderNumber!= null">
and profit.orderNumber = #{orderNumber}
</if>
<if test="merchantName!= null">
and profit.merchantName = #{merchantName}
</if>
<if test="agentStaffId != null">
and profit.agentStaffId = #{agentStaffId}
</if>
<if test="consumeFee!= null">
and profit.consumeFee = #{consumeFee}
</if>
<if test="createDt!= null">
and profit.createDt = #{createDt}
</if>
<if test="stTime!= null">
and profit.createDt <![CDATA[>=]]> #{stTime}
</if>
<if test="enTime!= null">
and profit.createDt <![CDATA[<=]]> #{enTime}
</if>
<if test="orderDt!= null">
and profit.orderDt = #{orderDt}
</if>
<if test="status!= null">
and profit.status = #{status}
</if>
<if test="startTime!= null">
and profit.createDt <![CDATA[>]]> #{startTime}
</if>
<if test="endTime!= null">
and profit.createDt <![CDATA[<]]> #{endTime}
</if>
<if test="payTypeCode!= null">
and profit.payTypeCode = #{payTypeCode}
</if>
<if test="payTypeName!= null">
and profit.payTypeName = #{payTypeName}
</if>
<if test="merchantLogo!= null">
and profit.merchantLogo = #{merchantLogo}
</if>
<if test="level!= null">
and profit.level = #{level}
</if>
<if test="merchantParentId!= null">
and profit.merchantParentId = #{merchantParentId}
</if>
<if test="merchantParentName!= null">
and profit.merchantParentName = #{merchantParentName}
</if>
<if test="merchantParentLogo!= null">
and profit.merchantParentLogo = #{merchantParentLogo}
</if>
<if test="startTime!= null">
and profit.createDt <![CDATA[>]]> #{startTime}
</if>
<if test="endTime!= null">
and profit.createDt <![CDATA[<]]> #{endTime}
</if>
<if test="merchantCodeList!= null">
and profit.merchantCode in
<foreach collection="merchantCodeList" item="item" open="(" close=")" index="index" separator=",">
#{item}
</foreach>
</if>
<if test="phone!= null">
and profit.phone = #{phone}
</if>
<if test="userName!= null">
and profit.userName = #{userName}
</if>
<if test="merchantParentLevel!= null">
and profit.merchantParentLevel = #{merchantParentLevel}
</if>
<if test="merchantParentPhone!= null">
and profit.merchantParentPhone = #{merchantParentPhone}
</if>
<if test="retype!= null">
and profit.type !=4
</if>
</where>
</select>
<select id="queryUserAppPageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(*) from tb_pluss_user_app
<where>
userType = 'promoter'
<if test="parentId!= null">
and parentId = #{parentId}
</if>
</where>
</select>
<select id="queryMerchantCount" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM tb_pluss_merchant_base_info
WHERE userId IN (SELECT userId
FROM tb_pluss_user_app
<where>
userType = 'promoter'
<if test="parentId!= null">
and parentId = #{parentId}
</if>
</where>)
</select>
<sql id="commom_where_if">
<if test="merchantCode!= null">
and merchantCode in (SELECT merchantCode
FROM tb_pluss_merchant_base_info
WHERE bindingCode =(SELECT bindingCode
FROM tb_pluss_merchant_base_info
where merchantCode = #{merchantCode}))
</if>
<choose>
<when test="status != null and status != ''">
and status = #{status}
</when>
<otherwise>
and status = '1'
</otherwise>
</choose>
</sql>
</mapper>