57 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			XML
		
	
		
		
			
		
	
	
			57 lines
		
	
	
		
			2.0 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.hcy.common.mapper.goods.GoodsMapper"> | ||
|  |     <!-- 通用查询映射结果 --> | ||
|  |     <resultMap id="BaseResultMap" type="com.hcy.common.dto.goods.GoodsDto"> | ||
|  |     </resultMap> | ||
|  | 
 | ||
|  |     <select id="getCouponCorrelationGoods" resultType="com.hcy.common.dto.goods.GoodsDto"> | ||
|  |         SELECT | ||
|  |             *, | ||
|  |             gc.`name` AS categoryName | ||
|  |         FROM | ||
|  |             la_goods AS g | ||
|  |                 LEFT JOIN la_goods_category AS gc ON gc.id = g.category_id | ||
|  |         WHERE | ||
|  |             g.is_delete = 0 | ||
|  |           AND g.id IN ( | ||
|  |             SELECT | ||
|  |                 goods_id | ||
|  |             FROM | ||
|  |                 la_goods_coupon | ||
|  |             WHERE | ||
|  |                 is_delete = 0 | ||
|  |             AND status = 1 | ||
|  |             AND coupon_id =  #{couponId}) | ||
|  |     </select> | ||
|  | 
 | ||
|  |     <select id="getGoodsCancelOrderList" resultType="com.hcy.common.dto.goods.GoodsDto"> | ||
|  |         SELECT | ||
|  |             g.*, | ||
|  |             coc.id AS cancelOrderId | ||
|  |         FROM | ||
|  |             la_goods AS g | ||
|  |             LEFT JOIN ( SELECT GROUP_CONCAT( DISTINCT goods_id ) AS goods_id, id FROM la_cancel_order_config GROUP BY goods_id) AS coc ON coc.goods_id = g.id | ||
|  |         <where> | ||
|  |             g.is_delete = 0 | ||
|  |             AND g.status = 1 | ||
|  |             <if test="param.name != null and param.name != ''"> | ||
|  |                 AND g.name like concat('%', #{param.name}, '%') | ||
|  |             </if> | ||
|  |             <if test="param.categoryId != null"> | ||
|  |                 AND g.category_id = #{param.categoryId} | ||
|  |             </if> | ||
|  |             <if test="param.isSetRefund != null"> | ||
|  |                 <choose> | ||
|  |                     <when test="param.isSetRefund == 0"> | ||
|  |                         AND coc.id is null | ||
|  |                     </when> | ||
|  |                     <otherwise> | ||
|  |                         AND coc.id is not null | ||
|  |                     </otherwise> | ||
|  |                 </choose> | ||
|  |             </if> | ||
|  |         </where> | ||
|  |     </select> | ||
|  | </mapper> |