专题资源的复制移动,分页查询
This commit is contained in:
parent
00626819c6
commit
50b5651e74
|
@ -44,6 +44,15 @@ public class SysOssResourceController extends BaseController {
|
|||
return sysOssResourceService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 待审核查询列表
|
||||
*/
|
||||
@SaCheckPermission("file:textbook:awaitList")
|
||||
@GetMapping("/await/pageList")
|
||||
public TableDataInfo<SysOssResourceVo> awaitList(SysOssResourceBo bo, PageQuery pageQuery) {
|
||||
return sysOssResourceService.queryAwaitPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取【请填写功能名称】详细信息
|
||||
*
|
||||
|
@ -95,10 +104,34 @@ public class SysOssResourceController extends BaseController {
|
|||
*
|
||||
* @param bo 主键串
|
||||
*/
|
||||
@SaCheckPermission("file:textbook:review")
|
||||
@SaCheckPermission("file:resource:review")
|
||||
@Log(title = "【审核专题资源】", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/review")
|
||||
public R<Void> review(@RequestBody SysOssResourceBo bo) {
|
||||
return toAjax(sysOssResourceService.reviewByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制
|
||||
*
|
||||
* @param bo 主键串
|
||||
*/
|
||||
@SaCheckPermission("file:resource:copy")
|
||||
@Log(title = "【复制专题资源】", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/copy")
|
||||
public R<Void> copy(@RequestBody SysOssResourceBo bo) {
|
||||
return toAjax(sysOssResourceService.copyByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 移动
|
||||
*
|
||||
* @param bo 主键串
|
||||
*/
|
||||
@SaCheckPermission("file:resource:move")
|
||||
@Log(title = "【移动专题资源】", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/move")
|
||||
public R<Void> move(@RequestBody SysOssResourceBo bo) {
|
||||
return toAjax(sysOssResourceService.moveByBo(bo));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public class SysOssTextbookController extends BaseController {
|
|||
* 待审核查询列表
|
||||
*/
|
||||
@SaCheckPermission("file:textbook:awaitList")
|
||||
@GetMapping("await/pageList")
|
||||
@GetMapping("/await/pageList")
|
||||
public TableDataInfo<SysOssTextbookVo> awaitList(SysOssTextbookBo bo, PageQuery pageQuery) {
|
||||
return sysOssTextbookService.queryAwaitPageList(bo, pageQuery);
|
||||
}
|
||||
|
|
|
@ -6,8 +6,11 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.common.mybatis.annotation.DataColumn;
|
||||
import org.dromara.common.mybatis.annotation.DataPermission;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.system.domain.SysOssResource;
|
||||
import org.dromara.system.domain.SysOssTextbook;
|
||||
import org.dromara.system.domain.vo.SysOssResourceVo;
|
||||
|
||||
/**
|
||||
|
@ -18,6 +21,12 @@ import org.dromara.system.domain.vo.SysOssResourceVo;
|
|||
*/
|
||||
@Mapper
|
||||
public interface SysOssResourceMapper extends BaseMapperPlus<SysOssResource, SysOssResourceVo> {
|
||||
Page<SysOssResourceVo> selectPageUserList(@Param("page") Page<SysOssResource> page,
|
||||
Page<SysOssResourceVo> selectPageList(@Param("page") Page<SysOssResource> page,
|
||||
@Param(Constants.WRAPPER) Wrapper<SysOssResource> queryWrapper);
|
||||
|
||||
@DataPermission({
|
||||
@DataColumn(key = "userName", value = "create_by")
|
||||
})
|
||||
Page<SysOssResourceVo> selectPageAwaitList(@Param("page") Page<SysOssTextbook> page,
|
||||
@Param(Constants.WRAPPER) Wrapper<SysOssTextbook> queryWrapper);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,15 @@ public interface ISysOssResourceService {
|
|||
*/
|
||||
TableDataInfo<SysOssResourceVo> queryPageList(SysOssResourceBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 待审核查询列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 【请填写功能名称】分页列表
|
||||
*/
|
||||
TableDataInfo<SysOssResourceVo> queryAwaitPageList(SysOssResourceBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的【请填写功能名称】列表
|
||||
*
|
||||
|
@ -68,4 +77,7 @@ public interface ISysOssResourceService {
|
|||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
Boolean reviewByBo(SysOssResourceBo bo);
|
||||
|
||||
Boolean copyByBo(SysOssResourceBo bo);
|
||||
Boolean moveByBo(SysOssResourceBo bo);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|||
import org.dromara.common.mybatis.helper.DataBaseHelper;
|
||||
import org.dromara.system.domain.SysCatalogResource;
|
||||
import org.dromara.system.domain.SysOssResource;
|
||||
import org.dromara.system.domain.SysOssTextbook;
|
||||
import org.dromara.system.domain.bo.SysOssResourceBo;
|
||||
import org.dromara.system.domain.vo.SysCatalogResourceVo;
|
||||
import org.dromara.system.domain.vo.SysOssResourceVo;
|
||||
|
@ -64,7 +65,16 @@ public class SysOssResourceServiceImpl implements ISysOssResourceService {
|
|||
*/
|
||||
@Override
|
||||
public TableDataInfo<SysOssResourceVo> queryPageList(SysOssResourceBo bo, PageQuery pageQuery) {
|
||||
Page<SysOssResourceVo> result = baseMapper.selectPageUserList(pageQuery.build(), this.buildQueryWrapper(bo));
|
||||
bo.setStatus(1);
|
||||
Page<SysOssResourceVo> result = baseMapper.selectPageList(pageQuery.build(), this.buildQueryWrapper(bo));
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<SysOssResourceVo> queryAwaitPageList(SysOssResourceBo bo, PageQuery pageQuery) {
|
||||
QueryWrapper<SysOssTextbook> wrapper = Wrappers.query();
|
||||
wrapper.le("ot.status", 0);
|
||||
Page<SysOssResourceVo> result = baseMapper.selectPageAwaitList(pageQuery.build(), wrapper);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
|
@ -132,9 +142,9 @@ public class SysOssResourceServiceImpl implements ISysOssResourceService {
|
|||
private void validEntityBeforeSave(SysOssResource entity) {
|
||||
SysOssVo ossVo = ossService.getById(entity.getOssId());
|
||||
if (ObjectUtil.isNull(ossVo)) {
|
||||
throw new ServiceException("资源文件不存在");
|
||||
throw new ServiceException("文件不存在");
|
||||
}
|
||||
SysCatalogResourceVo ossResource = catalogService.selectCatalogById(entity.getCatalogId());
|
||||
SysCatalogResourceVo ossResource = catalogService.selectCatalogById(entity.getCatalogId());
|
||||
if (ObjectUtil.isNull(ossResource)) {
|
||||
throw new ServiceException("资源目录不存在");
|
||||
}
|
||||
|
@ -163,4 +173,31 @@ public class SysOssResourceServiceImpl implements ISysOssResourceService {
|
|||
date.setStatus(bo.getStatus());
|
||||
return baseMapper.updateById(date) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean copyByBo(SysOssResourceBo bo) {
|
||||
SysOssResource copy = processDate(bo);
|
||||
validEntityBeforeSave(copy);
|
||||
return baseMapper.insert(copy) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean moveByBo(SysOssResourceBo bo) {
|
||||
SysOssResource move = processDate(bo);
|
||||
baseMapper.insert(move);
|
||||
validEntityBeforeSave(move);
|
||||
return baseMapper.deleteById(bo.getId()) > 0;
|
||||
}
|
||||
|
||||
private SysOssResource processDate(SysOssResourceBo bo) {
|
||||
SysOssResource ossResource = baseMapper.selectById(bo.getId());
|
||||
SysOssResource date = new SysOssResource();
|
||||
date.setOssId(ossResource.getOssId());
|
||||
String path = catalogService.selectCatalogNameById(bo.getCatalogId());
|
||||
date.setCatalogId(bo.getCatalogId());
|
||||
date.setFileName(ossResource.getFileName());
|
||||
date.setFilePath(path);
|
||||
date.setStatus(ossResource.getStatus());
|
||||
return date;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.system.mapper.SysOssResourceMapper">
|
||||
|
||||
<select id="selectPageUserList" resultType="org.dromara.system.domain.vo.SysOssResourceVo">
|
||||
select *
|
||||
<select id="selectPageList" resultType="org.dromara.system.domain.vo.SysOssResourceVo">
|
||||
select r.*, o.file_suffix, o.volume
|
||||
from sys_oss_resource r
|
||||
left join sys_catalog_resource cr on cr.catalog_id = r.catalog_id
|
||||
${ew.getCustomSqlSegment}
|
||||
left join sys_oss o on o.oss_id = r.oss_id
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
<select id="selectPageAwaitList" resultType="org.dromara.system.domain.vo.SysOssResourceVo">
|
||||
select r.*, o.file_suffix, o.volume
|
||||
from sys_oss_resource r
|
||||
left join sys_oss o on o.oss_id = r.oss_id
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue