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

325 lines
11 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.MerchantMenberComsumeMapper">
<insert id="saveMerchantMenberComsume" parameterType="cn.pluss.platform.entity.MerchantMenberComsume">
insert into tb_pluss_merchant_menber_comsume(merchantCode,merchantName,storeId,storeName,createDt,logo,memberCode,nickName,phone,comsumeMoney,payType,giveMoney,orderNumber)VALUES(#{merchantCode},#{merchantName},#{storeId},#{storeName},#{createDt},#{logo},#{memberCode},#{nickName},#{phone},#{comsumeMoney},#{payType},#{giveMoney},#{orderNumber})
</insert>
<insert id="saveMerchantMenberComsumeBatch">
insert into tb_pluss_merchant_menber_comsume(merchantCode,merchantName,storeId,storeName,createDt,logo,memberCode,nickName,phone,comsumeMoney,payType,giveMoney) VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{merchantCode},#{merchantName},#{storeId},#{storeName},#{createDt},#{logo},#{memberCode},#{nickName},#{phone},#{comsumeMoney},#{payType},#{giveMoney} )
</foreach>
</insert>
<select id="queryMerchantMenberComsume" parameterType="cn.pluss.platform.entity.MerchantMenberComsume" resultType="cn.pluss.platform.entity.MerchantMenberComsume">
SELECT mc.*,mbi.alias from tb_pluss_merchant_menber_comsume mc LEFT JOIN tb_pluss_merchant_base_info mbi on mbi.merchantCode= mc.merchantCode
<where>
<if test="id!= null">
and mc.id = #{id}
</if>
<if test="alias!= null">
and mbi.alias = #{alias}
</if>
<if test="merchantCode!= null">
and mc.merchantCode = #{merchantCode}
</if>
<if test="merchantName!= null">
and mc.merchantName = #{merchantName}
</if>
<if test="storeId!= null">
and mc.storeId = #{storeId}
</if>
<if test="storeName!= null">
and mc.storeName = #{storeName}
</if>
<if test="createDt!= null">
and mc.createDt = #{createDt}
</if>
<if test="logo!= null">
and mc.logo = #{logo}
</if>
<if test="memberCode!= null">
and mc.memberCode = #{memberCode}
</if>
<if test="nickName!= null">
and mc.nickName = #{nickName}
</if>
<if test="phone!= null">
and mc.phone = #{phone}
</if>
<if test="comsumeMoney!= null">
and mc.comsumeMoney = #{comsumeMoney}
</if>
<if test="payType!= null">
and mc.payType = #{payType}
</if>
<if test="giveMoney!= null">
and mc.giveMoney = #{giveMoney}
</if>
<if test="orderNumber!= null">
and mc.orderNumber = #{orderNumber}
</if>
</where>
</select>
<select id="queryMerchantMenberComsumeList" parameterType="cn.pluss.platform.entity.MerchantMenberComsume" resultType="cn.pluss.platform.entity.MerchantMenberComsume">
SELECT * from tb_pluss_merchant_menber_comsume
<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="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="comsumeMoney!= null">
and comsumeMoney = #{comsumeMoney}
</if>
<if test="payType!= null">
and payType = #{payType}
</if>
<if test="giveMoney!= null">
and giveMoney = #{giveMoney}
</if>
<if test="orderNumber!= null">
and orderNumber = #{orderNumber}
</if>
</where>
</select>
<update id="updateMerchantMenberComsume" parameterType="cn.pluss.platform.entity.MerchantMenberComsume" >
update tb_pluss_merchant_menber_comsume
<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="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="comsumeMoney!= null">
comsumeMoney = #{comsumeMoney},
</if>
<if test="payType!= null">
payType = #{payType},
</if>
<if test="giveMoney!= null">
giveMoney = #{giveMoney}
</if>
<if test="orderNumber!= null">
orderNumber = #{orderNumber}
</if>
</set>
where id=#{id}
</update>
<delete id="deleteMerchantMenberComsume" parameterType="cn.pluss.platform.entity.MerchantMenberComsume" >
DELETE FROM tb_pluss_merchant_menber_comsume where id=#{id}
</delete>
<select id="queryMerchantMenberComsumePage" parameterType="java.util.Map" resultType="cn.pluss.platform.entity.MerchantMenberComsume">
SELECT mc.*,mbi.alias from tb_pluss_merchant_menber_comsume mc LEFT JOIN tb_pluss_merchant_base_info mbi on mbi.merchantCode= mc.merchantCode
<where>
<if test="id!= null">
and mc.id = #{id}
</if>
<if test="alias!= null">
and mbi.alias LIKE concat("%", #{alias},"%")
</if>
<if test="merchantCode!= null">
and mc.merchantCode = #{merchantCode}
</if>
<if test="merchantName!= null">
and mc.merchantName = #{merchantName}
</if>
<if test="storeId!= null">
and mc.storeId = #{storeId}
</if>
<if test="storeName!= null">
and mc.storeName = #{storeName}
</if>
<if test="createDt!= null">
and mc.createDt = #{createDt}
</if>
<if test="logo!= null">
and mc.logo = #{logo}
</if>
<if test="memberCode!= null">
and mc.memberCode = #{memberCode}
</if>
<if test="nickName!= null">
and mc.nickName like CONCAT("%",#{nickName},"%")
</if>
<if test="phone!= null">
and mc.phone like CONCAT("%",#{phone},"%")
</if>
<if test="comsumeMoney!= null">
and mc.comsumeMoney = #{comsumeMoney}
</if>
<if test="payType!= null">
and mc.payType = #{payType}
</if>
<if test="giveMoney!= null">
and mc.giveMoney = #{giveMoney}
</if>
<if test="orderNumber!= null">
and mc.orderNumber = #{orderNumber}
</if>
</where>
order by id desc limit #{pageSize} offset #{offset}
</select>
<!-- 根据时间查询消费金额 -->
<select id="queryMerchantMenberComsumeByTime" parameterType="java.util.Map" resultType="cn.pluss.platform.entity.MerchantMenberComsume">
SELECT Sum(comsumeMoney) from tb_pluss_merchant_menber_comsume
<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="createDt!= null">
and createDt = #{createDt}
</if>
<if test="logo!= null">
and logo = #{logo}
</if>
<if test="memberCode!= null">
and memberCode = #{memberCode}
</if>
<if test="orderNumber!= null">
and orderNumber = #{orderNumber}
</if>
<if test="nickName!= null">
and nickName like CONCAT("%",#{nickName},"%")
</if>
<if test="phone!= null">
and phone like CONCAT("%",#{phone},"%")
</if>
<if test="comsumeMoney!= null">
and comsumeMoney = #{comsumeMoney}
</if>
<if test="payType!= null">
and payType = #{payType}
</if>
<if test="giveMoney!= null">
and giveMoney = #{giveMoney}
</if>
<if test="startTime!= null">
and createDt &gt;= #{startTime}
</if>
</where>
and createDt &lt;= #{endTime}
</select>
<select id="queryMerchantMenberComsumePageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(*) from tb_pluss_merchant_menber_comsume mc LEFT JOIN tb_pluss_merchant_base_info mbi on mbi.merchantCode= mc.merchantCode
<where>
<if test="id!= null">
and mc.id = #{id}
</if>
<if test="alias!= null">
and mbi.alias concat("%", #{alias},"%")
</if>
<if test="merchantCode!= null">
and mc.merchantCode = #{merchantCode}
</if>
<if test="merchantName!= null">
and mc.merchantName = #{merchantName}
</if>
<if test="storeId!= null">
and mc.storeId = #{storeId}
</if>
<if test="storeName!= null">
and mc.storeName = #{storeName}
</if>
<if test="createDt!= null">
and mc.createDt = #{createDt}
</if>
<if test="logo!= null">
and mc.logo = #{logo}
</if>
<if test="memberCode!= null">
and mc.memberCode = #{memberCode}
</if>
<if test="nickName!= null">
and mc.nickName like CONCAT("%",#{nickName},"%")
</if>
<if test="phone!= null">
and mc.phone like CONCAT("%",#{phone},"%")
</if>
<if test="comsumeMoney!= null">
and mc.comsumeMoney = #{comsumeMoney}
</if>
<if test="payType!= null">
and mc.payType = #{payType}
</if>
<if test="giveMoney!= null">
and mc.giveMoney = #{giveMoney}
</if>
<if test="orderNumber!= null">
and mc.orderNumber = #{orderNumber}
</if>
</where>
</select>
</mapper>