package com.hai.dao;

import com.hai.entity.SecDictionary;
import com.hai.entity.SecDictionaryExample;
import com.hai.entity.SecDictionaryKey;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;

import java.util.List;

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

    @DeleteProvider(type= SecDictionarySqlProvider.class, method="deleteByExample")
    int deleteByExample(SecDictionaryExample example);

    @Delete({
        "delete from sec_dictionary",
        "where code_type = #{codeType,jdbcType=VARCHAR}",
          "and code_value = #{codeValue,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(SecDictionaryKey key);

    @Insert({
        "insert into sec_dictionary (code_type, code_value, ",
        "code_name, code_desc, ",
        "sort_id, `status`, ",
        "ext_1, ext_2, ext_3)",
        "values (#{codeType,jdbcType=VARCHAR}, #{codeValue,jdbcType=VARCHAR}, ",
        "#{codeName,jdbcType=VARCHAR}, #{codeDesc,jdbcType=VARCHAR}, ",
        "#{sortId,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, ",
        "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    int insert(SecDictionary record);

    @InsertProvider(type= SecDictionarySqlProvider.class, method="insertSelective")
    int insertSelective(SecDictionary record);

    @SelectProvider(type= SecDictionarySqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="code_type", property="codeType", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="code_value", property="codeValue", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="code_name", property="codeName", jdbcType=JdbcType.VARCHAR),
        @Result(column="code_desc", property="codeDesc", jdbcType=JdbcType.VARCHAR),
        @Result(column="sort_id", property="sortId", jdbcType=JdbcType.INTEGER),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @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<SecDictionary> selectByExample(SecDictionaryExample example);

    @Select({
        "select",
        "code_type, code_value, code_name, code_desc, sort_id, `status`, ext_1, ext_2, ",
        "ext_3",
        "from sec_dictionary",
        "where code_type = #{codeType,jdbcType=VARCHAR}",
          "and code_value = #{codeValue,jdbcType=VARCHAR}"
    })
    @Results({
        @Result(column="code_type", property="codeType", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="code_value", property="codeValue", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="code_name", property="codeName", jdbcType=JdbcType.VARCHAR),
        @Result(column="code_desc", property="codeDesc", jdbcType=JdbcType.VARCHAR),
        @Result(column="sort_id", property="sortId", jdbcType=JdbcType.INTEGER),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @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)
    })
    SecDictionary selectByPrimaryKey(SecDictionaryKey key);

    @UpdateProvider(type= SecDictionarySqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") SecDictionary record, @Param("example") SecDictionaryExample example);

    @UpdateProvider(type= SecDictionarySqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") SecDictionary record, @Param("example") SecDictionaryExample example);

    @UpdateProvider(type= SecDictionarySqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(SecDictionary record);

    @Update({
        "update sec_dictionary",
        "set code_name = #{codeName,jdbcType=VARCHAR},",
          "code_desc = #{codeDesc,jdbcType=VARCHAR},",
          "sort_id = #{sortId,jdbcType=INTEGER},",
          "`status` = #{status,jdbcType=INTEGER},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR}",
        "where code_type = #{codeType,jdbcType=VARCHAR}",
          "and code_value = #{codeValue,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(SecDictionary record);
}
