|
|
@ -7,6 +7,8 @@ import com.qs.serve.common.model.dto.R; |
|
|
|
import com.qs.serve.common.model.enums.BizType; |
|
|
|
import com.qs.serve.common.model.enums.SystemModule; |
|
|
|
import com.qs.serve.common.util.PageUtil; |
|
|
|
import com.qs.serve.modules.bms.entity.BmsChannelPoint; |
|
|
|
import com.qs.serve.modules.bms.service.BmsChannelPointService; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
@ -17,6 +19,7 @@ import com.qs.serve.modules.bms.service.BmsChannelService; |
|
|
|
|
|
|
|
import javax.validation.Valid; |
|
|
|
import java.util.List; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 基础档案 渠道 |
|
|
@ -30,6 +33,7 @@ import java.util.List; |
|
|
|
public class BmsChannelController { |
|
|
|
|
|
|
|
private BmsChannelService bmsChannelService; |
|
|
|
private BmsChannelPointService bmsChannelPointService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 翻页 |
|
|
@ -69,7 +73,16 @@ public class BmsChannelController { |
|
|
|
@SysLog(module = SystemModule.BASE, title = "渠道", biz = BizType.UPDATE) |
|
|
|
@PreAuthorize("hasRole('bms:channel:update')") |
|
|
|
public R<?> updateById(@RequestBody @Valid BmsChannel param){ |
|
|
|
BmsChannel ori = bmsChannelService.getById(param.getId()); |
|
|
|
boolean result = bmsChannelService.updateById(param); |
|
|
|
if(!ori.getChannelName().equals(param.getChannelName())){ |
|
|
|
List<BmsChannelPoint> channelPoints = bmsChannelPointService.listByChannelId(param.getId()); |
|
|
|
channelPoints = channelPoints.stream().map(a->{ |
|
|
|
a.setChannelName(param.getChannelName()); |
|
|
|
return a; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
bmsChannelPointService.updateBatchById(channelPoints); |
|
|
|
} |
|
|
|
return R.isTrue(result); |
|
|
|
} |
|
|
|
|
|
|
|