a.id AS "id",
a.main_show_id AS "mainShowId",
a.show_rules AS "showRules",
a.cac_type AS "cacType",
a.show_code AS "showCode",
a.start_time AS "startTime",
a.end_time AS "endTime",
a.show_name AS "showName",
a.fee AS "fee",
a.discount AS "discount",
a.use_coupon AS "useCoupon",
a.statistics_state AS "statisticsState",
a.winner_state AS "winnerState",
a.create_by AS "createBy.id",
a.create_date AS "createDate",
a.update_by AS "updateBy.id",
a.update_date AS "updateDate",
a.remarks AS "remarks",
a.del_flag AS "delFlag",
a.referee AS "referee",
a.referee_remarks AS "refereeRemarks",
a.serial_number AS "serialNumber",
a.contest_judge_type AS "contestJudgeType",
a.is_discount AS "isDiscount",
b.show_location AS "mainShows.showLocation",
b.organizer AS "mainShows.organizer",
b.orgnize_type AS "mainShows.orgnizeType",
b.dog_num_max AS "mainShows.dogNumMax",
b.register AS "mainShows.register",
b.closing_time AS "mainShows.closingTime",
b.start_time AS "mainShows.startTime",
b.end_time AS "mainShows.endTime",
b.business_model_flag AS "mainShows.businessModelFlag",
b.id AS "mainShows.id"
LEFT JOIN show_main b ON a.main_show_id = b.id
INSERT INTO show_child(
id,
main_show_id,
show_rules,
cac_type,
show_code,
start_time,
end_time,
show_name,
fee,
discount,
use_coupon,
statistics_state,
winner_state,
create_by,
create_date,
update_by,
update_date,
remarks,
referee,
referee_remarks,
contest_judge_type,
del_flag,
is_discount
) VALUES (
#{id},
#{mainShowId},
#{showRules},
#{cacType},
#{showCode},
#{startTime},
#{endTime},
#{showName},
#{fee},
#{discount},
#{useCoupon},
#{statisticsState},
#{winnerState},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{remarks},
#{referee},
#{refereeRemarks},
#{contestJudgeType},
#{delFlag},
#{isDiscount}
)
UPDATE show_child SET
main_show_id = #{mainShowId},
show_rules = #{showRules},
cac_type = #{cacType},
show_code = #{showCode},
start_time = #{startTime},
end_time = #{endTime},
show_name = #{showName},
fee = #{fee},
discount = #{discount},
use_coupon = #{useCoupon},
statistics_state = #{statisticsState},
update_by = #{updateBy.id},
update_date = #{updateDate},
remarks = #{remarks},
referee = #{referee},
referee_remarks = #{refereeRemarks},
contest_judge_type = #{contestJudgeType},
del_flag = #{delFlag},
is_discount=#{isDiscount}
WHERE id = #{id}
UPDATE show_child SET
remarks = concat(IFNULL(remarks,''),#{remarks}),
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
UPDATE show_child a
INNER JOIN (
SELECT
@rowno :=@rowno + 1 AS rowno,
r.*
FROM
(
SELECT
a.id,
a.show_code
FROM
show_child a
LEFT JOIN show_main b ON a.main_show_id = b.id
WHERE a.del_flag = '0'
AND a.serial_number IS NULL
AND b.closing_time DATE_ADD(CONCAT(YEAR (now()),'-',MONTH (now()),'-01'),INTERVAL 2 MONTH)
ORDER BY b.closing_time ASC,a.show_code ASC
) r,
(SELECT @rowno := #{maxSerialNumber}) t
) b ON a.id = b.id
SET a.serial_number = b.rowno
UPDATE show_child SET
winner_state = #{winnerState},
update_by = #{updateBy.id},
update_date = #{updateDate}
WHERE id = #{id}