76 lines
2.8 KiB
XML
76 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="com.gxwebsoft.shop.mapper.CartMapper">
|
|
|
|
<!-- 关联查询sql -->
|
|
<sql id="selectSql">
|
|
SELECT a.*,b.goods_name,b.image,c.merchant_name,c.address
|
|
FROM shop_cart a
|
|
LEFT JOIN shop_goods b ON a.goods_id = b.goods_id
|
|
LEFT JOIN shop_merchant c ON a.merchant_id = c.merchant_id
|
|
<where>
|
|
<if test="param.id != null">
|
|
AND a.id = #{param.id}
|
|
</if>
|
|
<if test="param.type != null">
|
|
AND a.type = #{param.type}
|
|
</if>
|
|
<if test="param.goodsId != null">
|
|
AND a.goods_id LIKE CONCAT('%', #{param.goodsId}, '%')
|
|
</if>
|
|
<if test="param.code != null">
|
|
AND a.code LIKE CONCAT('%', #{param.code}, '%')
|
|
</if>
|
|
<if test="param.cartNum != null">
|
|
AND a.cart_num = #{param.cartNum}
|
|
</if>
|
|
<if test="param.isPay != null">
|
|
AND a.is_pay = #{param.isPay}
|
|
</if>
|
|
<if test="param.isNew != null">
|
|
AND a.is_new = #{param.isNew}
|
|
</if>
|
|
<if test="param.combinationId != null">
|
|
AND a.combination_id = #{param.combinationId}
|
|
</if>
|
|
<if test="param.seckillId != null">
|
|
AND a.seckill_id = #{param.seckillId}
|
|
</if>
|
|
<if test="param.bargainId != null">
|
|
AND a.bargain_id = #{param.bargainId}
|
|
</if>
|
|
<if test="param.userId != null">
|
|
AND a.user_id LIKE CONCAT('%', #{param.userId}, '%')
|
|
</if>
|
|
<if test="param.adminId != null">
|
|
AND a.admin_id LIKE CONCAT('%', #{param.adminId}, '%')
|
|
</if>
|
|
<if test="param.selected != null">
|
|
AND a.selected = #{param.selected}
|
|
</if>
|
|
<if test="param.createTimeStart != null">
|
|
AND a.create_time >= #{param.createTimeStart}
|
|
</if>
|
|
<if test="param.createTimeEnd != null">
|
|
AND a.create_time <= #{param.createTimeEnd}
|
|
</if>
|
|
<if test="param.keywords != null">
|
|
AND (c.merchant_name LIKE CONCAT('%', #{param.keywords}, '%')
|
|
OR b.goods_name LIKE CONCAT('%', #{param.keywords}, '%')
|
|
)
|
|
</if>
|
|
</where>
|
|
</sql>
|
|
|
|
<!-- 分页查询 -->
|
|
<select id="selectPageRel" resultType="com.gxwebsoft.shop.entity.Cart">
|
|
<include refid="selectSql"></include>
|
|
</select>
|
|
|
|
<!-- 查询全部 -->
|
|
<select id="selectListRel" resultType="com.gxwebsoft.shop.entity.Cart">
|
|
<include refid="selectSql"></include>
|
|
</select>
|
|
|
|
</mapper>
|