<?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.MaterialMapper">
  <resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.Material">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="Id" jdbcType="BIGINT" property="id" />
    <result column="CategoryId" jdbcType="BIGINT" property="categoryid" />
    <result column="Name" jdbcType="VARCHAR" property="name" />
    <result column="Mfrs" jdbcType="VARCHAR" property="mfrs" />
    <result column="Packing" jdbcType="DECIMAL" property="packing" />
    <result column="SafetyStock" jdbcType="DECIMAL" property="safetystock" />
    <result column="Model" jdbcType="VARCHAR" property="model" />
    <result column="Standard" jdbcType="VARCHAR" property="standard" />
    <result column="Color" jdbcType="VARCHAR" property="color" />
    <result column="Unit" jdbcType="VARCHAR" property="unit" />
    <result column="Remark" jdbcType="VARCHAR" property="remark" />
    <result column="RetailPrice" jdbcType="DECIMAL" property="retailprice" />
    <result column="LowPrice" jdbcType="DECIMAL" property="lowprice" />
    <result column="PresetPriceOne" jdbcType="DECIMAL" property="presetpriceone" />
    <result column="PresetPriceTwo" jdbcType="DECIMAL" property="presetpricetwo" />
    <result column="UnitId" jdbcType="BIGINT" property="unitid" />
    <result column="FirstOutUnit" jdbcType="VARCHAR" property="firstoutunit" />
    <result column="FirstInUnit" jdbcType="VARCHAR" property="firstinunit" />
    <result column="PriceStrategy" jdbcType="VARCHAR" property="pricestrategy" />
    <result column="Enabled" jdbcType="BIT" property="enabled" />
    <result column="OtherField1" jdbcType="VARCHAR" property="otherfield1" />
    <result column="OtherField2" jdbcType="VARCHAR" property="otherfield2" />
    <result column="OtherField3" jdbcType="VARCHAR" property="otherfield3" />
    <result column="enableSerialNumber" jdbcType="VARCHAR" property="enableserialnumber" />
    <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
    <result column="delete_Flag" jdbcType="VARCHAR" property="deleteFlag" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <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">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <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">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    Id, CategoryId, Name, Mfrs, Packing, SafetyStock, Model, Standard, Color, Unit, Remark, 
    RetailPrice, LowPrice, PresetPriceOne, PresetPriceTwo, UnitId, FirstOutUnit, FirstInUnit, 
    PriceStrategy, Enabled, OtherField1, OtherField2, OtherField3, enableSerialNumber, 
    tenant_id, delete_Flag
  </sql>
  <select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from jsh_material
    <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">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    from jsh_material
    where Id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from jsh_material
    where Id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.MaterialExample">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from jsh_material
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.jsh.erp.datasource.entities.Material">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into jsh_material (Id, CategoryId, Name, 
      Mfrs, Packing, SafetyStock, 
      Model, Standard, Color, 
      Unit, Remark, RetailPrice, 
      LowPrice, PresetPriceOne, PresetPriceTwo, 
      UnitId, FirstOutUnit, FirstInUnit, 
      PriceStrategy, Enabled, OtherField1, 
      OtherField2, OtherField3, enableSerialNumber, 
      tenant_id, delete_Flag)
    values (#{id,jdbcType=BIGINT}, #{categoryid,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, 
      #{mfrs,jdbcType=VARCHAR}, #{packing,jdbcType=DECIMAL}, #{safetystock,jdbcType=DECIMAL}, 
      #{model,jdbcType=VARCHAR}, #{standard,jdbcType=VARCHAR}, #{color,jdbcType=VARCHAR}, 
      #{unit,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{retailprice,jdbcType=DECIMAL}, 
      #{lowprice,jdbcType=DECIMAL}, #{presetpriceone,jdbcType=DECIMAL}, #{presetpricetwo,jdbcType=DECIMAL}, 
      #{unitid,jdbcType=BIGINT}, #{firstoutunit,jdbcType=VARCHAR}, #{firstinunit,jdbcType=VARCHAR}, 
      #{pricestrategy,jdbcType=VARCHAR}, #{enabled,jdbcType=BIT}, #{otherfield1,jdbcType=VARCHAR}, 
      #{otherfield2,jdbcType=VARCHAR}, #{otherfield3,jdbcType=VARCHAR}, #{enableserialnumber,jdbcType=VARCHAR}, 
      #{tenantId,jdbcType=BIGINT}, #{deleteFlag,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Material">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into jsh_material
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        Id,
      </if>
      <if test="categoryid != null">
        CategoryId,
      </if>
      <if test="name != null">
        Name,
      </if>
      <if test="mfrs != null">
        Mfrs,
      </if>
      <if test="packing != null">
        Packing,
      </if>
      <if test="safetystock != null">
        SafetyStock,
      </if>
      <if test="model != null">
        Model,
      </if>
      <if test="standard != null">
        Standard,
      </if>
      <if test="color != null">
        Color,
      </if>
      <if test="unit != null">
        Unit,
      </if>
      <if test="remark != null">
        Remark,
      </if>
      <if test="retailprice != null">
        RetailPrice,
      </if>
      <if test="lowprice != null">
        LowPrice,
      </if>
      <if test="presetpriceone != null">
        PresetPriceOne,
      </if>
      <if test="presetpricetwo != null">
        PresetPriceTwo,
      </if>
      <if test="unitid != null">
        UnitId,
      </if>
      <if test="firstoutunit != null">
        FirstOutUnit,
      </if>
      <if test="firstinunit != null">
        FirstInUnit,
      </if>
      <if test="pricestrategy != null">
        PriceStrategy,
      </if>
      <if test="enabled != null">
        Enabled,
      </if>
      <if test="otherfield1 != null">
        OtherField1,
      </if>
      <if test="otherfield2 != null">
        OtherField2,
      </if>
      <if test="otherfield3 != null">
        OtherField3,
      </if>
      <if test="enableserialnumber != null">
        enableSerialNumber,
      </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="categoryid != null">
        #{categoryid,jdbcType=BIGINT},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="mfrs != null">
        #{mfrs,jdbcType=VARCHAR},
      </if>
      <if test="packing != null">
        #{packing,jdbcType=DECIMAL},
      </if>
      <if test="safetystock != null">
        #{safetystock,jdbcType=DECIMAL},
      </if>
      <if test="model != null">
        #{model,jdbcType=VARCHAR},
      </if>
      <if test="standard != null">
        #{standard,jdbcType=VARCHAR},
      </if>
      <if test="color != null">
        #{color,jdbcType=VARCHAR},
      </if>
      <if test="unit != null">
        #{unit,jdbcType=VARCHAR},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="retailprice != null">
        #{retailprice,jdbcType=DECIMAL},
      </if>
      <if test="lowprice != null">
        #{lowprice,jdbcType=DECIMAL},
      </if>
      <if test="presetpriceone != null">
        #{presetpriceone,jdbcType=DECIMAL},
      </if>
      <if test="presetpricetwo != null">
        #{presetpricetwo,jdbcType=DECIMAL},
      </if>
      <if test="unitid != null">
        #{unitid,jdbcType=BIGINT},
      </if>
      <if test="firstoutunit != null">
        #{firstoutunit,jdbcType=VARCHAR},
      </if>
      <if test="firstinunit != null">
        #{firstinunit,jdbcType=VARCHAR},
      </if>
      <if test="pricestrategy != null">
        #{pricestrategy,jdbcType=VARCHAR},
      </if>
      <if test="enabled != null">
        #{enabled,jdbcType=BIT},
      </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="enableserialnumber != null">
        #{enableserialnumber,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.MaterialExample" resultType="java.lang.Integer">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select count(*) from jsh_material
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update jsh_material
    <set>
      <if test="record.id != null">
        Id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.categoryid != null">
        CategoryId = #{record.categoryid,jdbcType=BIGINT},
      </if>
      <if test="record.name != null">
        Name = #{record.name,jdbcType=VARCHAR},
      </if>
      <if test="record.mfrs != null">
        Mfrs = #{record.mfrs,jdbcType=VARCHAR},
      </if>
      <if test="record.packing != null">
        Packing = #{record.packing,jdbcType=DECIMAL},
      </if>
      <if test="record.safetystock != null">
        SafetyStock = #{record.safetystock,jdbcType=DECIMAL},
      </if>
      <if test="record.model != null">
        Model = #{record.model,jdbcType=VARCHAR},
      </if>
      <if test="record.standard != null">
        Standard = #{record.standard,jdbcType=VARCHAR},
      </if>
      <if test="record.color != null">
        Color = #{record.color,jdbcType=VARCHAR},
      </if>
      <if test="record.unit != null">
        Unit = #{record.unit,jdbcType=VARCHAR},
      </if>
      <if test="record.remark != null">
        Remark = #{record.remark,jdbcType=VARCHAR},
      </if>
      <if test="record.retailprice != null">
        RetailPrice = #{record.retailprice,jdbcType=DECIMAL},
      </if>
      <if test="record.lowprice != null">
        LowPrice = #{record.lowprice,jdbcType=DECIMAL},
      </if>
      <if test="record.presetpriceone != null">
        PresetPriceOne = #{record.presetpriceone,jdbcType=DECIMAL},
      </if>
      <if test="record.presetpricetwo != null">
        PresetPriceTwo = #{record.presetpricetwo,jdbcType=DECIMAL},
      </if>
      <if test="record.unitid != null">
        UnitId = #{record.unitid,jdbcType=BIGINT},
      </if>
      <if test="record.firstoutunit != null">
        FirstOutUnit = #{record.firstoutunit,jdbcType=VARCHAR},
      </if>
      <if test="record.firstinunit != null">
        FirstInUnit = #{record.firstinunit,jdbcType=VARCHAR},
      </if>
      <if test="record.pricestrategy != null">
        PriceStrategy = #{record.pricestrategy,jdbcType=VARCHAR},
      </if>
      <if test="record.enabled != null">
        Enabled = #{record.enabled,jdbcType=BIT},
      </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.enableserialnumber != null">
        enableSerialNumber = #{record.enableserialnumber,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">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update jsh_material
    set Id = #{record.id,jdbcType=BIGINT},
      CategoryId = #{record.categoryid,jdbcType=BIGINT},
      Name = #{record.name,jdbcType=VARCHAR},
      Mfrs = #{record.mfrs,jdbcType=VARCHAR},
      Packing = #{record.packing,jdbcType=DECIMAL},
      SafetyStock = #{record.safetystock,jdbcType=DECIMAL},
      Model = #{record.model,jdbcType=VARCHAR},
      Standard = #{record.standard,jdbcType=VARCHAR},
      Color = #{record.color,jdbcType=VARCHAR},
      Unit = #{record.unit,jdbcType=VARCHAR},
      Remark = #{record.remark,jdbcType=VARCHAR},
      RetailPrice = #{record.retailprice,jdbcType=DECIMAL},
      LowPrice = #{record.lowprice,jdbcType=DECIMAL},
      PresetPriceOne = #{record.presetpriceone,jdbcType=DECIMAL},
      PresetPriceTwo = #{record.presetpricetwo,jdbcType=DECIMAL},
      UnitId = #{record.unitid,jdbcType=BIGINT},
      FirstOutUnit = #{record.firstoutunit,jdbcType=VARCHAR},
      FirstInUnit = #{record.firstinunit,jdbcType=VARCHAR},
      PriceStrategy = #{record.pricestrategy,jdbcType=VARCHAR},
      Enabled = #{record.enabled,jdbcType=BIT},
      OtherField1 = #{record.otherfield1,jdbcType=VARCHAR},
      OtherField2 = #{record.otherfield2,jdbcType=VARCHAR},
      OtherField3 = #{record.otherfield3,jdbcType=VARCHAR},
      enableSerialNumber = #{record.enableserialnumber,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.Material">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update jsh_material
    <set>
      <if test="categoryid != null">
        CategoryId = #{categoryid,jdbcType=BIGINT},
      </if>
      <if test="name != null">
        Name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="mfrs != null">
        Mfrs = #{mfrs,jdbcType=VARCHAR},
      </if>
      <if test="packing != null">
        Packing = #{packing,jdbcType=DECIMAL},
      </if>
      <if test="safetystock != null">
        SafetyStock = #{safetystock,jdbcType=DECIMAL},
      </if>
      <if test="model != null">
        Model = #{model,jdbcType=VARCHAR},
      </if>
      <if test="standard != null">
        Standard = #{standard,jdbcType=VARCHAR},
      </if>
      <if test="color != null">
        Color = #{color,jdbcType=VARCHAR},
      </if>
      <if test="unit != null">
        Unit = #{unit,jdbcType=VARCHAR},
      </if>
      <if test="remark != null">
        Remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="retailprice != null">
        RetailPrice = #{retailprice,jdbcType=DECIMAL},
      </if>
      <if test="lowprice != null">
        LowPrice = #{lowprice,jdbcType=DECIMAL},
      </if>
      <if test="presetpriceone != null">
        PresetPriceOne = #{presetpriceone,jdbcType=DECIMAL},
      </if>
      <if test="presetpricetwo != null">
        PresetPriceTwo = #{presetpricetwo,jdbcType=DECIMAL},
      </if>
      <if test="unitid != null">
        UnitId = #{unitid,jdbcType=BIGINT},
      </if>
      <if test="firstoutunit != null">
        FirstOutUnit = #{firstoutunit,jdbcType=VARCHAR},
      </if>
      <if test="firstinunit != null">
        FirstInUnit = #{firstinunit,jdbcType=VARCHAR},
      </if>
      <if test="pricestrategy != null">
        PriceStrategy = #{pricestrategy,jdbcType=VARCHAR},
      </if>
      <if test="enabled != null">
        Enabled = #{enabled,jdbcType=BIT},
      </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="enableserialnumber != null">
        enableSerialNumber = #{enableserialnumber,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.Material">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update jsh_material
    set CategoryId = #{categoryid,jdbcType=BIGINT},
      Name = #{name,jdbcType=VARCHAR},
      Mfrs = #{mfrs,jdbcType=VARCHAR},
      Packing = #{packing,jdbcType=DECIMAL},
      SafetyStock = #{safetystock,jdbcType=DECIMAL},
      Model = #{model,jdbcType=VARCHAR},
      Standard = #{standard,jdbcType=VARCHAR},
      Color = #{color,jdbcType=VARCHAR},
      Unit = #{unit,jdbcType=VARCHAR},
      Remark = #{remark,jdbcType=VARCHAR},
      RetailPrice = #{retailprice,jdbcType=DECIMAL},
      LowPrice = #{lowprice,jdbcType=DECIMAL},
      PresetPriceOne = #{presetpriceone,jdbcType=DECIMAL},
      PresetPriceTwo = #{presetpricetwo,jdbcType=DECIMAL},
      UnitId = #{unitid,jdbcType=BIGINT},
      FirstOutUnit = #{firstoutunit,jdbcType=VARCHAR},
      FirstInUnit = #{firstinunit,jdbcType=VARCHAR},
      PriceStrategy = #{pricestrategy,jdbcType=VARCHAR},
      Enabled = #{enabled,jdbcType=BIT},
      OtherField1 = #{otherfield1,jdbcType=VARCHAR},
      OtherField2 = #{otherfield2,jdbcType=VARCHAR},
      OtherField3 = #{otherfield3,jdbcType=VARCHAR},
      enableSerialNumber = #{enableserialnumber,jdbcType=VARCHAR},
      tenant_id = #{tenantId,jdbcType=BIGINT},
      delete_Flag = #{deleteFlag,jdbcType=VARCHAR}
    where Id = #{id,jdbcType=BIGINT}
  </update>
</mapper>