123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342 |
- <?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.order.mapper.BaseMapper">
- <select id="getShopNameById" resultType="java.lang.String">
- SELECT `name`
- FROM shop
- WHERE shopID = #{shopId}
- LIMIT 1
- </select>
- <select id="getClubNameById" resultType="java.lang.String">
- SELECT `name`
- FROM club
- WHERE clubID = #{clubId}
- LIMIT 1
- </select>
- <insert id="insertUserInvoiceByUserId" parameterType="com.caimei365.order.model.vo.InvoiceVo">
- INSERT INTO cm_user_invoiceinfo (userId, invoiceTitle, corporationTaxNum, registeredAddress, registeredPhone,
- bankAccountNo, openBank)
- VALUES (#{userId}, #{invoiceTitle}, #{corporationTaxNum}, #{registeredAddress}, #{registeredPhone},
- #{bankAccountNo}, #{openBank})
- </insert>
- <insert id="insertPurchasePrice" keyColumn="id" keyProperty="id"
- parameterType="com.caimei365.order.model.po.PurchasePricePo" useGeneratedKeys="true">
- INSERT INTO repeat_purchase_price (userId, clubId, orderId, productId, shopId, shopName,
- taxRate, currentPrice, createTime, updateTime, delFlag)
- VALUES (#{userId}, #{clubId}, #{orderId}, #{productId}, #{shopId}, #{shopName},
- #{taxRate}, #{currentPrice}, #{createTime}, #{updateTime}, #{delFlag})
- </insert>
- <insert id="insertPurchaseHistory" keyColumn="id" keyProperty="id"
- parameterType="com.caimei365.order.model.po.PurchaseHistoryPo" useGeneratedKeys="true">
- INSERT INTO repeat_purchase_price_history (userId, clubId, orderId, productId, price, currentCostPrice,
- createTime, delFlag)
- VALUES (#{userId}, #{clubId}, #{orderId}, #{productId}, #{price}, #{currentCostPrice}, #{createTime},
- #{delFlag})
- </insert>
- <update id="updateUserInvoiceByUserId" parameterType="com.caimei365.order.model.vo.InvoiceVo">
- UPDATE cm_user_invoiceinfo
- SET invoiceTitle = #{invoiceTitle},
- corporationTaxNum = #{corporationTaxNum},
- registeredAddress = #{registeredAddress},
- registeredPhone = #{registeredPhone},
- bankAccountNo = #{bankAccountNo},
- openBank = #{openBank}
- WHERE userId = #{userId}
- </update>
- <update id="updatePurchasePrice">
- UPDATE repeat_purchase_price
- SET currentPrice = #{currentPrice},
- taxRate = #{taxRate},
- updateTime = #{updateTime}
- WHERE id = #{id}
- </update>
- <select id="getUserIdByClubId" resultType="java.lang.Integer">
- select userID
- from user
- where clubID = #{clubId}
- LIMIT 1
- </select>
- <select id="getIdentityByUserId" resultType="java.lang.Integer">
- select ifnull(userIdentity,0)
- from user
- where userID = #{userId}
- LIMIT 1
- </select>
- <select id="getUserNameByUserId" resultType="java.lang.String">
- select userName
- from user
- where userID = #{userId}
- LIMIT 1
- </select>
- <select id="getLadderPriceList" resultType="com.caimei365.order.model.vo.LadderPriceVo">
- select id,
- productId,
- ladderNum,
- buyNum,
- buyPrice
- from product_ladder_price
- where productId = #{productId}
- and userType = 3
- and delFlag = 0
- order by ladderNum asc
- </select>
- <select id="getRepurchasePrice" resultType="java.lang.Double">
- select r.currentPrice
- from repeat_purchase_price r
- left join product p on p.productID = r.productId
- where r.productId = #{productId}
- and r.userId = #{userId}
- and ((p.costCheckFlag = 1 and r.currentPrice <![CDATA[ >= ]]> p.costPrice) or p.costCheckFlag = 2)
- and p.price <![CDATA[ >= ]]> r.currentPrice
- and r.delFlag = 0
- </select>
- <select id="getPromotionByShopId" resultType="com.caimei365.order.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 AS shopId,
- pr.seen,
- pr.discount
- FROM cm_promotions pr
- LEFT JOIN cm_promotions_product prp ON pr.id = prp.promotionsId
- WHERE prp.supplierId = #{shopId}
- and pr.delFlag = 0
- and pr.type = 3
- AND (pr.status = 1 OR (pr.status = 2 AND (NOW() BETWEEN pr.beginTime AND pr.endTime)))
- ORDER BY pr.type DESC
- LIMIT 1
- </select>
- <select id="getPromotionByProductId" resultType="com.caimei365.order.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 AS shopId,
- pr.discount,
- pr.seen
- FROM cm_promotions pr
- LEFT JOIN cm_promotions_product prp ON pr.id = prp.promotionsId
- WHERE prp.productId = #{productId}
- and pr.delFlag = 0
- and pr.type in (1, 2)
- AND (pr.status = 1 OR (pr.status = 2 AND (NOW() BETWEEN pr.beginTime AND pr.endTime)))
- ORDER BY pr.type DESC
- LIMIT 1
- </select>
- <select id="getPromotionGifts" resultType="com.caimei365.order.model.vo.CartItemVo">
- 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,
- p.price AS originalPrice,
- p.unit AS unit,
- p.stock AS stock,
- p.validFlag AS validFlag
- FROM cm_promotions_gift cpg
- LEFT JOIN product p ON cpg.productId = p.productID
- WHERE cpg.promotionsId = #{promotionsId}
- ORDER BY cpg.id DESC
- </select>
- <select id="getShopByProductId" resultType="com.caimei365.order.model.vo.CartShopVo">
- SELECT s.shopID AS shopId,
- s.name AS shopName,
- s.logo AS shopLogo
- FROM shop s
- LEFT JOIN product p ON p.shopID = s.shopID
- WHERE p.productId = #{productId}
- LIMIT 1
- </select>
- <select id="getUserInvoice" resultType="com.caimei365.order.model.vo.InvoiceVo">
- SELECT id,
- userId,
- invoiceTitle,
- corporationTaxNum,
- registeredAddress,
- registeredPhone,
- bankAccountNo,
- openBank
- FROM cm_user_invoiceinfo
- WHERE userId = #{userId}
- LIMIT 1
- </select>
- <select id="getUserMoney" resultType="java.lang.Double">
- SELECT userMoney
- FROM user
- WHERE userID = #{userId}
- </select>
- <select id="getAbleUserMoney" resultType="java.lang.Double">
- SELECT ableUserMoney
- FROM user
- WHERE userID = #{userId}
- </select>
- <select id="getUserBeans" resultType="java.lang.Integer">
- SELECT userBeans
- FROM user
- WHERE userID = #{userId}
- </select>
- <select id="getPostageFlagList" resultType="com.caimei365.order.model.vo.ProductPostageVo">
- SELECT
- productID AS productId,
- freePostFlag AS postageFlag,
- commodityType
- FROM product
- WHERE validFlag='2' AND productID in
- <foreach collection="productIds" open="(" separator="," close=")" item="productId">
- #{productId}
- </foreach>
- </select>
- <select id="countUserOrder" resultType="java.lang.Integer">
- SELECT COUNT(*)
- FROM cm_order
- WHERE userID = #{userId}
- AND delFlag = 0
- AND STATUS != 6
- </select>
- <select id="getProvinceIdAndCityId" resultType="com.caimei365.order.model.vo.AddressVo">
- SELECT provinceID AS provinceId, cityID AS cityId
- FROM city
- WHERE cityID = (SELECT cityID from town where townID = #{townId})
- </select>
- <select id="getTownIdByAddressId" resultType="java.lang.Integer">
- SELECT townID
- FROM address
- WHERE addressID = #{addressId}
- </select>
- <select id="getPurchasePricePo" resultType="com.caimei365.order.model.po.PurchasePricePo">
- SELECT id,
- userId,
- clubId,
- orderId,
- productId,
- shopId,
- shopName,
- taxRate,
- currentPrice,
- createTime
- FROM repeat_purchase_price
- WHERE userId = #{userId}
- AND productId = #{productId}
- AND delFlag = '0'
- </select>
- <select id="getBindMobileByUserId" resultType="java.lang.String">
- SELECT bindMobile
- FROM user
- WHERE userID = #{userId}
- </select>
- <select id="getShopIdByproductId" resultType="java.lang.Integer">
- SELECT shopID
- FROM product
- WHERE productID = #{productId}
- </select>
- <select id="getClauseList" resultType="com.caimei365.order.model.vo.ClauseVo">
- SELECT id,
- name,
- content,
- clauseType,
- enabledStatus
- FROM bp_clause
- </select>
- <insert id="insertDiscernReceipt" keyColumn="id" keyProperty="id"
- parameterType="com.caimei365.order.model.po.DiscernReceiptPo" useGeneratedKeys="true">
- INSERT INTO cm_discern_receipt (payWay, payType, receiptType, receiptStatus, receiptAmount, confirmType,
- receiptDate, confirmDate, reviewDate, updateDate, delFlag, rePayFlag, formData)
- VALUES (#{payWay}, #{payType}, #{receiptType}, #{receiptStatus}, #{receiptAmount}, #{confirmType},
- #{receiptDate}, #{confirmDate}, #{reviewDate}, #{updateDate}, #{delFlag}, #{rePayFlag}, #{formData})
- </insert>
- <insert id="insertOrderReceiptRelation" keyColumn="id" keyProperty="id"
- parameterType="com.caimei365.order.model.po.OrderReceiptRelationPo" useGeneratedKeys="true">
- INSERT INTO cm_receipt_order_relation (relationType, receiptId, associateAmount, orderId, couponRecordId, vipRecordId,authVipRecordId, delFlag,
- mbOrderId, orderRequestNo, splitStatus, productId)
- VALUES (#{relationType}, #{receiptId}, #{associateAmount}, #{orderId},#{couponRecordId}, #{vipRecordId}, #{authVipRecordId}, #{delFlag}, #{mbOrderId},
- #{orderRequestNo}, #{splitStatus}, #{productId})
- </insert>
- <insert id="insertBeansHistory" parameterType="com.caimei365.order.model.po.UserBeansHistoryPo">
- INSERT INTO user_beans_history (userId, type, beansType, orderId, num, pushStatus, addTime, delFlag)
- VALUES (#{userId}, #{type}, #{beansType}, #{orderId}, #{num}, #{pushStatus}, #{addTime}, #{delFlag})
- </insert>
- <update id="updateUserBeans">
- UPDATE USER
- SET userBeans = #{userBeans}
- WHERE userID = #{userId}
- </update>
- <update id="updateUserClubStatus">
- UPDATE user
- SET clubStatus = #{clubStatus}
- WHERE userID = #{userId}
- </update>
- <update id="updateClubStatus">
- UPDATE club
- SET status = #{clubStatus}
- WHERE userID = #{userId}
- </update>
- <insert id="insertBalanceRecord" parameterType="com.caimei365.order.model.po.BalanceRecordPo">
- INSERT INTO cm_user_balance_record (userId, type, balanceType, addDate, amount, orderId, remark, delFlag)
- VALUES (#{userId}, #{type}, #{balanceType}, #{addDate}, #{amount}, #{orderId}, #{remark}, #{delFlag})
- </insert>
- <select id="getSvipUserIdByUserId" resultType="java.lang.Integer">
- select userId
- from cm_svip_user
- where userId = #{userId}
- and delFlag = '0'
- and now() <![CDATA[ < ]]> endTime
- </select>
- <select id="getSvipUserIdByClubId" resultType="java.lang.Integer">
- select svu.userId
- from cm_svip_user svu
- left join club c on svu.userId = c.userID
- where c.clubID = #{clubId}
- and delFlag = '0'
- and now() <![CDATA[ < ]]> endTime;
- </select>
- <select id="getClubStatus" resultType="java.lang.Integer">
- select clubStatus
- from user
- where userID = #{userId}
- </select>
- <select id="getClubConfirmTime" resultType="java.util.Date">
- SELECT confirmTime
- FROM club_confirm_record
- WHERE userId = #{userId}
- ORDER BY confirmTime DESC
- LIMIT 1
- </select>
- <select id="findLowOrder" resultType="com.caimei365.order.model.po.UserBeansHistoryPo">
- select id, userId, type, beansType, orderId, num, addTime
- from user_beans_history
- where orderId = #{orderId}
- and delFlag = 0
- and type = 2
- and num = 500
- </select>
- <select id="findBeans" resultType="java.lang.Integer">
- select userBeans from user where userID=#{userId}
- </select>
- <select id="getonlineMoney" resultType="java.lang.Double">
- select onlineMoney FROM USER WHERE userId = #{userId}
- </select>
- <select id="getAuthUser" resultType="com.caimei365.order.model.vo.AuthUserVo">
- select authUserId,name,mobile
- from cm_brand_auth_user
- where authUserId = #{userId}
- LIMIT 1
- </select>
- </mapper>
|