a.id AS "id",
a.birth_code AS "birthCode",
a.member_code AS "memberCode",
a.price AS "price",
a.city AS "city",
a.mobile AS "mobile",
a.linkman AS "linkman",
a.front_pic AS "frontPic",
a.side_pic AS "sidePic",
a.back_pic AS "backPic",
a.life_pic AS "lifePic",
a.health_info AS "healthInfo",
a.state AS "state",
a.consign AS "consign",
a.add_time AS "addTime",
a.review_state AS "reviewState",
a.review_time AS "reviewTime",
a.review_remarks AS "reviewRemarks",
a.running_number AS "runningNumber",
a.payment_state AS "paymentState",
a.payment_time AS "paymentTime",
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.org_id AS "orgId",
a.front_pic_review_state AS "frontPicReviewState",
a.side_pic_review_state AS "sidePicReviewState",
a.back_pic_review_state AS "backPicReviewState",
a.front_pic_remark AS "frontPicRemark",
a.side_pic_remark AS "sidePicRemark",
a.back_pic_remark AS "backPicRemark",
a.upper_review AS "upperReview",
a.type AS "type",
a.del_flag AS "delFlag",
b.identification_flag AS "identificationFlag",
b.cab_passport AS "cabPassport",
b.dog_birthday AS "dogBirthday"
LEFT JOIN dog_birth_certificate b ON b.birth_cer_reg_code = a.birth_code
INSERT INTO dog_activation(
id,
birth_code,
member_code,
price,
city,
mobile,
linkman,
front_pic,
side_pic,
back_pic,
life_pic,
health_info,
state,
consign,
create_by,
create_date,
update_by,
update_date,
org_id,
upper_review,
type,
del_flag
) VALUES (
#{id},
#{birthCode},
#{memberCode},
#{price},
#{city},
#{mobile},
#{linkman},
#{frontPic},
#{sidePic},
#{backPic},
#{lifePic},
#{healthInfo},
#{state},
#{consign},
#{createBy.id},
#{createDate},
#{updateBy.id},
#{updateDate},
#{orgId},
#{upperReview},
#{type},
#{delFlag}
)
UPDATE dog_activation SET
price = #{price},
city = #{city},
mobile = #{mobile},
linkman = #{linkman},
front_pic = #{frontPic},
side_pic = #{sidePic},
back_pic = #{backPic},
life_pic = #{lifePic},
health_info = #{healthInfo},
state = #{state},
consign = #{consign},
add_time = #{addTime},
front_pic_review_state = #{frontPicReviewState},
side_pic_review_state = #{sidePicReviewState},
back_pic_review_state = #{backPicReviewState},
front_pic_remark = #{frontPicRemark},
side_pic_remark = #{sidePicRemark},
back_pic_remark = #{backPicRemark},
review_state = #{reviewState},
review_time = #{reviewTime},
review_remarks = #{reviewRemarks},
running_number = #{runningNumber},
payment_state = #{paymentState},
payment_time = #{paymentTime},
update_by = #{updateBy.id},
update_date = #{updateDate},
type = #{type},
upper_review = #{upperReview},
remarks = #{remarks}
WHERE id = #{id}
UPDATE dog_activation SET
del_flag = #{DEL_FLAG_DELETE}
WHERE id = #{id}
UPDATE dog_activation SET
state = '0'
WHERE state = '1'
AND add_time DATE_SUB(CURDATE(), INTERVAL 60 DAY)
UPDATE dog_activation
SET state = '0'
WHERE
state = '1'
AND birth_code IN (
SELECT
b.birth_cer_reg_code
FROM
dog_birth_certificate b
WHERE
b.del_flag = '0'
AND b.dog_birthday < DATE_SUB(CURDATE(), INTERVAL 24 MONTH)
);