123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338 |
- <?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.caimei.modules.product.dao.CmSecondHandDetailDao">
- <sql id="cmSecondHandDetailColumns">
- a.id AS "id",
- a.productID AS "productID",
- a.sold AS "sold",
- a.secondHandType AS "secondHandType",
- a.instrumentType AS "instrumentType",
- a.fixedYears AS "fixedYears",
- a.maturityYears AS "maturityYears",
- a.companyName AS "companyName",
- a.detailTalkFlag AS "detailTalkFlag",
- a.originalPrice AS "originalPrice",
- a.contactName AS "contactName",
- a.contactMobile AS "contactMobile",
- a.dockingPeopleName AS "dockingPeopleName",
- a.dockingPeopleMobile AS "dockingPeopleMobile",
- a.secondProductType AS "secondProductType",
- a.provinceCityDistrict AS "provinceCityDistrict",
- a.townId as "townId",
- a.address AS "address",
- a.productQuality AS "productQuality",
- a.productDetails AS "productDetails",
- a.viewingNum AS "viewingNum",
- a.brandName AS "brandName",
- a.payAmount AS "payAmount",
- a.payFormData AS "payFormData",
- a.payType AS "payType",
- a.payDate AS "payDate",
- a.submitDate AS "submitDate",
- a.reviewedDate AS "reviewedDate",
- a.onLineDate AS "onLineDate",
- a.source AS "source",
- a.showContactFlag AS "showContactFlag",
- a.publisher AS "publisher",
- a.authenticationImage AS "authenticationImage",
- a.fileName AS "fileName",
- a.ossName AS "ossName",
- a.commitmentImage AS "commitmentImage",
- copi.validFlag AS "validFlag",
- p.productCategory AS "productCategory",
- p.name AS "name",
- cs.normalPrice AS "normalPrice",
- cs.price AS "price",
- cs.stock AS "stock",
- p.brandID AS "brandID",
- cs.costPrice as "costPrice",
- cs.costCheckFlag AS "costCheckFlag",
- cs.shopPercent AS "shopPercent",
- cs.organizeId AS "organizeId",
- p.visibility AS "visibility",
- p.splitCode AS "splitCode"
- </sql>
- <sql id="cmSecondHandDetailJoins">
- left join product p on p.productID = a.productID
- left join cm_sku cs on p.productId=cs.productId and p.groundMall like CONCAT('%', cs.organizeId, '%')
- </sql>
- <select id="get" resultType="CmSecondHandDetail">
- SELECT
- <include refid="cmSecondHandDetailColumns"/>
- ,cs.organizeId
- FROM cm_second_hand_detail a
- <include refid="cmSecondHandDetailJoins"/>
- left join cm_organize_product_info copi on copi.productId = a.productID
- WHERE a.productID = #{id}
- and a.groundMall like CONCAT('%', copi.organizeId, '%')
- </select>
- <select id="findList" resultType="CmSecondHandDetail">
- SELECT
- <include refid="cmSecondHandDetailColumns"/>
- FROM cm_second_hand_detail a
- <include refid="cmSecondHandDetailJoins"/>
- left join cm_organize_product_info copi on copi.productId = a.productID
- <where>
- a.groundMall like CONCAT('%', copi.organizeId, '%')
- <if test="productID != null and productID != ''">
- AND a.productID = #{productID}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <select id="findAllList" resultType="CmSecondHandDetail">
- SELECT
- <include refid="cmSecondHandDetailColumns"/>
- FROM cm_second_hand_detail a
- <include refid="cmSecondHandDetailJoins"/>
- left join cm_organize_product_info copi on copi.productId = p.productID
- <where>
- p.groundMall like CONCAT('%', copi.organizeId, '%')
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <select id="findValue" resultType="com.caimei.modules.product.entity.CmSecondHandDetail">
- select cshd.publishIdentity,
- cshd.authenticationBackImage,
- cshd.licenseImage,
- s.cardNumber,
- s.accountType,
- s.banOfDeposit,
- s.accountName
- from cm_second_hand_detail cshd
- left join product p on cshd.productId = p.productId
- left join shop s on s.shopID = p.shopID
- where p.productID = #{productID}
- </select>
- <select id="findFlieTypes" resultType="java.lang.Integer">
- select fileType
- from cm_second_file_type
- where productId = #{productID}
- </select>
- <select id="findShopId" resultType="java.lang.Integer">
- select shopId
- from product
- where productID = #{productId}
- </select>
- <insert id="insert" parameterType="CmSecondHandDetail" keyProperty="id" useGeneratedKeys="true">
- INSERT INTO cm_second_hand_detail(publishIdentity,
- authenticationBackImage,
- licenseImage,
- productID,
- sold,
- secondHandType,
- instrumentType,
- fixedYears,
- maturityYears,
- companyName,
- detailTalkFlag,
- originalPrice,
- contactName,
- contactMobile,
- dockingPeopleName,
- dockingPeopleMobile,
- secondProductType,
- provinceCityDistrict,
- townId,
- address,
- productQuality,
- productDetails,
- viewingNum,
- brandName,
- payAmount,
- payFormData,
- payType,
- payDate,
- submitDate,
- reviewedDate,
- onLineDate,
- source,
- showContactFlag,
- publisher,
- authenticationImage,
- fileName,
- ossName,
- commitmentImage)
- VALUES (#{publishIdentity},
- #{authenticationBackImage},
- #{licenseImage},
- #{productID},
- #{sold},
- #{secondHandType},
- #{instrumentType},
- #{fixedYears},
- #{maturityYears},
- #{companyName},
- #{detailTalkFlag},
- #{originalPrice},
- #{contactName},
- #{contactMobile},
- #{dockingPeopleName},
- #{dockingPeopleMobile},
- #{secondProductType},
- #{provinceCityDistrict},
- #{townId},
- #{address},
- #{productQuality},
- #{productDetails},
- #{viewingNum},
- #{brandName},
- #{payAmount},
- #{payFormData},
- #{payType},
- #{payDate},
- #{submitDate},
- #{reviewedDate},
- #{onLineDate},
- #{source},
- #{showContactFlag},
- #{publisher},
- #{authenticationImage},
- #{fileName},
- #{ossName},
- #{commitmentImage})
- </insert>
- <insert id="insertFileType">
- insert into cm_second_file_type
- (secondid, productid, filetype)
- values (#{secondId}, #{productId}, #{fileType})
- </insert>
- <insert id="insertShop" keyColumn="shopID" keyProperty="shopID" 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, #{shopType})
- </insert>
- <select id="selectContactDockingPeople" resultType="CmSecondHandDetail">
- select contactName, dockingPeopleName
- from cm_second_hand_detail
- where productID IN (
- SELECT p.productID
- FROM product AS p
- LEFT JOIN cm_order_product cop ON p.productID = cop.productID
- WHERE cop.shopOrderNo = #{shopOrderNo}
- )
- </select>
- <update id="update">
- UPDATE cm_second_hand_detail
- SET productID = #{productID},
- sold = #{sold},
- secondHandType = #{secondHandType},
- instrumentType = #{instrumentType},
- fixedYears = #{fixedYears},
- maturityYears = #{maturityYears},
- companyName = #{companyName},
- detailTalkFlag = #{detailTalkFlag},
- originalPrice = #{originalPrice},
- contactName = #{contactName},
- contactMobile = #{contactMobile},
- dockingPeopleName = #{dockingPeopleName},
- dockingPeopleMobile = #{dockingPeopleMobile},
- secondProductType = #{secondProductType},
- provinceCityDistrict = #{provinceCityDistrict},
- townId = #{townId},
- address = #{address},
- productQuality = #{productQuality},
- productDetails = #{productDetails},
- viewingNum = #{viewingNum},
- brandName = #{brandName},
- payAmount = #{payAmount},
- payFormData = #{payFormData},
- payType = #{payType},
- payDate = #{payDate},
- submitDate = #{submitDate},
- reviewedDate = #{reviewedDate},
- onLineDate = #{onLineDate},
- source = #{source},
- showContactFlag = #{showContactFlag},
- publisher = #{publisher},
- authenticationImage = #{authenticationImage},
- fileName = #{fileName},
- ossName = #{ossName},
- commitmentImage = #{commitmentImage},
- publishIdentity = #{publishIdentity}
- WHERE productID = #{productID}
- </update>
- <update id="updateRevieweInfo">
- UPDATE cm_second_hand_detail
- SET reviewedDate = #{reviewedDate},
- onLineDate = #{onLineDate}
- WHERE productID = #{productID}
- </update>
- <update id="updateOnLineDate">
- UPDATE cm_second_hand_detail
- SET onLineDate = #{date}
- WHERE productID = #{productID}
- </update>
- <update id="updatSecondHnadproductSold">
- UPDATE cm_second_hand_detail
- SET sold = 1
- where productID = #{productID}
- </update>
- <delete id="delete">
- DELETE
- FROM cm_second_hand_detail
- WHERE productID = #{productID}
- </delete>
- <delete id="deleteFileType">
- delete
- from cm_second_file_type
- where productId = #{productId}
- </delete>
- <update id="updatSecondHnadBySold">
- UPDATE cm_second_hand_detail
- SET sold = 0
- WHERE productID = #{productID}
- </update>
- <update id="updateShop">
- update shop
- set name=#{name},
- linkMan=#{linkMan},
- contractMobile=#{contractMobile},
- cardNumber=#{cardNumber},
- accountType=#{accountType},
- banOfDeposit=#{banOfDeposit},
- accountName=#{accountName}
- where shopID = #{shopID}
- </update>
- <update id="updateShopType">
- update shop
- set shopType=3
- where shopID = (select shopID from product where productID = #{productID})
- </update>
- </mapper>
|