123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455 |
- <?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.baike.dao.CmBaikeProductDao">
- <sql id="cmBaikeProductColumns">
- a.id AS "id",
- a.commodityType AS "commodityType",
- a.publishSource,
- s.name as "shopName",
- a.shopId,
- a.productLink,
- a.name AS "name",
- a.alias AS "alias",
- a.discription AS "discription",
- a.seoKeyword,
- a.image AS "image",
- a.authLink,
- a.authQrCode,
- a.advantage AS "advantage",
- a.disadvantage AS "disadvantage",
- a.principle AS "principle",
- a.brand AS "brand",
- a.producePlace AS "producePlace",
- a.marketTime AS "marketTime",
- a.company AS "company",
- a.nmpaTime AS "nmpaTime",
- a.adaptiveMan AS "adaptiveMan",
- a.unAdaptiveMan AS "unAdaptiveMan",
- a.aroundOperation AS "aroundOperation",
- a.publishTime AS "publishTime",
- a.basePv AS "basePv",
- a.actualPv AS "actualPv",
- a.typeId AS "typeId",
- a.topPosition AS "topPosition",
- a.status AS "status",
- a.auditStatus,
- a.onlineStatus,
- a.failReason,
- a.addTime AS "addTime",
- a.recommendType,
- cbt.name as "typeName",
- a.labelIds as "labelIds"
- </sql>
- <sql id="cmBaikeProductJoins">
- left join cm_baike_type cbt on a.typeId = cbt.id
- left join shop s on a.shopId = s.shopID
- </sql>
- <select id="get" resultType="CmBaikeProduct">
- SELECT
- <include refid="cmBaikeProductColumns"/>
- FROM cm_baike_product a
- <include refid="cmBaikeProductJoins"/>
- WHERE a.id = #{id} and delFlag = 0
- </select>
- <select id="findList" resultType="CmBaikeProduct">
- SELECT
- <include refid="cmBaikeProductColumns"/>
- FROM cm_baike_product a
- <include refid="cmBaikeProductJoins"/>
- <where>
- delFlag = 0
- <if test="id != null and id != ''">
- AND a.id = #{id}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="typeId != null and typeId != ''">
- AND a.typeId = #{typeId}
- </if>
- <if test="topFlag != null">
- <choose>
- <when test='topFlag == 1'>
- and topPosition is not null and topPosition != ''
- </when>
- <when test='topFlag == 0'>
- and (topPosition is null or topPosition = '')
- </when>
- </choose>
- </if>
- <if test="topPosition != null">
- and topPosition = #{topPosition}
- </if>
- <if test="status != null">
- AND a.status = #{status}
- </if>
- <!-- <if test="commodityType != null">-->
- <!-- and a.commodityType = #{commodityType}-->
- <!-- </if>-->
- <if test="publishSource != null">
- and a.publishSource = #{publishSource}
- </if>
- <if test="auditStatus != null">
- and a.auditStatus = #{auditStatus}
- </if>
- <if test="onlineStatus != null">
- and a.onlineStatus = #{onlineStatus}
- </if>
- <if test="shopName != null and shopName != ''">
- AND s.name LIKE concat('%',#{shopName},'%')
- </if>
- <if test="productIds != null and productIds != ''">
- and a.id not in
- <foreach item="productId" collection="productIds.split(',')" open="(" separator="," close=")">
- #{productId}
- </foreach>
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- order by a.addTime desc
- </otherwise>
- </choose>
- </select>
- <select id="findAllList" resultType="CmBaikeProduct">
- SELECT
- <include refid="cmBaikeProductColumns"/>
- FROM cm_baike_product a
- <include refid="cmBaikeProductJoins"/>
- <where>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <select id="findParamList" resultType="com.caimei.modules.baike.entity.CmBaikeProductParam">
- select productId, name, content
- from cm_baike_product_param
- where productId = #{id}
- </select>
- <select id="findImageList" resultType="java.lang.String">
- select image
- from cm_baike_product_image
- where productId = #{productId}
- and type = #{imageType}
- </select>
- <select id="findQuestionList" resultType="com.caimei.modules.baike.entity.CmBaikeProductQuestion">
- select productId, question, answer
- from cm_baike_product_question
- where productId = #{id}
- </select>
- <select id="findTopLength" resultType="java.lang.Integer">
- select count(*)
- from cm_baike_product
- where topPosition is not null
- and topPosition != ''
- </select>
- <select id="findShopList" resultType="com.caimei.modules.user.entity.NewCmShop">
- select s.shopID, u.name
- from shop s
- LEFT JOIN user u ON u.userID = s.userID
- where s.status = 90
- and u.userID is not null
- order by s.shopID desc;
- </select>
- <select id="checkFileName" resultType="java.lang.Integer">
- select id from cm_baike_product_file
- <where>
- fileName = #{fileName}
- <if test="productId != null || (fileIds != null and fileIds != '')">
- and(
- <if test="productId != null">
- productId = #{productId}
- </if>
- <if test="fileIds != null and fileIds != ''">
- or id in
- <foreach collection="fileIds.split(',')" item="fileId" index="index" open="(" separator=","
- close=")">
- #{fileId}
- </foreach>
- </if>
- )
- </if>
- </where>
- </select>
- <select id="getProductFileById" resultType="com.caimei.modules.baike.entity.CmBaikeProductFile">
- select productId, fileTitle, fileName, ossName
- from cm_baike_product_file
- where id = #{fileId}
- </select>
- <select id="findFileList" resultType="com.caimei.modules.baike.entity.CmBaikeProductFile">
- select id, productId, fileTitle, fileName, ossName
- from cm_baike_product_file
- where productId = #{id}
- </select>
- <insert id="insert" parameterType="CmBaikeProduct" keyProperty="id" useGeneratedKeys="true">
- INSERT INTO cm_baike_product(commodityType,
- name,
- shopId,
- productLink,
- alias,
- discription,
- seoKeyword,
- image,
- authLink,
- authQrCode,
- advantage,
- disadvantage,
- principle,
- brand,
- producePlace,
- marketTime,
- company,
- nmpaTime,
- adaptiveMan,
- unAdaptiveMan,
- aroundOperation,
- publishTime,
- basePv,
- actualPv,
- typeId,
- emptyNum,
- status,
- addTime,
- labelIds,
- relatedLabels)
- VALUES (#{commodityType},
- #{name},
- #{shopId},
- #{productLink},
- #{alias},
- #{discription},
- #{seoKeyword},
- #{image},
- #{authLink},
- #{authQrCode},
- #{advantage},
- #{disadvantage},
- #{principle},
- #{brand},
- #{producePlace},
- #{marketTime},
- #{company},
- #{nmpaTime},
- #{adaptiveMan},
- #{unAdaptiveMan},
- #{aroundOperation},
- #{publishTime},
- #{basePv},
- 0,
- #{typeId},
- #{emptyNum},
- #{status},
- NOW(),
- #{labelIds},
- #{labelStr})
- </insert>
- <insert id="insertProductImage">
- insert into cm_baike_product_image (productId, type, image)
- values (#{produtId}, #{imageType}, #{authImage})
- </insert>
- <insert id="insertProductParam">
- insert into cm_baike_product_param (productId, name, content)
- values (#{productId}, #{name}, #{content})
- </insert>
- <insert id="insertProductQuestion">
- insert into cm_baike_product_question (productId, question, answer)
- values (#{productId}, #{question}, #{answer})
- </insert>
- <insert id="insertProductFile" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
- insert into cm_baike_product_file(fileTitle, fileName, ossName, ossUrl)
- values (#{fileTitle}, #{fileName}, #{ossName}, #{ossUrl})
- </insert>
- <update id="update">
- UPDATE cm_baike_product SET
- name = #{name},
- shopId = #{shopId},
- productLink = #{productLink},
- alias = #{alias},
- discription = #{discription},
- seoKeyword = #{seoKeyword},
- image = #{image},
- authLink = #{authLink},
- authQrCode = #{authQrCode},
- advantage = #{advantage},
- disadvantage = #{disadvantage},
- principle = #{principle},
- brand = #{brand},
- producePlace = #{producePlace},
- marketTime = #{marketTime},
- company = #{company},
- nmpaTime = #{nmpaTime},
- adaptiveMan = #{adaptiveMan},
- unAdaptiveMan = #{unAdaptiveMan},
- aroundOperation = #{aroundOperation},
- publishTime = #{publishTime},
- basePv = #{basePv},
- typeId = #{typeId},
- emptyNum = #{emptyNum},
- <if test="auditFlag != null and auditFlag == 1">
- <if test="auditStatus != null">
- auditStatus = #{auditStatus},
- </if>
- <if test="onlineStatus != null">
- onlineStatus = #{onlineStatus},
- </if>
- <if test="failReason != null and failReason != ''">
- failReason = #{failReason},
- </if>
- </if>
- labelIds = #{labelIds},
- relatedLabels=#{labelStr},
- status = #{status}
- WHERE id = #{id}
- </update>
- <update id="updateStatus">
- update cm_baike_product
- set status = #{status}
- where id = #{productId}
- </update>
- <update id="updateTopPosition">
- update cm_baike_product
- set topPosition = #{topPosition}
- where id = #{id}
- </update>
- <update id="auditBaike">
- update cm_baike_product
- set auditStatus = #{auditStatus},
- failReason = #{failReason}
- <if test="publishTime != null">
- ,publishTime = #{publishTime}
- </if>
- where id = #{id}
- </update>
- <update id="offline">
- update cm_baike_product
- set onlineStatus = 3
- where id = #{id}
- </update>
- <update id="updateEmptyNum">
- update cm_baike_product
- set emptyNum = #{emptyNum}
- where id = #{id}
- </update>
- <update id="updateProductFile">
- update cm_baike_product_file
- set productId = #{productId}
- where id = #{fileId}
- </update>
- <update id="updateRecommendType">
- update cm_baike_product
- set recommendType = #{recommendType}
- where id = #{productId}
- </update>
- <delete id="delete">
- DELETE
- FROM cm_baike_product
- WHERE id = #{id}
- </delete>
- <delete id="deleteParamsByProductId">
- delete
- from cm_baike_product_param
- where productId = #{id}
- </delete>
- <delete id="deleteImagesByProductId">
- delete
- from cm_baike_product_image
- where productId = #{id}
- </delete>
- <delete id="deleteQuestionsByProductId">
- delete
- from cm_baike_product_question
- where productId = #{id}
- </delete>
- <delete id="delMaterialinfoBYProductId">
- delete
- from cm_baike_reference_info
- where productId = #{id}
- </delete>
- <delete id="delTextListByEntryId">
- delete
- from cm_baike_text_info
- where productId = #{id}
- </delete>
- <delete id="deleteProductFile">
- delete
- from cm_baike_product_file
- where id = #{fileId}
- </delete>
- <select id="getTextInfo" resultType="com.caimei.modules.baike.entity.CmBaikeTextInfo">
- select *
- from cm_baike_text_info
- where productId = #{productId}
- </select>
- <insert id="saveMaterialinfo">
- insert into cm_baike_reference_info(referenceType, website, articleName, websiteName, publishTime,
- acitationTime, author, workName, publicationPlace, press, publicationYear,
- acitationWeb, referenceDescription, imageDescription, imageUrl, productId,
- productType, ctrlId)
- values (#{referenceType}, #{website}, #{articleName}, #{websiteName}, #{publishTimeStr}, #{acitationTimeStr},
- #{author}, #{workName}, #{publicationPlace}, #{press}, #{publicationYearStr}, #{acitationWeb},
- #{referenceDescription}, #{imageDescription}, #{imageUrl}, #{productId}, #{productType}, #{ctrlId})
- </insert>
- <update id="upMaterialinfo">
- update cm_baike_reference_info
- set referenceType=#{referenceType},
- website=#{website},
- articleName=#{articleName},
- websiteName=#{websiteName},
- publishTime=#{publishTimeStr},
- acitationTime=#{acitationTimeStr},
- author=#{author},
- workName=#{workName},
- publicationPlace=#{publicationPlace},
- press=#{press},
- publicationYear=#{publicationYearStr},
- acitationWeb=#{acitationWeb},
- referenceDescription=#{referenceDescription},
- imageDescription=#{imageDescription},
- imageUrl=#{imageUrl}
- where id = #{id}
- </update>
- <insert id="insertText">
- insert into cm_baike_text_info(textType, productId, dictionaryContent, referenceId, parentId, dictionaryType)
- values (#{textType}, #{productId}, #{dictionaryContent}, #{referenceId}, #{parentId}, #{dictionaryType})
- </insert>
- <select id="getMaterialInfo" resultType="com.caimei.modules.baike.entity.CmBaikeReferenceInfo">
- select *
- from cm_baike_reference_info
- where productId = #{productId}
- </select>
- <delete id="delMaterialinfo">
- delete
- from cm_baike_reference_info
- where id = #{id}
- </delete>
- <select id="getMaterialinfo" resultType="com.caimei.modules.baike.entity.CmBaikeReferenceInfo">
- select *
- from cm_baike_reference_info
- where id = #{id}
- </select>
- </mapper>
|