95 lines
4.9 KiB
XML
95 lines
4.9 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" resultMap="GoodsStandardResult">
|
||
|
|
<include refid="selectGoodsStandard"/>
|
||
|
|
<where>
|
||
|
|
<if test="goodsId != null and goodsId != 0">
|
||
|
|
AND goods_id = #{goodsId}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="batchInsert" parameterType="com.ghy.goods.domain.GoodsStandard" useGeneratedKeys="true" keyProperty="goodsStandardId">
|
||
|
|
<foreach collection="array" item="goodsStandardList">
|
||
|
|
INSERT INTO goods_standard(
|
||
|
|
<if test="goodsStandardName != null and goodsStandardName != 0">goods_standard_name,</if>
|
||
|
|
<if test="goodsId != null and goodsId != 0">goods_id,</if>
|
||
|
|
<if test="deptGoodsCategoryId != null and deptGoodsCategoryId != ''">dept_goods_category_id</if>
|
||
|
|
<if test="goodsPrice != null and goodsPrice != 0">goods_price,</if>
|
||
|
|
<if test="discountPrice != null and discountPrice != 0">discount_price,</if>
|
||
|
|
<if test="groupPrice != null and groupPrice != 0">group_price,</if>
|
||
|
|
<if test="goodsNum != null and goodsNum != 0">goods_num,</if>
|
||
|
|
<if test="saleNum != null and saleNum != 0">sale_num,</if>
|
||
|
|
<if test="status != null and status != 0">status,</if>
|
||
|
|
<if test="remark != null and remark != ''">remark,</if>
|
||
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||
|
|
create_time
|
||
|
|
)
|
||
|
|
VALUES(
|
||
|
|
<if test="goodsStandardName != null and goodsStandardName != 0">#{goodsStandardName},</if>
|
||
|
|
<if test="goodsId != null and goodsId != 0">#{goodsId},</if>
|
||
|
|
<if test="deptGoodsCategoryId != null and deptGoodsCategoryId != ''">#{deptGoodsCategoryId}</if>
|
||
|
|
<if test="goodsPrice != null and goodsPrice != 0">#{goodsPrice},</if>
|
||
|
|
<if test="discountPrice != null and discountPrice != 0">#{discountPrice},</if>
|
||
|
|
<if test="groupPrice != null and groupPrice != 0">#{groupPrice},</if>
|
||
|
|
<if test="goodsNum != null and goodsNum != 0">#{goodsNum},</if>
|
||
|
|
<if test="saleNum != null and saleNum != 0">#{saleNum},</if>
|
||
|
|
<if test="status != null">#{status},</if>
|
||
|
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||
|
|
sysdate()
|
||
|
|
);
|
||
|
|
</foreach>
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<select id="checkStore" resultMap="GoodsStandardResult">
|
||
|
|
<include refid="selectGoodsStandard"/>
|
||
|
|
where goods_standard_id = #{goodsStandardId}
|
||
|
|
and goods_num >= #{num}
|
||
|
|
</select>
|
||
|
|
</mapper>
|