<?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.ShopOrderCartInfoMapper">

    <!-- 关联查询sql -->
    <sql id="selectSql">
        SELECT a.*
        FROM shop_order_cart_info a
        <where>
            <if test="param.id != null">
                AND a.id = #{param.id}
            </if>
            <if test="param.oid != null">
                AND a.oid LIKE CONCAT('%', #{param.oid}, '%')
            </if>
            <if test="param.orderId != null">
                AND a.order_id LIKE CONCAT('%', #{param.orderId}, '%')
            </if>
            <if test="param.cartId != null">
                AND a.cart_id LIKE CONCAT('%', #{param.cartId}, '%')
            </if>
            <if test="param.productId != null">
                AND a.product_id LIKE CONCAT('%', #{param.productId}, '%')
            </if>
            <if test="param.cartInfo != null">
                AND a.cart_info LIKE CONCAT('%', #{param.cartInfo}, '%')
            </if>
            <if test="param.unique != null">
                AND a.unique LIKE CONCAT('%', #{param.unique}, '%')
            </if>
            <if test="param.isAfterSales != null">
                AND a.is_after_sales = #{param.isAfterSales}
            </if>
        </where>
    </sql>

    <!-- 分页查询 -->
    <select id="selectPageRel" resultType="com.gxwebsoft.shop.entity.ShopOrderCartInfo">
        <include refid="selectSql"></include>
    </select>

    <!-- 查询全部 -->
    <select id="selectListRel" resultType="com.gxwebsoft.shop.entity.ShopOrderCartInfo">
        <include refid="selectSql"></include>
    </select>

</mapper>
