|
@@ -0,0 +1,122 @@
|
|
|
|
+<?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.CmSecondHandRecommendDao">
|
|
|
|
+
|
|
|
|
+ <sql id="cmSecondHandRecommendColumns">
|
|
|
|
+ a.id AS "id",
|
|
|
|
+ a.secondHandProductID AS "secondHandProductID",
|
|
|
|
+ a.productType AS "productType",
|
|
|
|
+ a.recommendProductID AS "recommendProductID",
|
|
|
|
+ a.sort AS "sort",
|
|
|
|
+ a.delFlag AS "delFlag"
|
|
|
|
+ </sql>
|
|
|
|
+
|
|
|
|
+ <select id="get" resultType="CmSecondHandRecommend">
|
|
|
|
+ SELECT
|
|
|
|
+ <include refid="cmSecondHandRecommendColumns"/>
|
|
|
|
+ FROM cm_second_hand_recommend a
|
|
|
|
+ WHERE a.id = #{id} order by a.sort desc
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="findByRecommendProductID" resultType="com.caimei.modules.product.entity.CmSecondHandRecommend">
|
|
|
|
+ SELECT
|
|
|
|
+ <include refid="cmSecondHandRecommendColumns"/>
|
|
|
|
+ FROM cm_second_hand_recommend a
|
|
|
|
+ WHERE a.secondHandProductID = #{secondHandProductID}
|
|
|
|
+ and a.productType = #{productType}
|
|
|
|
+ and a.recommendProductID = #{recommendProductID}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="findRecommendList" resultType="com.caimei.modules.product.entity.CmSecondHandRecommend">
|
|
|
|
+ SELECT
|
|
|
|
+ <include refid="cmSecondHandRecommendColumns"/>
|
|
|
|
+ FROM cm_second_hand_recommend a
|
|
|
|
+ WHERE a.secondHandProductID = #{id}
|
|
|
|
+ order by a.sort asc
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="findList" resultType="CmSecondHandRecommend">
|
|
|
|
+ SELECT
|
|
|
|
+ <include refid="cmSecondHandRecommendColumns"/>
|
|
|
|
+ FROM cm_second_hand_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>
|
|
|
|
+
|
|
|
|
+ <select id="findAllList" resultType="CmSecondHandRecommend">
|
|
|
|
+ SELECT
|
|
|
|
+ <include refid="cmSecondHandRecommendColumns"/>
|
|
|
|
+ FROM cm_second_hand_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>
|
|
|
|
+
|
|
|
|
+ <insert id="insert" parameterType="CmSecondHandRecommend" keyProperty="id" useGeneratedKeys="true">
|
|
|
|
+ INSERT INTO cm_second_hand_recommend(
|
|
|
|
+ secondHandProductID,
|
|
|
|
+ productType,
|
|
|
|
+ recommendProductID,
|
|
|
|
+ sort,
|
|
|
|
+ delFlag
|
|
|
|
+ ) VALUES (
|
|
|
|
+ #{secondHandProductID},
|
|
|
|
+ #{productType},
|
|
|
|
+ #{recommendProductID},
|
|
|
|
+ #{sort},
|
|
|
|
+ #{delFlag}
|
|
|
|
+ )
|
|
|
|
+ </insert>
|
|
|
|
+
|
|
|
|
+ <update id="update">
|
|
|
|
+ UPDATE cm_second_hand_recommend SET
|
|
|
|
+ secondHandProductID = #{secondHandProductID},
|
|
|
|
+ productType = #{productType},
|
|
|
|
+ recommendProductID = #{recommendProductID},
|
|
|
|
+ sort = #{sort},
|
|
|
|
+ delFlag = #{delFlag}
|
|
|
|
+ WHERE id = #{id}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+ <update id="updateSort">
|
|
|
|
+ UPDATE cm_second_hand_recommend SET
|
|
|
|
+ sort = #{sort}
|
|
|
|
+ WHERE id = #{id}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+ <update id="updateRecommendProduct">
|
|
|
|
+ UPDATE cm_second_hand_recommend SET
|
|
|
|
+ sort = #{sort}
|
|
|
|
+ WHERE secondHandProductID = #{secondHandProductID}
|
|
|
|
+ and productType = #{productType}
|
|
|
|
+ and recommendProductID = #{recommendProductID}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+ <delete id="delete">
|
|
|
|
+ DELETE FROM cm_second_hand_recommend
|
|
|
|
+ WHERE id = #{id}
|
|
|
|
+ </delete>
|
|
|
|
+
|
|
|
|
+ <delete id="deleteRecommend">
|
|
|
|
+ DELETE FROM cm_second_hand_recommend
|
|
|
|
+ WHERE secondHandProductID = #{secondHandProductID}
|
|
|
|
+ and productType = #{productType}
|
|
|
|
+ and recommendProductID = #{recommendProductID}
|
|
|
|
+ </delete>
|
|
|
|
+
|
|
|
|
+</mapper>
|