Commit 0a8d9a38 authored by liqin's avatar liqin 💬

bug fixed

parent 346e6661
......@@ -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";
......
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;
import cn.wisenergy.chnmuseum.party.model.CopyrightOwnerBoardCat;
/**
* <pre>
......@@ -10,9 +9,8 @@ import org.springframework.stereotype.Repository;
* </pre>
*
* @author Danny Lee
* @since 2021-03-18
* @since 2021-04-12
*/
@Repository
public interface CopyrightOwnerBoardTypeMapper extends BaseMapper<CopyrightOwnerBoardType> {
public interface CopyrightOwnerBoardCatMapper extends BaseMapper<CopyrightOwnerBoardCat> {
}
......@@ -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;
}
......@@ -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;
}
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> {
}
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 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>
......@@ -13,10 +16,13 @@ import org.springframework.stereotype.Service;
* </pre>
*
* @author Danny Lee
* @since 2021-03-18
* @since 2021-04-12
*/
@Slf4j
@Service
public class CopyrightOwnerBoardTypeServiceImpl extends ServiceImpl<CopyrightOwnerBoardTypeMapper, CopyrightOwnerBoardType> implements CopyrightOwnerBoardTypeService {
public class CopyrightOwnerBoardCatServiceImpl extends ServiceImpl<CopyrightOwnerBoardCatMapper, CopyrightOwnerBoardCat> implements CopyrightOwnerBoardCatService {
@Autowired
private CopyrightOwnerBoardCatMapper copyrightOwnerBoardCatMapper;
}
......@@ -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();
}
......
......@@ -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);
}
......
......@@ -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();
}
......
<?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>
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