refactor:数据字典等实现修改
parent
d54f520d98
commit
783eac5c45
|
@ -14,11 +14,15 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface ISysDictData extends ICommonData<SysDictData, Long> {
|
public interface ISysDictData extends ICommonData<SysDictData, Long> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按条件查询
|
||||||
|
*/
|
||||||
|
List<SysDictData> findByConditions(SysDictData query);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按条件分页查询
|
* 按条件分页查询
|
||||||
*/
|
*/
|
||||||
Paging<SysDictData> findByConditions(String dictType, String dictValue,
|
Paging<SysDictData> findByConditions(SysDictData query, int page, int size);
|
||||||
String status, int page, int size);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据字典类型和字典键值查询字典数据信息
|
* 根据字典类型和字典键值查询字典数据信息
|
||||||
|
@ -37,4 +41,12 @@ public interface ISysDictData extends ICommonData<SysDictData, Long> {
|
||||||
*/
|
*/
|
||||||
List<SysDictType> findByDicType(String dictType);
|
List<SysDictType> findByDicType(String dictType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字典类型查询字典数据数量
|
||||||
|
*
|
||||||
|
* @param dictType 字典类型
|
||||||
|
* @return 字典数据集合信息
|
||||||
|
*/
|
||||||
|
long countByDicType(String dictType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@ import cc.iotkit.data.ICommonData;
|
||||||
import cc.iotkit.common.api.Paging;
|
import cc.iotkit.common.api.Paging;
|
||||||
import cc.iotkit.model.system.SysDictType;
|
import cc.iotkit.model.system.SysDictType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典类型数据接口
|
* 字典类型数据接口
|
||||||
*
|
*
|
||||||
|
@ -11,11 +13,15 @@ import cc.iotkit.model.system.SysDictType;
|
||||||
*/
|
*/
|
||||||
public interface ISysDictTypeData extends ICommonData<SysDictType, Long> {
|
public interface ISysDictTypeData extends ICommonData<SysDictType, Long> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按条件查询
|
||||||
|
*/
|
||||||
|
List<SysDictType> findByConditions(SysDictType cond);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按条件分页查询
|
* 按条件分页查询
|
||||||
*/
|
*/
|
||||||
Paging<SysDictType> findByConditions(String dictName, String dictType,
|
Paging<SysDictType> findByConditions(SysDictType cond, int page, int size);
|
||||||
String status, int page, int size);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据字典类型查询信息
|
* 根据字典类型查询信息
|
||||||
|
@ -25,4 +31,12 @@ public interface ISysDictTypeData extends ICommonData<SysDictType, Long> {
|
||||||
*/
|
*/
|
||||||
SysDictType findByDicType(String dictType);
|
SysDictType findByDicType(String dictType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改字典类型
|
||||||
|
*
|
||||||
|
* @param dictType 类型
|
||||||
|
* @param newType 新类型
|
||||||
|
*/
|
||||||
|
void updateDicType(String dictType, String newType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@ import cc.iotkit.data.ICommonData;
|
||||||
import cc.iotkit.common.api.Paging;
|
import cc.iotkit.common.api.Paging;
|
||||||
import cc.iotkit.model.system.SysLogininfor;
|
import cc.iotkit.model.system.SysLogininfor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录记录数据接口
|
* 登录记录数据接口
|
||||||
*
|
*
|
||||||
|
@ -11,11 +13,15 @@ import cc.iotkit.model.system.SysLogininfor;
|
||||||
*/
|
*/
|
||||||
public interface ISysLogininforData extends ICommonData<SysLogininfor, Long> {
|
public interface ISysLogininforData extends ICommonData<SysLogininfor, Long> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按条件查询
|
||||||
|
*/
|
||||||
|
List<SysLogininfor> findByConditions(SysLogininfor cond);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按条件分页查询
|
* 按条件分页查询
|
||||||
*/
|
*/
|
||||||
Paging<SysLogininfor> findByConditions(String tenantId, String userName,
|
Paging<SysLogininfor> findByConditions(SysLogininfor cond, int page, int size);
|
||||||
String status, int page, int size);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按租户清除登录日志
|
* 按租户清除登录日志
|
||||||
|
@ -24,4 +30,8 @@ public interface ISysLogininforData extends ICommonData<SysLogininfor, Long> {
|
||||||
*/
|
*/
|
||||||
void deleteByTenantId(String tenantId);
|
void deleteByTenantId(String tenantId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除所有
|
||||||
|
*/
|
||||||
|
void deleteAll();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import cc.iotkit.common.api.Paging;
|
||||||
import cc.iotkit.model.system.SysConfig;
|
import cc.iotkit.model.system.SysConfig;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.github.linpeilie.Converter;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@ -68,4 +67,9 @@ public class SysConfigDataImpl implements ISysConfigData {
|
||||||
public Paging<SysConfig> findConfigs(SysConfig query) {
|
public Paging<SysConfig> findConfigs(SysConfig query) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysConfig findByConfigKey(String configKey) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,6 @@ import cn.hutool.core.lang.Dict;
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.ttl.TransmittableThreadLocal;
|
import com.alibaba.ttl.TransmittableThreadLocal;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.time.StopWatch;
|
import org.apache.commons.lang3.time.StopWatch;
|
||||||
import org.aspectj.lang.JoinPoint;
|
import org.aspectj.lang.JoinPoint;
|
||||||
|
@ -26,6 +24,8 @@ import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
package cc.iotkit.common.log.event;
|
package cc.iotkit.common.log.event;
|
||||||
|
|
||||||
|
import cn.hutool.http.useragent.UserAgent;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,9 +36,14 @@ public class LogininforEvent implements Serializable {
|
||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求体
|
* ip
|
||||||
*/
|
*/
|
||||||
private HttpServletRequest request;
|
private String ip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* user-agent
|
||||||
|
*/
|
||||||
|
private UserAgent userAgent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 其他参数
|
* 其他参数
|
||||||
|
|
|
@ -10,11 +10,11 @@ import cc.iotkit.system.dto.bo.SysConfigBo;
|
||||||
import cc.iotkit.system.dto.vo.SysConfigVo;
|
import cc.iotkit.system.dto.vo.SysConfigVo;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import cc.iotkit.system.service.ISysConfigService;
|
import cc.iotkit.system.service.ISysConfigService;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,11 +11,11 @@ import cc.iotkit.system.service.ISysDictDataService;
|
||||||
import cc.iotkit.system.service.ISysDictTypeService;
|
import cc.iotkit.system.service.ISysDictTypeService;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,11 @@ import cc.iotkit.system.dto.bo.SysDictTypeBo;
|
||||||
import cc.iotkit.system.dto.vo.SysDictTypeVo;
|
import cc.iotkit.system.dto.vo.SysDictTypeVo;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import cc.iotkit.system.service.ISysDictTypeService;
|
import cc.iotkit.system.service.ISysDictTypeService;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,7 +13,6 @@ import cc.iotkit.system.dto.vo.SysOssVo;
|
||||||
import cc.iotkit.system.service.ISysOssService;
|
import cc.iotkit.system.service.ISysOssService;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
|
@ -21,6 +20,7 @@ import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -10,11 +10,11 @@ import cc.iotkit.system.dto.bo.SysPostBo;
|
||||||
import cc.iotkit.system.dto.vo.SysPostVo;
|
import cc.iotkit.system.dto.vo.SysPostVo;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import cc.iotkit.system.service.ISysPostService;
|
import cc.iotkit.system.service.ISysPostService;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,11 +17,11 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import cc.iotkit.system.service.ISysDeptService;
|
import cc.iotkit.system.service.ISysDeptService;
|
||||||
import cc.iotkit.system.service.ISysRoleService;
|
import cc.iotkit.system.service.ISysRoleService;
|
||||||
import cc.iotkit.system.service.ISysUserService;
|
import cc.iotkit.system.service.ISysUserService;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,7 +6,6 @@ import cc.iotkit.common.api.Paging;
|
||||||
import cc.iotkit.common.excel.utils.ExcelUtil;
|
import cc.iotkit.common.excel.utils.ExcelUtil;
|
||||||
import cc.iotkit.common.log.annotation.Log;
|
import cc.iotkit.common.log.annotation.Log;
|
||||||
import cc.iotkit.common.log.enums.BusinessType;
|
import cc.iotkit.common.log.enums.BusinessType;
|
||||||
import cc.iotkit.common.tenant.helper.TenantHelper;
|
|
||||||
import cc.iotkit.common.validate.AddGroup;
|
import cc.iotkit.common.validate.AddGroup;
|
||||||
import cc.iotkit.common.validate.EditGroup;
|
import cc.iotkit.common.validate.EditGroup;
|
||||||
import cc.iotkit.common.web.core.BaseController;
|
import cc.iotkit.common.web.core.BaseController;
|
||||||
|
@ -15,7 +14,6 @@ import cc.iotkit.system.dto.vo.SysTenantVo;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import cn.dev33.satoken.annotation.SaCheckRole;
|
import cn.dev33.satoken.annotation.SaCheckRole;
|
||||||
import com.baomidou.lock.annotation.Lock4j;
|
import com.baomidou.lock.annotation.Lock4j;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
@ -31,6 +29,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,13 +14,13 @@ import cc.iotkit.system.dto.vo.SysTenantPackageVo;
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import cn.dev33.satoken.annotation.SaCheckRole;
|
import cn.dev33.satoken.annotation.SaCheckRole;
|
||||||
import cc.iotkit.system.service.ISysTenantPackageService;
|
import cc.iotkit.system.service.ISysTenantPackageService;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,7 +22,6 @@ import cn.dev33.satoken.secure.BCrypt;
|
||||||
import cn.hutool.core.lang.tree.Tree;
|
import cn.hutool.core.lang.tree.Tree;
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import cc.iotkit.system.listener.SysUserImportListener;
|
import cc.iotkit.system.listener.SysUserImportListener;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
|
@ -30,6 +29,7 @@ import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class SysDictDataBo extends BaseDto {
|
||||||
* 字典编码
|
* 字典编码
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "字典编码不能为空", groups = { EditGroup.class })
|
@NotNull(message = "字典编码不能为空", groups = { EditGroup.class })
|
||||||
private Long dictCode;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典排序
|
* 字典排序
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class SysDictTypeBo extends BaseDto {
|
||||||
* 字典主键
|
* 字典主键
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "字典主键不能为空", groups = { EditGroup.class })
|
@NotNull(message = "字典主键不能为空", groups = { EditGroup.class })
|
||||||
private Long dictId;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典名称
|
* 字典名称
|
||||||
|
|
|
@ -21,7 +21,7 @@ public class SysLogininforBo {
|
||||||
/**
|
/**
|
||||||
* 访问ID
|
* 访问ID
|
||||||
*/
|
*/
|
||||||
private Long infoId;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 租户编号
|
* 租户编号
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class SysDictDataVo implements Serializable {
|
||||||
* 字典编码
|
* 字典编码
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "字典编码")
|
@ExcelProperty(value = "字典编码")
|
||||||
private Long dictCode;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典排序
|
* 字典排序
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class SysDictTypeVo implements Serializable {
|
||||||
* 字典主键
|
* 字典主键
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "字典主键")
|
@ExcelProperty(value = "字典主键")
|
||||||
private Long dictId;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典名称
|
* 字典名称
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
package cc.iotkit.system.mapper;
|
|
||||||
|
|
||||||
import cc.iotkit.model.system.SysDept;
|
|
||||||
import cc.iotkit.system.dto.vo.SysDeptVo;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 部门管理 数据层
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
public interface SysDeptMapper extends BaseMapperPlus<SysDept, SysDeptVo> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询部门管理数据
|
|
||||||
*
|
|
||||||
* @param queryWrapper 查询条件
|
|
||||||
* @return 部门信息集合
|
|
||||||
*/
|
|
||||||
@DataPermission({
|
|
||||||
@DataColumn(key = "deptName", value = "dept_id")
|
|
||||||
})
|
|
||||||
List<SysDeptVo> selectDeptList(@Param(Constants.WRAPPER) Wrapper<SysDept> queryWrapper);
|
|
||||||
|
|
||||||
@DataPermission({
|
|
||||||
@DataColumn(key = "deptName", value = "dept_id")
|
|
||||||
})
|
|
||||||
SysDeptVo selectDeptById(Long deptId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据角色ID查询部门树信息
|
|
||||||
*
|
|
||||||
* @param roleId 角色ID
|
|
||||||
* @param deptCheckStrictly 部门树选择项是否关联显示
|
|
||||||
* @return 选中部门列表
|
|
||||||
*/
|
|
||||||
List<Long> selectDeptListByRoleId(@Param("roleId") Long roleId, @Param("deptCheckStrictly") boolean deptCheckStrictly);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
package cc.iotkit.system.mapper;
|
|
||||||
|
|
||||||
import cc.iotkit.common.constant.UserConstants;
|
|
||||||
import cc.iotkit.model.system.SysDictData;
|
|
||||||
import cc.iotkit.system.dto.vo.SysDictDataVo;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 字典表 数据层
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
public interface SysDictDataMapper extends BaseMapperPlus<SysDictData, SysDictDataVo> {
|
|
||||||
|
|
||||||
default List<SysDictDataVo> selectDictDataByType(String dictType) {
|
|
||||||
return selectVoList(
|
|
||||||
new LambdaQueryWrapper<SysDictData>()
|
|
||||||
.eq(SysDictData::getStatus, UserConstants.DICT_NORMAL)
|
|
||||||
.eq(SysDictData::getDictType, dictType)
|
|
||||||
.orderByAsc(SysDictData::getDictSort));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
package cc.iotkit.system.mapper;
|
|
||||||
|
|
||||||
import cc.iotkit.system.dto.vo.SysPostVo;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 岗位信息 数据层
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
public interface SysPostMapper extends BaseMapperPlus<SysPost, SysPostVo> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据用户ID获取岗位选择框列表
|
|
||||||
*
|
|
||||||
* @param userId 用户ID
|
|
||||||
* @return 选中岗位ID列表
|
|
||||||
*/
|
|
||||||
List<Long> selectPostListByUserId(Long userId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询用户所属岗位组
|
|
||||||
*
|
|
||||||
* @param userName 用户名
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
List<SysPostVo> selectPostsByUserName(String userName);
|
|
||||||
|
|
||||||
}
|
|
|
@ -38,7 +38,7 @@ public interface ISysLogininforService {
|
||||||
* @param infoIds 需要删除的登录日志ID
|
* @param infoIds 需要删除的登录日志ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteLogininforByIds(Long[] infoIds);
|
void deleteLogininforByIds(Long[] infoIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清空系统登录日志
|
* 清空系统登录日志
|
||||||
|
|
|
@ -4,9 +4,9 @@ import cc.iotkit.common.api.PageRequest;
|
||||||
import cc.iotkit.common.api.Paging;
|
import cc.iotkit.common.api.Paging;
|
||||||
import cc.iotkit.system.dto.bo.SysOssBo;
|
import cc.iotkit.system.dto.bo.SysOssBo;
|
||||||
import cc.iotkit.system.dto.vo.SysOssVo;
|
import cc.iotkit.system.dto.vo.SysOssVo;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
package cc.iotkit.system.service.impl;
|
package cc.iotkit.system.service.impl;
|
||||||
|
|
||||||
import cc.iotkit.common.utils.StreamUtils;
|
|
||||||
import cc.iotkit.model.system.SysDept;
|
|
||||||
import cc.iotkit.system.dto.SysRoleDept;
|
|
||||||
import cc.iotkit.system.mapper.SysDeptMapper;
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.convert.Convert;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,11 @@ import cc.iotkit.common.api.PageRequest;
|
||||||
import cc.iotkit.common.api.Paging;
|
import cc.iotkit.common.api.Paging;
|
||||||
import cc.iotkit.common.constant.CacheNames;
|
import cc.iotkit.common.constant.CacheNames;
|
||||||
|
|
||||||
import cc.iotkit.common.exception.BizException;
|
|
||||||
import cc.iotkit.common.redis.utils.CacheUtils;
|
|
||||||
import cc.iotkit.common.utils.MapstructUtils;
|
import cc.iotkit.common.utils.MapstructUtils;
|
||||||
|
import cc.iotkit.data.system.ISysDictData;
|
||||||
import cc.iotkit.model.system.SysDictData;
|
import cc.iotkit.model.system.SysDictData;
|
||||||
import cc.iotkit.system.dto.bo.SysDictDataBo;
|
import cc.iotkit.system.dto.bo.SysDictDataBo;
|
||||||
import cc.iotkit.system.dto.vo.SysDictDataVo;
|
import cc.iotkit.system.dto.vo.SysDictDataVo;
|
||||||
import cc.iotkit.system.mapper.SysDictDataMapper;
|
|
||||||
import cc.iotkit.system.service.ISysDictDataService;
|
import cc.iotkit.system.service.ISysDictDataService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.cache.annotation.CachePut;
|
import org.springframework.cache.annotation.CachePut;
|
||||||
|
@ -27,13 +25,16 @@ import java.util.List;
|
||||||
@Service
|
@Service
|
||||||
public class SysDictDataServiceImpl implements ISysDictDataService {
|
public class SysDictDataServiceImpl implements ISysDictDataService {
|
||||||
|
|
||||||
private final SysDictDataMapper baseMapper;
|
private final ISysDictData sysDictData;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Paging<SysDictDataVo> selectPageDictDataList(SysDictDataBo dictData, PageRequest<?> query) {
|
public Paging<SysDictDataVo> selectPageDictDataList(SysDictDataBo dictData, PageRequest<?> query) {
|
||||||
LambdaQueryWrapper<SysDictData> lqw = buildQueryWrapper(dictData);
|
return MapstructUtils.convert(
|
||||||
Page<SysDictDataVo> page = baseMapper.selectVoPage(query.build(), lqw);
|
sysDictData.findByConditions(
|
||||||
return TableDataInfo.build(page);
|
MapstructUtils.convert(dictData, SysDictData.class),
|
||||||
|
query.getPageNum(),
|
||||||
|
query.getPageSize()
|
||||||
|
), SysDictDataVo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,18 +45,10 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysDictDataVo> selectDictDataList(SysDictDataBo dictData) {
|
public List<SysDictDataVo> selectDictDataList(SysDictDataBo dictData) {
|
||||||
LambdaQueryWrapper<SysDictData> lqw = buildQueryWrapper(dictData);
|
return MapstructUtils.convert(
|
||||||
return baseMapper.selectVoList(lqw);
|
sysDictData.findByConditions(
|
||||||
}
|
MapstructUtils.convert(dictData, SysDictData.class)
|
||||||
|
), SysDictDataVo.class);
|
||||||
private LambdaQueryWrapper<SysDictData> buildQueryWrapper(SysDictDataBo bo) {
|
|
||||||
LambdaQueryWrapper<SysDictData> lqw = Wrappers.lambdaQuery();
|
|
||||||
lqw.eq(bo.getDictSort() != null, SysDictData::getDictSort, bo.getDictSort());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getDictLabel()), SysDictData::getDictLabel, bo.getDictLabel());
|
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getDictType()), SysDictData::getDictType, bo.getDictType());
|
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysDictData::getStatus, bo.getStatus());
|
|
||||||
lqw.orderByAsc(SysDictData::getDictSort);
|
|
||||||
return lqw;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,11 +60,7 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String selectDictLabel(String dictType, String dictValue) {
|
public String selectDictLabel(String dictType, String dictValue) {
|
||||||
return baseMapper.selectOne(new LambdaQueryWrapper<SysDictData>()
|
return sysDictData.findByDictTypeAndDictValue(dictType, dictValue).getDictLabel();
|
||||||
.select(SysDictData::getDictLabel)
|
|
||||||
.eq(SysDictData::getDictType, dictType)
|
|
||||||
.eq(SysDictData::getDictValue, dictValue))
|
|
||||||
.getDictLabel();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,7 +71,7 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysDictDataVo selectDictDataById(Long dictCode) {
|
public SysDictDataVo selectDictDataById(Long dictCode) {
|
||||||
return baseMapper.selectVoById(dictCode);
|
return MapstructUtils.convert(sysDictData.findById(dictCode), SysDictDataVo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -93,9 +82,9 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
||||||
@Override
|
@Override
|
||||||
public void deleteDictDataByIds(Long[] dictCodes) {
|
public void deleteDictDataByIds(Long[] dictCodes) {
|
||||||
for (Long dictCode : dictCodes) {
|
for (Long dictCode : dictCodes) {
|
||||||
SysDictData data = baseMapper.selectById(dictCode);
|
SysDictData data = sysDictData.findById(dictCode);
|
||||||
baseMapper.deleteById(dictCode);
|
sysDictData.deleteById(dictCode);
|
||||||
CacheUtils.evict(CacheNames.SYS_DICT, data.getDictType());
|
// CacheUtils.evict(CacheNames.SYS_DICT, data.getDictType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,11 +98,8 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
||||||
@Override
|
@Override
|
||||||
public List<SysDictDataVo> insertDictData(SysDictDataBo bo) {
|
public List<SysDictDataVo> insertDictData(SysDictDataBo bo) {
|
||||||
SysDictData data = MapstructUtils.convert(bo, SysDictData.class);
|
SysDictData data = MapstructUtils.convert(bo, SysDictData.class);
|
||||||
int row = baseMapper.insert(data);
|
sysDictData.save(data);
|
||||||
if (row > 0) {
|
return MapstructUtils.convert(sysDictData.findByDicType(data.getDictType()), SysDictDataVo.class);
|
||||||
return baseMapper.selectDictDataByType(data.getDictType());
|
|
||||||
}
|
|
||||||
throw new BizException("操作失败");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -122,15 +108,12 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
||||||
* @param bo 字典数据信息
|
* @param bo 字典数据信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@CachePut(cacheNames = CacheNames.SYS_DICT, key = "#bo.dictType")
|
// @CachePut(cacheNames = CacheNames.SYS_DICT, key = "#bo.dictType")
|
||||||
@Override
|
@Override
|
||||||
public List<SysDictDataVo> updateDictData(SysDictDataBo bo) {
|
public List<SysDictDataVo> updateDictData(SysDictDataBo bo) {
|
||||||
SysDictData data = MapstructUtils.convert(bo, SysDictData.class);
|
SysDictData data = MapstructUtils.convert(bo, SysDictData.class);
|
||||||
int row = baseMapper.updateById(data);
|
sysDictData.save(data);
|
||||||
if (row > 0) {
|
return MapstructUtils.convert(sysDictData.findByDicType(data.getDictType()), SysDictDataVo.class);
|
||||||
return baseMapper.selectDictDataByType(data.getDictType());
|
|
||||||
}
|
|
||||||
throw new BizException("操作失败");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package cc.iotkit.system.service.impl;
|
package cc.iotkit.system.service.impl;
|
||||||
|
|
||||||
import cc.iotkit.common.api.PageRequest;
|
import cc.iotkit.common.api.PageRequest;
|
||||||
|
import cc.iotkit.common.api.Paging;
|
||||||
import cc.iotkit.common.constant.CacheConstants;
|
import cc.iotkit.common.constant.CacheConstants;
|
||||||
import cc.iotkit.common.constant.CacheNames;
|
import cc.iotkit.common.constant.CacheNames;
|
||||||
import cc.iotkit.common.api.Paging;
|
|
||||||
import cc.iotkit.common.exception.BizException;
|
import cc.iotkit.common.exception.BizException;
|
||||||
import cc.iotkit.common.redis.utils.CacheUtils;
|
import cc.iotkit.common.redis.utils.CacheUtils;
|
||||||
import cc.iotkit.common.service.DictService;
|
import cc.iotkit.common.service.DictService;
|
||||||
|
@ -11,21 +11,17 @@ import cc.iotkit.common.utils.MapstructUtils;
|
||||||
import cc.iotkit.common.utils.SpringUtils;
|
import cc.iotkit.common.utils.SpringUtils;
|
||||||
import cc.iotkit.common.utils.StreamUtils;
|
import cc.iotkit.common.utils.StreamUtils;
|
||||||
import cc.iotkit.common.utils.StringUtils;
|
import cc.iotkit.common.utils.StringUtils;
|
||||||
import cc.iotkit.model.system.SysDictData;
|
import cc.iotkit.data.system.ISysDictData;
|
||||||
|
import cc.iotkit.data.system.ISysDictTypeData;
|
||||||
import cc.iotkit.model.system.SysDictType;
|
import cc.iotkit.model.system.SysDictType;
|
||||||
import cc.iotkit.system.dto.bo.SysDictTypeBo;
|
import cc.iotkit.system.dto.bo.SysDictTypeBo;
|
||||||
import cc.iotkit.system.dto.vo.SysDictDataVo;
|
import cc.iotkit.system.dto.vo.SysDictDataVo;
|
||||||
import cc.iotkit.system.dto.vo.SysDictTypeVo;
|
import cc.iotkit.system.dto.vo.SysDictTypeVo;
|
||||||
import cc.iotkit.system.mapper.SysDictDataMapper;
|
|
||||||
import cn.dev33.satoken.context.SaHolder;
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
|
||||||
import cc.iotkit.system.service.ISysDictTypeService;
|
import cc.iotkit.system.service.ISysDictTypeService;
|
||||||
|
import cn.dev33.satoken.context.SaHolder;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.cache.annotation.CachePut;
|
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -42,14 +38,16 @@ import java.util.stream.Collectors;
|
||||||
@Service
|
@Service
|
||||||
public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService {
|
public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService {
|
||||||
|
|
||||||
private final SysDictTypeMapper baseMapper;
|
private final ISysDictTypeData sysDictTypeData;
|
||||||
private final SysDictDataMapper dictDataMapper;
|
private final ISysDictData sysDictData;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Paging<SysDictTypeVo> selectPageDictTypeList(SysDictTypeBo dictType, PageRequest<?> pageQuery) {
|
public Paging<SysDictTypeVo> selectPageDictTypeList(SysDictTypeBo dictType, PageRequest<?> query) {
|
||||||
LambdaQueryWrapper<SysDictType> lqw = buildQueryWrapper(dictType);
|
return MapstructUtils.convert(
|
||||||
Page<SysDictTypeVo> page = baseMapper.selectVoPage(query.build(), lqw);
|
sysDictTypeData.findByConditions(
|
||||||
return TableDataInfo.build(page);
|
MapstructUtils.convert(dictType, SysDictType.class),
|
||||||
|
query.getPageNum(), query.getPageSize()),
|
||||||
|
SysDictTypeVo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,19 +58,10 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysDictTypeVo> selectDictTypeList(SysDictTypeBo dictType) {
|
public List<SysDictTypeVo> selectDictTypeList(SysDictTypeBo dictType) {
|
||||||
LambdaQueryWrapper<SysDictType> lqw = buildQueryWrapper(dictType);
|
return MapstructUtils.convert(
|
||||||
return baseMapper.selectVoList(lqw);
|
sysDictTypeData.findByConditions(
|
||||||
}
|
MapstructUtils.convert(dictType, SysDictType.class)),
|
||||||
|
SysDictTypeVo.class);
|
||||||
private LambdaQueryWrapper<SysDictType> buildQueryWrapper(SysDictTypeBo bo) {
|
|
||||||
Map<String, Object> params = bo.getParams();
|
|
||||||
LambdaQueryWrapper<SysDictType> lqw = Wrappers.lambdaQuery();
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getDictName()), SysDictType::getDictName, bo.getDictName());
|
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getDictType()), SysDictType::getDictType, bo.getDictType());
|
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysDictType::getStatus, bo.getStatus());
|
|
||||||
lqw.between(params.get("beginTime") != null && params.get("endTime") != null,
|
|
||||||
SysDictType::getCreateTime, params.get("beginTime"), params.get("endTime"));
|
|
||||||
return lqw;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,7 +71,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysDictTypeVo> selectDictTypeAll() {
|
public List<SysDictTypeVo> selectDictTypeAll() {
|
||||||
return baseMapper.selectVoList();
|
return MapstructUtils.convert(sysDictTypeData.findAll(), SysDictTypeVo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,14 +80,10 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||||
* @param dictType 字典类型
|
* @param dictType 字典类型
|
||||||
* @return 字典数据集合信息
|
* @return 字典数据集合信息
|
||||||
*/
|
*/
|
||||||
@Cacheable(cacheNames = CacheNames.SYS_DICT, key = "#dictType")
|
// @Cacheable(cacheNames = CacheNames.SYS_DICT, key = "#dictType")
|
||||||
@Override
|
@Override
|
||||||
public List<SysDictDataVo> selectDictDataByType(String dictType) {
|
public List<SysDictDataVo> selectDictDataByType(String dictType) {
|
||||||
List<SysDictDataVo> dictDatas = dictDataMapper.selectDictDataByType(dictType);
|
return MapstructUtils.convert(sysDictData.findByDicType(dictType), SysDictDataVo.class);
|
||||||
if (CollUtil.isNotEmpty(dictDatas)) {
|
|
||||||
return dictDatas;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,7 +94,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SysDictTypeVo selectDictTypeById(Long dictId) {
|
public SysDictTypeVo selectDictTypeById(Long dictId) {
|
||||||
return baseMapper.selectVoById(dictId);
|
return MapstructUtils.convert(sysDictTypeData.findById(dictId), SysDictTypeVo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -118,10 +103,10 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||||
* @param dictType 字典类型
|
* @param dictType 字典类型
|
||||||
* @return 字典类型
|
* @return 字典类型
|
||||||
*/
|
*/
|
||||||
@Cacheable(cacheNames = CacheNames.SYS_DICT, key = "#dictType")
|
// @Cacheable(cacheNames = CacheNames.SYS_DICT, key = "#dictType")
|
||||||
@Override
|
@Override
|
||||||
public SysDictTypeVo selectDictTypeByType(String dictType) {
|
public SysDictTypeVo selectDictTypeByType(String dictType) {
|
||||||
return baseMapper.selectVoById(new LambdaQueryWrapper<SysDictType>().eq(SysDictType::getDictType, dictType));
|
return MapstructUtils.convert(sysDictTypeData.findByDicType(dictType), SysDictTypeVo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -132,14 +117,13 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||||
@Override
|
@Override
|
||||||
public void deleteDictTypeByIds(Long[] dictIds) {
|
public void deleteDictTypeByIds(Long[] dictIds) {
|
||||||
for (Long dictId : dictIds) {
|
for (Long dictId : dictIds) {
|
||||||
SysDictType dictType = baseMapper.selectById(dictId);
|
SysDictType dictType = sysDictTypeData.findById(dictId);
|
||||||
if (dictDataMapper.exists(new LambdaQueryWrapper<SysDictData>()
|
if (sysDictData.countByDicType(dictType.getDictType()) > 0) {
|
||||||
.eq(SysDictData::getDictType, dictType.getDictType()))) {
|
throw new BizException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
|
||||||
throw new ServiceException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
|
|
||||||
}
|
}
|
||||||
CacheUtils.evict(CacheNames.SYS_DICT, dictType.getDictType());
|
CacheUtils.evict(CacheNames.SYS_DICT, dictType.getDictType());
|
||||||
}
|
}
|
||||||
baseMapper.deleteBatchIds(Arrays.asList(dictIds));
|
sysDictTypeData.deleteByIds(dictIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -156,15 +140,12 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||||
* @param bo 字典类型信息
|
* @param bo 字典类型信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@CachePut(cacheNames = CacheNames.SYS_DICT, key = "#bo.dictType")
|
// @CachePut(cacheNames = CacheNames.SYS_DICT, key = "#bo.dictType")
|
||||||
@Override
|
@Override
|
||||||
public List<SysDictTypeVo> insertDictType(SysDictTypeBo bo) {
|
public List<SysDictTypeVo> insertDictType(SysDictTypeBo bo) {
|
||||||
SysDictType dict = MapstructUtils.convert(bo, SysDictType.class);
|
SysDictType dict = MapstructUtils.convert(bo, SysDictType.class);
|
||||||
int row = baseMapper.insert(dict);
|
sysDictTypeData.save(dict);
|
||||||
if (row > 0) {
|
return new ArrayList<>();
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
throw new BizException("操作失败");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -173,21 +154,13 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||||
* @param bo 字典类型信息
|
* @param bo 字典类型信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@CachePut(cacheNames = CacheNames.SYS_DICT, key = "#bo.dictType")
|
// @CachePut(cacheNames = CacheNames.SYS_DICT, key = "#bo.dictType")
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public List<SysDictDataVo> updateDictType(SysDictTypeBo bo) {
|
public List<SysDictDataVo> updateDictType(SysDictTypeBo bo) {
|
||||||
SysDictType dict = MapstructUtils.convert(bo, SysDictType.class);
|
SysDictType oldDict = sysDictTypeData.findById(bo.getId());
|
||||||
SysDictType oldDict = baseMapper.selectById(dict.getDictId());
|
sysDictTypeData.updateDicType(oldDict.getDictType(), bo.getDictType());
|
||||||
dictDataMapper.update(null, new LambdaUpdateWrapper<SysDictData>()
|
// CacheUtils.evict(CacheNames.SYS_DICT, oldDict.getDictType());
|
||||||
.set(SysDictData::getDictType, dict.getDictType())
|
return MapstructUtils.convert(sysDictData.findByDicType(bo.getDictType()), SysDictDataVo.class);
|
||||||
.eq(SysDictData::getDictType, oldDict.getDictType()));
|
|
||||||
int row = baseMapper.updateById(dict);
|
|
||||||
if (row > 0) {
|
|
||||||
CacheUtils.evict(CacheNames.SYS_DICT, oldDict.getDictType());
|
|
||||||
return dictDataMapper.selectDictDataByType(dict.getDictType());
|
|
||||||
}
|
|
||||||
throw new BizException("操作失败");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -198,10 +171,11 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean checkDictTypeUnique(SysDictTypeBo dictType) {
|
public boolean checkDictTypeUnique(SysDictTypeBo dictType) {
|
||||||
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysDictType>()
|
// boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysDictType>()
|
||||||
.eq(SysDictType::getDictType, dictType.getDictType())
|
// .eq(SysDictType::getDictType, dictType.getDictType())
|
||||||
.ne(ObjectUtil.isNotNull(dictType.getDictId()), SysDictType::getDictId, dictType.getDictId()));
|
// .ne(ObjectUtil.isNotNull(dictType.getDictId()), SysDictType::getDictId, dictType.getDictId()));
|
||||||
return !exist;
|
// return !exist;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -225,8 +199,8 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||||
Map<String, String> map = StreamUtils.toMap(datas, SysDictDataVo::getDictValue, SysDictDataVo::getDictLabel);
|
Map<String, String> map = StreamUtils.toMap(datas, SysDictDataVo::getDictValue, SysDictDataVo::getDictLabel);
|
||||||
if (StringUtils.containsAny(dictValue, separator)) {
|
if (StringUtils.containsAny(dictValue, separator)) {
|
||||||
return Arrays.stream(dictValue.split(separator))
|
return Arrays.stream(dictValue.split(separator))
|
||||||
.map(v -> map.getOrDefault(v, StringUtils.EMPTY))
|
.map(v -> map.getOrDefault(v, StringUtils.EMPTY))
|
||||||
.collect(Collectors.joining(separator));
|
.collect(Collectors.joining(separator));
|
||||||
} else {
|
} else {
|
||||||
return map.getOrDefault(dictValue, StringUtils.EMPTY);
|
return map.getOrDefault(dictValue, StringUtils.EMPTY);
|
||||||
}
|
}
|
||||||
|
@ -253,8 +227,8 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService
|
||||||
Map<String, String> map = StreamUtils.toMap(datas, SysDictDataVo::getDictLabel, SysDictDataVo::getDictValue);
|
Map<String, String> map = StreamUtils.toMap(datas, SysDictDataVo::getDictLabel, SysDictDataVo::getDictValue);
|
||||||
if (StringUtils.containsAny(dictLabel, separator)) {
|
if (StringUtils.containsAny(dictLabel, separator)) {
|
||||||
return Arrays.stream(dictLabel.split(separator))
|
return Arrays.stream(dictLabel.split(separator))
|
||||||
.map(l -> map.getOrDefault(l, StringUtils.EMPTY))
|
.map(l -> map.getOrDefault(l, StringUtils.EMPTY))
|
||||||
.collect(Collectors.joining(separator));
|
.collect(Collectors.joining(separator));
|
||||||
} else {
|
} else {
|
||||||
return map.getOrDefault(dictLabel, StringUtils.EMPTY);
|
return map.getOrDefault(dictLabel, StringUtils.EMPTY);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,31 +1,26 @@
|
||||||
package cc.iotkit.system.service.impl;
|
package cc.iotkit.system.service.impl;
|
||||||
|
|
||||||
import cc.iotkit.common.api.PageRequest;
|
import cc.iotkit.common.api.PageRequest;
|
||||||
import cc.iotkit.common.constant.Constants;
|
|
||||||
import cc.iotkit.common.api.Paging;
|
import cc.iotkit.common.api.Paging;
|
||||||
|
import cc.iotkit.common.constant.Constants;
|
||||||
import cc.iotkit.common.log.event.LogininforEvent;
|
import cc.iotkit.common.log.event.LogininforEvent;
|
||||||
import cc.iotkit.common.utils.MapstructUtils;
|
import cc.iotkit.common.utils.MapstructUtils;
|
||||||
import cc.iotkit.common.utils.ServletUtils;
|
|
||||||
import cc.iotkit.common.utils.StringUtils;
|
import cc.iotkit.common.utils.StringUtils;
|
||||||
import cc.iotkit.common.utils.ip.AddressUtils;
|
import cc.iotkit.common.utils.ip.AddressUtils;
|
||||||
import cc.iotkit.common.web.utils.UnsignedMathGenerator;
|
import cc.iotkit.data.system.ISysLogininforData;
|
||||||
import cc.iotkit.model.system.SysLogininfor;
|
import cc.iotkit.model.system.SysLogininfor;
|
||||||
import cc.iotkit.system.dto.bo.SysLogininforBo;
|
import cc.iotkit.system.dto.bo.SysLogininforBo;
|
||||||
import cc.iotkit.system.dto.vo.SysLogininforVo;
|
import cc.iotkit.system.dto.vo.SysLogininforVo;
|
||||||
import cn.hutool.http.useragent.UserAgent;
|
|
||||||
import cn.hutool.http.useragent.UserAgentUtil;
|
|
||||||
import cc.iotkit.system.service.ISysLogininforService;
|
import cc.iotkit.system.service.ISysLogininforService;
|
||||||
|
import cn.hutool.http.useragent.UserAgent;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统访问日志情况信息 服务层处理
|
* 系统访问日志情况信息 服务层处理
|
||||||
|
@ -37,7 +32,7 @@ import java.util.Map;
|
||||||
@Service
|
@Service
|
||||||
public class SysLogininforServiceImpl implements ISysLogininforService {
|
public class SysLogininforServiceImpl implements ISysLogininforService {
|
||||||
|
|
||||||
private final SysLogininforMapper baseMapper;
|
private final ISysLogininforData sysLogininforData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 记录登录信息
|
* 记录登录信息
|
||||||
|
@ -47,10 +42,7 @@ public class SysLogininforServiceImpl implements ISysLogininforService {
|
||||||
@Async
|
@Async
|
||||||
@EventListener
|
@EventListener
|
||||||
public void recordLogininfor(LogininforEvent logininforEvent) {
|
public void recordLogininfor(LogininforEvent logininforEvent) {
|
||||||
HttpServletRequest request = logininforEvent.getRequest();
|
String ip = logininforEvent.getIp();
|
||||||
final UserAgent userAgent = UserAgentUtil.parse(request.getHeader("User-Agent"));
|
|
||||||
final String ip = UnsignedMathGenerator.ServletUtils.getClientIP(request);
|
|
||||||
|
|
||||||
String address = AddressUtils.getRealAddressByIP(ip);
|
String address = AddressUtils.getRealAddressByIP(ip);
|
||||||
StringBuilder s = new StringBuilder();
|
StringBuilder s = new StringBuilder();
|
||||||
s.append(getBlock(ip));
|
s.append(getBlock(ip));
|
||||||
|
@ -60,6 +52,7 @@ public class SysLogininforServiceImpl implements ISysLogininforService {
|
||||||
s.append(getBlock(logininforEvent.getMessage()));
|
s.append(getBlock(logininforEvent.getMessage()));
|
||||||
// 打印信息到日志
|
// 打印信息到日志
|
||||||
log.info(s.toString(), logininforEvent.getArgs());
|
log.info(s.toString(), logininforEvent.getArgs());
|
||||||
|
UserAgent userAgent = logininforEvent.getUserAgent();
|
||||||
// 获取客户端操作系统
|
// 获取客户端操作系统
|
||||||
String os = userAgent.getOs().getName();
|
String os = userAgent.getOs().getName();
|
||||||
// 获取客户端浏览器
|
// 获取客户端浏览器
|
||||||
|
@ -92,19 +85,13 @@ public class SysLogininforServiceImpl implements ISysLogininforService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Paging<SysLogininforVo> selectPageLogininforList(SysLogininforBo logininfor, PageRequest<?> query) {
|
public Paging<SysLogininforVo> selectPageLogininforList(SysLogininforBo logininfor, PageRequest<?> query) {
|
||||||
Map<String, Object> params = logininfor.getParams();
|
return MapstructUtils.convert(
|
||||||
LambdaQueryWrapper<SysLogininfor> lqw = new LambdaQueryWrapper<SysLogininfor>()
|
sysLogininforData.findByConditions(
|
||||||
.like(StringUtils.isNotBlank(logininfor.getIpaddr()), SysLogininfor::getIpaddr, logininfor.getIpaddr())
|
MapstructUtils.convert(logininfor, SysLogininfor.class),
|
||||||
.eq(StringUtils.isNotBlank(logininfor.getStatus()), SysLogininfor::getStatus, logininfor.getStatus())
|
query.getPageNum(),
|
||||||
.like(StringUtils.isNotBlank(logininfor.getUserName()), SysLogininfor::getUserName, logininfor.getUserName())
|
query.getPageSize()
|
||||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
), SysLogininforVo.class
|
||||||
SysLogininfor::getLoginTime, params.get("beginTime"), params.get("endTime"));
|
);
|
||||||
if (StringUtils.isBlank(query.getOrderByColumn())) {
|
|
||||||
pageQuery.setOrderByColumn("info_id");
|
|
||||||
pageQuery.setIsAsc("desc");
|
|
||||||
}
|
|
||||||
Page<SysLogininforVo> page = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
||||||
return TableDataInfo.build(page);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -116,7 +103,7 @@ public class SysLogininforServiceImpl implements ISysLogininforService {
|
||||||
public void insertLogininfor(SysLogininforBo bo) {
|
public void insertLogininfor(SysLogininforBo bo) {
|
||||||
SysLogininfor logininfor = MapstructUtils.convert(bo, SysLogininfor.class);
|
SysLogininfor logininfor = MapstructUtils.convert(bo, SysLogininfor.class);
|
||||||
logininfor.setLoginTime(new Date());
|
logininfor.setLoginTime(new Date());
|
||||||
baseMapper.insert(logininfor);
|
sysLogininforData.save(logininfor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -127,14 +114,11 @@ public class SysLogininforServiceImpl implements ISysLogininforService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SysLogininforVo> selectLogininforList(SysLogininforBo logininfor) {
|
public List<SysLogininforVo> selectLogininforList(SysLogininforBo logininfor) {
|
||||||
Map<String, Object> params = logininfor.getParams();
|
return MapstructUtils.convert(
|
||||||
return baseMapper.selectVoList(new LambdaQueryWrapper<SysLogininfor>()
|
sysLogininforData.findByConditions(
|
||||||
.like(StringUtils.isNotBlank(logininfor.getIpaddr()), SysLogininfor::getIpaddr, logininfor.getIpaddr())
|
MapstructUtils.convert(logininfor, SysLogininfor.class)
|
||||||
.eq(StringUtils.isNotBlank(logininfor.getStatus()), SysLogininfor::getStatus, logininfor.getStatus())
|
), SysLogininforVo.class
|
||||||
.like(StringUtils.isNotBlank(logininfor.getUserName()), SysLogininfor::getUserName, logininfor.getUserName())
|
);
|
||||||
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
|
||||||
SysLogininfor::getLoginTime, params.get("beginTime"), params.get("endTime"))
|
|
||||||
.orderByDesc(SysLogininfor::getInfoId));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -144,8 +128,8 @@ public class SysLogininforServiceImpl implements ISysLogininforService {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int deleteLogininforByIds(Long[] infoIds) {
|
public void deleteLogininforByIds(Long[] infoIds) {
|
||||||
return baseMapper.deleteBatchIds(Arrays.asList(infoIds));
|
sysLogininforData.deleteByIds(infoIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -153,6 +137,6 @@ public class SysLogininforServiceImpl implements ISysLogininforService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void cleanLogininfor() {
|
public void cleanLogininfor() {
|
||||||
baseMapper.delete(new LambdaQueryWrapper<>());
|
sysLogininforData.deleteAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,11 +33,6 @@ import java.util.*;
|
||||||
@Service
|
@Service
|
||||||
public class SysMenuServiceImpl implements ISysMenuService {
|
public class SysMenuServiceImpl implements ISysMenuService {
|
||||||
|
|
||||||
private final SysMenuMapper baseMapper;
|
|
||||||
private final SysRoleMapper roleMapper;
|
|
||||||
private final SysRoleMenuMapper roleMenuMapper;
|
|
||||||
private final SysTenantPackageMapper tenantPackageMapper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户查询系统菜单列表
|
* 根据用户查询系统菜单列表
|
||||||
*
|
*
|
||||||
|
|
|
@ -25,9 +25,6 @@ import java.util.List;
|
||||||
@Service
|
@Service
|
||||||
public class SysNoticeServiceImpl implements ISysNoticeService {
|
public class SysNoticeServiceImpl implements ISysNoticeService {
|
||||||
|
|
||||||
private final SysNoticeMapper baseMapper;
|
|
||||||
private final SysUserMapper userMapper;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Paging<SysNoticeVo> selectPageNoticeList(SysNoticeBo notice, PageRequest<?> query) {
|
public Paging<SysNoticeVo> selectPageNoticeList(SysNoticeBo notice, PageRequest<?> query) {
|
||||||
LambdaQueryWrapper<SysNotice> lqw = buildQueryWrapper(notice);
|
LambdaQueryWrapper<SysNotice> lqw = buildQueryWrapper(notice);
|
||||||
|
|
|
@ -36,11 +36,6 @@ import java.util.*;
|
||||||
@Service
|
@Service
|
||||||
public class SysRoleServiceImpl implements ISysRoleService {
|
public class SysRoleServiceImpl implements ISysRoleService {
|
||||||
|
|
||||||
private final SysRoleMapper baseMapper;
|
|
||||||
private final SysRoleMenuMapper roleMenuMapper;
|
|
||||||
private final SysUserRoleMapper userRoleMapper;
|
|
||||||
private final SysRoleDeptMapper roleDeptMapper;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Paging<SysRoleVo> selectPageRoleList(SysRoleBo role, PageRequest<?> query) {
|
public Paging<SysRoleVo> selectPageRoleList(SysRoleBo role, PageRequest<?> query) {
|
||||||
Page<SysRoleVo> page = baseMapper.selectPageRoleList(query.build(), this.buildQueryWrapper(role));
|
Page<SysRoleVo> page = baseMapper.selectPageRoleList(query.build(), this.buildQueryWrapper(role));
|
||||||
|
|
Loading…
Reference in New Issue