From 0a8d9a382a4d47126492acf6cfb6928b1aee9a25 Mon Sep 17 00:00:00 2001 From: liqin <liqin@wisenergy.cn> Date: Mon, 12 Apr 2021 18:31:27 +0800 Subject: [PATCH] bug fixed --- .../party/common/mybatis/MysqlGenerator.java | 2 +- .../mapper/CopyrightOwnerBoardCatMapper.java | 16 +++++ .../mapper/CopyrightOwnerBoardTypeMapper.java | 18 ----- .../chnmuseum/party/model/CopyrightOwner.java | 12 ++++ ...dType.java => CopyrightOwnerBoardCat.java} | 12 ++-- ...ava => CopyrightOwnerBoardCatService.java} | 6 +- .../CopyrightOwnerBoardCatServiceImpl.java | 28 ++++++++ .../CopyrightOwnerBoardTypeServiceImpl.java | 22 ------ .../controller/CopyrightOwnerController.java | 72 +++++++++++++++---- .../ExhibitionBoardCatController.java | 22 +++++- .../controller/VideoContentCatController.java | 23 +++++- ...r.xml => CopyrightOwnerBoardCatMapper.xml} | 14 ++-- 12 files changed, 172 insertions(+), 75 deletions(-) create mode 100644 src/main/java/cn/wisenergy/chnmuseum/party/mapper/CopyrightOwnerBoardCatMapper.java delete mode 100644 src/main/java/cn/wisenergy/chnmuseum/party/mapper/CopyrightOwnerBoardTypeMapper.java rename src/main/java/cn/wisenergy/chnmuseum/party/model/{CopyrightOwnerBoardType.java => CopyrightOwnerBoardCat.java} (84%) rename src/main/java/cn/wisenergy/chnmuseum/party/service/{CopyrightOwnerBoardTypeService.java => CopyrightOwnerBoardCatService.java} (52%) create mode 100644 src/main/java/cn/wisenergy/chnmuseum/party/service/impl/CopyrightOwnerBoardCatServiceImpl.java delete mode 100644 src/main/java/cn/wisenergy/chnmuseum/party/service/impl/CopyrightOwnerBoardTypeServiceImpl.java rename src/main/resources/mapper/{CopyrightOwnerBoardTypeMapper.xml => CopyrightOwnerBoardCatMapper.xml} (54%) diff --git a/src/main/java/cn/wisenergy/chnmuseum/party/common/mybatis/MysqlGenerator.java b/src/main/java/cn/wisenergy/chnmuseum/party/common/mybatis/MysqlGenerator.java index 492c74f..5d60b9f 100644 --- a/src/main/java/cn/wisenergy/chnmuseum/party/common/mybatis/MysqlGenerator.java +++ b/src/main/java/cn/wisenergy/chnmuseum/party/common/mybatis/MysqlGenerator.java @@ -3,7 +3,7 @@ package cn.wisenergy.chnmuseum.party.common.mybatis; public class MysqlGenerator { private static final String[] tableNames = new String[]{ - "asset" + "copyright_owner_board_cat" }; // private static final String projectPath = "D:\\develop\\Project\\chnmuseum-party"; private static final String projectPath = "/opt/ss"; diff --git a/src/main/java/cn/wisenergy/chnmuseum/party/mapper/CopyrightOwnerBoardCatMapper.java b/src/main/java/cn/wisenergy/chnmuseum/party/mapper/CopyrightOwnerBoardCatMapper.java new file mode 100644 index 0000000..204532b --- /dev/null +++ b/src/main/java/cn/wisenergy/chnmuseum/party/mapper/CopyrightOwnerBoardCatMapper.java @@ -0,0 +1,16 @@ +package cn.wisenergy.chnmuseum.party.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerBoardCat; + +/** + * <pre> + * ç‰ˆæƒæ–¹å±•æ¿åˆ†ç±» Mapper æŽ¥å£ + * </pre> + * + * @author Danny Lee + * @since 2021-04-12 + */ +public interface CopyrightOwnerBoardCatMapper extends BaseMapper<CopyrightOwnerBoardCat> { + +} diff --git a/src/main/java/cn/wisenergy/chnmuseum/party/mapper/CopyrightOwnerBoardTypeMapper.java b/src/main/java/cn/wisenergy/chnmuseum/party/mapper/CopyrightOwnerBoardTypeMapper.java deleted file mode 100644 index 19204d9..0000000 --- a/src/main/java/cn/wisenergy/chnmuseum/party/mapper/CopyrightOwnerBoardTypeMapper.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.wisenergy.chnmuseum.party.mapper; - -import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerBoardType; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.springframework.stereotype.Repository; - -/** - * <pre> - * ç‰ˆæƒæ–¹å±•æ¿åˆ†ç±» Mapper æŽ¥å£ - * </pre> - * - * @author Danny Lee - * @since 2021-03-18 - */ -@Repository -public interface CopyrightOwnerBoardTypeMapper extends BaseMapper<CopyrightOwnerBoardType> { - -} diff --git a/src/main/java/cn/wisenergy/chnmuseum/party/model/CopyrightOwner.java b/src/main/java/cn/wisenergy/chnmuseum/party/model/CopyrightOwner.java index 2ea8564..28d3e51 100644 --- a/src/main/java/cn/wisenergy/chnmuseum/party/model/CopyrightOwner.java +++ b/src/main/java/cn/wisenergy/chnmuseum/party/model/CopyrightOwner.java @@ -89,4 +89,16 @@ public class CopyrightOwner implements Serializable { @TableField(exist = false) private String videoContentCatNames; + @ApiModelProperty("展æ¿åˆ†ç±»ID集åˆ(详情使用)") + @TableField(exist = false) + private List<String> boardCatIdList; + + @ApiModelProperty("展æ¿åˆ†ç±»ç±»å称集åˆ(详情使用)") + @TableField(exist = false) + private List<String> boardCatNameList; + + @ApiModelProperty("展æ¿åˆ†ç±»åç§°(列表使用)") + @TableField(exist = false) + private String boardCatNames; + } diff --git a/src/main/java/cn/wisenergy/chnmuseum/party/model/CopyrightOwnerBoardType.java b/src/main/java/cn/wisenergy/chnmuseum/party/model/CopyrightOwnerBoardCat.java similarity index 84% rename from src/main/java/cn/wisenergy/chnmuseum/party/model/CopyrightOwnerBoardType.java rename to src/main/java/cn/wisenergy/chnmuseum/party/model/CopyrightOwnerBoardCat.java index 63df64c..7131a6a 100644 --- a/src/main/java/cn/wisenergy/chnmuseum/party/model/CopyrightOwnerBoardType.java +++ b/src/main/java/cn/wisenergy/chnmuseum/party/model/CopyrightOwnerBoardCat.java @@ -21,7 +21,7 @@ import java.io.Serializable; * </p> * * @author Danny Lee - * @since 2021-03-18 + * @since 2021-04-12 */ @Data @Builder @@ -29,14 +29,14 @@ import java.io.Serializable; @NoArgsConstructor @Accessors(chain = true) @EqualsAndHashCode(callSuper = false) -@TableName("copyright_owner_board_type") +@TableName("copyright_owner_board_cat") @ApiModel(value = "ç‰ˆæƒæ–¹å±•æ¿åˆ†ç±»", description = "ç‰ˆæƒæ–¹å±•æ¿åˆ†ç±»") -public class CopyrightOwnerBoardType implements Serializable { +public class CopyrightOwnerBoardCat implements Serializable { private static final long serialVersionUID = 1L; @TableId(value = "id", type = IdType.ASSIGN_ID) - @NotNull(message = "IDä¸èƒ½ä¸ºç©º", groups = {Update.class}) + @NotNull(message = "ä¸èƒ½ä¸ºç©º", groups = {Update.class}) private String id; @ApiModelProperty("ç‰ˆæƒæ–¹ID") @@ -45,8 +45,8 @@ public class CopyrightOwnerBoardType implements Serializable { private String copyrightOwnerId; @ApiModelProperty("展æ¿åˆ†ç±»ID") - @TableField("board_type_id") + @TableField("board_cat_id") @NotBlank(message = "展æ¿åˆ†ç±»IDä¸èƒ½ä¸ºç©º", groups = {Add.class, Update.class}) - private String boardTypeId; + private String boardCatId; } diff --git a/src/main/java/cn/wisenergy/chnmuseum/party/service/CopyrightOwnerBoardTypeService.java b/src/main/java/cn/wisenergy/chnmuseum/party/service/CopyrightOwnerBoardCatService.java similarity index 52% rename from src/main/java/cn/wisenergy/chnmuseum/party/service/CopyrightOwnerBoardTypeService.java rename to src/main/java/cn/wisenergy/chnmuseum/party/service/CopyrightOwnerBoardCatService.java index de1b23d..b623b8d 100644 --- a/src/main/java/cn/wisenergy/chnmuseum/party/service/CopyrightOwnerBoardTypeService.java +++ b/src/main/java/cn/wisenergy/chnmuseum/party/service/CopyrightOwnerBoardCatService.java @@ -1,6 +1,6 @@ package cn.wisenergy.chnmuseum.party.service; -import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerBoardType; +import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerBoardCat; import com.baomidou.mybatisplus.extension.service.IService; /** @@ -9,8 +9,8 @@ import com.baomidou.mybatisplus.extension.service.IService; * </p> * * @author Danny Lee - * @since 2021-03-18 + * @since 2021-04-12 */ -public interface CopyrightOwnerBoardTypeService extends IService<CopyrightOwnerBoardType> { +public interface CopyrightOwnerBoardCatService extends IService<CopyrightOwnerBoardCat> { } diff --git a/src/main/java/cn/wisenergy/chnmuseum/party/service/impl/CopyrightOwnerBoardCatServiceImpl.java b/src/main/java/cn/wisenergy/chnmuseum/party/service/impl/CopyrightOwnerBoardCatServiceImpl.java new file mode 100644 index 0000000..b717ed2 --- /dev/null +++ b/src/main/java/cn/wisenergy/chnmuseum/party/service/impl/CopyrightOwnerBoardCatServiceImpl.java @@ -0,0 +1,28 @@ +package cn.wisenergy.chnmuseum.party.service.impl; + +import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerBoardCat; +import cn.wisenergy.chnmuseum.party.mapper.CopyrightOwnerBoardCatMapper; +import cn.wisenergy.chnmuseum.party.service.CopyrightOwnerBoardCatService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * <pre> + * ç‰ˆæƒæ–¹å±•æ¿åˆ†ç±» æœåŠ¡å®žçŽ°ç±» + * </pre> + * + * @author Danny Lee + * @since 2021-04-12 + */ +@Slf4j +@Service +public class CopyrightOwnerBoardCatServiceImpl extends ServiceImpl<CopyrightOwnerBoardCatMapper, CopyrightOwnerBoardCat> implements CopyrightOwnerBoardCatService { + + @Autowired + private CopyrightOwnerBoardCatMapper copyrightOwnerBoardCatMapper; + +} diff --git a/src/main/java/cn/wisenergy/chnmuseum/party/service/impl/CopyrightOwnerBoardTypeServiceImpl.java b/src/main/java/cn/wisenergy/chnmuseum/party/service/impl/CopyrightOwnerBoardTypeServiceImpl.java deleted file mode 100644 index 37b028a..0000000 --- a/src/main/java/cn/wisenergy/chnmuseum/party/service/impl/CopyrightOwnerBoardTypeServiceImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.wisenergy.chnmuseum.party.service.impl; - -import cn.wisenergy.chnmuseum.party.mapper.CopyrightOwnerBoardTypeMapper; -import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerBoardType; -import cn.wisenergy.chnmuseum.party.service.CopyrightOwnerBoardTypeService; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -/** - * <pre> - * ç‰ˆæƒæ–¹å±•æ¿åˆ†ç±» æœåŠ¡å®žçŽ°ç±» - * </pre> - * - * @author Danny Lee - * @since 2021-03-18 - */ -@Slf4j -@Service -public class CopyrightOwnerBoardTypeServiceImpl extends ServiceImpl<CopyrightOwnerBoardTypeMapper, CopyrightOwnerBoardType> implements CopyrightOwnerBoardTypeService { - -} diff --git a/src/main/java/cn/wisenergy/chnmuseum/party/web/controller/CopyrightOwnerController.java b/src/main/java/cn/wisenergy/chnmuseum/party/web/controller/CopyrightOwnerController.java index 79fc2bb..818c7e7 100644 --- a/src/main/java/cn/wisenergy/chnmuseum/party/web/controller/CopyrightOwnerController.java +++ b/src/main/java/cn/wisenergy/chnmuseum/party/web/controller/CopyrightOwnerController.java @@ -26,7 +26,6 @@ import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.stream.Collectors; /** @@ -55,6 +54,12 @@ public class CopyrightOwnerController extends BaseController { @Resource private CopyrightOwnerVideoContentCatService copyrightOwnerVideoContentCatService; + @Resource + private CopyrightOwnerBoardCatService copyrightOwnerBoardCatService; + + @Resource + private ExhibitionBoardCatService exhibitionBoardCatService; + @Resource private ExhibitionBoardService exhibitionBoardService; @@ -77,6 +82,18 @@ public class CopyrightOwnerController extends BaseController { this.copyrightOwnerVideoContentCatService.saveBatch(copyrightOwnerVideoContentCatList); } + final List<String> boardCatIdList = copyrightOwner.getBoardCatIdList(); + if (boardCatIdList != null && !boardCatIdList.isEmpty()) { + List<CopyrightOwnerBoardCat> copyrightOwnerBoardCatList = new ArrayList<>(); + for (String boardCatId : boardCatIdList) { + copyrightOwnerBoardCatList.add(CopyrightOwnerBoardCat.builder() + .boardCatId(boardCatId) + .copyrightOwnerId(copyrightOwner.getId()) + .build()); + } + this.copyrightOwnerBoardCatService.saveBatch(copyrightOwnerBoardCatList); + } + // 返回æ“作结果 if (result) { return getSuccessResult(); @@ -106,6 +123,22 @@ public class CopyrightOwnerController extends BaseController { } this.copyrightOwnerVideoContentCatService.saveBatch(copyrightOwnerVideoContentCatList); } + + final List<String> boardCatIdList = copyrightOwner.getBoardCatIdList(); + if (boardCatIdList != null && !boardCatIdList.isEmpty()) { + LambdaUpdateWrapper<CopyrightOwnerBoardCat> updateWrapper = Wrappers.<CopyrightOwnerBoardCat>lambdaUpdate().eq(CopyrightOwnerBoardCat::getCopyrightOwnerId, copyrightOwner.getId()); + this.copyrightOwnerBoardCatService.remove(updateWrapper); + + List<CopyrightOwnerBoardCat> copyrightOwnerBoardCatList = new ArrayList<>(); + for (String boardCatId : boardCatIdList) { + copyrightOwnerBoardCatList.add(CopyrightOwnerBoardCat.builder() + .boardCatId(boardCatId) + .copyrightOwnerId(copyrightOwner.getId()) + .build()); + } + this.copyrightOwnerBoardCatService.saveBatch(copyrightOwnerBoardCatList); + } + if (flag) { return getSuccessResult(); } @@ -120,9 +153,7 @@ public class CopyrightOwnerController extends BaseController { @ApiOperation(value = "获å–ç‰ˆæƒæ–¹å…¨éƒ¨åˆ—表(æ— åˆ†é¡µ)", notes = "获å–ç‰ˆæƒæ–¹å…¨éƒ¨åˆ—表(æ— åˆ†é¡µ)") public Map<String, Object> getCopyrightOwnerList(@RequestParam("copyrightOwnerType") CopyrightOwnerTypeEnum copyrightOwnerTypeEnum) { LambdaQueryWrapper<CopyrightOwner> lambdaQueryWrapper = Wrappers.<CopyrightOwner>lambdaQuery().eq(CopyrightOwner::getOwnerType, copyrightOwnerTypeEnum.name()); - lambdaQueryWrapper.eq(CopyrightOwner::getDeleted, false); - lambdaQueryWrapper.le(CopyrightOwner::getExpireDateStart, TimeUtils.getDateTimeOfTimestamp(System.currentTimeMillis())) - .ge(CopyrightOwner::getExpireDateEnd, TimeUtils.getDateTimeOfTimestamp(System.currentTimeMillis())); + lambdaQueryWrapper.le(CopyrightOwner::getExpireDateStart, TimeUtils.getDateTimeOfTimestamp(System.currentTimeMillis())).ge(CopyrightOwner::getExpireDateEnd, TimeUtils.getDateTimeOfTimestamp(System.currentTimeMillis())); lambdaQueryWrapper.orderByDesc(CopyrightOwner::getCreateTime); List<CopyrightOwner> copyrightOwnerList = copyrightOwnerService.list(lambdaQueryWrapper); return getResult(copyrightOwnerList); @@ -148,8 +179,8 @@ public class CopyrightOwnerController extends BaseController { } // æ ¹æ®åˆ›å»ºæ—¶é—´åŒºé—´æ£€ç´¢ if (genericPageParam.getStartDate() != null && genericPageParam.getEndDate() != null) { - queryWrapper.ge(CopyrightOwner::getCreateTime, genericPageParam.getStartDate().atTime(0, 0, 0)) - .le(CopyrightOwner::getCreateTime, genericPageParam.getEndDate().atTime(23, 59, 59)); + queryWrapper.ge(CopyrightOwner::getExpireDateEnd, genericPageParam.getEndDate().atTime(23, 59, 59)) + .le(CopyrightOwner::getExpireDateStart, genericPageParam.getStartDate().atTime(0, 0, 0)); } // 设置排åºè§„则 queryWrapper.orderByDesc(CopyrightOwner::getCreateTime); @@ -168,19 +199,18 @@ public class CopyrightOwnerController extends BaseController { if (CopyrightOwnerTypeEnum.VIDEO_CONTENT.name().equals(genericPageParam.getOwnerType())) { List<CopyrightOwnerVideoContentCat> copyrightOwnerVideoContentCatList = this.copyrightOwnerVideoContentCatService.list(Wrappers.<CopyrightOwnerVideoContentCat>lambdaQuery().eq(CopyrightOwnerVideoContentCat::getCopyrightOwnerId, copyrightOwner.getId())); if (!copyrightOwnerVideoContentCatList.isEmpty()) { - Set<String> idList = copyrightOwnerVideoContentCatList.stream().map(CopyrightOwnerVideoContentCat::getVideoContentCatId).collect(Collectors.toSet()); + final List<String> idList = copyrightOwnerVideoContentCatList.stream().map(CopyrightOwnerVideoContentCat::getVideoContentCatId).distinct().collect(Collectors.toList()); List<VideoContentCat> videoContentCatList = this.videoContentCatService.listByIds(idList); String videoContentCatNames = videoContentCatList.stream().map(VideoContentCat::getName).collect(Collectors.joining("ã€")); copyrightOwner.setVideoContentCatNames(videoContentCatNames); } } else if (CopyrightOwnerTypeEnum.EXHIBITION_BOARD.name().equals(genericPageParam.getOwnerType())) { - LambdaQueryWrapper<ExhibitionBoard> lambdaQueryWrapper = Wrappers.<ExhibitionBoard>lambdaQuery().eq(ExhibitionBoard::getBoardCopyrightOwnerId, copyrightOwner.getId()); - List<ExhibitionBoard> exhibitionBoardList = this.exhibitionBoardService.list(lambdaQueryWrapper); - if (!exhibitionBoardList.isEmpty()) { - Set<String> videoContentCatIdList = exhibitionBoardList.stream().map(ExhibitionBoard::getVideoContentCatId).collect(Collectors.toSet()); - List<VideoContentCat> videoContentCatList = this.videoContentCatService.listByIds(videoContentCatIdList); - String videoContentCatNames = videoContentCatList.stream().map(VideoContentCat::getName).collect(Collectors.joining("ã€")); - copyrightOwner.setVideoContentCatNames(videoContentCatNames); + final List<CopyrightOwnerBoardCat> copyrightOwnerBoardCatList = this.copyrightOwnerBoardCatService.list(Wrappers.<CopyrightOwnerBoardCat>lambdaQuery().eq(CopyrightOwnerBoardCat::getCopyrightOwnerId, copyrightOwner.getId())); + if (!copyrightOwnerBoardCatList.isEmpty()) { + List<String> idList = copyrightOwnerBoardCatList.stream().map(CopyrightOwnerBoardCat::getBoardCatId).distinct().collect(Collectors.toList()); + final List<ExhibitionBoardCat> exhibitionBoardCatList = this.exhibitionBoardCatService.listByIds(idList); + final String exhibitionBoardCatNames = exhibitionBoardCatList.stream().map(ExhibitionBoardCat::getName).collect(Collectors.joining("ã€")); + copyrightOwner.setBoardCatNames(exhibitionBoardCatNames); } } } @@ -209,6 +239,18 @@ public class CopyrightOwnerController extends BaseController { } } } + if (CopyrightOwnerTypeEnum.EXHIBITION_BOARD.name().equals(ownerType)) { + final List<CopyrightOwnerBoardCat> copyrightOwnerBoardCatList = this.copyrightOwnerBoardCatService.list(Wrappers.<CopyrightOwnerBoardCat>lambdaQuery().eq(CopyrightOwnerBoardCat::getCopyrightOwnerId, id)); + if (!copyrightOwnerBoardCatList.isEmpty()) { + final List<String> boardCatIdList = copyrightOwnerBoardCatList.stream().map(CopyrightOwnerBoardCat::getBoardCatId).distinct().collect(Collectors.toList()); + copyrightOwner.setBoardCatIdList(boardCatIdList); + final List<ExhibitionBoardCat> exhibitionBoardCatList = this.exhibitionBoardCatService.listByIds(boardCatIdList); + if (!exhibitionBoardCatList.isEmpty()) { + final List<String> exhibitionBoardCatNameList = exhibitionBoardCatList.stream().map(ExhibitionBoardCat::getName).collect(Collectors.toList()); + copyrightOwner.setBoardCatNameList(exhibitionBoardCatNameList); + } + } + } return getResult(copyrightOwner); } @@ -230,6 +272,8 @@ public class CopyrightOwnerController extends BaseController { updateWrapper1.set(ExhibitionBoard::getDeleted, true); this.exhibitionBoardService.update(updateWrapper1); + //todo åˆ é™¤ç‰ˆæƒæ–¹å…³è”表 + return getSuccessResult(); } diff --git a/src/main/java/cn/wisenergy/chnmuseum/party/web/controller/ExhibitionBoardCatController.java b/src/main/java/cn/wisenergy/chnmuseum/party/web/controller/ExhibitionBoardCatController.java index ffbc641..e76617b 100644 --- a/src/main/java/cn/wisenergy/chnmuseum/party/web/controller/ExhibitionBoardCatController.java +++ b/src/main/java/cn/wisenergy/chnmuseum/party/web/controller/ExhibitionBoardCatController.java @@ -5,8 +5,10 @@ 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.CopyrightOwner; +import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerBoardCat; import cn.wisenergy.chnmuseum.party.model.ExhibitionBoard; import cn.wisenergy.chnmuseum.party.model.ExhibitionBoardCat; +import cn.wisenergy.chnmuseum.party.service.CopyrightOwnerBoardCatService; import cn.wisenergy.chnmuseum.party.service.CopyrightOwnerService; import cn.wisenergy.chnmuseum.party.service.ExhibitionBoardCatService; import cn.wisenergy.chnmuseum.party.service.ExhibitionBoardService; @@ -30,6 +32,7 @@ import javax.annotation.Resource; import javax.validation.constraints.NotNull; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; @@ -53,6 +56,8 @@ public class ExhibitionBoardCatController extends BaseController { private ExhibitionBoardCatService exhibitionBoardCatService; @Resource private CopyrightOwnerService copyrightOwnerService; + @Resource + private CopyrightOwnerBoardCatService copyrightOwnerBoardCatService; @PostMapping("/save") @RequiresAuthentication //@RequiresPermissions("exhibition:board:cat:save") @@ -111,14 +116,27 @@ public class ExhibitionBoardCatController extends BaseController { updateWrapper.set(ExhibitionBoard::getDeleted, true); this.exhibitionBoardService.update(updateWrapper); + //todo åˆ é™¤ä¸é—´å…³è”表 + return getSuccessResult(); } + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "copyrightOwnerId", value = "展æ¿å†…å®¹ç‰ˆæƒæ–¹ID", paramType = "query", dataType = "String") + }) @GetMapping("/getList") @RequiresAuthentication //@RequiresPermissions("exhibition:board:cat:list") @ApiOperation(value = "获å–展æ¿åˆ†ç±»å…¨éƒ¨åˆ—表(æ— åˆ†é¡µ)", notes = "获å–展æ¿åˆ†ç±»å…¨éƒ¨åˆ—表(æ— åˆ†é¡µ)") - public Map<String, Object> getExhibitionBoardCatList() { - List<ExhibitionBoardCat> exhibitionBoardCatList = exhibitionBoardCatService.list(Wrappers.<ExhibitionBoardCat>lambdaQuery().eq(ExhibitionBoardCat::getDeleted,false).orderByDesc(ExhibitionBoardCat::getCreateTime)); + public Map<String, Object> getExhibitionBoardCatList(@RequestParam(value = "copyrightOwnerId", required = false) String copyrightOwnerId) { + final LambdaQueryWrapper<ExhibitionBoardCat> exhibitionBoardCatLambdaQueryWrapper = Wrappers.<ExhibitionBoardCat>lambdaQuery().orderByDesc(ExhibitionBoardCat::getCreateTime); + if (StringUtils.isNotBlank(copyrightOwnerId)) { + final LambdaQueryWrapper<CopyrightOwnerBoardCat> queryWrapper = Wrappers.<CopyrightOwnerBoardCat>lambdaQuery().eq(CopyrightOwnerBoardCat::getCopyrightOwnerId, copyrightOwnerId); + queryWrapper.select(CopyrightOwnerBoardCat::getBoardCatId); + final List<String> boardCatIdList = this.copyrightOwnerBoardCatService.listObjs(queryWrapper, Objects::toString); + exhibitionBoardCatLambdaQueryWrapper.in(ExhibitionBoardCat::getId, boardCatIdList); + } + + List<ExhibitionBoardCat> exhibitionBoardCatList = exhibitionBoardCatService.list(exhibitionBoardCatLambdaQueryWrapper); return getResult(exhibitionBoardCatList); } diff --git a/src/main/java/cn/wisenergy/chnmuseum/party/web/controller/VideoContentCatController.java b/src/main/java/cn/wisenergy/chnmuseum/party/web/controller/VideoContentCatController.java index 49be66d..4a60d98 100644 --- a/src/main/java/cn/wisenergy/chnmuseum/party/web/controller/VideoContentCatController.java +++ b/src/main/java/cn/wisenergy/chnmuseum/party/web/controller/VideoContentCatController.java @@ -3,9 +3,11 @@ package cn.wisenergy.chnmuseum.party.web.controller; import cn.wisenergy.chnmuseum.party.common.validator.groups.Add; import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam; import cn.wisenergy.chnmuseum.party.model.CopyrightOwner; +import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerVideoContentCat; import cn.wisenergy.chnmuseum.party.model.VideoContent; import cn.wisenergy.chnmuseum.party.model.VideoContentCat; import cn.wisenergy.chnmuseum.party.service.CopyrightOwnerService; +import cn.wisenergy.chnmuseum.party.service.CopyrightOwnerVideoContentCatService; import cn.wisenergy.chnmuseum.party.service.VideoContentCatService; import cn.wisenergy.chnmuseum.party.service.VideoContentService; import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController; @@ -26,6 +28,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; @@ -43,6 +46,9 @@ import java.util.stream.Collectors; @Api(tags = {"视频内容分类接å£"}) public class VideoContentCatController extends BaseController { + @Resource + private CopyrightOwnerVideoContentCatService copyrightOwnerVideoContentCatService; + @Resource private VideoContentCatService videoContentCatService; @@ -77,11 +83,22 @@ public class VideoContentCatController extends BaseController { return getFailResult(); } + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "copyrightOwnerId", value = "è§†é¢‘å†…å®¹ç‰ˆæƒæ–¹ID", paramType = "query", dataType = "String") + }) @GetMapping("/getList") @RequiresAuthentication //@RequiresPermissions("video:content:cat:list") @ApiOperation(value = "获å–视频内容分类全部列表(æ— åˆ†é¡µ)", notes = "获å–视频内容分类全部列表(æ— åˆ†é¡µ)") - public Map<String, Object> getVideoContentCatList() { - List<VideoContentCat> videoContentCatList = videoContentCatService.list(Wrappers.<VideoContentCat>lambdaQuery().eq(VideoContentCat::getDeleted,false).orderByDesc(VideoContentCat::getCreateTime)); + public Map<String, Object> getVideoContentCatList(@RequestParam(value = "copyrightOwnerId", required = false) String copyrightOwnerId) { + final LambdaQueryWrapper<VideoContentCat> videoContentCatLambdaQueryWrapper = Wrappers.<VideoContentCat>lambdaQuery().orderByDesc(VideoContentCat::getCreateTime); + if (StringUtils.isNotBlank(copyrightOwnerId)) { + final LambdaQueryWrapper<CopyrightOwnerVideoContentCat> queryWrapper = Wrappers.<CopyrightOwnerVideoContentCat>lambdaQuery().eq(CopyrightOwnerVideoContentCat::getCopyrightOwnerId, copyrightOwnerId); + queryWrapper.select(CopyrightOwnerVideoContentCat::getVideoContentCatId); + final List<String> videoContentCatIdList = this.copyrightOwnerVideoContentCatService.listObjs(queryWrapper, Objects::toString); + videoContentCatLambdaQueryWrapper.in(VideoContentCat::getId, videoContentCatIdList); + } + + List<VideoContentCat> videoContentCatList = videoContentCatService.list(videoContentCatLambdaQueryWrapper); return getResult(videoContentCatList); } @@ -153,6 +170,8 @@ public class VideoContentCatController extends BaseController { updateWrapper.set(VideoContent::getDeleted, true); this.videoContentService.update(updateWrapper); + //todo åˆ é™¤ä¸é—´å…³è”表 + return getSuccessResult(); } diff --git a/src/main/resources/mapper/CopyrightOwnerBoardTypeMapper.xml b/src/main/resources/mapper/CopyrightOwnerBoardCatMapper.xml similarity index 54% rename from src/main/resources/mapper/CopyrightOwnerBoardTypeMapper.xml rename to src/main/resources/mapper/CopyrightOwnerBoardCatMapper.xml index ee45b8c..a6dde64 100644 --- a/src/main/resources/mapper/CopyrightOwnerBoardTypeMapper.xml +++ b/src/main/resources/mapper/CopyrightOwnerBoardCatMapper.xml @@ -1,17 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> -<mapper namespace="cn.wisenergy.chnmuseum.party.mapper.CopyrightOwnerBoardTypeMapper"> +<mapper namespace="cn.wisenergy.chnmuseum.party.mapper.CopyrightOwnerBoardCatMapper"> <!-- é€šç”¨æŸ¥è¯¢æ˜ å°„ç»“æžœ --> - <resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.CopyrightOwnerBoardType"> - <id column="id" property="id" /> - <result column="copyright_owner_id" property="copyrightOwnerId" /> - <result column="board_type_id" property="boardTypeId" /> - </resultMap> + <resultMap id="BaseResultMap" type="cn.wisenergy.chnmuseum.party.model.CopyrightOwnerBoardCat"> + <id column="id" property="id"/> + <result column="copyright_owner_id" property="copyrightOwnerId"/> + <result column="board_cat_id" property="boardCatId"/> + </resultMap> <!-- 通用查询结果列 --> <sql id="Base_Column_List"> - id, copyright_owner_id, board_type_id + id, copyright_owner_id, board_cat_id </sql> </mapper> -- 2.18.1