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 @@ ...@@ -116,7 +116,13 @@
b1.fd_id ORDER_ID, b1.fd_id ORDER_ID,
'1' AS ALERT_TYPE, '1' AS ALERT_TYPE,
DATE_ADD(NOW(), INTERVAL 30 MINUTE) as 'date1', 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 FROM
lbpm_workitem a lbpm_workitem a
LEFT JOIN lbpm_node e ON e.fd_id = a.fd_node_id LEFT JOIN lbpm_node e ON e.fd_id = a.fd_node_id
......
...@@ -60,6 +60,12 @@ public class SysMenu extends BaseEntity { ...@@ -60,6 +60,12 @@ public class SysMenu extends BaseEntity {
@Schema(description = "视图ID") @Schema(description = "视图ID")
private String viewId; private String viewId;
/**
* 权限维度
*/
@Schema(description = "权限维度")
private String permissionType;
/** /**
* 授权状态(0启用、1禁用) * 授权状态(0启用、1禁用)
*/ */
......
...@@ -49,7 +49,7 @@ public class SysMenuController { ...@@ -49,7 +49,7 @@ public class SysMenuController {
*/ */
@Operation(description = "新增新权限-菜单表:hasPermission('permission_sysmenu_add')") @Operation(description = "新增新权限-菜单表:hasPermission('permission_sysmenu_add')")
@SysLog("新增新权限-菜单表") @SysLog("新增新权限-菜单表")
@PostMapping @PostMapping("/addMenu")
@PreAuthorize("@pms.hasPermission('permission_sysmenu_add')") @PreAuthorize("@pms.hasPermission('permission_sysmenu_add')")
public R<Boolean> save(@RequestBody SysMenu sysMenu) { public R<Boolean> save(@RequestBody SysMenu sysMenu) {
return sysMenuService.saveMenu(sysMenu); return sysMenuService.saveMenu(sysMenu);
...@@ -66,7 +66,18 @@ public class SysMenuController { ...@@ -66,7 +66,18 @@ public class SysMenuController {
@PostMapping("/updateMenu") @PostMapping("/updateMenu")
@PreAuthorize("@pms.hasPermission('permission_sysmenu_edit')") @PreAuthorize("@pms.hasPermission('permission_sysmenu_edit')")
public R<Boolean> updateById(@RequestBody SysMenu sysMenu) { 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> { ...@@ -28,4 +28,11 @@ public interface SysMenuService extends IService<SysMenu> {
* @return * @return
*/ */
R<Boolean> saveMenu(SysMenu menu); 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 ...@@ -67,6 +67,38 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
} }
//错误信息 //错误信息
StringBuilder errorStr = new StringBuilder(); 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; String name;
//判断填写的控件id 是否属于表单的字段 //判断填写的控件id 是否属于表单的字段
...@@ -74,23 +106,14 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl ...@@ -74,23 +106,14 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
if (!menu.getColumnIdList().isEmpty()) { if (!menu.getColumnIdList().isEmpty()) {
for (String columnId : menu.getColumnIdList()) { for (String columnId : menu.getColumnIdList()) {
name = columnId.substring(0, columnId.indexOf(";")); 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); String label = columnId.substring(columnId.indexOf(";") + 1);
if (list.stream().noneMatch(e -> e.equals(label))) { if (list.stream().noneMatch(e -> e.equals(label))) {
errorStr.append(name).append("的控件id填写有误;"); 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;/* 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)
*/
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ArrayUtil;
...@@ -42,17 +27,11 @@ import org.springframework.stereotype.Service; ...@@ -42,17 +27,11 @@ import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/**
* 新权限-用户权限表
*
* @author hyc
* @date 2023-08-29 14:49:40
*/
@Log4j2 @Log4j2
@Service @Service
public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionMapper, SysUserPermission> implements SysUserPermissionService { public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionMapper, SysUserPermission> implements SysUserPermissionService {
...@@ -73,13 +52,11 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM ...@@ -73,13 +52,11 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
*/ */
@Override @Override
public void listExport(HttpServletResponse response, SysUserPermissionSearchVo searchVo){ public void listExport(HttpServletResponse response, SysUserPermissionSearchVo searchVo){
String fileName = "新权限-用户权限表批量导出" + DateUtil.getThisTime() + ".xlsx"; String fileName = "用户权限表批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表 //获取要导出的列表
List<SysUserPermission> list = new ArrayList<>(); List<SysUserPermission> list = new ArrayList<>();
long count = noPageCountDiy(searchVo); long count = noPageCountDiy(searchVo);
ServletOutputStream out = null; try (ServletOutputStream out = response.getOutputStream()){
try {
out = response.getOutputStream();
response.setContentType(CommonConstants.MULTIPART_FORM_DATA); response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName , CommonConstants.UTF8)); response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName , CommonConstants.UTF8));
...@@ -87,7 +64,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM ...@@ -87,7 +64,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
ExcelWriter excelWriter = EasyExcel.write(out, SysUserPermission.class).build(); ExcelWriter excelWriter = EasyExcel.write(out, SysUserPermission.class).build();
int index = 0; int index = 0;
if (count > CommonConstants.ZERO_INT){ 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.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT); searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
...@@ -99,34 +76,24 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM ...@@ -99,34 +76,24 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
} }
} }
if (Common.isNotNull(list)){ if (Common.isNotNull(list)){
WriteSheet writeSheet = EasyExcel.writerSheet("新权限-用户权限表"+index).build(); WriteSheet writeSheet = EasyExcel.writerSheet("用户权限表"+index).build();
excelWriter.write(list,writeSheet); excelWriter.write(list,writeSheet);
index++; index++;
} }
i = i + CommonConstants.EXCEL_EXPORT_LIMIT;
if (Common.isNotNull(list)){ if (Common.isNotNull(list)){
list.clear(); list.clear();
} }
} }
}else { }else {
WriteSheet writeSheet = EasyExcel.writerSheet("新权限-用户权限表"+index).build(); WriteSheet writeSheet = EasyExcel.writerSheet("用户权限表"+index).build();
excelWriter.write(list,writeSheet); excelWriter.write(list,writeSheet);
} }
if (Common.isNotNull(list)){ if (Common.isNotNull(list)){
list.clear(); list.clear();
} }
out.flush();
excelWriter.finish(); excelWriter.finish();
}catch (Exception e){ }catch (Exception e){
log.error("执行异常" ,e); log.error("执行异常" ,e);
}finally {
try {
if (null != out) {
out.close();
}
} catch (IOException e) {
log.error("执行异常", e);
}
} }
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
<result property="menuParentId" column="MENU_PARENT_ID"/> <result property="menuParentId" column="MENU_PARENT_ID"/>
<result property="modelId" column="MODEL_ID"/> <result property="modelId" column="MODEL_ID"/>
<result property="viewId" column="VIEW_ID"/> <result property="viewId" column="VIEW_ID"/>
<result property="permissionType" column="PERMISSION_TYPE"/>
<result property="permissionStatus" column="PERMISSION_STATUS"/> <result property="permissionStatus" column="PERMISSION_STATUS"/>
<result property="deleteStatus" column="DELETE_STATUS"/> <result property="deleteStatus" column="DELETE_STATUS"/>
<result property="incomeId" column="INCOME_ID"/> <result property="incomeId" column="INCOME_ID"/>
...@@ -32,6 +33,7 @@ ...@@ -32,6 +33,7 @@
a.MENU_NAME, a.MENU_NAME,
a.MENU_NAME_PARENT, a.MENU_NAME_PARENT,
a.MENU_PARENT_ID, a.MENU_PARENT_ID,
a.PERMISSION_TYPE,
a.PERMISSION_STATUS, a.PERMISSION_STATUS,
a.DELETE_STATUS, a.DELETE_STATUS,
a.CREATE_TIME a.CREATE_TIME
......
...@@ -36,44 +36,26 @@ ...@@ -36,44 +36,26 @@
<sql id="sysUserPermission_where"> <sql id="sysUserPermission_where">
<if test="sysUserPermission != null"> <if test="sysUserPermission != null">
<if test="sysUserPermission.empName != null and sysUserPermission.empName.trim() != ''"> <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>
<if test="sysUserPermission.empLoginName != null and sysUserPermission.empLoginName.trim() != ''"> <if test="sysUserPermission.empLoginName != null and sysUserPermission.empLoginName.trim() != ''">
AND a.EMP_LOGIN_NAME = #{sysUserPermission.empLoginName} AND a.EMP_LOGIN_NAME = #{sysUserPermission.empLoginName}
</if> </if>
<if test="sysUserPermission.empDept != null and sysUserPermission.empDept.trim() != ''"> <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>
<if test="sysUserPermission.permissionType != null and sysUserPermission.permissionType.trim() != ''"> <if test="sysUserPermission.permissionType != null and sysUserPermission.permissionType.trim() != ''">
AND a.PERMISSION_TYPE = #{sysUserPermission.permissionType} AND a.PERMISSION_TYPE = #{sysUserPermission.permissionType}
</if> </if>
<if test="sysUserPermission.name != null and sysUserPermission.name.trim() != ''"> <if test="sysUserPermission.name != null and sysUserPermission.name.trim() != ''">
AND a.NAME = #{sysUserPermission.name} AND a.NAME like concat('%',#{sysUserPermission.name},'%')
</if> </if>
<if test="sysUserPermission.code != null and sysUserPermission.code.trim() != ''"> <if test="sysUserPermission.code != null and sysUserPermission.code.trim() != ''">
AND a.CODE = #{sysUserPermission.code} AND a.CODE = #{sysUserPermission.code}
</if> </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() != ''"> <if test="sysUserPermission.permissionStatus != null and sysUserPermission.permissionStatus.trim() != ''">
AND a.PERMISSION_STATUS = #{sysUserPermission.permissionStatus} AND a.PERMISSION_STATUS = #{sysUserPermission.permissionStatus}
</if> </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> </if>
</sql> </sql>
<!--sysUserPermission简单分页查询--> <!--sysUserPermission简单分页查询-->
...@@ -82,8 +64,9 @@ ...@@ -82,8 +64,9 @@
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
FROM sys_user_permission a FROM sys_user_permission a
<where> <where>
1=1 1=1 AND a.DELETE_FLAG = '1'
<include refid="sysUserPermission_where"/> <include refid="sysUserPermission_where"/>
</where> </where>
order by a.CREATE_TIME desc
</select> </select>
</mapper> </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