springboot+mybatis实现删除更新(三)

 1.controller

    @PutMapping
    public Result modify(@RequestBody Dept dept){
        log.info("{}",dept);
        deptService.modify(dept);
        return Result.success();
    }

2.service 

    //更新部门
    void modify(Dept dept);
    @Override
    public void modify(Dept dept) {
        dept.setUpdateTime(LocalDateTime.now());
        deptMapper.modify(dept);
    }

3.mapper 

void modify(Dept dept);

XML映射文件 

 
    
        update dept
        
            
                name = #{name},
            
            
                update_time = #{updateTime}
            
        
        where id = #{id}
    

你可能感兴趣的:(springboot,mybatis,spring,boot,java)