<?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="DOUBLE" property="packing" />
    <result column="SafetyStock" jdbcType="DOUBLE" 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="DOUBLE" property="retailprice" />
    <result column="LowPrice" jdbcType="DOUBLE" property="lowprice" />
    <result column="PresetPriceOne" jdbcType="DOUBLE" property="presetpriceone" />
    <result column="PresetPriceTwo" jdbcType="DOUBLE" 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" />
  </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
  </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)
    values (#{id,jdbcType=BIGINT}, #{categoryid,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, 
      #{mfrs,jdbcType=VARCHAR}, #{packing,jdbcType=DOUBLE}, #{safetystock,jdbcType=DOUBLE}, 
      #{model,jdbcType=VARCHAR}, #{standard,jdbcType=VARCHAR}, #{color,jdbcType=VARCHAR}, 
      #{unit,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{retailprice,jdbcType=DOUBLE}, 
      #{lowprice,jdbcType=DOUBLE}, #{presetpriceone,jdbcType=DOUBLE}, #{presetpricetwo,jdbcType=DOUBLE}, 
      #{unitid,jdbcType=BIGINT}, #{firstoutunit,jdbcType=VARCHAR}, #{firstinunit,jdbcType=VARCHAR}, 
      #{pricestrategy,jdbcType=VARCHAR}, #{enabled,jdbcType=BIT}, #{otherfield1,jdbcType=VARCHAR}, 
      #{otherfield2,jdbcType=VARCHAR}, #{otherfield3,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>
    </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=DOUBLE},
      </if>
      <if test="safetystock != null">
        #{safetystock,jdbcType=DOUBLE},
      </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=DOUBLE},
      </if>
      <if test="lowprice != null">
        #{lowprice,jdbcType=DOUBLE},
      </if>
      <if test="presetpriceone != null">
        #{presetpriceone,jdbcType=DOUBLE},
      </if>
      <if test="presetpricetwo != null">
        #{presetpricetwo,jdbcType=DOUBLE},
      </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>
    </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=DOUBLE},
      </if>
      <if test="record.safetystock != null">
        SafetyStock = #{record.safetystock,jdbcType=DOUBLE},
      </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=DOUBLE},
      </if>
      <if test="record.lowprice != null">
        LowPrice = #{record.lowprice,jdbcType=DOUBLE},
      </if>
      <if test="record.presetpriceone != null">
        PresetPriceOne = #{record.presetpriceone,jdbcType=DOUBLE},
      </if>
      <if test="record.presetpricetwo != null">
        PresetPriceTwo = #{record.presetpricetwo,jdbcType=DOUBLE},
      </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>
    </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=DOUBLE},
      SafetyStock = #{record.safetystock,jdbcType=DOUBLE},
      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=DOUBLE},
      LowPrice = #{record.lowprice,jdbcType=DOUBLE},
      PresetPriceOne = #{record.presetpriceone,jdbcType=DOUBLE},
      PresetPriceTwo = #{record.presetpricetwo,jdbcType=DOUBLE},
      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}
    <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=DOUBLE},
      </if>
      <if test="safetystock != null">
        SafetyStock = #{safetystock,jdbcType=DOUBLE},
      </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=DOUBLE},
      </if>
      <if test="lowprice != null">
        LowPrice = #{lowprice,jdbcType=DOUBLE},
      </if>
      <if test="presetpriceone != null">
        PresetPriceOne = #{presetpriceone,jdbcType=DOUBLE},
      </if>
      <if test="presetpricetwo != null">
        PresetPriceTwo = #{presetpricetwo,jdbcType=DOUBLE},
      </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>
    </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=DOUBLE},
      SafetyStock = #{safetystock,jdbcType=DOUBLE},
      Model = #{model,jdbcType=VARCHAR},
      Standard = #{standard,jdbcType=VARCHAR},
      Color = #{color,jdbcType=VARCHAR},
      Unit = #{unit,jdbcType=VARCHAR},
      Remark = #{remark,jdbcType=VARCHAR},
      RetailPrice = #{retailprice,jdbcType=DOUBLE},
      LowPrice = #{lowprice,jdbcType=DOUBLE},
      PresetPriceOne = #{presetpriceone,jdbcType=DOUBLE},
      PresetPriceTwo = #{presetpricetwo,jdbcType=DOUBLE},
      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}
    where Id = #{id,jdbcType=BIGINT}
  </update>
</mapper>