返回主键

package cn.adminlog.mapper;


import cn.adminlog.pojo.Emp;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;

@Mapper
public interface EmpMapper {
    // 根据ID删除数据

    @Delete("delete from emp where id = #{id}")
//    public void delete(Integer id);
    public int delete(Integer id);

    // 新增员工

    @Options(keyProperty = "id", useGeneratedKeys = true)   // 将自动生成的主键值赋值给emp对象的id属性

    @Insert("insert into emp(username, name, gender, image, job, entrydate, dept_id, create_time, update_time)" +
            "values (#{username},#{name},#{gender},#{image},#{job},#{entrydate},#{deptID},#{createTime},#{updateTime});")
    public void insert(Emp emp);

}