Commit 4459faea authored by liqin's avatar liqin 💬

bug fixed

parent c5d03e45
......@@ -5,7 +5,10 @@ import cn.wisenergy.chnmuseum.party.common.util.TimeUtils;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Add;
import cn.wisenergy.chnmuseum.party.common.validator.groups.Update;
import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
import cn.wisenergy.chnmuseum.party.model.*;
import cn.wisenergy.chnmuseum.party.model.AssetType;
import cn.wisenergy.chnmuseum.party.model.CopyrightOwner;
import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerAssetType;
import cn.wisenergy.chnmuseum.party.model.ExhibitionBoard;
import cn.wisenergy.chnmuseum.party.service.*;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -123,23 +126,8 @@ public class CopyrightOwnerController extends BaseController {
@ApiImplicitParam(name = "id", value = "标识ID", paramType = "path", dataType = "String")
})
public Map<String, Object> deleteCopyrightOwner(@PathVariable("id") String id) {
LambdaUpdateWrapper<Asset> updateWrapper = Wrappers.<Asset>lambdaUpdate().eq(Asset::getAssetCopyrightOwnerId, id);
updateWrapper.set(Asset::getAssetCopyrightOwnerId, null);
boolean result1 = this.assetService.update(updateWrapper);
LambdaUpdateWrapper<ExhibitionBoard> updateWrapper1 = Wrappers.<ExhibitionBoard>lambdaUpdate().eq(ExhibitionBoard::getBoardCopyrightOwnerId, id);
updateWrapper1.set(ExhibitionBoard::getBoardCopyrightOwnerId, null);
boolean result2 = this.exhibitionBoardService.update(updateWrapper1);
LambdaUpdateWrapper<CopyrightOwnerAssetType> updateWrapper2 = Wrappers.<CopyrightOwnerAssetType>lambdaUpdate().eq(CopyrightOwnerAssetType::getCopyrightOwnerId, id);
boolean result3 = this.copyrightOwnerAssetTypeService.remove(updateWrapper2);
boolean result = this.copyrightOwnerService.removeById(id);
if (result && result1 && result2 && result3) {
return getSuccessResult();
}
return getFailResult();
}
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "copyrightOwnerType", value = "版权方类型", paramType = "query", dataType = "String", required = true)
......@@ -221,6 +209,21 @@ public class CopyrightOwnerController extends BaseController {
@RequiresPermissions("copyright:owner:get:id")
public Map<String, Object> getById(@PathVariable("id") String id) {
CopyrightOwner copyrightOwner = copyrightOwnerService.getById(id);
String ownerType = copyrightOwner.getOwnerType();
if (CopyrightOwnerTypeEnum.ASSET.name.equals(ownerType)) {
LambdaQueryWrapper<CopyrightOwnerAssetType> lambdaQueryWrapper = Wrappers.<CopyrightOwnerAssetType>lambdaQuery().eq(CopyrightOwnerAssetType::getCopyrightOwnerId, id);
List<CopyrightOwnerAssetType> copyrightOwnerAssetTypeList = this.copyrightOwnerAssetTypeService.list(lambdaQueryWrapper);
if (!copyrightOwnerAssetTypeList.isEmpty()) {
List<String> assetTypeIdArrayList = copyrightOwnerAssetTypeList.stream().map(CopyrightOwnerAssetType::getAssetTypeId).distinct().collect(Collectors.toList());
copyrightOwner.setAssetTypeIdList(assetTypeIdArrayList);
final List<AssetType> assetTypeList = this.assetTypeService.listByIds(assetTypeIdArrayList);
if (!assetTypeList.isEmpty()) {
final List<String> assetTypeNameList = assetTypeList.stream().map(AssetType::getName).collect(Collectors.toList());
copyrightOwner.setAssetTypeNameList(assetTypeNameList);
}
}
}
return getResult(copyrightOwner);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment