package com.hfkj.dao;

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

import java.util.List;

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

    @DeleteProvider(type= SecMenuSqlProvider.class, method="deleteByExample")
    int deleteByExample(SecMenuExample example);

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

    @Insert({
        "insert into sec_menu (menu_name, menu_type, ",
        "menu_url, menu_url_img, ",
        "menu_p_sid, menu_sort, ",
        "menu_desc, menu_mobile_url, ",
        "show_on_mobile)",
        "values (#{menuName,jdbcType=VARCHAR}, #{menuType,jdbcType=INTEGER}, ",
        "#{menuUrl,jdbcType=VARCHAR}, #{menuUrlImg,jdbcType=VARCHAR}, ",
        "#{menuPSid,jdbcType=BIGINT}, #{menuSort,jdbcType=INTEGER}, ",
        "#{menuDesc,jdbcType=VARCHAR}, #{menuMobileUrl,jdbcType=VARCHAR}, ",
        "#{showOnMobile,jdbcType=INTEGER})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(SecMenu record);

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

    @SelectProvider(type= SecMenuSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="menu_name", property="menuName", jdbcType=JdbcType.VARCHAR),
        @Result(column="menu_type", property="menuType", jdbcType=JdbcType.INTEGER),
        @Result(column="menu_url", property="menuUrl", jdbcType=JdbcType.VARCHAR),
        @Result(column="menu_url_img", property="menuUrlImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="menu_p_sid", property="menuPSid", jdbcType=JdbcType.BIGINT),
        @Result(column="menu_sort", property="menuSort", jdbcType=JdbcType.INTEGER),
        @Result(column="menu_desc", property="menuDesc", jdbcType=JdbcType.VARCHAR),
        @Result(column="menu_mobile_url", property="menuMobileUrl", jdbcType=JdbcType.VARCHAR),
        @Result(column="show_on_mobile", property="showOnMobile", jdbcType=JdbcType.INTEGER)
    })
    List<SecMenu> selectByExample(SecMenuExample example);

    @Select({
        "select",
        "id, menu_name, menu_type, menu_url, menu_url_img, menu_p_sid, menu_sort, menu_desc, ",
        "menu_mobile_url, show_on_mobile",
        "from sec_menu",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="menu_name", property="menuName", jdbcType=JdbcType.VARCHAR),
        @Result(column="menu_type", property="menuType", jdbcType=JdbcType.INTEGER),
        @Result(column="menu_url", property="menuUrl", jdbcType=JdbcType.VARCHAR),
        @Result(column="menu_url_img", property="menuUrlImg", jdbcType=JdbcType.VARCHAR),
        @Result(column="menu_p_sid", property="menuPSid", jdbcType=JdbcType.BIGINT),
        @Result(column="menu_sort", property="menuSort", jdbcType=JdbcType.INTEGER),
        @Result(column="menu_desc", property="menuDesc", jdbcType=JdbcType.VARCHAR),
        @Result(column="menu_mobile_url", property="menuMobileUrl", jdbcType=JdbcType.VARCHAR),
        @Result(column="show_on_mobile", property="showOnMobile", jdbcType=JdbcType.INTEGER)
    })
    SecMenu selectByPrimaryKey(Long id);

    @UpdateProvider(type= SecMenuSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") SecMenu record, @Param("example") SecMenuExample example);

    @UpdateProvider(type= SecMenuSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") SecMenu record, @Param("example") SecMenuExample example);

    @UpdateProvider(type= SecMenuSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(SecMenu record);

    @Update({
        "update sec_menu",
        "set menu_name = #{menuName,jdbcType=VARCHAR},",
          "menu_type = #{menuType,jdbcType=INTEGER},",
          "menu_url = #{menuUrl,jdbcType=VARCHAR},",
          "menu_url_img = #{menuUrlImg,jdbcType=VARCHAR},",
          "menu_p_sid = #{menuPSid,jdbcType=BIGINT},",
          "menu_sort = #{menuSort,jdbcType=INTEGER},",
          "menu_desc = #{menuDesc,jdbcType=VARCHAR},",
          "menu_mobile_url = #{menuMobileUrl,jdbcType=VARCHAR},",
          "show_on_mobile = #{showOnMobile,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(SecMenu record);
}
