Commit 374978d8 authored by hongguangwu's avatar hongguangwu

Merge remote-tracking branch 'origin/MVP1.5.8' into MVP1.5.8

parents 9fbf1bf2 741a18f2
......@@ -116,7 +116,13 @@
b1.fd_id ORDER_ID,
'1' AS ALERT_TYPE,
DATE_ADD(NOW(), INTERVAL 30 MINUTE) as 'date1',
IF(b1.fd_3b779ba2168eea = 1,DATE_ADD(a.fd_start_date,INTERVAL 3 HOUR),IF(b1.fd_3b779ba2168eea = 4,DATE_ADD(a.fd_start_date,INTERVAL 5 HOUR),DATE_ADD(a.fd_start_date,INTERVAL 8 HOUR))) as 'date2'
IF(b1.fd_3b779ba2168eea = 1,
DATE_ADD(a.fd_start_date,INTERVAL 3 HOUR),
IF(b1.fd_3b779ba2168eea = 4,
DATE_ADD(a.fd_start_date,INTERVAL 5 HOUR),
IF(b1.fd_3b779ba2168eea = 7,
DATE_ADD(a.fd_start_date,INTERVAL 8 HOUR),
DATE_ADD(a.fd_start_date,INTERVAL 2 MONTH)))) as 'date2'
FROM
lbpm_workitem a
LEFT JOIN lbpm_node e ON e.fd_id = a.fd_node_id
......
......@@ -60,6 +60,12 @@ public class SysMenu extends BaseEntity {
@Schema(description = "视图ID")
private String viewId;
/**
* 权限维度
*/
@Schema(description = "权限维度")
private String permissionType;
/**
* 授权状态(0启用、1禁用)
*/
......
......@@ -49,7 +49,7 @@ public class SysMenuController {
*/
@Operation(description = "新增新权限-菜单表:hasPermission('permission_sysmenu_add')")
@SysLog("新增新权限-菜单表")
@PostMapping
@PostMapping("/addMenu")
@PreAuthorize("@pms.hasPermission('permission_sysmenu_add')")
public R<Boolean> save(@RequestBody SysMenu sysMenu) {
return sysMenuService.saveMenu(sysMenu);
......@@ -66,7 +66,18 @@ public class SysMenuController {
@PostMapping("/updateMenu")
@PreAuthorize("@pms.hasPermission('permission_sysmenu_edit')")
public R<Boolean> updateById(@RequestBody SysMenu sysMenu) {
return R.ok(sysMenuService.updateById(sysMenu));
return sysMenuService.updateMenu(sysMenu);
}
/**
* 通过id查询新权限-菜单表
*
* @param id id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
public R<SysMenu> getById(@PathVariable("id") String id) {
return R.ok(sysMenuService.getById(id));
}
}
......@@ -28,4 +28,11 @@ public interface SysMenuService extends IService<SysMenu> {
* @return
*/
R<Boolean> saveMenu(SysMenu menu);
/**
* 更新菜单表
* @param menu 新权限-菜单表
* @return
*/
R<Boolean> updateMenu(SysMenu menu);
}
......@@ -67,6 +67,38 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
}
//错误信息
StringBuilder errorStr = new StringBuilder();
//权限维度
StringBuilder permissionType = new StringBuilder();
this.check(menu,errorStr,permissionType);
//权限维度的控件id填写错误的话统一返回
if (errorStr.length() > 0) {
return R.failed(errorStr.substring(0, errorStr.lastIndexOf(";")));
}
menu.setPermissionType(permissionType.substring(0, errorStr.lastIndexOf("、")));
int res = baseMapper.insert(menu);
if (res <= CommonConstants.ZERO_INT) {
return R.failed();
}
return R.ok();
}
@Override
public R<Boolean> updateMenu(SysMenu menu) {
//错误信息
StringBuilder errorStr = new StringBuilder();
//权限维度
StringBuilder permissionType = new StringBuilder();
this.check(menu,errorStr,permissionType);
//权限维度的控件id填写错误的话统一返回
if (errorStr.length() > 0) {
return R.failed(errorStr.substring(0, errorStr.lastIndexOf(";")));
}
menu.setPermissionType(permissionType.substring(0, errorStr.lastIndexOf("、")));
baseMapper.updateById(menu);
return R.ok();
}
public void check(SysMenu menu,StringBuilder errorStr,StringBuilder permissionType) {
//权限类型
String name;
//判断填写的控件id 是否属于表单的字段
......@@ -74,23 +106,14 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
if (!menu.getColumnIdList().isEmpty()) {
for (String columnId : menu.getColumnIdList()) {
name = columnId.substring(0, columnId.indexOf(";"));
//label为控件id;columnId格式为【客户权限_fd_3ae495ff53c560】
permissionType.append(name).append("、");
//label为控件id;columnId格式为【客户权限;fd_3ae495ff53c560】
String label = columnId.substring(columnId.indexOf(";") + 1);
if (list.stream().noneMatch(e -> e.equals(label))) {
errorStr.append(name).append("的控件id填写有误;");
}
}
}
//权限维度的控件id填写错误的话统一返回
if (errorStr.length() > 0) {
return R.failed(errorStr.substring(0, errorStr.lastIndexOf(";")));
}
int res = baseMapper.insert(menu);
if (res <= CommonConstants.ZERO_INT) {
return R.failed();
}
return R.ok();
}
}
package com.yifu.cloud.plus.v1.permission.service.impl;/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.permission.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ArrayUtil;
......@@ -42,17 +27,11 @@ import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
/**
* 新权限-用户权限表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@Log4j2
@Service
public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionMapper, SysUserPermission> implements SysUserPermissionService {
......@@ -73,13 +52,11 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
*/
@Override
public void listExport(HttpServletResponse response, SysUserPermissionSearchVo searchVo){
String fileName = "新权限-用户权限表批量导出" + DateUtil.getThisTime() + ".xlsx";
String fileName = "用户权限表批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<SysUserPermission> list = new ArrayList<>();
long count = noPageCountDiy(searchVo);
ServletOutputStream out = null;
try {
out = response.getOutputStream();
try (ServletOutputStream out = response.getOutputStream()){
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName , CommonConstants.UTF8));
......@@ -87,7 +64,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
ExcelWriter excelWriter = EasyExcel.write(out, SysUserPermission.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT){
for (int i = 0; i <= count; ) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
......@@ -99,34 +76,24 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
}
}
if (Common.isNotNull(list)){
WriteSheet writeSheet = EasyExcel.writerSheet("新权限-用户权限表"+index).build();
WriteSheet writeSheet = EasyExcel.writerSheet("用户权限表"+index).build();
excelWriter.write(list,writeSheet);
index++;
}
i = i + CommonConstants.EXCEL_EXPORT_LIMIT;
if (Common.isNotNull(list)){
list.clear();
}
}
}else {
WriteSheet writeSheet = EasyExcel.writerSheet("新权限-用户权限表"+index).build();
WriteSheet writeSheet = EasyExcel.writerSheet("用户权限表"+index).build();
excelWriter.write(list,writeSheet);
}
if (Common.isNotNull(list)){
list.clear();
}
out.flush();
excelWriter.finish();
}catch (Exception e){
log.error("执行异常" ,e);
}finally {
try {
if (null != out) {
out.close();
}
} catch (IOException e) {
log.error("执行异常", e);
}
}
}
......
......@@ -10,6 +10,7 @@
<result property="menuParentId" column="MENU_PARENT_ID"/>
<result property="modelId" column="MODEL_ID"/>
<result property="viewId" column="VIEW_ID"/>
<result property="permissionType" column="PERMISSION_TYPE"/>
<result property="permissionStatus" column="PERMISSION_STATUS"/>
<result property="deleteStatus" column="DELETE_STATUS"/>
<result property="incomeId" column="INCOME_ID"/>
......@@ -32,6 +33,7 @@
a.MENU_NAME,
a.MENU_NAME_PARENT,
a.MENU_PARENT_ID,
a.PERMISSION_TYPE,
a.PERMISSION_STATUS,
a.DELETE_STATUS,
a.CREATE_TIME
......
......@@ -36,44 +36,26 @@
<sql id="sysUserPermission_where">
<if test="sysUserPermission != null">
<if test="sysUserPermission.empName != null and sysUserPermission.empName.trim() != ''">
AND a.EMP_NAME = #{sysUserPermission.empName}
AND a.EMP_NAME like concat('%',#{sysUserPermission.empName},'%')
</if>
<if test="sysUserPermission.empLoginName != null and sysUserPermission.empLoginName.trim() != ''">
AND a.EMP_LOGIN_NAME = #{sysUserPermission.empLoginName}
</if>
<if test="sysUserPermission.empDept != null and sysUserPermission.empDept.trim() != ''">
AND a.EMP_DEPT = #{sysUserPermission.empDept}
AND a.EMP_DEPT like concat('%',#{sysUserPermission.empDept},'%')
</if>
<if test="sysUserPermission.permissionType != null and sysUserPermission.permissionType.trim() != ''">
AND a.PERMISSION_TYPE = #{sysUserPermission.permissionType}
</if>
<if test="sysUserPermission.name != null and sysUserPermission.name.trim() != ''">
AND a.NAME = #{sysUserPermission.name}
AND a.NAME like concat('%',#{sysUserPermission.name},'%')
</if>
<if test="sysUserPermission.code != null and sysUserPermission.code.trim() != ''">
AND a.CODE = #{sysUserPermission.code}
</if>
<if test="sysUserPermission.isContains != null and sysUserPermission.isContains.trim() != ''">
AND a.IS_CONTAINS = #{sysUserPermission.isContains}
</if>
<if test="sysUserPermission.permissionStatus != null and sysUserPermission.permissionStatus.trim() != ''">
AND a.PERMISSION_STATUS = #{sysUserPermission.permissionStatus}
</if>
<if test="sysUserPermission.deleteFlag != null and sysUserPermission.deleteFlag.trim() != ''">
AND a.DELETE_FLAG = #{sysUserPermission.deleteFlag}
</if>
<if test="sysUserPermission.createBy != null and sysUserPermission.createBy.trim() != ''">
AND a.CREATE_BY = #{sysUserPermission.createBy}
</if>
<if test="sysUserPermission.updateBy != null and sysUserPermission.updateBy.trim() != ''">
AND a.UPDATE_BY = #{sysUserPermission.updateBy}
</if>
<if test="sysUserPermission.createName != null and sysUserPermission.createName.trim() != ''">
AND a.CREATE_NAME = #{sysUserPermission.createName}
</if>
<if test="sysUserPermission.updateTime != null">
AND a.UPDATE_TIME = #{sysUserPermission.updateTime}
</if>
</if>
</sql>
<!--sysUserPermission简单分页查询-->
......@@ -82,8 +64,9 @@
<include refid="Base_Column_List"/>
FROM sys_user_permission a
<where>
1=1
1=1 AND a.DELETE_FLAG = '1'
<include refid="sysUserPermission_where"/>
</where>
order by a.CREATE_TIME desc
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment