<?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.order.dao.impl.VU9cAllotOrderDaoImpl">

    <resultMap id="get-VU9cAllotOrderEntity-result" type="com.hzya.frame.u9c.allot.order.entity.VU9cAllotOrderEntity" >
        <result property="id" column="id" jdbcType="VARCHAR"/>
        <result property="outorderno" column="outOrderNo" jdbcType="VARCHAR"/>
        <result property="doctypename" column="doctypename" jdbcType="VARCHAR"/>
        <result property="doctypecode" column="doctypecode" jdbcType="VARCHAR"/>
        <result property="docdate" column="docDate" jdbcType="VARCHAR"/>
        <result property="remark" column="remark" jdbcType="VARCHAR"/>
        <result property="status" column="status" jdbcType="VARCHAR"/>
        <result property="update_time" column="update_time" jdbcType="VARCHAR"/>
    </resultMap>
    <!-- 查询的字段-->
    <sql id = "VU9cAllotOrderEntity_Base_Column_List">
        id,
        outOrderNo,
        doctypename,
        doctypecode,
        status,
        update_time,
    docDate
     </sql>
 <!-- 查询 采用==查询 -->
 <select id="entity_list_base" resultMap="get-VU9cAllotOrderEntity-result" parameterType = "com.hzya.frame.u9c.allot.order.entity.VU9cAllotOrderEntity">
    select
    <include refid="VU9cAllotOrderEntity_Base_Column_List" />
    from v_u9c_allot_order
    <trim prefix="where" prefixOverrides="and"> 
        <if test="outorderno != null and outorderno != ''"> and outOrderNo = #{outorderno} </if>
        <if test="id != null and id != ''"> and id = #{id} </if>
        <if test="status != null and status != ''"> and status = #{status} </if>
        <if test="update_time != null and update_time != ''"> and update_time = #{update_time} </if>
        <if test="docdate != null and docdate != ''"> and docDate = #{docdate} </if>

    </trim>

</select>

    <!--睿本云专用-->
    <select id="VU9cAllotOrderEntity_list_base_reabam" resultMap="get-VU9cAllotOrderEntity-result" parameterType = "com.hzya.frame.u9c.allot.order.entity.VU9cAllotOrderEntity">
        select
        <include refid="VU9cAllotOrderEntity_Base_Column_List" />
        from v_u9c_allot_order
        <trim prefix="where" prefixOverrides="and">
            <if test="outorderno != null and outorderno != ''"> and outOrderNo = #{outorderno} </if>
            <if test="id != null and id != ''"> and id = #{id} </if>
            <if test="status != null and status != ''"> and status = #{status} </if>
            <if test="update_time != null and update_time != ''"> and update_time >= #{update_time} </if>
            <if test="docdate != null and docdate != ''"> and docDate = #{docdate} </if>
            <if test="doctypecode != null and doctypecode != ''"> and doctypecode = #{doctypecode} </if>
            <if test="doctypename != null and doctypename != ''"> and doctypename = #{doctypename} </if>
            and status = 5
        </trim>

    </select>

<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.u9c.allot.order.entity.VU9cAllotOrderEntity">
        select  count(1)   from v_u9c_allot_order
    <trim prefix="where" prefixOverrides="and"> 
        <if test="outorderno != null and outorderno != ''"> and outOrderNo = #{outorderno} </if>
        <if test="docdate != null and docdate != ''"> and docDate = #{docdate} </if>


    </trim>

    </select>

    <!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-VU9cAllotOrderEntity-result" parameterType = "com.hzya.frame.u9c.allot.order.entity.VU9cAllotOrderEntity">
    select
    <include refid="VU9cAllotOrderEntity_Base_Column_List" />
    from v_u9c_allot_order
    <trim prefix="where" prefixOverrides="and"> 
        <if test="outorderno != null and outorderno != ''"> and outOrderNo like concat('%',#{outorderno},'%') </if>
        <if test="docdate != null and docdate != ''"> and docDate like concat('%',#{docdate},'%') </if>
        <if test="remark != null and remark != ''"> and remark like concat('%',#{remark},'%') </if>

    </trim>

</select>

<!-- 查询列表 字段采用or格式 -->
<select id="VU9cAllotOrderentity_list_or" resultMap="get-VU9cAllotOrderEntity-result" parameterType = "com.hzya.frame.u9c.allot.order.entity.VU9cAllotOrderEntity">
    select
    <include refid="VU9cAllotOrderEntity_Base_Column_List" />
    from v_u9c_allot_order
    <trim prefix="where" prefixOverrides="and"> 
        <if test="outorderno != null and outorderno != ''"> or outOrderNo = #{outorderno} </if>
        <if test="docdate != null and docdate != ''"> or docDate = #{docdate} </if>

    </trim>

</select>



</mapper>

