|
@@ -1,73 +1,84 @@
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.caimei365.commodity.mapper.SecondHandMapper">
|
|
|
- <insert id="saveSencondHandProduct" parameterType="com.caimei365.commodity.model.po.ProductSecondPo" keyProperty="id" useGeneratedKeys="true">
|
|
|
- insert into cm_second_hand_detail(
|
|
|
- productID, sold, secondHandType, instrumentType, fixedYears, maturityYears, companyName, detailTalkFlag,
|
|
|
- originalPrice, contactName, contactMobile, dockingPeopleName, dockingPeopleMobile, secondProductType,
|
|
|
- townId, brandName, provinceCityDistrict, address, productQuality, productDetails, viewingNum, payStatus,
|
|
|
- payAmount, payFormData, payType, payDate, submitDate, reviewedDate, onLineDate, source, publisher, authenticationImage,
|
|
|
- fileName, ossName, commitmentImage,publishIdentity,licenseImage,authenticationBackImage
|
|
|
- ) values (
|
|
|
- #{productId}, #{sold}, #{secondHandType}, #{instrumentType}, #{fixedYears}, #{maturityYears}, #{companyName},
|
|
|
- #{detailTalkFlag}, #{originalPrice}, #{contactName}, #{contactMobile}, #{dockingPeopleName}, #{dockingPeopleMobile},
|
|
|
- #{secondProductType}, #{townId}, #{brandName}, #{provinceCityDistrict}, #{address}, #{productQuality}, #{productDetails},
|
|
|
- #{viewingNum}, #{payStatus}, #{payAmount}, #{payFormData}, #{payType}, #{payDate}, #{submitDate}, #{reviewedDate},
|
|
|
- #{onLineDate}, #{source}, #{publisher}, #{authenticationImage}, #{fileName}, #{ossName}, #{commitmentImage},#{publishIdentity},
|
|
|
- #{licenseImage},#{authenticationBackImage}
|
|
|
- )
|
|
|
+ <insert id="saveSencondHandProduct" parameterType="com.caimei365.commodity.model.po.ProductSecondPo"
|
|
|
+ keyProperty="id" useGeneratedKeys="true">
|
|
|
+ insert into cm_second_hand_detail(productID, sold, secondHandType, instrumentType, fixedYears, maturityYears,
|
|
|
+ companyName, detailTalkFlag,
|
|
|
+ originalPrice, contactName, contactMobile, dockingPeopleName,
|
|
|
+ dockingPeopleMobile, secondProductType,
|
|
|
+ townId, brandName, provinceCityDistrict, address, productQuality,
|
|
|
+ productDetails, viewingNum, payStatus,
|
|
|
+ payAmount, payFormData, payType, payDate, submitDate, reviewedDate,
|
|
|
+ onLineDate, source, publisher, authenticationImage,
|
|
|
+ fileName, ossName, commitmentImage, publishIdentity, licenseImage,
|
|
|
+ authenticationBackImage)
|
|
|
+ values (#{productId}, #{sold}, #{secondHandType}, #{instrumentType}, #{fixedYears}, #{maturityYears},
|
|
|
+ #{companyName},
|
|
|
+ #{detailTalkFlag}, #{originalPrice}, #{contactName}, #{contactMobile}, #{dockingPeopleName},
|
|
|
+ #{dockingPeopleMobile},
|
|
|
+ #{secondProductType}, #{townId}, #{brandName}, #{provinceCityDistrict}, #{address}, #{productQuality},
|
|
|
+ #{productDetails},
|
|
|
+ #{viewingNum}, #{payStatus}, #{payAmount}, #{payFormData}, #{payType}, #{payDate}, #{submitDate},
|
|
|
+ #{reviewedDate},
|
|
|
+ #{onLineDate}, #{source}, #{publisher}, #{authenticationImage}, #{fileName}, #{ossName},
|
|
|
+ #{commitmentImage}, #{publishIdentity},
|
|
|
+ #{licenseImage}, #{authenticationBackImage})
|
|
|
</insert>
|
|
|
<insert id="insertProductImage" parameterType="com.caimei365.commodity.model.po.ProductImagePo">
|
|
|
insert into productimage (productID, shopID, addTime, image, mainFlag, sortIndex)
|
|
|
values (#{productId}, #{shopId}, #{addTime}, #{image}, #{mainFlag}, #{sortIndex})
|
|
|
</insert>
|
|
|
- <insert id="insertProduct" keyColumn="productID" keyProperty="productId" parameterType="com.caimei365.commodity.model.po.ProductPo" useGeneratedKeys="true">
|
|
|
- insert into product (
|
|
|
- brandId, name, price, stock, aliasName, normalPrice, mainImage, productCategory, preferredFlag, shopId,
|
|
|
- sellNumber, costPrice, costCheckFlag, costProportional, hasSkuFlag, validFlag, ladderPriceFlag, sortIndex, featuredFlag, byFlag,
|
|
|
- step, actFlag, actStatus, freePostFlag, productType, machineType, includedTax, recommendType, invoiceType,
|
|
|
- visibility, addTime, updateTime, onlineTime, downlineTime,announType
|
|
|
- ) values (
|
|
|
- #{brandId}, #{name}, #{price}, #{stock}, #{aliasName}, #{normalPrice}, #{mainImage}, #{productCategory},
|
|
|
- #{preferredFlag}, #{shopId}, #{sellNumber}, #{costPrice}, #{costCheckFlag}, #{costProportional}, #{hasSkuFlag}, #{validFlag},
|
|
|
- #{ladderPriceFlag}, #{sortIndex}, #{featuredFlag}, #{byFlag}, #{step}, #{actFlag}, #{actStatus},
|
|
|
- #{freePostFlag}, #{productType}, #{machineType}, #{includedTax}, #{recommendType}, #{invoiceType},
|
|
|
- #{visibility}, #{addTime}, #{updateTime}, #{onlineTime}, #{offlineTime},#{announType}
|
|
|
- )
|
|
|
+ <insert id="insertProduct" keyColumn="productID" keyProperty="productId"
|
|
|
+ parameterType="com.caimei365.commodity.model.po.ProductPo" useGeneratedKeys="true">
|
|
|
+ insert into product (brandId, name, aliasName, mainImage, productCategory, preferredFlag, shopId,
|
|
|
+ sellNumber, hasSkuFlag, validFlag, sortIndex, featuredFlag, byFlag,
|
|
|
+ step, actFlag, actStatus, freePostFlag, productType, machineType, includedTax,
|
|
|
+ recommendType, invoiceType,
|
|
|
+ visibility, addTime, updateTime, onlineTime, downlineTime, announType)
|
|
|
+ values (#{brandId}, #{name}, #{aliasName}, #{mainImage}, #{productCategory},
|
|
|
+ #{preferredFlag}, #{shopId}, #{sellNumber}, #{hasSkuFlag}, #{validFlag},
|
|
|
+ #{sortIndex}, #{featuredFlag}, #{byFlag}, #{step}, #{actFlag}, #{actStatus},
|
|
|
+ #{freePostFlag}, #{productType}, #{machineType}, #{includedTax}, #{recommendType}, #{invoiceType},
|
|
|
+ #{visibility}, #{addTime}, #{updateTime}, #{onlineTime}, #{offlineTime}, #{announType})
|
|
|
</insert>
|
|
|
<insert id="insertSecondFileType">
|
|
|
insert into cm_second_file_type
|
|
|
- (fileType,secondId,productId)
|
|
|
- values (#{fileType},#{secondId},#{productId})
|
|
|
+ (fileType, secondId, productId)
|
|
|
+ values (#{fileType}, #{secondId}, #{productId})
|
|
|
</insert>
|
|
|
- <insert id="insertShop" keyColumn="shopID" keyProperty="shopId" parameterType="com.caimei365.commodity.model.vo.ShopVo" useGeneratedKeys="true">
|
|
|
- insert into shop (name,linkMan,contractMobile,cardNumber,accountType,banOfDeposit,accountName,addTime,status,shopType)
|
|
|
- values (#{name},#{linkMan},#{contractMobile},#{cardNumber},#{accountType},#{banOfDeposit},#{accountName},now(),90,0)
|
|
|
+ <insert id="insertShop" keyColumn="shopID" keyProperty="shopId"
|
|
|
+ parameterType="com.caimei365.commodity.model.vo.ShopVo" useGeneratedKeys="true">
|
|
|
+ insert into shop (name, linkMan, contractMobile, cardNumber, accountType, banOfDeposit, accountName, addTime,
|
|
|
+ status, shopType)
|
|
|
+ values (#{name}, #{linkMan}, #{contractMobile}, #{cardNumber}, #{accountType}, #{banOfDeposit}, #{accountName},
|
|
|
+ now(), 90, 0)
|
|
|
</insert>
|
|
|
<update id="updateSecondHandViews">
|
|
|
- UPDATE cm_second_hand_detail SET viewingNum = #{viewingNum}
|
|
|
+ UPDATE cm_second_hand_detail
|
|
|
+ SET viewingNum = #{viewingNum}
|
|
|
WHERE productID = #{productId}
|
|
|
</update>
|
|
|
<select id="getSeconHandList" resultType="com.caimei365.commodity.model.vo.SecondListVo">
|
|
|
select
|
|
|
- p.productID as productId,
|
|
|
- p.actStatus,
|
|
|
- p.`name` as name,
|
|
|
- p.mainImage as image,
|
|
|
- p.price,
|
|
|
- p.brandID as brandId,
|
|
|
- IF(p.brandID != 161,cb.name ,cshd.brandName) as "brandName",
|
|
|
- cshd.sold as "sold",
|
|
|
- cshd.detailTalkFlag as "detailTalkFlag",
|
|
|
- cshd.onLineDate as "onLineDate",
|
|
|
- cshd.viewingNum as "viewingNum",
|
|
|
- cshd.provinceCityDistrict as "provinceCityDistrict"
|
|
|
- from
|
|
|
- product p
|
|
|
+ p.productID as productId,
|
|
|
+ p.actStatus,
|
|
|
+ p.`name` as name,
|
|
|
+ p.mainImage as image,
|
|
|
+ cs.price,
|
|
|
+ p.brandID as brandId,
|
|
|
+ IF(p.brandID != 161,cb.name ,cshd.brandName) as "brandName",
|
|
|
+ cshd.sold as "sold",
|
|
|
+ cshd.detailTalkFlag as "detailTalkFlag",
|
|
|
+ cshd.onLineDate as "onLineDate",
|
|
|
+ cshd.viewingNum as "viewingNum",
|
|
|
+ cshd.provinceCityDistrict as "provinceCityDistrict"
|
|
|
+ from product p
|
|
|
+ left join cm_sku cs on p.productID=cs.productId
|
|
|
left join cm_second_hand_detail cshd on p.productID = cshd.productID
|
|
|
left join cm_brand cb on cb.id = p.brandID
|
|
|
where
|
|
|
- p.productCategory = 2 and p.validFlag = 2
|
|
|
+ p.productCategory = 2 and p.validFlag = 2
|
|
|
<if test="secondHandType != null and secondHandType != ''">
|
|
|
and cshd.secondHandType = #{secondHandType}
|
|
|
</if>
|
|
@@ -89,103 +100,106 @@
|
|
|
order by cshd.sold, cshd.onLineDate desc
|
|
|
</select>
|
|
|
<select id="getSecondHandDetail" resultType="com.caimei365.commodity.model.vo.SecondDetailVo">
|
|
|
- select
|
|
|
- p.productID as productId,
|
|
|
- p.actStatus,
|
|
|
- p.`name` as name,
|
|
|
- p.mainImage as image,
|
|
|
- p.price,
|
|
|
- p.normalPrice,
|
|
|
- p.productType,
|
|
|
- p.stock,
|
|
|
- p.brandID as brandId,
|
|
|
- p.visibility as visibility,
|
|
|
- IF(p.brandID != 161,cb.name ,cshd.brandName) as "brandName",
|
|
|
- cb.description as "brandInfo",
|
|
|
- cshd.originalPrice,
|
|
|
- cshd.sold,
|
|
|
- cshd.detailTalkFlag,
|
|
|
- cshd.onLineDate,
|
|
|
- cshd.viewingNum,
|
|
|
- cshd.provinceCityDistrict,
|
|
|
- cshd.productDetails,
|
|
|
- cshd.productQuality,
|
|
|
- cshd.secondHandType,
|
|
|
- ifnull(cshd.instrumentType,0) as instrumentType,
|
|
|
- cshd.showContactFlag,
|
|
|
- cshd.contactMobile,
|
|
|
- cshd.contactName,
|
|
|
- cshd.fixedYears,
|
|
|
- cshd.maturityYears,
|
|
|
- cshd.publishIdentity,
|
|
|
- cshd.companyName
|
|
|
+ select p.productID as productId,
|
|
|
+ p.actStatus,
|
|
|
+ p.`name` as name,
|
|
|
+ p.mainImage as image,
|
|
|
+ cs.price,
|
|
|
+ cs.normalPrice,
|
|
|
+ p.productType,
|
|
|
+ cs.stock,
|
|
|
+ p.brandID as brandId,
|
|
|
+ p.visibility as visibility,
|
|
|
+ IF(p.brandID != 161, cb.name, cshd.brandName) as "brandName",
|
|
|
+ cb.description as "brandInfo",
|
|
|
+ cshd.originalPrice,
|
|
|
+ cshd.sold,
|
|
|
+ cshd.detailTalkFlag,
|
|
|
+ cshd.onLineDate,
|
|
|
+ cshd.viewingNum,
|
|
|
+ cshd.provinceCityDistrict,
|
|
|
+ cshd.productDetails,
|
|
|
+ cshd.productQuality,
|
|
|
+ cshd.secondHandType,
|
|
|
+ ifnull(cshd.instrumentType, 0) as instrumentType,
|
|
|
+ cshd.showContactFlag,
|
|
|
+ cshd.contactMobile,
|
|
|
+ cshd.contactName,
|
|
|
+ cshd.fixedYears,
|
|
|
+ cshd.maturityYears,
|
|
|
+ cshd.publishIdentity,
|
|
|
+ cshd.companyName
|
|
|
from product p
|
|
|
- left join cm_second_hand_detail cshd on p.productID = cshd.productID
|
|
|
- left join cm_brand cb on cb.id = p.brandID
|
|
|
- where p.productCategory = 2 and p.productID = #{productId}
|
|
|
+ left join cm_sku cs on p.productID = cs.productId
|
|
|
+ left join cm_second_hand_detail cshd on p.productID = cshd.productID
|
|
|
+ left join cm_brand cb on cb.id = p.brandID
|
|
|
+ where p.productCategory = 2
|
|
|
+ and p.productID = #{productId}
|
|
|
</select>
|
|
|
<select id="getImageByProductId" resultType="java.lang.String">
|
|
|
- select image from productimage
|
|
|
+ select image
|
|
|
+ from productimage
|
|
|
where productID = #{productId}
|
|
|
order by mainFlag desc
|
|
|
</select>
|
|
|
<select id="getAddressInfo" resultType="com.caimei365.commodity.model.vo.AddressVo">
|
|
|
- select a.name as "province"
|
|
|
- ,b.name as "city"
|
|
|
- ,c.name as "town"
|
|
|
- ,c.townId as "townID"
|
|
|
+ select a.name as "province"
|
|
|
+ , b.name as "city"
|
|
|
+ , c.name as "town"
|
|
|
+ , c.townId as "townID"
|
|
|
from province a
|
|
|
- right join city b on a.provinceId = b.provinceId
|
|
|
- right join town c on b.cityId = c.cityId where c.townId = #{townId}
|
|
|
+ right join city b on a.provinceId = b.provinceId
|
|
|
+ right join town c on b.cityId = c.cityId
|
|
|
+ where c.townId = #{townId}
|
|
|
</select>
|
|
|
<select id="getOrderPageSecondList" resultType="com.caimei365.commodity.model.vo.SecondListVo">
|
|
|
select
|
|
|
- p.productID as productId,
|
|
|
- p.actStatus,
|
|
|
- p.`name` as name,
|
|
|
- p.mainImage as image,
|
|
|
- p.price,
|
|
|
- p.brandID as brandId,
|
|
|
- IF(p.brandID != 161,cb.name ,cshd.brandName) as "brandName",
|
|
|
- cshd.sold as "sold",
|
|
|
- cshd.detailTalkFlag as "detailTalkFlag",
|
|
|
- cshd.onLineDate as "onLineDate",
|
|
|
- cshd.viewingNum as "viewingNum",
|
|
|
- cshd.provinceCityDistrict as "provinceCityDistrict"
|
|
|
- from
|
|
|
- product p
|
|
|
+ p.productID as productId,
|
|
|
+ p.actStatus,
|
|
|
+ p.`name` as name,
|
|
|
+ p.mainImage as image,
|
|
|
+ cs.price,
|
|
|
+ p.brandID as brandId,
|
|
|
+ IF(p.brandID != 161,cb.name ,cshd.brandName) as "brandName",
|
|
|
+ cshd.sold as "sold",
|
|
|
+ cshd.detailTalkFlag as "detailTalkFlag",
|
|
|
+ cshd.onLineDate as "onLineDate",
|
|
|
+ cshd.viewingNum as "viewingNum",
|
|
|
+ cshd.provinceCityDistrict as "provinceCityDistrict"
|
|
|
+ from product p
|
|
|
+ left join cm_sku cs on p.productID=cs.productId
|
|
|
left join cm_second_hand_detail cshd on p.productID = cshd.productID
|
|
|
left join cm_brand cb on cb.id = p.brandID
|
|
|
where
|
|
|
- p.productCategory = 2 and p.validFlag = 2
|
|
|
- <if test="secondHandType != null and secondHandType != ''">
|
|
|
+ p.productCategory = 2 and p.validFlag = 2
|
|
|
+ <if test="secondHandType != null and secondHandType != ''">
|
|
|
and cshd.secondHandType = #{secondHandType}
|
|
|
- </if>
|
|
|
- <if test="instrumentType != null and instrumentType != ''">
|
|
|
- and cshd.instrumentType like CONCAT('%',#{instrumentType},'%')
|
|
|
- </if>
|
|
|
- <if test="searchKeyword != null and searchKeyword != ''">
|
|
|
+ </if>
|
|
|
+ <if test="instrumentType != null and instrumentType != ''">
|
|
|
+ and cshd.instrumentType like CONCAT('%',#{instrumentType},'%')
|
|
|
+ </if>
|
|
|
+ <if test="searchKeyword != null and searchKeyword != ''">
|
|
|
and p.name like CONCAT('%',#{searchKeyword},'%')
|
|
|
- </if>
|
|
|
- and cshd.sold != 1
|
|
|
- order by cshd.onLineDate desc
|
|
|
+ </if>
|
|
|
+ and cshd.sold != 1
|
|
|
+ order by cshd.onLineDate desc
|
|
|
</select>
|
|
|
<select id="getSecondListByLimit" resultType="com.caimei365.commodity.model.vo.SecondListVo">
|
|
|
select
|
|
|
- p.productID as productId,
|
|
|
- p.actStatus,
|
|
|
- p.`name` as name,
|
|
|
- p.mainImage as image,
|
|
|
- p.price,
|
|
|
- p.brandID as brandId,
|
|
|
- IF(p.brandID != 161,cb.name ,cshd.brandName) as "brandName",
|
|
|
- cshd.sold as "sold",
|
|
|
- cshd.detailTalkFlag as "detailTalkFlag",
|
|
|
- cshd.onLineDate as "onLineDate",
|
|
|
- cshd.viewingNum as "viewingNum",
|
|
|
- cshd.provinceCityDistrict as "provinceCityDistrict"
|
|
|
- from
|
|
|
- product p
|
|
|
+ p.productID as productId,
|
|
|
+ p.actStatus,
|
|
|
+ p.`name` as name,
|
|
|
+ p.mainImage as image,
|
|
|
+ cs.price,
|
|
|
+ p.brandID as brandId,
|
|
|
+ IF(p.brandID != 161,cb.name ,cshd.brandName) as "brandName",
|
|
|
+ cshd.sold as "sold",
|
|
|
+ cshd.detailTalkFlag as "detailTalkFlag",
|
|
|
+ cshd.onLineDate as "onLineDate",
|
|
|
+ cshd.viewingNum as "viewingNum",
|
|
|
+ cshd.provinceCityDistrict as "provinceCityDistrict"
|
|
|
+ from product p
|
|
|
+ left join cm_sku cs on p.productID=cs.productId
|
|
|
left join cm_second_hand_detail cshd on p.productID = cshd.productID
|
|
|
left join cm_brand cb on cb.id = p.brandID
|
|
|
where p.productCategory = 2 and p.validFlag = 2
|
|
@@ -198,28 +212,34 @@
|
|
|
<select id="getBrandList" resultType="com.caimei365.commodity.model.vo.BrandVo">
|
|
|
select id, name
|
|
|
from cm_brand
|
|
|
- where status = '1' and delFlag = '0' and description is not null and description != '' and id not in (161)
|
|
|
- order by sort
|
|
|
+ where status = '1'
|
|
|
+ and delFlag = '0'
|
|
|
+ and description is not null
|
|
|
+ and description != ''
|
|
|
+ and id not in (161)
|
|
|
+ order by sort
|
|
|
</select>
|
|
|
<select id="getSecondRecommends" resultType="com.caimei365.commodity.model.vo.SecondListVo">
|
|
|
- select
|
|
|
- p.productID as productId,
|
|
|
- p.actStatus,
|
|
|
- p.`name` as name,
|
|
|
- p.mainImage as image,
|
|
|
- p.price,
|
|
|
- p.brandID as brandId,
|
|
|
- cb.name as "brandName"
|
|
|
+ select p.productID as productId,
|
|
|
+ p.actStatus,
|
|
|
+ p.`name` as name,
|
|
|
+ p.mainImage as image,
|
|
|
+ cs.price,
|
|
|
+ p.brandID as brandId,
|
|
|
+ cb.name as "brandName"
|
|
|
from product p
|
|
|
- left join cm_second_hand_recommend cshr on p.productID = cshr.recommendProductID
|
|
|
- left join cm_brand cb on cb.id = p.brandID
|
|
|
- where p.validFlag = 2 and cshr.delFlag = 0
|
|
|
- and cshr.secondHandProductID = #{productId}
|
|
|
+ left join cm_sku cs on p.productID = cs.productId
|
|
|
+ left join cm_second_hand_recommend cshr on p.productID = cshr.recommendProductID
|
|
|
+ left join cm_brand cb on cb.id = p.brandID
|
|
|
+ where p.validFlag = 2
|
|
|
+ and cshr.delFlag = 0
|
|
|
+ and cshr.secondHandProductID = #{productId}
|
|
|
order by cshr.sort desc
|
|
|
</select>
|
|
|
<select id="findSecondShop" resultType="java.lang.Integer">
|
|
|
- select shopId from shop
|
|
|
+ select shopId
|
|
|
+ from shop
|
|
|
where shopType = 3
|
|
|
- AND cardNumber = #{cardNumber}
|
|
|
+ AND cardNumber = #{cardNumber}
|
|
|
</select>
|
|
|
</mapper>
|