<?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.bom.details.dao.impl.VHzyaBomDetailsDaoImpl">

    <resultMap id="get-VHzyaBomDetailsEntity-result" type="com.hzya.frame.u9c.bom.details.entity.VHzyaBomDetailsEntity" >
        <result property="id" column="id" jdbcType="INTEGER"/>
        <result property="name" column="name" jdbcType="VARCHAR"/>
        <result property="code" column="code" jdbcType="VARCHAR"/>
        <result property="skuCode" column="sku_code" jdbcType="VARCHAR"/>
        <result property="parentId" column="parent_id" jdbcType="VARCHAR"/>
        <result property="replaceId" column="replace_id" jdbcType="VARCHAR"/>
        <result property="itemNumber" column="item_number" jdbcType="VARCHAR"/>
        <result property="subitem" column="subitem" jdbcType="VARCHAR"/>
        <result property="modifyTime" column="modify_time" jdbcType="VARCHAR"/>
        <result property="usageType" column="usage_type" jdbcType="VARCHAR"/>
        <result property="dosage" column="dosage" jdbcType="VARCHAR"/>
        <result property="parentNumber" column="parent_number" jdbcType="VARCHAR"/>
        <result property="rounding" column="rounding" jdbcType="VARCHAR"/>
        <result property="effectiveOrNot" column="effective_or_not" jdbcType="VARCHAR"/>
        <result property="effectiveDate" column="effective_date" jdbcType="VARCHAR"/>
    </resultMap>
    <!-- 查询的字段-->
    <sql id = "VHzyaBomDetailsEntity_Base_Column_List">
        id
       ,name 
        ,code 
        ,sku_code 
        ,parent_id 
        ,replace_id 
        ,item_number 
        ,subitem 
        ,modify_time 
        ,usage_type 
        ,dosage 
        ,parent_number 
        ,rounding 
        ,effective_or_not 
        ,effective_date 
     </sql>
 <!-- 查询 采用==查询 -->
 <select id="entity_list_base" resultMap="get-VHzyaBomDetailsEntity-result" parameterType = "com.hzya.frame.u9c.bom.details.entity.VHzyaBomDetailsEntity">
    select
    <include refid="VHzyaBomDetailsEntity_Base_Column_List" />
    from v_hzya_bom_details
    <trim prefix="where" prefixOverrides="and"> 
        <if test="id != null"> and id = #{id} </if>
        <if test="name != null and name != ''"> and name = #{name} </if>
        <if test="code != null and code != ''"> and code = #{code} </if>
        <if test="skuCode != null and skuCode != ''"> and sku_code = #{skuCode} </if>
        <if test="parentId != null and parentId != ''"> and parent_id = #{parentId} </if>
        <if test="replaceId != null and replaceId != ''"> and replace_id = #{replaceId} </if>
        <if test="itemNumber != null and itemNumber != ''"> and item_number = #{itemNumber} </if>
        <if test="subitem != null and subitem != ''"> and subitem = #{subitem} </if>
        <if test="modifyTime != null and modifyTime != ''"> and modify_time = #{modifyTime} </if>
        <if test="usageType != null and usageType != ''"> and usage_type = #{usageType} </if>
        <if test="dosage != null and dosage != ''"> and dosage = #{dosage} </if>
        <if test="parentNumber != null and parentNumber != ''"> and parent_number = #{parentNumber} </if>
        <if test="rounding != null and rounding != ''"> and rounding = #{rounding} </if>
        <if test="effectiveOrNot != null and effectiveOrNot != ''"> and effective_or_not = #{effectiveOrNot} </if>
        <if test="effectiveDate != null and effectiveDate != ''"> and effective_date = #{effectiveDate} </if>

    </trim>

</select>
    
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.u9c.bom.details.entity.VHzyaBomDetailsEntity">
        select  count(1)   from v_hzya_bom_details
    <trim prefix="where" prefixOverrides="and"> 
        <if test="id != null"> and id = #{id} </if>
        <if test="name != null and name != ''"> and name = #{name} </if>
        <if test="code != null and code != ''"> and code = #{code} </if>
        <if test="skuCode != null and skuCode != ''"> and sku_code = #{skuCode} </if>
        <if test="parentId != null and parentId != ''"> and parent_id = #{parentId} </if>
        <if test="replaceId != null and replaceId != ''"> and replace_id = #{replaceId} </if>
        <if test="itemNumber != null and itemNumber != ''"> and item_number = #{itemNumber} </if>
        <if test="subitem != null and subitem != ''"> and subitem = #{subitem} </if>
        <if test="modifyTime != null and modifyTime != ''"> and modify_time = #{modifyTime} </if>
        <if test="usageType != null and usageType != ''"> and usage_type = #{usageType} </if>
        <if test="dosage != null and dosage != ''"> and dosage = #{dosage} </if>
        <if test="parentNumber != null and parentNumber != ''"> and parent_number = #{parentNumber} </if>
        <if test="rounding != null and rounding != ''"> and rounding = #{rounding} </if>
        <if test="effectiveOrNot != null and effectiveOrNot != ''"> and effective_or_not = #{effectiveOrNot} </if>
        <if test="effectiveDate != null and effectiveDate != ''"> and effective_date = #{effectiveDate} </if>

    </trim>

    </select>

    <!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-VHzyaBomDetailsEntity-result" parameterType = "com.hzya.frame.u9c.bom.details.entity.VHzyaBomDetailsEntity">
    select
    <include refid="VHzyaBomDetailsEntity_Base_Column_List" />
    from v_hzya_bom_details
    <trim prefix="where" prefixOverrides="and"> 
        <if test="id != null"> and id like concat('%',#{id},'%') </if>
        <if test="name != null and name != ''"> and name like concat('%',#{name},'%') </if>
        <if test="code != null and code != ''"> and code like concat('%',#{code},'%') </if>
        <if test="skuCode != null and skuCode != ''"> and sku_code like concat('%',#{skuCode},'%') </if>
        <if test="parentId != null and parentId != ''"> and parent_id like concat('%',#{parentId},'%') </if>
        <if test="replaceId != null and replaceId != ''"> and replace_id like concat('%',#{replaceId},'%') </if>
        <if test="itemNumber != null and itemNumber != ''"> and item_number like concat('%',#{itemNumber},'%') </if>
        <if test="subitem != null and subitem != ''"> and subitem like concat('%',#{subitem},'%') </if>
        <if test="modifyTime != null and modifyTime != ''"> and modify_time like concat('%',#{modifyTime},'%') </if>
        <if test="usageType != null and usageType != ''"> and usage_type like concat('%',#{usageType},'%') </if>
        <if test="dosage != null and dosage != ''"> and dosage like concat('%',#{dosage},'%') </if>
        <if test="parentNumber != null and parentNumber != ''"> and parent_number like concat('%',#{parentNumber},'%') </if>
        <if test="rounding != null and rounding != ''"> and rounding like concat('%',#{rounding},'%') </if>
        <if test="effectiveOrNot != null and effectiveOrNot != ''"> and effective_or_not like concat('%',#{effectiveOrNot},'%') </if>
        <if test="effectiveDate != null and effectiveDate != ''"> and effective_date like concat('%',#{effectiveDate},'%') </if>

    </trim>

</select>

<!-- 查询列表 字段采用or格式 -->
<select id="VHzyaBomDetailsentity_list_or" resultMap="get-VHzyaBomDetailsEntity-result" parameterType = "com.hzya.frame.u9c.bom.details.entity.VHzyaBomDetailsEntity">
    select
    <include refid="VHzyaBomDetailsEntity_Base_Column_List" />
    from v_hzya_bom_details
    <trim prefix="where" prefixOverrides="and"> 
        <if test="id != null"> or id = #{id} </if>
        <if test="name != null and name != ''"> or name = #{name} </if>
        <if test="code != null and code != ''"> or code = #{code} </if>
        <if test="skuCode != null and skuCode != ''"> or sku_code = #{skuCode} </if>
        <if test="parentId != null and parentId != ''"> or parent_id = #{parentId} </if>
        <if test="replaceId != null and replaceId != ''"> or replace_id = #{replaceId} </if>
        <if test="itemNumber != null and itemNumber != ''"> or item_number = #{itemNumber} </if>
        <if test="subitem != null and subitem != ''"> or subitem = #{subitem} </if>
        <if test="modifyTime != null and modifyTime != ''"> or modify_time = #{modifyTime} </if>
        <if test="usageType != null and usageType != ''"> or usage_type = #{usageType} </if>
        <if test="dosage != null and dosage != ''"> or dosage = #{dosage} </if>
        <if test="parentNumber != null and parentNumber != ''"> or parent_number = #{parentNumber} </if>
        <if test="rounding != null and rounding != ''"> or rounding = #{rounding} </if>
        <if test="effectiveOrNot != null and effectiveOrNot != ''"> or effective_or_not = #{effectiveOrNot} </if>
        <if test="effectiveDate != null and effectiveDate != ''"> or effective_date = #{effectiveDate} </if>

    </trim>

</select>
</mapper>

