<?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.hzya.frame.u9c.allot.items.dao.impl.VU9cAllotOrderItemsDaoImpl">

    <resultMap id="get-VU9cAllotOrderItemsEntity-result" type="com.hzya.frame.u9c.allot.items.entity.VU9cAllotOrderItemsEntity" >
        <result property="id" column="id" jdbcType="VARCHAR"/>
        <result property="sortno" column="sortno" jdbcType="VARCHAR"/>
        <result property="reabamWcode" column="reabamWcode" jdbcType="VARCHAR"/>
        <result property="skubarcode" column="skuBarcode" jdbcType="VARCHAR"/>
        <result property="itemname" column="itemName" jdbcType="VARCHAR"/>
        <result property="itemcode" column="itemCode" jdbcType="VARCHAR"/>
        <result property="quantity" column="quantity" jdbcType="VARCHAR"/>
        <result property="quantity1" column="quantity1" jdbcType="VARCHAR"/>
        <result property="reabamUnit" column="reabamUnit" jdbcType="VARCHAR"/>
        <result property="unit_name" column="unit_name" jdbcType="VARCHAR"/>
        <result property="saleprice" column="salePrice" jdbcType="VARCHAR"/>
        <result property="locationcode" column="locationCode" jdbcType="VARCHAR"/>
        <result property="locationname" column="locationName" jdbcType="VARCHAR"/>
    </resultMap>
    <!-- 查询的字段-->
    <sql id = "VU9cAllotOrderItemsEntity_Base_Column_List">
        id,
        sortno
       ,skuBarcode 
       ,reabamWcode
        ,itemName
        ,itemCode 
        ,quantity 
        ,quantity1
        ,reabamUnit
        ,unit_name
        ,salePrice
        ,locationCode 
        ,locationName 
     </sql>
 <!-- 查询 采用==查询 -->
 <select id="entity_list_base" resultMap="get-VU9cAllotOrderItemsEntity-result" parameterType = "com.hzya.frame.u9c.allot.items.entity.VU9cAllotOrderItemsEntity">
    select
    <include refid="VU9cAllotOrderItemsEntity_Base_Column_List" />
    from v_u9c_allot_order_items
    <trim prefix="where" prefixOverrides="and"> 
        <if test="sortno != null and sortno != ''"> and sortno = #{sortno} </if>
        <if test="id != null and id != ''"> and id = #{id} </if>
        <if test="skubarcode != null and skubarcode != ''"> and skuBarcode = #{skubarcode} </if>
        <if test="reabamWcode != null and reabamWcode != ''"> and reabamWcode = #{reabamWcode} </if>
        <if test="itemname != null and itemname != ''"> and itemName = #{itemname} </if>
        <if test="itemcode != null and itemcode != ''"> and itemCode = #{itemcode} </if>
        <if test="quantity != null and quantity != ''"> and quantity = #{quantity} </if>
        <if test="saleprice != null and saleprice != ''"> and salePrice = #{saleprice} </if>
        <if test="locationcode != null and locationcode != ''"> and locationCode = #{locationcode} </if>
        <if test="locationname != null and locationname != ''"> and locationName = #{locationname} </if>

    </trim>

</select>

    <!-- 睿本云专用 -->
    <select id="VU9cAllotOrderItemsEntity_list_base_reabam" resultMap="get-VU9cAllotOrderItemsEntity-result" parameterType = "com.hzya.frame.u9c.allot.items.entity.VU9cAllotOrderItemsEntity">
        select
        <include refid="VU9cAllotOrderItemsEntity_Base_Column_List" />
        from v_u9c_allot_order_items
        <trim prefix="where" prefixOverrides="and">
            <if test="sortno != null and sortno != ''"> and sortno = #{sortno} </if>
            <if test="id != null and id != ''"> and id = #{id} </if>
            <if test="skubarcode != null and skubarcode != ''"> and skuBarcode = #{skubarcode} </if>
            <if test="reabamWcode != null and reabamWcode != ''"> and reabamWcode = #{reabamWcode} </if>
            <if test="itemname != null and itemname != ''"> and itemName = #{itemname} </if>
            <if test="itemcode != null and itemcode != ''"> and itemCode = #{itemcode} </if>
            <if test="quantity != null and quantity != ''"> and quantity = #{quantity} </if>
            <if test="saleprice != null and saleprice != ''"> and salePrice = #{saleprice} </if>
            <if test="locationcode != null and locationcode != ''"> and locationCode = #{locationcode} </if>
            <if test="locationname != null and locationname != ''"> and locationName = #{locationname} </if>

        </trim>

    </select>
    
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.u9c.allot.items.entity.VU9cAllotOrderItemsEntity">
        select  count(1)   from v_u9c_allot_order_items
    <trim prefix="where" prefixOverrides="and"> 
        <if test="sortno != null and sortno != ''"> and sortno = #{sortno} </if>
        <if test="skubarcode != null and skubarcode != ''"> and skuBarcode = #{skubarcode} </if>
        <if test="itemname != null and itemname != ''"> and itemName = #{itemname} </if>
        <if test="itemcode != null and itemcode != ''"> and itemCode = #{itemcode} </if>
        <if test="quantity != null and quantity != ''"> and quantity = #{quantity} </if>
        <if test="saleprice != null and saleprice != ''"> and salePrice = #{saleprice} </if>
        <if test="locationcode != null and locationcode != ''"> and locationCode = #{locationcode} </if>
        <if test="locationname != null and locationname != ''"> and locationName = #{locationname} </if>

    </trim>

    </select>

    <!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-VU9cAllotOrderItemsEntity-result" parameterType = "com.hzya.frame.u9c.allot.items.entity.VU9cAllotOrderItemsEntity">
    select
    <include refid="VU9cAllotOrderItemsEntity_Base_Column_List" />
    from v_u9c_allot_order_items
    <trim prefix="where" prefixOverrides="and"> 
        <if test="sortno != null and sortno != ''"> and sortno like concat('%',#{sortno},'%') </if>
        <if test="skubarcode != null and skubarcode != ''"> and skuBarcode like concat('%',#{skubarcode},'%') </if>
        <if test="itemname != null and itemname != ''"> and itemName like concat('%',#{itemname},'%') </if>
        <if test="itemcode != null and itemcode != ''"> and itemCode like concat('%',#{itemcode},'%') </if>
        <if test="quantity != null and quantity != ''"> and quantity like concat('%',#{quantity},'%') </if>
        <if test="saleprice != null and saleprice != ''"> and salePrice like concat('%',#{saleprice},'%') </if>
        <if test="locationcode != null and locationcode != ''"> and locationCode like concat('%',#{locationcode},'%') </if>
        <if test="locationname != null and locationname != ''"> and locationName like concat('%',#{locationname},'%') </if>

    </trim>

</select>

<!-- 查询列表 字段采用or格式 -->
<select id="VU9cAllotOrderItemsentity_list_or" resultMap="get-VU9cAllotOrderItemsEntity-result" parameterType = "com.hzya.frame.u9c.allot.items.entity.VU9cAllotOrderItemsEntity">
    select
    <include refid="VU9cAllotOrderItemsEntity_Base_Column_List" />
    from v_u9c_allot_order_items
    <trim prefix="where" prefixOverrides="and"> 
        <if test="sortno != null and sortno != ''"> or sortno = #{sortno} </if>
        <if test="skubarcode != null and skubarcode != ''"> or skuBarcode = #{skubarcode} </if>
        <if test="itemname != null and itemname != ''"> or itemName = #{itemname} </if>
        <if test="itemcode != null and itemcode != ''"> or itemCode = #{itemcode} </if>
        <if test="quantity != null and quantity != ''"> or quantity = #{quantity} </if>
        <if test="saleprice != null and saleprice != ''"> or salePrice = #{saleprice} </if>
        <if test="locationcode != null and locationcode != ''"> or locationCode = #{locationcode} </if>
        <if test="locationname != null and locationname != ''"> or locationName = #{locationname} </if>

    </trim>

</select>



</mapper>

