<?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.usoft.credit.dal.mapper.EnterpriseJsonMapper">
  <resultMap id="BaseResultMap" type="com.usoft.credit.dal.entity.EnterpriseJson">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="code" jdbcType="VARCHAR" property="code" />
    <result column="enname" jdbcType="VARCHAR" property="enname" />
    <result column="registerno" jdbcType="VARCHAR" property="registerno" />
    <result column="creditcode" jdbcType="VARCHAR" property="creditcode" />
    <result column="create_date" jdbcType="DATE" property="createDate" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.usoft.credit.dal.entity.EnterpriseJsonWithBLOBs">
    <result column="encredit" jdbcType="LONGVARCHAR" property="encredit" />
    <result column="endept" jdbcType="LONGVARCHAR" property="endept" />
    <result column="enexception" jdbcType="LONGVARCHAR" property="enexception" />
    <result column="enrisk" jdbcType="LONGVARCHAR" property="enrisk" />
  </resultMap>
  <sql id="Base_Column_List">
    id, code, enname, registerno, creditcode, create_date
  </sql>
  <sql id="Blob_Column_List">
    encredit, endept, enexception, enrisk
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from t_enterprise_json
    where id = #{id,jdbcType=INTEGER}
  </select>

  <select id="findByCreateTime" resultMap="ResultMapWithBLOBs">
    select
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from t_enterprise_json
    where create_date = #{date} AND enname = #{enname}
    AND registerno = #{registerno} AND creditcode = #{creditcode}
  </select>

  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_enterprise_json
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.usoft.credit.dal.entity.EnterpriseJsonWithBLOBs">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into t_enterprise_json (code, enname, registerno, 
      creditcode, create_date, encredit, 
      endept, enexception, enrisk
      )
    values (#{code,jdbcType=VARCHAR}, #{enname,jdbcType=VARCHAR}, #{registerno,jdbcType=VARCHAR}, 
      #{creditcode,jdbcType=VARCHAR}, #{createDate,jdbcType=DATE}, #{encredit,jdbcType=LONGVARCHAR}, 
      #{endept,jdbcType=LONGVARCHAR}, #{enexception,jdbcType=LONGVARCHAR}, #{enrisk,jdbcType=LONGVARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.usoft.credit.dal.entity.EnterpriseJsonWithBLOBs">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into t_enterprise_json
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="code != null">
        code,
      </if>
      <if test="enname != null">
        enname,
      </if>
      <if test="registerno != null">
        registerno,
      </if>
      <if test="creditcode != null">
        creditcode,
      </if>
      <if test="createDate != null">
        create_date,
      </if>
      <if test="encredit != null">
        encredit,
      </if>
      <if test="endept != null">
        endept,
      </if>
      <if test="enexception != null">
        enexception,
      </if>
      <if test="enrisk != null">
        enrisk,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="code != null">
        #{code,jdbcType=VARCHAR},
      </if>
      <if test="enname != null">
        #{enname,jdbcType=VARCHAR},
      </if>
      <if test="registerno != null">
        #{registerno,jdbcType=VARCHAR},
      </if>
      <if test="creditcode != null">
        #{creditcode,jdbcType=VARCHAR},
      </if>
      <if test="createDate != null">
        #{createDate,jdbcType=DATE},
      </if>
      <if test="encredit != null">
        #{encredit,jdbcType=LONGVARCHAR},
      </if>
      <if test="endept != null">
        #{endept,jdbcType=LONGVARCHAR},
      </if>
      <if test="enexception != null">
        #{enexception,jdbcType=LONGVARCHAR},
      </if>
      <if test="enrisk != null">
        #{enrisk,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.usoft.credit.dal.entity.EnterpriseJsonWithBLOBs">
    update t_enterprise_json
    <set>
      <if test="code != null">
        code = #{code,jdbcType=VARCHAR},
      </if>
      <if test="enname != null">
        enname = #{enname,jdbcType=VARCHAR},
      </if>
      <if test="registerno != null">
        registerno = #{registerno,jdbcType=VARCHAR},
      </if>
      <if test="creditcode != null">
        creditcode = #{creditcode,jdbcType=VARCHAR},
      </if>
      <if test="createDate != null">
        create_date = #{createDate,jdbcType=DATE},
      </if>
      <if test="encredit != null">
        encredit = #{encredit,jdbcType=LONGVARCHAR},
      </if>
      <if test="endept != null">
        endept = #{endept,jdbcType=LONGVARCHAR},
      </if>
      <if test="enexception != null">
        enexception = #{enexception,jdbcType=LONGVARCHAR},
      </if>
      <if test="enrisk != null">
        enrisk = #{enrisk,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.usoft.credit.dal.entity.EnterpriseJsonWithBLOBs">
    update t_enterprise_json
    set code = #{code,jdbcType=VARCHAR},
      enname = #{enname,jdbcType=VARCHAR},
      registerno = #{registerno,jdbcType=VARCHAR},
      creditcode = #{creditcode,jdbcType=VARCHAR},
      create_date = #{createDate,jdbcType=DATE},
      encredit = #{encredit,jdbcType=LONGVARCHAR},
      endept = #{endept,jdbcType=LONGVARCHAR},
      enexception = #{enexception,jdbcType=LONGVARCHAR},
      enrisk = #{enrisk,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.usoft.credit.dal.entity.EnterpriseJson">
    update t_enterprise_json
    set code = #{code,jdbcType=VARCHAR},
      enname = #{enname,jdbcType=VARCHAR},
      registerno = #{registerno,jdbcType=VARCHAR},
      creditcode = #{creditcode,jdbcType=VARCHAR},
      create_date = #{createDate,jdbcType=DATE}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>