Search in sources :

Example 6 with Storage

use of com.moxi.mogublog.commons.entity.Storage in project mogu_blog_v2 by moxi624.

the class StorageServiceImpl method getStorageByAdmin.

@Override
public Storage getStorageByAdmin() {
    HttpServletRequest request = RequestHolder.getRequest();
    String adminUid = request.getAttribute(SysConf.ADMIN_UID).toString();
    QueryWrapper<Storage> queryWrapper = new QueryWrapper<>();
    queryWrapper.eq(SysConf.STATUS, EStatus.ENABLE);
    queryWrapper.eq(SQLConf.ADMIN_UID, adminUid);
    queryWrapper.last(SysConf.LIMIT_ONE);
    Storage reStorage = storageService.getOne(queryWrapper);
    return reStorage;
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) Storage(com.moxi.mogublog.commons.entity.Storage) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)

Example 7 with Storage

use of com.moxi.mogublog.commons.entity.Storage in project mogu_blog_v2 by moxi624.

the class StorageServiceImpl method initStorageSize.

@Override
public String initStorageSize(String adminUid, Long maxStorageSize) {
    QueryWrapper<Storage> queryWrapper = new QueryWrapper<>();
    queryWrapper.eq(SQLConf.ADMIN_UID, adminUid);
    queryWrapper.last(SysConf.LIMIT_ONE);
    Storage storage = storageService.getOne(queryWrapper);
    if (storage != null) {
        return ResultUtil.errorWithMessage(MessageConf.ENTITY_EXIST);
    } else {
        Storage saveStorage = new Storage();
        saveStorage.setAdminUid(adminUid);
        saveStorage.setStorageSize(0L);
        saveStorage.setMaxStorageSize(maxStorageSize);
        saveStorage.insert();
        return ResultUtil.successWithMessage(MessageConf.OPERATION_SUCCESS);
    }
}
Also used : Storage(com.moxi.mogublog.commons.entity.Storage) QueryWrapper(com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)

Aggregations

Storage (com.moxi.mogublog.commons.entity.Storage)7 QueryWrapper (com.baomidou.mybatisplus.core.conditions.query.QueryWrapper)5 NetworkDisk (com.moxi.mogublog.commons.entity.NetworkDisk)2 UpdateException (com.moxi.mougblog.base.exception.exceptionType.UpdateException)2 ArrayList (java.util.ArrayList)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 IPage (com.baomidou.mybatisplus.core.metadata.IPage)1 Page (com.baomidou.mybatisplus.extension.plugins.pagination.Page)1 Admin (com.moxi.mogublog.commons.entity.Admin)1 File (com.moxi.mogublog.commons.entity.File)1 OnlineAdmin (com.moxi.mogublog.commons.entity.OnlineAdmin)1 Role (com.moxi.mogublog.commons.entity.Role)1 SystemConfig (com.moxi.mogublog.commons.entity.SystemConfig)1 QueryException (com.moxi.mougblog.base.exception.exceptionType.QueryException)1 Date (java.util.Date)1 MultipartFile (org.springframework.web.multipart.MultipartFile)1