进阶之路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)

 

posted @ 2020-02-27 11:34  唯恐不及  阅读(396)  评论(0编辑  收藏  举报