<?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.jsh.erp.datasource.mappers.DepotItemMapper">
  <resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.DepotItem">
    <id column="Id" jdbcType="BIGINT" property="id" />
    <result column="HeaderId" jdbcType="BIGINT" property="headerid" />
    <result column="MaterialId" jdbcType="BIGINT" property="materialid" />
    <result column="material_extend_id" jdbcType="BIGINT" property="materialExtendId" />
    <result column="MUnit" jdbcType="VARCHAR" property="munit" />
    <result column="OperNumber" jdbcType="DECIMAL" property="opernumber" />
    <result column="BasicNumber" jdbcType="DECIMAL" property="basicnumber" />
    <result column="UnitPrice" jdbcType="DECIMAL" property="unitprice" />
    <result column="TaxUnitPrice" jdbcType="DECIMAL" property="taxunitprice" />
    <result column="AllPrice" jdbcType="DECIMAL" property="allprice" />
    <result column="Remark" jdbcType="VARCHAR" property="remark" />
    <result column="Img" jdbcType="VARCHAR" property="img" />
    <result column="Incidentals" jdbcType="DECIMAL" property="incidentals" />
    <result column="DepotId" jdbcType="BIGINT" property="depotid" />
    <result column="AnotherDepotId" jdbcType="BIGINT" property="anotherdepotid" />
    <result column="TaxRate" jdbcType="DECIMAL" property="taxrate" />
    <result column="TaxMoney" jdbcType="DECIMAL" property="taxmoney" />
    <result column="TaxLastMoney" jdbcType="DECIMAL" property="taxlastmoney" />
    <result column="OtherField1" jdbcType="VARCHAR" property="otherfield1" />
    <result column="OtherField2" jdbcType="VARCHAR" property="otherfield2" />
    <result column="OtherField3" jdbcType="VARCHAR" property="otherfield3" />
    <result column="OtherField4" jdbcType="VARCHAR" property="otherfield4" />
    <result column="OtherField5" jdbcType="VARCHAR" property="otherfield5" />
    <result column="MType" jdbcType="VARCHAR" property="mtype" />
    <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
    <result column="delete_Flag" jdbcType="VARCHAR" property="deleteFlag" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    Id, HeaderId, MaterialId, material_extend_id, MUnit, OperNumber, BasicNumber, UnitPrice, 
    TaxUnitPrice, AllPrice, Remark, Img, Incidentals, DepotId, AnotherDepotId, TaxRate, 
    TaxMoney, TaxLastMoney, OtherField1, OtherField2, OtherField3, OtherField4, OtherField5, 
    MType, tenant_id, delete_Flag
  </sql>
  <select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from jsh_depotitem
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from jsh_depotitem
    where Id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from jsh_depotitem
    where Id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.DepotItemExample">
    delete from jsh_depotitem
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.jsh.erp.datasource.entities.DepotItem">
    insert into jsh_depotitem (Id, HeaderId, MaterialId, 
      material_extend_id, MUnit, OperNumber, 
      BasicNumber, UnitPrice, TaxUnitPrice, 
      AllPrice, Remark, Img, 
      Incidentals, DepotId, AnotherDepotId, 
      TaxRate, TaxMoney, TaxLastMoney, 
      OtherField1, OtherField2, OtherField3, 
      OtherField4, OtherField5, MType, 
      tenant_id, delete_Flag)
    values (#{id,jdbcType=BIGINT}, #{headerid,jdbcType=BIGINT}, #{materialid,jdbcType=BIGINT}, 
      #{materialExtendId,jdbcType=BIGINT}, #{munit,jdbcType=VARCHAR}, #{opernumber,jdbcType=DECIMAL}, 
      #{basicnumber,jdbcType=DECIMAL}, #{unitprice,jdbcType=DECIMAL}, #{taxunitprice,jdbcType=DECIMAL}, 
      #{allprice,jdbcType=DECIMAL}, #{remark,jdbcType=VARCHAR}, #{img,jdbcType=VARCHAR}, 
      #{incidentals,jdbcType=DECIMAL}, #{depotid,jdbcType=BIGINT}, #{anotherdepotid,jdbcType=BIGINT}, 
      #{taxrate,jdbcType=DECIMAL}, #{taxmoney,jdbcType=DECIMAL}, #{taxlastmoney,jdbcType=DECIMAL}, 
      #{otherfield1,jdbcType=VARCHAR}, #{otherfield2,jdbcType=VARCHAR}, #{otherfield3,jdbcType=VARCHAR}, 
      #{otherfield4,jdbcType=VARCHAR}, #{otherfield5,jdbcType=VARCHAR}, #{mtype,jdbcType=VARCHAR}, 
      #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.DepotItem">
    insert into jsh_depotitem
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        Id,
      </if>
      <if test="headerid != null">
        HeaderId,
      </if>
      <if test="materialid != null">
        MaterialId,
      </if>
      <if test="materialExtendId != null">
        material_extend_id,
      </if>
      <if test="munit != null">
        MUnit,
      </if>
      <if test="opernumber != null">
        OperNumber,
      </if>
      <if test="basicnumber != null">
        BasicNumber,
      </if>
      <if test="unitprice != null">
        UnitPrice,
      </if>
      <if test="taxunitprice != null">
        TaxUnitPrice,
      </if>
      <if test="allprice != null">
        AllPrice,
      </if>
      <if test="remark != null">
        Remark,
      </if>
      <if test="img != null">
        Img,
      </if>
      <if test="incidentals != null">
        Incidentals,
      </if>
      <if test="depotid != null">
        DepotId,
      </if>
      <if test="anotherdepotid != null">
        AnotherDepotId,
      </if>
      <if test="taxrate != null">
        TaxRate,
      </if>
      <if test="taxmoney != null">
        TaxMoney,
      </if>
      <if test="taxlastmoney != null">
        TaxLastMoney,
      </if>
      <if test="otherfield1 != null">
        OtherField1,
      </if>
      <if test="otherfield2 != null">
        OtherField2,
      </if>
      <if test="otherfield3 != null">
        OtherField3,
      </if>
      <if test="otherfield4 != null">
        OtherField4,
      </if>
      <if test="otherfield5 != null">
        OtherField5,
      </if>
      <if test="mtype != null">
        MType,
      </if>
      <if test="tenantId != null">
        tenant_id,
      </if>
      <if test="deleteFlag != null">
        delete_Flag,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="headerid != null">
        #{headerid,jdbcType=BIGINT},
      </if>
      <if test="materialid != null">
        #{materialid,jdbcType=BIGINT},
      </if>
      <if test="materialExtendId != null">
        #{materialExtendId,jdbcType=BIGINT},
      </if>
      <if test="munit != null">
        #{munit,jdbcType=VARCHAR},
      </if>
      <if test="opernumber != null">
        #{opernumber,jdbcType=DECIMAL},
      </if>
      <if test="basicnumber != null">
        #{basicnumber,jdbcType=DECIMAL},
      </if>
      <if test="unitprice != null">
        #{unitprice,jdbcType=DECIMAL},
      </if>
      <if test="taxunitprice != null">
        #{taxunitprice,jdbcType=DECIMAL},
      </if>
      <if test="allprice != null">
        #{allprice,jdbcType=DECIMAL},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="img != null">
        #{img,jdbcType=VARCHAR},
      </if>
      <if test="incidentals != null">
        #{incidentals,jdbcType=DECIMAL},
      </if>
      <if test="depotid != null">
        #{depotid,jdbcType=BIGINT},
      </if>
      <if test="anotherdepotid != null">
        #{anotherdepotid,jdbcType=BIGINT},
      </if>
      <if test="taxrate != null">
        #{taxrate,jdbcType=DECIMAL},
      </if>
      <if test="taxmoney != null">
        #{taxmoney,jdbcType=DECIMAL},
      </if>
      <if test="taxlastmoney != null">
        #{taxlastmoney,jdbcType=DECIMAL},
      </if>
      <if test="otherfield1 != null">
        #{otherfield1,jdbcType=VARCHAR},
      </if>
      <if test="otherfield2 != null">
        #{otherfield2,jdbcType=VARCHAR},
      </if>
      <if test="otherfield3 != null">
        #{otherfield3,jdbcType=VARCHAR},
      </if>
      <if test="otherfield4 != null">
        #{otherfield4,jdbcType=VARCHAR},
      </if>
      <if test="otherfield5 != null">
        #{otherfield5,jdbcType=VARCHAR},
      </if>
      <if test="mtype != null">
        #{mtype,jdbcType=VARCHAR},
      </if>
      <if test="tenantId != null">
        #{tenantId,jdbcType=BIGINT},
      </if>
      <if test="deleteFlag != null">
        #{deleteFlag,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultType="java.lang.Long">
    select count(*) from jsh_depotitem
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update jsh_depotitem
    <set>
      <if test="record.id != null">
        Id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.headerid != null">
        HeaderId = #{record.headerid,jdbcType=BIGINT},
      </if>
      <if test="record.materialid != null">
        MaterialId = #{record.materialid,jdbcType=BIGINT},
      </if>
      <if test="record.materialExtendId != null">
        material_extend_id = #{record.materialExtendId,jdbcType=BIGINT},
      </if>
      <if test="record.munit != null">
        MUnit = #{record.munit,jdbcType=VARCHAR},
      </if>
      <if test="record.opernumber != null">
        OperNumber = #{record.opernumber,jdbcType=DECIMAL},
      </if>
      <if test="record.basicnumber != null">
        BasicNumber = #{record.basicnumber,jdbcType=DECIMAL},
      </if>
      <if test="record.unitprice != null">
        UnitPrice = #{record.unitprice,jdbcType=DECIMAL},
      </if>
      <if test="record.taxunitprice != null">
        TaxUnitPrice = #{record.taxunitprice,jdbcType=DECIMAL},
      </if>
      <if test="record.allprice != null">
        AllPrice = #{record.allprice,jdbcType=DECIMAL},
      </if>
      <if test="record.remark != null">
        Remark = #{record.remark,jdbcType=VARCHAR},
      </if>
      <if test="record.img != null">
        Img = #{record.img,jdbcType=VARCHAR},
      </if>
      <if test="record.incidentals != null">
        Incidentals = #{record.incidentals,jdbcType=DECIMAL},
      </if>
      <if test="record.depotid != null">
        DepotId = #{record.depotid,jdbcType=BIGINT},
      </if>
      <if test="record.anotherdepotid != null">
        AnotherDepotId = #{record.anotherdepotid,jdbcType=BIGINT},
      </if>
      <if test="record.taxrate != null">
        TaxRate = #{record.taxrate,jdbcType=DECIMAL},
      </if>
      <if test="record.taxmoney != null">
        TaxMoney = #{record.taxmoney,jdbcType=DECIMAL},
      </if>
      <if test="record.taxlastmoney != null">
        TaxLastMoney = #{record.taxlastmoney,jdbcType=DECIMAL},
      </if>
      <if test="record.otherfield1 != null">
        OtherField1 = #{record.otherfield1,jdbcType=VARCHAR},
      </if>
      <if test="record.otherfield2 != null">
        OtherField2 = #{record.otherfield2,jdbcType=VARCHAR},
      </if>
      <if test="record.otherfield3 != null">
        OtherField3 = #{record.otherfield3,jdbcType=VARCHAR},
      </if>
      <if test="record.otherfield4 != null">
        OtherField4 = #{record.otherfield4,jdbcType=VARCHAR},
      </if>
      <if test="record.otherfield5 != null">
        OtherField5 = #{record.otherfield5,jdbcType=VARCHAR},
      </if>
      <if test="record.mtype != null">
        MType = #{record.mtype,jdbcType=VARCHAR},
      </if>
      <if test="record.tenantId != null">
        tenant_id = #{record.tenantId,jdbcType=BIGINT},
      </if>
      <if test="record.deleteFlag != null">
        delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update jsh_depotitem
    set Id = #{record.id,jdbcType=BIGINT},
      HeaderId = #{record.headerid,jdbcType=BIGINT},
      MaterialId = #{record.materialid,jdbcType=BIGINT},
      material_extend_id = #{record.materialExtendId,jdbcType=BIGINT},
      MUnit = #{record.munit,jdbcType=VARCHAR},
      OperNumber = #{record.opernumber,jdbcType=DECIMAL},
      BasicNumber = #{record.basicnumber,jdbcType=DECIMAL},
      UnitPrice = #{record.unitprice,jdbcType=DECIMAL},
      TaxUnitPrice = #{record.taxunitprice,jdbcType=DECIMAL},
      AllPrice = #{record.allprice,jdbcType=DECIMAL},
      Remark = #{record.remark,jdbcType=VARCHAR},
      Img = #{record.img,jdbcType=VARCHAR},
      Incidentals = #{record.incidentals,jdbcType=DECIMAL},
      DepotId = #{record.depotid,jdbcType=BIGINT},
      AnotherDepotId = #{record.anotherdepotid,jdbcType=BIGINT},
      TaxRate = #{record.taxrate,jdbcType=DECIMAL},
      TaxMoney = #{record.taxmoney,jdbcType=DECIMAL},
      TaxLastMoney = #{record.taxlastmoney,jdbcType=DECIMAL},
      OtherField1 = #{record.otherfield1,jdbcType=VARCHAR},
      OtherField2 = #{record.otherfield2,jdbcType=VARCHAR},
      OtherField3 = #{record.otherfield3,jdbcType=VARCHAR},
      OtherField4 = #{record.otherfield4,jdbcType=VARCHAR},
      OtherField5 = #{record.otherfield5,jdbcType=VARCHAR},
      MType = #{record.mtype,jdbcType=VARCHAR},
      tenant_id = #{record.tenantId,jdbcType=BIGINT},
      delete_Flag = #{record.deleteFlag,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.DepotItem">
    update jsh_depotitem
    <set>
      <if test="headerid != null">
        HeaderId = #{headerid,jdbcType=BIGINT},
      </if>
      <if test="materialid != null">
        MaterialId = #{materialid,jdbcType=BIGINT},
      </if>
      <if test="materialExtendId != null">
        material_extend_id = #{materialExtendId,jdbcType=BIGINT},
      </if>
      <if test="munit != null">
        MUnit = #{munit,jdbcType=VARCHAR},
      </if>
      <if test="opernumber != null">
        OperNumber = #{opernumber,jdbcType=DECIMAL},
      </if>
      <if test="basicnumber != null">
        BasicNumber = #{basicnumber,jdbcType=DECIMAL},
      </if>
      <if test="unitprice != null">
        UnitPrice = #{unitprice,jdbcType=DECIMAL},
      </if>
      <if test="taxunitprice != null">
        TaxUnitPrice = #{taxunitprice,jdbcType=DECIMAL},
      </if>
      <if test="allprice != null">
        AllPrice = #{allprice,jdbcType=DECIMAL},
      </if>
      <if test="remark != null">
        Remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="img != null">
        Img = #{img,jdbcType=VARCHAR},
      </if>
      <if test="incidentals != null">
        Incidentals = #{incidentals,jdbcType=DECIMAL},
      </if>
      <if test="depotid != null">
        DepotId = #{depotid,jdbcType=BIGINT},
      </if>
      <if test="anotherdepotid != null">
        AnotherDepotId = #{anotherdepotid,jdbcType=BIGINT},
      </if>
      <if test="taxrate != null">
        TaxRate = #{taxrate,jdbcType=DECIMAL},
      </if>
      <if test="taxmoney != null">
        TaxMoney = #{taxmoney,jdbcType=DECIMAL},
      </if>
      <if test="taxlastmoney != null">
        TaxLastMoney = #{taxlastmoney,jdbcType=DECIMAL},
      </if>
      <if test="otherfield1 != null">
        OtherField1 = #{otherfield1,jdbcType=VARCHAR},
      </if>
      <if test="otherfield2 != null">
        OtherField2 = #{otherfield2,jdbcType=VARCHAR},
      </if>
      <if test="otherfield3 != null">
        OtherField3 = #{otherfield3,jdbcType=VARCHAR},
      </if>
      <if test="otherfield4 != null">
        OtherField4 = #{otherfield4,jdbcType=VARCHAR},
      </if>
      <if test="otherfield5 != null">
        OtherField5 = #{otherfield5,jdbcType=VARCHAR},
      </if>
      <if test="mtype != null">
        MType = #{mtype,jdbcType=VARCHAR},
      </if>
      <if test="tenantId != null">
        tenant_id = #{tenantId,jdbcType=BIGINT},
      </if>
      <if test="deleteFlag != null">
        delete_Flag = #{deleteFlag,jdbcType=VARCHAR},
      </if>
    </set>
    where Id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.DepotItem">
    update jsh_depotitem
    set HeaderId = #{headerid,jdbcType=BIGINT},
      MaterialId = #{materialid,jdbcType=BIGINT},
      material_extend_id = #{materialExtendId,jdbcType=BIGINT},
      MUnit = #{munit,jdbcType=VARCHAR},
      OperNumber = #{opernumber,jdbcType=DECIMAL},
      BasicNumber = #{basicnumber,jdbcType=DECIMAL},
      UnitPrice = #{unitprice,jdbcType=DECIMAL},
      TaxUnitPrice = #{taxunitprice,jdbcType=DECIMAL},
      AllPrice = #{allprice,jdbcType=DECIMAL},
      Remark = #{remark,jdbcType=VARCHAR},
      Img = #{img,jdbcType=VARCHAR},
      Incidentals = #{incidentals,jdbcType=DECIMAL},
      DepotId = #{depotid,jdbcType=BIGINT},
      AnotherDepotId = #{anotherdepotid,jdbcType=BIGINT},
      TaxRate = #{taxrate,jdbcType=DECIMAL},
      TaxMoney = #{taxmoney,jdbcType=DECIMAL},
      TaxLastMoney = #{taxlastmoney,jdbcType=DECIMAL},
      OtherField1 = #{otherfield1,jdbcType=VARCHAR},
      OtherField2 = #{otherfield2,jdbcType=VARCHAR},
      OtherField3 = #{otherfield3,jdbcType=VARCHAR},
      OtherField4 = #{otherfield4,jdbcType=VARCHAR},
      OtherField5 = #{otherfield5,jdbcType=VARCHAR},
      MType = #{mtype,jdbcType=VARCHAR},
      tenant_id = #{tenantId,jdbcType=BIGINT},
      delete_Flag = #{deleteFlag,jdbcType=VARCHAR}
    where Id = #{id,jdbcType=BIGINT}
  </update>
</mapper>