1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?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.newhome.dao.NewPageRecommendProductDao">
- <insert id="addProducts">
- insert into cm_page_recommend_product (productId)
- values
- <foreach collection="split" item="item" index="index" separator=",">
- (#{item})
- </foreach>
- </insert>
- <update id="updateSorts">
- update cm_page_recommend_product
- set sort = #{sort}
- where productId = #{id}
- </update>
- <delete id="delProduct">
- delete from cm_page_recommend_product
- where productId = #{productId}
- </delete>
- <select id="findRecommendList" resultType="com.caimei.modules.product.entity.Product">
- select cpp.sort as sortIndex, p.mainImage, p.name, p.productID, s.name as shopName
- from cm_page_recommend_product cpp
- left join product p on cpp.productId = p.productID
- left join shop s on p.shopId = s.shopId
- where p.productCategory = 1
- group by p.productID
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy},cpp.sort asc
- </when>
- <otherwise>
- order by cpp.sort asc
- </otherwise>
- </choose>
- </select>
- <select id="findProductList" resultType="com.caimei.modules.product.entity.Product">
- SELECT a.mainImage, a.name, a.productID,s.name as "shopName"
- FROM product a
- left join cm_organize_product_info copi on copi.productId = a.productID
- left join shop s on a.shopId = s.shopID
- left join cm_page_recommend_product nsp ON a.productId = nsp.productId
- <where>
- nsp.productId is null
- and
- copi.validFlag in (2,3,9)
- <if test="productID !=null and productID !=''">
- AND a.productID=#{productID}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE concat('%',#{name},'%')
- </if>
- <if test="shopName != null and shopName != ''">
- AND s.name LIKE concat('%',#{shopName},'%')
- </if>
- and a.productCategory = 1
- </where>
- group by a.productID
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- order by a.productID desc
- </otherwise>
- </choose>
- </select>
- </mapper>
|