Commit 9ae9289d authored by huyuchen's avatar huyuchen

菜单权限修改

parent 2487e795
package com.yifu.cloud.plus.v1.yifu.permission.vo;/*
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* 新权限-字段vo
*
* @author huyc
* @date 2023-09-04 14:49:40
*/
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
@Data
public class SysDictVo implements Serializable {
/**
* 名称
*/
@Schema(description = "名称")
private String id;
/**
* 编码
*/
@Schema(description = "编码")
private String name;
}
\ No newline at end of file
package com.yifu.cloud.plus.v1.yifu.permission.vo;/*
* 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 io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* 新权限-账号管理表
*
* @author huyc
* @date 2023-09-04 14:49:40
*/
@Data
public class SysUserDeptVo implements Serializable {
/**
* 名称
*/
@Schema(description = "名称")
private String name;
/**
* 编码
*/
@Schema(description = "编码")
private String code;
/**
* 类型
*/
@Schema(description = "类型")
private String type;
/**
* 登录名
*/
@Schema(description = "登录名")
private String loginName;
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
/**
* 新权限-用户权限表
......@@ -18,8 +19,8 @@ public class SysUserPermissionSearchVo extends SysUserPermission {
/**
* 多选导出或删除等操作
*/
@Schema(description = "选中ID,多个逗号分割")
private String ids;
@Schema(description = "选中ID,数组")
private List<String> idList;
/**
* 创建时间区间 [开始时间,结束时间]
......
package com.yifu.cloud.plus.v1.yifu.permission.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema;
......@@ -21,16 +19,6 @@ import java.io.Serializable;
@Data
public class SysUserPermissionVo extends RowIndex implements Serializable {
/**
* id
*/
@TableId(type = IdType.ASSIGN_ID)
@NotBlank(message = "id 不能为空")
@Length(max = 36, message = "id 不能超过36 个字符")
@ExcelAttribute(name = "id", isNotEmpty = true, errorInfo = "id 不能为空", maxLength = 36)
@Schema(description = "id")
@ExcelProperty("id")
private String id;
/**
* 员工姓名
*/
......@@ -83,26 +71,18 @@ public class SysUserPermissionVo extends RowIndex implements Serializable {
/**
* 是否包含(0 是 1否)
*/
@Length(max = 1, message = "是否包含(0 是 1否) 不能超过1 个字符")
@ExcelAttribute(name = "是否包含(0 是 1否)", maxLength = 1)
@Schema(description = "是否包含(0 是 1否)")
@ExcelProperty("是否包含(0 是 1否)")
@Length(max = 1, message = "是否含下级部门 不能超过1 个字符")
@ExcelAttribute(name = "是否含下级部门", maxLength = 1)
@Schema(description = "是否含下级部门")
@ExcelProperty("是否含下级部门")
private String isContains;
/**
* 授权状态(0启用、1禁用)
*/
@Length(max = 1, message = "授权状态(0启用、1禁用) 不能超过1 个字符")
@ExcelAttribute(name = "授权状态(0启用、1禁用)", maxLength = 1)
@Schema(description = "授权状态(0启用、1禁用)")
@ExcelProperty("授权状态(0启用、1禁用)")
@Length(max = 1, message = "授权状态 不能超过1 个字符")
@ExcelAttribute(name = "授权状态", maxLength = 1)
@Schema(description = "授权状态")
@ExcelProperty("授权状态")
private String permissionStatus;
/**
* 删除状态(0是、1否)
*/
@Length(max = 1, message = "删除状态(0是、1否) 不能超过1 个字符")
@ExcelAttribute(name = "删除状态(0是、1否)", maxLength = 1)
@Schema(description = "删除状态(0是、1否)")
@ExcelProperty("删除状态(0是、1否)")
private String deleteFlag;
}
......@@ -7,6 +7,8 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysDictVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserDeptVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionSearchVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
......@@ -47,18 +49,6 @@ public class SysUserPermissionController {
return new R<>(sysUserPermissionService.getSysUserPermissionPage(page, sysUserPermission));
}
/**
* 不分页查询
*
* @param sysUserPermission 新权限-用户权限表
* @return
*/
@Operation(summary = "不分页查询", description = "不分页查询")
@PostMapping("/noPage")
public R<List<SysUserPermission>> getSysUserPermissionNoPage(@RequestBody SysUserPermissionSearchVo sysUserPermission) {
return R.ok(sysUserPermissionService.noPageDiy(sysUserPermission));
}
/**
* 通过id查询新权限-用户权限表
*
......@@ -102,15 +92,15 @@ public class SysUserPermissionController {
/**
* 通过id删除新权限-用户权限表
*
* @param id id
* @param idList
* @return R
*/
@Operation(description = "通过id删除新权限-用户权限表:hasPermission('permission_sysuserpermission_del')")
@SysLog("通过id删除新权限-用户权限表")
@DeleteMapping("/{id}")
@PostMapping("/deleteByIds")
@PreAuthorize("@pms.hasPermission('permission_sysuserpermission_del')")
public R<Boolean> removeById(@PathVariable String id) {
return R.ok(sysUserPermissionService.removeById(id));
public R<Boolean> removeById(@RequestBody List<String> idList) {
return R.ok(sysUserPermissionService.removeBatchByIds(idList));
}
/**
......@@ -139,4 +129,29 @@ public class SysUserPermissionController {
public void export(HttpServletResponse response, @RequestBody SysUserPermissionSearchVo searchVo) {
sysUserPermissionService.listExport(response, searchVo);
}
/**
* 名称,编码模糊搜索
*
* @param page 分页对象
* @param searchVo 新权限-用户权限表
* @return
*/
@Operation(description = "根据名称,编码模糊搜索")
@GetMapping("/customerPage")
public R<IPage<SysUserDeptVo>> getNameCodePage(Page<SysUserDeptVo> page, SysUserDeptVo searchVo) {
return new R<>(sysUserPermissionService.getNameCodePage(page,searchVo));
}
/**
* 名称,编码模糊搜索
*
* @param type 字典类型
* @return
*/
@Operation(description = "根据名称,编码模糊搜索")
@PostMapping("/selectDictByType")
public R<List<SysDictVo>> selectDictByType(@RequestParam String type) {
return new R<>(sysUserPermissionService.selectDictByType(type));
}
}
......@@ -4,9 +4,15 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysDictVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserDeptVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionSearchVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 新权限-用户权限表
*
......@@ -15,10 +21,78 @@ import org.apache.ibatis.annotations.Param;
*/
@Mapper
public interface SysUserPermissionMapper extends BaseMapper<SysUserPermission> {
/**
* 新权限-用户权限表简单分页查询
* @param sysUserPermission 新权限-用户权限表
* @return
*/
IPage<SysUserPermission> getSysUserPermissionPage(Page<SysUserPermission> page, @Param("sysUserPermission") SysUserPermission sysUserPermission);
/**
* 新权限-用户权限表简单分页查询
*
* @param sysUserPermission 新权限-用户权限表
* @return
*/
IPage<SysUserPermission> getSysUserPermissionPage(Page<SysUserPermission> page, @Param("sysUserPermission") SysUserPermissionSearchVo sysUserPermission);
/**
* 导出查询数量
*
* @param sysUserPermission 新权限-用户权限表
* @return
*/
long userSelectCount(@Param("sysUserPermission") SysUserPermissionSearchVo sysUserPermission);
/**
* 查询导出数据
*
* @param sysUserPermission 新权限-用户权限表
* @return
*/
List<SysUserPermissionVo> userSelectList(@Param("sysUserPermission") SysUserPermissionSearchVo sysUserPermission);
/**
* 根据名称或者编码查询数据
* 单位权限
* @param name 名称
* @return
*/
IPage<SysUserDeptVo> selectUnitVO(Page<SysUserDeptVo> page, @Param("name") String name);
/**
* 根据名称或者编码查询数据
* 合同权限
* @param name 名称
* @return
*/
IPage<SysUserDeptVo> selectContractVO(Page<SysUserDeptVo> page, @Param("name") String name);
/**
* 根据名称或者编码查询数据
* 合同权限
* @param name 名称
* @return
*/
IPage<SysUserDeptVo> selectContractSimpleVO(Page<SysUserDeptVo> page, @Param("loginName") String loginName, @Param("name") String name, @Param("type") String type);
/**
* 根据名称或者编码查询数据
* 项目权限
* @param name 名称
* @return
*/
IPage<SysUserDeptVo> selectSettleVO(Page<SysUserDeptVo> page, @Param("name") String name);
/**
* 根据名称或者编码查询数据
* 商机权限
* @param name 名称
* @return
*/
IPage<SysUserDeptVo> selectBusinessVO(Page<SysUserDeptVo> page, @Param("name") String name);
/**
* 根据名称或者编码查询数据
* 报价单权限
* @param name 名称
* @return
*/
IPage<SysUserDeptVo> selectQuotationVO(Page<SysUserDeptVo> page, @Param("name") String name);
List<SysDictVo> selectDictByType(@Param("type") String type);
}
......@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.permission.entity.SysUserPermission;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysDictVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserDeptVo;
import com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionSearchVo;
import javax.servlet.http.HttpServletResponse;
......@@ -30,5 +32,12 @@ public interface SysUserPermissionService extends IService<SysUserPermission> {
void listExport(HttpServletResponse response, SysUserPermissionSearchVo searchVo);
List<SysUserPermission> noPageDiy(SysUserPermissionSearchVo searchVo);
/**
* 新权限-用户权限表简单分页查询
* @param searchVo
* @return
*/
IPage<SysUserDeptVo> getNameCodePage(Page<SysUserDeptVo> page, SysUserDeptVo searchVo);
List<SysDictVo> selectDictByType(String type);
}
......@@ -60,7 +60,7 @@
<include refid="Base_Column_List"/>
FROM sys_menu a
<where>
1=1 AND a.DELETE_STATUS = '1'
a.DELETE_STATUS = '1'
<include refid="sysMenu_where"/>
</where>
order by a.CREATE_TIME desc
......
......@@ -20,11 +20,33 @@
<result property="createTime" column="CREATE_TIME"/>
<result property="updateTime" column="UPDATE_TIME"/>
</resultMap>
<resultMap id="sysUserPermissionExportMap" type="com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserPermissionVo">
<result property="empName" column="EMP_NAME"/>
<result property="empLoginName" column="EMP_LOGIN_NAME"/>
<result property="empDept" column="EMP_DEPT"/>
<result property="permissionType" column="PERMISSION_TYPE"/>
<result property="name" column="NAME"/>
<result property="code" column="CODE"/>
<result property="isContains" column="IS_CONTAINS"/>
<result property="permissionStatus" column="PERMISSION_STATUS"/>
</resultMap>
<resultMap id="nameAndCodeMap" type="com.yifu.cloud.plus.v1.yifu.permission.vo.SysUserDeptVo">
<result property="name" column="name"/>
<result property="code" column="code"/>
</resultMap>
<resultMap id="dictMap" type="com.yifu.cloud.plus.v1.yifu.permission.vo.SysDictVo">
<result property="id" column="id"/>
<result property="name" column="name"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.EMP_NAME,
a.EMP_LOGIN_NAME,
a.EMP_DEPT,
b.fd_dept_name,
a.PERMISSION_TYPE,
a.NAME,
a.CODE,
......@@ -35,6 +57,13 @@
</sql>
<sql id="sysUserPermission_where">
<if test="sysUserPermission != null">
<if test="sysUserPermission.idList != null">
AND a.id in
<foreach item="idStr" index="index" collection="sysUserPermission.idList" open="(" separator="," close=")">
#{idStr}
</foreach>
</if>
<if test="sysUserPermission.idList == null">
<if test="sysUserPermission.empName != null and sysUserPermission.empName.trim() != ''">
AND a.EMP_NAME like concat('%',#{sysUserPermission.empName},'%')
</if>
......@@ -42,7 +71,7 @@
AND a.EMP_LOGIN_NAME = #{sysUserPermission.empLoginName}
</if>
<if test="sysUserPermission.empDept != null and sysUserPermission.empDept.trim() != ''">
AND a.EMP_DEPT like concat('%',#{sysUserPermission.empDept},'%')
AND b.EMP_DEPT like concat('%',#{sysUserPermission.empDept},'%')
</if>
<if test="sysUserPermission.permissionType != null and sysUserPermission.permissionType.trim() != ''">
AND a.PERMISSION_TYPE = #{sysUserPermission.permissionType}
......@@ -56,17 +85,121 @@
<if test="sysUserPermission.permissionStatus != null and sysUserPermission.permissionStatus.trim() != ''">
AND a.PERMISSION_STATUS = #{sysUserPermission.permissionStatus}
</if>
</if>
</if>
</sql>
<!--sysUserPermission简单分页查询-->
<select id="getSysUserPermissionPage" resultMap="sysUserPermissionMap">
SELECT
<include refid="Base_Column_List"/>
FROM sys_user_permission a
FROM sys_user_permission a left join sys_user_info b on a.EMP_LOGIN_NAME = b.fd_login_name
<where>
1=1 AND a.DELETE_FLAG = '1'
a.DELETE_FLAG = '1'
<include refid="sysUserPermission_where"/>
</where>
order by a.CREATE_TIME desc
</select>
<select id="userSelectCount" resultType="java.lang.Long">
SELECT
count(1)
FROM sys_user_permission a left join sys_user_info b on a.EMP_LOGIN_NAME = b.fd_login_name
<where>
a.DELETE_FLAG = '1'
<include refid="sysUserPermission_where"/>
</where>
</select>
<select id="userSelectList" resultMap="sysUserPermissionExportMap">
SELECT
a.EMP_NAME,
a.EMP_LOGIN_NAME,
b.fd_dept_name,
b.name AS PERMISSION_TYPE,
a.NAME,
a.CODE,
CASE WHEN a.IS_CONTAINS=0 THEN "是"
WHEN a.IS_CONTAINS =1 THEN "否"
ELSE a.IS_CONTAINS END as IS_CONTAINS,
CASE WHEN a.PERMISSION_STATUS=0 THEN "启用"
WHEN a.PERMISSION_STATUS =1 THEN "禁用"
ELSE a.PERMISSION_STATUS END as PERMISSION_STATUS
FROM sys_user_permission a
LEFT JOIN permission_type b on a.PERMISSION_TYPE = b.id
LEFT JOIN sys_user_info b on a.EMP_LOGIN_NAME = b.fd_login_name
<where>
a.DELETE_FLAG = '1'
<include refid="sysUserPermission_where"/>
</where>
limit #{sysUserPermission.limitStart},#{sysUserPermission.limitEnd}
</select>
<select id="selectUnitVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3a9d1d4d438bfc code,a.fd_3a9d1d4caeeeb8 name
from ekp_05b7485fd444f95a6177 a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3a9d1d4d438bfc like concat('%',#{name},'%') or a.fd_3a9d1d4caeeeb8 like concat('%',#{name},'%'))
</if>
</select>
<select id="selectContractVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3ade33763baa0e code,a.fd_3ade334bac0016 name
from ekp_0103c453b2848c3bb31c a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3ade33763baa0e like concat('%',#{name},'%') or a.fd_3ade334bac0016 like concat('%',#{name},'%'))
</if>
</select>
<select id="selectSettleVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3a37fe508071fe code,a.fd_3a2b38c61ef9aa name
from ekp_24a8e6a7fc143bb8c48a a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3a37fe508071fe like concat('%',#{name},'%') or a.fd_3a2b38c61ef9aa like concat('%',#{name},'%'))
</if>
</select>
<select id="selectContractSimpleVO" resultMap="nameAndCodeMap">
SELECT
a.NAME,
a.CODE
from sys_user_permission a
where a.EMP_LOGIN_NAME = #{loginName} and a.PERMISSION_TYPE = #{type}
<if test="name != null and name.trim() != ''">
AND (a.NAME like concat('%',#{name},'%') or a.CODE like concat('%',#{name},'%'))
</if>
</select>
<select id="selectBusinessVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3b107f1084fd96 code,a.fd_3b04b95268f19c name
from ekp_2f8e08660c542d8a169f a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3b107f1084fd96 like concat('%',#{name},'%') or a.fd_3b04b95268f19c like concat('%',#{name},'%'))
</if>
</select>
<select id="selectQuotationVO" resultMap="nameAndCodeMap">
SELECT
a.fd_3b04b9dc64a9f4 code,a.fd_3b04b9daa0c25e name
from ekp_2f8e08660c542d8a169f a
where 1=1
<if test="name != null and name.trim() != ''">
AND (a.fd_3b04b9dc64a9f4 like concat('%',#{name},'%') or a.fd_3b04b9daa0c25e like concat('%',#{name},'%'))
</if>
</select>
<select id="selectDictByType" resultMap="dictMap">
SELECT
a.dict_id as id,a.name
from permission_type a
where a.dict_type = #{type}
</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