a.id AS "id",
a.productID AS "productID",
a.sold AS "sold",
a.secondHandType AS "secondHandType",
a.instrumentType AS "instrumentType",
a.fixedYears AS "fixedYears",
a.maturityYears AS "maturityYears",
a.companyName AS "companyName",
a.detailTalkFlag AS "detailTalkFlag",
a.originalPrice AS "originalPrice",
a.contactName AS "contactName",
a.contactMobile AS "contactMobile",
a.dockingPeopleName AS "dockingPeopleName",
a.dockingPeopleMobile AS "dockingPeopleMobile",
a.secondProductType AS "secondProductType",
a.provinceCityDistrict AS "provinceCityDistrict",
a.townId as "townId",
a.address AS "address",
a.productQuality AS "productQuality",
a.productDetails AS "productDetails",
a.viewingNum AS "viewingNum",
a.brandName AS "brandName",
a.payAmount AS "payAmount",
a.payFormData AS "payFormData",
a.payType AS "payType",
a.payDate AS "payDate",
a.submitDate AS "submitDate",
a.reviewedDate AS "reviewedDate",
a.onLineDate AS "onLineDate",
a.source AS "source",
a.showContactFlag AS "showContactFlag",
a.publisher AS "publisher",
a.authenticationImage AS "authenticationImage",
a.fileName AS "fileName",
a.ossName AS "ossName",
a.commitmentImage AS "commitmentImage",
copi.validFlag AS "validFlag",
p.productCategory AS "productCategory",
p.name AS "name",
cs.normalPrice AS "normalPrice",
cs.price AS "price",
cs.stock AS "stock",
p.brandID AS "brandID",
cs.costPrice as "costPrice",
cs.costCheckFlag AS "costCheckFlag",
cs.shopPercent AS "shopPercent",
cs.organizeId AS "organizeId",
p.visibility AS "visibility",
p.splitCode AS "splitCode"
left join product p on p.productID = a.productID
left join cm_sku cs on p.productId=cs.productId and p.groundMall like CONCAT('%', cs.organizeId, '%')
INSERT INTO cm_second_hand_detail(publishIdentity,
authenticationBackImage,
licenseImage,
productID,
sold,
secondHandType,
instrumentType,
fixedYears,
maturityYears,
companyName,
detailTalkFlag,
originalPrice,
contactName,
contactMobile,
dockingPeopleName,
dockingPeopleMobile,
secondProductType,
provinceCityDistrict,
townId,
address,
productQuality,
productDetails,
viewingNum,
brandName,
payAmount,
payFormData,
payType,
payDate,
submitDate,
reviewedDate,
onLineDate,
source,
showContactFlag,
publisher,
authenticationImage,
fileName,
ossName,
commitmentImage)
VALUES (#{publishIdentity},
#{authenticationBackImage},
#{licenseImage},
#{productID},
#{sold},
#{secondHandType},
#{instrumentType},
#{fixedYears},
#{maturityYears},
#{companyName},
#{detailTalkFlag},
#{originalPrice},
#{contactName},
#{contactMobile},
#{dockingPeopleName},
#{dockingPeopleMobile},
#{secondProductType},
#{provinceCityDistrict},
#{townId},
#{address},
#{productQuality},
#{productDetails},
#{viewingNum},
#{brandName},
#{payAmount},
#{payFormData},
#{payType},
#{payDate},
#{submitDate},
#{reviewedDate},
#{onLineDate},
#{source},
#{showContactFlag},
#{publisher},
#{authenticationImage},
#{fileName},
#{ossName},
#{commitmentImage})
insert into cm_second_file_type
(secondid, productid, filetype)
values (#{secondId}, #{productId}, #{fileType})
insert into shop (name, linkMan, contractMobile, cardNumber, accountType, banOfDeposit, accountName, addTime,
status, shopType)
values (#{name}, #{linkMan}, #{contractMobile}, #{cardNumber}, #{accountType}, #{banOfDeposit}, #{accountName},
now(), 90, #{shopType})
UPDATE cm_second_hand_detail
SET productID = #{productID},
sold = #{sold},
secondHandType = #{secondHandType},
instrumentType = #{instrumentType},
fixedYears = #{fixedYears},
maturityYears = #{maturityYears},
companyName = #{companyName},
detailTalkFlag = #{detailTalkFlag},
originalPrice = #{originalPrice},
contactName = #{contactName},
contactMobile = #{contactMobile},
dockingPeopleName = #{dockingPeopleName},
dockingPeopleMobile = #{dockingPeopleMobile},
secondProductType = #{secondProductType},
provinceCityDistrict = #{provinceCityDistrict},
townId = #{townId},
address = #{address},
productQuality = #{productQuality},
productDetails = #{productDetails},
viewingNum = #{viewingNum},
brandName = #{brandName},
payAmount = #{payAmount},
payFormData = #{payFormData},
payType = #{payType},
payDate = #{payDate},
submitDate = #{submitDate},
reviewedDate = #{reviewedDate},
onLineDate = #{onLineDate},
source = #{source},
showContactFlag = #{showContactFlag},
publisher = #{publisher},
authenticationImage = #{authenticationImage},
fileName = #{fileName},
ossName = #{ossName},
commitmentImage = #{commitmentImage},
publishIdentity = #{publishIdentity}
WHERE productID = #{productID}
UPDATE cm_second_hand_detail
SET reviewedDate = #{reviewedDate},
onLineDate = #{onLineDate}
WHERE productID = #{productID}
UPDATE cm_second_hand_detail
SET onLineDate = #{date}
WHERE productID = #{productID}
UPDATE cm_second_hand_detail
SET sold = 1
where productID = #{productID}
DELETE
FROM cm_second_hand_detail
WHERE productID = #{productID}
delete
from cm_second_file_type
where productId = #{productId}
UPDATE cm_second_hand_detail
SET sold = 0
WHERE productID = #{productID}
update shop
set name=#{name},
linkMan=#{linkMan},
contractMobile=#{contractMobile},
cardNumber=#{cardNumber},
accountType=#{accountType},
banOfDeposit=#{banOfDeposit},
accountName=#{accountName}
where shopID = #{shopID}
update shop
set shopType=3
where shopID = (select shopID from product where productID = #{productID})