123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519 |
- <?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.ShopMapper">
- <insert id="insertProduct" keyColumn="productID" keyProperty="productId" parameterType="com.caimei365.commodity.model.po.ProductPo" useGeneratedKeys="true">
- insert into product (
- shopID, name, aliasName, commodityType, bigTypeID, smallTypeID, tinyTypeID, mainImage,
- brandID, productType, tags, unit, normalPrice, price, price1, includedTax, minBuyNumber, stock,
- <if test="productCategory != null and productCategory != ''">
- productCategory,
- </if>
- <if test="serviceNumber != null and serviceNumber != ''">
- serviceNumber,
- </if>
- <if test="supplierTaxPoint != null and supplierTaxPoint != ''">
- supplierTaxPoint,
- </if>
- <if test="addTime != null and addTime != ''">
- addTime,
- </if>
- <if test="hasSkuFlag != null and hasSkuFlag != ''">
- hasSkuFlag,
- </if>
- <if test="sellNumber != null and sellNumber != ''">
- sellNumber,
- </if>
- <if test="sortIndex != null and sortIndex != ''">
- sortIndex,
- </if>
- <if test="featuredFlag != null and featuredFlag != ''">
- featuredFlag,
- </if>
- <if test="costCheckFlag != null and costCheckFlag != ''">
- costCheckFlag,
- </if>
- <if test="recommendType != null and recommendType != ''">
- recommendType,
- </if>
- <if test="priceFlag != null and priceFlag != ''">
- price1TextFlag,
- </if>
- <if test="actFlag != null and actFlag != ''">
- actFlag,
- </if>
- <if test="ladderPriceFlag != null and ladderPriceFlag != ''">
- ladderPriceFlag,
- </if>
- <if test="visibility != null and visibility != ''">
- visibility,
- </if>
- <if test="productCode != null and productCode != ''">
- productCode,
- </if>
- <if test="searchKey != null and searchKey != ''">
- searchKey,
- </if>
- <if test="allAreaFlag != null and allAreaFlag != ''">
- allAreaFlag,
- </if>
- <if test="step != null and step != ''">
- step,
- </if>
- <if test="costPrice != null and costPrice != ''">
- costPrice,
- </if>
- <if test="provinceIds != null and provinceIds != ''">
- provinceIds,
- </if>
- <if test="machineType != null and machineType != ''">
- machineType,
- </if>
- <if test="qualificationImg != null and qualificationImg != ''">
- qualificationImg,
- </if>
- <if test="invoiceType != null and invoiceType != ''">
- invoiceType,
- </if>
- updateTime, validFlag
- ) values (
- #{shopId}, #{name}, #{aliasName}, #{commodityType}, #{bigTypeId}, #{smallTypeId}, #{tinyTypeId}, #{mainImage},
- #{brandId}, #{productType}, #{tags}, #{unit}, #{normalPrice}, #{price}, #{price}, #{includedTax}, #{minBuyNumber}, #{stock},
- <if test="productCategory != null and productCategory != ''">
- #{productCategory},
- </if>
- <if test="serviceNumber != null and serviceNumber != ''">
- #{serviceNumber},
- </if>
- <if test="supplierTaxPoint != null and supplierTaxPoint != ''">
- #{supplierTaxPoint},
- </if>
- <if test="addTime != null and addTime != ''">
- #{addTime},
- </if>
- <if test="hasSkuFlag != null and hasSkuFlag != ''">
- #{hasSkuFlag},
- </if>
- <if test="sellNumber != null and sellNumber != ''">
- #{sellNumber},
- </if>
- <if test="sortIndex != null and sortIndex != ''">
- #{sortIndex},
- </if>
- <if test="featuredFlag != null and featuredFlag != ''">
- #{featuredFlag},
- </if>
- <if test="costCheckFlag != null and costCheckFlag != ''">
- #{costCheckFlag},
- </if>
- <if test="recommendType != null and recommendType != ''">
- #{recommendType},
- </if>
- <if test="priceFlag != null and priceFlag != ''">
- #{priceFlag},
- </if>
- <if test="actFlag != null and actFlag != ''">
- #{actFlag},
- </if>
- <if test="ladderPriceFlag != null and ladderPriceFlag != ''">
- #{ladderPriceFlag},
- </if>
- <if test="visibility != null and visibility != ''">
- #{visibility},
- </if>
- <if test="productCode != null and productCode != ''">
- #{productCode},
- </if>
- <if test="searchKey != null and searchKey != ''">
- #{searchKey},
- </if>
- <if test="allAreaFlag != null and allAreaFlag != ''">
- #{allAreaFlag},
- </if>
- <if test="step != null and step != ''">
- #{step},
- </if>
- <if test="costPrice != null and costPrice != ''">
- #{costPrice},
- </if>
- <if test="provinceIds != null and provinceIds != ''">
- #{provinceIds},
- </if>
- <if test="machineType != null and machineType != ''">
- #{machineType},
- </if>
- <if test="qualificationImg != null and qualificationImg != ''">
- #{qualificationImg},
- </if>
- <if test="invoiceType != null and invoiceType != ''">
- #{invoiceType},
- </if>
- #{updateTime}, #{validFlag}
- )
- </insert>
- <update id="updateProduct">
- update product set
- shopID = #{shopId}, name = #{name}, aliasName = #{aliasName}, commodityType = #{commodityType},
- bigTypeId = #{bigTypeId}, smallTypeId = #{smallTypeId}, tinyTypeId = #{tinyTypeId}, mainImage = #{mainImage},
- brandId = #{brandId}, productType = #{productType}, tags = #{tags}, unit = #{unit}, normalPrice = #{normalPrice},
- price = #{price}, price1 = #{price}, includedTax = #{includedTax}, minBuyNumber = #{minBuyNumber}, stock = #{stock},
- <if test="productCategory != null and productCategory != ''">
- productCategory = #{productCategory},
- </if>
- <if test="serviceNumber != null and serviceNumber != ''">
- serviceNumber = #{serviceNumber},
- </if>
- <if test="supplierTaxPoint != null and supplierTaxPoint != ''">
- supplierTaxPoint = #{supplierTaxPoint},
- </if>
- <if test="addTime != null and addTime != ''">
- addTime = #{addTime},
- </if>
- <if test="hasSkuFlag != null and hasSkuFlag != ''">
- hasSkuFlag = #{hasSkuFlag},
- </if>
- <if test="sellNumber != null and sellNumber != ''">
- sellNumber = #{sellNumber},
- </if>
- <if test="sortIndex != null and sortIndex != ''">
- sortIndex = #{sortIndex},
- </if>
- <if test="featuredFlag != null and featuredFlag != ''">
- featuredFlag = #{featuredFlag},
- </if>
- <if test="costCheckFlag != null and costCheckFlag != ''">
- costCheckFlag = #{costCheckFlag},
- </if>
- <if test="recommendType != null and recommendType != ''">
- recommendType = #{recommendType},
- </if>
- <if test="priceFlag != null and priceFlag != ''">
- price1TextFlag = #{priceFlag},
- </if>
- <if test="actFlag != null and actFlag != ''">
- actFlag = #{actFlag},
- </if>
- <if test="ladderPriceFlag != null and ladderPriceFlag != ''">
- ladderPriceFlag = #{ladderPriceFlag},
- </if>
- <if test="visibility != null and visibility != ''">
- visibility = #{visibility},
- </if>
- <if test="productCode != null and productCode != ''">
- productCode = #{productCode},
- </if>
- <if test="searchKey != null and searchKey != ''">
- searchKey = #{searchKey},
- </if>
- <if test="allAreaFlag != null and allAreaFlag != ''">
- allAreaFlag = #{allAreaFlag},
- </if>
- <if test="step != null and step != ''">
- step = #{step},
- </if>
- <if test="costPrice != null and costPrice != ''">
- costPrice = #{costPrice},
- </if>
- <if test="provinceIds != null and provinceIds != ''">
- provinceIds = #{provinceIds},
- </if>
- <if test="machineType != null and machineType != ''">
- machineType = #{machineType},
- </if>
- <if test="qualificationImg != null and qualificationImg != ''">
- qualificationImg = #{qualificationImg},
- </if>
- <if test="invoiceType != null and invoiceType != ''">
- invoiceType = #{invoiceType},
- </if>
- updateTime = #{updateTime}, validFlag = #{validFlag}
- where productID = #{productId}
- </update>
- <insert id="insertProductImage">
- insert into productimage (productID, shopID, addTime, image, mainFlag, sortIndex)
- values (#{productId}, #{shopId}, #{addTime}, #{image}, #{mainFlag}, #{sortIndex})
- </insert>
- <insert id="insertProductParameters" parameterType="com.caimei365.commodity.model.po.ProductParameterPo">
- insert into cm_product_related_parameters (productId, paramsName, paramsContent, delFlag)
- values (#{productId}, #{paramsName}, #{paramsContent}, #{delFlag})
- </insert>
- <insert id="insertProductDetailInfo">
- insert into productdetailinfo (
- productID, propValueAlias, propValueImages,
- detailInfo, serviceInfo, orderInfo, detailInfoTxt, seoTitle,
- seoKeyword, seoDes
- ) values (
- #{productId}, #{propValueAlias}, #{propValueImages},
- #{detailInfo}, #{serviceInfo}, #{orderInfo}, #{detailInfoTxt}, #{seoTitle},
- #{seoKeyword}, #{seoDes}
- )
- </insert>
- <insert id="insertBrand" keyColumn="id" keyProperty="id" parameterType="com.caimei365.commodity.model.po.BrandPo" useGeneratedKeys="true">
- insert into cm_brand (name, source, userID, status, delFlag, createDate, updateDate, logo, description)
- values (#{name},#{source},#{userId},#{status}, #{delFlag},#{createDate},#{updateDate},#{logo},#{description})
- </insert>
- <update id="updateBrand">
- update cm_brand
- <set>
- <if test="name != null">
- `name` = #{name},
- </if>
- <if test="source != null">
- `source` = #{source},
- </if>
- <if test="userId != null">
- userID = #{userId},
- </if>
- <if test="status != null">
- `status` = #{status},
- </if>
- <if test="delFlag != null">
- delFlag = #{delFlag},
- </if>
- <if test="updateDate != null">
- updateDate = #{updateDate},
- </if>
- <if test="logo != null">
- logo = #{logo},
- </if>
- <if test="description != null">
- description = #{description},
- </if>
- </set>
- where id = #{id}
- </update>
- <update id="updateProductImage">
- update productimage set productID = #{productId}, shopID = #{shopId}, addTime = #{addTime},
- image = #{image}, mainFlag = #{mainFlag}, sortIndex = #{sortIndex}
- where productImageId = #{id}
- </update>
- <update id="updateProductDetailInfo">
- update productdetailinfo set
- propValueAlias = #{propValueAlias},
- propValueImages = #{propValueImages},
- detailInfo = #{detailInfo},
- detailInfoTxt = #{detailInfoTxt},
- seoTitle = #{seoTitle},
- seoKeyword = #{seoKeyword},
- seoDes = #{seoDes},
- serviceInfo = #{serviceInfo},
- orderInfo = #{orderInfo}
- where
- productDetailInfoID = #{productDetailInfoId}
- </update>
- <update id="updateProductFeatured">
- update product set featuredFlag = #{featuredFlag}
- where productID = #{productId}
- and shopID = #{shopId}
- </update>
- <update id="updateProductValidFlag">
- update product set validFlag = #{validFlag} where productID = #{productId}
- </update>
- <update id="updateProductCode">
- update product set productCode = #{productCode} where productID = #{productId}
- </update>
- <delete id="deleteProductImage">
- delete from productimage where productImageID = #{id}
- </delete>
- <delete id="deleteProductParameters">
- delete from cm_product_related_parameters where productId = #{productId}
- </delete>
- <select id="getMainProducts" resultType="com.caimei365.commodity.model.search.ProductListVo">
- select
- p.productID as productId,
- p.actStatus,
- p.shopID as shopId,
- p.`name` as `name`,
- p.mainImage as image,
- p.price1 as price,
- p.unit as unit,
- p.price1TextFlag as priceFlag,
- IFNULL(p.visibility,3) as visibility,
- p.price8Text as beautyActFlag
- from product p
- where p.shopID = #{shopId}
- and p.visibility in
- <foreach collection="visibilityList" item="visibility" index="index" open="(" separator="," close=")">
- #{visibility}
- </foreach>
- and p.validFlag = 2 and p.featuredFlag=1
- order by p.productID desc limit 4
- </select>
- <select id="getShopProductsSelect" resultType="com.caimei365.commodity.model.vo.ProductItemVo">
- select
- p.productID as productId,
- p.actStatus,
- p.name,
- p.aliasName,
- p.mainImage as image,
- p.unit,
- p.productCode as code,
- p.price1TextFlag as priceFlag,
- p.price1 as price,
- p.shopID as shopId,
- p.searchKey as keyword,
- p.price8Text as beautyActFlag,
- p.minBuyNumber as minBuyNumber,
- p.maxBuyNumber as maxBuyNumber,
- p.ladderPriceFlag,
- p.normalPrice,
- p.step,
- p.shopID as shopId,
- p.taxPoint as taxRate,
- p.includedTax,
- p.invoiceType,
- p.productCategory as productCategory,
- p.validFlag,
- p.featuredFlag,
- p.commodityType,
- p.bigTypeID as bigTypeId,
- p.smallTypeID as smallTypeId,
- p.tinyTypeID as tinyTypeId
- from product p
- <where>
- p.shopID = #{shopId}
- <if test="productCode != null and productCode != ''">
- and p.productCode = #{productCode}
- </if>
- <if test="validFlag != null and validFlag != ''">
- and p.validFlag = #{validFlag}
- </if>
- <if test="featuredFlag != null and featuredFlag != ''">
- and p.featuredFlag = #{featuredFlag}
- </if>
- <if test="tinyTypeId != null and tinyTypeId != 0">
- and p.tinyTypeID = #{tinyTypeId}
- </if>
- <if test="smallTypeId != null and smallTypeId != 0">
- and p.smallTypeID = #{smallTypeId}
- </if>
- <if test="bigTypeId != null and bigTypeId != 0">
- and p.bigTypeID = #{bigTypeId}
- </if>
- <if test="commodityType != null and commodityType != ''">
- and p.commodityType = #{commodityType}
- </if>
- <if test="name != null and name != ''">
- and p.name like CONCAT("%",#{name},"%")
- </if>
- </where>
- order by p.productID desc
- </select>
- <select id="getTypeName" resultType="java.lang.String">
- select
- CONCAT_WS("-", b.name, s.name, t.name)
- from
- bigtype b
- left join smalltype s on s.smallTypeID = #{smallTypeId}
- left join tinytype t on t.tinyTypeID = #{tinyTypeId}
- where
- b.bigTypeID = #{bigTypeId};
- </select>
- <select id="getUserIdByshopId" resultType="java.lang.Integer">
- select userID from user where shopID = #{shopId}
- </select>
- <select id="getMainProductsCount" resultType="java.lang.Integer">
- select count(*) from product where shopID = #{shopId}
- and validFlag = '2' and featuredFlag='1' order by productID desc
- </select>
- <select id="getCodeByTypeId" resultType="java.lang.String">
- select
- CONCAT(IFNULL(b.bigTypeCode,''), IFNULL(s.smallTypeCode,''), IFNULL(t.tinyTypeCode,''))
- from bigtype b
- left join smalltype s on s.bigTypeID = b.bigTypeID
- left join tinytype t on t.smallTypeID = s.smallTypeID
- <where>
- <if test="bigTypeId != null">
- b.bigTypeID = #{bigTypeId}
- </if>
- <if test="smallTypeId != null">
- and s.smallTypeID = #{smallTypeId}
- </if>
- <if test="tinyTypeId != null">
- and t.tinyTypeID = #{tinyTypeId}
- </if>
- </where>
- </select>
- <select id="getImageByProductId" resultType="com.caimei365.commodity.model.po.ProductImagePo">
- select productImageID as id, productID as productId, shopID as shopId, addTime, image, mainFlag, sortIndex
- from productimage
- where productID = #{productId}
- order by mainFlag DESC
- </select>
- <select id="getProductForm" resultType="com.caimei365.commodity.model.vo.ProductFormVo">
- select productID as productId, shopID as shopId, name, aliasName, commodityType, mainImage, stock, invoiceType,
- bigTypeID as bigTypeId, smallTypeID as smallTypeId, tinyTypeID as tinyTypeId, searchKey, visibility,
- brandID as brandId, productType, tags, unit, normalPrice, price1 as price, includedTax, minBuyNumber,
- productCategory, serviceNumber, supplierTaxPoint, price1TextFlag as priceFlag, actFlag, ladderPriceFlag,
- addTime, hasSkuFlag, sellNumber, sortIndex, featuredFlag, costCheckFlag, recommendType, machineType,
- productCode, updateTime, validFlag, searchKey, allAreaFlag, step, costPrice, provinceIds, qualificationImg
- from product
- where productID = #{productId}
- </select>
- <select id="getBrandNameById" resultType="java.lang.String">
- select name from cm_brand where id = #{brandId}
- </select>
- <select id="getProductParameters" resultType="com.caimei365.commodity.model.po.ProductParameterPo">
- select id, productID as productId, paramsName, paramsContent
- from cm_product_related_parameters
- where productId = #{productId} AND delFlag='0'
- </select>
- <select id="getProductImages" resultType="com.caimei365.commodity.model.po.ProductImagePo">
- select productImageID as id, productID as productId, shopId, addTime, image, mainFlag, sortIndex
- from productimage
- where productID = #{productId} order by mainFlag desc
- </select>
- <select id="getProductDetailInfo" resultType="com.caimei365.commodity.model.po.ProductDetailInfoPo">
- select productDetailInfoId, productId, detailInfo, serviceInfo, orderInfo, propValueAlias,
- propValueImages, detailInfoTxt, seoTitle, seoKeyword, seoDes
- from productdetailinfo
- where productId = #{productId}
- </select>
- <select id="getProductShopById" resultType="com.caimei365.commodity.model.vo.ShopVo">
- select userID as userId, shopID as shopId, name, sname as shortName, linkMan, contractMobile,
- contractEmail1 as contractEmail, contractEmail1 as email, provinceID as proviceId, cityID as cityId, townID as townId,
- address, socialCreditCode, businessLicenseImage as businessLicense, firstShopType, secondShopType,
- mainpro as mainProduct, productDesc as mainProductDesc,legalPerson,registeredCapital,fax as faxNumber,
- nature as companyNature, turnover, medicalPracticeLicenseImg1 as medicalPracticeLicense, info as shopDesc,
- businessScope, logo, addTime, status, contractPhone, validFlag, website, wxOfficialAccount, wxApplets
- from shop where shopID = #{shopId}
- </select>
- <select id="getProductNumById" resultType="java.lang.Integer">
- select COUNT(*) as normalNum from product p
- where p.shopID = #{shopId} and p.validFlag = 2
- group by p.shopID
- </select>
- <select id="getUserIdentityById" resultType="java.lang.Integer">
- select userIdentity from user
- where userID = #{userId}
- </select>
- <select id="getBrandAssociation" resultType="com.caimei365.commodity.model.vo.BrandVo">
- select id, name from cm_brand
- where
- status = '1' and delFlag = '0'
- and name like CONCAT("%",#{name},"%")
- order by
- case when ( source = '1' and userID = #{userId} )
- then 0
- else 1
- end asc,
- LENGTH(name) asc
- </select>
- <select id="getBrandByName" resultType="com.caimei365.commodity.model.vo.BrandVo">
- select id, name from cm_brand where name = #{name} and delFlag = '0'
- </select>
- <select id="getShopBrandList" resultType="com.caimei365.commodity.model.vo.BrandVo">
- select id, name, source, userId, status, auditNote, sort, delFlag, logo, description, createDate, updateDate
- from cm_brand
- <where>
- userID = #{userId}
- and delFlag = '0'
- <if test="name != null and name != ''">
- and name like CONCAT("%",#{name},"%")
- </if>
- <if test="status != null and status != ''">
- and status = #{status}
- </if>
- </where>
- order by createDate desc
- </select>
- </mapper>
|