代码优化
This commit is contained in:
@@ -33,7 +33,6 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -49,13 +48,6 @@ public class DeptController {
|
||||
private final DeptService deptService;
|
||||
private static final String ENTITY_NAME = "dept";
|
||||
|
||||
@ApiOperation("导出部门数据")
|
||||
@GetMapping(value = "/download")
|
||||
@SaCheckPermission("dept:list")
|
||||
public void download(HttpServletResponse response, DeptQueryCriteria criteria) throws Exception {
|
||||
deptService.download(deptService.queryAll(criteria, false), response);
|
||||
}
|
||||
|
||||
@ApiOperation("查询部门")
|
||||
@GetMapping
|
||||
@SaCheckPermission(value = {"user:list", "dept:list"}, mode = SaMode.AND)
|
||||
@@ -116,4 +108,4 @@ public class DeptController {
|
||||
deptService.delete(deptDtos);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -54,13 +53,6 @@ public class MenuController {
|
||||
private final MenuMapper menuMapper;
|
||||
private static final String ENTITY_NAME = "menu";
|
||||
|
||||
@ApiOperation("导出菜单数据")
|
||||
@GetMapping(value = "/download")
|
||||
@SaCheckPermission("menu:list")
|
||||
public void download(HttpServletResponse response, MenuQueryCriteria criteria) throws Exception {
|
||||
menuService.download(menuService.queryAll(criteria, false), response);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/build")
|
||||
@ApiOperation("获取前端所需菜单")
|
||||
public ResponseEntity<Object> buildMenus(){
|
||||
|
||||
@@ -19,8 +19,6 @@ import org.nl.modules.system.domain.Dept;
|
||||
import org.nl.modules.system.service.dto.DeptDto;
|
||||
import org.nl.modules.system.service.dto.DeptQueryCriteria;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -93,14 +91,6 @@ public interface DeptService {
|
||||
*/
|
||||
Set<Dept> findByRoleId(Long id);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
* @param queryAll 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<DeptDto> queryAll, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 获取待删除的部门
|
||||
|
||||
@@ -19,8 +19,6 @@ import org.nl.modules.system.domain.Menu;
|
||||
import org.nl.modules.system.service.dto.MenuDto;
|
||||
import org.nl.modules.system.service.dto.MenuQueryCriteria;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -93,14 +91,6 @@ public interface MenuService {
|
||||
*/
|
||||
void delete(Set<Menu> menuSet);
|
||||
|
||||
/**
|
||||
* 导出
|
||||
* @param queryAll 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<MenuDto> queryAll, HttpServletResponse response) throws IOException;
|
||||
|
||||
/**
|
||||
* 懒加载菜单数据
|
||||
* @param pid /
|
||||
|
||||
@@ -23,7 +23,10 @@ import cn.hutool.db.Entity;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.*;
|
||||
import org.nl.modules.common.utils.CacheKey;
|
||||
import org.nl.modules.common.utils.QueryHelp;
|
||||
import org.nl.modules.common.utils.RedisUtils;
|
||||
import org.nl.modules.common.utils.ValidationUtil;
|
||||
import org.nl.modules.system.domain.Dept;
|
||||
import org.nl.modules.system.domain.User;
|
||||
import org.nl.modules.system.repository.DeptRepository;
|
||||
@@ -41,9 +44,7 @@ import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.sql.DataSource;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
@@ -157,19 +158,6 @@ public class DeptServiceImpl implements DeptService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<DeptDto> deptDtos, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (DeptDto deptDTO : deptDtos) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("部门名称", deptDTO.getName());
|
||||
map.put("部门状态", deptDTO.getEnabled() ? "启用" : "停用");
|
||||
map.put("创建日期", deptDTO.getCreateTime());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<DeptDto> getDeleteDepts(List<Dept> menuList, Set<DeptDto> deptDtos) {
|
||||
for (Dept dept : menuList) {
|
||||
|
||||
@@ -20,7 +20,6 @@ import cn.hutool.core.util.StrUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.exception.EntityExistException;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
import org.nl.modules.common.utils.QueryHelp;
|
||||
import org.nl.modules.common.utils.RedisUtils;
|
||||
import org.nl.modules.common.utils.ValidationUtil;
|
||||
@@ -43,8 +42,6 @@ import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -319,23 +316,6 @@ public class MenuServiceImpl implements MenuService {
|
||||
return menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<MenuDto> menuDtos, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (MenuDto menuDTO : menuDtos) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("菜单标题", menuDTO.getTitle());
|
||||
map.put("菜单类型", menuDTO.getType() == null ? "目录" : menuDTO.getType() == 1 ? "菜单" : "按钮");
|
||||
map.put("权限标识", menuDTO.getPermission());
|
||||
map.put("外链菜单", menuDTO.getIFrame() ? "是" : "否");
|
||||
map.put("菜单可见", menuDTO.getHidden() ? "否" : "是");
|
||||
map.put("是否缓存", menuDTO.getCache() ? "是" : "否");
|
||||
map.put("创建日期", menuDTO.getCreateTime());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
private void updateSubCnt(Long menuId) {
|
||||
if (menuId != null) {
|
||||
int count = menuRepository.countByPid(menuId);
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,56 @@
|
||||
[交易说明]
|
||||
交易名: 部门数据
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.grid_name TYPEAS s_string
|
||||
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
sys_grid_field.*, sys_grid.name as grid_name
|
||||
FROM
|
||||
sys_grid_field
|
||||
LEFT JOIN sys_grid ON sys_grid_field.grid_id = sys_grid.id
|
||||
WHERE
|
||||
sys_grid_field.is_delete = '0' AND sys_grid.is_delete = '0'
|
||||
OPTION 输入.grid_name <> ""
|
||||
sys_grid.name LIKE 输入.grid_name
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
@@ -13,7 +13,6 @@
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
<date-range-picker v-model="query.createTime" class="date-item" />
|
||||
<el-select
|
||||
v-model="query.enabled"
|
||||
clearable
|
||||
@@ -147,7 +146,6 @@ import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import DateRangePicker from '@/components/DateRangePicker'
|
||||
|
||||
const defaultForm = {
|
||||
id: null,
|
||||
@@ -163,7 +161,7 @@ const defaultForm = {
|
||||
}
|
||||
export default {
|
||||
name: 'Dept',
|
||||
components: { Treeselect, crudOperation, rrOperation, udOperation, DateRangePicker },
|
||||
components: { Treeselect, crudOperation, rrOperation, udOperation },
|
||||
cruds() {
|
||||
return CRUD({ title: '部门', url: 'api/dept', crudMethod: { ...crudDept }})
|
||||
},
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-input v-model="query.blurry" clearable size="mini" placeholder="模糊搜索" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
||||
<date-range-picker v-model="query.createTime" class="date-item" />
|
||||
<rrOperation />
|
||||
</div>
|
||||
<crudOperation :permission="permission" />
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-input v-model="query.jobName" clearable size="mini" placeholder="输入任务名称搜索" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" />
|
||||
<date-range-picker v-model="query.createTime" class="date-item" />
|
||||
<rrOperation />
|
||||
</div>
|
||||
<crudOperation :permission="permission">
|
||||
@@ -85,7 +84,7 @@
|
||||
<el-table-column show-overflow-tooltip prop="beanName" label="Bean名称" />
|
||||
<el-table-column show-overflow-tooltip prop="methodName" label="执行方法" />
|
||||
<el-table-column show-overflow-tooltip prop="params" label="参数" />
|
||||
<el-table-column show-overflow-tooltip prop="cronExpression" label="cron表达式" />
|
||||
<el-table-column show-overflow-tooltip prop="cronExpression" label="cron表达式" min-width="100" show-tooltip-when-overflow />
|
||||
<el-table-column show-overflow-tooltip prop="isPause" width="90px" label="状态">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.isPause ? 'warning' : 'success'">{{ scope.row.isPause ? '已暂停' : '运行中' }}</el-tag>
|
||||
|
||||
Reference in New Issue
Block a user