<?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.cool.store.mapper.BanktypeMapper">
  <resultMap id="BaseResultMap" type="com.cool.store.entity.BanktypeDO">
    <id column="pk_banktype" jdbcType="CHAR" property="pkBanktype" />
    <result column="code" jdbcType="VARCHAR" property="code" />
    <result column="combinecode" jdbcType="VARCHAR" property="combinecode" />
    <result column="name" jdbcType="VARCHAR" property="name" />
  </resultMap>
  <sql id="Base_Column_List">
    pk_banktype, code, combinecode, name
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from xfsg_banktype
    where pk_banktype = #{pkBanktype,jdbcType=CHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from xfsg_banktype
    where pk_banktype = #{pkBanktype,jdbcType=CHAR}
  </delete>
  <insert id="insertSelective" parameterType="com.cool.store.entity.BanktypeDO">
    insert into xfsg_banktype
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="pkBanktype != null">
        pk_banktype,
      </if>
      <if test="code != null">
        code,
      </if>
      <if test="combinecode != null">
        combinecode,
      </if>
      <if test="name != null">
        name,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="pkBanktype != null">
        #{pkBanktype,jdbcType=CHAR},
      </if>
      <if test="code != null">
        #{code,jdbcType=VARCHAR},
      </if>
      <if test="combinecode != null">
        #{combinecode,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.cool.store.entity.BanktypeDO">
    update xfsg_banktype
    <set>
      <if test="code != null">
        code = #{code,jdbcType=VARCHAR},
      </if>
      <if test="combinecode != null">
        combinecode = #{combinecode,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        name = #{name,jdbcType=VARCHAR},
      </if>
    </set>
    where pk_banktype = #{pkBanktype,jdbcType=CHAR}
  </update>
  <sql id="dynamicQuery">
    <trim prefix="WHERE" prefixOverrides="AND | OR">
      <if test="null != pkBanktype">
         and t.pk_banktype = #{pkBanktype,jdbcType=CHAR}
      </if>
      <if test="null != code">
         and t.code = #{code,jdbcType=VARCHAR}
      </if>
      <if test="null != combinecode">
         and t.combinecode = #{combinecode,jdbcType=VARCHAR}
      </if>
      <if test="null != name">
         and t.name = #{name,jdbcType=VARCHAR}
      </if>
    </trim>
  </sql>

  <select id="listBank" resultMap="BaseResultMap">
    select * from xfsg_banktype
    where 1=1 and code is not null and name is not null
    order by name
  </select>

</mapper>