sqlmap-prod.xml 1.37 KB
<?xml version="1.0" encoding="UTF-8"?>
<sqlMap namespace="prod">
	<select id="getProdByBrandId">
		SELECT * FROM tbl_prod WHERE brand_id = :brand_id AND recom_status IN (#recom_status#)  ORDER BY `sort` DESC,create_time desc limit :offset, :limit
	</select>
	<select id="getProdTotalByBrandId">
	   SELECT COUNT(*) FROM tbl_prod WHERE brand_id = :brand_id AND recom_status IN (#recom_status#) ORDER BY `sort` DESC
	</select>
   <select id="getProd">
		SELECT * FROM tbl_prod WHERE recom_status in (#recom_status#) ORDER BY `sort` DESC , create_time DESC limit :offset, :limit
	</select>
    <select id="getProdTotal">
		SELECT COUNT(*) FROM tbl_prod WHERE recom_status IN (#recom_status#) 
	</select>
	<update id="updateProd">
		UPDATE tbl_prod SET name=:name, brand_id=:brand_id, url=:url, pic = :pic, `sort` = :sort, market_price=:market_price, product_skn = :product_skn, product_id =:product_id,  text = :text,create_time = :create_time, price = :price, recom_status = :recom_status WHERE id = :id
	</update>
	<insert id="insertProd">
		INSERT INTO tbl_prod (name,brand_id,url,pic,text, price, `sort`, recom_status, market_price, product_skn, product_id, create_time) VALUES (:name,:brand_id,:url,:pic,:text,:price, :sort, :recom_status, :market_price,:product_skn,:product_id, UNIX_TIMESTAMP()) 
	</insert>	
	<delete id="delProd">
	    DELETE FROM tbl_prod WHERE id = :id
	</delete>	
</sqlMap>