<?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="cn.superdesk.uniorder.dao.mapper.unified.KfkCompanyMapper">
	<resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.unified.KfkCompany">
		<id column="id" property="id" jdbcType="BIGINT"/>
		<result column="company_id" property="companyId" jdbcType="BIGINT"/>
		<result column="code" property="code" jdbcType="VARCHAR"/>
		<result column="name" property="name" jdbcType="VARCHAR"/>
		<result column="short_name" property="shortName" jdbcType="VARCHAR"/>
		<result column="logo" property="logo" jdbcType="VARCHAR"/>
		<result column="leader_name" property="leaderName" jdbcType="VARCHAR"/>
		<result column="leader_phone" property="leaderPhone" jdbcType="VARCHAR"/>
		<result column="type" property="type" jdbcType="TINYINT"/>
		<result column="telephone" property="telephone" jdbcType="VARCHAR"/>
		<result column="belong_group" property="belongGroup" jdbcType="VARCHAR"/>
		<result column="address" property="address" jdbcType="VARCHAR"/>
		<result column="remark" property="remark" jdbcType="VARCHAR"/>
		<result column="created_by" property="createdBy" jdbcType="INTEGER"/>
		<result column="created_at" property="createdAt" jdbcType="TIMESTAMP"/>
		<result column="updated_by" property="updatedBy" jdbcType="INTEGER"/>
		<result column="updated_at" property="updatedAt" jdbcType="TIMESTAMP"/>
		<result column="enabled" property="enabled" jdbcType="TINYINT"/>
	</resultMap>
	<select id="findByCompanyId" resultMap="BaseResultMap" parameterType="java.lang.Long">
		select
		<include refid="Base_Column_List"/>
		from kfk_company
		where company_id = #{id,jdbcType=BIGINT}
	</select>

	<sql id="Base_Column_List">
    id, company_id, code, name, short_name, logo, leader_name, leader_phone, type, telephone, 
    belong_group, address, remark, created_by, created_at, updated_by, updated_at, enabled
  </sql>
	<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
		select
		<include refid="Base_Column_List"/>
		from kfk_company
		where id = #{id,jdbcType=BIGINT}
	</select>
	<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from kfk_company
    where id = #{id,jdbcType=BIGINT}
  </delete>
	<insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.unified.KfkCompany">
		<selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER">
			SELECT LAST_INSERT_ID()
		</selectKey>
		insert into kfk_company (company_id, code, name,
		short_name, logo, leader_name,
		leader_phone, type, telephone,
		belong_group, address, remark,
		created_by, created_at, updated_by,
		updated_at, enabled)
		values (#{companyId,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
		#{shortName,jdbcType=VARCHAR}, #{logo,jdbcType=VARCHAR}, #{leaderName,jdbcType=VARCHAR},
		#{leaderPhone,jdbcType=VARCHAR}, #{type,jdbcType=TINYINT}, #{telephone,jdbcType=VARCHAR},
		#{belongGroup,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
		#{createdBy,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=INTEGER},
		#{updatedAt,jdbcType=TIMESTAMP}, #{enabled,jdbcType=TINYINT})
	</insert>
	<insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.unified.KfkCompany">
		<selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER">
			SELECT LAST_INSERT_ID()
		</selectKey>
		insert into kfk_company
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="companyId != null">
				company_id,
			</if>
			<if test="code != null">
				code,
			</if>
			<if test="name != null">
				name,
			</if>
			<if test="shortName != null">
				short_name,
			</if>
			<if test="logo != null">
				logo,
			</if>
			<if test="leaderName != null">
				leader_name,
			</if>
			<if test="leaderPhone != null">
				leader_phone,
			</if>
			<if test="type != null">
				type,
			</if>
			<if test="telephone != null">
				telephone,
			</if>
			<if test="belongGroup != null">
				belong_group,
			</if>
			<if test="address != null">
				address,
			</if>
			<if test="remark != null">
				remark,
			</if>
			<if test="createdBy != null">
				created_by,
			</if>
			<if test="createdAt != null">
				created_at,
			</if>
			<if test="updatedBy != null">
				updated_by,
			</if>
			<if test="updatedAt != null">
				updated_at,
			</if>
			<if test="enabled != null">
				enabled,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="companyId != null">
				#{companyId,jdbcType=BIGINT},
			</if>
			<if test="code != null">
				#{code,jdbcType=VARCHAR},
			</if>
			<if test="name != null">
				#{name,jdbcType=VARCHAR},
			</if>
			<if test="shortName != null">
				#{shortName,jdbcType=VARCHAR},
			</if>
			<if test="logo != null">
				#{logo,jdbcType=VARCHAR},
			</if>
			<if test="leaderName != null">
				#{leaderName,jdbcType=VARCHAR},
			</if>
			<if test="leaderPhone != null">
				#{leaderPhone,jdbcType=VARCHAR},
			</if>
			<if test="type != null">
				#{type,jdbcType=TINYINT},
			</if>
			<if test="telephone != null">
				#{telephone,jdbcType=VARCHAR},
			</if>
			<if test="belongGroup != null">
				#{belongGroup,jdbcType=VARCHAR},
			</if>
			<if test="address != null">
				#{address,jdbcType=VARCHAR},
			</if>
			<if test="remark != null">
				#{remark,jdbcType=VARCHAR},
			</if>
			<if test="createdBy != null">
				#{createdBy,jdbcType=INTEGER},
			</if>
			<if test="createdAt != null">
				#{createdAt,jdbcType=TIMESTAMP},
			</if>
			<if test="updatedBy != null">
				#{updatedBy,jdbcType=INTEGER},
			</if>
			<if test="updatedAt != null">
				#{updatedAt,jdbcType=TIMESTAMP},
			</if>
			<if test="enabled != null">
				#{enabled,jdbcType=TINYINT},
			</if>
		</trim>
	</insert>
	<update id="updateByPrimaryKeySelective" parameterType="cn.superdesk.uniorder.dao.entity.unified.KfkCompany">
		update kfk_company
		<set>
			<if test="companyId != null">
				company_id = #{companyId,jdbcType=BIGINT},
			</if>
			<if test="code != null">
				code = #{code,jdbcType=VARCHAR},
			</if>
			<if test="name != null">
				name = #{name,jdbcType=VARCHAR},
			</if>
			<if test="shortName != null">
				short_name = #{shortName,jdbcType=VARCHAR},
			</if>
			<if test="logo != null">
				logo = #{logo,jdbcType=VARCHAR},
			</if>
			<if test="leaderName != null">
				leader_name = #{leaderName,jdbcType=VARCHAR},
			</if>
			<if test="leaderPhone != null">
				leader_phone = #{leaderPhone,jdbcType=VARCHAR},
			</if>
			<if test="type != null">
				type = #{type,jdbcType=TINYINT},
			</if>
			<if test="telephone != null">
				telephone = #{telephone,jdbcType=VARCHAR},
			</if>
			<if test="belongGroup != null">
				belong_group = #{belongGroup,jdbcType=VARCHAR},
			</if>
			<if test="address != null">
				address = #{address,jdbcType=VARCHAR},
			</if>
			<if test="remark != null">
				remark = #{remark,jdbcType=VARCHAR},
			</if>
			<if test="createdBy != null">
				created_by = #{createdBy,jdbcType=INTEGER},
			</if>
			<if test="createdAt != null">
				created_at = #{createdAt,jdbcType=TIMESTAMP},
			</if>
			<if test="updatedBy != null">
				updated_by = #{updatedBy,jdbcType=INTEGER},
			</if>
			<if test="updatedAt != null">
				updated_at = #{updatedAt,jdbcType=TIMESTAMP},
			</if>
			<if test="enabled != null">
				enabled = #{enabled,jdbcType=TINYINT},
			</if>
		</set>
		where id = #{id,jdbcType=BIGINT}
	</update>
	<update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.unified.KfkCompany">
    update kfk_company
    set company_id = #{companyId,jdbcType=BIGINT},
      code = #{code,jdbcType=VARCHAR},
      name = #{name,jdbcType=VARCHAR},
      short_name = #{shortName,jdbcType=VARCHAR},
      logo = #{logo,jdbcType=VARCHAR},
      leader_name = #{leaderName,jdbcType=VARCHAR},
      leader_phone = #{leaderPhone,jdbcType=VARCHAR},
      type = #{type,jdbcType=TINYINT},
      telephone = #{telephone,jdbcType=VARCHAR},
      belong_group = #{belongGroup,jdbcType=VARCHAR},
      address = #{address,jdbcType=VARCHAR},
      remark = #{remark,jdbcType=VARCHAR},
      created_by = #{createdBy,jdbcType=INTEGER},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      updated_by = #{updatedBy,jdbcType=INTEGER},
      updated_at = #{updatedAt,jdbcType=TIMESTAMP},
      enabled = #{enabled,jdbcType=TINYINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>