+ * MappedJdbcTypes 数据库中的数据类型 MappedTypes java中的的数据类型
+ *
+ * @author xuzihui
+ * @date 2019-11-20
+ */
+@MappedTypes(value = { String[].class })
+@MappedJdbcTypes(value = JdbcType.VARCHAR)
+public class JsonStringArrayTypeHandler extends BaseTypeHandler {
+
+ @Override
+ public void setNonNullParameter(PreparedStatement ps, int i, String[] parameter, JdbcType jdbcType)
+ throws SQLException {
+ ps.setString(i, ArrayUtil.join(parameter, StrUtil.COMMA));
+ }
+
+ @Override
+ @SneakyThrows
+ public String[] getNullableResult(ResultSet rs, String columnName) {
+ String reString = rs.getString(columnName);
+ return Convert.toStrArray(reString);
+ }
+
+ @Override
+ @SneakyThrows
+ public String[] getNullableResult(ResultSet rs, int columnIndex) {
+ String reString = rs.getString(columnIndex);
+ return Convert.toStrArray(reString);
+ }
+
+ @Override
+ @SneakyThrows
+ public String[] getNullableResult(CallableStatement cs, int columnIndex) {
+ String reString = cs.getString(columnIndex);
+ return Convert.toStrArray(reString);
+ }
+
+}
diff --git a/pig-common/pig-common-oss/pom.xml b/pig-common/pig-common-oss/pom.xml
new file mode 100755
index 00000000..1ec26766
--- /dev/null
+++ b/pig-common/pig-common-oss/pom.xml
@@ -0,0 +1,28 @@
+
+
+ 4.0.0
+
+ com.pig4cloud
+ pig-common
+ 3.7.0-SNAPSHOT
+
+
+ pig-common-oss
+ jar
+
+ pig 文件系统依赖
+
+
+
+ com.amazonaws
+ aws-java-sdk-s3
+ ${aws.version}
+
+
+ cn.hutool
+ hutool-core
+
+
+
diff --git a/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/FileAutoConfiguration.java b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/FileAutoConfiguration.java
new file mode 100755
index 00000000..2227b953
--- /dev/null
+++ b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/FileAutoConfiguration.java
@@ -0,0 +1,36 @@
+/*
+ * 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 pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ */
+
+package com.pig4cloud.pig.common.file;
+
+import com.pig4cloud.pig.common.file.core.FileProperties;
+import com.pig4cloud.pig.common.file.local.LocalFileAutoConfiguration;
+import com.pig4cloud.pig.common.file.oss.OssAutoConfiguration;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Import;
+
+/**
+ * aws 自动配置类
+ *
+ * @author lengleng
+ * @author 858695266
+ */
+@Import({ LocalFileAutoConfiguration.class, OssAutoConfiguration.class })
+@EnableConfigurationProperties({ FileProperties.class })
+public class FileAutoConfiguration {
+
+}
diff --git a/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/core/FileProperties.java b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/core/FileProperties.java
new file mode 100755
index 00000000..e225cd95
--- /dev/null
+++ b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/core/FileProperties.java
@@ -0,0 +1,51 @@
+/*
+ * 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 pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ */
+
+package com.pig4cloud.pig.common.file.core;
+
+import com.pig4cloud.pig.common.file.local.LocalFileProperties;
+import com.pig4cloud.pig.common.file.oss.OssProperties;
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * 文件 配置信息
+ *
+ * @author lengleng
+ *
+ *
+ * API Documentation
+ */
+ List getAllBuckets();
+
+ /**
+ * @param bucketName bucket名称
+ * @see
+ */
+ void removeBucket(String bucketName);
+
+ /**
+ * 上传文件
+ * @param bucketName bucket名称
+ * @param objectName 文件名称
+ * @param stream 文件流
+ * @param contextType 文件类型
+ * @throws Exception
+ */
+ void putObject(String bucketName, String objectName, InputStream stream, String contextType) throws Exception;
+
+ /**
+ * 上传文件
+ * @param bucketName bucket名称
+ * @param objectName 文件名称
+ * @param stream 文件流
+ * @param contextType 文件类型
+ * @throws Exception
+ */
+ void putObject(String bucketName, String objectName, InputStream stream) throws Exception;
+
+ /**
+ * 获取文件
+ * @param bucketName bucket名称
+ * @param objectName 文件名称
+ * @return 二进制流 API Documentation
+ */
+ S3Object getObject(String bucketName, String objectName);
+
+ void removeObject(String bucketName, String objectName) throws Exception;
+
+ /**
+ * @throws Exception
+ */
+ @Override
+ default void afterPropertiesSet() throws Exception {
+ }
+
+ /**
+ * 根据文件前置查询文件
+ * @param bucketName bucket名称
+ * @param prefix 前缀
+ * @param recursive 是否递归查询
+ * @return S3ObjectSummary 列表
+ * @see AWS
+ * API Documentation
+ */
+ List getAllObjectsByPrefix(String bucketName, String prefix, boolean recursive);
+
+}
diff --git a/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/local/LocalFileAutoConfiguration.java b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/local/LocalFileAutoConfiguration.java
new file mode 100755
index 00000000..bf34b0c3
--- /dev/null
+++ b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/local/LocalFileAutoConfiguration.java
@@ -0,0 +1,45 @@
+/*
+ * 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 pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ */
+
+package com.pig4cloud.pig.common.file.local;
+
+import com.pig4cloud.pig.common.file.core.FileProperties;
+import com.pig4cloud.pig.common.file.core.FileTemplate;
+import lombok.AllArgsConstructor;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Bean;
+
+/**
+ * aws 自动配置类
+ *
+ * @author lengleng
+ * @author 858695266
+ */
+@AllArgsConstructor
+public class LocalFileAutoConfiguration {
+
+ private final FileProperties properties;
+
+ @Bean
+ @ConditionalOnMissingBean(LocalFileTemplate.class)
+ @ConditionalOnProperty(name = "file.local.enable", havingValue = "true", matchIfMissing = true)
+ public FileTemplate localFileTemplate() {
+ return new LocalFileTemplate(properties);
+ }
+
+}
diff --git a/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/local/LocalFileProperties.java b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/local/LocalFileProperties.java
new file mode 100755
index 00000000..7cf833e9
--- /dev/null
+++ b/pig-common/pig-common-oss/src/main/java/com/pig4cloud/pig/common/file/local/LocalFileProperties.java
@@ -0,0 +1,44 @@
+/*
+ * 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 pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ */
+
+package com.pig4cloud.pig.common.file.local;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+/**
+ * 本地文件 配置信息
+ *
+ * @author lengleng
+ *
*
* @author lengleng
- * @since 2019/2/1
+ * @since 2017-10-29
*/
@Data
+@Schema(description = "角色菜单")
@EqualsAndHashCode(callSuper = true)
public class SysRoleMenu extends Model {
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysUser.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysUser.java
index 919f1461..0c4c9142 100644
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysUser.java
+++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysUser.java
@@ -1,29 +1,31 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.api.entity;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.pig4cloud.pig.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
-import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
/**
*
*
* @author lengleng
- * @since 2019/2/1
+ * @since 2017-10-29
*/
@Data
-@EqualsAndHashCode(callSuper = true)
-public class SysUser extends BaseEntity {
+@Schema(description = "用户")
+public class SysUser implements Serializable {
private static final long serialVersionUID = 1L;
@@ -49,7 +51,7 @@ public class SysUser extends BaseEntity {
/**
* 用户名
*/
- @Schema(title = "用户名")
+ @Schema(description = "用户名")
private String username;
/**
@@ -65,6 +67,42 @@ public class SysUser extends BaseEntity {
@Schema(description = "随机盐")
private String salt;
+ /**
+ * 创建人
+ */
+ @TableField(fill = FieldFill.INSERT)
+ @Schema(description = "创建人")
+ private String createBy;
+
+ /**
+ * 修改人
+ */
+ @TableField(fill = FieldFill.UPDATE)
+ @Schema(description = "修改人")
+ private String updateBy;
+
+ /**
+ * 创建时间
+ */
+ @TableField(fill = FieldFill.INSERT)
+ @Schema(description = "创建时间")
+ private LocalDateTime createTime;
+
+ /**
+ * 修改时间
+ */
+ @TableField(fill = FieldFill.UPDATE)
+ @Schema(description = "修改时间")
+ private LocalDateTime updateTime;
+
+ /**
+ * 0-正常,1-删除
+ */
+ @TableLogic
+ @TableField(fill = FieldFill.INSERT)
+ @Schema(description = "删除标记,1:已删除,0:正常")
+ private String delFlag;
+
/**
* 锁定标记
*/
@@ -90,9 +128,51 @@ public class SysUser extends BaseEntity {
private Long deptId;
/**
- * 0-正常,1-删除
+ * 微信openid
*/
- @TableLogic
- private String delFlag;
+ @Schema(description = "微信openid")
+ private String wxOpenid;
+
+ /**
+ * 微信小程序openId
+ */
+ @Schema(description = "微信小程序openid")
+ private String miniOpenid;
+
+ /**
+ * QQ openid
+ */
+ @Schema(description = "QQ openid")
+ private String qqOpenid;
+
+ /**
+ * 码云唯一标识
+ */
+ @Schema(description = "码云唯一标识")
+ private String giteeLogin;
+
+ /**
+ * 开源中国唯一标识
+ */
+ @Schema(description = "开源中国唯一标识")
+ private String oscId;
+
+ /**
+ * 昵称
+ */
+ @Schema(description = "昵称")
+ private String nickname;
+
+ /**
+ * 姓名
+ */
+ @Schema(description = "姓名")
+ private String name;
+
+ /**
+ * 邮箱
+ */
+ @Schema(description = "邮箱")
+ private String email;
}
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysUserRole.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysUserRole.java
index 93d4e63c..ffb92d8e 100644
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysUserRole.java
+++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/entity/SysUserRole.java
@@ -1,17 +1,20 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.api.entity;
@@ -27,9 +30,10 @@ import lombok.EqualsAndHashCode;
*
*
* @author lengleng
- * @since 2019/2/1
+ * @since 2017-10-29
*/
@Data
+@Schema(description = "用户角色")
@EqualsAndHashCode(callSuper = true)
public class SysUserRole extends Model {
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteClientDetailsService.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteClientDetailsService.java
index e130bd89..c5e788b4 100644
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteClientDetailsService.java
+++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteClientDetailsService.java
@@ -26,6 +26,7 @@ import com.pig4cloud.pig.common.core.util.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestHeader;
import java.util.List;
@@ -33,22 +34,25 @@ import java.util.List;
* @author lengleng
* @date 2020/12/05
*/
-@FeignClient(contextId = "remoteClientDetailsService", value = ServiceNameConstants.UMPS_SERVICE)
+@FeignClient(contextId = "remoteClientDetailsService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteClientDetailsService {
/**
* 通过clientId 查询客户端信息
* @param clientId 用户名
+ * @param from 调用标志
* @return R
*/
- @GetMapping(value = "/client/getClientDetailsById/{clientId}", headers = SecurityConstants.HEADER_FROM_IN)
- R getClientDetailsById(@PathVariable("clientId") String clientId);
+ @GetMapping("/client/getClientDetailsById/{clientId}")
+ R getClientDetailsById(@PathVariable("clientId") String clientId,
+ @RequestHeader(SecurityConstants.FROM) String from);
/**
* 查询全部客户端
+ * @param from 调用标识
* @return R
*/
- @GetMapping(value = "/client/list", headers = SecurityConstants.HEADER_FROM_IN)
- R> listClientDetails();
+ @GetMapping("/client/list")
+ R> listClientDetails(@RequestHeader(SecurityConstants.FROM) String from);
}
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteDeptService.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteDeptService.java
deleted file mode 100644
index 197b3015..00000000
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteDeptService.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.pig4cloud.pig.admin.api.feign;
-
-import com.pig4cloud.pig.common.core.constant.SecurityConstants;
-import com.pig4cloud.pig.common.core.constant.ServiceNameConstants;
-import com.pig4cloud.pig.common.core.util.R;
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-
-import java.util.List;
-
-/**
- * @author hccake
- */
-@FeignClient(contextId = "remoteDeptService", value = ServiceNameConstants.UMPS_SERVICE)
-public interface RemoteDeptService {
-
- /**
- * 查收子级id列表
- * @return 返回子级id列表
- */
- @GetMapping(value = "/dept/child-id/{deptId}", headers = SecurityConstants.HEADER_FROM_IN)
- R> listChildDeptId(@PathVariable("deptId") Long deptId);
-
-}
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteDictService.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteDictService.java
index 3ca11474..f17c7611 100644
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteDictService.java
+++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteDictService.java
@@ -15,7 +15,7 @@ import java.util.List;
*
* 查询参数相关
*/
-@FeignClient(contextId = "remoteDictService", value = ServiceNameConstants.UMPS_SERVICE)
+@FeignClient(contextId = "remoteDictService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteDictService {
/**
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteLogService.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteLogService.java
old mode 100755
new mode 100644
index f4fd260d..e9ad3b3c
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteLogService.java
+++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteLogService.java
@@ -1,17 +1,20 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.api.feign;
@@ -23,20 +26,22 @@ import com.pig4cloud.pig.common.core.util.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
/**
* @author lengleng
- * @date 2019/2/1
+ * @date 2018/6/28
*/
-@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.UMPS_SERVICE)
+@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteLogService {
/**
* 保存日志
* @param sysLog 日志实体
+ * @param from 是否内部调用
* @return succes、false
*/
- @PostMapping(value = "/log", headers = SecurityConstants.HEADER_FROM_IN)
- R saveLog(@RequestBody SysLog sysLog);
+ @PostMapping("/log/save")
+ R saveLog(@RequestBody SysLog sysLog, @RequestHeader(SecurityConstants.FROM) String from);
}
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteParamService.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteParamService.java
index deb214bc..a4738418 100644
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteParamService.java
+++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteParamService.java
@@ -6,6 +6,7 @@ import com.pig4cloud.pig.common.core.util.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestHeader;
/**
* @author lengleng
@@ -13,15 +14,16 @@ import org.springframework.web.bind.annotation.PathVariable;
*
* 查询参数相关
*/
-@FeignClient(contextId = "remoteParamService", value = ServiceNameConstants.UMPS_SERVICE)
+@FeignClient(contextId = "remoteParamService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteParamService {
/**
* 通过key 查询参数配置
* @param key key
+ * @param from 声明成内部调用,避免MQ 等无法调用
* @return
*/
- @GetMapping(value = "/param/publicValue/{key}", headers = SecurityConstants.HEADER_FROM_IN)
- R getByKey(@PathVariable("key") String key);
+ @GetMapping("/param/publicValue/{key}")
+ R getByKey(@PathVariable("key") String key, @RequestHeader(SecurityConstants.FROM) String from);
}
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteTokenService.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteTokenService.java
old mode 100755
new mode 100644
index 7976fef9..85d64872
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteTokenService.java
+++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteTokenService.java
@@ -1,21 +1,23 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * 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 pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pig.admin.api.feign;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
import com.pig4cloud.pig.common.core.constant.ServiceNameConstants;
import com.pig4cloud.pig.common.core.util.R;
@@ -26,25 +28,39 @@ import java.util.Map;
/**
* @author lengleng
- * @date 2019/2/1
+ * @date 2018/9/4
*/
@FeignClient(contextId = "remoteTokenService", value = ServiceNameConstants.AUTH_SERVICE)
public interface RemoteTokenService {
/**
* 分页查询token 信息
+ * @param from 内部调用标志
* @param params 分页参数
+ * @param from 内部调用标志
* @return page
*/
- @PostMapping(value = "/token/page", headers = SecurityConstants.HEADER_FROM_IN)
- R getTokenPage(@RequestBody Map params);
+ @PostMapping("/token/page")
+ R getTokenPage(@RequestBody Map params, @RequestHeader(SecurityConstants.FROM) String from);
/**
* 删除token
+ * @param from 内部调用标志
* @param token token
+ * @param from 内部调用标志
* @return
*/
- @DeleteMapping(value = "/token/{token}", headers = SecurityConstants.HEADER_FROM_IN)
- R removeToken(@PathVariable("token") String token);
+ @DeleteMapping("/token/{token}")
+ R removeTokenById(@PathVariable("token") String token, @RequestHeader(SecurityConstants.FROM) String from);
+
+ /**
+ * 校验令牌获取用户信息
+ * @param token
+ * @param from
+ * @return
+ */
+ @GetMapping("/token/query-token")
+ R> queryToken(@RequestParam("token") String token,
+ @RequestHeader(SecurityConstants.FROM) String from);
}
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteUserService.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteUserService.java
old mode 100755
new mode 100644
index 3dfc3f08..39adc1e5
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteUserService.java
+++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/feign/RemoteUserService.java
@@ -1,64 +1,57 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.api.feign;
+import com.pig4cloud.pig.admin.api.dto.UserDTO;
import com.pig4cloud.pig.admin.api.dto.UserInfo;
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
import com.pig4cloud.pig.common.core.constant.ServiceNameConstants;
import com.pig4cloud.pig.common.core.util.R;
+import org.apache.ibatis.annotations.Param;
import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestParam;
-
-import java.util.List;
-import java.util.Set;
+import org.springframework.cloud.openfeign.SpringQueryMap;
+import org.springframework.web.bind.annotation.*;
/**
* @author lengleng
- * @date 2019/2/1
+ * @date 2018/6/22
*/
-@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.UMPS_SERVICE)
+@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteUserService {
/**
* 通过用户名查询用户、角色信息
+ * @param user 用户查询对象
+ * @param from 调用标志
+ * @return R
+ */
+ @GetMapping("/user/info/query")
+ R info(@SpringQueryMap UserDTO user, @RequestHeader(SecurityConstants.FROM) String from);
+
+ /**
+ * 锁定用户
* @param username 用户名
- * @return R
+ * @param from 调用标识
+ * @return
*/
- @GetMapping(value = "/user/info/{username}", headers = SecurityConstants.HEADER_FROM_IN)
- R info(@PathVariable("username") String username);
-
- /**
- * 通过手机号码查询用户、角色信息
- * @param phone 手机号码
- * @param from 调用标志
- * @return R
- */
- @GetMapping(value = "/app/info/{phone}", headers = SecurityConstants.HEADER_FROM_IN)
- R infoByMobile(@PathVariable("phone") String phone);
-
- /**
- * 根据部门id,查询对应的用户 id 集合
- * @param deptIds 部门id 集合
- * @param from 调用标志
- * @return 用户 id 集合
- */
- @GetMapping(value = "/user/ids", headers = SecurityConstants.HEADER_FROM_IN)
- R> listUserIdByDeptIds(@RequestParam("deptIds") Set deptIds);
+ @PutMapping("/user/lock/{username}")
+ R lockUser(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM) String from);
}
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/util/DictResolver.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/util/DictResolver.java
index 6c7a7193..136b9ea8 100644
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/util/DictResolver.java
+++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/util/DictResolver.java
@@ -57,7 +57,7 @@ public class DictResolver {
SysDictItem sysDictItem = getDictItemByItemLabel(type, itemLabel);
- return ObjectUtils.isNotEmpty(sysDictItem) ? sysDictItem.getValue() : StringPool.EMPTY;
+ return ObjectUtils.isNotEmpty(sysDictItem) ? sysDictItem.getItemValue() : StringPool.EMPTY;
}
/**
@@ -72,7 +72,7 @@ public class DictResolver {
List dictItemList = getDictItemsByType(type);
if (CollectionUtils.isNotEmpty(dictItemList)) {
- return dictItemList.stream().filter(item -> itemValue.equals(item.getValue())).findFirst().orElse(null);
+ return dictItemList.stream().filter(item -> itemValue.equals(item.getItemValue())).findFirst().orElse(null);
}
return null;
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/util/ParamResolver.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/util/ParamResolver.java
index 9b4e43a0..51d0337b 100644
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/util/ParamResolver.java
+++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/util/ParamResolver.java
@@ -3,6 +3,7 @@ package com.pig4cloud.pig.admin.api.util;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil;
import com.pig4cloud.pig.admin.api.feign.RemoteParamService;
+import com.pig4cloud.pig.common.core.constant.SecurityConstants;
import com.pig4cloud.pig.common.core.util.SpringContextHolder;
import lombok.experimental.UtilityClass;
@@ -43,7 +44,7 @@ public class ParamResolver {
RemoteParamService remoteParamService = SpringContextHolder.getBean(RemoteParamService.class);
- String result = remoteParamService.getByKey(key).getData();
+ String result = remoteParamService.getByKey(key, SecurityConstants.FROM_IN).getData();
if (StrUtil.isNotBlank(result)) {
return Convert.convert(clazz, result);
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/DeptExcelVo.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/DeptExcelVo.java
new file mode 100644
index 00000000..7272f3e0
--- /dev/null
+++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/DeptExcelVo.java
@@ -0,0 +1,44 @@
+package com.pig4cloud.pig.admin.api.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.pig4cloud.plugin.excel.annotation.ExcelLine;
+import jakarta.validation.constraints.NotBlank;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 部门导入导出
+ */
+@Data
+public class DeptExcelVo implements Serializable {
+
+ /**
+ * 导入时候回显行号
+ */
+ @ExcelLine
+ @ExcelIgnore
+ private Long lineNum;
+
+ /**
+ * 上级部门
+ */
+ @NotBlank(message = "上级部门不能为空")
+ @ExcelProperty("上级部门")
+ private String parentName;
+
+ /**
+ * 部门名称
+ */
+ @NotBlank(message = "部门名称不能为空")
+ @ExcelProperty("部门名称")
+ private String name;
+
+ /**
+ * 排序
+ */
+ @ExcelProperty(value = "排序值")
+ private Integer sortOrder;
+
+}
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/ImageCode.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/ImageCode.java
deleted file mode 100644
index 1256a5f6..00000000
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/ImageCode.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.pig4cloud.pig.admin.api.vo;
-
-import lombok.Data;
-
-import java.awt.image.BufferedImage;
-import java.io.Serializable;
-import java.time.LocalDateTime;
-
-/**
- * @author lengleng
- * @date 2019/2/1
- */
-@Data
-public class ImageCode implements Serializable {
-
- private String code;
-
- private LocalDateTime expireTime;
-
- private BufferedImage image;
-
- public ImageCode(BufferedImage image, String sRand, int defaultImageExpire) {
- this.image = image;
- this.code = sRand;
- this.expireTime = LocalDateTime.now().plusSeconds(defaultImageExpire);
- }
-
-}
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/LogVO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/LogVO.java
deleted file mode 100644
index a62cf6c5..00000000
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/LogVO.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.pig4cloud.pig.admin.api.vo;
-
-import com.pig4cloud.pig.admin.api.entity.SysLog;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @author lengleng
- * @date 2019/2/1
- */
-@Data
-public class LogVO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private SysLog sysLog;
-
- private String username;
-
-}
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/PostExcelVO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/PostExcelVO.java
index 23ce1dbb..83998a42 100644
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/PostExcelVO.java
+++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/PostExcelVO.java
@@ -4,10 +4,10 @@ import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.pig4cloud.plugin.excel.annotation.ExcelLine;
-import lombok.Data;
-
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
import java.io.Serializable;
import java.time.LocalDateTime;
@@ -24,7 +24,7 @@ public class PostExcelVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
- * excel 行号
+ * 导入时候回显行号
*/
@ExcelLine
@ExcelIgnore
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/PreLogVO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/PreLogVO.java
new file mode 100644
index 00000000..de46b1a4
--- /dev/null
+++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/PreLogVO.java
@@ -0,0 +1,73 @@
+/*
+ * 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 pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ */
+
+package com.pig4cloud.pig.admin.api.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * @author lengleng
+ * @date 2018/8/27 前端日志vo
+ */
+@Data
+@Schema(description = "前端日志展示对象")
+public class PreLogVO {
+
+ /**
+ * 请求url
+ */
+ @Schema(description = "请求url")
+ private String url;
+
+ /**
+ * 请求耗时
+ */
+ @Schema(description = "请求耗时")
+ private String time;
+
+ /**
+ * 请求用户
+ */
+ @Schema(description = "请求用户")
+ private String user;
+
+ /**
+ * 请求结果
+ */
+ @Schema(description = "请求结果0:成功9:失败")
+ private String type;
+
+ /**
+ * 请求传递参数
+ */
+ @Schema(description = "请求传递参数")
+ private String message;
+
+ /**
+ * 异常信息
+ */
+ @Schema(description = "异常信息")
+ private String stack;
+
+ /**
+ * 日志标题
+ */
+ @Schema(description = "日志标题")
+ private String info;
+
+}
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/RoleExcelVO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/RoleExcelVO.java
index 7ff36849..c06cd6f8 100644
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/RoleExcelVO.java
+++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/RoleExcelVO.java
@@ -4,9 +4,9 @@ import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.pig4cloud.plugin.excel.annotation.ExcelLine;
+import jakarta.validation.constraints.NotBlank;
import lombok.Data;
-import jakarta.validation.constraints.NotBlank;
import java.io.Serializable;
import java.time.LocalDateTime;
@@ -23,7 +23,7 @@ public class RoleExcelVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
- * excel 行号
+ * 导入时候回显行号
*/
@ExcelLine
@ExcelIgnore
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/RoleVo.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/RoleVo.java
index 89691d54..fde0bbec 100644
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/RoleVo.java
+++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/RoleVo.java
@@ -1,17 +1,18 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * 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 pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pig.admin.api.vo;
@@ -25,7 +26,7 @@ import lombok.Data;
*/
@Data
@Schema(description = "前端角色展示对象")
-public class RoleVo {
+public class RoleVO {
/**
* 角色id
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserExcelVO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserExcelVO.java
index e8a86488..eac64877 100644
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserExcelVO.java
+++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserExcelVO.java
@@ -4,9 +4,9 @@ import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.pig4cloud.plugin.excel.annotation.ExcelLine;
+import jakarta.validation.constraints.NotBlank;
import lombok.Data;
-import jakarta.validation.constraints.NotBlank;
import java.io.Serializable;
import java.time.LocalDateTime;
@@ -23,7 +23,7 @@ public class UserExcelVO implements Serializable {
private static final long serialVersionUID = 1L;
/**
- * excel 行号
+ * 导入时候回显行号
*/
@ExcelLine
@ExcelIgnore
@@ -49,6 +49,27 @@ public class UserExcelVO implements Serializable {
@ExcelProperty("手机号")
private String phone;
+ /**
+ * 手机号
+ */
+ @NotBlank(message = "昵称不能为空")
+ @ExcelProperty("昵称")
+ private String nickname;
+
+ /**
+ * 手机号
+ */
+ @NotBlank(message = "姓名不能为空")
+ @ExcelProperty("姓名")
+ private String name;
+
+ /**
+ * 手机号
+ */
+ @NotBlank(message = "邮箱不能为空")
+ @ExcelProperty("邮箱")
+ private String email;
+
/**
* 部门名称
*/
@@ -64,10 +85,10 @@ public class UserExcelVO implements Serializable {
private String roleNameList;
/**
- * 岗位列表
+ * 角色列表
*/
@NotBlank(message = "岗位不能为空")
- @ExcelProperty("岗位")
+ @ExcelProperty("岗位名称")
private String postNameList;
/**
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserInfoVO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserInfoVO.java
deleted file mode 100644
index 32195cc4..00000000
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserInfoVO.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.pig4cloud.pig.admin.api.vo;
-
-import com.pig4cloud.pig.admin.api.entity.SysUser;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @author lengleng
- * @date 2019/2/1
- *
- * commit('SET_ROLES', data) commit('SET_NAME', data) commit('SET_AVATAR', data)
- * commit('SET_INTRODUCTION', data) commit('SET_PERMISSIONS', data)
- */
-@Data
-public class UserInfoVO implements Serializable {
-
- /**
- * 用户基本信息
- */
- private SysUser sysUser;
-
- /**
- * 权限标识集合
- */
- private String[] permissions;
-
- /**
- * 角色集合
- */
- private Long[] roles;
-
-}
diff --git a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserVO.java b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserVO.java
index 4692eda5..a42f357a 100644
--- a/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserVO.java
+++ b/pig-upms/pig-upms-api/src/main/java/com/pig4cloud/pig/admin/api/vo/UserVO.java
@@ -1,23 +1,27 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.api.vo;
import com.pig4cloud.pig.admin.api.entity.SysPost;
import com.pig4cloud.pig.admin.api.entity.SysRole;
+import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
@@ -26,9 +30,10 @@ import java.util.List;
/**
* @author lengleng
- * @date 2019/2/1
+ * @date 2017/10/29
*/
@Data
+@Schema(description = "前端用户展示对象")
public class UserVO implements Serializable {
private static final long serialVersionUID = 1L;
@@ -36,66 +41,103 @@ public class UserVO implements Serializable {
/**
* 主键ID
*/
+ @Schema(description = "主键")
private Long userId;
/**
* 用户名
*/
+ @Schema(description = "用户名")
private String username;
/**
* 密码
*/
+ @Schema(description = "密码")
private String password;
/**
* 随机盐
*/
+ @Schema(description = "随机盐")
private String salt;
+ /**
+ * 微信openid
+ */
+ @Schema(description = "微信open id")
+ private String wxOpenid;
+
+ /**
+ * QQ openid
+ */
+ @Schema(description = "qq open id")
+ private String qqOpenid;
+
+ /**
+ * gitee openid
+ */
+ @Schema(description = "gitee open id")
+ private String giteeOpenId;
+
+ /**
+ * 开源中国 openid
+ */
+ @Schema(description = "开源中国 open id")
+ private String oscOpenId;
+
/**
* 创建时间
*/
+ @Schema(description = "创建时间")
private LocalDateTime createTime;
/**
* 修改时间
*/
+ @Schema(description = "修改时间")
private LocalDateTime updateTime;
/**
* 0-正常,1-删除
*/
+ @Schema(description = "删除标记,1:已删除,0:正常")
private String delFlag;
/**
* 锁定标记
*/
+ @Schema(description = "锁定标记,0:正常,9:已锁定")
private String lockFlag;
/**
- * 简介
+ * 手机号
*/
+ @Schema(description = "手机号")
private String phone;
/**
* 头像
*/
+ @Schema(description = "头像")
private String avatar;
/**
* 部门ID
*/
+ @Schema(description = "所属部门")
private Long deptId;
/**
* 部门名称
*/
+ @Schema(description = "所属部门名称")
private String deptName;
/**
* 角色列表
*/
+ @Schema(description = "拥有的角色列表")
private List roleList;
/**
@@ -103,4 +145,22 @@ public class UserVO implements Serializable {
*/
private List postList;
+ /**
+ * 昵称
+ */
+ @Schema(description = "昵称")
+ private String nickname;
+
+ /**
+ * 姓名
+ */
+ @Schema(description = "姓名")
+ private String name;
+
+ /**
+ * 邮箱
+ */
+ @Schema(description = "邮箱")
+ private String email;
+
}
diff --git a/pig-upms/pig-upms-api/src/main/resources/META-INF/spring.factories b/pig-upms/pig-upms-api/src/main/resources/META-INF/spring.factories
new file mode 100755
index 00000000..381af7d2
--- /dev/null
+++ b/pig-upms/pig-upms-api/src/main/resources/META-INF/spring.factories
@@ -0,0 +1,7 @@
+com.pig4cloud.pig.common.feign.PigxFeignAutoConfiguration=\
+ com.pig4cloud.pig.admin.api.feign.RemoteClientDetailsService,\
+ com.pig4cloud.pig.admin.api.feign.RemoteLogService,\
+ com.pig4cloud.pig.admin.api.feign.RemoteParamService,\
+ com.pig4cloud.pig.admin.api.feign.RemoteTokenService,\
+ com.pig4cloud.pig.admin.api.feign.RemoteUserService,\
+ com.pig4cloud.pig.admin.api.feign.RemoteDictService
diff --git a/pig-upms/pig-upms-api/src/main/resources/META-INF/spring/org.springframework.cloud.openfeign.FeignClient.imports b/pig-upms/pig-upms-api/src/main/resources/META-INF/spring/org.springframework.cloud.openfeign.FeignClient.imports
deleted file mode 100644
index 9eca72e4..00000000
--- a/pig-upms/pig-upms-api/src/main/resources/META-INF/spring/org.springframework.cloud.openfeign.FeignClient.imports
+++ /dev/null
@@ -1,7 +0,0 @@
-com.pig4cloud.pig.admin.api.feign.RemoteClientDetailsService
-com.pig4cloud.pig.admin.api.feign.RemoteDictService
-com.pig4cloud.pig.admin.api.feign.RemoteDeptService
-com.pig4cloud.pig.admin.api.feign.RemoteLogService
-com.pig4cloud.pig.admin.api.feign.RemoteTokenService
-com.pig4cloud.pig.admin.api.feign.RemoteUserService
-com.pig4cloud.pig.admin.api.feign.RemoteParamService
diff --git a/pig-upms/pig-upms-biz/pom.xml b/pig-upms/pig-upms-biz/pom.xml
index a3652ff2..4aa61289 100644
--- a/pig-upms/pig-upms-biz/pom.xml
+++ b/pig-upms/pig-upms-biz/pom.xml
@@ -21,7 +21,7 @@
com.pig4cloudpig-upms
- 3.6.4
+ 3.7.0-SNAPSHOTpig-upms-biz
@@ -37,8 +37,8 @@
- com.pig4cloud.plugin
- oss-spring-boot-starter
+ com.pig4cloud
+ pig-common-oss
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/PigAdminApplication.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/PigAdminApplication.java
index 0706cc15..c17ec051 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/PigAdminApplication.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/PigAdminApplication.java
@@ -1,17 +1,20 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin;
@@ -25,11 +28,13 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/**
* @author lengleng
- * @date 2018年06月21日 用户统一管理系统
+ * @date 2018年06月21日
+ *
+ * 用户统一管理系统
*/
@EnablePigDoc("admin")
-@EnablePigResourceServer
@EnablePigFeignClients
+@EnablePigResourceServer
@EnableDiscoveryClient
@SpringBootApplication
public class PigAdminApplication {
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/AppController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/AppController.java
deleted file mode 100644
index c540936d..00000000
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/AppController.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.pig4cloud.pig.admin.controller;
-
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.pig4cloud.pig.admin.api.dto.AppSmsDTO;
-import com.pig4cloud.pig.admin.api.dto.UserInfo;
-import com.pig4cloud.pig.admin.api.entity.SysUser;
-import com.pig4cloud.pig.admin.service.AppService;
-import com.pig4cloud.pig.admin.service.SysUserService;
-import com.pig4cloud.pig.common.core.exception.ErrorCodes;
-import com.pig4cloud.pig.common.core.util.MsgUtils;
-import com.pig4cloud.pig.common.core.util.R;
-import com.pig4cloud.pig.common.security.annotation.Inner;
-import io.swagger.v3.oas.annotations.security.SecurityRequirement;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.AllArgsConstructor;
-import org.springframework.http.HttpHeaders;
-import org.springframework.web.bind.annotation.*;
-
-import jakarta.validation.Valid;
-
-/**
- * @author lengleng
- * @date 2021/9/16 移动端登录
- */
-@RestController
-@AllArgsConstructor
-@RequestMapping("/app")
-@Tag(name = "移动端登录模块")
-@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
-public class AppController {
-
- private final AppService appService;
-
- private final SysUserService userService;
-
- /**
- * 发送手机验证码
- * @param sms 请求手机对象
- * @return code
- */
- @Inner(value = false)
- @PostMapping("/sms")
- public R sendSmsCode(@Valid @RequestBody AppSmsDTO sms) {
- return appService.sendSmsCode(sms);
- }
-
- /**
- * 获取指定用户全部信息
- * @param phone 手机号
- * @return 用户信息
- */
- @Inner
- @GetMapping("/info/{phone}")
- public R infoByMobile(@PathVariable String phone) {
- SysUser user = userService.getOne(Wrappers.query().lambda().eq(SysUser::getPhone, phone));
- if (user == null) {
- return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_USERINFO_EMPTY, phone));
- }
- return R.ok(userService.getUserInfo(user));
- }
-
-}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/DeptController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/DeptController.java
deleted file mode 100644
index a028f8b7..00000000
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/DeptController.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.pig4cloud.pig.admin.controller;
-
-import cn.hutool.core.lang.tree.Tree;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.pig4cloud.pig.admin.api.entity.SysDept;
-import com.pig4cloud.pig.admin.service.SysDeptService;
-import com.pig4cloud.pig.common.core.util.R;
-import com.pig4cloud.pig.common.log.annotation.SysLog;
-import com.pig4cloud.pig.common.security.annotation.Inner;
-import io.swagger.v3.oas.annotations.security.SecurityRequirement;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
-import org.springframework.http.HttpHeaders;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import jakarta.validation.Valid;
-import java.util.List;
-
-/**
- *
- * 部门管理 前端控制器
- *
- *
- * @author lengleng
- * @since 2019/2/1
- */
-@RestController
-@RequiredArgsConstructor
-@RequestMapping("/dept")
-@Tag(name = "部门管理模块")
-@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
-public class DeptController {
-
- private final SysDeptService sysDeptService;
-
- /**
- * 通过ID查询
- * @param id ID
- * @return SysDept
- */
- @GetMapping("/{id:\\d+}")
- public R getById(@PathVariable Long id) {
- return R.ok(sysDeptService.getById(id));
- }
-
- /**
- * 返回树形菜单集合
- * @return 树形菜单
- */
- @GetMapping(value = "/tree")
- public R>> listDeptTrees() {
- return R.ok(sysDeptService.listDeptTrees());
- }
-
- /**
- * 返回当前用户树形菜单集合
- * @return 树形菜单
- */
- @GetMapping(value = "/user-tree")
- public R>> listCurrentUserDeptTrees() {
- return R.ok(sysDeptService.listCurrentUserDeptTrees());
- }
-
- /**
- * 添加
- * @param sysDept 实体
- * @return success/false
- */
- @SysLog("添加部门")
- @PostMapping
- @PreAuthorize("@pms.hasPermission('sys_dept_add')")
- public R save(@Valid @RequestBody SysDept sysDept) {
- return R.ok(sysDeptService.saveDept(sysDept));
- }
-
- /**
- * 删除
- * @param id ID
- * @return success/false
- */
- @SysLog("删除部门")
- @DeleteMapping("/{id:\\d+}")
- @PreAuthorize("@pms.hasPermission('sys_dept_del')")
- public R removeById(@PathVariable Long id) {
- return R.ok(sysDeptService.removeDeptById(id));
- }
-
- /**
- * 编辑
- * @param sysDept 实体
- * @return success/false
- */
- @SysLog("编辑部门")
- @PutMapping
- @PreAuthorize("@pms.hasPermission('sys_dept_edit')")
- public R update(@Valid @RequestBody SysDept sysDept) {
- return R.ok(sysDeptService.updateDeptById(sysDept));
- }
-
- /**
- * 根据部门名查询部门信息
- * @param deptname 部门名
- * @return
- */
- @GetMapping("/details/{deptname}")
- public R user(@PathVariable String deptname) {
- SysDept condition = new SysDept();
- condition.setName(deptname);
- return R.ok(sysDeptService.getOne(new QueryWrapper<>(condition)));
- }
-
- /**
- * 查收子级id列表
- * @return 返回子级id列表
- */
- @Inner
- @GetMapping(value = "/child-id/{deptId:\\d+}")
- public R> listChildDeptId(@PathVariable Long deptId) {
- return R.ok(sysDeptService.listChildDeptId(deptId));
- }
-
-}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/DictController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/DictController.java
deleted file mode 100644
index 5ba3b295..00000000
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/DictController.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.pig4cloud.pig.admin.controller;
-
-import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.pig4cloud.pig.admin.api.entity.SysDict;
-import com.pig4cloud.pig.admin.api.entity.SysDictItem;
-import com.pig4cloud.pig.admin.service.SysDictItemService;
-import com.pig4cloud.pig.admin.service.SysDictService;
-import com.pig4cloud.pig.common.core.constant.CacheConstants;
-import com.pig4cloud.pig.common.core.util.R;
-import com.pig4cloud.pig.common.log.annotation.SysLog;
-import io.swagger.v3.oas.annotations.security.SecurityRequirement;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
-import org.springframework.cache.annotation.CacheEvict;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.http.HttpHeaders;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import jakarta.validation.Valid;
-import java.util.List;
-
-/**
- *
- * 字典表 前端控制器
- *
- *
- * @author lengleng
- * @since 2019-03-19
- */
-@RestController
-@RequiredArgsConstructor
-@RequestMapping("/dict")
-@Tag(name = "字典管理模块")
-@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
-public class DictController {
-
- private final SysDictItemService sysDictItemService;
-
- private final SysDictService sysDictService;
-
- /**
- * 通过ID查询字典信息
- * @param id ID
- * @return 字典信息
- */
- @GetMapping("/{id:\\d+}")
- public R getById(@PathVariable Long id) {
- return R.ok(sysDictService.getById(id));
- }
-
- /**
- * 分页查询字典信息
- * @param page 分页对象
- * @return 分页对象
- */
- @GetMapping("/page")
- public R> getDictPage(Page page, SysDict sysDict) {
- return R.ok(sysDictService.page(page,
- Wrappers.lambdaQuery()
- .like(StrUtil.isNotBlank(sysDict.getDictKey()), SysDict::getDictKey, sysDict.getDictKey())
- .eq(StrUtil.isNotBlank(sysDict.getSystemFlag()), SysDict::getSystemFlag, sysDict.getSystemFlag())));
- }
-
- /**
- * 通过字典类型查找字典
- * @param type 类型
- * @return 同类型字典
- */
- @GetMapping("/key/{key}")
- @Cacheable(value = CacheConstants.DICT_DETAILS, key = "#key")
- public R> getDictByKey(@PathVariable String key) {
- return R.ok(sysDictItemService.list(Wrappers.query().lambda().eq(SysDictItem::getDictKey, key)));
- }
-
- /**
- * 添加字典
- * @param sysDict 字典信息
- * @return success、false
- */
- @SysLog("添加字典")
- @PostMapping
- @PreAuthorize("@pms.hasPermission('sys_dict_add')")
- public R save(@Valid @RequestBody SysDict sysDict) {
- return R.ok(sysDictService.save(sysDict));
- }
-
- /**
- * 删除字典,并且清除字典缓存
- * @param id ID
- * @return R
- */
- @SysLog("删除字典")
- @DeleteMapping("/{id:\\d+}")
- @PreAuthorize("@pms.hasPermission('sys_dict_del')")
- public R removeById(@PathVariable Long id) {
- sysDictService.removeDict(id);
- return R.ok();
- }
-
- /**
- * 修改字典
- * @param sysDict 字典信息
- * @return success/false
- */
- @PutMapping
- @SysLog("修改字典")
- @PreAuthorize("@pms.hasPermission('sys_dict_edit')")
- public R updateById(@Valid @RequestBody SysDict sysDict) {
- sysDictService.updateDict(sysDict);
- return R.ok();
- }
-
- /**
- * 分页查询
- * @param page 分页对象
- * @param sysDictItem 字典项
- * @return
- */
- @GetMapping("/item/page")
- public R> getSysDictItemPage(Page page, SysDictItem sysDictItem) {
- return R.ok(sysDictItemService.page(page, Wrappers.query(sysDictItem)));
- }
-
- /**
- * 通过id查询字典项
- * @param id id
- * @return R
- */
- @GetMapping("/item/{id:\\d+}")
- public R getDictItemById(@PathVariable("id") Long id) {
- return R.ok(sysDictItemService.getById(id));
- }
-
- /**
- * 新增字典项
- * @param sysDictItem 字典项
- * @return R
- */
- @SysLog("新增字典项")
- @PostMapping("/item")
- @CacheEvict(value = CacheConstants.DICT_DETAILS, allEntries = true)
- public R save(@RequestBody SysDictItem sysDictItem) {
- return R.ok(sysDictItemService.save(sysDictItem));
- }
-
- /**
- * 修改字典项
- * @param sysDictItem 字典项
- * @return R
- */
- @SysLog("修改字典项")
- @PutMapping("/item")
- public R updateById(@RequestBody SysDictItem sysDictItem) {
- sysDictItemService.updateDictItem(sysDictItem);
- return R.ok();
- }
-
- /**
- * 通过id删除字典项
- * @param id id
- * @return R
- */
- @SysLog("删除字典项")
- @DeleteMapping("/item/{id:\\d+}")
- public R removeDictItemById(@PathVariable Long id) {
- sysDictItemService.removeDictItem(id);
- return R.ok();
- }
-
- @SysLog("清除字典缓存")
- @DeleteMapping("/cache")
- @PreAuthorize("@pms.hasPermission('sys_dict_del')")
- public R clearDictCache() {
- sysDictService.clearDictCache();
- return R.ok();
- }
-
-}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/LogController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/LogController.java
deleted file mode 100644
index 4aae2416..00000000
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/LogController.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.pig4cloud.pig.admin.controller;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.pig4cloud.pig.admin.api.dto.SysLogDTO;
-import com.pig4cloud.pig.admin.api.entity.SysLog;
-import com.pig4cloud.pig.admin.service.SysLogService;
-import com.pig4cloud.pig.common.core.util.R;
-import com.pig4cloud.pig.common.security.annotation.Inner;
-import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
-import io.swagger.v3.oas.annotations.security.SecurityRequirement;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
-import org.springframework.http.HttpHeaders;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import jakarta.validation.Valid;
-import java.util.List;
-
-/**
- *
- * 日志表 前端控制器
- *
- *
- * @author lengleng
- * @since 2019/2/1
- */
-@RestController
-@RequiredArgsConstructor
-@RequestMapping("/log")
-@Tag(name = "日志管理模块")
-@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
-public class LogController {
-
- private final SysLogService sysLogService;
-
- /**
- * 简单分页查询
- * @param page 分页对象
- * @param sysLog 系统日志
- * @return
- */
- @GetMapping("/page")
- public R> getLogPage(Page page, SysLogDTO sysLog) {
- return R.ok(sysLogService.getLogByPage(page, sysLog));
- }
-
- /**
- * 删除日志
- * @param id ID
- * @return success/false
- */
- @DeleteMapping("/{id:\\d+}")
- @PreAuthorize("@pms.hasPermission('sys_log_del')")
- public R removeById(@PathVariable Long id) {
- return R.ok(sysLogService.removeById(id));
- }
-
- /**
- * 插入日志
- * @param sysLog 日志实体
- * @return success/false
- */
- @Inner
- @PostMapping
- public R save(@Valid @RequestBody SysLog sysLog) {
- return R.ok(sysLogService.save(sysLog));
- }
-
- /**
- * 导出excel 表格
- * @param sysLog 查询条件
- * @return EXCEL
- */
- @ResponseExcel
- @GetMapping("/export")
- @PreAuthorize("@pms.hasPermission('sys_log_import_export')")
- public List export(SysLogDTO sysLog) {
- return sysLogService.getLogList(sysLog);
- }
-
-}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/OauthClientDetailsController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/OauthClientDetailsController.java
deleted file mode 100644
index ae45b757..00000000
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/OauthClientDetailsController.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.pig4cloud.pig.admin.controller;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.pig4cloud.pig.admin.api.entity.SysOauthClientDetails;
-import com.pig4cloud.pig.admin.service.SysOauthClientDetailsService;
-import com.pig4cloud.pig.common.core.util.R;
-import com.pig4cloud.pig.common.log.annotation.SysLog;
-import com.pig4cloud.pig.common.security.annotation.Inner;
-import io.swagger.v3.oas.annotations.security.SecurityRequirement;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
-import org.springframework.http.HttpHeaders;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import jakarta.validation.Valid;
-import java.util.List;
-
-/**
- *
- * 前端控制器
- *
- *
- * @author lengleng
- * @since 2018-05-15
- */
-@RestController
-@RequiredArgsConstructor
-@RequestMapping("/client")
-@Tag(name = "客户端管理模块")
-@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
-public class OauthClientDetailsController {
-
- private final SysOauthClientDetailsService sysOauthClientDetailsService;
-
- /**
- * 通过ID查询
- * @param clientId 客户端id
- * @return SysOauthClientDetails
- */
- @GetMapping("/{clientId}")
- public R> getByClientId(@PathVariable String clientId) {
- return R.ok(sysOauthClientDetailsService
- .list(Wrappers.lambdaQuery().eq(SysOauthClientDetails::getClientId, clientId)));
- }
-
- /**
- * 简单分页查询
- * @param page 分页对象
- * @param sysOauthClientDetails 系统终端
- * @return
- */
- @GetMapping("/page")
- public R> getOauthClientDetailsPage(Page page,
- SysOauthClientDetails sysOauthClientDetails) {
- return R.ok(sysOauthClientDetailsService.page(page, Wrappers.query(sysOauthClientDetails)));
- }
-
- /**
- * 添加
- * @param sysOauthClientDetails 实体
- * @return success/false
- */
- @SysLog("添加终端")
- @PostMapping
- @PreAuthorize("@pms.hasPermission('sys_client_add')")
- public R add(@Valid @RequestBody SysOauthClientDetails sysOauthClientDetails) {
- return R.ok(sysOauthClientDetailsService.save(sysOauthClientDetails));
- }
-
- /**
- * 删除
- * @param id ID
- * @return success/false
- */
- @SysLog("删除终端")
- @DeleteMapping("/{id}")
- @PreAuthorize("@pms.hasPermission('sys_client_del')")
- public R removeById(@PathVariable String id) {
- return R.ok(sysOauthClientDetailsService.removeClientDetailsById(id));
- }
-
- /**
- * 编辑
- * @param sysOauthClientDetails 实体
- * @return success/false
- */
- @SysLog("编辑终端")
- @PutMapping
- @PreAuthorize("@pms.hasPermission('sys_client_edit')")
- public R update(@Valid @RequestBody SysOauthClientDetails sysOauthClientDetails) {
- return R.ok(sysOauthClientDetailsService.updateClientDetailsById(sysOauthClientDetails));
- }
-
- @SysLog("清除终端缓存")
- @DeleteMapping("/cache")
- @PreAuthorize("@pms.hasPermission('sys_client_del')")
- public R clearClientCache() {
- sysOauthClientDetailsService.clearClientCache();
- return R.ok();
- }
-
- @Inner
- @GetMapping("/getClientDetailsById/{clientId}")
- public R getClientDetailsById(@PathVariable String clientId) {
- return R.ok(sysOauthClientDetailsService.getOne(
- Wrappers.lambdaQuery().eq(SysOauthClientDetails::getClientId, clientId), false));
- }
-
-}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/RoleController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/RoleController.java
deleted file mode 100644
index 923b229e..00000000
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/RoleController.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.pig4cloud.pig.admin.controller;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.pig4cloud.pig.admin.api.entity.SysRole;
-import com.pig4cloud.pig.admin.api.vo.RoleExcelVO;
-import com.pig4cloud.pig.admin.api.vo.RoleVo;
-import com.pig4cloud.pig.admin.service.SysRoleMenuService;
-import com.pig4cloud.pig.admin.service.SysRoleService;
-import com.pig4cloud.pig.common.core.util.R;
-import com.pig4cloud.pig.common.log.annotation.SysLog;
-import com.pig4cloud.plugin.excel.annotation.RequestExcel;
-import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
-import io.swagger.v3.oas.annotations.security.SecurityRequirement;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
-import org.springframework.http.HttpHeaders;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.*;
-
-import jakarta.validation.Valid;
-import java.util.List;
-
-/**
- * @author lengleng
- * @date 2019/2/1
- */
-@RestController
-@RequiredArgsConstructor
-@RequestMapping("/role")
-@Tag(name = "角色管理模块")
-@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
-public class RoleController {
-
- private final SysRoleService sysRoleService;
-
- private final SysRoleMenuService sysRoleMenuService;
-
- /**
- * 通过ID查询角色信息
- * @param id ID
- * @return 角色信息
- */
- @GetMapping("/{id:\\d+}")
- public R getById(@PathVariable Long id) {
- return R.ok(sysRoleService.getById(id));
- }
-
- /**
- * 添加角色
- * @param sysRole 角色信息
- * @return success、false
- */
- @SysLog("添加角色")
- @PostMapping
- @PreAuthorize("@pms.hasPermission('sys_role_add')")
- public R save(@Valid @RequestBody SysRole sysRole) {
- return R.ok(sysRoleService.save(sysRole));
- }
-
- /**
- * 修改角色
- * @param sysRole 角色信息
- * @return success/false
- */
- @SysLog("修改角色")
- @PutMapping
- @PreAuthorize("@pms.hasPermission('sys_role_edit')")
- public R update(@Valid @RequestBody SysRole sysRole) {
- return R.ok(sysRoleService.updateById(sysRole));
- }
-
- /**
- * 删除角色
- * @param id
- * @return
- */
- @SysLog("删除角色")
- @DeleteMapping("/{id:\\d+}")
- @PreAuthorize("@pms.hasPermission('sys_role_del')")
- public R removeById(@PathVariable Long id) {
- return R.ok(sysRoleService.removeRoleById(id));
- }
-
- /**
- * 获取角色列表
- * @return 角色列表
- */
- @GetMapping("/list")
- public R> listRoles() {
- return R.ok(sysRoleService.list(Wrappers.emptyWrapper()));
- }
-
- /**
- * 分页查询角色信息
- * @param page 分页对象
- * @return 分页对象
- */
- @GetMapping("/page")
- public R> getRolePage(Page page) {
- return R.ok(sysRoleService.page(page, Wrappers.emptyWrapper()));
- }
-
- /**
- * 更新角色菜单
- * @param roleVo 角色对象
- * @return success、false
- */
- @SysLog("更新角色菜单")
- @PutMapping("/menu")
- @PreAuthorize("@pms.hasPermission('sys_role_perm')")
- public R saveRoleMenus(@RequestBody RoleVo roleVo) {
- return R.ok(sysRoleMenuService.saveRoleMenus(roleVo.getRoleId(), roleVo.getMenuIds()));
- }
-
- /**
- * 导出excel 表格
- * @return
- */
- @ResponseExcel
- @GetMapping("/export")
- @PreAuthorize("@pms.hasPermission('sys_role_import_export')")
- public List export() {
- return sysRoleService.listRole();
- }
-
- /**
- * 导入角色
- * @param excelVOList 角色列表
- * @param bindingResult 错误信息列表
- * @return ok fail
- */
- @PostMapping("/import")
- @PreAuthorize("@pms.hasPermission('sys_role_import_export')")
- public R importRole(@RequestExcel List excelVOList, BindingResult bindingResult) {
- return sysRoleService.importRole(excelVOList, bindingResult);
- }
-
-}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysClientController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysClientController.java
new file mode 100644
index 00000000..7c2d874e
--- /dev/null
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysClientController.java
@@ -0,0 +1,165 @@
+/*
+ *
+ * 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 pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ *
+ */
+
+package com.pig4cloud.pig.admin.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.pig4cloud.pig.admin.api.entity.SysOauthClientDetails;
+import com.pig4cloud.pig.admin.service.SysOauthClientDetailsService;
+import com.pig4cloud.pig.common.core.util.R;
+import com.pig4cloud.pig.common.log.annotation.SysLog;
+import com.pig4cloud.pig.common.security.annotation.Inner;
+import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
+import lombok.AllArgsConstructor;
+import org.springdoc.core.annotations.ParameterObject;
+import org.springframework.http.HttpHeaders;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ *
+ * 前端控制器
+ *
+ *
+ * @author lengleng
+ * @since 2018-05-15
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/client")
+@Tag(description = "client", name = "客户端管理模块")
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class SysClientController {
+
+ private final SysOauthClientDetailsService clientDetailsService;
+
+ /**
+ * 通过ID查询
+ * @param clientId clientId
+ * @return SysOauthClientDetails
+ */
+ @GetMapping("/{clientId}")
+ public R getByClientId(@PathVariable String clientId) {
+ SysOauthClientDetails details = clientDetailsService
+ .getOne(Wrappers.lambdaQuery().eq(SysOauthClientDetails::getClientId, clientId));
+ return R.ok(details);
+ }
+
+ /**
+ * 简单分页查询
+ * @param page 分页对象
+ * @param sysOauthClientDetails 系统终端
+ * @return
+ */
+ @GetMapping("/page")
+ public R getOauthClientDetailsPage(@ParameterObject Page page,
+ @ParameterObject SysOauthClientDetails sysOauthClientDetails) {
+ LambdaQueryWrapper wrapper = Wrappers.lambdaQuery()
+ .like(StrUtil.isNotBlank(sysOauthClientDetails.getClientId()), SysOauthClientDetails::getClientId,
+ sysOauthClientDetails.getClientId())
+ .like(StrUtil.isNotBlank(sysOauthClientDetails.getClientSecret()), SysOauthClientDetails::getClientSecret,
+ sysOauthClientDetails.getClientSecret());
+ return R.ok(clientDetailsService.page(page, wrapper));
+ }
+
+ /**
+ * 添加
+ * @param clientDetails 实体
+ * @return success/false
+ */
+ @SysLog("添加终端")
+ @PostMapping
+ @PreAuthorize("@pms.hasPermission('sys_client_add')")
+ public R add(@Valid @RequestBody SysOauthClientDetails clientDetails) {
+ return R.ok(clientDetailsService.saveClient(clientDetails));
+ }
+
+ /**
+ * 删除
+ * @param ids ID 列表
+ * @return success/false
+ */
+ @SysLog("删除终端")
+ @DeleteMapping
+ @PreAuthorize("@pms.hasPermission('sys_client_del')")
+ public R removeById(@RequestBody Long[] ids) {
+ clientDetailsService.removeBatchByIds(CollUtil.toList(ids));
+ return R.ok();
+ }
+
+ /**
+ * 编辑
+ * @param clientDetails 实体
+ * @return success/false
+ */
+ @SysLog("编辑终端")
+ @PutMapping
+ @PreAuthorize("@pms.hasPermission('sys_client_edit')")
+ public R update(@Valid @RequestBody SysOauthClientDetails clientDetails) {
+ return R.ok(clientDetailsService.updateClientById(clientDetails));
+ }
+
+ @Inner(false)
+ @GetMapping("/getClientDetailsById/{clientId}")
+ public R getClientDetailsById(@PathVariable String clientId) {
+ return R.ok(clientDetailsService.getOne(
+ Wrappers.lambdaQuery().eq(SysOauthClientDetails::getClientId, clientId), false));
+ }
+
+ /**
+ * 查询全部客户端
+ * @return
+ */
+ @Inner(false)
+ @GetMapping("/list")
+ public R listClients() {
+ return R.ok(clientDetailsService.list());
+ }
+
+ /**
+ * 同步缓存字典
+ * @return R
+ */
+ @SysLog("同步终端")
+ @PutMapping("/sync")
+ public R sync() {
+ return clientDetailsService.syncClientCache();
+ }
+
+ /**
+ * 导出所有客户端
+ * @return excel
+ */
+ @ResponseExcel
+ @SysLog("导出excel")
+ @GetMapping("/export")
+ public List export(SysOauthClientDetails sysOauthClientDetails) {
+ return clientDetailsService.list(Wrappers.query(sysOauthClientDetails));
+ }
+
+}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysDeptController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysDeptController.java
new file mode 100644
index 00000000..65e94b40
--- /dev/null
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysDeptController.java
@@ -0,0 +1,154 @@
+/*
+ *
+ * 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 pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ *
+ */
+
+package com.pig4cloud.pig.admin.controller;
+
+import com.pig4cloud.pig.admin.api.entity.SysDept;
+import com.pig4cloud.pig.admin.api.vo.DeptExcelVo;
+import com.pig4cloud.pig.admin.service.SysDeptService;
+import com.pig4cloud.pig.common.core.util.R;
+import com.pig4cloud.pig.common.log.annotation.SysLog;
+import com.pig4cloud.plugin.excel.annotation.RequestExcel;
+import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
+import lombok.AllArgsConstructor;
+import org.springframework.http.HttpHeaders;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.*;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ *
+ * 部门管理 前端控制器
+ *
+ *
+ * @author lengleng
+ * @since 2018-01-20
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/dept")
+@Tag(description = "dept", name = "部门管理模块")
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class SysDeptController {
+
+ private final SysDeptService sysDeptService;
+
+ /**
+ * 通过ID查询
+ * @param id ID
+ * @return SysDept
+ */
+ @GetMapping("/{id}")
+ public R getById(@PathVariable Long id) {
+ return R.ok(sysDeptService.getById(id));
+ }
+
+ /**
+ * 查询全部部门
+ */
+ @GetMapping("/list")
+ public R list() {
+ return R.ok(sysDeptService.list());
+ }
+
+ /**
+ * 返回树形菜单集合
+ * @param deptName 部门名称
+ * @return 树形菜单
+ */
+ @GetMapping(value = "/tree")
+ public R getTree(String deptName) {
+ return R.ok(sysDeptService.selectTree(deptName));
+ }
+
+ /**
+ * 添加
+ * @param sysDept 实体
+ * @return success/false
+ */
+ @SysLog("添加部门")
+ @PostMapping
+ @PreAuthorize("@pms.hasPermission('sys_dept_add')")
+ public R save(@Valid @RequestBody SysDept sysDept) {
+ return R.ok(sysDeptService.save(sysDept));
+ }
+
+ /**
+ * 删除
+ * @param id ID
+ * @return success/false
+ */
+ @SysLog("删除部门")
+ @DeleteMapping("/{id}")
+ @PreAuthorize("@pms.hasPermission('sys_dept_del')")
+ public R removeById(@PathVariable Long id) {
+ return R.ok(sysDeptService.removeDeptById(id));
+ }
+
+ /**
+ * 编辑
+ * @param sysDept 实体
+ * @return success/false
+ */
+ @SysLog("编辑部门")
+ @PutMapping
+ @PreAuthorize("@pms.hasPermission('sys_dept_edit')")
+ public R update(@Valid @RequestBody SysDept sysDept) {
+ sysDept.setUpdateTime(LocalDateTime.now());
+ return R.ok(sysDeptService.updateById(sysDept));
+ }
+
+ /**
+ * 查收子级列表
+ * @return 返回子级
+ */
+ @GetMapping(value = "/getDescendantList/{deptId}")
+ public R getDescendantList(@PathVariable Long deptId) {
+ return R.ok(sysDeptService.listDescendant(deptId));
+ }
+
+ /**
+ * 导出部门
+ * @return
+ */
+ @ResponseExcel
+ @GetMapping("/export")
+ public List export() {
+ return sysDeptService.listExcelVo();
+ }
+
+ /**
+ * 导入部门
+ * @param excelVOList
+ * @param bindingResult
+ * @return
+ */
+ @PostMapping("import")
+ public R importDept(@RequestExcel List excelVOList, BindingResult bindingResult) {
+
+ return sysDeptService.importDept(excelVOList, bindingResult);
+ }
+
+}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysDictController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysDictController.java
new file mode 100644
index 00000000..ecfafb01
--- /dev/null
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysDictController.java
@@ -0,0 +1,242 @@
+/*
+ *
+ * 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 pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ *
+ */
+
+package com.pig4cloud.pig.admin.controller;
+
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.pig4cloud.pig.admin.api.entity.SysDict;
+import com.pig4cloud.pig.admin.api.entity.SysDictItem;
+import com.pig4cloud.pig.admin.service.SysDictItemService;
+import com.pig4cloud.pig.admin.service.SysDictService;
+import com.pig4cloud.pig.common.core.constant.CacheConstants;
+import com.pig4cloud.pig.common.core.util.R;
+import com.pig4cloud.pig.common.log.annotation.SysLog;
+import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
+import lombok.AllArgsConstructor;
+import org.springdoc.core.annotations.ParameterObject;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.http.HttpHeaders;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ *
+ * 字典表 前端控制器
+ *
+ *
+ * @author lengleng
+ * @since 2019-03-19
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/dict")
+@Tag(description = "dict", name = "字典管理模块")
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class SysDictController {
+
+ private final SysDictService sysDictService;
+
+ private final SysDictItemService sysDictItemService;
+
+ /**
+ * 通过ID查询字典信息
+ * @param id ID
+ * @return 字典信息
+ */
+ @GetMapping("/details/{id}")
+ public R getById(@PathVariable Long id) {
+ return R.ok(sysDictService.getById(id));
+ }
+
+ /**
+ * 查询字典信息
+ * @param query 查询信息
+ * @return 字典信息
+ */
+ @GetMapping("/details")
+ public R getDetails(@ParameterObject SysDict query) {
+ return R.ok(sysDictService.getOne(Wrappers.query(query), false));
+ }
+
+ /**
+ * 分页查询字典信息
+ * @param page 分页对象
+ * @return 分页对象
+ */
+ @GetMapping("/page")
+ public R getDictPage(@ParameterObject Page page, @ParameterObject SysDict sysDict) {
+ return R.ok(sysDictService.page(page,
+ Wrappers.lambdaQuery()
+ .eq(StrUtil.isNotBlank(sysDict.getSystemFlag()), SysDict::getSystemFlag, sysDict.getSystemFlag())
+ .like(StrUtil.isNotBlank(sysDict.getDictType()), SysDict::getDictType, sysDict.getDictType())));
+ }
+
+ /**
+ * 通过字典类型查找字典
+ * @param type 类型
+ * @return 同类型字典
+ */
+ @GetMapping("/type/{type}")
+ @Cacheable(value = CacheConstants.DICT_DETAILS, key = "#type", unless = "#result.data.isEmpty()")
+ public R> getDictByType(@PathVariable String type) {
+ return R.ok(sysDictItemService.list(Wrappers.query().lambda().eq(SysDictItem::getDictType, type)));
+ }
+
+ /**
+ * 添加字典
+ * @param sysDict 字典信息
+ * @return success、false
+ */
+ @SysLog("添加字典")
+ @PostMapping
+ @PreAuthorize("@pms.hasPermission('sys_dict_add')")
+ public R save(@Valid @RequestBody SysDict sysDict) {
+ sysDictService.save(sysDict);
+ return R.ok(sysDict);
+ }
+
+ /**
+ * 删除字典,并且清除字典缓存
+ * @param ids ID
+ * @return R
+ */
+ @SysLog("删除字典")
+ @DeleteMapping
+ @PreAuthorize("@pms.hasPermission('sys_dict_del')")
+ @CacheEvict(value = CacheConstants.DICT_DETAILS, allEntries = true)
+ public R removeById(@RequestBody Long[] ids) {
+ return R.ok(sysDictService.removeDictByIds(ids));
+ }
+
+ /**
+ * 修改字典
+ * @param sysDict 字典信息
+ * @return success/false
+ */
+ @PutMapping
+ @SysLog("修改字典")
+ @PreAuthorize("@pms.hasPermission('sys_dict_edit')")
+ public R updateById(@Valid @RequestBody SysDict sysDict) {
+ return sysDictService.updateDict(sysDict);
+ }
+
+ /**
+ * 分页查询
+ * @param name 名称或者字典项
+ * @return
+ */
+ @GetMapping("/list")
+ public R getDictList(String name) {
+ return R.ok(sysDictService.list(Wrappers.lambdaQuery()
+ .like(StrUtil.isNotBlank(name), SysDict::getDictType, name)
+ .or()
+ .like(StrUtil.isNotBlank(name), SysDict::getDescription, name)));
+ }
+
+ /**
+ * 分页查询
+ * @param page 分页对象
+ * @param sysDictItem 字典项
+ * @return
+ */
+ @GetMapping("/item/page")
+ public R getSysDictItemPage(Page page, SysDictItem sysDictItem) {
+ return R.ok(sysDictItemService.page(page, Wrappers.query(sysDictItem)));
+ }
+
+ /**
+ * 通过id查询字典项
+ * @param id id
+ * @return R
+ */
+ @GetMapping("/item/details/{id}")
+ public R getDictItemById(@PathVariable("id") Long id) {
+ return R.ok(sysDictItemService.getById(id));
+ }
+
+ /**
+ * 查询字典项详情
+ * @param query 查询条件
+ * @return R
+ */
+ @GetMapping("/item/details")
+ public R getDictItemDetails(SysDictItem query) {
+ return R.ok(sysDictItemService.getOne(Wrappers.query(query), false));
+ }
+
+ /**
+ * 新增字典项
+ * @param sysDictItem 字典项
+ * @return R
+ */
+ @SysLog("新增字典项")
+ @PostMapping("/item")
+ @CacheEvict(value = CacheConstants.DICT_DETAILS, allEntries = true)
+ public R save(@RequestBody SysDictItem sysDictItem) {
+ return R.ok(sysDictItemService.save(sysDictItem));
+ }
+
+ /**
+ * 修改字典项
+ * @param sysDictItem 字典项
+ * @return R
+ */
+ @SysLog("修改字典项")
+ @PutMapping("/item")
+ public R updateById(@RequestBody SysDictItem sysDictItem) {
+ return sysDictItemService.updateDictItem(sysDictItem);
+ }
+
+ /**
+ * 通过id删除字典项
+ * @param id id
+ * @return R
+ */
+ @SysLog("删除字典项")
+ @DeleteMapping("/item/{id}")
+ public R removeDictItemById(@PathVariable Long id) {
+ return sysDictItemService.removeDictItem(id);
+ }
+
+ /**
+ * 同步缓存字典
+ * @return R
+ */
+ @SysLog("同步字典")
+ @PutMapping("/sync")
+ public R sync() {
+ return sysDictService.syncDictCache();
+ }
+
+ @ResponseExcel
+ @GetMapping("/export")
+ public List export(SysDictItem sysDictItem) {
+ return sysDictItemService.list(Wrappers.query(sysDictItem));
+ }
+
+}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/FileController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysFileController.java
similarity index 79%
rename from pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/FileController.java
rename to pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysFileController.java
index fa5b90f8..8f139ace 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/FileController.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysFileController.java
@@ -19,7 +19,7 @@ package com.pig4cloud.pig.admin.controller;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pig.admin.api.entity.SysFile;
@@ -30,28 +30,28 @@ import com.pig4cloud.pig.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
+import org.springdoc.core.annotations.ParameterObject;
import org.springframework.core.io.ClassPathResource;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
-import jakarta.servlet.http.HttpServletResponse;
-
/**
* 文件管理
*
* @author Luckly
- * @date 2021-09-11
+ * @date 2019-06-18 17:18:42
*/
@RestController
-@RequiredArgsConstructor
+@AllArgsConstructor
@RequestMapping("/sys-file")
-@Tag(name = "文件管理模块")
+@Tag(description = "sys-file", name = "文件管理")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
-public class FileController {
+public class SysFileController {
private final SysFileService sysFileService;
@@ -63,22 +63,26 @@ public class FileController {
*/
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page")
- public R> getSysFilePage(Page page, SysFile sysFile) {
- return R.ok(sysFileService.page(page, Wrappers.lambdaQuery()
- .like(StrUtil.isNotBlank(sysFile.getFileName()), SysFile::getFileName, sysFile.getFileName())));
+ public R getSysFilePage(@ParameterObject Page page, @ParameterObject SysFile sysFile) {
+ LambdaQueryWrapper wrapper = Wrappers.lambdaQuery()
+ .like(StrUtil.isNotBlank(sysFile.getOriginal()), SysFile::getOriginal, sysFile.getOriginal());
+ return R.ok(sysFileService.page(page, wrapper));
}
/**
* 通过id删除文件管理
- * @param id id
+ * @param ids id 列表
* @return R
*/
@Operation(summary = "通过id删除文件管理", description = "通过id删除文件管理")
@SysLog("删除文件管理")
- @DeleteMapping("/{id:\\d+}")
+ @DeleteMapping
@PreAuthorize("@pms.hasPermission('sys_file_del')")
- public R removeById(@PathVariable Long id) {
- return R.ok(sysFileService.deleteFile(id));
+ public R removeById(@RequestBody Long[] ids) {
+ for (Long id : ids) {
+ sysFileService.deleteFile(id);
+ }
+ return R.ok();
}
/**
@@ -110,23 +114,11 @@ public class FileController {
* @param response 本地文件
*/
@SneakyThrows
- @GetMapping("/local/{fileName}")
+ @GetMapping("/local/file/{fileName}")
public void localFile(@PathVariable String fileName, HttpServletResponse response) {
ClassPathResource resource = new ClassPathResource("file/" + fileName);
response.setContentType("application/octet-stream; charset=UTF-8");
IoUtil.copy(resource.getInputStream(), response.getOutputStream());
}
- /**
- * 获取文件外网的访问地址
- * @param bucket
- * @param fileName
- * @return
- */
- @Inner(false)
- @GetMapping("/online/{bucket}/{fileName}")
- public R onlineFile(@PathVariable String bucket, @PathVariable String fileName) {
- return R.ok(sysFileService.onlineFile(bucket, fileName));
- }
-
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysLogController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysLogController.java
new file mode 100644
index 00000000..49946feb
--- /dev/null
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysLogController.java
@@ -0,0 +1,105 @@
+/*
+ *
+ * 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 pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ *
+ */
+
+package com.pig4cloud.pig.admin.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.pig4cloud.pig.admin.api.dto.SysLogDTO;
+import com.pig4cloud.pig.admin.api.entity.SysLog;
+import com.pig4cloud.pig.admin.api.vo.PreLogVO;
+import com.pig4cloud.pig.admin.service.SysLogService;
+import com.pig4cloud.pig.common.core.util.R;
+import com.pig4cloud.pig.common.security.annotation.Inner;
+import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
+import lombok.AllArgsConstructor;
+import org.springdoc.core.annotations.ParameterObject;
+import org.springframework.http.HttpHeaders;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ *
+ * 日志表 前端控制器
+ *
+ *
+ * @author lengleng
+ * @since 2017-11-20
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/log")
+@Tag(description = "log", name = "日志管理模块")
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class SysLogController {
+
+ private final SysLogService sysLogService;
+
+ /**
+ * 简单分页查询
+ * @param page 分页对象
+ * @param sysLog 系统日志
+ * @return
+ */
+ @GetMapping("/page")
+ public R getLogPage(@ParameterObject Page page, @ParameterObject SysLogDTO sysLog) {
+ return R.ok(sysLogService.getLogByPage(page, sysLog));
+ }
+
+ /**
+ * 批量删除日志
+ * @param ids ID
+ * @return success/false
+ */
+ @DeleteMapping
+ @PreAuthorize("@pms.hasPermission('sys_log_del')")
+ public R removeByIds(@RequestBody Long[] ids) {
+ return R.ok(sysLogService.removeBatchByIds(CollUtil.toList(ids)));
+ }
+
+ /**
+ * 插入日志
+ * @param sysLog 日志实体
+ * @return success/false
+ */
+ @Inner
+ @PostMapping("/save")
+ public R save(@Valid @RequestBody SysLog sysLog) {
+ return R.ok(sysLogService.saveLog(sysLog));
+ }
+
+ /**
+ * 导出excel 表格
+ * @param sysLog 查询条件
+ * @return
+ */
+ @ResponseExcel
+ @GetMapping("/export")
+ @PreAuthorize("@pms.hasPermission('sys_log_export')")
+ public List export(SysLog sysLog) {
+ return sysLogService.list(Wrappers.query(sysLog));
+ }
+
+}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/MenuController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysMenuController.java
similarity index 52%
rename from pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/MenuController.java
rename to pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysMenuController.java
index e6fdd2b5..78aa094b 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/MenuController.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysMenuController.java
@@ -1,22 +1,24 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.controller;
-import cn.hutool.core.lang.tree.Tree;
import com.pig4cloud.pig.admin.api.entity.SysMenu;
import com.pig4cloud.pig.admin.service.SysMenuService;
import com.pig4cloud.pig.common.core.util.R;
@@ -24,14 +26,13 @@ import com.pig4cloud.pig.common.log.annotation.SysLog;
import com.pig4cloud.pig.common.security.util.SecurityUtils;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
+import jakarta.validation.Valid;
+import lombok.AllArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
-import jakarta.validation.Valid;
-import java.util.Collection;
-import java.util.List;
+import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;
@@ -40,39 +41,37 @@ import java.util.stream.Collectors;
* @date 2017/10/31
*/
@RestController
-@RequiredArgsConstructor
+@AllArgsConstructor
@RequestMapping("/menu")
-@Tag(name = "菜单管理模块")
+@Tag(description = "menu", name = "菜单管理模块")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
-public class MenuController {
+public class SysMenuController {
private final SysMenuService sysMenuService;
/**
* 返回当前用户的树形菜单集合
+ * @param type 类型
* @param parentId 父节点ID
* @return 当前用户的树形菜单
*/
@GetMapping
- public R>> getUserMenu(Long parentId) {
+ public R getUserMenu(String type, Long parentId) {
// 获取符合条件的菜单
- Set menuSet = SecurityUtils.getRoles()
- .stream()
- .map(sysMenuService::findMenuByRoleId)
- .flatMap(Collection::stream)
- .collect(Collectors.toSet());
- return R.ok(sysMenuService.filterMenu(menuSet, parentId));
+ Set all = new HashSet<>();
+ SecurityUtils.getRoles().forEach(roleId -> all.addAll(sysMenuService.findMenuByRoleId(roleId)));
+ return R.ok(sysMenuService.filterMenu(all, type, parentId));
}
/**
* 返回树形菜单集合
- * @param lazy 是否是懒加载
* @param parentId 父节点ID
+ * @param menuName 菜单名称
* @return 树形菜单
*/
@GetMapping(value = "/tree")
- public R>> getTree(boolean lazy, Long parentId) {
- return R.ok(sysMenuService.treeMenu(lazy, parentId));
+ public R getTree(Long parentId, String menuName, String type) {
+ return R.ok(sysMenuService.treeMenu(parentId, menuName, type));
}
/**
@@ -81,7 +80,7 @@ public class MenuController {
* @return 属性集合
*/
@GetMapping("/tree/{roleId}")
- public R> getRoleTree(@PathVariable Long roleId) {
+ public R getRoleTree(@PathVariable Long roleId) {
return R
.ok(sysMenuService.findMenuByRoleId(roleId).stream().map(SysMenu::getMenuId).collect(Collectors.toList()));
}
@@ -91,20 +90,20 @@ public class MenuController {
* @param id 菜单ID
* @return 菜单详细信息
*/
- @GetMapping("/{id:\\d+}")
- public R getById(@PathVariable Long id) {
+ @GetMapping("/{id}")
+ public R getById(@PathVariable Long id) {
return R.ok(sysMenuService.getById(id));
}
/**
* 新增菜单
* @param sysMenu 菜单信息
- * @return 含ID 菜单信息
+ * @return success/false
*/
@SysLog("新增菜单")
@PostMapping
@PreAuthorize("@pms.hasPermission('sys_menu_add')")
- public R save(@Valid @RequestBody SysMenu sysMenu) {
+ public R save(@Valid @RequestBody SysMenu sysMenu) {
sysMenuService.save(sysMenu);
return R.ok(sysMenu);
}
@@ -115,10 +114,10 @@ public class MenuController {
* @return success/false
*/
@SysLog("删除菜单")
- @DeleteMapping("/{id:\\d+}")
+ @DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('sys_menu_del')")
- public R removeById(@PathVariable Long id) {
- return R.ok(sysMenuService.removeMenuById(id));
+ public R removeById(@PathVariable Long id) {
+ return sysMenuService.removeMenuById(id);
}
/**
@@ -129,19 +128,8 @@ public class MenuController {
@SysLog("更新菜单")
@PutMapping
@PreAuthorize("@pms.hasPermission('sys_menu_edit')")
- public R update(@Valid @RequestBody SysMenu sysMenu) {
+ public R update(@Valid @RequestBody SysMenu sysMenu) {
return R.ok(sysMenuService.updateMenuById(sysMenu));
}
- /**
- * 清除菜单缓存
- */
- @SysLog("清除菜单缓存")
- @DeleteMapping("/cache")
- @PreAuthorize("@pms.hasPermission('sys_menu_del')")
- public R clearMenuCache() {
- sysMenuService.clearMenuCache();
- return R.ok();
- }
-
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysMobileController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysMobileController.java
new file mode 100644
index 00000000..31f5d084
--- /dev/null
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysMobileController.java
@@ -0,0 +1,53 @@
+/*
+ * 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 pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ */
+
+package com.pig4cloud.pig.admin.controller;
+
+import com.pig4cloud.pig.admin.service.SysMobileService;
+import com.pig4cloud.pig.common.core.util.R;
+import com.pig4cloud.pig.common.security.annotation.Inner;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.AllArgsConstructor;
+import org.springframework.http.HttpHeaders;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author lengleng
+ * @date 2018/11/14
+ *
* 客户端注册功能 register.user = false
*/
@RestController
@RequestMapping("/register")
@RequiredArgsConstructor
@ConditionalOnProperty(name = "register.user", matchIfMissing = true)
-public class RegisterController {
+public class SysRegisterController {
private final SysUserService userService;
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysRoleController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysRoleController.java
new file mode 100644
index 00000000..3066d024
--- /dev/null
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysRoleController.java
@@ -0,0 +1,186 @@
+/*
+ *
+ * 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 pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
+ *
+ */
+
+package com.pig4cloud.pig.admin.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.pig4cloud.pig.admin.api.entity.SysRole;
+import com.pig4cloud.pig.admin.api.vo.RoleExcelVO;
+import com.pig4cloud.pig.admin.api.vo.RoleVO;
+import com.pig4cloud.pig.admin.service.SysRoleService;
+import com.pig4cloud.pig.common.core.constant.CacheConstants;
+import com.pig4cloud.pig.common.core.util.R;
+import com.pig4cloud.pig.common.log.annotation.SysLog;
+import com.pig4cloud.plugin.excel.annotation.RequestExcel;
+import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
+import lombok.AllArgsConstructor;
+import org.springdoc.core.annotations.ParameterObject;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.http.HttpHeaders;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * @author lengleng
+ * @date 2020-02-10
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/role")
+@Tag(description = "role", name = "角色管理模块")
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class SysRoleController {
+
+ private final SysRoleService sysRoleService;
+
+ /**
+ * 通过ID查询角色信息
+ * @param id ID
+ * @return 角色信息
+ */
+ @GetMapping("/details/{id}")
+ public R getById(@PathVariable Long id) {
+ return R.ok(sysRoleService.getById(id));
+ }
+
+ /**
+ * 查询角色信息
+ * @param query 查询条件
+ * @return 角色信息
+ */
+ @GetMapping("/details")
+ public R getDetails(@ParameterObject SysRole query) {
+ return R.ok(sysRoleService.getOne(Wrappers.query(query), false));
+ }
+
+ /**
+ * 添加角色
+ * @param sysRole 角色信息
+ * @return success、false
+ */
+ @SysLog("添加角色")
+ @PostMapping
+ @PreAuthorize("@pms.hasPermission('sys_role_add')")
+ @CacheEvict(value = CacheConstants.ROLE_DETAILS, allEntries = true)
+ public R save(@Valid @RequestBody SysRole sysRole) {
+ return R.ok(sysRoleService.save(sysRole));
+ }
+
+ /**
+ * 修改角色
+ * @param sysRole 角色信息
+ * @return success/false
+ */
+ @SysLog("修改角色")
+ @PutMapping
+ @PreAuthorize("@pms.hasPermission('sys_role_edit')")
+ @CacheEvict(value = CacheConstants.ROLE_DETAILS, allEntries = true)
+ public R update(@Valid @RequestBody SysRole sysRole) {
+ return R.ok(sysRoleService.updateById(sysRole));
+ }
+
+ /**
+ * 删除角色
+ * @param ids
+ * @return
+ */
+ @SysLog("删除角色")
+ @DeleteMapping
+ @PreAuthorize("@pms.hasPermission('sys_role_del')")
+ @CacheEvict(value = CacheConstants.ROLE_DETAILS, allEntries = true)
+ public R removeById(@RequestBody Long[] ids) {
+ return R.ok(sysRoleService.removeRoleByIds(ids));
+ }
+
+ /**
+ * 获取角色列表
+ * @return 角色列表
+ */
+ @GetMapping("/list")
+ public R listRoles() {
+ return R.ok(sysRoleService.list(Wrappers.emptyWrapper()));
+ }
+
+ /**
+ * 分页查询角色信息
+ * @param page 分页对象
+ * @param role 查询条件
+ * @return 分页对象
+ */
+ @GetMapping("/page")
+ public R getRolePage(Page page, SysRole role) {
+ return R.ok(sysRoleService.page(page, Wrappers.lambdaQuery()
+ .like(StrUtil.isNotBlank(role.getRoleName()), SysRole::getRoleName, role.getRoleName())));
+ }
+
+ /**
+ * 更新角色菜单
+ * @param roleVo 角色对象
+ * @return success、false
+ */
+ @SysLog("更新角色菜单")
+ @PutMapping("/menu")
+ @PreAuthorize("@pms.hasPermission('sys_role_perm')")
+ public R saveRoleMenus(@RequestBody RoleVO roleVo) {
+ return R.ok(sysRoleService.updateRoleMenus(roleVo));
+ }
+
+ /**
+ * 通过角色ID 查询角色列表
+ * @param roleIdList 角色ID
+ * @return
+ */
+ @PostMapping("/getRoleList")
+ public R getRoleList(@RequestBody List roleIdList) {
+ return R.ok(sysRoleService.findRolesByRoleIds(roleIdList, CollUtil.join(roleIdList, StrUtil.UNDERLINE)));
+ }
+
+ /**
+ * 导出excel 表格
+ * @return
+ */
+ @ResponseExcel
+ @GetMapping("/export")
+ @PreAuthorize("@pms.hasPermission('sys_role_export')")
+ public List export() {
+ return sysRoleService.listRole();
+ }
+
+ /**
+ * 导入角色
+ * @param excelVOList 角色列表
+ * @param bindingResult 错误信息列表
+ * @return ok fail
+ */
+ @PostMapping("/import")
+ @PreAuthorize("@pms.hasPermission('sys_role_export')")
+ public R importRole(@RequestExcel List excelVOList, BindingResult bindingResult) {
+ return sysRoleService.importRole(excelVOList, bindingResult);
+ }
+
+}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysSystemInfoController.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysSystemInfoController.java
new file mode 100644
index 00000000..4318abc7
--- /dev/null
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysSystemInfoController.java
@@ -0,0 +1,59 @@
+package com.pig4cloud.pig.admin.controller;
+
+import com.pig4cloud.pig.common.core.util.R;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.data.redis.connection.RedisServerCommands;
+import org.springframework.data.redis.core.RedisCallback;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.http.HttpHeaders;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.*;
+
+@RestController
+@RequestMapping("/system")
+@RequiredArgsConstructor
+@Tag(description = "system", name = "系统监控")
+@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
+public class SysSystemInfoController {
+
+ private final RedisTemplate redisTemplate;
+
+ /**
+ * 缓存监控
+ * @return R
*
* @author lengleng
- * @since 2019/2/1
+ * @since 2017-11-20
*/
@Mapper
public interface SysLogMapper extends BaseMapper {
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysMenuMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysMenuMapper.java
index 9622ba7f..c7acc70c 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysMenuMapper.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysMenuMapper.java
@@ -1,26 +1,29 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.mapper;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pig4cloud.pig.admin.api.entity.SysMenu;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
-import java.util.Set;
+import java.util.List;
/**
*
@@ -28,7 +31,7 @@ import java.util.Set;
*
*
* @author lengleng
- * @since 2019/2/1
+ * @since 2017-10-29
*/
@Mapper
public interface SysMenuMapper extends BaseMapper {
@@ -38,6 +41,6 @@ public interface SysMenuMapper extends BaseMapper {
* @param roleId 角色ID
* @return
*/
- Set listMenusByRoleId(Long roleId);
+ List listMenusByRoleId(Long roleId);
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysOauthClientDetailsMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysOauthClientDetailsMapper.java
index 124097e7..39a47d6a 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysOauthClientDetailsMapper.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysOauthClientDetailsMapper.java
@@ -1,23 +1,26 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.mapper;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pig4cloud.pig.admin.api.entity.SysOauthClientDetails;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
@@ -26,7 +29,7 @@ import org.apache.ibatis.annotations.Mapper;
*
*
* @author lengleng
- * @since 2019/2/1
+ * @since 2018-05-15
*/
@Mapper
public interface SysOauthClientDetailsMapper extends BaseMapper {
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysPostMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysPostMapper.java
index 46078d6b..9118e41b 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysPostMapper.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysPostMapper.java
@@ -17,17 +17,17 @@
package com.pig4cloud.pig.admin.mapper;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pig4cloud.pig.admin.api.entity.SysPost;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
- * 岗位管理表 mapper接口
+ * 岗位信息表
*
* @author fxz
- * @date 2022-03-15 17:18:40
+ * @date 2022-03-26 12:50:43
*/
@Mapper
public interface SysPostMapper extends BaseMapper {
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysPublicParamMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysPublicParamMapper.java
index 55a8659a..b10662e7 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysPublicParamMapper.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysPublicParamMapper.java
@@ -16,8 +16,8 @@
*/
package com.pig4cloud.pig.admin.mapper;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pig4cloud.pig.admin.api.entity.SysPublicParam;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysRoleMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysRoleMapper.java
index 6779e35a..dc6f847d 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysRoleMapper.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysRoleMapper.java
@@ -1,23 +1,26 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.mapper;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pig4cloud.pig.admin.api.entity.SysRole;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@@ -28,7 +31,7 @@ import java.util.List;
*
*
* @author lengleng
- * @since 2019/2/1
+ * @since 2017-10-29
*/
@Mapper
public interface SysRoleMapper extends BaseMapper {
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysRoleMenuMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysRoleMenuMapper.java
index b6196ab4..2facf53e 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysRoleMenuMapper.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysRoleMenuMapper.java
@@ -1,23 +1,26 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.mapper;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pig4cloud.pig.admin.api.entity.SysRoleMenu;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
@@ -26,7 +29,7 @@ import org.apache.ibatis.annotations.Mapper;
*
*
* @author lengleng
- * @since 2019/2/1
+ * @since 2017-10-29
*/
@Mapper
public interface SysRoleMenuMapper extends BaseMapper {
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysUserMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysUserMapper.java
index 58fdaf1d..99b20667 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysUserMapper.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysUserMapper.java
@@ -1,17 +1,20 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.mapper;
@@ -33,7 +36,7 @@ import java.util.List;
*
*
* @author lengleng
- * @since 2019/2/1
+ * @since 2017-10-29
*/
@Mapper
public interface SysUserMapper extends BaseMapper {
@@ -49,6 +52,7 @@ public interface SysUserMapper extends BaseMapper {
* 分页查询用户信息(含角色)
* @param page 分页
* @param userDTO 查询参数
+ * @param dataScope
* @return list
*/
IPage getUserVosPage(Page page, @Param("query") UserDTO userDTO);
@@ -63,6 +67,7 @@ public interface SysUserMapper extends BaseMapper {
/**
* 查询用户列表
* @param userDTO 查询条件
+ * @param dataScope 数据权限声明
* @return
*/
List selectVoList(@Param("query") UserDTO userDTO);
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysUserRoleMapper.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysUserRoleMapper.java
index e0de4b70..890b85e5 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysUserRoleMapper.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/mapper/SysUserRoleMapper.java
@@ -1,25 +1,27 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.mapper;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pig4cloud.pig.admin.api.entity.SysUserRole;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
/**
*
*
* @author lengleng
- * @since 2019/2/1
+ * @since 2017-10-29
*/
@Mapper
public interface SysUserRoleMapper extends BaseMapper {
- /**
- * 根据用户Id删除该用户的角色关系
- * @param userId 用户ID
- * @return boolean
- * @author 寻欢·李
- * @date 2017年12月7日 16:31:38
- */
- Boolean deleteByUserId(@Param("userId") Long userId);
-
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDeptRelationService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDeptRelationService.java
deleted file mode 100644
index 72cbb950..00000000
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDeptRelationService.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.pig4cloud.pig.admin.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.pig4cloud.pig.admin.api.entity.SysDept;
-import com.pig4cloud.pig.admin.api.entity.SysDeptRelation;
-
-/**
- *
- * 服务类
- *
- *
- * @author lengleng
- * @since 2019/2/1
- */
-public interface SysDeptRelationService extends IService {
-
- /**
- * 新建部门关系
- * @param sysDept 部门
- */
- void saveDeptRelation(SysDept sysDept);
-
- /**
- * 通过ID删除部门关系
- * @param id
- */
- void removeDeptRelationById(Long id);
-
- /**
- * 更新部门关系
- * @param relation
- */
- void updateDeptRelation(SysDeptRelation relation);
-
-}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDeptService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDeptService.java
index 2005be34..4153e6ea 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDeptService.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDeptService.java
@@ -1,17 +1,20 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.service;
@@ -19,6 +22,9 @@ package com.pig4cloud.pig.admin.service;
import cn.hutool.core.lang.tree.Tree;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.pig.admin.api.entity.SysDept;
+import com.pig4cloud.pig.admin.api.vo.DeptExcelVo;
+import com.pig4cloud.pig.common.core.util.R;
+import org.springframework.validation.BindingResult;
import java.util.List;
@@ -28,28 +34,16 @@ import java.util.List;
*
*
* @author lengleng
- * @since 2019/2/1
+ * @since 2018-01-20
*/
public interface SysDeptService extends IService {
/**
* 查询部门树菜单
+ * @param deptName 部门名称
* @return 树
*/
- List> listDeptTrees();
-
- /**
- * 查询用户部门树
- * @return
- */
- List> listCurrentUserDeptTrees();
-
- /**
- * 添加信息部门
- * @param sysDept
- * @return
- */
- Boolean saveDept(SysDept sysDept);
+ List> selectTree(String deptName);
/**
* 删除部门
@@ -58,18 +52,15 @@ public interface SysDeptService extends IService {
*/
Boolean removeDeptById(Long id);
- /**
- * 更新部门
- * @param sysDept 部门信息
- * @return 成功、失败
- */
- Boolean updateDeptById(SysDept sysDept);
+ List listExcelVo();
+
+ R importDept(List excelVOList, BindingResult bindingResult);
/**
- * 查找指定部门的子部门id列表
- * @param deptId 部门id
- * @return List
+ * 获取部门的所有后代部门列表
+ * @param deptId 部门ID
+ * @return 后代部门列表
*/
- List listChildDeptId(Long deptId);
+ List listDescendant(Long deptId);
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDictItemService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDictItemService.java
index d9af4afe..8963eb3c 100755
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDictItemService.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDictItemService.java
@@ -1,22 +1,24 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * 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 pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pig.admin.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.pig.admin.api.entity.SysDictItem;
+import com.pig4cloud.pig.common.core.util.R;
/**
* 字典项
@@ -31,13 +33,13 @@ public interface SysDictItemService extends IService {
* @param id 字典项ID
* @return
*/
- void removeDictItem(Long id);
+ R removeDictItem(Long id);
/**
* 更新字典项
* @param item 字典项
* @return
*/
- void updateDictItem(SysDictItem item);
+ R updateDictItem(SysDictItem item);
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDictService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDictService.java
index 58ff67c4..90779628 100755
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDictService.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysDictService.java
@@ -1,22 +1,24 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * 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 pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pig.admin.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.pig.admin.api.entity.SysDict;
+import com.pig4cloud.pig.common.core.util.R;
/**
* 字典表
@@ -28,21 +30,22 @@ public interface SysDictService extends IService {
/**
* 根据ID 删除字典
- * @param id
+ * @param ids ID列表
* @return
*/
- void removeDict(Long id);
+ R removeDictByIds(Long[] ids);
/**
* 更新字典
* @param sysDict 字典
* @return
*/
- void updateDict(SysDict sysDict);
+ R updateDict(SysDict sysDict);
/**
- * 清除缓存
+ * 同步缓存 (清空缓存)
+ * @return R
*/
- void clearDictCache();
+ R syncDictCache();
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysFileService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysFileService.java
index b73f129e..2ca5ba7f 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysFileService.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysFileService.java
@@ -20,9 +20,8 @@ package com.pig4cloud.pig.admin.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.pig.admin.api.entity.SysFile;
import com.pig4cloud.pig.common.core.util.R;
-import org.springframework.web.multipart.MultipartFile;
-
import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.web.multipart.MultipartFile;
/**
* 文件管理
@@ -54,12 +53,4 @@ public interface SysFileService extends IService {
*/
Boolean deleteFile(Long id);
- /**
- * 获取外网访问地址
- * @param bucket
- * @param fileName
- * @return
- */
- String onlineFile(String bucket, String fileName);
-
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysLogService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysLogService.java
index e81ccccb..7fe4dc7b 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysLogService.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysLogService.java
@@ -1,17 +1,20 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.service;
@@ -21,15 +24,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.pig.admin.api.dto.SysLogDTO;
import com.pig4cloud.pig.admin.api.entity.SysLog;
-import java.util.List;
-
/**
*
* 日志表 服务类
*
*
* @author lengleng
- * @since 2019/2/1
+ * @since 2017-11-20
*/
public interface SysLogService extends IService {
@@ -39,13 +40,13 @@ public interface SysLogService extends IService {
* @param sysLog
* @return
*/
- Page getLogByPage(Page page, SysLogDTO sysLog);
+ Page getLogByPage(Page page, SysLogDTO sysLog);
/**
- * 列表查询日志
- * @param sysLog 查询条件
- * @return List
+ * 插入日志
+ * @param sysLog 日志对象
+ * @return true/false
*/
- List getLogList(SysLogDTO sysLog);
+ Boolean saveLog(SysLog sysLog);
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysMenuService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysMenuService.java
index 6b842e50..c1594d85 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysMenuService.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysMenuService.java
@@ -1,17 +1,20 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.service;
@@ -19,6 +22,7 @@ package com.pig4cloud.pig.admin.service;
import cn.hutool.core.lang.tree.Tree;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.pig.admin.api.entity.SysMenu;
+import com.pig4cloud.pig.common.core.util.R;
import java.util.List;
import java.util.Set;
@@ -29,7 +33,7 @@ import java.util.Set;
*
*
* @author lengleng
- * @since 2019/2/1
+ * @since 2017-10-29
*/
public interface SysMenuService extends IService {
@@ -38,14 +42,14 @@ public interface SysMenuService extends IService {
* @param roleId 角色ID
* @return 菜单列表
*/
- Set findMenuByRoleId(Long roleId);
+ List findMenuByRoleId(Long roleId);
/**
* 级联删除菜单
* @param id 菜单ID
- * @return true成功, false失败
+ * @return 成功、失败
*/
- Boolean removeMenuById(Long id);
+ R removeMenuById(Long id);
/**
* 更新菜单信息
@@ -56,23 +60,18 @@ public interface SysMenuService extends IService {
/**
* 构建树
- * @param lazy 是否是懒加载
* @param parentId 父节点ID
+ * @param menuName 菜单名称
* @return
*/
- List> treeMenu(boolean lazy, Long parentId);
+ List> treeMenu(Long parentId, String menuName, String type);
/**
* 查询菜单
- * @param menuSet
+ * @param voSet
* @param parentId
* @return
*/
- List> filterMenu(Set menuSet, Long parentId);
-
- /**
- * 清除菜单缓存
- */
- void clearMenuCache();
+ List> filterMenu(Set voSet, String type, Long parentId);
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/AppService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysMobileService.java
similarity index 78%
rename from pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/AppService.java
rename to pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysMobileService.java
index 80981864..d102831e 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/AppService.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysMobileService.java
@@ -17,28 +17,19 @@
package com.pig4cloud.pig.admin.service;
-import com.pig4cloud.pig.admin.api.dto.AppSmsDTO;
import com.pig4cloud.pig.common.core.util.R;
/**
* @author lengleng
* @date 2018/11/14
*/
-public interface AppService {
+public interface SysMobileService {
/**
* 发送手机验证码
- * @param sms phone
+ * @param mobile mobile
* @return code
*/
- R sendSmsCode(AppSmsDTO sms);
-
- /**
- * 校验验证码
- * @param phone 手机号
- * @param code 验证码
- * @return
- */
- boolean check(String phone, String code);
+ R sendSmsCode(String mobile);
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysOauthClientDetailsService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysOauthClientDetailsService.java
index ce4026c7..110c7c99 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysOauthClientDetailsService.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysOauthClientDetailsService.java
@@ -1,23 +1,28 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.service;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.pig.admin.api.entity.SysOauthClientDetails;
+import com.pig4cloud.pig.common.core.util.R;
/**
*
*
* @author lengleng
- * @since 2019/2/1
+ * @since 2018-05-15
*/
public interface SysOauthClientDetailsService extends IService {
/**
- * 通过ID删除客户端
- * @param id
+ * 根据客户端信息
+ * @param clientDetails
* @return
*/
- Boolean removeClientDetailsById(String id);
+ Boolean updateClientById(SysOauthClientDetails clientDetails);
/**
- * 修改客户端信息
- * @param sysOauthClientDetails
+ * 添加客户端
+ * @param clientDetails
* @return
*/
- Boolean updateClientDetailsById(SysOauthClientDetails sysOauthClientDetails);
+ Boolean saveClient(SysOauthClientDetails clientDetails);
/**
- * 清除客户端缓存
+ * 分页查询客户端信息
+ * @param page
+ * @param query
+ * @return
*/
- void clearClientCache();
+ Page queryPage(Page page, SysOauthClientDetails query);
+
+ /**
+ * 同步缓存 (清空缓存)
+ * @return R
+ */
+ R syncClientCache();
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysPostService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysPostService.java
index 6bd2ea6c..e7349fa3 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysPostService.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysPostService.java
@@ -26,13 +26,19 @@ import org.springframework.validation.BindingResult;
import java.util.List;
/**
- * 岗位管理 服务类
+ * 岗位信息表
*
* @author fxz
- * @date 2022-03-15 17:18:40
+ * @date 2022-03-26 12:50:43
*/
public interface SysPostService extends IService {
+ /**
+ * 导出excel 表格
+ * @return
+ */
+ List listPost();
+
/**
* 导入岗位
* @param excelVOList 岗位列表
@@ -41,10 +47,4 @@ public interface SysPostService extends IService {
*/
R importPost(List excelVOList, BindingResult bindingResult);
- /**
- * 导出excel 表格
- * @return
- */
- List listPost();
-
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysPublicParamService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysPublicParamService.java
index a834f9f2..e6f50ee4 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysPublicParamService.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysPublicParamService.java
@@ -45,10 +45,10 @@ public interface SysPublicParamService extends IService {
/**
* 删除参数
- * @param publicId
+ * @param publicIds 参数列表
* @return
*/
- R removeParam(Long publicId);
+ R removeParamByIds(Long[] publicIds);
/**
* 同步缓存
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysRoleMenuService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysRoleMenuService.java
index f8f5c084..73a13c6e 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysRoleMenuService.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysRoleMenuService.java
@@ -1,17 +1,20 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.service;
@@ -25,13 +28,13 @@ import com.pig4cloud.pig.admin.api.entity.SysRoleMenu;
*
*
* @author lengleng
- * @since 2019/2/1
+ * @since 2017-10-29
*/
public interface SysRoleMenuService extends IService {
/**
* 更新角色菜单
- * @param roleId 角色
+ * @param roleId 角色ID
* @param menuIds 菜单ID拼成的字符串,每个id之间根据逗号分隔
* @return
*/
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysRoleService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysRoleService.java
index c00b36a1..cbd3e5c1 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysRoleService.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysRoleService.java
@@ -1,17 +1,20 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.service;
@@ -19,6 +22,7 @@ package com.pig4cloud.pig.admin.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.pig.admin.api.entity.SysRole;
import com.pig4cloud.pig.admin.api.vo.RoleExcelVO;
+import com.pig4cloud.pig.admin.api.vo.RoleVO;
import com.pig4cloud.pig.common.core.util.R;
import org.springframework.validation.BindingResult;
@@ -30,16 +34,38 @@ import java.util.List;
*
*
* @author lengleng
- * @since 2019/2/1
+ * @since 2017-10-29
*/
public interface SysRoleService extends IService {
/**
- * 通过角色ID,删除角色
- * @param id
+ * 通过用户ID,查询角色信息
+ * @param userId
* @return
*/
- Boolean removeRoleById(Long id);
+ List findRolesByUserId(Long userId);
+
+ /**
+ * 根据角色ID 查询角色列表
+ * @param roleIdList 角色ID列表
+ * @param key 缓存key
+ * @return
+ */
+ List findRolesByRoleIds(List roleIdList, String key);
+
+ /**
+ * 通过角色ID,删除角色
+ * @param ids
+ * @return
+ */
+ Boolean removeRoleByIds(Long[] ids);
+
+ /**
+ * 根据角色菜单列表
+ * @param roleVo 角色&菜单列表
+ * @return
+ */
+ Boolean updateRoleMenus(RoleVO roleVo);
/**
* 导入角色
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysUserRoleService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysUserRoleService.java
index 6860414f..b86a402a 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysUserRoleService.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysUserRoleService.java
@@ -1,17 +1,20 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.service;
@@ -25,7 +28,7 @@ import com.pig4cloud.pig.admin.api.entity.SysUserRole;
*
*
* @author lengleng
- * @since 2019/2/1
+ * @since 2017-10-29
*/
public interface SysUserRoleService extends IService {
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysUserService.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysUserService.java
index f58f39c5..cfcdfa0a 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysUserService.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/SysUserService.java
@@ -1,17 +1,20 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.service;
@@ -28,11 +31,10 @@ import com.pig4cloud.pig.common.core.util.R;
import org.springframework.validation.BindingResult;
import java.util.List;
-import java.util.Set;
/**
* @author lengleng
- * @date 2019/2/1
+ * @date 2017/10/31
*/
public interface SysUserService extends IService {
@@ -41,7 +43,7 @@ public interface SysUserService extends IService {
* @param sysUser 用户
* @return userInfo
*/
- UserInfo getUserInfo(SysUser sysUser);
+ UserInfo findUserInfo(SysUser sysUser);
/**
* 分页查询用户信息(含有角色信息)
@@ -49,19 +51,19 @@ public interface SysUserService extends IService {
* @param userDTO 参数列表
* @return
*/
- IPage getUserWithRolePage(Page page, UserDTO userDTO);
+ IPage getUsersWithRolePage(Page page, UserDTO userDTO);
/**
* 删除用户
- * @param sysUser 用户
+ * @param ids 用户
* @return boolean
*/
- Boolean removeUserById(SysUser sysUser);
+ Boolean deleteUserByIds(Long[] ids);
/**
* 更新当前用户基本信息
* @param userDto 用户信息
- * @return Boolean 操作成功返回true,操作失败返回false
+ * @return Boolean
*/
R updateUserInfo(UserDTO userDto);
@@ -70,21 +72,14 @@ public interface SysUserService extends IService {
* @param userDto 用户信息
* @return
*/
- R updateUser(UserDTO userDto);
+ Boolean updateUser(UserDTO userDto);
/**
* 通过ID查询用户信息
* @param id 用户ID
* @return 用户信息
*/
- UserVO getUserVoById(Long id);
-
- /**
- * 查询上级部门的用户信息
- * @param username 用户名
- * @return R
- */
- List listAncestorUsersByUsername(String username);
+ UserVO selectUserVoById(Long id);
/**
* 保存用户信息
@@ -108,13 +103,6 @@ public interface SysUserService extends IService {
*/
R importUser(List excelVOList, BindingResult bindingResult);
- /**
- * 根据部门 id 列表查询对应的用户 id 集合
- * @param deptIds 部门 id 列表
- * @return userIdList
- */
- List listUserIdByDeptIds(Set deptIds);
-
/**
* 注册用户
* @param userDto 用户信息
@@ -122,4 +110,25 @@ public interface SysUserService extends IService {
*/
R registerUser(UserDTO userDto);
+ /**
+ * 锁定用户
+ * @param username
+ * @return
+ */
+ R lockUser(String username);
+
+ /**
+ * 修改密码
+ * @param userDto 用户信息
+ * @return
+ */
+ R changePassword(UserDTO userDto);
+
+ /**
+ * 校验密码
+ * @param password 密码明文
+ * @return
+ */
+ R checkPassword(String password);
+
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDeptRelationServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDeptRelationServiceImpl.java
deleted file mode 100644
index 3f077e3d..00000000
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDeptRelationServiceImpl.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.pig4cloud.pig.admin.service.impl;
-
-import cn.hutool.core.collection.CollUtil;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.pig4cloud.pig.admin.api.entity.SysDept;
-import com.pig4cloud.pig.admin.api.entity.SysDeptRelation;
-import com.pig4cloud.pig.admin.mapper.SysDeptRelationMapper;
-import com.pig4cloud.pig.admin.service.SysDeptRelationService;
-import lombok.RequiredArgsConstructor;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- *
- * 服务实现类
- *
- *
- * @author lengleng
- * @since 2019/2/1
- */
-@Service
-@RequiredArgsConstructor
-public class SysDeptRelationServiceImpl extends ServiceImpl
- implements SysDeptRelationService {
-
- private final SysDeptRelationMapper sysDeptRelationMapper;
-
- /**
- * 维护部门关系
- * @param sysDept 部门
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public void saveDeptRelation(SysDept sysDept) {
- // 增加部门关系表
- List relationList = sysDeptRelationMapper.selectList(
- Wrappers.query().lambda().eq(SysDeptRelation::getDescendant, sysDept.getParentId()))
- .stream()
- .map(relation -> {
- relation.setDescendant(sysDept.getDeptId());
- return relation;
- })
- .collect(Collectors.toList());
- if (CollUtil.isNotEmpty(relationList)) {
- this.saveBatch(relationList);
- }
-
- // 自己也要维护到关系表中
- SysDeptRelation own = new SysDeptRelation();
- own.setDescendant(sysDept.getDeptId());
- own.setAncestor(sysDept.getDeptId());
- sysDeptRelationMapper.insert(own);
- }
-
- /**
- * 通过ID删除部门关系
- * @param id
- */
- @Override
- public void removeDeptRelationById(Long id) {
- baseMapper.deleteDeptRelationsById(id);
- }
-
- /**
- * 更新部门关系
- * @param relation
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public void updateDeptRelation(SysDeptRelation relation) {
- baseMapper.deleteDeptRelations(relation);
- baseMapper.insertDeptRelations(relation);
- }
-
-}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDeptServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDeptServiceImpl.java
index b141b4e3..31cd166c 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDeptServiceImpl.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDeptServiceImpl.java
@@ -1,17 +1,20 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.service.impl;
@@ -20,18 +23,20 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNode;
import cn.hutool.core.lang.tree.TreeUtil;
+import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pig4cloud.pig.admin.api.entity.SysDept;
-import com.pig4cloud.pig.admin.api.entity.SysDeptRelation;
+import com.pig4cloud.pig.admin.api.vo.DeptExcelVo;
import com.pig4cloud.pig.admin.mapper.SysDeptMapper;
-import com.pig4cloud.pig.admin.service.SysDeptRelationService;
import com.pig4cloud.pig.admin.service.SysDeptService;
-import com.pig4cloud.pig.common.security.util.SecurityUtils;
-import lombok.RequiredArgsConstructor;
+import com.pig4cloud.pig.common.core.util.R;
+import com.pig4cloud.plugin.excel.vo.ErrorMessage;
+import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.validation.BindingResult;
import java.util.*;
import java.util.stream.Collectors;
@@ -42,28 +47,13 @@ import java.util.stream.Collectors;
*
*
* @author lengleng
- * @since 2019/2/1
+ * @since 2018-01-20
*/
@Service
-@RequiredArgsConstructor
+@AllArgsConstructor
public class SysDeptServiceImpl extends ServiceImpl implements SysDeptService {
- private final SysDeptRelationService sysDeptRelationService;
-
- /**
- * 添加信息部门
- * @param dept 部门
- * @return
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public Boolean saveDept(SysDept dept) {
- SysDept sysDept = new SysDept();
- BeanUtils.copyProperties(dept, sysDept);
- this.save(sysDept);
- sysDeptRelationService.saveDeptRelation(sysDept);
- return Boolean.TRUE;
- }
+ private final SysDeptMapper deptMapper;
/**
* 删除部门
@@ -74,85 +64,26 @@ public class SysDeptServiceImpl extends ServiceImpl impl
@Transactional(rollbackFor = Exception.class)
public Boolean removeDeptById(Long id) {
// 级联删除部门
- List idList = sysDeptRelationService
- .list(Wrappers.query().lambda().eq(SysDeptRelation::getAncestor, id))
- .stream()
- .map(SysDeptRelation::getDescendant)
- .collect(Collectors.toList());
+ List idList = this.listDescendant(id).stream().map(SysDept::getDeptId).collect(Collectors.toList());
- if (CollUtil.isNotEmpty(idList)) {
- this.removeByIds(idList);
- }
+ Optional.ofNullable(idList).filter(CollUtil::isNotEmpty).ifPresent(this::removeByIds);
- // 删除部门级联关系
- sysDeptRelationService.removeDeptRelationById(id);
return Boolean.TRUE;
}
- /**
- * 更新部门
- * @param sysDept 部门信息
- * @return 成功、失败
- */
- @Override
- @Transactional(rollbackFor = Exception.class)
- public Boolean updateDeptById(SysDept sysDept) {
- // 更新部门状态
- this.updateById(sysDept);
- // 更新部门关系
- SysDeptRelation relation = new SysDeptRelation();
- relation.setAncestor(sysDept.getParentId());
- relation.setDescendant(sysDept.getDeptId());
- sysDeptRelationService.updateDeptRelation(relation);
- return Boolean.TRUE;
- }
-
- @Override
- public List listChildDeptId(Long deptId) {
- List deptRelations = sysDeptRelationService.list(Wrappers.lambdaQuery()
- .eq(SysDeptRelation::getAncestor, deptId)
- .ne(SysDeptRelation::getDescendant, deptId));
- if (CollUtil.isNotEmpty(deptRelations)) {
- return deptRelations.stream().map(SysDeptRelation::getDescendant).collect(Collectors.toList());
- }
- return new ArrayList<>();
- }
-
/**
* 查询全部部门树
- * @return 树
+ * @param deptName
+ * @return 树 部门名称
*/
@Override
- public List> listDeptTrees() {
- return getDeptTree(this.list(Wrappers.emptyWrapper()), 0L);
- }
+ public List> selectTree(String deptName) {
+ // 查询全部部门
+ List deptAllList = deptMapper
+ .selectList(Wrappers.lambdaQuery().like(StrUtil.isNotBlank(deptName), SysDept::getName, deptName));
- /**
- * 查询用户部门树
- * @return
- */
- @Override
- public List> listCurrentUserDeptTrees() {
- Long deptId = SecurityUtils.getUser().getDeptId();
- List descendantIdList = sysDeptRelationService
- .list(Wrappers.query().lambda().eq(SysDeptRelation::getAncestor, deptId))
- .stream()
- .map(SysDeptRelation::getDescendant)
- .collect(Collectors.toList());
-
- List deptList = baseMapper.selectBatchIds(descendantIdList);
- Optional dept = deptList.stream().filter(item -> item.getDeptId().intValue() == deptId).findFirst();
- return getDeptTree(deptList, dept.isPresent() ? dept.get().getParentId() : 0L);
- }
-
- /**
- * 构建部门树
- * @param depts 部门
- * @param parentId 父级id
- * @return
- */
- private List> getDeptTree(List depts, Long parentId) {
- List> collect = depts.stream()
+ // 权限内部门
+ List> collect = deptAllList.stream()
.filter(dept -> dept.getDeptId().intValue() != dept.getParentId())
.sorted(Comparator.comparingInt(SysDept::getSortOrder))
.map(dept -> {
@@ -161,15 +92,119 @@ public class SysDeptServiceImpl extends ServiceImpl impl
treeNode.setParentId(dept.getParentId());
treeNode.setName(dept.getName());
treeNode.setWeight(dept.getSortOrder());
- // 扩展属性
- Map extra = new HashMap<>(4);
+ // 有权限不返回标识
+ Map extra = new HashMap<>(8);
extra.put("createTime", dept.getCreateTime());
treeNode.setExtra(extra);
return treeNode;
})
.collect(Collectors.toList());
- return TreeUtil.build(collect, parentId);
+ // 模糊查询 不组装树结构 直接返回 表格方便编辑
+ if (StrUtil.isNotBlank(deptName)) {
+ return collect.stream().map(node -> {
+ Tree tree = new Tree<>();
+ tree.putAll(node.getExtra());
+ BeanUtils.copyProperties(node, tree);
+ return tree;
+ }).collect(Collectors.toList());
+ }
+
+ return TreeUtil.build(collect, 0L);
+ }
+
+ /**
+ * 导出部门
+ * @return
+ */
+ @Override
+ public List listExcelVo() {
+ List list = this.list();
+ List deptExcelVos = list.stream().map(item -> {
+ DeptExcelVo deptExcelVo = new DeptExcelVo();
+ deptExcelVo.setName(item.getName());
+ Optional first = this.list()
+ .stream()
+ .filter(it -> item.getParentId().equals(it.getDeptId()))
+ .map(SysDept::getName)
+ .findFirst();
+ deptExcelVo.setParentName(first.orElse("根部门"));
+ deptExcelVo.setSortOrder(item.getSortOrder());
+ return deptExcelVo;
+ }).collect(Collectors.toList());
+ return deptExcelVos;
+ }
+
+ @Override
+ public R importDept(List excelVOList, BindingResult bindingResult) {
+ List errorMessageList = (List) bindingResult.getTarget();
+
+ List deptList = this.list();
+ for (DeptExcelVo item : excelVOList) {
+ Set errorMsg = new HashSet<>();
+ boolean exsitUsername = deptList.stream().anyMatch(sysDept -> item.getName().equals(sysDept.getName()));
+ if (exsitUsername) {
+ errorMsg.add("部门名称已经存在");
+ }
+ SysDept one = this.getOne(Wrappers.lambdaQuery().eq(SysDept::getName, item.getParentName()));
+ if (item.getParentName().equals("根部门")) {
+ one = new SysDept();
+ one.setDeptId(0L);
+ }
+ if (one == null) {
+ errorMsg.add("上级部门不存在");
+ }
+ if (CollUtil.isEmpty(errorMsg)) {
+ SysDept sysDept = new SysDept();
+ sysDept.setName(item.getName());
+ sysDept.setParentId(one.getDeptId());
+ sysDept.setSortOrder(item.getSortOrder());
+ baseMapper.insert(sysDept);
+ }
+ else {
+ // 数据不合法情况
+ errorMessageList.add(new ErrorMessage(item.getLineNum(), errorMsg));
+ }
+ }
+ if (CollUtil.isNotEmpty(errorMessageList)) {
+ return R.failed(errorMessageList);
+ }
+ return R.ok(null, "部门导入成功");
+ }
+
+ /**
+ * 查询所有子节点 (包含当前节点)
+ * @param deptId 部门ID 目标部门ID
+ * @return ID
+ */
+ @Override
+ public List listDescendant(Long deptId) {
+ // 查询全部部门
+ List allDeptList = baseMapper.selectList(Wrappers.emptyWrapper());
+
+ // 递归查询所有子节点
+ List resDeptList = new ArrayList<>();
+ recursiveDept(allDeptList, deptId, resDeptList);
+
+ // 添加当前节点
+ resDeptList.addAll(allDeptList.stream()
+ .filter(sysDept -> deptId.equals(sysDept.getDeptId()))
+ .collect(Collectors.toList()));
+ return resDeptList;
+ }
+
+ /**
+ * 递归查询所有子节点。
+ * @param allDeptList 所有部门列表
+ * @param parentId 父部门ID
+ * @param resDeptList 结果集合
+ */
+ private void recursiveDept(List allDeptList, Long parentId, List resDeptList) {
+ // 使用 Stream API 进行筛选和遍历
+ allDeptList.stream().filter(sysDept -> sysDept.getParentId().equals(parentId)).forEach(sysDept -> {
+ resDeptList.add(sysDept);
+ recursiveDept(allDeptList, sysDept.getDeptId(), resDeptList);
+ });
}
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDictItemServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDictItemServiceImpl.java
index 65c729f2..b265c8cf 100755
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDictItemServiceImpl.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysDictItemServiceImpl.java
@@ -1,17 +1,18 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * 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 pig4cloud.com developer nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * Author: lengleng (wangiegie@gmail.com)
*/
package com.pig4cloud.pig.admin.service.impl;
@@ -25,10 +26,10 @@ import com.pig4cloud.pig.common.core.constant.CacheConstants;
import com.pig4cloud.pig.common.core.constant.enums.DictTypeEnum;
import com.pig4cloud.pig.common.core.exception.ErrorCodes;
import com.pig4cloud.pig.common.core.util.MsgUtils;
-import lombok.RequiredArgsConstructor;
+import com.pig4cloud.pig.common.core.util.R;
+import lombok.AllArgsConstructor;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;
-import org.springframework.util.Assert;
/**
* 字典项
@@ -37,7 +38,7 @@ import org.springframework.util.Assert;
* @date 2019/03/19
*/
@Service
-@RequiredArgsConstructor
+@AllArgsConstructor
public class SysDictItemServiceImpl extends ServiceImpl implements SysDictItemService {
private final SysDictService dictService;
@@ -49,14 +50,15 @@ public class SysDictItemServiceImpl extends ServiceImpl implements SysDictService {
private final SysDictItemMapper dictItemMapper;
/**
* 根据ID 删除字典
- * @param id 字典ID
+ * @param ids 字典ID 列表
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
@CacheEvict(value = CacheConstants.DICT_DETAILS, allEntries = true)
- public void removeDict(Long id) {
- SysDict dict = this.getById(id);
- // 系统内置
- Assert.state(!DictTypeEnum.SYSTEM.getType().equals(dict.getSystemFlag()),
- MsgUtils.getMessage(ErrorCodes.SYS_DICT_DELETE_SYSTEM));
- baseMapper.deleteById(id);
- dictItemMapper.delete(Wrappers.lambdaQuery().eq(SysDictItem::getDictId, id));
+ public R removeDictByIds(Long[] ids) {
+
+ List dictIdList = baseMapper.selectBatchIds(CollUtil.toList(ids))
+ .stream()
+ .filter(sysDict -> !sysDict.getSystemFlag().equals(DictTypeEnum.SYSTEM.getType()))// 系统内置类型不删除
+ .map(SysDict::getId)
+ .collect(Collectors.toList());
+
+ baseMapper.deleteBatchIds(dictIdList);
+
+ dictItemMapper.delete(Wrappers.lambdaQuery().in(SysDictItem::getDictId, dictIdList));
+ return R.ok();
}
/**
@@ -67,19 +77,25 @@ public class SysDictServiceImpl extends ServiceImpl impl
* @return
*/
@Override
- @CacheEvict(value = CacheConstants.DICT_DETAILS, key = "#dict.type")
- public void updateDict(SysDict dict) {
+ @CacheEvict(value = CacheConstants.DICT_DETAILS, key = "#dict.dictType")
+ public R updateDict(SysDict dict) {
SysDict sysDict = this.getById(dict.getId());
// 系统内置
- Assert.state(!DictTypeEnum.SYSTEM.getType().equals(sysDict.getSystemFlag()),
- MsgUtils.getMessage(ErrorCodes.SYS_DICT_UPDATE_SYSTEM));
+ if (DictTypeEnum.SYSTEM.getType().equals(sysDict.getSystemFlag())) {
+ return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_DICT_UPDATE_SYSTEM));
+ }
this.updateById(dict);
+ return R.ok(dict);
}
+ /**
+ * 同步缓存 (清空缓存)
+ * @return R
+ */
@Override
@CacheEvict(value = CacheConstants.DICT_DETAILS, allEntries = true)
- public void clearDictCache() {
-
+ public R syncDictCache() {
+ return R.ok();
}
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysFileServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysFileServiceImpl.java
index 3e9f197e..3a7ff84d 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysFileServiceImpl.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysFileServiceImpl.java
@@ -26,8 +26,9 @@ import com.pig4cloud.pig.admin.api.entity.SysFile;
import com.pig4cloud.pig.admin.mapper.SysFileMapper;
import com.pig4cloud.pig.admin.service.SysFileService;
import com.pig4cloud.pig.common.core.util.R;
-import com.pig4cloud.plugin.oss.OssProperties;
-import com.pig4cloud.plugin.oss.service.OssTemplate;
+import com.pig4cloud.pig.common.file.core.FileProperties;
+import com.pig4cloud.pig.common.file.core.FileTemplate;
+import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
@@ -35,11 +36,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
-import jakarta.servlet.http.HttpServletResponse;
-import java.time.Duration;
-import java.time.temporal.ChronoUnit;
+import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
+import java.util.Objects;
/**
* 文件管理
@@ -52,9 +52,9 @@ import java.util.Map;
@AllArgsConstructor
public class SysFileServiceImpl extends ServiceImpl implements SysFileService {
- private final OssProperties ossProperties;
+ private final FileTemplate fileTemplate;
- private final OssTemplate ossTemplate;
+ private final FileProperties properties;
/**
* 上传文件
@@ -65,13 +65,12 @@ public class SysFileServiceImpl extends ServiceImpl impl
public R uploadFile(MultipartFile file) {
String fileName = IdUtil.simpleUUID() + StrUtil.DOT + FileUtil.extName(file.getOriginalFilename());
Map resultMap = new HashMap<>(4);
- resultMap.put("bucketName", ossProperties.getBucketName());
+ resultMap.put("bucketName", properties.getBucketName());
resultMap.put("fileName", fileName);
- resultMap.put("url", String.format("/admin/sys-file/%s/%s", ossProperties.getBucketName(), fileName));
+ resultMap.put("url", String.format("/admin/sys-file/%s/%s", properties.getBucketName(), fileName));
- try {
- ossTemplate.putObject(ossProperties.getBucketName(), fileName, file.getContentType(),
- file.getInputStream());
+ try (InputStream inputStream = file.getInputStream()) {
+ fileTemplate.putObject(properties.getBucketName(), fileName, inputStream, file.getContentType());
// 文件管理数据记录,收集管理追踪文件
fileLog(file, fileName);
}
@@ -90,7 +89,7 @@ public class SysFileServiceImpl extends ServiceImpl impl
*/
@Override
public void getFile(String bucket, String fileName, HttpServletResponse response) {
- try (S3Object s3Object = ossTemplate.getObject(bucket, fileName)) {
+ try (S3Object s3Object = fileTemplate.getObject(bucket, fileName)) {
response.setContentType("application/octet-stream; charset=UTF-8");
IoUtil.copy(s3Object.getObjectContent(), response.getOutputStream());
}
@@ -109,7 +108,10 @@ public class SysFileServiceImpl extends ServiceImpl impl
@Transactional(rollbackFor = Exception.class)
public Boolean deleteFile(Long id) {
SysFile file = this.getById(id);
- ossTemplate.removeObject(ossProperties.getBucketName(), file.getFileName());
+ if (Objects.isNull(file)) {
+ return Boolean.FALSE;
+ }
+ fileTemplate.removeObject(properties.getBucketName(), file.getFileName());
return this.removeById(id);
}
@@ -124,19 +126,8 @@ public class SysFileServiceImpl extends ServiceImpl impl
sysFile.setOriginal(file.getOriginalFilename());
sysFile.setFileSize(file.getSize());
sysFile.setType(FileUtil.extName(file.getOriginalFilename()));
- sysFile.setBucketName(ossProperties.getBucketName());
+ sysFile.setBucketName(properties.getBucketName());
this.save(sysFile);
}
- /**
- * 默认获取文件的在线地址
- * @param bucket
- * @param fileName
- * @return
- */
- @Override
- public String onlineFile(String bucket, String fileName) {
- return ossTemplate.getObjectURL(bucket, fileName, Duration.of(7, ChronoUnit.DAYS));
- }
-
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysLogServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysLogServiceImpl.java
index eb04d3f6..f956a0ae 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysLogServiceImpl.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysLogServiceImpl.java
@@ -1,17 +1,20 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.service.impl;
@@ -27,8 +30,7 @@ import com.pig4cloud.pig.admin.api.entity.SysLog;
import com.pig4cloud.pig.admin.mapper.SysLogMapper;
import com.pig4cloud.pig.admin.service.SysLogService;
import org.springframework.stereotype.Service;
-
-import java.util.List;
+import org.springframework.transaction.annotation.Transactional;
/**
*
@@ -36,42 +38,37 @@ import java.util.List;
*
*
* @author lengleng
- * @since 2019/2/1
+ * @since 2017-11-20
*/
@Service
public class SysLogServiceImpl extends ServiceImpl implements SysLogService {
@Override
public Page getLogByPage(Page page, SysLogDTO sysLog) {
- return baseMapper.selectPage(page, buildQueryWrapper(sysLog));
- }
- /**
- * 列表查询日志
- * @param sysLog 查询条件
- * @return List
- */
- @Override
- public List getLogList(SysLogDTO sysLog) {
- return baseMapper.selectList(buildQueryWrapper(sysLog));
- }
-
- /**
- * 构建查询的 wrapper
- * @param sysLog 查询条件
- * @return LambdaQueryWrapper
- */
- private LambdaQueryWrapper buildQueryWrapper(SysLogDTO sysLog) {
- LambdaQueryWrapper wrapper = Wrappers.lambdaQuery()
- .eq(StrUtil.isNotBlank(sysLog.getType()), SysLog::getType, sysLog.getType())
- .like(StrUtil.isNotBlank(sysLog.getRemoteAddr()), SysLog::getRemoteAddr, sysLog.getRemoteAddr());
+ LambdaQueryWrapper wrapper = Wrappers.lambdaQuery();
+ if (StrUtil.isNotBlank(sysLog.getLogType())) {
+ wrapper.eq(SysLog::getLogType, sysLog.getLogType());
+ }
if (ArrayUtil.isNotEmpty(sysLog.getCreateTime())) {
wrapper.ge(SysLog::getCreateTime, sysLog.getCreateTime()[0])
.le(SysLog::getCreateTime, sysLog.getCreateTime()[1]);
}
- return wrapper;
+ return baseMapper.selectPage(page, wrapper);
+ }
+
+ /**
+ * 插入日志
+ * @param sysLog 日志对象
+ * @return true/false
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public Boolean saveLog(SysLog sysLog) {
+ baseMapper.insert(sysLog);
+ return Boolean.TRUE;
}
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMenuServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMenuServiceImpl.java
index 09fadb1e..1041e048 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMenuServiceImpl.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMenuServiceImpl.java
@@ -1,17 +1,20 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.service.impl;
@@ -20,6 +23,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNode;
import cn.hutool.core.lang.tree.TreeUtil;
+import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -33,19 +37,22 @@ import com.pig4cloud.pig.common.core.constant.CommonConstants;
import com.pig4cloud.pig.common.core.constant.enums.MenuTypeEnum;
import com.pig4cloud.pig.common.core.exception.ErrorCodes;
import com.pig4cloud.pig.common.core.util.MsgUtils;
-import lombok.RequiredArgsConstructor;
+import com.pig4cloud.pig.common.core.util.R;
+import jakarta.validation.constraints.NotNull;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.Assert;
-import jakarta.validation.constraints.NotNull;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
+import java.util.function.Predicate;
import java.util.stream.Collectors;
/**
@@ -57,34 +64,31 @@ import java.util.stream.Collectors;
* @since 2017-10-29
*/
@Service
-@RequiredArgsConstructor
+@AllArgsConstructor
+@Slf4j
public class SysMenuServiceImpl extends ServiceImpl implements SysMenuService {
private final SysRoleMenuMapper sysRoleMenuMapper;
@Override
- @Cacheable(value = CacheConstants.MENU_DETAILS, key = "#roleId + '_menu'", unless = "#result == null")
- public Set findMenuByRoleId(Long roleId) {
+ @Cacheable(value = CacheConstants.MENU_DETAILS, key = "#roleId", unless = "#result.isEmpty()")
+ public List findMenuByRoleId(Long roleId) {
return baseMapper.listMenusByRoleId(roleId);
}
- /**
- * 级联删除菜单
- * @param id 菜单ID
- * @return true成功, false失败
- */
@Override
@Transactional(rollbackFor = Exception.class)
@CacheEvict(value = CacheConstants.MENU_DETAILS, allEntries = true)
- public Boolean removeMenuById(Long id) {
+ public R removeMenuById(Long id) {
// 查询父节点为当前节点的节点
List menuList = this.list(Wrappers.query().lambda().eq(SysMenu::getParentId, id));
-
- Assert.isTrue(CollUtil.isEmpty(menuList), MsgUtils.getMessage(ErrorCodes.SYS_MENU_DELETE_EXISTING));
+ if (CollUtil.isNotEmpty(menuList)) {
+ return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_MENU_DELETE_EXISTING));
+ }
sysRoleMenuMapper.delete(Wrappers.query().lambda().eq(SysRoleMenu::getMenuId, id));
// 删除当前菜单及其子菜单
- return this.removeById(id);
+ return R.ok(this.removeById(id));
}
@Override
@@ -95,57 +99,54 @@ public class SysMenuServiceImpl extends ServiceImpl impl
/**
* 构建树查询 1. 不是懒加载情况,查询全部 2. 是懒加载,根据parentId 查询 2.1 父节点为空,则查询ID -1
- * @param lazy 是否是懒加载
* @param parentId 父节点ID
+ * @param menuName 菜单名称
* @return
*/
@Override
- public List> treeMenu(boolean lazy, Long parentId) {
- if (!lazy) {
- List> collect = baseMapper
- .selectList(Wrappers.lambdaQuery().orderByAsc(SysMenu::getSortOrder))
- .stream()
- .map(getNodeFunction())
- .collect(Collectors.toList());
-
- return TreeUtil.build(collect, CommonConstants.MENU_TREE_ROOT_ID);
- }
-
+ public List> treeMenu(Long parentId, String menuName, String type) {
Long parent = parentId == null ? CommonConstants.MENU_TREE_ROOT_ID : parentId;
List> collect = baseMapper
- .selectList(
- Wrappers.lambdaQuery().eq(SysMenu::getParentId, parent).orderByAsc(SysMenu::getSortOrder))
+ .selectList(Wrappers.lambdaQuery()
+ .like(StrUtil.isNotBlank(menuName), SysMenu::getName, menuName)
+ .eq(StrUtil.isNotBlank(type), SysMenu::getMenuType, type)
+ .orderByAsc(SysMenu::getSortOrder))
.stream()
.map(getNodeFunction())
.collect(Collectors.toList());
+ // 模糊查询 不组装树结构 直接返回 表格方便编辑
+ if (StrUtil.isNotBlank(menuName)) {
+ return collect.stream().map(node -> {
+ Tree tree = new Tree<>();
+ tree.putAll(node.getExtra());
+ BeanUtils.copyProperties(node, tree);
+ return tree;
+ }).collect(Collectors.toList());
+ }
+
return TreeUtil.build(collect, parent);
}
/**
* 查询菜单
* @param all 全部菜单
+ * @param type 类型
* @param parentId 父节点ID
* @return
*/
@Override
- public List> filterMenu(Set all, Long parentId) {
+ public List> filterMenu(Set all, String type, Long parentId) {
List> collect = all.stream()
- .filter(menu -> MenuTypeEnum.LEFT_MENU.getType().equals(menu.getType()))
- .filter(menu -> StrUtil.isNotBlank(menu.getPath()))
+ .filter(menuTypePredicate(type))
.map(getNodeFunction())
.collect(Collectors.toList());
+
Long parent = parentId == null ? CommonConstants.MENU_TREE_ROOT_ID : parentId;
return TreeUtil.build(collect, parent);
}
- @Override
- @CacheEvict(value = CacheConstants.MENU_DETAILS, allEntries = true)
- public void clearMenuCache() {
-
- }
-
@NotNull
private Function> getNodeFunction() {
return menu -> {
@@ -156,16 +157,42 @@ public class SysMenuServiceImpl extends ServiceImpl impl
node.setWeight(menu.getSortOrder());
// 扩展属性
Map extra = new HashMap<>();
- extra.put("icon", menu.getIcon());
extra.put("path", menu.getPath());
- extra.put("type", menu.getType());
+ extra.put("menuType", menu.getMenuType());
extra.put("permission", menu.getPermission());
- extra.put("label", menu.getName());
extra.put("sortOrder", menu.getSortOrder());
- extra.put("keepAlive", menu.getKeepAlive());
+
+ // 适配 vue3
+ Map meta = new HashMap<>();
+ meta.put("title", menu.getName());
+ meta.put("isLink", menu.getPath() != null && menu.getPath().startsWith("http") ? menu.getPath() : "");
+ meta.put("isHide", !BooleanUtil.toBooleanObject(menu.getVisible()));
+ meta.put("isKeepAlive", BooleanUtil.toBooleanObject(menu.getKeepAlive()));
+ meta.put("isAffix", false);
+ meta.put("isIframe", BooleanUtil.toBooleanObject(menu.getEmbedded()));
+ meta.put("icon", menu.getIcon());
+ // 增加英文
+ meta.put("enName", menu.getEnName());
+
+ extra.put("meta", meta);
node.setExtra(extra);
return node;
};
}
+ /**
+ * menu 类型断言
+ * @param type 类型
+ * @return Predicate
+ */
+ private Predicate menuTypePredicate(String type) {
+ return vo -> {
+ if (MenuTypeEnum.TOP_MENU.getDescription().equals(type)) {
+ return MenuTypeEnum.TOP_MENU.getType().equals(vo.getMenuType());
+ }
+ // 其他查询 左侧 + 顶部
+ return !MenuTypeEnum.BUTTON.getType().equals(vo.getMenuType());
+ };
+ }
+
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/AppServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMobileServiceImpl.java
similarity index 64%
rename from pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/AppServiceImpl.java
rename to pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMobileServiceImpl.java
index a68246b5..13f1905d 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/AppServiceImpl.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysMobileServiceImpl.java
@@ -17,24 +17,25 @@
package com.pig4cloud.pig.admin.service.impl;
+import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.RandomUtil;
+import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.pig4cloud.pig.admin.api.dto.AppSmsDTO;
import com.pig4cloud.pig.admin.api.entity.SysUser;
import com.pig4cloud.pig.admin.mapper.SysUserMapper;
-import com.pig4cloud.pig.admin.service.AppService;
+import com.pig4cloud.pig.admin.service.SysMobileService;
import com.pig4cloud.pig.common.core.constant.CacheConstants;
import com.pig4cloud.pig.common.core.constant.SecurityConstants;
+import com.pig4cloud.pig.common.core.constant.enums.LoginTypeEnum;
import com.pig4cloud.pig.common.core.exception.ErrorCodes;
import com.pig4cloud.pig.common.core.util.MsgUtils;
import com.pig4cloud.pig.common.core.util.R;
-import io.springboot.sms.core.SmsClient;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
-import java.util.Objects;
+import java.util.List;
import java.util.concurrent.TimeUnit;
/**
@@ -46,58 +47,39 @@ import java.util.concurrent.TimeUnit;
@Slf4j
@Service
@AllArgsConstructor
-public class AppServiceImpl implements AppService {
+public class SysMobileServiceImpl implements SysMobileService {
private final RedisTemplate redisTemplate;
private final SysUserMapper userMapper;
- private final SmsClient smsClient;
-
/**
* 发送手机验证码 TODO: 调用短信网关发送验证码,测试返回前端
- * @param sms 手机号
+ * @param mobile mobile
* @return code
*/
@Override
- public R sendSmsCode(AppSmsDTO sms) {
- Object codeObj = redisTemplate.opsForValue().get(CacheConstants.DEFAULT_CODE_KEY + sms.getPhone());
+ public R sendSmsCode(String mobile) {
+ List userList = userMapper
+ .selectList(Wrappers.query().lambda().eq(SysUser::getPhone, mobile));
+
+ if (CollUtil.isEmpty(userList)) {
+ log.info("手机号未注册:{}", mobile);
+ return R.ok(Boolean.FALSE, MsgUtils.getMessage(ErrorCodes.SYS_APP_PHONE_UNREGISTERED, mobile));
+ }
+
+ Object codeObj = redisTemplate.opsForValue().get(CacheConstants.DEFAULT_CODE_KEY + mobile);
if (codeObj != null) {
- log.info("手机号验证码未过期:{},{}", sms.getPhone(), codeObj);
+ log.info("手机号验证码未过期:{},{}", mobile, codeObj);
return R.ok(Boolean.FALSE, MsgUtils.getMessage(ErrorCodes.SYS_APP_SMS_OFTEN));
}
- // 校验手机号是否存在 sys_user 表
- if (sms.getExist()
- && !userMapper.exists(Wrappers.lambdaQuery().eq(SysUser::getPhone, sms.getPhone()))) {
- return R.ok(Boolean.FALSE, MsgUtils.getMessage(ErrorCodes.SYS_APP_PHONE_UNREGISTERED, sms.getPhone()));
- }
-
String code = RandomUtil.randomNumbers(Integer.parseInt(SecurityConstants.CODE_SIZE));
- log.info("手机号生成验证码成功:{},{}", sms.getPhone(), code);
+ log.debug("手机号生成验证码成功:{},{}", mobile, code);
redisTemplate.opsForValue()
- .set(CacheConstants.DEFAULT_CODE_KEY + sms.getPhone(), code, SecurityConstants.CODE_TIME, TimeUnit.SECONDS);
-
- // 调用短信通道发送
- this.smsClient.sendCode(code, sms.getPhone());
+ .set(CacheConstants.DEFAULT_CODE_KEY + mobile, code, SecurityConstants.CODE_TIME, TimeUnit.SECONDS);
return R.ok(Boolean.TRUE, code);
}
- /**
- * 校验验证码
- * @param phone 手机号
- * @param code 验证码
- * @return
- */
- @Override
- public boolean check(String phone, String code) {
- Object codeObj = redisTemplate.opsForValue().get(CacheConstants.DEFAULT_CODE_KEY + phone);
-
- if (Objects.isNull(codeObj)) {
- return false;
- }
- return codeObj.equals(code);
- }
-
}
diff --git a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysOauthClientDetailsServiceImpl.java b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysOauthClientDetailsServiceImpl.java
index 60dbdb81..2e267c7a 100644
--- a/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysOauthClientDetailsServiceImpl.java
+++ b/pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/service/impl/SysOauthClientDetailsServiceImpl.java
@@ -1,28 +1,36 @@
/*
- * Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright (c) 2018-2025, lengleng All rights reserved.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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 pig4cloud.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)
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
package com.pig4cloud.pig.admin.service.impl;
+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.pig4cloud.pig.admin.api.entity.SysOauthClientDetails;
import com.pig4cloud.pig.admin.mapper.SysOauthClientDetailsMapper;
import com.pig4cloud.pig.admin.service.SysOauthClientDetailsService;
import com.pig4cloud.pig.common.core.constant.CacheConstants;
+import com.pig4cloud.pig.common.core.util.R;
+import lombok.RequiredArgsConstructor;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
/**
*