|
@@ -8,8 +8,14 @@
|
|
g.uid uid,
|
|
g.uid uid,
|
|
gc.id category_id,
|
|
gc.id category_id,
|
|
gc.category_name category_name,
|
|
gc.category_name category_name,
|
|
|
|
+
|
|
COALESCE(g.brand_id, -1) brand_id,
|
|
COALESCE(g.brand_id, -1) brand_id,
|
|
|
|
+ COALESCE(gb.brand_name, '') brand_name,
|
|
|
|
+ COALESCE(gb.brand_name_en, '') brand_name_en,
|
|
COALESCE(g.unit_id, -1) unit_id,
|
|
COALESCE(g.unit_id, -1) unit_id,
|
|
|
|
+ COALESCE(gu.unit_name, '') unit_name,
|
|
|
|
+ COALESCE(gu.unit_name_en, '') unit_name_en,
|
|
|
|
+
|
|
COALESCE(g.good_thumb, '') good_thumb,
|
|
COALESCE(g.good_thumb, '') good_thumb,
|
|
COALESCE(g.good_images, '') good_images,
|
|
COALESCE(g.good_images, '') good_images,
|
|
gt.good_name good_name,
|
|
gt.good_name good_name,
|
|
@@ -26,8 +32,14 @@
|
|
g.uid uid,
|
|
g.uid uid,
|
|
gc.id category_id,
|
|
gc.id category_id,
|
|
gc.category_name category_name,
|
|
gc.category_name category_name,
|
|
|
|
+
|
|
COALESCE(g.brand_id, -1) brand_id,
|
|
COALESCE(g.brand_id, -1) brand_id,
|
|
|
|
+ COALESCE(gb.brand_name, '') brand_name,
|
|
|
|
+ COALESCE(gb.brand_name_en, '') brand_name_en,
|
|
COALESCE(g.unit_id, -1) unit_id,
|
|
COALESCE(g.unit_id, -1) unit_id,
|
|
|
|
+ COALESCE(gu.unit_name, '') unit_name,
|
|
|
|
+ COALESCE(gu.unit_name_en, '') unit_name_en,
|
|
|
|
+
|
|
COALESCE(g.good_thumb, '') good_thumb,
|
|
COALESCE(g.good_thumb, '') good_thumb,
|
|
COALESCE(g.good_images, '') good_images,
|
|
COALESCE(g.good_images, '') good_images,
|
|
g.status status,
|
|
g.status status,
|
|
@@ -49,9 +61,10 @@
|
|
<sql id="leftJoinCategory">
|
|
<sql id="leftJoinCategory">
|
|
LEFT JOIN b2c_good_category_i18n gc ON gc.good_category_id = g.category_id AND gc.language = #{lang}
|
|
LEFT JOIN b2c_good_category_i18n gc ON gc.good_category_id = g.category_id AND gc.language = #{lang}
|
|
</sql>
|
|
</sql>
|
|
- <sql id="leftJoinTranslations">
|
|
|
|
- LEFT JOIN b2c_good_i18n gt ON g.id = gt.good_id
|
|
|
|
- </sql>
|
|
|
|
|
|
+ <sql id="leftJoinTranslations">LEFT JOIN b2c_good_i18n gt ON g.id = gt.good_id</sql>
|
|
|
|
+ <sql id="leftJoinUnit">LEFT JOIN b2c_good_unit gu ON g.unit_id = gu.id</sql>
|
|
|
|
+ <sql id="leftJoinBrand">LEFT JOIN b2c_good_brand gb ON g.brand_id = gb.id</sql>
|
|
|
|
+
|
|
|
|
|
|
<sql id="includeGoodDetailFull">
|
|
<sql id="includeGoodDetailFull">
|
|
g.id id,
|
|
g.id id,
|
|
@@ -61,8 +74,14 @@
|
|
|
|
|
|
gc.id category_id,
|
|
gc.id category_id,
|
|
gc.category_name category_name,
|
|
gc.category_name category_name,
|
|
|
|
+
|
|
COALESCE(g.brand_id, -1) brand_id,
|
|
COALESCE(g.brand_id, -1) brand_id,
|
|
|
|
+ COALESCE(gb.brand_name, '') brand_name,
|
|
|
|
+ COALESCE(gb.brand_name_en, '') brand_name_en,
|
|
COALESCE(g.unit_id, -1) unit_id,
|
|
COALESCE(g.unit_id, -1) unit_id,
|
|
|
|
+ COALESCE(gu.unit_name, '') unit_name,
|
|
|
|
+ COALESCE(gu.unit_name_en, '') unit_name_en,
|
|
|
|
+
|
|
COALESCE(g.good_thumb, '') good_thumb,
|
|
COALESCE(g.good_thumb, '') good_thumb,
|
|
COALESCE(g.good_images, '') good_images,
|
|
COALESCE(g.good_images, '') good_images,
|
|
|
|
|
|
@@ -83,7 +102,11 @@
|
|
<result property="category_id" column="category_id" javaType="java.lang.Long" />
|
|
<result property="category_id" column="category_id" javaType="java.lang.Long" />
|
|
<result property="category_name" column="category_name" />
|
|
<result property="category_name" column="category_name" />
|
|
<result property="brand_id" column="brand_id" javaType="java.lang.Long" />
|
|
<result property="brand_id" column="brand_id" javaType="java.lang.Long" />
|
|
|
|
+ <result property="brand_name" column="brand_name" />
|
|
|
|
+ <result property="brand_name_en" column="brand_name_en" />
|
|
<result property="unit_id" column="unit_id" javaType="java.lang.Long" />
|
|
<result property="unit_id" column="unit_id" javaType="java.lang.Long" />
|
|
|
|
+ <result property="unit_name" column="unit_name" />
|
|
|
|
+ <result property="unit_name_en" column="unit_name_en" />
|
|
<result property="good_thumb" column="good_thumb" />
|
|
<result property="good_thumb" column="good_thumb" />
|
|
<result property="good_images" column="good_images" />
|
|
<result property="good_images" column="good_images" />
|
|
<result property="good_name" column="good_name" />
|
|
<result property="good_name" column="good_name" />
|
|
@@ -101,7 +124,11 @@
|
|
<result property="category_id" column="category_id" javaType="java.lang.Long" />
|
|
<result property="category_id" column="category_id" javaType="java.lang.Long" />
|
|
<result property="category_name" column="category_name" />
|
|
<result property="category_name" column="category_name" />
|
|
<result property="brand_id" column="brand_id" javaType="java.lang.Long" />
|
|
<result property="brand_id" column="brand_id" javaType="java.lang.Long" />
|
|
|
|
+ <result property="brand_name" column="brand_name" />
|
|
|
|
+ <result property="brand_name_en" column="brand_name_en" />
|
|
<result property="unit_id" column="unit_id" javaType="java.lang.Long" />
|
|
<result property="unit_id" column="unit_id" javaType="java.lang.Long" />
|
|
|
|
+ <result property="unit_name" column="unit_name" />
|
|
|
|
+ <result property="unit_name_en" column="unit_name_en" />
|
|
<result property="good_thumb" column="good_thumb" />
|
|
<result property="good_thumb" column="good_thumb" />
|
|
<result property="good_images" column="good_images" />
|
|
<result property="good_images" column="good_images" />
|
|
<result property="status" column="status" javaType="java.lang.Integer" />
|
|
<result property="status" column="status" javaType="java.lang.Integer" />
|
|
@@ -146,6 +173,8 @@
|
|
SELECT <include refid="includeGood" /> FROM b2c_good g
|
|
SELECT <include refid="includeGood" /> FROM b2c_good g
|
|
<include refid="leftJoinCategory" />
|
|
<include refid="leftJoinCategory" />
|
|
<include refid="leftJoinTranslations" />
|
|
<include refid="leftJoinTranslations" />
|
|
|
|
+ <include refid="leftJoinUnit" />
|
|
|
|
+ <include refid="leftJoinBrand" />
|
|
<where>
|
|
<where>
|
|
gt.language = #{lang}
|
|
gt.language = #{lang}
|
|
<if test="uid != null and uid != ''">
|
|
<if test="uid != null and uid != ''">
|
|
@@ -172,6 +201,8 @@
|
|
SELECT <include refid="includeGoodDetail" />
|
|
SELECT <include refid="includeGoodDetail" />
|
|
FROM b2c_good g
|
|
FROM b2c_good g
|
|
<include refid="leftJoinCategory" />
|
|
<include refid="leftJoinCategory" />
|
|
|
|
+ <include refid="leftJoinUnit" />
|
|
|
|
+ <include refid="leftJoinBrand" />
|
|
<where>
|
|
<where>
|
|
<if test="uid != null and uid != ''">
|
|
<if test="uid != null and uid != ''">
|
|
AND g.uid = #{uid}
|
|
AND g.uid = #{uid}
|
|
@@ -188,6 +219,8 @@
|
|
FROM b2c_good g
|
|
FROM b2c_good g
|
|
<include refid="leftJoinCategory" />
|
|
<include refid="leftJoinCategory" />
|
|
<include refid="leftJoinTranslations" />
|
|
<include refid="leftJoinTranslations" />
|
|
|
|
+ <include refid="leftJoinUnit" />
|
|
|
|
+ <include refid="leftJoinBrand" />
|
|
WHERE
|
|
WHERE
|
|
gt.language = #{lang}
|
|
gt.language = #{lang}
|
|
AND g.uid = #{uid}
|
|
AND g.uid = #{uid}
|