mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 17:21:53 +08:00
1. 完成通知模块的迁移
2. 实现 excel 导出的基础功能
This commit is contained in:
parent
6a36fe65b2
commit
02ff516f0f
@ -77,22 +77,6 @@ spring:
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
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
|
||||
|
@ -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>
|
@ -58,31 +58,16 @@ public class Cpu {
|
||||
return Arith.round(Arith.mul(sys / total, 100), 2);
|
||||
}
|
||||
|
||||
public void setSys(double sys) {
|
||||
this.sys = sys;
|
||||
}
|
||||
|
||||
public double getUsed() {
|
||||
return Arith.round(Arith.mul(used / total, 100), 2);
|
||||
}
|
||||
|
||||
public void setUsed(double used) {
|
||||
this.used = used;
|
||||
}
|
||||
|
||||
public double getWait() {
|
||||
return Arith.round(Arith.mul(wait / total, 100), 2);
|
||||
}
|
||||
|
||||
public void setWait(double wait) {
|
||||
this.wait = wait;
|
||||
}
|
||||
|
||||
public double getFree() {
|
||||
return Arith.round(Arith.mul(free / total, 100), 2);
|
||||
}
|
||||
|
||||
public void setFree(double free) {
|
||||
this.free = free;
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ export function addNotice(data) {
|
||||
export function updateNotice(data) {
|
||||
return request({
|
||||
url: '/system/notice/update',
|
||||
method: 'put',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
@ -39,6 +39,6 @@ export function updateNotice(data) {
|
||||
export function delNotice(noticeId) {
|
||||
return request({
|
||||
url: '/system/notice/delete?id=' + noticeId,
|
||||
method: 'delete'
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
@ -49,7 +49,8 @@ export function exportUser(query) {
|
||||
return request({
|
||||
url: '/system/user/export',
|
||||
method: 'get',
|
||||
params: query
|
||||
params: query,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
||||
</el-row>
|
||||
|
||||
<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
|
||||
label="公告标题"
|
||||
align="center"
|
||||
@ -117,11 +117,11 @@
|
||||
<el-form-item label="公告类型" prop="type">
|
||||
<el-select v-model="form.type" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="dict in typeOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictLabel"
|
||||
:value="dict.dictValue"
|
||||
></el-option>
|
||||
v-for="dict in noticeTypeDictDatas"
|
||||
:key="parseInt(dict.value)"
|
||||
:label="dict.label"
|
||||
:value="parseInt(dict.value)"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@ -131,9 +131,9 @@
|
||||
<el-radio
|
||||
v-for="dict in statusDictDatas"
|
||||
:key="parseInt(dict.value)"
|
||||
:label="dict.label"
|
||||
:value="parseInt(dict.value)"
|
||||
:label="parseInt(dict.value)"
|
||||
>{{dict.label}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
@ -177,10 +177,6 @@ export default {
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 类型数据字典
|
||||
statusOptions: [],
|
||||
// 状态数据字典
|
||||
typeOptions: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
@ -227,7 +223,7 @@ export default {
|
||||
},
|
||||
// 公告状态字典翻译
|
||||
typeFormat(row, column) {
|
||||
return getDictDataLabel(DICT_TYPE.SYS_NOTICE_TYPE, row.status)
|
||||
return getDictDataLabel(DICT_TYPE.SYS_NOTICE_TYPE, row.type)
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
@ -237,7 +233,7 @@ export default {
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
noticeId: undefined,
|
||||
id: undefined,
|
||||
title: undefined,
|
||||
type: undefined,
|
||||
content: undefined,
|
||||
@ -264,8 +260,8 @@ export default {
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const noticeId = row.noticeId || this.ids
|
||||
getNotice(noticeId).then(response => {
|
||||
const id = row.id || this.ids
|
||||
getNotice(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改公告";
|
||||
@ -275,7 +271,7 @@ export default {
|
||||
submitForm: function() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.noticeId !== undefined) {
|
||||
if (this.form.id !== undefined) {
|
||||
updateNotice(this.form).then(response => {
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
@ -293,13 +289,13 @@ export default {
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const noticeIds = row.noticeId || this.ids
|
||||
this.$confirm('是否确认删除公告编号为"' + noticeIds + '"的数据项?', "警告", {
|
||||
const ids = row.id || this.ids
|
||||
this.$confirm('是否确认删除公告编号为"' + ids + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
return delNotice(noticeIds);
|
||||
return delNotice(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
|
@ -655,7 +655,15 @@ export default {
|
||||
}).then(function() {
|
||||
return exportUser(queryParams);
|
||||
}).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);
|
||||
})
|
||||
},
|
||||
/** 导入按钮操作 */
|
||||
|
@ -2,10 +2,10 @@ package cn.iocoder.dashboard.modules.system.controller.auth;
|
||||
|
||||
import cn.iocoder.dashboard.common.enums.CommonStatusEnum;
|
||||
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.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.dal.mysql.dataobject.permission.SysMenuDO;
|
||||
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.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
|
||||
|
@ -1,6 +1,5 @@
|
||||
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 lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@ -8,5 +7,5 @@ import lombok.EqualsAndHashCode;
|
||||
@ApiModel("通知公告创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysNoticeCreateReqVO extends SysPostBaseVO {
|
||||
public class SysNoticeCreateReqVO extends SysNoticeBaseVO {
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
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.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@ -11,7 +10,7 @@ import java.util.Date;
|
||||
@ApiModel("通知公告信息 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysNoticeRespVO extends SysPostBaseVO {
|
||||
public class SysNoticeRespVO extends SysNoticeBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "通知公告序号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
@ -1,6 +1,5 @@
|
||||
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.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@ -11,7 +10,7 @@ import javax.validation.constraints.NotNull;
|
||||
@ApiModel("岗位公告更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysNoticeUpdateReqVO extends SysPostBaseVO {
|
||||
public class SysNoticeUpdateReqVO extends SysNoticeBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "岗位公告编号", required = true, example = "1024")
|
||||
@NotNull(message = "岗位公告编号不能为空")
|
||||
|
@ -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.user.SysUserService;
|
||||
import cn.iocoder.dashboard.util.collection.CollectionUtils;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -17,6 +18,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static cn.iocoder.dashboard.common.pojo.CommonResult.success;
|
||||
@ -116,6 +119,15 @@ public class SysUserController {
|
||||
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)
|
||||
// @PreAuthorize("@ss.hasPermi('system:user:export')")
|
||||
// @GetMapping("/export")
|
||||
|
@ -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.SysNoticePageReqVO;
|
||||
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.dal.mysql.dao.notice.SysNoticeMapper;
|
||||
import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.notice.SysNoticeDO;
|
||||
@ -40,6 +39,7 @@ public class SysNoticeServiceImpl implements SysNoticeService {
|
||||
@Override
|
||||
public Long createNotice(SysNoticeCreateReqVO reqVO) {
|
||||
SysNoticeDO notice = SysNoticeConvert.INSTANCE.convert(reqVO);
|
||||
noticeMapper.insert(notice);
|
||||
return notice.getId();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user