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

172 lines
7.0 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.RealFansMapper">
<insert id="saveRealFansBatch">
insert into tb_pluss_real_fans(nickName,logo,phone,soleId,aliConsum,wechatConsum,enableMerchantCode,enableTime) VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{nickName},#{logo},#{phone},#{soleId},#{aliConsum},#{wechatConsum},#{enableMerchantCode},#{enableTime} )
</foreach>
</insert>
<select id="queryRealFansPage" parameterType="java.util.Map" resultType="cn.pluss.platform.entity.RealFans">
SELECT * from tb_pluss_real_fans
<where>
<if test="id!= null">
and id = #{id}
</if>
<if test="nickName!= null and nickName!=''">
and nickName like CONCAT("%",#{nickName},"%")
</if>
<if test="logo!= null">
and logo = #{logo}
</if>
<if test="phone!= null and phone!=''">
and phone like CONCAT("%",#{phone},"%")
</if>
<if test="soleId!= null">
and soleId = #{soleId}
</if>
<if test="aliConsum!= null">
and aliConsum = #{aliConsum}
</if>
<if test="wechatConsum!= null">
and wechatConsum = #{wechatConsum}
</if>
<if test="enableMerchantCode!= null">
and enableMerchantCode = #{enableMerchantCode}
</if>
<if test="enableTime!= null">
and enableTime = #{enableTime}
</if>
</where>
order by id desc limit #{pageSize} offset #{offset}
</select>
<select id="queryRealFansPageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(*) from tb_pluss_real_fans
<where>
<if test="id!= null">
and id = #{id}
</if>
<if test="nickName!= null and nickName!=''">
and nickName like CONCAT("%",#{nickName},"%")
</if>
<if test="logo!= null">
and logo = #{logo}
</if>
<if test="phone!= null and phone!=''">
and phone like CONCAT("%",#{phone},"%")
</if>
<if test="soleId!= null">
and soleId = #{soleId}
</if>
<if test="aliConsum!= null">
and aliConsum = #{aliConsum}
</if>
<if test="wechatConsum!= null">
and wechatConsum = #{wechatConsum}
</if>
<if test="enableMerchantCode!= null">
and enableMerchantCode = #{enableMerchantCode}
</if>
<if test="enableTime!= null">
and enableTime = #{enableTime}
</if>
</where>
</select>
<select id="queryRealFansListManagePage" parameterType="java.util.Map" resultType="cn.pluss.platform.vo.RealFansVO">
select rf.id,mbi.alias,rf.nickName,rf.logo,rf.phone,rf.soleId,rf.aliConsum,rf.wechatConsum,mbi.merchantName as merchantName,rf.enableTime from tb_pluss_real_fans rf LEFT JOIN tb_pluss_merchant_base_info mbi ON rf.enableMerchantCode=mbi.merchantCode
<where>
<if test="phone!=null and phone!=''">
rf.phone like CONCAT("%",#{phone},"%")
</if>
<if test="alias!=null and alias!=''">
mbi.alias like CONCAT("%",#{alias},"%")
</if>
<if test="nickName!= null and nickName!=''">
and rf.nickName like CONCAT("%",#{nickName},"%")
</if>
<if test="merchantCode!=null and merchantCode!=''">
rf.enableMerchantCode=#{merchantCode}
</if>
<if test="startTime!= null and startTime!=''">
<![CDATA[
and DATE_FORMAT(enableTime, '%Y-%m-%d %H:%i:%S')>=DATE_FORMAT(#{startTime}, '%Y-%m-%d %H:%i:%S')
]]>
</if>
<if test="endTime!= null and endTime!=''">
<![CDATA[
and DATE_FORMAT(enableTime, '%Y-%m-%d %H:%i:%S')<=DATE_FORMAT(#{endTime}, '%Y-%m-%d %H:%i:%S')
]]>
</if>
<if test="merchantName!= null and merchantName!=''">
and mbi.merchantName like CONCAT("%",#{merchantName},"%")
</if>
</where>
</select>
<select id="queryRealFansListManagePageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
select count(*) from tb_pluss_real_fans rf LEFT JOIN tb_pluss_merchant_base_info mbi ON rf.enableMerchantCode=mbi.merchantCode
<where>
<if test="phone!=null and phone!=''">
rf.phone like CONCAT("%",#{phone},"%")
</if>
<if test="alias!=null and alias!=''">
mbi.alias like CONCAT("%",#{alias},"%")
</if>
<if test="nickName!= null and nickName!=''">
and rf.nickName like CONCAT("%",#{nickName},"%")
</if>
<if test="merchantCode!=null and merchantCode!=''">
rf.enableMerchantCode=#{merchantCode}
</if>
<if test="startTime!= null and startTime!=''">
<![CDATA[
and DATE_FORMAT(enableTime, '%Y-%m-%d %H:%i:%S')>=DATE_FORMAT(#{startTime}, '%Y-%m-%d %H:%i:%S')
]]>
</if>
<if test="endTime!= null and endTime!=''">
<![CDATA[
and DATE_FORMAT(enableTime, '%Y-%m-%d %H:%i:%S')<=DATE_FORMAT(#{endTime}, '%Y-%m-%d %H:%i:%S')
]]>
</if>
<if test="merchantName!= null and merchantName!=''">
and mbi.merchantName like CONCAT("%",#{merchantName},"%")
</if>
</where>
</select>
<select id="pageData" resultType="cn.pluss.platform.entity.RealFans">
select *,
mbi.alias
from tb_pluss_real_fans rf
left join tb_pluss_merchant_base_info mbi
on rf.enableMerchantCode = mbi.merchantCode
<where>
<if test="realFans.alias != null and realFans.alias != ''">
and mbi.alias like CONCAT('%',#{realFans.alias},'%')
</if>
<if test="realFans.nickName != null and realFans.nickName != ''">
and rf.nickName = #{realFans.nickName}
</if>
<if test="realFans.soleId != null and realFans.soleId != ''">
and rf.soleId = #{realFans.soleId}
</if>
<if test="realFans.startTime != null">
and DATE_FORMAT(rf.enableTime,'%Y-%m-%d') <![CDATA[ >= ]]> DATE_FORMAT(#{realFans.startTime},'%Y-%m-%d')
</if>
<if test="realFans.endTime != null">
and DATE_FORMAT(rf.enableTime,'%Y-%m-%d') <![CDATA[ <= ]]> DATE_FORMAT(#{realFans.endTime},'%Y-%m-%d')
</if>
</where>
order by enableTime desc
</select>
</mapper>