|
@@ -122,7 +122,16 @@
|
|
|
<if test="cpId != null">
|
|
<if test="cpId != null">
|
|
|
AND tmgs.cp_id = #{cpId}
|
|
AND tmgs.cp_id = #{cpId}
|
|
|
</if>
|
|
</if>
|
|
|
-
|
|
|
|
|
|
|
+ <if test="brandIds != null">
|
|
|
|
|
+ AND EXISTS (
|
|
|
|
|
+ SELECT 1
|
|
|
|
|
+ FROM unnest(string_to_array(#{brandIds}, ',')) AS brand_uuid
|
|
|
|
|
+ WHERE brand_uuid::uuid = tmgs.brand_id
|
|
|
|
|
+ )
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="searchText !=null">
|
|
|
|
|
+ AND ( tmgs.sku_name LIKE concat('%', #{searchText}, '%')
|
|
|
|
|
+ </if>
|
|
|
</where>
|
|
</where>
|
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
|
@@ -138,11 +147,20 @@
|
|
|
<select id="selectByCond" resultMap="BaseResultMapResponse">
|
|
<select id="selectByCond" resultMap="BaseResultMapResponse">
|
|
|
SELECT
|
|
SELECT
|
|
|
<include refid="Base_Column_List_JOIN"/>
|
|
<include refid="Base_Column_List_JOIN"/>
|
|
|
- ,tmgb.brand_name AS "brandName",tmgsr.series_name AS "seriesName"
|
|
|
|
|
|
|
+ ,tmgb.brand_name AS "brandName",tmgsr.series_name AS "seriesName",tpi.usable_qty AS "usableQty"
|
|
|
FROM dkic_b.t_mst_goods_sku tmgs
|
|
FROM dkic_b.t_mst_goods_sku tmgs
|
|
|
LEFT JOIN dkic_b.t_mst_goods_brand tmgb ON tmgb.brand_id = tmgs.brand_id
|
|
LEFT JOIN dkic_b.t_mst_goods_brand tmgb ON tmgb.brand_id = tmgs.brand_id
|
|
|
LEFT JOIN dkic_b.t_mst_goods_series tmgsr ON tmgsr.series_id = tmgs.series_id
|
|
LEFT JOIN dkic_b.t_mst_goods_series tmgsr ON tmgsr.series_id = tmgs.series_id
|
|
|
|
|
+ LEFT JOIN dkic_b.t_psi_inventory tpi ON tpi.sku_id = tmgs.sku_id
|
|
|
<include refid="Condition"/>
|
|
<include refid="Condition"/>
|
|
|
|
|
+ ORDER BY CASE
|
|
|
|
|
+ WHEN #{sort} = 2 THEN tpi.usable_qty
|
|
|
|
|
+ ELSE NULL
|
|
|
|
|
+ END ASC,
|
|
|
|
|
+ CASE
|
|
|
|
|
+ WHEN #{sort} != 2 THEN tpi.usable_qty
|
|
|
|
|
+ ELSE NULL
|
|
|
|
|
+ END DESC
|
|
|
<if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
<if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
limit #{end} offset #{start}
|
|
limit #{end} offset #{start}
|
|
|
</if>
|
|
</if>
|