| | |
| | | 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 |
| | | 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} |
| | | 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 |
| | | WHEN `inventory` = 0 THEN 0 |
| | | ELSE 1 |
| | | END DESC, |
| | | `redeemPoints` ASC |
| | | </select> |