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;
/**
* 新权限-用户权限表
*
......@@ -17,8 +23,76 @@ import org.apache.ibatis.annotations.Param;
public interface SysUserPermissionMapper extends BaseMapper<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
*/
IPage<SysUserPermission> getSysUserPermissionPage(Page<SysUserPermission> page, @Param("sysUserPermission") SysUserPermission sysUserPermission);
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);
}
package com.yifu.cloud.plus.v1.permission.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ArrayUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.context.AnalysisContext;
......@@ -9,17 +8,18 @@ import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.permission.mapper.SysUserPermissionMapper;
import com.yifu.cloud.plus.v1.permission.service.SysUserPermissionService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
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 lombok.extern.log4j.Log4j2;
......@@ -35,108 +35,108 @@ import java.util.List;
@Log4j2
@Service
public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionMapper, SysUserPermission> implements SysUserPermissionService {
/**
* 新权限-用户权限表简单分页查询
*
* @param sysUserPermission 新权限-用户权限表
* @return
*/
@Override
public IPage<SysUserPermission> getSysUserPermissionPage(Page<SysUserPermission> page, SysUserPermissionSearchVo sysUserPermission){
return baseMapper.getSysUserPermissionPage(page,sysUserPermission);
public IPage<SysUserPermission> getSysUserPermissionPage(Page<SysUserPermission> page, SysUserPermissionSearchVo sysUserPermission) {
return baseMapper.getSysUserPermissionPage(page, sysUserPermission);
}
/**
* 新权限-用户权限表批量导出
*
* @param searchVo 新权限-用户权限表
* @return
*/
@Override
public void listExport(HttpServletResponse response, SysUserPermissionSearchVo searchVo){
public void listExport(HttpServletResponse response, SysUserPermissionSearchVo searchVo) {
String fileName = "用户权限表批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<SysUserPermission> list = new ArrayList<>();
long count = noPageCountDiy(searchVo);
try (ServletOutputStream out = response.getOutputStream()){
List<SysUserPermissionVo> list = new ArrayList<>();
long count = baseMapper.userSelectCount(searchVo);
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));
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, SysUserPermission.class).build();
ExcelWriter excelWriter = EasyExcel.write(out, SysUserPermissionVo.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT){
if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = noPageDiy(searchVo);
if (Common.isNotNull(list)){
ExcelUtil<SysUserPermission> util = new ExcelUtil<>(SysUserPermission.class);
for (SysUserPermission vo:list){
util.convertEntity(vo,null,null,null);
}
}
if (Common.isNotNull(list)){
WriteSheet writeSheet = EasyExcel.writerSheet("用户权限表"+index).build();
excelWriter.write(list,writeSheet);
list = baseMapper.userSelectList(searchVo);
if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcel.writerSheet("用户权限表" + index).build();
excelWriter.write(list, writeSheet);
index++;
}
if (Common.isNotNull(list)){
if (Common.isNotNull(list)) {
list.clear();
}
}
}else {
WriteSheet writeSheet = EasyExcel.writerSheet("用户权限表"+index).build();
excelWriter.write(list,writeSheet);
} else {
WriteSheet writeSheet = EasyExcel.writerSheet("用户权限表" + index).build();
excelWriter.write(list, writeSheet);
}
if (Common.isNotNull(list)){
if (Common.isNotNull(list)) {
list.clear();
}
excelWriter.finish();
}catch (Exception e){
log.error("执行异常" ,e);
} catch (Exception e) {
log.error("执行异常", e);
}
}
@Override
public List<SysUserPermission> noPageDiy(SysUserPermissionSearchVo searchVo) {
LambdaQueryWrapper<SysUserPermission> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds());
if (Common.isNotNull(idList)){
wrapper.in(SysUserPermission::getId,idList);
}
if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0){
wrapper.last(" limit "+ searchVo.getLimitStart() +","+ searchVo.getLimitEnd());
}
wrapper.orderByDesc(BaseEntity::getCreateTime);
return baseMapper.selectList(wrapper);
}
private Long noPageCountDiy(SysUserPermissionSearchVo searchVo) {
LambdaQueryWrapper<SysUserPermission> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds());
if (Common.isNotNull(idList)){
wrapper.in(SysUserPermission::getId,idList);
}
return baseMapper.selectCount(wrapper);
public IPage<SysUserDeptVo> getNameCodePage(Page<SysUserDeptVo> page, SysUserDeptVo searchVo) {
if (Common.isNotNull(searchVo) && Common.isNotNull(searchVo.getType())) {
YifuUser user = SecurityUtils.getUser();
IPage<SysUserDeptVo> iPage;
//客户权限
if (CommonConstants.ONE_STRING.equals(searchVo.getType())) {
iPage = baseMapper.selectUnitVO(page,searchVo.getName());
} else if (CommonConstants.TWO_STRING.equals(searchVo.getType())) {
//商机权限
iPage = baseMapper.selectBusinessVO(page, searchVo.getName());
} else if (CommonConstants.THREE_STRING.equals(searchVo.getType())) {
//报价单权限
iPage = baseMapper.selectQuotationVO(page, searchVo.getName());
} else if (CommonConstants.FOUR_STRING.equals(searchVo.getType())) {
//合同权限
if (CommonConstants.ONE_STRING.equals(user.getId())) {
iPage = baseMapper.selectContractVO(page, searchVo.getName());
} else {
iPage = baseMapper.selectContractSimpleVO(page, searchVo.getName(),searchVo.getName(),searchVo.getType());
}
} else {
//项目权限
if (CommonConstants.ONE_STRING.equals(user.getId())) {
iPage = baseMapper.selectSettleVO(page, searchVo.getName());
} else {
iPage = baseMapper.selectContractSimpleVO(page, searchVo.getName(),searchVo.getName(),searchVo.getType());
}
}
return iPage;
}
return null;
}
private LambdaQueryWrapper buildQueryWrapper(SysUserPermissionSearchVo entity){
LambdaQueryWrapper<SysUserPermission> wrapper = Wrappers.lambdaQuery();
if (ArrayUtil.isNotEmpty(entity.getCreateTimes())) {
wrapper.ge(SysUserPermission::getCreateTime, entity.getCreateTimes()[0])
.le(SysUserPermission::getCreateTime,
entity.getCreateTimes()[1]);
}
if (Common.isNotNull(entity.getCreateName())){
wrapper.eq(SysUserPermission::getCreateName,entity.getCreateName());
}
return wrapper;
@Override
public List<SysDictVo> selectDictByType(String type) {
return baseMapper.selectDictByType(type);
}
@Override
public R<List<ErrorMessage>> importDiy(InputStream inputStream) {
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<SysUserPermissionVo> util1 = new ExcelUtil<>(SysUserPermissionVo.class);;
ExcelUtil<SysUserPermissionVo> util1 = new ExcelUtil<>(SysUserPermissionVo.class);
// 写法2:
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
......@@ -155,11 +155,11 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
public void invoke(SysUserPermissionVo data, AnalysisContext context) {
ReadRowHolder readRowHolder = context.readRowHolder();
Integer rowIndex = readRowHolder.getRowIndex();
data.setRowIndex(rowIndex+1);
data.setRowIndex(rowIndex + 1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)){
if (Common.isNotNull(errorMessage)) {
errorMessageList.add(errorMessage);
}else {
} else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
......@@ -168,6 +168,7 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext context) {
saveData();
......@@ -178,28 +179,28 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importSysUserPermission(cachedDataList,errorMessageList);
importSysUserPermission(cachedDataList, errorMessageList);
log.info("存储数据库成功!");
}
}).sheet().doRead();
}catch (Exception e){
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e);
} catch (Exception e) {
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR, e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
return R.ok(errorMessageList);
}
private void importSysUserPermission(List<SysUserPermissionVo> excelVOList, List<ErrorMessage> errorMessageList) {
// 个性化校验逻辑
ErrorMessage errorMsg;
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
SysUserPermissionVo excel = excelVOList.get(i);
// 插入
insertExcel(excel);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(),CommonConstants.SAVE_SUCCESS));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), CommonConstants.SAVE_SUCCESS));
}
}
/**
* 插入excel bad record
*/
......
......@@ -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}
......@@ -57,16 +86,120 @@
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