Commit 3f92ab88 authored by liqin's avatar liqin 💬

bug fixed

parent 8263f466
......@@ -3,7 +3,7 @@ package cn.wisenergy.chnmuseum.party.common.mybatis;
public class MysqlGenerator {
private static final String[] tableNames = new String[]{
"copyright_owner_video_content_cat"
"asset"
};
// private static final String projectPath = "D:\\develop\\Project\\chnmuseum-party";
private static final String projectPath = "/opt/ss";
......
......@@ -2,6 +2,8 @@ package cn.wisenergy.chnmuseum.party.mapper;
import cn.wisenergy.chnmuseum.party.model.Asset;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Select;
/**
* <p>
......@@ -13,4 +15,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface AssetMapper extends BaseMapper<Asset> {
@Select("SELECT a.*, co.`name` AS video_content_copyright_owner_name, vcc.`name` AS video_content_cat_name " +
"FROM asset a, video_content vc, copyright_owner co, video_content_cat vcc" +
"where a.ref_item_id = vc.id " +
"and vc.video_content_cat_id = vcc.id " +
"and vc.video_content_copyright_owner_id = vcc.co " +
"<if test='videoContentCatId != null'>and vcc.id = #{videoContentCatId} </if>" +
"<if test='videoContentCopyrightOwnerId != null'>and co.id = #{videoContentCopyrightOwnerId} </if>")
Page<Asset> selectPageByConditions(Page<Object> page, String videoContentCatId, String videoContentCopyrightOwnerId);
}
......@@ -97,4 +97,12 @@ public class Asset implements Serializable {
@TableField(exist = false)
private String exhibitionBoardCover;
@ApiModelProperty("视频类别")
@TableField(exist = false)
private String videoContentCatName;
@ApiModelProperty("视频版权方")
@TableField(exist = false)
private String videoContentCopyrightOwnerName;
}
package cn.wisenergy.chnmuseum.party.service;
import cn.wisenergy.chnmuseum.party.model.Asset;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
/**
......@@ -13,4 +14,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface AssetService extends IService<Asset> {
Page<Asset> pageByConditions(Page<Object> page, String videoContentCatId, String videoContentCopyrightOwnerId);
}
......@@ -3,9 +3,12 @@ package cn.wisenergy.chnmuseum.party.service.impl;
import cn.wisenergy.chnmuseum.party.mapper.AssetMapper;
import cn.wisenergy.chnmuseum.party.model.Asset;
import cn.wisenergy.chnmuseum.party.service.AssetService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* <p>
* 视频 服务实现类
......@@ -17,4 +20,12 @@ import org.springframework.stereotype.Service;
@Service
public class AssetServiceImpl extends ServiceImpl<AssetMapper, Asset> implements AssetService {
@Resource
private AssetMapper assetMapper;
@Override
public Page<Asset> pageByConditions(Page<Object> page, String videoContentCatId, String videoContentCopyrightOwnerId) {
return assetMapper.selectPageByConditions(page, videoContentCatId, videoContentCopyrightOwnerId);
}
}
package cn.wisenergy.chnmuseum.party.web.controller;
import cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam;
import cn.wisenergy.chnmuseum.party.model.Asset;
import cn.wisenergy.chnmuseum.party.service.AssetService;
import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Map;
/**
* <pre>
* 文件资产 前端控制器
* </pre>
*
* @author Danny Lee
* @since 2021-04-06
*/
@Slf4j
@RestController
@RequestMapping("/asset")
@Api(tags = {"文件资产操作接口"})
public class AssetController extends BaseController {
@Resource
private AssetService assetService;
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "nameOrCode", value = "视频文件名", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "videoContentCatId", value = "视频内容分类ID", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "videoContentCopyrightOwnerId", value = "视频内容版权方ID", paramType = "query", dataType = "String")
})
@PostMapping("/getPageList")
@RequiresPermissions("asset:page")
@ApiOperation(value = "获取文件资产分页列表", notes = "获取文件资产分页列表")
public Map<String, Object> getAssetPageList(GenericPageParam genericPageParam,
@RequestParam(value = "videoContentCatId", required = false) String videoContentCatId,
@RequestParam(value = "videoContentCopyrightOwnerId", required = false) String videoContentCopyrightOwnerId) {
LambdaQueryWrapper<Asset> ew = new LambdaQueryWrapper<>();
// 对名称或编码模糊查询
if (StringUtils.isNotBlank(genericPageParam.getNameOrCode())) {
ew.like(Asset::getFileName, genericPageParam.getNameOrCode());
}
// 设置排序规则
ew.orderByDesc(Asset::getCreateTime);
// 设置查询内容
ew.select(
Asset::getId,
Asset::getFileName,
Asset::getFileExtName,
Asset::getFileCat,
Asset::getFileSize,
Asset::getFileType,
Asset::getFileUrl,
Asset::getLanguage,
Asset::getVideoContentCopyrightOwnerName,
Asset::getVideoContentCatName,
Asset::getCreateTime,
Asset::getUpdateTime);
Page<Asset> page = this.assetService.pageByConditions(getPage(), videoContentCatId, videoContentCopyrightOwnerId);
return getResult(page);
}
@ApiOperation(value = "获取文件资产详情", notes = "获取文件资产详情")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "标识ID", dataType = "String", paramType = "path")
})
@GetMapping("/get/{id}")
@RequiresPermissions("asset:get:id")
public Map<String, Object> getById(@PathVariable("id") String id) {
Asset asset = assetService.getById(id);
return getResult(asset);
}
}
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