EmpMapper(dao)

本文介绍了一个基于MyBatis实现的员工表数据库操作接口,涵盖了增删改查等核心功能,通过具体的Java代码展示了如何对数据库中的员工记录进行有效的管理和维护。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

package cn.et.food.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.type.JdbcType;

import cn.et.food.entity.Emp;
import cn.et.food.entity.EmpExample;

public interface EmpMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table emp
     *
     * @mbg.generated Wed Dec 13 09:46:59 CST 2017
     */
    @SelectProvider(type=EmpSqlProvider.class, method="countByExample")
    long countByExample(EmpExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table emp
     *
     * @mbg.generated Wed Dec 13 09:46:59 CST 2017
     */
    @DeleteProvider(type=EmpSqlProvider.class, method="deleteByExample")
    int deleteByExample(EmpExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table emp
     *
     * @mbg.generated Wed Dec 13 09:46:59 CST 2017
     */
    @Delete({
        "delete from emp",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table emp
     *
     * @mbg.generated Wed Dec 13 09:46:59 CST 2017
     */
    @Insert({
        "insert into emp (id, ename, ",
        "sal, deptid)",
        "values (#{id,jdbcType=INTEGER}, #{ename,jdbcType=VARCHAR}, ",
        "#{sal,jdbcType=DECIMAL}, #{deptid,jdbcType=INTEGER})"
    })
    int insert(Emp record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table emp
     *
     * @mbg.generated Wed Dec 13 09:46:59 CST 2017
     */
    @InsertProvider(type=EmpSqlProvider.class, method="insertSelective")
    int insertSelective(Emp record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table emp
     *
     * @mbg.generated Wed Dec 13 09:46:59 CST 2017
     */
    @SelectProvider(type=EmpSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="ename", property="ename", jdbcType=JdbcType.VARCHAR),
        @Result(column="sal", property="sal", jdbcType=JdbcType.DECIMAL),
        @Result(column="deptid", property="deptid", jdbcType=JdbcType.INTEGER)
    })
    List<Emp> selectByExampleWithRowbounds(EmpExample example, RowBounds rowBounds);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table emp
     *
     * @mbg.generated Wed Dec 13 09:46:59 CST 2017
     */
    @SelectProvider(type=EmpSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="ename", property="ename", jdbcType=JdbcType.VARCHAR),
        @Result(column="sal", property="sal", jdbcType=JdbcType.DECIMAL),
        @Result(column="deptid", property="deptid", jdbcType=JdbcType.INTEGER)
    })
    List<Emp> selectByExample(EmpExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table emp
     *
     * @mbg.generated Wed Dec 13 09:46:59 CST 2017
     */
    @Select({
        "select",
        "id, ename, sal, deptid",
        "from emp",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="ename", property="ename", jdbcType=JdbcType.VARCHAR),
        @Result(column="sal", property="sal", jdbcType=JdbcType.DECIMAL),
        @Result(column="deptid", property="deptid", jdbcType=JdbcType.INTEGER)
    })
    Emp selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table emp
     *
     * @mbg.generated Wed Dec 13 09:46:59 CST 2017
     */
    @UpdateProvider(type=EmpSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Emp record, @Param("example") EmpExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table emp
     *
     * @mbg.generated Wed Dec 13 09:46:59 CST 2017
     */
    @UpdateProvider(type=EmpSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Emp record, @Param("example") EmpExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table emp
     *
     * @mbg.generated Wed Dec 13 09:46:59 CST 2017
     */
    @UpdateProvider(type=EmpSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Emp record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table emp
     *
     * @mbg.generated Wed Dec 13 09:46:59 CST 2017
     */
    @Update({
        "update emp",
        "set ename = #{ename,jdbcType=VARCHAR},",
          "sal = #{sal,jdbcType=DECIMAL},",
          "deptid = #{deptid,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Emp record);
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值