<?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.ruoyi.other.mapper.TGoodsMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.ruoyi.other.api.domain.TGoods">
|
<id column="id" property="id" />
|
<result column="type" property="type" />
|
<result column="name" property="name" />
|
<result column="cover_picture" property="coverPicture" />
|
<result column="details_picture" property="detailsPicture" />
|
<result column="dispatch_address" property="dispatchAddress" />
|
<result column="service_description" property="serviceDescription" />
|
<result column="original_price" property="originalPrice" />
|
<result column="preferential_price" property="preferentialPrice" />
|
<result column="vip_price" property="vipPrice" />
|
<result column="redeem_points" property="redeemPoints" />
|
<result column="limit_exchange_times" property="limitExchangeTimes" />
|
<result column="inventory" property="inventory" />
|
<result column="underlying_sales" property="underlyingSales" />
|
<result column="describe" property="describe" />
|
<result column="introduce" property="introduce" />
|
<result column="explain" property="explain" />
|
<result column="status" property="status" />
|
<result column="create_time" property="createTime" />
|
<result column="del_flag" property="delFlag" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, type, name, cover_picture, details_picture, dispatch_address, service_description, original_price, preferential_price, vip_price, redeem_points, limit_exchange_times, inventory, underlying_sales, describe, introduce, explain, status, create_time, del_flag
|
</sql>
|
<select id="pageList" resultType="com.ruoyi.other.api.domain.TGoods">
|
select * from t_goods
|
<where>
|
<if test="req.name != null and req.name != ''">
|
AND `name` LIKE concat('%',#{req.name}, '%')
|
</if>
|
<if test="req.type != null">
|
AND `type` = #{req.type}
|
</if>
|
<if test="req.status != null">
|
AND status = #{req.status}
|
</if>
|
<if test="req.otherState != null and req.otherState == 2">
|
AND inventory = 0
|
</if>
|
<if test="req.otherState != null and req.otherState ==3">
|
AND status = 2
|
</if>
|
AND del_flag = ${@com.ruoyi.common.core.enums.DelFlagEnum@NO.getCode()}
|
</where>
|
ORDER BY create_time DESC
|
</select>
|
|
<select id="pageList1" resultType="com.ruoyi.other.api.domain.TGoods">
|
SELECT
|
id,name,redeem_points as redeemPoints,inventory,original_price as originalPrice ,preferential_price as preferentialPrice,vip_price as vipPrice,1 as goodType,cover_picture as coverPicture,underlying_sales as underlyingSales
|
FROM
|
t_goods
|
WHERE `status` = 1 and del_flag = 0 and type = #{appGoodQuery.type}
|
UNION ALL
|
SELECT
|
id,
|
NAME,
|
redeem_points AS redeemPoints,
|
inventory_quantity AS inventory,
|
payment_amount AS originalPrice,
|
payment_amount AS preferentiaPrice,
|
vip_payment_amount AS vipPrice,
|
2 AS goodType,
|
cover_picture AS coverPicture,
|
0 AS underlyingSales
|
FROM
|
t_coupon
|
WHERE
|
`status` = 1
|
AND del_flag = 0 and ways_to_obtain != #{appGoodQuery.type}
|
AND (
|
validity_period_mode != 1
|
OR (validity_period_mode = 1 AND end_time >= NOW())
|
)
|
ORDER BY
|
CASE
|
WHEN `inventory` = 0 THEN 0
|
ELSE 1
|
END DESC,
|
`redeemPoints` ASC
|
</select>
|
|
</mapper>
|