123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <?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.mapper.GoodsMapper">
- <select id="findGoodsList"
- resultType="Goods">
- select * from goods
- </select>
-
- <select id="paihang"
- resultType="Goods">
- select sum(goodsQuantity) goodsQuantity,goodsId goodsId from orderitem group by goodsId order by sum(goodsQuantity) desc limit 0,7
- </select>
-
-
-
- <select id="report2" parameterType="java.util.Map" resultType="Goods">
- select sum(goodsQuantity) goodsQuantity, DATE_FORMAT(orderdate, '%Y-%m-%d') orderdate,sum(goodsQuantity*goodsshichangjia) goodsshichangjia from orderitem a left join torder b on a.orderid=b.orderid left join goods c on a.goodsid=c.goodsid where orderZhuangtai != '未付款' and orderZhuangtai != '已取消' group by DATE_FORMAT(orderdate, '%Y-%m-%d')
- </select>
-
-
-
- <select id="query" parameterType="java.util.Map" resultType="Goods">
- select * from goods
- <where>
- <if test="goodsId!=null and goodsId!=0">
- and goodsId= #{goodsId}
- </if>
-
- <if test="goodsDel!=null and goodsDel!=''">
- and goodsDel= #{goodsDel}
- </if>
- <if test="tj!=null">
- and tj= #{tj}
- </if>
-
- <if test="qtj=='Y'.toString()">
- and ( tj=1 or goodsCatelogId in
- <foreach item="item" index="index" collection="cids" open="(" separator="," close=")">
- #{item}
- </foreach>
- )
-
- </if>
-
-
- <if test="zt!=null">
- and zt= #{zt}
- </if>
- <if test="goodsCatelogId!=null and goodsCatelogId!=0">
- and goodsCatelogId= #{goodsCatelogId}
- </if>
- <if test="goodsName!=null and goodsName!=''">
- and goodsName like '%${goodsName}%'
- </if>
-
- <if test="kucun==1000">
- and kucun > 0 and goodsId!=#{own}
- </if>
-
- </where>
-
-
- order by zan desc
-
-
- <if test="page">
- limit #{offset} ,#{pageSize}
- </if>
- </select>
-
-
- <select id="getCount" parameterType="java.util.Map" resultType="Int">
- select count(0) from goods
- <where>
- <if test="goodsId!=null and goodsId!=0">
- and goodsId= #{goodsId}
- </if>
-
- <if test="goodsDel!=null and goodsDel!=''">
- and goodsDel= #{goodsDel}
- </if>
-
- <if test="zt!=null">
- and zt= #{zt}
- </if>
- <if test="goodsCatelogId!=null and goodsCatelogId!=0">
- and goodsCatelogId= #{goodsCatelogId}
- </if>
- <if test="goodsName!=null and goodsName!=''">
- and goodsName like '%${goodsName}%'
- </if>
-
- </where>
- </select>
-
-
- <select id="queryGoodsById" parameterType="int" resultType="Goods">
- select * from goods where goodsId=${value}
- </select>
-
- <insert id="insertGoods" useGeneratedKeys="true" keyProperty="id" parameterType="Goods">
- insert into goods
- (goodsName,goodsMiaoshu,goodsPic,goodsShichangjia,goodsCatelogId,goodsDel,zt,kucun,tj)
- values
- (#{goodsName},#{goodsMiaoshu},#{goodsPic},#{goodsShichangjia},#{goodsCatelogId},#{goodsDel},#{zt},#{kucun},0);
- </insert>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <update id="updateGoods" parameterType="Goods" >
- update goods set
- goodsName=#{goodsName},goodsMiaoshu=#{goodsMiaoshu},goodsPic=#{goodsPic},goodsShichangjia=#{goodsShichangjia},goodsCatelogId=#{goodsCatelogId},goodsDel=#{goodsDel},zt=#{zt},kucun=#{kucun},zan=#{zan},tj=#{tj}
- where
- goodsId=#{goodsId}
- </update>
-
-
-
- <delete id="deleteGoods" parameterType="int">
- delete from goods where goodsId=${value}
- </delete>
-
-
-
- <select id="findSameGoods" parameterType="java.util.Map" resultType="Goods">
- select * from goods where goodsCatelogId= #{goodsCatelogId} and goodsId!=#{goodsId}
- limit 0 ,2
-
- </select>
- </mapper>
-
|