1. 完成通知模块的迁移

2. 实现 excel 导出的基础功能
This commit is contained in:
YunaiV 2021-01-13 21:49:32 +08:00
parent 6a36fe65b2
commit 02ff516f0f
13 changed files with 47 additions and 100 deletions

View File

@ -77,22 +77,6 @@ spring:
# #连接池最大阻塞等待时间(使用负值表示没有限制) # #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms max-wait: -1ms
# MyBatis配置
mybatis:
# 搜索指定包别名
typeAliasesPackage: com.ruoyi.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
# PageHelper分页插件
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countSql
# Swagger配置 # Swagger配置
swagger: swagger:
# 是否开启swagger # 是否开启swagger

View File

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-framework</artifactId>
<description>
framework框架核心
</description>
<dependencies>
<!-- SpringBoot 拦截器 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<!-- 获取系统信息 -->
<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -58,31 +58,16 @@ public class Cpu {
return Arith.round(Arith.mul(sys / total, 100), 2); return Arith.round(Arith.mul(sys / total, 100), 2);
} }
public void setSys(double sys) {
this.sys = sys;
}
public double getUsed() { public double getUsed() {
return Arith.round(Arith.mul(used / total, 100), 2); return Arith.round(Arith.mul(used / total, 100), 2);
} }
public void setUsed(double used) {
this.used = used;
}
public double getWait() { public double getWait() {
return Arith.round(Arith.mul(wait / total, 100), 2); return Arith.round(Arith.mul(wait / total, 100), 2);
} }
public void setWait(double wait) {
this.wait = wait;
}
public double getFree() { public double getFree() {
return Arith.round(Arith.mul(free / total, 100), 2); return Arith.round(Arith.mul(free / total, 100), 2);
} }
public void setFree(double free) {
this.free = free;
}
} }

View File

@ -30,7 +30,7 @@ export function addNotice(data) {
export function updateNotice(data) { export function updateNotice(data) {
return request({ return request({
url: '/system/notice/update', url: '/system/notice/update',
method: 'put', method: 'post',
data: data data: data
}) })
} }
@ -39,6 +39,6 @@ export function updateNotice(data) {
export function delNotice(noticeId) { export function delNotice(noticeId) {
return request({ return request({
url: '/system/notice/delete?id=' + noticeId, url: '/system/notice/delete?id=' + noticeId,
method: 'delete' method: 'post'
}) })
} }

View File

@ -49,7 +49,8 @@ export function exportUser(query) {
return request({ return request({
url: '/system/user/export', url: '/system/user/export',
method: 'get', method: 'get',
params: query params: query,
responseType: 'blob'
}) })
} }

View File

@ -49,7 +49,7 @@
</el-row> </el-row>
<el-table v-loading="loading" :data="noticeList"> <el-table v-loading="loading" :data="noticeList">
<el-table-column label="序号" align="center" prop="noticeId" width="100" /> <el-table-column label="序号" align="center" prop="id" width="100" />
<el-table-column <el-table-column
label="公告标题" label="公告标题"
align="center" align="center"
@ -117,11 +117,11 @@
<el-form-item label="公告类型" prop="type"> <el-form-item label="公告类型" prop="type">
<el-select v-model="form.type" placeholder="请选择"> <el-select v-model="form.type" placeholder="请选择">
<el-option <el-option
v-for="dict in typeOptions" v-for="dict in noticeTypeDictDatas"
:key="dict.dictValue" :key="parseInt(dict.value)"
:label="dict.dictLabel" :label="dict.label"
:value="dict.dictValue" :value="parseInt(dict.value)"
></el-option> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -131,9 +131,9 @@
<el-radio <el-radio
v-for="dict in statusDictDatas" v-for="dict in statusDictDatas"
:key="parseInt(dict.value)" :key="parseInt(dict.value)"
:label="dict.label" :label="parseInt(dict.value)"
:value="parseInt(dict.value)"
>{{dict.label}}</el-radio> >{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
@ -177,10 +177,6 @@ export default {
title: "", title: "",
// //
open: false, open: false,
//
statusOptions: [],
//
typeOptions: [],
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
@ -227,7 +223,7 @@ export default {
}, },
// //
typeFormat(row, column) { typeFormat(row, column) {
return getDictDataLabel(DICT_TYPE.SYS_NOTICE_TYPE, row.status) return getDictDataLabel(DICT_TYPE.SYS_NOTICE_TYPE, row.type)
}, },
// //
cancel() { cancel() {
@ -237,7 +233,7 @@ export default {
// //
reset() { reset() {
this.form = { this.form = {
noticeId: undefined, id: undefined,
title: undefined, title: undefined,
type: undefined, type: undefined,
content: undefined, content: undefined,
@ -264,8 +260,8 @@ export default {
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const noticeId = row.noticeId || this.ids const id = row.id || this.ids
getNotice(noticeId).then(response => { getNotice(id).then(response => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改公告"; this.title = "修改公告";
@ -275,7 +271,7 @@ export default {
submitForm: function() { submitForm: function() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.noticeId !== undefined) { if (this.form.id !== undefined) {
updateNotice(this.form).then(response => { updateNotice(this.form).then(response => {
this.msgSuccess("修改成功"); this.msgSuccess("修改成功");
this.open = false; this.open = false;
@ -293,13 +289,13 @@ export default {
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const noticeIds = row.noticeId || this.ids const ids = row.id || this.ids
this.$confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?', "警告", { this.$confirm('是否确认删除公告编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(function() { }).then(function() {
return delNotice(noticeIds); return delNotice(ids);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.msgSuccess("删除成功"); this.msgSuccess("删除成功");

View File

@ -655,7 +655,15 @@ export default {
}).then(function() { }).then(function() {
return exportUser(queryParams); return exportUser(queryParams);
}).then(response => { }).then(response => {
this.download(response.msg); // this.download(response.msg);
let blob = new Blob([response], {type: 'application/vnd.ms-excel'});
window.URL = window.URL || window.webkitURL;
let href = URL.createObjectURL(blob);
let downA = document.createElement("a");
downA.href = href;//
downA.download = '123321.xls';
downA.click();
window.URL.revokeObjectURL(href);
}) })
}, },
/** 导入按钮操作 */ /** 导入按钮操作 */

View File

@ -2,10 +2,10 @@ package cn.iocoder.dashboard.modules.system.controller.auth;
import cn.iocoder.dashboard.common.enums.CommonStatusEnum; import cn.iocoder.dashboard.common.enums.CommonStatusEnum;
import cn.iocoder.dashboard.common.pojo.CommonResult; import cn.iocoder.dashboard.common.pojo.CommonResult;
import cn.iocoder.dashboard.modules.system.controller.auth.vo.SysAuthMenuRespVO;
import cn.iocoder.dashboard.modules.system.controller.auth.vo.SysAuthPermissionInfoRespVO;
import cn.iocoder.dashboard.modules.system.controller.auth.vo.SysAuthLoginReqVO; import cn.iocoder.dashboard.modules.system.controller.auth.vo.SysAuthLoginReqVO;
import cn.iocoder.dashboard.modules.system.controller.auth.vo.SysAuthLoginRespVO; import cn.iocoder.dashboard.modules.system.controller.auth.vo.SysAuthLoginRespVO;
import cn.iocoder.dashboard.modules.system.controller.auth.vo.SysAuthMenuRespVO;
import cn.iocoder.dashboard.modules.system.controller.auth.vo.SysAuthPermissionInfoRespVO;
import cn.iocoder.dashboard.modules.system.convert.auth.SysAuthConvert; import cn.iocoder.dashboard.modules.system.convert.auth.SysAuthConvert;
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.permission.SysMenuDO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.permission.SysMenuDO;
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.permission.SysRoleDO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.permission.SysRoleDO;
@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Valid; import javax.validation.Valid;
import java.util.List; import java.util.List;
import static cn.iocoder.dashboard.common.pojo.CommonResult.success; import static cn.iocoder.dashboard.common.pojo.CommonResult.success;

View File

@ -1,6 +1,5 @@
package cn.iocoder.dashboard.modules.system.controller.notice.vo; package cn.iocoder.dashboard.modules.system.controller.notice.vo;
import cn.iocoder.dashboard.modules.system.controller.dept.vo.post.SysPostBaseVO;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -8,5 +7,5 @@ import lombok.EqualsAndHashCode;
@ApiModel("通知公告创建 Request VO") @ApiModel("通知公告创建 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysNoticeCreateReqVO extends SysPostBaseVO { public class SysNoticeCreateReqVO extends SysNoticeBaseVO {
} }

View File

@ -1,6 +1,5 @@
package cn.iocoder.dashboard.modules.system.controller.notice.vo; package cn.iocoder.dashboard.modules.system.controller.notice.vo;
import cn.iocoder.dashboard.modules.system.controller.dept.vo.post.SysPostBaseVO;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -11,7 +10,7 @@ import java.util.Date;
@ApiModel("通知公告信息 Response VO") @ApiModel("通知公告信息 Response VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysNoticeRespVO extends SysPostBaseVO { public class SysNoticeRespVO extends SysNoticeBaseVO {
@ApiModelProperty(value = "通知公告序号", required = true, example = "1024") @ApiModelProperty(value = "通知公告序号", required = true, example = "1024")
private Long id; private Long id;

View File

@ -1,6 +1,5 @@
package cn.iocoder.dashboard.modules.system.controller.notice.vo; package cn.iocoder.dashboard.modules.system.controller.notice.vo;
import cn.iocoder.dashboard.modules.system.controller.dept.vo.post.SysPostBaseVO;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -11,7 +10,7 @@ import javax.validation.constraints.NotNull;
@ApiModel("岗位公告更新 Request VO") @ApiModel("岗位公告更新 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysNoticeUpdateReqVO extends SysPostBaseVO { public class SysNoticeUpdateReqVO extends SysNoticeBaseVO {
@ApiModelProperty(value = "岗位公告编号", required = true, example = "1024") @ApiModelProperty(value = "岗位公告编号", required = true, example = "1024")
@NotNull(message = "岗位公告编号不能为空") @NotNull(message = "岗位公告编号不能为空")

View File

@ -10,6 +10,7 @@ import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.user.SysUserDO;
import cn.iocoder.dashboard.modules.system.service.dept.SysDeptService; import cn.iocoder.dashboard.modules.system.service.dept.SysDeptService;
import cn.iocoder.dashboard.modules.system.service.user.SysUserService; import cn.iocoder.dashboard.modules.system.service.user.SysUserService;
import cn.iocoder.dashboard.util.collection.CollectionUtils; import cn.iocoder.dashboard.util.collection.CollectionUtils;
import com.alibaba.excel.EasyExcel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -17,6 +18,8 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*; import java.util.*;
import static cn.iocoder.dashboard.common.pojo.CommonResult.success; import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
@ -116,6 +119,15 @@ public class SysUserController {
return success(true); return success(true);
} }
@ApiOperation("导出用户")
@GetMapping("/export")
public void exportUsers(HttpServletResponse response) throws IOException {
String fileName = "测试文件.xls";
response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
EasyExcel.write(response.getOutputStream(), SysUserExcelVO.class).sheet().doWrite(new ArrayList<>());
}
// @Log(title = "用户管理", businessType = BusinessType.EXPORT) // @Log(title = "用户管理", businessType = BusinessType.EXPORT)
// @PreAuthorize("@ss.hasPermi('system:user:export')") // @PreAuthorize("@ss.hasPermi('system:user:export')")
// @GetMapping("/export") // @GetMapping("/export")

View File

@ -5,7 +5,6 @@ import cn.iocoder.dashboard.common.pojo.PageResult;
import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeCreateReqVO; import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeCreateReqVO;
import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticePageReqVO; import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticePageReqVO;
import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeUpdateReqVO; import cn.iocoder.dashboard.modules.system.controller.notice.vo.SysNoticeUpdateReqVO;
import cn.iocoder.dashboard.modules.system.convert.dept.SysPostConvert;
import cn.iocoder.dashboard.modules.system.convert.notice.SysNoticeConvert; import cn.iocoder.dashboard.modules.system.convert.notice.SysNoticeConvert;
import cn.iocoder.dashboard.modules.system.dal.mysql.dao.notice.SysNoticeMapper; import cn.iocoder.dashboard.modules.system.dal.mysql.dao.notice.SysNoticeMapper;
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.notice.SysNoticeDO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.notice.SysNoticeDO;
@ -40,6 +39,7 @@ public class SysNoticeServiceImpl implements SysNoticeService {
@Override @Override
public Long createNotice(SysNoticeCreateReqVO reqVO) { public Long createNotice(SysNoticeCreateReqVO reqVO) {
SysNoticeDO notice = SysNoticeConvert.INSTANCE.convert(reqVO); SysNoticeDO notice = SysNoticeConvert.INSTANCE.convert(reqVO);
noticeMapper.insert(notice);
return notice.getId(); return notice.getId();
} }