|
@@ -2,99 +2,99 @@
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<!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.CmProductRecommendDao">
|
|
<mapper namespace="com.caimei.modules.product.dao.CmProductRecommendDao">
|
|
|
|
|
|
- <sql id="cmProductRecommendColumns">
|
|
|
|
- a.id AS "id",
|
|
|
|
|
|
+ <sql id="cmProductRecommendColumns">
|
|
|
|
+ a.id AS "id",
|
|
a.productID AS "productID",
|
|
a.productID AS "productID",
|
|
a.recommendProductID AS "recommendProductID",
|
|
a.recommendProductID AS "recommendProductID",
|
|
a.shopName AS "shopName",
|
|
a.shopName AS "shopName",
|
|
a.sort AS "sort"
|
|
a.sort AS "sort"
|
|
- </sql>
|
|
|
|
|
|
+ </sql>
|
|
|
|
|
|
|
|
|
|
- <select id="get" resultType="CmProductRecommend">
|
|
|
|
- SELECT
|
|
|
|
- <include refid="cmProductRecommendColumns"/>
|
|
|
|
- FROM cm_product_recommend a
|
|
|
|
- <include refid="cmProductRecommendJoins"/>
|
|
|
|
- WHERE a.id = #{id}
|
|
|
|
- </select>
|
|
|
|
|
|
+ <select id="get" resultType="CmProductRecommend">
|
|
|
|
+ SELECT
|
|
|
|
+ <include refid="cmProductRecommendColumns"/>
|
|
|
|
+ FROM cm_product_recommend a
|
|
|
|
+ WHERE a.id = #{id}
|
|
|
|
+ </select>
|
|
|
|
|
|
- <select id="findList" resultType="CmProductRecommend">
|
|
|
|
- SELECT
|
|
|
|
- <include refid="cmProductRecommendColumns"/>
|
|
|
|
- FROM cm_product_recommend a
|
|
|
|
- <include refid="cmProductRecommendJoins"/>
|
|
|
|
- <where>
|
|
|
|
|
|
+ <select id="findList" resultType="CmProductRecommend">
|
|
|
|
+ SELECT
|
|
|
|
+ <include refid="cmProductRecommendColumns"/>
|
|
|
|
+ FROM cm_product_recommend a
|
|
|
|
+ <where>
|
|
|
|
|
|
- </where>
|
|
|
|
- <choose>
|
|
|
|
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
|
- ORDER BY ${page.orderBy}
|
|
|
|
- </when>
|
|
|
|
- <otherwise>
|
|
|
|
- </otherwise>
|
|
|
|
- </choose>
|
|
|
|
- </select>
|
|
|
|
|
|
+ </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="CmProductRecommend">
|
|
|
|
- SELECT
|
|
|
|
- <include refid="cmProductRecommendColumns"/>
|
|
|
|
- FROM cm_product_recommend a
|
|
|
|
- <include refid="cmProductRecommendJoins"/>
|
|
|
|
- <where>
|
|
|
|
|
|
+ <select id="findAllList" resultType="CmProductRecommend">
|
|
|
|
+ SELECT
|
|
|
|
+ <include refid="cmProductRecommendColumns"/>
|
|
|
|
+ FROM cm_product_recommend a
|
|
|
|
+ <where>
|
|
|
|
|
|
- </where>
|
|
|
|
- <choose>
|
|
|
|
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
|
- ORDER BY ${page.orderBy}
|
|
|
|
- </when>
|
|
|
|
- <otherwise>
|
|
|
|
- </otherwise>
|
|
|
|
- </choose>
|
|
|
|
- </select>
|
|
|
|
|
|
+ </where>
|
|
|
|
+ <choose>
|
|
|
|
+ <when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
|
+ ORDER BY ${page.orderBy}
|
|
|
|
+ </when>
|
|
|
|
+ <otherwise>
|
|
|
|
+ </otherwise>
|
|
|
|
+ </choose>
|
|
|
|
+ </select>
|
|
|
|
|
|
- <insert id="insert" parameterType="CmProductRecommend" keyProperty="id" useGeneratedKeys="true">
|
|
|
|
- INSERT INTO cm_product_recommend(
|
|
|
|
- id,
|
|
|
|
- productID,
|
|
|
|
- recommendProductID,
|
|
|
|
- shopName,
|
|
|
|
- sort
|
|
|
|
- ) VALUES (
|
|
|
|
- #{id},
|
|
|
|
- #{productID},
|
|
|
|
- #{recommendProductID},
|
|
|
|
- #{shopName},
|
|
|
|
- #{sort}
|
|
|
|
- )
|
|
|
|
- </insert>
|
|
|
|
|
|
+ <insert id="insert" parameterType="CmProductRecommend" keyProperty="id" useGeneratedKeys="true">
|
|
|
|
+ INSERT INTO cm_product_recommend(id,
|
|
|
|
+ productID,
|
|
|
|
+ recommendProductID,
|
|
|
|
+ shopName,
|
|
|
|
+ sort)
|
|
|
|
+ VALUES (#{id},
|
|
|
|
+ #{productID},
|
|
|
|
+ #{recommendProductID},
|
|
|
|
+ #{shopName},
|
|
|
|
+ #{sort})
|
|
|
|
+ </insert>
|
|
|
|
|
|
- <update id="update">
|
|
|
|
- UPDATE cm_product_recommend SET
|
|
|
|
- productID = #{productID},
|
|
|
|
- recommendProductID = #{recommendProductID},
|
|
|
|
- sort = #{sort}
|
|
|
|
- WHERE id = #{id}
|
|
|
|
- </update>
|
|
|
|
|
|
+ <update id="update">
|
|
|
|
+ UPDATE cm_product_recommend
|
|
|
|
+ SET productID = #{productID},
|
|
|
|
+ recommendProductID = #{recommendProductID},
|
|
|
|
+ sort = #{sort}
|
|
|
|
+ WHERE id = #{id}
|
|
|
|
+ </update>
|
|
|
|
|
|
- <delete id="delete">
|
|
|
|
- DELETE FROM cm_product_recommend
|
|
|
|
- WHERE id = #{id}
|
|
|
|
- </delete>
|
|
|
|
|
|
+ <delete id="delete">
|
|
|
|
+ DELETE
|
|
|
|
+ FROM cm_product_recommend
|
|
|
|
+ WHERE id = #{id}
|
|
|
|
+ </delete>
|
|
|
|
|
|
- <select id="findByRecommendProductID" resultType="CmProductRecommend">
|
|
|
|
- select <include refid="cmProductRecommendColumns"/>
|
|
|
|
- from cm_product_recommend a
|
|
|
|
- where a.productID = #{productID} and a.recommendProductID = #{recommendProductID}
|
|
|
|
- </select>
|
|
|
|
|
|
+ <select id="findByRecommendProductID" resultType="CmProductRecommend">
|
|
|
|
+ select
|
|
|
|
+ <include refid="cmProductRecommendColumns"/>
|
|
|
|
+ from cm_product_recommend a
|
|
|
|
+ where a.productID = #{productID} and a.recommendProductID = #{recommendProductID}
|
|
|
|
+ </select>
|
|
|
|
|
|
- <update id="updateSort">
|
|
|
|
- UPDATE cm_product_recommend SET
|
|
|
|
- sort = #{sort}
|
|
|
|
- WHERE id = #{id}
|
|
|
|
- </update>
|
|
|
|
|
|
+ <update id="updateSort">
|
|
|
|
+ UPDATE cm_product_recommend
|
|
|
|
+ SET sort = #{sort}
|
|
|
|
+ WHERE id = #{id}
|
|
|
|
+ </update>
|
|
|
|
|
|
- <select id="findProductShopName" resultType="string">
|
|
|
|
- select s.name from product p join shop s on p.shopID = s.shopID where p.productID = #{productID} and p.productCategory = 1
|
|
|
|
- </select>
|
|
|
|
|
|
+ <select id="findProductShopName" resultType="string">
|
|
|
|
+ select s.name
|
|
|
|
+ from product p
|
|
|
|
+ join shop s on p.shopID = s.shopID
|
|
|
|
+ where p.productID = #{productID}
|
|
|
|
+ and p.productCategory = 1
|
|
|
|
+ </select>
|
|
</mapper>
|
|
</mapper>
|