进阶之路003 增删改查/数据导入导出之修改功能

//Controller

/**
* 修改
*/
@ResponseBody
@RequestMapping("/update")
@RequiresPermissions("xxx:detail:update")
public R update(@RequestBody DetailEntity detail){

//帮助用户判定值是否为空
ValidatorUtils.validateEntity(detail);
detailService.updateById(detail);

return R.ok();
}

//Service接口层

/**
* 根据 ID 选择修改
*
* @param entity 实体对象
*/
boolean updateById(T entity);

//接口实现类

@Override
public boolean updateById(T entity) {
return retBool(baseMapper.updateById(entity));
}

//Dao层


/**
* 根据 ID 修改
*
* @param entity 实体对象
*/
int updateById(@Param(Constants.ENTITY) T entity)

原文地址:https://www.cnblogs.com/pureray-hui/p/12371201.html