160 lines
6.1 KiB
XML
160 lines
6.1 KiB
XML
|
|
<?xml version="1.0" encoding="UTF-8"?><!--Converted at: Wed Jul 11 17:43:20 CST 2018-->
|
||
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||
|
|
<mapper namespace="Goods">
|
||
|
|
|
||
|
|
<insert id="insertGoods" parameterType="Goods">
|
||
|
|
INSERT INTO Goods ( goodsId, goodsName, lessonId , goodsLevel,
|
||
|
|
wordCount, price, description, isRecomm, goodsPic,
|
||
|
|
memo , rebate ,tradePrice ,tryMonths,isOut )
|
||
|
|
Values ( #{goodsId}, #{goodsName}, #{lessonId} , #{goodsLevel},
|
||
|
|
#{wordCount}, #{price}, #{description}, #{isRecomm}, #{goodsPic},
|
||
|
|
#{memo} , #{rebate} ,#{tradePrice},#{tryMonths},#{isOut} )
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<update id="updateGoods" parameterType="Goods">
|
||
|
|
UPDATE Goods
|
||
|
|
SET goodsId = #{goodsId}, goodsName = #{goodsName},
|
||
|
|
lessonId = #{lessonId} , goodsLevel = #{goodsLevel},
|
||
|
|
wordCount = #{wordCount}, price = #{price},
|
||
|
|
description = #{description}, isRecomm = #{isRecomm},
|
||
|
|
goodsPic = #{goodsPic}, memo = #{memo} , rebate = #{rebate},
|
||
|
|
tradePrice = #{tradePrice} ,tryMonths = #{tryMonths},isOut=#{isOut}
|
||
|
|
where goodsId=#{goodsId}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<select id="getGoodsByKey" parameterType="java.lang.Integer" resultType="Goods">
|
||
|
|
SELECT goodsId , goodsName , lessonId , goodsLevel , wordCount ,
|
||
|
|
price , description , isRecomm , goodsPic , memo ,
|
||
|
|
rebate ,tradePrice ,tryMonths, isOut
|
||
|
|
FROM Goods
|
||
|
|
WHERE goodsId=#{goodsId}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getSeqGoods" resultType="Integer" useCache="false" flushCache="true">
|
||
|
|
SELECT nextval('seq_goodsId')
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getGoodsCount" resultType="Integer">
|
||
|
|
SELECT count(*) from Goods
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getGoodss" parameterType="java.util.Map" resultType="Goods">
|
||
|
|
SELECT goodsId , goodsName , lessonId , goodsLevel , wordCount ,
|
||
|
|
price , description , isRecomm , goodsPic , memo ,
|
||
|
|
rebate ,tradePrice ,tryMonths , isOut
|
||
|
|
FROM Goods
|
||
|
|
order by goodsId
|
||
|
|
<if test="pageSize!=null">
|
||
|
|
limit #{pageSize}
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="offset!=null">
|
||
|
|
offset #{offset}
|
||
|
|
</if>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="recommGoodss" resultType="Goods">
|
||
|
|
SELECT goodsId , goodsName , lessonId , goodsLevel , wordCount ,
|
||
|
|
price , description , isRecomm , goodsPic , memo ,
|
||
|
|
rebate ,tradePrice ,tryMonths,isOut
|
||
|
|
FROM Goods
|
||
|
|
WHERE isRecomm = 1
|
||
|
|
order by goodsId
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getSalesCount" resultType="Integer">
|
||
|
|
select count(*) from goods where isRecomm =1 and price >0
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getSalesGoodss" parameterType="java.util.Map" resultType="Goods">
|
||
|
|
SELECT goodsId , goodsName , lessonId , goodsLevel , wordCount ,
|
||
|
|
price , description , isRecomm , goodsPic , memo ,
|
||
|
|
rebate ,tradePrice ,tryMonths, isOut
|
||
|
|
FROM Goods
|
||
|
|
where isRecomm =1 and price >0
|
||
|
|
<if test="pageSize!=null">
|
||
|
|
limit #{pageSize}
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="offset!=null">
|
||
|
|
offset #{offset}
|
||
|
|
</if>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="seriesgoodsnames" parameterType="java.util.List" resultType="String">
|
||
|
|
SELECT string_agg( goodsname , ',' )
|
||
|
|
FROM Goods
|
||
|
|
WHERE goodsId in
|
||
|
|
<foreach collection="list" index="index" item="item" separator="," close=")" open="(">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<select id="getAreaOwnGoodss" parameterType="java.util.Map" resultType="Goods">
|
||
|
|
SELECT goodsId , goodsName , lessonId , goodsLevel , wordCount ,
|
||
|
|
price , description , isRecomm , goodsPic , memo ,
|
||
|
|
rebate ,tradePrice ,tryMonths , isOut
|
||
|
|
FROM Goods where goodsId in (select valueint from parameter where paratype=7 and paraint=#{areaId})
|
||
|
|
order by goodsId
|
||
|
|
<if test="pageSize!=null">
|
||
|
|
limit #{pageSize}
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="offset!=null">
|
||
|
|
offset #{offset}
|
||
|
|
</if>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
<select id="getParentAreaOwnGoodss" parameterType="java.util.Map" resultType="Goods">
|
||
|
|
with temp as (select areaid from area where
|
||
|
|
|
||
|
|
<if test="objectType==1">
|
||
|
|
parentid=#{areaId}
|
||
|
|
</if>
|
||
|
|
<if test="objectType==2">
|
||
|
|
parentid in (select areaid from area where parentid=#{areaId})
|
||
|
|
</if>
|
||
|
|
),
|
||
|
|
temp1 as(select count(areaid) as much from temp ),
|
||
|
|
temp2 as(
|
||
|
|
select valueint,count(distinct paraint) much from parameter where paratype=7 and paraint in (select areaid from temp)
|
||
|
|
group by valueint )
|
||
|
|
SELECT goodsId , goodsName , lessonId , goodsLevel , wordCount ,
|
||
|
|
price , description , isRecomm , goodsPic , memo ,
|
||
|
|
rebate ,tradePrice ,tryMonths , isOut
|
||
|
|
FROM Goods where goodsId in (select valueint from temp2 where much=(select much from temp1))
|
||
|
|
order by goodsId
|
||
|
|
<if test="pageSize!=null">
|
||
|
|
limit #{pageSize}
|
||
|
|
</if>
|
||
|
|
|
||
|
|
<if test="offset!=null">
|
||
|
|
offset #{offset}
|
||
|
|
</if>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getParentAreaOwnGoodssCount" parameterType="java.util.Map" resultType="java.lang.Integer">
|
||
|
|
with temp as (select areaid from area where
|
||
|
|
|
||
|
|
<if test="objectType==1">
|
||
|
|
parentid=#{areaId}
|
||
|
|
</if>
|
||
|
|
<if test="objectType==2">
|
||
|
|
parentid in (select areaid from area where parentid=#{areaId})
|
||
|
|
</if>
|
||
|
|
),
|
||
|
|
temp1 as(select count(areaid) as much from temp ),
|
||
|
|
temp2 as(
|
||
|
|
select valueint,count(distinct paraint) much from parameter where paratype=7 and paraint in (select areaid from temp)
|
||
|
|
group by valueint )
|
||
|
|
select count(valueint) from temp2 where much=(select much from temp1)
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="getAreaOwnGoodssCount" parameterType="java.lang.Integer" resultType="java.lang.Integer">
|
||
|
|
select count(valueint) from parameter where paratype=7 and paraint=#{areaId}
|
||
|
|
</select>
|
||
|
|
</mapper>
|