UPDATE products
SET
productName = #{product.productName},
specification = #{product.specification},
yolk = #{product.yolk},
quantity = #{product.quantity},
variety = #{product.variety},
grossWeight = #{product.grossWeight},
price = #{product.price},
updated_at = NOW()
WHERE
sellerId = #{sellerId}
AND productId = #{productId}
UPDATE users
SET
nickName = #{nickName},
type = #{type},
company = #{company},
region = #{region},
level = #{level},
demand = #{demand},
spec = #{spec},
updated_at = #{updated_at}
WHERE phoneNumber = #{phoneNumber}
UPDATE products
SET
productName = #{productName},
variety = #{variety},
specification = #{specification},
quantity = #{quantity},
grossWeight = #{grossWeight},
yolk = #{yolk},
updated_at = NOW()
WHERE sellerId = #{sellerId}
INSERT INTO products (
productId,
sellerId,
productName,
variety,
specification,
quantity,
grossWeight,
yolk,
price,
created_at,
updated_at
) VALUES (
COALESCE(#{productId}, UUID()),
#{sellerId},
#{productName},
#{variety},
#{specification},
#{quantity},
#{grossWeight},
#{yolk},
#{price},
NOW(),
NOW()
)
ON DUPLICATE KEY UPDATE
productName = VALUES(productName),
variety = VALUES(variety),
specification = VALUES(specification),
quantity = VALUES(quantity),
grossWeight = VALUES(grossWeight),
yolk = VALUES(yolk),
price = VALUES(price),
updated_at = NOW()
UPDATE contacts
SET
wechat = #{wechat},
account = #{account},
accountNumber = #{accountNumber},
bank = #{bank},
address = #{address},
updated_at = NOW()
WHERE userId = #{userId}
LIMIT 1
INSERT INTO contacts (id, userId, wechat, account, accountNumber, bank, address, updated_at)
VALUES (
COALESCE(#{contactId}, UUID()),
#{userId},
#{wechat},
#{account},
#{accountNumber},
#{bank},
#{address},
NOW()
)
ON DUPLICATE KEY UPDATE
wechat = VALUES(wechat),
account = VALUES(account),
accountNumber = VALUES(accountNumber),
bank = VALUES(bank),
address = VALUES(address),
updated_at = NOW()
UPDATE contacts
SET
wechat = #{wechat},
account = #{account},
accountNumber = #{accountNumber},
bank = #{bank},
address = #{address},
updated_at = NOW()
WHERE userId = #{userId}
AND id = #{contactId}
UPDATE products
SET
productName = #{productName},
variety = #{variety},
specification = #{specification},
quantity = #{quantity},
grossWeight = #{grossWeight},
yolk = #{yolk},
updated_at = NOW()
WHERE sellerId = #{sellerId}
AND productId = #{productId}
UPDATE products
SET
productName = #{productName},
variety = #{variety},
specification = #{specification},
quantity = #{quantity},
grossWeight = #{grossWeight},
yolk = #{yolk},
updated_at = NOW()
WHERE productId = #{productId}