tlias管理系统--员工管理--修改员工-查询回显功能
This commit is contained in:
@@ -51,4 +51,14 @@ public class EmpController {
|
||||
empService.save(emp);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/*
|
||||
查询回显功能
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public Result getEmpById(@PathVariable Integer id){
|
||||
log.info("根据id查询员工:{}",id);
|
||||
Emp emp = empService.getEmpById(id);
|
||||
return Result.success(emp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,4 +48,12 @@ public interface EmpMapper {
|
||||
@Insert("insert into emp(username,name,gender,image,job,entrydate,create_time,update_time) " +
|
||||
"values(#{username},#{name},#{gender},#{image},#{job},#{entrydate},#{createTime},#{updateTime})")
|
||||
void save(Emp emp);
|
||||
|
||||
/**
|
||||
* 根据id查询员工
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Select("select * from emp where id = #{id}")
|
||||
Emp getEmpById(Integer id);
|
||||
}
|
||||
|
||||
@@ -31,4 +31,12 @@ public interface EmpService {
|
||||
* @param emp
|
||||
*/
|
||||
void save(Emp emp);
|
||||
|
||||
/**
|
||||
* 根据id查询员工
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Emp getEmpById(Integer id);
|
||||
|
||||
}
|
||||
|
||||
@@ -89,4 +89,16 @@ public class EmpServiceImpl implements EmpService {
|
||||
emp.setUpdateTime(LocalDateTime.now());
|
||||
empMapper.save(emp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询员工
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Emp getEmpById(Integer id) {
|
||||
/* Emp emp = empMapper.getEmpById(id);
|
||||
return emp;*/
|
||||
return empMapper.getEmpById(id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user