code7

51 阅读1分钟
其中设置状态(有效和无效)和弹窗修改都属于同一个修改即可

**注意: 如果name无值不用处理 (因为启用禁用不用传name)**

**如果name有值,需要检查是否改变 是否重复 长度是否合格** 
@ApiOperation(value ="频道修改")
@PostMapping("/update")
public ResponseResult update(@RequestBody  ChannelDto dto) {
    return channelService.update(dto);
} 
 
ResponseResult update(ChannelDto dto);  
  @PutMapping("/update")
    public ResponseResult update(@RequestBody ChannelDto channelDto){
//        参数判断
        if(channelDto == null || channelDto.getId() == null){
            return ResponseResult.error(AppHttpCodeEnum.PARAM_REQUIRE);
        }
//        对象转换
        AdChannel adChannel = BeanHelper.copyProperties(channelDto, AdChannel.class);
        boolean b = channelService.updateById(adChannel);
        if(!b){
            throw new LeadException(AppHttpCodeEnum.SERVER_ERROR);
        }
        return ResponseResult.ok();
    }