Commit 9c3609e8 by 284718418@qq.com

1.云盘-我空间业务代码

parent a27e7f3e
......@@ -143,4 +143,20 @@ public class DiskCatalogue extends Model<DiskCatalogue> {
@TableField(exist = false)
private List<DiskCatalogue> breadcrumb;
/**
* 用户类型:0.超级管理员,1.管理员,2.普通用户
*/
@ApiModelProperty(value = "用户类型:0.超级管理员,1.管理员,2.普通用户")
@Transient
@TableField(exist = false)
private Integer userRole;
/**
* 用户权限:r查看,w编辑,x删除,d下载:例如rwxd
*/
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "用户权限:r查看,w编辑,x删除,d下载:例如rwxd")
private String userPower;
}
package cn.timer.api.bean.disk;
import cn.timer.api.config.annotation.UserBean;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
......@@ -84,4 +85,22 @@ public class DiskCloudDiskUser extends Model<DiskCloudDiskUser> {
*/
@ApiModelProperty(value = "逻辑删除标记0.未删除 1.删除")
private Integer deleteFlag;
public String getUserPower() {
return userPower;
}
public void setUserPower(String userPower) {
switch (this.userRole){
case 0:
this.userPower="rwxd";
break;
case 1:
this.userPower="rwd";
break;
case 2:
this.userPower="rd";
break;
}
}
}
......@@ -23,9 +23,7 @@ public interface DiskCatalogueService {
/**
* 我的文件夹
* @param orgId
* @param userId
* @param type
* @param diskCatalogueParam
* @return
*/
List<DiskCatalogue> getDiskCatalogue(DiskCatalogueParam diskCatalogueParam);
......
package cn.timer.api.controller.disk.sevice;
import cn.timer.api.bean.disk.DiskCatalogue;
import cn.timer.api.bean.disk.DiskCloudDiskUser;
import cn.timer.api.bean.disk.DiskFiles;
import cn.timer.api.dto.disk.DiskCatalogueDto;
import cn.timer.api.dto.disk.DiskCatalogueParam;
import java.util.List;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022/1/4
*/
public interface DiskCloudDiskUserService {
/**
* 判断用户是否拥有该权限
* @param diskCatalogueDto
* @return
*/
boolean getDiskUserRole(DiskCatalogueDto diskCatalogueDto, DiskCatalogue catalogue);
}
package cn.timer.api.controller.disk.sevice;
import cn.timer.api.bean.disk.DiskCatalogue;
import cn.timer.api.bean.disk.DiskCloudDiskUser;
import cn.timer.api.config.enuminterface.JxglEnumInterface;
import cn.timer.api.dao.disk.DiskCloudDiskUserMapper;
import cn.timer.api.dto.disk.DiskCatalogueDto;
import cn.timer.api.utils.ResultUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
/**
* @author wuqingjun
* @email 284718418@qq.com
* @date 2021/12/29
*/
@Service
public class DiskCloudDiskUserServiceImpl implements DiskCloudDiskUserService {
@Resource
private DiskCloudDiskUserMapper diskCloudDiskUserMapper;
@Override
public boolean getDiskUserRole(DiskCatalogueDto diskCatalogueDto, DiskCatalogue catalogue) {
if(StringUtils.isEmpty(catalogue) || StringUtils.isEmpty(diskCatalogueDto)){
return false;
}
if(catalogue.getCreateUserId().equals(diskCatalogueDto.getUserId())){
return true;
}
DiskCloudDiskUser dcdUser = DiskCloudDiskUser.builder().build().selectOne(new QueryWrapper<DiskCloudDiskUser>()
.lambda().eq(DiskCloudDiskUser::getUserId,diskCatalogueDto.getUserId()));
if(StringUtils.isEmpty(dcdUser)){
return false;
}
return false;
}
}
package cn.timer.api.dto.disk;
import cn.timer.api.bean.disk.DiskCloudDiskUser;
import cn.timer.api.config.exception.ValidationMsg;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -10,6 +11,7 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
/**
* @author wuqingjun
......@@ -63,4 +65,12 @@ public class DiskCatalogueDto implements Serializable{
*/
@ApiModelProperty(value = "备注信息")
private String remark;
/**
* 用户ID
*/
@ApiModelProperty(value = "用户ID")
private Integer userId;
@ApiModelProperty(value = "云空间成员")
List<DiskCloudDiskUser> diskCloudDiskUsers;
}
......@@ -26,6 +26,9 @@
LEFT JOIN disk_catalogue_files cf ON f.id=cf.files_id AND cf.id > 0
WHERE f.delete_flag=0 AND cf.delete_flag = 0
AND f.create_user_id = #{param.userId} AND cf.catalogue_id=#{param.parentId}
<if test="param.searchName != null and param.searchName != ''">
AND f.title like CONCAT('%',#{param.searchName},'%')
</if>
ORDER BY f.create_time DESC
</select>
......
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