package com.hfkj.dao;

import com.hfkj.entity.BsOrganization;
import com.hfkj.entity.BsOrganizationExample;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 
 * 代码由工具生成,请勿修改!!!
 * 如果需要扩展请在其父类进行扩展
 * 
 **/
@Repository
public interface BsOrganizationMapper extends BsOrganizationMapperExt {
    @SelectProvider(type= BsOrganizationSqlProvider.class, method="countByExample")
    long countByExample(BsOrganizationExample example);

    @DeleteProvider(type= BsOrganizationSqlProvider.class, method="deleteByExample")
    int deleteByExample(BsOrganizationExample example);

    @Delete({
        "delete from bs_organization",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into bs_organization (region_id, region_abbreviate, ",
        "parent_id, `name`, company_id, ",
        "manager_id, manager_name, ",
        "manager_phone, address, ",
        "phone, remark, email, ",
        "site_url, logo, `status`, ",
        "create_time, update_time, ",
        "op_id, rectify_no, ",
        "ext_1, ext_2, ext_3)",
        "values (#{regionId,jdbcType=VARCHAR}, #{regionAbbreviate,jdbcType=VARCHAR}, ",
        "#{parentId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{companyId,jdbcType=BIGINT}, ",
        "#{managerId,jdbcType=BIGINT}, #{managerName,jdbcType=VARCHAR}, ",
        "#{managerPhone,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, ",
        "#{phone,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, ",
        "#{siteUrl,jdbcType=VARCHAR}, #{logo,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ",
        "#{opId,jdbcType=BIGINT}, #{rectifyNo,jdbcType=VARCHAR}, ",
        "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(BsOrganization record);

    @InsertProvider(type= BsOrganizationSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insertSelective(BsOrganization record);

    @SelectProvider(type= BsOrganizationSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="region_id", property="regionId", jdbcType=JdbcType.VARCHAR),
        @Result(column="region_abbreviate", property="regionAbbreviate", jdbcType=JdbcType.VARCHAR),
        @Result(column="parent_id", property="parentId", jdbcType=JdbcType.BIGINT),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT),
        @Result(column="manager_id", property="managerId", jdbcType=JdbcType.BIGINT),
        @Result(column="manager_name", property="managerName", jdbcType=JdbcType.VARCHAR),
        @Result(column="manager_phone", property="managerPhone", jdbcType=JdbcType.VARCHAR),
        @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR),
        @Result(column="phone", property="phone", jdbcType=JdbcType.VARCHAR),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR),
        @Result(column="email", property="email", jdbcType=JdbcType.VARCHAR),
        @Result(column="site_url", property="siteUrl", jdbcType=JdbcType.VARCHAR),
        @Result(column="logo", property="logo", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT),
        @Result(column="rectify_no", property="rectifyNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
    })
    List<BsOrganization> selectByExample(BsOrganizationExample example);

    @Select({
        "select",
        "id, region_id, region_abbreviate, parent_id, `name`, company_id, manager_id, ",
        "manager_name, manager_phone, address, phone, remark, email, site_url, logo, ",
        "`status`, create_time, update_time, op_id, rectify_no, ext_1, ext_2, ext_3",
        "from bs_organization",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="region_id", property="regionId", jdbcType=JdbcType.VARCHAR),
        @Result(column="region_abbreviate", property="regionAbbreviate", jdbcType=JdbcType.VARCHAR),
        @Result(column="parent_id", property="parentId", jdbcType=JdbcType.BIGINT),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT),
        @Result(column="manager_id", property="managerId", jdbcType=JdbcType.BIGINT),
        @Result(column="manager_name", property="managerName", jdbcType=JdbcType.VARCHAR),
        @Result(column="manager_phone", property="managerPhone", jdbcType=JdbcType.VARCHAR),
        @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR),
        @Result(column="phone", property="phone", jdbcType=JdbcType.VARCHAR),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR),
        @Result(column="email", property="email", jdbcType=JdbcType.VARCHAR),
        @Result(column="site_url", property="siteUrl", jdbcType=JdbcType.VARCHAR),
        @Result(column="logo", property="logo", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT),
        @Result(column="rectify_no", property="rectifyNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
    })
    BsOrganization selectByPrimaryKey(Long id);

    @UpdateProvider(type= BsOrganizationSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") BsOrganization record, @Param("example") BsOrganizationExample example);

    @UpdateProvider(type= BsOrganizationSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") BsOrganization record, @Param("example") BsOrganizationExample example);

    @UpdateProvider(type= BsOrganizationSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(BsOrganization record);

    @Update({
        "update bs_organization",
        "set region_id = #{regionId,jdbcType=VARCHAR},",
          "region_abbreviate = #{regionAbbreviate,jdbcType=VARCHAR},",
          "parent_id = #{parentId,jdbcType=BIGINT},",
          "`name` = #{name,jdbcType=VARCHAR},",
          "company_id = #{companyId,jdbcType=BIGINT},",
          "manager_id = #{managerId,jdbcType=BIGINT},",
          "manager_name = #{managerName,jdbcType=VARCHAR},",
          "manager_phone = #{managerPhone,jdbcType=VARCHAR},",
          "address = #{address,jdbcType=VARCHAR},",
          "phone = #{phone,jdbcType=VARCHAR},",
          "remark = #{remark,jdbcType=VARCHAR},",
          "email = #{email,jdbcType=VARCHAR},",
          "site_url = #{siteUrl,jdbcType=VARCHAR},",
          "logo = #{logo,jdbcType=VARCHAR},",
          "`status` = #{status,jdbcType=INTEGER},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "op_id = #{opId,jdbcType=BIGINT},",
          "rectify_no = #{rectifyNo,jdbcType=VARCHAR},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(BsOrganization record);
}
