87 lines
3.5 KiB
XML
87 lines
3.5 KiB
XML
<?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.ghy.goods.mapper.GoodsStandardMapper">
|
|
|
|
<resultMap id="GoodsStandardResult" type="com.ghy.goods.domain.GoodsStandard">
|
|
<result property="goodsStandardId" column="goods_standard_id"/>
|
|
<result property="goodsStandardName" column="goods_standard_name"/>
|
|
<result property="goodsId" column="goods_id"/>
|
|
<result property="deptGoodsCategoryId" column="dept_goods_category_id"/>
|
|
<result property="goodsPrice" column="goods_price"/>
|
|
<result property="discountPrice" column="discount_price"/>
|
|
<result property="groupPrice" column="group_price"/>
|
|
<result property="goodsNum" column="goods_num"/>
|
|
<result property="saleNum" column="sale_num"/>
|
|
<result property="status" column="status"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateBy" column="update_by"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="remark" column="remark"/>
|
|
|
|
</resultMap>
|
|
|
|
<sql id="selectGoodsStandard">
|
|
SELECT goods_standard_id,
|
|
goods_standard_name,
|
|
goods_id,
|
|
dept_goods_category_id,
|
|
goods_price,
|
|
discount_price,
|
|
group_price,
|
|
goods_num,
|
|
create_by,
|
|
create_time,
|
|
sale_num,
|
|
status,
|
|
update_by,
|
|
update_time,
|
|
remark
|
|
FROM goods_standard
|
|
</sql>
|
|
|
|
<select id="selectById" resultMap="GoodsStandardResult">
|
|
<include refid="selectGoodsStandard"/>
|
|
<where>
|
|
<if test="goodsStandardId != null and goodsStandardId != 0">
|
|
AND goods_standard_id = #{goodsStandardId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectByIds" resultMap="GoodsStandardResult">
|
|
<include refid="selectGoodsStandard"/>
|
|
where goods_standard_id in
|
|
<foreach collection="collection" item="goodsStandardIds" open="(" separator="," close=")">
|
|
#{goodsStandardIds}
|
|
</foreach>
|
|
</select>
|
|
|
|
<select id="selectByGoodsId" parameterType="long" resultMap="GoodsStandardResult">
|
|
<include refid="selectGoodsStandard"/>
|
|
<where>
|
|
<if test="goodsId != null ">
|
|
AND goods_id = #{goodsId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<insert id="batchInsert" parameterType="list">
|
|
INSERT INTO goods_standard (
|
|
goods_standard_name, goods_id, dept_goods_category_id, goods_price, discount_price, group_price, goods_num,
|
|
sale_num, status, remark, create_by, create_time )
|
|
VALUES
|
|
<foreach collection="goodsStandards" separator="," item="goodsStandard">
|
|
(
|
|
#{goodsStandard.goodsStandardName}, #{goodsStandard.goodsId}, #{goodsStandard.deptGoodsCategoryId}, #{goodsStandard.goodsPrice}, #{goodsStandard.discountPrice},
|
|
#{goodsStandard.groupPrice}, #{goodsStandard.goodsNum}, #{goodsStandard.saleNum}, #{goodsStandard.status}, #{goodsStandard.remark}, #{goodsStandard.createBy}, sysdate()
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<select id="checkStore" resultMap="GoodsStandardResult">
|
|
<include refid="selectGoodsStandard"/>
|
|
where goods_standard_id = #{goodsStandardId}
|
|
and goods_num >= #{num}
|
|
</select>
|
|
</mapper> |