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

274 lines
8.3 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.ActivityRechargeMapper">
<insert id="saveActivityRechargeBatch">
insert into tb_pluss_activity_recharge(userId,merchantCode,merchantName,rechargeMoney,giveMoney,startDt,endDt,name,createDt,timeType,storeId,storeName) VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{userId},#{merchantCode},#{merchantName},#{rechargeMoney},#{giveMoney},#{startDt},#{endDt},#{name},#{createDt},#{timeType},#{storeId},#{storeName} )
</foreach>
</insert>
<select id="queryActivityRechargeList" parameterType="cn.pluss.platform.entity.ActivityRecharge" resultType="cn.pluss.platform.entity.ActivityRecharge">
SELECT * from tb_pluss_activity_recharge
<where>
<if test="id!= null">
and id = #{id}
</if>
<if test="userId!= null">
and userId = #{userId}
</if>
<if test="merchantCode!= null">
and merchantCode = #{merchantCode}
</if>
<if test="merchantName!= null">
and merchantName = #{merchantName}
</if>
<if test="rechargeMoney!= null">
and rechargeMoney = #{rechargeMoney}
</if>
<if test="giveMoney!= null">
and giveMoney = #{giveMoney}
</if>
<if test="startDt!= null">
and startDt = #{startDt}
</if>
<if test="endDt!= null">
and endDt = #{endDt}
</if>
<if test="name!= null">
and name = #{name}
</if>
<if test="startDt!= null">
AND startDt <![CDATA[>=]]>#{startDt}
</if>
<if test="endDt!= null">
AND endDt <![CDATA[<=]]>#{endDt}
</if>
<if test="storeId!= null">
and storeId = #{storeId}
</if>
<if test="storeName!= null">
and storeName = #{storeName}
</if>
<if test="posterUrl!= null">
and posterUrl = #{posterUrl}
</if>
</where>
order by id desc
</select>
<select id="queryActivityRechargePage" parameterType="java.util.Map" resultType="cn.pluss.platform.entity.ActivityRecharge">
SELECT * from tb_pluss_activity_recharge
<where>
<if test="id!= null">
and id = #{id}
</if>
<if test="userId!= null">
and userId = #{userId}
</if>
<if test="merchantCode!= null">
and merchantCode = #{merchantCode}
</if>
<if test="merchantName!= null">
and merchantName = #{merchantName}
</if>
<if test="rechargeMoney!= null">
and rechargeMoney = #{rechargeMoney}
</if>
<if test="giveMoney!= null">
and giveMoney = #{giveMoney}
</if>
<if test="startDt!= null">
AND startDt <![CDATA[>=]]>#{startDt}
</if>
<if test="endDt!= null">
AND endDt <![CDATA[<=]]>#{endDt}
</if>
<if test="name!= null and name!=''">
and name like CONCAT("%",#{name},"%")
</if>
<if test="createDt!= null">
and createDt = #{createDt}
</if>
<if test="timeType!= null">
and timeType = #{timeType}
</if>
<if test="storeId!= null">
and storeId = #{storeId}
</if>
<if test="storeName!= null">
and storeName = #{storeName}
</if>
<if test="posterUrl!= null">
and posterUrl = #{posterUrl}
</if>
</where>
order by id desc limit #{pageSize} offset #{offset}
</select>
<select id="queryActivityNoRechargePage" parameterType="java.util.Map" resultType="cn.pluss.platform.entity.ActivityRecharge">
SELECT * from tb_pluss_activity_recharge
<where>
<if test="id!= null">
and id = #{id}
</if>
<if test="userId!= null">
and userId = #{userId}
</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="rechargeMoney!= null">
and rechargeMoney = #{rechargeMoney}
</if>
<if test="giveMoney!= null">
and giveMoney = #{giveMoney}
</if>
<if test="startDt!= null">
AND startDt <![CDATA[>=]]>#{startDt}
</if>
<if test="endDt!= null">
AND endDt <![CDATA[<=]]>#{endDt}
</if>
<if test="name!= null and name!=''">
and name like CONCAT("%",#{name},"%")
</if>
<if test="createDt!= null">
and createDt = #{createDt}
</if>
<if test="timeType!= null">
and timeType = #{timeType}
</if>
<if test="storeId!= null">
and storeId = #{storeId}
</if>
<if test="storeName!= null">
and storeName = #{storeName}
</if>
<if test="posterUrl!= null">
and posterUrl = #{posterUrl}
</if>
</where>
order by id desc limit #{pageSize} offset #{offset}
</select>
<select id="queryActivityRechargePageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(*) from tb_pluss_activity_recharge
<where>
<if test="id!= null">
and id = #{id}
</if>
<if test="userId!= null">
and userId = #{userId}
</if>
<if test="merchantCode!= null">
and merchantCode = #{merchantCode}
</if>
<if test="merchantName!= null">
and merchantName = #{merchantName}
</if>
<if test="rechargeMoney!= null">
and rechargeMoney = #{rechargeMoney}
</if>
<if test="giveMoney!= null">
and giveMoney = #{giveMoney}
</if>
<if test="startDt!= null">
AND startDt <![CDATA[>=]]>#{startDt}
</if>
<if test="endDt!= null">
AND endDt <![CDATA[<=]]>#{endDt}
</if>
<if test="name!= null and name!=''">
and name = #{name}
</if>
<if test="createDt!= null">
and createDt = #{createDt}
</if>
<if test="timeType!= null">
and timeType = #{timeType}
</if>
<if test="storeId!= null">
and storeId = #{storeId}
</if>
<if test="storeName!= null">
and storeName = #{storeName}
</if>
<if test="posterUrl!= null">
and posterUrl = #{posterUrl}
</if>
</where>
</select>
<select id="queryActivityNoRechargePageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(*) from tb_pluss_activity_recharge
<where>
<if test="id!= null">
and id = #{id}
</if>
<if test="userId!= null">
and userId = #{userId}
</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="rechargeMoney!= null">
and rechargeMoney = #{rechargeMoney}
</if>
<if test="giveMoney!= null">
and giveMoney = #{giveMoney}
</if>
<if test="startDt!= null">
AND startDt <![CDATA[>=]]>#{startDt}
</if>
<if test="endDt!= null">
AND endDt <![CDATA[<=]]>#{endDt}
</if>
<if test="name!= null and name!=''">
and name = #{name}
</if>
<if test="createDt!= null">
and createDt = #{createDt}
</if>
<if test="timeType!= null">
and timeType = #{timeType}
</if>
<if test="storeId!= null">
and storeId = #{storeId}
</if>
<if test="storeName!= null">
and storeName = #{storeName}
</if>
<if test="posterUrl!= null">
and posterUrl = #{posterUrl}
</if>
</where>
</select>
<select id="queryUsableActivityRechageList" parameterType="cn.pluss.platform.entity.ActivityRecharge" resultType="cn.pluss.platform.entity.ActivityRecharge">
(SELECT * FROM tb_pluss_activity_recharge
WHERE merchantCode = #{merchantCode} and storeId = #{storeId} and timeType = '0') UNION All
(SELECT * FROM tb_pluss_activity_recharge
WHERE merchantCode = #{merchantCode} and timeType = '1' and DATE_FORMAT(startDt,'%Y-%m-%d') <![CDATA[<=]]> DATE_FORMAT(NOW(),'%Y-%m-%d') and DATE_FORMAT(endDt,'%Y-%m-%d') <![CDATA[>=]]> DATE_FORMAT(NOW(),'%Y-%m-%d') )
</select>
</mapper>