Files
gxtyzx-java/modules/shop/mapper/xml/MerchantMapper.xml
T
2024-08-13 17:51:18 +08:00

112 lines
4.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="com.gxwebsoft.shop.mapper.MerchantMapper">
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM shop_merchant a
<where>
<if test="param.merchantId != null">
AND a.merchant_id = #{param.merchantId}
</if>
<if test="param.merchantName != null">
AND a.merchant_name LIKE CONCAT('%', #{param.merchantName}, '%')
</if>
<if test="param.merchantCode != null">
AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%')
</if>
<if test="param.type != null">
AND a.type = #{param.type}
</if>
<if test="param.image != null">
AND a.image LIKE CONCAT('%', #{param.image}, '%')
</if>
<if test="param.phone != null">
AND a.phone LIKE CONCAT('%', #{param.phone}, '%')
</if>
<if test="param.realName != null">
AND a.real_name LIKE CONCAT('%', #{param.realName}, '%')
</if>
<if test="param.shopType != null">
AND a.shop_type LIKE CONCAT('%', #{param.shopType}, '%')
</if>
<if test="param.itemType != null">
AND a.item_type LIKE CONCAT('%', #{param.itemType}, '%')
</if>
<if test="param.category != null">
AND a.category LIKE CONCAT('%', #{param.category}, '%')
</if>
<if test="param.commission != null">
AND a.commission = #{param.commission}
</if>
<if test="param.keywords != null">
AND a.keywords LIKE CONCAT('%', #{param.keywords}, '%')
</if>
<if test="param.files != null">
AND a.files LIKE CONCAT('%', #{param.files}, '%')
</if>
<if test="param.ownStore != null">
AND a.own_store = #{param.ownStore}
</if>
<if test="param.recommend != null">
AND a.recommend = #{param.recommend}
</if>
<if test="param.goodsReview != null">
AND a.goods_review = #{param.goodsReview}
</if>
<if test="param.comments != null">
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
</if>
<if test="param.status != null">
AND a.status = #{param.status}
</if>
<if test="param.deleted != null">
AND a.deleted = #{param.deleted}
</if>
<if test="param.deleted == null">
AND a.deleted = 0
</if>
<if test="param.sortNumber != null">
AND a.sort_number = #{param.sortNumber}
</if>
<if test="param.createTimeStart != null">
AND a.create_time &gt;= #{param.createTimeStart}
</if>
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.merchantIds != null">
AND a.merchant_id IN
<foreach collection="param.merchantIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="param.merchantCodes != null">
AND a.merchant_code IN
<foreach collection="param.merchantCodes" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="param.keywords != null">
AND (
a.merchant_name LIKE CONCAT('%', #{param.keywords}, '%')
OR a.phone LIKE CONCAT('%', #{param.keywords}, '%')
OR a.real_name LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
</where>
</sql>
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.shop.entity.Merchant">
<include refid="selectSql"></include>
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.shop.entity.Merchant">
<include refid="selectSql"></include>
</select>
</mapper>