<?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.hys.app.mapper.goods.GoodsSnMapper">

    <!--查询商品关联的可检索的参数值-->
    <select id="getGoodsSnCount" resultType="com.hys.app.model.erp.dos.GoodsSnDO" useCache="false">
        select goods_id,id, sn_code,create_time,update_time,status,creator,updater from erp_goods_sn
        <where>
            <if test="request.goodsId!=null and request.goodsId>0">
                goods_id=#{request.goodsId}
            </if>
            <if test="request.snCode!=null and request.snCode!=''">
                sn_code=#{request.snCode}
            </if>
        </where>
        group by goods_id
        order by id desc
        limit ${(request.pageNo- 1) * request.pageSize} , #{request.pageSize}
    </select>

    <select id="getGoodsSnCountQty" resultType="Long" useCache="false">

        select  count(goods_id) from erp_goods_sn
        <where>
            <if test="request.goodsId!=null and request.goodsId>0">
                goods_id=#{request.goodsId}
            </if>
            <if test="request.snCode!=null and request.snCode!=''">
                sn_code=#{request.snCode}
            </if>
        </where>
         group by goods_id

    </select>


</mapper>