728x90
<insert id="insertKycInfo">
INSERT INTO `okcoin_broker`.`user_kyc_info`(
`user_id`,
`kyc_info`,
`type`,
`country_id`,
`level`,
`status`,
`fail_reason`,
`remark`,
`create_time`,
`update_time`,
`exp_date`
) VALUES
<foreach collection="userKycInfo" item="element" index="index" open="(" separator="),(" close=")">
#{element.user_id},
<choose>
<when test="element.kyc_info ==null">null,</when>
<when test="element.kyc_info ==''">null,</when>
<otherwise>#{element.kyc_info},</otherwise>
</choose>
#{element.type},
#{element.country_id},
#{element.level},
#{element.status},
#{element.fail_reason},
#{element.remark},
date_format(STR_TO_DATE(#{element.create_time}, '%Y-%m-%d %H:%i:%s'), '%Y-%m-%d %H:%i:%s'),
date_format(STR_TO_DATE(#{element.update_time}, '%Y-%m-%d %H:%i:%s'), '%Y-%m-%d %H:%i:%s'),
<choose>
<when test="element.exp_date ==null">null</when>
<when test="element.exp_date ==''">null</when>
<otherwise>date_format(STR_TO_DATE(#{element.exp_date}, '%Y-%m-%d %H:%i:%s'), '%Y-%m-%d %H:%i:%s')</otherwise>
</choose>
</foreach>
ON DUPLICATE KEY UPDATE
user_id = VALUES(user_id),
<choose>
<when test="element.kyc_info ==null">kyc_info = null,</when>
<when test="element.kyc_info ==''">kyc_info = null,</when>
<otherwise>kyc_info = VALUES(kyc_info),</otherwise>
</choose>
type = VALUES (type),
country_id = VALUES (country_id),
level = VALUES (level),
status = VALUES (status),
fail_reason = VALUES (fail_reason),
remark = VALUES (remark),
create_time = date_format(STR_TO_DATE(VALUES(create_time), '%Y-%m-%d %H:%i:%s'), '%Y-%m-%d %H:%i:%s'),
update_time = date_format(STR_TO_DATE(VALUES(update_time), '%Y-%m-%d %H:%i:%s'), '%Y-%m-%d %H:%i:%s'),
<choose>
<when test="element.exp_date ==null">exp_date = null</when>
<when test="element.exp_date ==''">exp_date = null</when>
<otherwise>exp_date = date_format(STR_TO_DATE(VALUES(exp_date), '%Y-%m-%d %H:%i:%s'), '%Y-%m-%d %H:%i:%s')</otherwise>
</choose>
</insert>
내저장소 바로가기 luxury515
'Back-end > 기타' 카테고리의 다른 글
유효성체크,예외처리,응답메시지에 대한 공통처리. (0) | 2023.04.17 |
---|---|
필터(Filter) vs 인터셉터(Intercepter) (0) | 2023.04.17 |
AWS KMS 관련 세팅 (0) | 2023.04.14 |
DI(Depandency Injection) 에 관하여 (0) | 2023.04.14 |
plantUml preview 갑자기 작동안될때. (0) | 2023.04.14 |