<?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.AccountMapper">
  <resultMap id="BaseResultMap" type="com.jsh.erp.datasource.entities.Account">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="Id" jdbcType="BIGINT" property="id" />
    <result column="Name" jdbcType="VARCHAR" property="name" />
    <result column="SerialNo" jdbcType="VARCHAR" property="serialno" />
    <result column="InitialAmount" jdbcType="DECIMAL" property="initialamount" />
    <result column="CurrentAmount" jdbcType="DECIMAL" property="currentamount" />
    <result column="Remark" jdbcType="VARCHAR" property="remark" />
    <result column="IsDefault" jdbcType="BIT" property="isdefault" />
  </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, Name, SerialNo, InitialAmount, CurrentAmount, Remark, IsDefault
  </sql>
  <select id="selectByExample" parameterType="com.jsh.erp.datasource.entities.AccountExample" 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_account
    <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_account
    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_account
    where Id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.jsh.erp.datasource.entities.AccountExample">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from jsh_account
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.jsh.erp.datasource.entities.Account">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into jsh_account (Id, Name, SerialNo, 
      InitialAmount, CurrentAmount, Remark, 
      IsDefault)
    values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{serialno,jdbcType=VARCHAR}, 
      #{initialamount,jdbcType=DECIMAL}, #{currentamount,jdbcType=DECIMAL}, #{remark,jdbcType=VARCHAR}, 
      #{isdefault,jdbcType=BIT})
  </insert>
  <insert id="insertSelective" parameterType="com.jsh.erp.datasource.entities.Account">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into jsh_account
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        Id,
      </if>
      <if test="name != null">
        Name,
      </if>
      <if test="serialno != null">
        SerialNo,
      </if>
      <if test="initialamount != null">
        InitialAmount,
      </if>
      <if test="currentamount != null">
        CurrentAmount,
      </if>
      <if test="remark != null">
        Remark,
      </if>
      <if test="isdefault != null">
        IsDefault,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="serialno != null">
        #{serialno,jdbcType=VARCHAR},
      </if>
      <if test="initialamount != null">
        #{initialamount,jdbcType=DECIMAL},
      </if>
      <if test="currentamount != null">
        #{currentamount,jdbcType=DECIMAL},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="isdefault != null">
        #{isdefault,jdbcType=BIT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.jsh.erp.datasource.entities.AccountExample" resultType="java.lang.Integer">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select count(*) from jsh_account
    <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_account
    <set>
      <if test="record.id != null">
        Id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.name != null">
        Name = #{record.name,jdbcType=VARCHAR},
      </if>
      <if test="record.serialno != null">
        SerialNo = #{record.serialno,jdbcType=VARCHAR},
      </if>
      <if test="record.initialamount != null">
        InitialAmount = #{record.initialamount,jdbcType=DECIMAL},
      </if>
      <if test="record.currentamount != null">
        CurrentAmount = #{record.currentamount,jdbcType=DECIMAL},
      </if>
      <if test="record.remark != null">
        Remark = #{record.remark,jdbcType=VARCHAR},
      </if>
      <if test="record.isdefault != null">
        IsDefault = #{record.isdefault,jdbcType=BIT},
      </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_account
    set Id = #{record.id,jdbcType=BIGINT},
      Name = #{record.name,jdbcType=VARCHAR},
      SerialNo = #{record.serialno,jdbcType=VARCHAR},
      InitialAmount = #{record.initialamount,jdbcType=DECIMAL},
      CurrentAmount = #{record.currentamount,jdbcType=DECIMAL},
      Remark = #{record.remark,jdbcType=VARCHAR},
      IsDefault = #{record.isdefault,jdbcType=BIT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.jsh.erp.datasource.entities.Account">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update jsh_account
    <set>
      <if test="name != null">
        Name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="serialno != null">
        SerialNo = #{serialno,jdbcType=VARCHAR},
      </if>
      <if test="initialamount != null">
        InitialAmount = #{initialamount,jdbcType=DECIMAL},
      </if>
      <if test="currentamount != null">
        CurrentAmount = #{currentamount,jdbcType=DECIMAL},
      </if>
      <if test="remark != null">
        Remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="isdefault != null">
        IsDefault = #{isdefault,jdbcType=BIT},
      </if>
    </set>
    where Id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.jsh.erp.datasource.entities.Account">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update jsh_account
    set Name = #{name,jdbcType=VARCHAR},
      SerialNo = #{serialno,jdbcType=VARCHAR},
      InitialAmount = #{initialamount,jdbcType=DECIMAL},
      CurrentAmount = #{currentamount,jdbcType=DECIMAL},
      Remark = #{remark,jdbcType=VARCHAR},
      IsDefault = #{isdefault,jdbcType=BIT}
    where Id = #{id,jdbcType=BIGINT}
  </update>
</mapper>