<?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.organisation.SysCompanyMapper">
	<resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.organisation.SysCompany">
		<id column="id" property="id" jdbcType="BIGINT"/>
		<result column="company_name" property="companyName" jdbcType="VARCHAR"/>
		<result column="tel" property="tel" jdbcType="VARCHAR"/>
		<result column="address" property="address" jdbcType="VARCHAR"/>
		<result column="bank_title" property="bankTitle" jdbcType="VARCHAR"/>
		<result column="bank_no" property="bankNo" jdbcType="VARCHAR"/>
		<result column="bank_name" property="bankName" jdbcType="VARCHAR"/>
	</resultMap>
	<sql id="Base_Column_List">
    id, company_name, tel, address, bank_title, bank_no, bank_name
  </sql>
	<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
		select
		<include refid="Base_Column_List"/>
		from sys_company
		where id = #{id,jdbcType=BIGINT}
	</select>
	<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from sys_company
    where id = #{id,jdbcType=BIGINT}
  </delete>
	<insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.organisation.SysCompany">
		<selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER">
			SELECT LAST_INSERT_ID()
		</selectKey>
		insert into sys_company (company_name, tel, address,
		bank_title, bank_no, bank_name
		)
		values (#{companyName,jdbcType=VARCHAR}, #{tel,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
		#{bankTitle,jdbcType=VARCHAR}, #{bankNo,jdbcType=VARCHAR}, #{bankName,jdbcType=VARCHAR}
		)
	</insert>
	<insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.organisation.SysCompany">
		<selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER">
			SELECT LAST_INSERT_ID()
		</selectKey>
		insert into sys_company
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="companyName != null">
				company_name,
			</if>
			<if test="tel != null">
				tel,
			</if>
			<if test="address != null">
				address,
			</if>
			<if test="bankTitle != null">
				bank_title,
			</if>
			<if test="bankNo != null">
				bank_no,
			</if>
			<if test="bankName != null">
				bank_name,
			</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="companyName != null">
				#{companyName,jdbcType=VARCHAR},
			</if>
			<if test="tel != null">
				#{tel,jdbcType=VARCHAR},
			</if>
			<if test="address != null">
				#{address,jdbcType=VARCHAR},
			</if>
			<if test="bankTitle != null">
				#{bankTitle,jdbcType=VARCHAR},
			</if>
			<if test="bankNo != null">
				#{bankNo,jdbcType=VARCHAR},
			</if>
			<if test="bankName != null">
				#{bankName,jdbcType=VARCHAR},
			</if>
		</trim>
	</insert>
	<update id="updateByPrimaryKeySelective" parameterType="cn.superdesk.uniorder.dao.entity.organisation.SysCompany">
		update sys_company
		<set>
			<if test="companyName != null">
				company_name = #{companyName,jdbcType=VARCHAR},
			</if>
			<if test="tel != null">
				tel = #{tel,jdbcType=VARCHAR},
			</if>
			<if test="address != null">
				address = #{address,jdbcType=VARCHAR},
			</if>
			<if test="bankTitle != null">
				bank_title = #{bankTitle,jdbcType=VARCHAR},
			</if>
			<if test="bankNo != null">
				bank_no = #{bankNo,jdbcType=VARCHAR},
			</if>
			<if test="bankName != null">
				bank_name = #{bankName,jdbcType=VARCHAR},
			</if>
		</set>
		where id = #{id,jdbcType=BIGINT}
	</update>
	<update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.organisation.SysCompany">
    update sys_company
    set company_name = #{companyName,jdbcType=VARCHAR},
      tel = #{tel,jdbcType=VARCHAR},
      address = #{address,jdbcType=VARCHAR},
      bank_title = #{bankTitle,jdbcType=VARCHAR},
      bank_no = #{bankNo,jdbcType=VARCHAR},
      bank_name = #{bankName,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>