123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- <?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.mapper.ProductMapper">
- <select id="findImageAll" resultType="string">
- SELECT
- image
- FROM
- cm_hehe_image
- WHERE
- status = 1
- ORDER BY
- - sort DESC
- </select>
- <select id="findProductList" resultType="com.caimei.model.vo.ProductVo">
- SELECT
- a.productId,
- a.recommend,
- a.price,
- a.includedTax,
- a.invoiceType,
- a.clubTaxPoint,
- p.name,
- P.unit,
- p.mainImage
- FROM
- cm_hehe_product a
- LEFT JOIN product p ON a.productId = p.productID
- WHERE
- a.validFlag = 1
- <if test="name != null and name != ''">
- AND p.name LIKE CONCAT('%',#{name},'%')
- </if>
- ORDER BY
- a.recommend DESC,
- a.addTime DESC
- </select>
- <select id="findActivityByProductId" resultType="integer">
- SELECT
- activityId
- FROM
- cm_hehe_activity_product a
- LEFT JOIN cm_hehe_activity cha ON a.activityId = cha.id
- WHERE
- cha.delFlag = 0
- AND a.delFlag = 0
- AND NOW() BETWEEN cha.beginTime
- AND cha.endTime
- AND a.productId = #{productId}
- </select>
- <select id="findActivityLadder" resultType="com.caimei.model.vo.ActivityLadderVo">
- SELECT
- buyNum,
- buyPrice
- FROM
- cm_hehe_activity_ladder
- WHERE
- activityId = #{activityId}
- AND productId = #{productId}
- ORDER BY
- ladderNum
- </select>
-
- <select id="findProductByProductId" resultType="com.caimei.model.vo.ProductDetailsVo">
- SELECT
- a.productId,
- a.recommend,
- a.price,
- a.includedTax,
- a.invoiceType,
- a.clubTaxPoint,
- a.validFlag,
- p.name,
- p.mainImage,
- p.brandID AS "brandId",
- p.bigTypeID AS "bigTypeId",
- p.smallTypeID AS "smallTypeId",
- p.tinyTypeID AS "tinyTypeId",
- P.unit,
- P.stock,
- p.tags
- FROM
- cm_hehe_product a
- LEFT JOIN product p ON a.productId = p.productID
- WHERE
- a.productId = #{productId}
- </select>
- <select id="findProductImages" resultType="string">
- SELECT
- image
- FROM
- productimage
- WHERE
- productID = #{productId}
- ORDER BY
- mainFlag DESC
- </select>
- <select id="findProductDetail" resultType="com.caimei.model.po.ProductDetailInfoPo">
- select
- productDetailInfoID as productDetailInfoId,
- productID as productId,
- propValueAlias,
- propValueImages,
- detailInfo,
- detailInfoTxt,
- seoTitle,
- seoKeyword,
- seoDes,
- serviceInfo,
- orderInfo
- from
- productdetailinfo
- where
- productID = #{productId}
- </select>
- <select id="findTypeName" resultType="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="findBrandName" resultType="string">
- SELECT
- name
- FROM
- cm_brand
- WHERE
- id = #{brandId}
- and delFlag = '0'
- and status = '1'
- </select>
- <select id="findParameters" resultType="com.caimei.model.vo.RelatedParametersVo">
- SELECT
- paramsName,
- paramsContent
- FROM
- cm_product_related_parameters
- WHERE
- productId = #{productId}
- AND delFlag = '0'
- </select>
- <select id="findSearchHistory" resultType="integer">
- SELECT id FROM user_search_history WHERE searchWord = #{name} AND userId = #{userId} LIMIT 1
- </select>
- <update id="updateHistoryByDate">
- UPDATE user_search_history SET searchDate = NOW() WHERE id = #{recordId}
- </update>
- <insert id="insertSearchHistory">
- INSERT INTO `user_search_history` (
- `userId`, `searchWord`, `searchDate`,
- `delFlag`
- )
- VALUES
- (
- #{userId}, #{searchWord}, #{searchDate},
- #{delFlag}
- )
- </insert>
- <select id="searchHistory" resultType="string">
- SELECT
- searchWord
- FROM
- user_search_history
- WHERE
- userId = #{userId}
- ORDER BY
- searchDate DESC
- LIMIT
- 10
- </select>
- <delete id="deleteHistoryByUserId">
- DELETE FROM user_search_history
- WHERE userId=#{userId}
- AND id NOT IN (
- SELECT temp.id FROM (
- SELECT id FROM user_search_history WHERE userId=#{userId} ORDER BY id DESC LIMIT 10
- ) AS temp
- )
- </delete>
- <delete id="deleteHistory">
- DELETE FROM user_search_history WHERE userId + #{userId}
- </delete>
- </mapper>
|