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;
}
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);
}
}
Aggregations