通过套餐生成商品并持久化数据
This commit is contained in:
@ -7,162 +7,311 @@
|
||||
<id property="id" column="id"/>
|
||||
<result property="outItemId" column="out_item_id"/>
|
||||
<result property="aliItemId" column="ali_item_id"/>
|
||||
<result property="outSkuId" column="out_sku_id"/>
|
||||
<result property="itemDesc" column="item_desc"/>
|
||||
<result property="brandName" column="brand_name"/>
|
||||
<result property="modelName" column="model_name"/>
|
||||
<result property="categoryName" column="category_name"/>
|
||||
<result property="dictLabel" column="dict_label"/>
|
||||
<result property="rentalDays" column="rental_days"/>
|
||||
<result property="rentType" column="rent_type"/>
|
||||
<result property="ruleName" column="rule_name"/>
|
||||
<result property="pagePath" column="page_path"/>
|
||||
<result property="image" column="image"/>
|
||||
<result property="imageList1" column="image_list1"/>
|
||||
<result property="imageList2" column="image_list2"/>
|
||||
<result property="imageList3" column="image_list3"/>
|
||||
<result property="depositFree" column="deposit_free"/>
|
||||
<result property="depositPrice" column="deposit_price"/>
|
||||
<result property="rentalPrice" column="rental_price"/>
|
||||
<result property="batteryRuleId" column="battery_rule_id"/>
|
||||
<result property="carRuleId" column="car_rule_id"/>
|
||||
<result property="carModelId" column="car_model_id"/>
|
||||
<result property="brandId" column="brand_id"/>
|
||||
<result property="rentalDays" column="rental_days"/>
|
||||
<result property="rentalPrice" column="rental_price"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 字段列表 -->
|
||||
<!-- 查询字段 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, out_item_id, ali_item_id, brand_name, model_name, category_name,
|
||||
dict_label, rule_name, image, battery_rule_id, car_rule_id, car_model_id, brand_id,rental_days,rental_price
|
||||
id
|
||||
,
|
||||
out_item_id,
|
||||
ali_item_id,
|
||||
out_sku_id,
|
||||
item_desc,
|
||||
brand_name,
|
||||
model_name,
|
||||
category_name,
|
||||
rental_days,
|
||||
rent_type,
|
||||
rule_name,
|
||||
page_path,
|
||||
image,
|
||||
image_list1,
|
||||
image_list2,
|
||||
image_list3,
|
||||
deposit_free,
|
||||
deposit_price,
|
||||
rental_price,
|
||||
battery_rule_id,
|
||||
car_rule_id,
|
||||
car_model_id,
|
||||
brand_id
|
||||
</sql>
|
||||
|
||||
<!-- 查询所有 -->
|
||||
<select id="selectAll" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List"/>
|
||||
FROM zc_rent_rule_item
|
||||
</select>
|
||||
|
||||
<!-- 根据ID查询 -->
|
||||
<select id="selectById" parameterType="Long" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List"/>
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM zc_rent_rule_item
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 查询所有 -->
|
||||
<select id="selectAll" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM zc_rent_rule_item
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectByItemId" parameterType="Long" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List"/>
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM zc_rent_rule_item
|
||||
WHERE out_item_id = #{outItemId}
|
||||
</select>
|
||||
|
||||
<select id="selectByAliId" parameterType="Long" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List"/>
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM zc_rent_rule_item
|
||||
WHERE ali_item_id = #{aliItemId}
|
||||
</select>
|
||||
|
||||
<select id="selectByIds" parameterType="map" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List"/>
|
||||
FROM zc_rent_rule_item
|
||||
<where>
|
||||
<if test="batteryRuleId != null">
|
||||
AND battery_rule_id = #{batteryRuleId}
|
||||
</if>
|
||||
<if test="carRuleId != null">
|
||||
AND car_rule_id = #{carRuleId}
|
||||
</if>
|
||||
<if test="carModelId != null">
|
||||
AND car_model_id = #{carModelId}
|
||||
</if>
|
||||
<if test="brandId != null">
|
||||
AND brand_id = #{brandId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 插入 -->
|
||||
<!-- 插入数据 -->
|
||||
<insert id="insert" parameterType="com.sczx.pay.alipay.po.RentRuleItem">
|
||||
INSERT INTO zc_rent_rule_item (
|
||||
id,
|
||||
out_item_id,
|
||||
ali_item_id,
|
||||
brand_name,
|
||||
model_name,
|
||||
category_name,
|
||||
dict_label,
|
||||
rule_name,
|
||||
image,
|
||||
battery_rule_id,
|
||||
car_rule_id,
|
||||
car_model_id,
|
||||
rental_days,
|
||||
rental_price,
|
||||
brand_id
|
||||
) VALUES (
|
||||
#{id},
|
||||
#{outItemId},
|
||||
#{aliItemId},
|
||||
#{brandName},
|
||||
#{modelName},
|
||||
#{categoryName},
|
||||
#{dictLabel},
|
||||
#{ruleName},
|
||||
#{image},
|
||||
#{batteryRuleId},
|
||||
#{carRuleId},
|
||||
#{carModelId},
|
||||
#{rentalDays},
|
||||
#{rentalPrice},
|
||||
#{brandId}
|
||||
)
|
||||
insert into zc_rent_rule_item
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="outItemId != null and outItemId != ''">out_item_id,</if>
|
||||
<if test="aliItemId != null and aliItemId != ''">ali_item_id,</if>
|
||||
<if test="outSkuId != null and outSkuId != ''">out_sku_id,</if>
|
||||
<if test="itemDesc != null and itemDesc != ''">item_desc,</if>
|
||||
<if test="brandName != null and brandName != ''">brand_name,</if>
|
||||
<if test="modelName != null and modelName != ''">model_name,</if>
|
||||
<if test="categoryName != null and categoryName != ''">category_name,</if>
|
||||
<if test="rentalDays != null">rental_days,</if>
|
||||
<if test="rentType != null and rentType != ''">rent_type,</if>
|
||||
<if test="ruleName != null and ruleName != ''">rule_name,</if>
|
||||
<if test="pagePath != null and pagePath != ''">page_path,</if>
|
||||
<if test="image != null and image != ''">image,</if>
|
||||
<if test="imageList1 != null and imageList1 != ''">image_list1,</if>
|
||||
<if test="imageList2 != null and imageList2 != ''">image_list2,</if>
|
||||
<if test="imageList3 != null and imageList3 != ''">image_list3,</if>
|
||||
<if test="depositFree != null and depositFree != ''">deposit_free,</if>
|
||||
<if test="depositPrice != null">deposit_price,</if>
|
||||
<if test="rentalPrice != null">rental_price,</if>
|
||||
<if test="batteryRuleId != null">battery_rule_id,</if>
|
||||
<if test="carRuleId != null">car_rule_id,</if>
|
||||
<if test="carModelId != null">car_model_id,</if>
|
||||
<if test="brandId != null">brand_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="outItemId != null and outItemId != ''">#{outItemId},</if>
|
||||
<if test="aliItemId != null and aliItemId != ''">#{aliItemId},</if>
|
||||
<if test="outSkuId != null and outSkuId != ''">#{outSkuId},</if>
|
||||
<if test="itemDesc != null and itemDesc != ''">#{itemDesc},</if>
|
||||
<if test="brandName != null and brandName != ''">#{brandName},</if>
|
||||
<if test="modelName != null and modelName != ''">#{modelName},</if>
|
||||
<if test="categoryName != null and categoryName != ''">#{categoryName},</if>
|
||||
<if test="rentalDays != null">#{rentalDays},</if>
|
||||
<if test="rentType != null and rentType != ''">#{rentType},</if>
|
||||
<if test="ruleName != null and ruleName != ''">#{ruleName},</if>
|
||||
<if test="pagePath != null and pagePath != ''">#{pagePath},</if>
|
||||
<if test="image != null and image != ''">#{image},</if>
|
||||
<if test="imageList1 != null and imageList1 != ''">#{imageList1},</if>
|
||||
<if test="imageList2 != null and imageList2 != ''">#{imageList2},</if>
|
||||
<if test="imageList3 != null and imageList3 != ''">#{imageList3},</if>
|
||||
<if test="depositFree != null and depositFree != ''">#{depositFree},</if>
|
||||
<if test="depositPrice != null">#{depositPrice},</if>
|
||||
<if test="rentalPrice != null">#{rentalPrice},</if>
|
||||
<if test="batteryRuleId != null">#{batteryRuleId},</if>
|
||||
<if test="carRuleId != null">#{carRuleId},</if>
|
||||
<if test="carModelId != null">#{carModelId},</if>
|
||||
<if test="brandId != null">#{brandId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 批量插入 -->
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO zc_rent_rule_item (
|
||||
id, out_item_id, ali_item_id, brand_name, model_name, category_name,
|
||||
dict_label, rule_name, image, battery_rule_id, car_rule_id, car_model_id, brand_id,rental_days,rental_price
|
||||
) VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
#{item.id},
|
||||
#{item.outItemId},
|
||||
#{item.aliItemId},
|
||||
#{item.brandName},
|
||||
#{item.modelName},
|
||||
#{item.categoryName},
|
||||
#{item.dictLabel},
|
||||
#{item.ruleName},
|
||||
#{item.image},
|
||||
#{item.batteryRuleId},
|
||||
#{item.carRuleId},
|
||||
#{item.carModelId},
|
||||
#{item.brandId},
|
||||
#{item.rentalDays},
|
||||
#{item.rentalPrice},
|
||||
)
|
||||
</foreach>
|
||||
<insert id="insertByFourId" parameterType="com.sczx.pay.alipay.po.RentRuleItem" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into zc_rent_rule_item
|
||||
(out_item_id,
|
||||
ali_item_id,
|
||||
out_sku_id,
|
||||
item_desc,
|
||||
brand_name,
|
||||
model_name,
|
||||
category_name,
|
||||
rental_days,
|
||||
rent_type,
|
||||
rule_name,
|
||||
page_path,
|
||||
image,
|
||||
image_list1,
|
||||
image_list2,
|
||||
image_list3,
|
||||
deposit_free,
|
||||
deposit_price,
|
||||
rental_price,
|
||||
battery_rule_id,car_rule_id,car_model_id,brand_id)
|
||||
SELECT
|
||||
#{outItemId} AS out_item_id,
|
||||
'' AS ali_item_id,
|
||||
#{outSkuId} AS out_sku_id,
|
||||
#{itemDesc} as item_desc,
|
||||
zcm.brand_name AS brand_name,
|
||||
zcm.model_name AS model_name,
|
||||
zbc.category_name AS category_name,
|
||||
zrcr.rental_days AS rental_days,
|
||||
sdd.dict_label AS rent_type,
|
||||
zrcr.rule_name AS rule_name,
|
||||
#{pagePath} AS page_path,
|
||||
zcm.image AS image,
|
||||
'' as image_list1,
|
||||
'' as image_list2,
|
||||
'' as image_list3,
|
||||
zrcr.deposit_free AS deposit_free,
|
||||
zrcr.deposit_price AS deposit_price,
|
||||
zrcr.rental_price AS rental_price,
|
||||
zrcrb.battery_rule_id AS battery_rule_id,
|
||||
zcmp.car_rule_id AS car_rule_id,
|
||||
zcmp.car_model_id AS car_model_id,
|
||||
zcb.id AS brand_id
|
||||
FROM
|
||||
zc_car_brand AS zcb,
|
||||
zc_car_model AS zcm,
|
||||
zc_car_model_package AS zcmp,
|
||||
zc_rent_car_rule AS zrcr,
|
||||
zc_rent_battey_rule AS zrbr,
|
||||
zc_rent_car_rule_battery AS zrcrb,
|
||||
sys_dict_data AS sdd,
|
||||
zc_battery_category AS zbc
|
||||
WHERE
|
||||
zcb.id = zcm.brand_id
|
||||
AND zcmp.car_model_id = zcm.id
|
||||
AND zcmp.car_rule_id = zrcr.id
|
||||
AND zrcrb.car_rule_id = zrcr.id
|
||||
AND zrcrb.battery_rule_id = zrbr.id
|
||||
AND sdd.dict_type = 'key_rent_type'
|
||||
AND zrcr.rental_type = sdd.dict_value
|
||||
AND zbc.id = zrbr.category_id
|
||||
AND zcb.id = #{brandId}
|
||||
AND zcmp.car_model_id = #{carModelId}
|
||||
AND zcmp.car_rule_id = #{carRuleId}
|
||||
AND zrcrb.battery_rule_id = #{batteryRuleId}
|
||||
</insert>
|
||||
|
||||
<!-- 更新 -->
|
||||
<update id="update" parameterType="com.sczx.pay.alipay.po.RentRuleItem">
|
||||
UPDATE zc_rent_rule_item
|
||||
<!-- 更新数据 -->
|
||||
<update id="updateById" parameterType="com.sczx.pay.alipay.po.RentRuleItem">
|
||||
update zc_rent_rule_item
|
||||
<set>
|
||||
<if test="outItemId != null and outItemId != ''">out_item_id = #{outItemId},</if>
|
||||
<if test="aliItemId != null and aliItemId != ''">ali_item_id = #{aliItemId},</if>
|
||||
<if test="outSkuId != null and outSkuId != ''">out_sku_id = #{outSkuId},</if>
|
||||
<if test="itemDesc != null and itemDesc != ''">item_desc = #{itemDesc},</if>
|
||||
<if test="brandName != null and brandName != ''">brand_name = #{brandName},</if>
|
||||
<if test="modelName != null and modelName != ''">model_name = #{modelName},</if>
|
||||
<if test="categoryName != null and categoryName != ''">category_name = #{categoryName},</if>
|
||||
<if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if>
|
||||
<if test="rentalDays != null">rental_days = #{rentalDays},</if>
|
||||
<if test="rentType != null and rentType != ''">rent_type = #{rentType},</if>
|
||||
<if test="ruleName != null and ruleName != ''">rule_name = #{ruleName},</if>
|
||||
<if test="image != null">image = #{image},</if>
|
||||
<if test="pagePath != null and pagePath != ''">page_path = #{pagePath},</if>
|
||||
<if test="image != null and image != ''">image = #{image},</if>
|
||||
<if test="imageList1 != null and imageList1 != ''">image_list1 = #{imageList1},</if>
|
||||
<if test="imageList2 != null and imageList2 != ''">image_list2 = #{imageList2},</if>
|
||||
<if test="imageList3 != null and imageList3 != ''">image_list3 = #{imageList3},</if>
|
||||
<if test="depositFree != null and depositFree != ''">deposit_free = #{depositFree},</if>
|
||||
<if test="depositPrice != null">deposit_price = #{depositPrice},</if>
|
||||
<if test="rentalPrice != null">rental_price = #{rentalPrice},</if>
|
||||
<if test="batteryRuleId != null">battery_rule_id = #{batteryRuleId},</if>
|
||||
<if test="carRuleId != null">car_rule_id = #{carRuleId},</if>
|
||||
<if test="carModelId != null">car_model_id = #{carModelId},</if>
|
||||
<if test="brandId != null">brand_id = #{brandId},</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateItemIdByOutItemId" parameterType="com.sczx.pay.alipay.po.RentRuleItem">
|
||||
UPDATE zc_rent_rule_item
|
||||
set ali_item_id = #{aliItemId}
|
||||
WHERE out_item_id = #{aliItemId}
|
||||
<update id="updateByOutItemId" parameterType="com.sczx.pay.alipay.po.RentRuleItem">
|
||||
update zc_rent_rule_item
|
||||
<set>
|
||||
<if test="outItemId != null and outItemId != ''">out_item_id = #{outItemId},</if>
|
||||
<if test="aliItemId != null and aliItemId != ''">ali_item_id = #{aliItemId},</if>
|
||||
<if test="outSkuId != null and outSkuId != ''">out_sku_id = #{outSkuId},</if>
|
||||
<if test="itemDesc != null and itemDesc != ''">item_desc = #{itemDesc},</if>
|
||||
<if test="brandName != null and brandName != ''">brand_name = #{brandName},</if>
|
||||
<if test="modelName != null and modelName != ''">model_name = #{modelName},</if>
|
||||
<if test="categoryName != null and categoryName != ''">category_name = #{categoryName},</if>
|
||||
<if test="rentalDays != null">rental_days = #{rentalDays},</if>
|
||||
<if test="rentType != null and rentType != ''">rent_type = #{rentType},</if>
|
||||
<if test="ruleName != null and ruleName != ''">rule_name = #{ruleName},</if>
|
||||
<if test="pagePath != null and pagePath != ''">page_path = #{pagePath},</if>
|
||||
<if test="image != null and image != ''">image = #{image},</if>
|
||||
<if test="imageList1 != null and imageList1 != ''">image_list1 = #{imageList1},</if>
|
||||
<if test="imageList2 != null and imageList2 != ''">image_list2 = #{imageList2},</if>
|
||||
<if test="imageList3 != null and imageList3 != ''">image_list3 = #{imageList3},</if>
|
||||
<if test="depositFree != null and depositFree != ''">deposit_free = #{depositFree},</if>
|
||||
<if test="depositPrice != null">deposit_price = #{depositPrice},</if>
|
||||
<if test="rentalPrice != null">rental_price = #{rentalPrice},</if>
|
||||
<if test="batteryRuleId != null">battery_rule_id = #{batteryRuleId},</if>
|
||||
<if test="carRuleId != null">car_rule_id = #{carRuleId},</if>
|
||||
<if test="carModelId != null">car_model_id = #{carModelId},</if>
|
||||
<if test="brandId != null">brand_id = #{brandId},</if>
|
||||
</set>
|
||||
where out_item_id = #{outItemId}
|
||||
</update>
|
||||
|
||||
|
||||
<select id="selectByFourId" parameterType="com.sczx.pay.alipay.po.RentRuleItem" resultMap="BaseResultMap">
|
||||
SELECT zcm.brand_name AS brand_name,
|
||||
zcm.model_name AS model_name,
|
||||
zbc.category_name AS category_name,
|
||||
zrcr.rental_days AS rental_days,
|
||||
sdd.dict_label AS rent_type,
|
||||
zrcr.rule_name AS rule_name,
|
||||
zcm.image AS image,
|
||||
zrcr.deposit_free AS deposit_free,
|
||||
zrcr.deposit_price AS deposit_price,
|
||||
zrcr.rental_price AS rental_price,
|
||||
zrcrb.battery_rule_id AS battery_rule_id,
|
||||
zcmp.car_rule_id AS car_rule_id,
|
||||
zcmp.car_model_id AS car_model_id,
|
||||
zcb.id AS brand_id
|
||||
FROM zc_car_brand AS zcb,
|
||||
zc_car_model AS zcm,
|
||||
zc_car_model_package AS zcmp,
|
||||
zc_rent_car_rule AS zrcr,
|
||||
zc_rent_battey_rule AS zrbr,
|
||||
zc_rent_car_rule_battery AS zrcrb,
|
||||
sys_dict_data AS sdd,
|
||||
zc_battery_category AS zbc
|
||||
WHERE zcb.id = zcm.brand_id
|
||||
AND zcmp.car_model_id = zcm.id
|
||||
AND zcmp.car_rule_id = zrcr.id
|
||||
AND zrcrb.car_rule_id = zrcr.id
|
||||
AND zrcrb.battery_rule_id = zrbr.id
|
||||
AND sdd.dict_type = 'key_rent_type'
|
||||
AND zrcr.rental_type = sdd.dict_value
|
||||
AND zbc.id = zrbr.category_id
|
||||
AND zrcrb.battery_rule_id = #{batteryRuleId}
|
||||
AND zcmp.car_rule_id = #{carRuleId}
|
||||
AND zcmp.car_model_id = #{carModelId}
|
||||
AND zcb.id = #{brandId}
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 根据ID删除 -->
|
||||
<delete id="deleteById" parameterType="Long">
|
||||
DELETE FROM zc_rent_rule_item WHERE id = #{id}
|
||||
delete
|
||||
from zc_rent_rule_item
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user