zhijiezhao 1 年之前
父节点
当前提交
248daaa024

+ 0 - 6
src/main/java/com/caimei/modules/product/dao/CmSecondHandRecommendDao.java

@@ -1,6 +1,5 @@
 package com.caimei.modules.product.dao;
 
-import com.caimei.modules.product.entity.CmSecondHandRecommendVo;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import com.caimei.modules.product.entity.CmSecondHandRecommend;
@@ -18,11 +17,6 @@ public interface CmSecondHandRecommendDao extends CrudDao<CmSecondHandRecommend>
 
     List<CmSecondHandRecommend> findRecommendList(@Param("id") String id);
 
-    CmSecondHandRecommendVo getSecondHandRecommend(@Param("id") String id);
-
-    List<CmSecondHandRecommendVo> querySecondHandRecommend(@Param("id") String queryProductID,
-                                                           @Param("productName") String queryProductName);
-
     CmSecondHandRecommend findByRecommendProductID(@Param("secondHandProductID") String secondHandProductID,
                                                    @Param("productType") String productType,
                                                    @Param("recommendProductID") String recommendProductID);

+ 0 - 7
src/main/java/com/caimei/modules/product/service/CmSecondHandTransactionService.java

@@ -237,11 +237,4 @@ public class CmSecondHandTransactionService extends CrudService<CmSecondHandTran
 		return cmSecondHandRecommendDao.findRecommendList(id);
 	}
 
-	public CmSecondHandRecommendVo getSecondHandRecommend(String id) {
-		return cmSecondHandRecommendDao.getSecondHandRecommend(id);
-	}
-
-	public List<CmSecondHandRecommendVo> querySecondHandRecommend(String queryProductID, String queryProductName) {
-		return cmSecondHandRecommendDao.querySecondHandRecommend(queryProductID, queryProductName);
-	}
 }

+ 122 - 0
src/main/resources/mappings/modules/product/CmSecondHandRecommendMapper.xml

@@ -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>