123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245 |
- <?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>
- <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, 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})
- </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>
- <update id="updateSecondHandViews">
- 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,
- 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 != ''">
- and cshd.secondHandType = #{secondHandType}
- </if>
- <if test="instrumentType != null and instrumentType != '' and instrumentType != '0' and instrumentType != 0">
- and cshd.instrumentType like CONCAT('%',#{instrumentType},'%')
- </if>
- <if test="name != null and name != ''">
- and p.name like CONCAT('%',#{name},'%')
- </if>
- <if test="userIdentity == null or userIdentity == 0">
- AND p.visibility = 3
- </if>
- <if test="userIdentity == 4">
- AND p.visibility IN (2,3)
- </if>
- <if test="userIdentity == 2">
- AND p.visibility IN (1,2,3)
- </if>
- 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,
- 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_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
- 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"
- 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}
- </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,
- 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 != ''">
- and cshd.secondHandType = #{secondHandType}
- </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
- </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,
- 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 != ''">
- and cshd.secondHandType = #{secondHandType}
- </if>
- order by cshd.onLineDate desc
- limit 10
- </select>
- <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
- </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,
- cs.price,
- p.brandID as brandId,
- cb.name as "brandName"
- from product p
- 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
- where shopType = 3
- AND cardNumber = #{cardNumber}
- </select>
- </mapper>
|