123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- <?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
- ) 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}
- )
- </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, price1, stock, aliasName, normalPrice, mainImage, productCategory, preferredFlag, shopId,
- sellNumber, costPrice, costCheckFlag, hasSkuFlag, validFlag, ladderPriceFlag, sortIndex, featuredFlag, byFlag,
- step, actFlag, actStatus, freePostFlag, productType, machineType, includedTax, recommendType, invoiceType,
- visibility, addTime, updateTime, onlineTime, downlineTime
- ) values (
- #{brandId}, #{name}, #{price}, #{price}, #{stock}, #{aliasName}, #{normalPrice}, #{mainImage}, #{productCategory},
- #{preferredFlag}, #{shopId}, #{sellNumber}, #{costPrice}, #{costCheckFlag}, #{hasSkuFlag}, #{validFlag},
- #{ladderPriceFlag}, #{sortIndex}, #{featuredFlag}, #{byFlag}, #{step}, #{actFlag}, #{actStatus},
- #{freePostFlag}, #{productType}, #{machineType}, #{includedTax}, #{recommendType}, #{invoiceType},
- #{visibility}, #{addTime}, #{updateTime}, #{onlineTime}, #{offlineTime}
- )
- </insert>
- <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.price1 as 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_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>
- order by 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.price1 as price,
- p.normalPrice,
- p.productType,
- p.stock,
- p.brandID as brandId,
- 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,
- cshd.instrumentType,
- cshd.showContactFlag,
- cshd.contactMobile,
- cshd.contactName,
- cshd.fixedYears,
- cshd.maturityYears
- 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}
- </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,
- p.price1 as 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_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,
- p.price1 as 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_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>
- </mapper>
|