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

62 lines
2.8 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.MerchantQrcodeMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.pluss.platform.entity.MerchantQrcode">
<id column="id" property="id"/>
<result column="merchantCode" property="merchantCode"/>
<result column="merchantName" property="merchantName"/>
<result column="qrCodeUrl" property="qrCodeUrl"/>
<result column="createTime" property="createTime"/>
<result column="updateTime" property="updateTime"/>
</resultMap>
<select id="listPage" resultType="cn.pluss.platform.entity.MerchantQrcode" parameterType="java.util.Map">
SELECT mq.id,ua.userId,mq.merchantCode,mg.`name`,mg.`status`,mq.merchantName,mq.qrCodeUrl,mq.createTime,mq.updateTime
FROM tb_pluss_merchant_qrcode mq
LEFT JOIN tb_pluss_merchant_guide mg ON mq.merchantCode = mg.merchantCode
LEFT JOIN tb_pluss_user_app ua ON mq.merchantCode = ua.merchantCode
<where>
ua.userType = 'promoter'
<if test="userId != null and userId != ''">
and ua.userId = #{userId}
</if>
<if test="merchantName != null and merchantName != ''">
and mq.merchantName = #{merchantName}
</if>
<if test="name != null and name != ''">
and mg.name like concat("%",#{name},"%")
</if>
</where>
order by mq.createTime desc limit #{pageSize} offset #{offset}
</select>
<select id="countMerchantQrcode" resultType="java.lang.Integer" parameterType="java.util.Map">
select count(*)
FROM tb_pluss_merchant_qrcode mq
LEFT JOIN tb_pluss_merchant_guide mg ON mq.merchantCode = mg.merchantCode
LEFT JOIN tb_pluss_user_app ua ON mq.merchantCode = ua.merchantCode
<where>
ua.userType = 'promoter'
<if test="userId != null and userId != ''">
and ua.userId = #{userId}
</if>
<if test="merchantName != null and merchantName != ''">
and mq.merchantName = #{merchantName}
</if>
<if test="name != null and name != ''">
and mg.name like concat("%",#{name},"%")
</if>
</where>
</select>
<select id="selectPage" resultType="cn.pluss.platform.entity.MerchantQrcode">
SELECT mq.id,ua.userId,mq.merchantCode,mg.`name`,mg.`status`,mq.merchantName,mq.qrCodeUrl,mq.createTime,mq.updateTime
FROM tb_pluss_merchant_qrcode mq
LEFT JOIN tb_pluss_merchant_guide mg ON mq.merchantCode = mg.merchantCode
LEFT JOIN tb_pluss_user_app ua ON mq.merchantCode = ua.merchantCode
${ew.customSqlSegment}
</select>
</mapper>