123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- <?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.user.mapper.ShopMapper">
- <insert id="insertShopCert">
- insert into shopcert (shopID, shopCertTypeID, `name`,
- image, organization, effectDate,
- loseEfficacyDate)
- values (#{shopId}, #{shopCertTypeId}, #{name},
- #{image}, #{organization}, #{effectDate},
- #{loseEfficacyDate})
- </insert>
- <update id="updateShopUserByUpdateInfo">
- update user
- set name = #{name}, userName = #{userName}, email = #{email}
- where userID = #{userId}
- </update>
- <update id="updateShopByUpdateInfo">
- update shop
- <set>
- <if test="shortName != null and shortName != ''">
- sname = #{shortName},
- </if>
- <if test="contractEmail != null and contractEmail != ''">
- contractEmail = #{contractEmail},
- </if>
- <if test="contractPhone != null and contractPhone != ''">
- contractPhone = #{contractPhone},
- </if>
- <if test="linkMan != null and linkMan != ''">
- linkMan = #{linkMan},
- </if>
- <if test="townId != null and townId != ''">
- provinceID = #{provinceId}, cityID = #{cityId}, townID = #{townId},address = #{address},
- </if>
- <if test="socialCreditCode != null and socialCreditCode != ''">
- socialCreditCode = #{socialCreditCode},
- </if>
- <if test="businessLicense != null and businessLicense != ''">
- businessLicenseImage = #{businessLicense},
- </if>
- <if test="firstShopType != null and firstShopType != ''">
- firstShopType = #{firstShopType},
- </if>
- <if test="secondShopType != null and secondShopType != ''">
- secondShopType = #{secondShopType},
- </if>
- <if test="mainProduct != null and mainProduct != ''">
- mainpro = #{mainProduct},
- </if>
- <if test="mainProductDesc != null and mainProductDesc != ''">
- productDesc = #{mainProductDesc},
- </if>
- <if test="legalPerson != null and legalPerson != ''">
- legalPerson = #{legalPerson},
- </if>
- <if test="registeredCapital != null and registeredCapital != ''">
- registeredCapital = #{registeredCapital},
- </if>
- <if test="faxNumber != null and faxNumber != ''">
- fax = #{faxNumber},
- </if>
- <if test="companyNature != null and companyNature != ''">
- nature = #{companyNature},
- </if>
- <if test="turnover != null and turnover != ''">
- turnover = #{turnover},
- </if>
- <if test="medicalPracticeLicense != null and medicalPracticeLicense != ''">
- medicalPracticeLicenseImg1 = #{medicalPracticeLicense},
- </if>
- <if test="shopDesc != null and shopDesc != ''">
- info = #{shopDesc},
- </if>
- <if test="businessScope != null and businessScope != ''">
- businessScope = #{businessScope},
- </if>
- <if test="logo != null and logo != ''">
- logo = #{logo},
- </if>
- <if test="website != null and website != ''">
- website = #{website},
- </if>
- <if test="wxApplets != null and wxApplets != ''">
- wxApplets = #{wxApplets},
- </if>
- <if test="wxOfficialAccount != null and wxOfficialAccount != ''">
- wxOfficialAccount = #{wxOfficialAccount},
- </if>
- name = #{name}
- </set>
- where shopID = #{shopId}
- </update>
- <delete id="deleteShopCertByShopId">
- DELETE FROM shopcert WHERE shopID = #{shopId}
- </delete>
- <select id="getShopCert" resultType="java.lang.String">
- SELECT image FROM shopcert WHERE shopID = #{shopId} AND shopCertTypeID = #{shopCertTypeId}
- </select>
- <select id="getShopByUserId" resultType="com.caimei365.user.model.vo.UserLoginVo">
- select
- u.userID as userId,
- u.userOrganizeID as organizeId,
- u.clubID as clubId,
- u.shopID as shopId,
- u.serviceProviderId as serviceProviderId,
- u.userName as userName,
- u.name as name,
- u.mobile as mobile,
- u.bindMobile as bindMobile,
- u.email as email,
- u.userPermission as userPermission,
- u.userIdentity as userIdentity,
- u.password as password,
- u.guideFlag as guideFlag,
- u.clubStatus as clubStatus,
- u.manufacturerStatus as shopStatus
- from user u
- where u.userId = #{userId}
- </select>
- <select id="getShopById" resultType="com.caimei365.user.model.vo.ShopVo">
- select userID as userId, shopID as shopId, name, sname as shortName, linkMan, contractMobile,
- contractEmail, contractEmail 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="getShopHomeData" resultType="com.caimei365.user.model.vo.ShopHomeVo">
- select
- s.shopID as id,
- s.userID as userId,
- s.name,
- s.sname as abbr,
- s.logo,
- s.address,
- s.businessScope,
- s.businessLicenseImage as businessLicense,
- s.taxCertificateImage as taxCertificate,
- s.authorizationCertificateImage as certificate,
- s.info,
- s.productDesc,
- count(*) as normalNum
- from shop s
- where s.shopID = #{supplierId}
- group by s.shopID
- </select>
- <select id="getShopCertById" resultType="java.lang.String">
- SELECT image FROM shopcert WHERE shopID = #{shopId} AND shopCertTypeID = #{shopCertTypeId}
- </select>
- <select id="medicalPracticeLicense" resultType="java.lang.String">
- SELECT medicalPracticeLicenseImg1 FROM shop WHERE shopID = #{shopId}
- </select>
- <select id="getShopHomeImages" resultType="com.caimei365.user.model.vo.ShopBannerVo">
- select shopBannerID AS id, shopID AS shopId, image, link, title, info
- from shopbanner where shopID = #{shopId}
- </select>
- <select id="getShopPromotionsByShopId" resultType="com.caimei365.user.model.vo.PromotionsVo">
- select pr.id,
- pr.name,
- pr.description,
- pr.type,
- pr.mode,
- pr.touchPrice,
- pr.reducedPrice,
- pr.beginTime,
- pr.endTime,
- pr.status,
- prp.productId,
- prp.supplierId
- from cm_promotions pr
- left join cm_promotions_product prp on pr.id = prp.promotionsId
- where prp.supplierId = #{shopId}
- and (pr.status = 1 or ( pr.status = 2 and (NOW() between pr.beginTime and pr.endTime)))
- and pr.type=3
- and pr.delFlag not in (1,2)
- order by pr.type desc
- limit 1
- </select>
- <select id="getPromotionsGifts" resultType="com.caimei365.user.model.vo.ProductItemVo">
- select
- cpg.id as id,
- p.productID as productId,
- p.shopID as shopId,
- p.`name` as `name`,
- p.mainImage as image,
- cpg.number as number,
- 0 as price,
- 2 as productType,
- (select price from cm_sku where productId=p.productId order by price asc limit 1)as originalPrice,
- (select unit from cm_sku where productId=p.productId order by price asc limit 1)as unit,
- copi.validFlag as validFlag,
- (select stock from cm_sku where productId=p.productId order by price asc limit 1)as stock
- from product p
- left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 0
- left join cm_promotions_gift cpg on cpg.productId = p.productID
- where cpg.promotionsId = #{promotionsId}
- order by cpg.addTime desc
- </select>
- <select id="getShopProductCount" resultType="java.lang.Integer">
- SELECT COUNT(*)
- FROM product p
- left join cm_organize_product_info copi on p.productID = copi.productId
- WHERE p.shopID = #{shopId} and copi.organizeId = #{productOrganize}
- and p.groundMall LIKE concat('%',#{productOrganize},'%')
- <if test="validFlag != null">
- AND copi.validFlag = #{validFlag}
- </if>
- </select>
- <select id="getSalesRankingList" resultType="java.util.Map">
- SELECT cop.productID AS productId, SUM(cop.num) AS total
- FROM cm_order_product cop JOIN cm_order co ON co.orderID = cop.orderID
- WHERE cop.shopID = #{shopId} and cop.organizeID = #{organizeId}
- AND co.STATUS NOT IN ('0', '6', '7')
- AND co.delFlag = '0'
- AND co.secondHandOrderFlag != '1'
- GROUP BY productID
- ORDER BY total DESC
- LIMIT 5
- </select>
- <select id="getProductShown" resultType="com.caimei365.user.model.vo.ProductItemVo">
- SELECT name, mainImage AS image
- FROM product
- WHERE productId = #{productId}
- </select>
- <select id="getSalesStatistics" resultType="java.util.Map">
- SELECT COUNT(DISTINCT so.shopOrderID) AS orderQuantity,
- IFNULL(SUM(o.productTotalFee),0) AS orderAmount
- FROM cm_order o
- JOIN cm_shop_order so ON o.orderID = so.orderID
- WHERE o.status NOT IN('0', '6', '7')
- AND o.delFlag = '0'
- AND so.delFlag = '0'
- AND so.shopID = #{shopId}
- AND so.organizeID = #{organizeId}
- AND o.secondHandOrderFlag != '1'
- <if test="startTime != null and startTime != ''">
- AND o.orderTime <![CDATA[ >= ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.orderTime <![CDATA[ <= ]]> #{endTime}
- </if>
- </select>
- <select id="getShopHomeImageCount" resultType="java.lang.Integer">
- SELECT COUNT(*) FROM shopbanner WHERE shopID = #{shopId}
- </select>
- <insert id="insertShopHomeImage">
- INSERT INTO shopbanner (shopID,title,link,info,image)
- VALUES (#{shopId},#{title},#{link},#{info},#{image})
- </insert>
- <update id="updateShopHomeImage">
- UPDATE shopbanner
- SET title = #{title}, link = #{link}, info = #{info}, image = #{image}
- WHERE shopBannerID = #{id}
- </update>
- <delete id="deleteShopHomeImage">
- DELETE FROM shopbanner WHERE shopBannerID = #{id}
- </delete>
- </mapper>
|