mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-17 16:36:03 +08:00
Merge branch 'dev-ruoyi-5.8.9'
This commit is contained in:
@@ -46,12 +46,7 @@
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-text</artifactId>
|
||||
</dependency>
|
||||
<!-- oauth2-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security.oauth</groupId>
|
||||
<artifactId>spring-security-oauth2</artifactId>
|
||||
<version>2.5.1.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
@@ -125,6 +120,29 @@
|
||||
<artifactId>fastbee-ruleEngine</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--引入DM8驱动-->
|
||||
<dependency>
|
||||
<groupId>com.dameng</groupId>
|
||||
<artifactId>Dm8JdbcDriver18</artifactId>
|
||||
<version>8.1.1.49</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>mssql-jdbc</artifactId>
|
||||
<version>8.4.1.jre8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.5.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.oracle.database.jdbc</groupId>
|
||||
<artifactId>ojdbc8</artifactId>
|
||||
<version>19.3.0.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
package com.fastbee.iot.oauth;
|
||||
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer;
|
||||
import org.springframework.security.oauth2.provider.OAuth2RequestFactory;
|
||||
import org.springframework.security.oauth2.provider.approval.ApprovalStore;
|
||||
import org.springframework.security.oauth2.provider.approval.JdbcApprovalStore;
|
||||
import org.springframework.security.oauth2.provider.approval.UserApprovalHandler;
|
||||
import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;
|
||||
import org.springframework.security.oauth2.provider.code.JdbcAuthorizationCodeServices;
|
||||
import org.springframework.security.oauth2.provider.error.OAuth2AuthenticationEntryPoint;
|
||||
import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory;
|
||||
import org.springframework.security.oauth2.provider.token.TokenStore;
|
||||
import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
/**
|
||||
* 授权服务器配置,配置客户端id,密钥和令牌的过期时间
|
||||
*/
|
||||
@Configuration
|
||||
@EnableAuthorizationServer
|
||||
public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter {
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
|
||||
@Autowired
|
||||
private AuthenticationManager authenticationManager;
|
||||
|
||||
@Autowired
|
||||
private UserDetailsService userDetailsService;
|
||||
|
||||
/**
|
||||
* 用来配置令牌端点(Token Endpoint)的安全约束
|
||||
* @param security
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
|
||||
security.allowFormAuthenticationForClients()
|
||||
.authenticationEntryPoint(new OAuth2AuthenticationEntryPoint());
|
||||
}
|
||||
|
||||
/**
|
||||
* 用来配置客户端详情服务
|
||||
* @param clients
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
|
||||
|
||||
clients.withClientDetails(getClientDetailsService());
|
||||
}
|
||||
|
||||
/**
|
||||
* 用来配置授权(authorization)以及令牌(token)的访问端点和令牌服务(token services)。
|
||||
* @param endpoints
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
|
||||
// 查询用户、授权、分组,可以被重写
|
||||
endpoints.userDetailsService(userDetailsService)
|
||||
// 审批客户端的授权
|
||||
.userApprovalHandler(userApprovalHandler())
|
||||
// 授权审批
|
||||
.approvalStore(approvalStore())
|
||||
// 获取授权码
|
||||
.authorizationCodeServices(new JdbcAuthorizationCodeServices(dataSource))
|
||||
// 验证token
|
||||
.authenticationManager(authenticationManager)
|
||||
// 查询、保存、刷新token
|
||||
.tokenStore(this.getJdbcTokenStore());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ApprovalStore approvalStore() {
|
||||
return new JdbcApprovalStore(dataSource);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public UserApprovalHandler userApprovalHandler() {
|
||||
return new SpeakerApprovalHandler(getClientDetailsService(), approvalStore(), oAuth2RequestFactory());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JdbcClientDetailsService getClientDetailsService() {
|
||||
JdbcClientDetailsService jdbcClientDetailsService = new JdbcClientDetailsService(dataSource);
|
||||
jdbcClientDetailsService.setPasswordEncoder(passwordEncoder());
|
||||
return jdbcClientDetailsService;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public OAuth2RequestFactory oAuth2RequestFactory() {
|
||||
return new DefaultOAuth2RequestFactory(getClientDetailsService());
|
||||
}
|
||||
@Bean
|
||||
public TokenStore getJdbcTokenStore(){
|
||||
TokenStore tokenStore = new JdbcTokenStore(dataSource);
|
||||
return tokenStore;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public BCryptPasswordEncoder passwordEncoder(){
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.fastbee.iot.oauth;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
|
||||
import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationManager;
|
||||
import org.springframework.security.oauth2.provider.token.TokenStore;
|
||||
import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@Configuration
|
||||
@EnableResourceServer
|
||||
public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
|
||||
@Override
|
||||
public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
|
||||
TokenStore tokenStore = jdbcTokenStore();
|
||||
OAuth2AuthenticationManager auth2AuthenticationManager= new OAuth2AuthenticationManager();
|
||||
resources.authenticationManager(auth2AuthenticationManager);
|
||||
resources.resourceId("speaker-service").tokenStore(tokenStore).stateless(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(HttpSecurity http) throws Exception {
|
||||
// 限制资源服务器只接管匹配的资源
|
||||
http.requestMatchers().antMatchers("/oauth/speaker/**")
|
||||
.and()
|
||||
//授权的请求
|
||||
.authorizeRequests()
|
||||
.anyRequest().authenticated()
|
||||
//关闭跨站请求防护
|
||||
.and()
|
||||
.csrf().disable();
|
||||
}
|
||||
|
||||
public TokenStore jdbcTokenStore(){
|
||||
TokenStore tokenStore = new JdbcTokenStore(dataSource);
|
||||
return tokenStore;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
package com.fastbee.iot.oauth;
|
||||
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.oauth2.common.util.OAuth2Utils;
|
||||
import org.springframework.security.oauth2.provider.AuthorizationRequest;
|
||||
import org.springframework.security.oauth2.provider.OAuth2RequestFactory;
|
||||
import org.springframework.security.oauth2.provider.approval.Approval;
|
||||
import org.springframework.security.oauth2.provider.approval.ApprovalStore;
|
||||
import org.springframework.security.oauth2.provider.approval.ApprovalStoreUserApprovalHandler;
|
||||
import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* kerwincui
|
||||
*/
|
||||
public class SpeakerApprovalHandler extends ApprovalStoreUserApprovalHandler {
|
||||
|
||||
private int approvalExpirySeconds = -1;
|
||||
|
||||
@Autowired
|
||||
private ApprovalStore approvalStore;
|
||||
|
||||
public SpeakerApprovalHandler(JdbcClientDetailsService clientDetailsService, ApprovalStore approvalStore, OAuth2RequestFactory oAuth2RequestFactory) {
|
||||
this.setApprovalStore(approvalStore);
|
||||
this.setClientDetailsService(clientDetailsService);
|
||||
this.setRequestFactory(oAuth2RequestFactory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthorizationRequest updateAfterApproval(AuthorizationRequest authorizationRequest, Authentication userAuthentication) {
|
||||
// 获取授权过的范围
|
||||
Set<String> requestedScopes = authorizationRequest.getScope();
|
||||
Set<String> approvedScopes = new HashSet<String>();
|
||||
Set<Approval> approvals = new HashSet<Approval>();
|
||||
Date expiry = computeExpiry();
|
||||
|
||||
// 存储授权或拒绝的范围
|
||||
Map<String, String> approvalParameters = authorizationRequest.getApprovalParameters();
|
||||
for (String requestedScope : requestedScopes) {
|
||||
String approvalParameter = OAuth2Utils.SCOPE_PREFIX + requestedScope;
|
||||
String value = approvalParameters.get(approvalParameter);
|
||||
value = value == null ? "" : value.toLowerCase();
|
||||
if ("true".equals(value) || value.startsWith("approve")||value.equals("on")) {
|
||||
approvedScopes.add(requestedScope);
|
||||
approvals.add(new Approval(userAuthentication.getName(), authorizationRequest.getClientId(),
|
||||
requestedScope, expiry, Approval.ApprovalStatus.APPROVED));
|
||||
}
|
||||
else {
|
||||
approvals.add(new Approval(userAuthentication.getName(), authorizationRequest.getClientId(),
|
||||
requestedScope, expiry, Approval.ApprovalStatus.DENIED));
|
||||
}
|
||||
}
|
||||
approvalStore.addApprovals(approvals);
|
||||
|
||||
boolean approved;
|
||||
authorizationRequest.setScope(approvedScopes);
|
||||
if (approvedScopes.isEmpty() && !requestedScopes.isEmpty()) {
|
||||
approved = false;
|
||||
}
|
||||
else {
|
||||
approved = true;
|
||||
}
|
||||
authorizationRequest.setApproved(approved);
|
||||
return authorizationRequest;
|
||||
}
|
||||
|
||||
private Date computeExpiry() {
|
||||
Calendar expiresAt = Calendar.getInstance();
|
||||
// 默认一个月
|
||||
if (approvalExpirySeconds == -1) {
|
||||
expiresAt.add(Calendar.MONTH, 1);
|
||||
}
|
||||
else {
|
||||
expiresAt.add(Calendar.SECOND, approvalExpirySeconds);
|
||||
}
|
||||
return expiresAt.getTime();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
package com.fastbee.iot.oauth.api;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.oauth2.common.util.OAuth2Utils;
|
||||
import org.springframework.security.oauth2.provider.AuthorizationRequest;
|
||||
import org.springframework.security.oauth2.provider.ClientDetails;
|
||||
import org.springframework.security.oauth2.provider.approval.Approval;
|
||||
import org.springframework.security.oauth2.provider.approval.ApprovalStore;
|
||||
import org.springframework.security.oauth2.provider.client.JdbcClientDetailsService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.SessionAttributes;
|
||||
|
||||
import java.security.Principal;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* kerwincui
|
||||
*/
|
||||
@Controller
|
||||
@SessionAttributes("authorizationRequest")
|
||||
public class ConfirmAccessController {
|
||||
@Autowired
|
||||
private JdbcClientDetailsService clientDetailsService;
|
||||
@Autowired
|
||||
private ApprovalStore approvalStore;
|
||||
|
||||
@RequestMapping("/oauth/confirm_access")
|
||||
public String getAccessConfirmation(Map<String, Object> model, Principal principal ) {
|
||||
AuthorizationRequest clientAuth = (AuthorizationRequest) model.remove("authorizationRequest");
|
||||
ClientDetails client = clientDetailsService.loadClientByClientId(clientAuth.getClientId());
|
||||
|
||||
Map<String, String> scopes = new LinkedHashMap<String, String>();
|
||||
for (String scope : clientAuth.getScope()) {
|
||||
scopes.put(OAuth2Utils.SCOPE_PREFIX + scope, "false");
|
||||
}
|
||||
for (Approval approval : approvalStore.getApprovals(principal.getName(), client.getClientId())) {
|
||||
if (clientAuth.getScope().contains(approval.getScope())) {
|
||||
scopes.put(OAuth2Utils.SCOPE_PREFIX + approval.getScope(),
|
||||
approval.getStatus() == Approval.ApprovalStatus.APPROVED ? "true" : "false");
|
||||
}
|
||||
}
|
||||
model.put("auth_request", clientAuth);
|
||||
model.put("client", client);
|
||||
model.put("scopes", scopes);
|
||||
return "oauth/access_confirmation";
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.fastbee.iot.oauth.api;
|
||||
|
||||
import com.fastbee.common.core.domain.AjaxResult;
|
||||
import com.fastbee.common.core.domain.model.LoginBody;
|
||||
import com.fastbee.common.utils.SecurityUtils;
|
||||
import com.fastbee.framework.web.service.SysLoginService;
|
||||
import com.fastbee.framework.web.service.TokenService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.oauth2.common.OAuth2AccessToken;
|
||||
import org.springframework.security.oauth2.provider.token.TokenStore;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
public class LoginController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private TokenStore tokenStore;
|
||||
|
||||
@Autowired
|
||||
private SysLoginService loginService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@RequestMapping("/oauth/login")
|
||||
public String login() {
|
||||
return "oauth/login";
|
||||
}
|
||||
|
||||
@RequestMapping("/oauth/index")
|
||||
public String index() {
|
||||
return "oauth/index";
|
||||
}
|
||||
|
||||
@GetMapping("/oauth/logout")
|
||||
@ResponseBody
|
||||
public String logout(@RequestHeader String Authorization) {
|
||||
if (!Authorization.isEmpty()){
|
||||
String token=Authorization.split(" ")[1];
|
||||
OAuth2AccessToken auth2AccessToken = tokenStore.readAccessToken(token);
|
||||
tokenStore.removeAccessToken(auth2AccessToken);
|
||||
return "SUCCESS";
|
||||
}else{
|
||||
return "FAIL";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.fastbee.iot.oauth.api;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* kerwincui
|
||||
*/
|
||||
@RestController
|
||||
public class SpeakerController {
|
||||
@GetMapping("/oauth/speaker/get")
|
||||
public JSONObject getSpeaker() {
|
||||
// Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
JSONObject Json = new JSONObject();
|
||||
Json.put("1", "1");
|
||||
Json.put("2", "2");
|
||||
Json.put("3", "3");
|
||||
System.out.println("调用了接口get");
|
||||
return Json;
|
||||
}
|
||||
@PostMapping("/oauth/speaker/post")
|
||||
public JSONObject postSpeaker() {
|
||||
// Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
JSONObject bookJson = new JSONObject();
|
||||
bookJson.put("1", "1");
|
||||
System.out.println("调用了接口post");
|
||||
return bookJson;
|
||||
}
|
||||
}
|
||||
@@ -144,10 +144,10 @@ public class ToolServiceImpl implements IToolService
|
||||
{
|
||||
msg = "密码长度必须在5到20个字符之间";
|
||||
}
|
||||
else if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(sysUser)))
|
||||
else if (userService.checkUserNameUnique(sysUser))
|
||||
{
|
||||
msg = "保存用户'" + username + "'失败,注册账号已存在";
|
||||
}else if (UserConstants.NOT_UNIQUE.equals(checkPhoneUnique(phonenumber)))
|
||||
}else if (checkPhoneUnique(phonenumber))
|
||||
{
|
||||
msg = "保存用户'" + username + "'失败,注册手机号码已存在";
|
||||
}
|
||||
@@ -203,10 +203,10 @@ public class ToolServiceImpl implements IToolService
|
||||
{
|
||||
msg = "密码长度必须在5到20个字符之间";
|
||||
}
|
||||
else if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(sysUser)))
|
||||
else if (userService.checkUserNameUnique(sysUser))
|
||||
{
|
||||
msg = "保存用户'" + username + "'失败,注册账号已存在";
|
||||
}else if (UserConstants.NOT_UNIQUE.equals(checkPhoneUnique(phonenumber)))
|
||||
}else if (checkPhoneUnique(phonenumber))
|
||||
{
|
||||
msg = "保存用户'" + username + "'失败,注册手机号码已存在";
|
||||
}
|
||||
@@ -252,7 +252,7 @@ public class ToolServiceImpl implements IToolService
|
||||
* @param phonenumber 手机号码
|
||||
* @return
|
||||
*/
|
||||
public String checkPhoneUnique(String phonenumber)
|
||||
public boolean checkPhoneUnique(String phonenumber)
|
||||
{
|
||||
SysUser info = userMapper.checkPhoneUnique(phonenumber);
|
||||
if (StringUtils.isNotNull(info))
|
||||
|
||||
@@ -16,7 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="deviceId" column="device_id" />
|
||||
<result property="deviceName" column="device_name" />
|
||||
<result property="serialNumber" column="serial_number" />
|
||||
<result property="identity" column="identity" />
|
||||
<result property="identity" column="identify" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="isMonitor" column="is_monitor" />
|
||||
<result property="mode" column="mode" />
|
||||
@@ -31,18 +31,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<resultMap type="com.fastbee.iot.model.HistoryModel" id="HistoryResult">
|
||||
<result property="value" column="log_value" />
|
||||
<result property="time" column="create_time" />
|
||||
<result property="identity" column="identity" />
|
||||
<result property="identity" column="identify" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeviceLogVo">
|
||||
select log_id, log_type, log_value, device_id, device_name,serial_number, identity, create_by, is_monitor,mode, user_id, user_name, tenant_id, tenant_name, create_time, remark from iot_device_log
|
||||
select log_id, log_type, log_value, device_id, device_name,serial_number, identify, create_by, is_monitor,mode, user_id, user_name, tenant_id, tenant_name, create_time, remark from iot_device_log
|
||||
</sql>
|
||||
|
||||
<select id="selectMonitorList" parameterType="com.fastbee.iot.domain.DeviceLog" resultMap="MonitorResult">
|
||||
select log_value, create_time from iot_device_log
|
||||
<where>
|
||||
<if test="1==1"> and is_monitor=1</if>
|
||||
<if test="identity != null and identity != ''"> and identity = #{identity}</if>
|
||||
<if test="identity != null and identity != ''"> and identify = #{identity}</if>
|
||||
<if test="deviceId != null and deviceId !=0"> and device_id = #{deviceId}</if>
|
||||
<if test="serialNumber != null and serialNumber !=''"> and serial_number = #{serialNumber}</if>
|
||||
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''"> and create_time between #{beginTime} and #{endTime}</if>
|
||||
@@ -91,12 +91,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="tenantId != null and tenantId != 0"> and tenant_id = #{tenantId}</if>
|
||||
</where>
|
||||
) as monitorCount
|
||||
limit 1
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="saveBatch" parameterType="com.fastbee.iot.domain.DeviceLog">
|
||||
insert into iot_device_log (log_type,log_value,device_id,device_name,serial_number,identity,create_by,
|
||||
insert into iot_device_log (log_type,log_value,device_id,device_name,serial_number,identify,create_by,
|
||||
is_monitor,mode,create_time,remark,user_id,user_name,tenant_id,tenant_name,model_name)
|
||||
values
|
||||
<foreach collection="list" item="item" index="index" separator=",">
|
||||
@@ -114,7 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="deviceId != null">device_id = #{deviceId},</if>
|
||||
<if test="deviceName != null and deviceName != ''">device_name = #{deviceName},</if>
|
||||
<if test="serialNumber != null and serialNumber != ''">serial_number = #{serialNumber},</if>
|
||||
<if test="identity != null">identity = #{identity},</if>
|
||||
<if test="identity != null">identify = #{identity},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="isMonitor != null">is_monitor = #{isMonitor},</if>
|
||||
<if test="mode != null">mode = #{mode},</if>
|
||||
|
||||
@@ -297,7 +297,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectDeviceProductAlertCount" parameterType="com.fastbee.iot.domain.Device" resultType="com.fastbee.iot.model.DeviceStatistic">
|
||||
select
|
||||
<!--设备数量-->
|
||||
(select count(distinct d.device_id,d.user_id)
|
||||
(select count(distinct concat(d.device_id, '|', d.tenant_id))
|
||||
from iot_device d
|
||||
inner join iot_device_user u on u.device_id = d.device_id
|
||||
<where>
|
||||
@@ -307,7 +307,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
) as deviceCount,
|
||||
|
||||
<!--在线设备数量-->
|
||||
(select count(distinct d.device_id,d.user_id)
|
||||
(select count(distinct concat(d.device_id, '|', d.tenant_id))
|
||||
from iot_device d
|
||||
inner join iot_device_user u on u.device_id = d.device_id
|
||||
<where>
|
||||
@@ -320,7 +320,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
(
|
||||
<!--普通用户查询设备中的产品数量-->
|
||||
<if test="userId != null and userId != 0">
|
||||
select count(distinct product_id)
|
||||
select count(product_id)
|
||||
from iot_device
|
||||
where user_id = #{userId}
|
||||
</if>
|
||||
|
||||
@@ -6,7 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<resultMap type="com.fastbee.iot.domain.EventLog" id="EventLogResult">
|
||||
<result property="logId" column="log_id" />
|
||||
<result property="identity" column="identity" />
|
||||
<result property="identity" column="identify" />
|
||||
<result property="modelName" column="model_name" />
|
||||
<result property="logType" column="log_type" />
|
||||
<result property="logValue" column="log_value" />
|
||||
@@ -25,13 +25,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEventLogVo">
|
||||
select log_id, identity, model_name, log_type, log_value, device_id, device_name, serial_number, is_monitor, mode, user_id, user_name, tenant_id, tenant_name, create_by, create_time, remark from iot_event_log
|
||||
select log_id, identify, model_name, log_type, log_value, device_id, device_name, serial_number, is_monitor, mode, user_id, user_name, tenant_id, tenant_name, create_by, create_time, remark from iot_event_log
|
||||
</sql>
|
||||
|
||||
<select id="selectEventLogList" parameterType="com.fastbee.iot.domain.EventLog" resultMap="EventLogResult">
|
||||
<include refid="selectEventLogVo"/>
|
||||
<where>
|
||||
<if test="identity != null and identity != ''"> and identity = #{identity}</if>
|
||||
<if test="identity != null and identity != ''"> and identify = #{identity}</if>
|
||||
<if test="modelName != null and modelName != ''"> and model_name like concat('%', #{modelName}, '%')</if>
|
||||
<if test="logType != null "> and log_type = #{logType}</if>
|
||||
<if test="logValue != null and logValue != ''"> and log_value = #{logValue}</if>
|
||||
@@ -62,7 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<insert id="insertEventLog" parameterType="com.fastbee.iot.domain.EventLog" useGeneratedKeys="true" keyProperty="logId">
|
||||
insert into iot_event_log
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="identity != null and identity != ''">identity,</if>
|
||||
<if test="identity != null and identity != ''">identify,</if>
|
||||
<if test="modelName != null">model_name,</if>
|
||||
<if test="logType != null">log_type,</if>
|
||||
<if test="logValue != null and logValue != ''">log_value,</if>
|
||||
@@ -100,7 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" parameterType="com.fastbee.iot.domain.EventLog">
|
||||
insert into iot_event_log (identity,model_name,log_type,log_value,device_id,device_name,serial_number,is_monitor,mode,user_id,
|
||||
insert into iot_event_log (identify,model_name,log_type,log_value,device_id,device_name,serial_number,is_monitor,mode,user_id,
|
||||
user_name,tenant_id,tenant_name,create_by,create_time,remark)
|
||||
values
|
||||
<foreach collection="list" separator="," index="index" item="item">
|
||||
@@ -112,7 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<update id="updateEventLog" parameterType="com.fastbee.iot.domain.EventLog">
|
||||
update iot_event_log
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="identity != null and identity != ''">identity = #{identity},</if>
|
||||
<if test="identity != null and identity != ''">identify = #{identity},</if>
|
||||
<if test="modelName != null">model_name = #{modelName},</if>
|
||||
<if test="logType != null">log_type = #{logType},</if>
|
||||
<if test="logValue != null and logValue != ''">log_value = #{logValue},</if>
|
||||
|
||||
@@ -23,6 +23,17 @@
|
||||
<artifactId>fastbee-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring</artifactId>
|
||||
<version>${dynamic-datasource.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.fastbee.system.convert;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fastbee.system.domain.SysClient;
|
||||
import com.fastbee.system.domain.vo.SysClientVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统授权Convert转换类
|
||||
*
|
||||
* @author zhuangpeng.li
|
||||
* @date 2024-12-12
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysClientConvert
|
||||
{
|
||||
/** 代码生成区域 可直接覆盖**/
|
||||
SysClientConvert INSTANCE = Mappers.getMapper(SysClientConvert.class);
|
||||
|
||||
/**
|
||||
* 实体类转换为VO类
|
||||
*
|
||||
* @param sysClient
|
||||
* @return 系统授权集合
|
||||
*/
|
||||
SysClientVO convertSysClientVO(SysClient sysClient);
|
||||
|
||||
/**
|
||||
* VO类转换为实体类集合
|
||||
*
|
||||
* @param sysClientVO
|
||||
* @return 系统授权集合
|
||||
*/
|
||||
SysClient convertSysClient(SysClientVO sysClientVO);
|
||||
|
||||
/**
|
||||
* 实体类转换为VO类集合
|
||||
*
|
||||
* @param sysClientList
|
||||
* @return 系统授权集合
|
||||
*/
|
||||
List<SysClientVO> convertSysClientVOList(List<SysClient> sysClientList);
|
||||
|
||||
/**
|
||||
* VO类转换为实体类
|
||||
*
|
||||
* @param sysClientVOList
|
||||
* @return 系统授权集合
|
||||
*/
|
||||
List<SysClient> convertSysClientList(List<SysClientVO> sysClientVOList);
|
||||
|
||||
/**
|
||||
* 实体类转换为VO类分页
|
||||
*
|
||||
* @param sysClientPage
|
||||
* @return 系统授权分页
|
||||
*/
|
||||
Page<SysClientVO> convertSysClientVOPage(Page<SysClient> sysClientPage);
|
||||
|
||||
/**
|
||||
* VO类转换为实体类
|
||||
*
|
||||
* @param sysClientVOPage
|
||||
* @return 系统授权分页
|
||||
*/
|
||||
Page<SysClient> convertSysClientPage(Page<SysClientVO> sysClientVOPage);
|
||||
/** 代码生成区域 可直接覆盖END**/
|
||||
|
||||
/** 自定义代码区域 **/
|
||||
|
||||
|
||||
/** 自定义代码区域 END**/
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.fastbee.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fastbee.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 系统授权对象 sys_client
|
||||
*
|
||||
* @author zhuangpeng.li
|
||||
* @date 2024-12-12
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "SysClient", description = "系统授权 sys_client")
|
||||
@Data
|
||||
@TableName("sys_client" )
|
||||
public class SysClient extends BaseEntity {
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/** id唯一标识 */
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModelProperty("id唯一标识")
|
||||
private Long id;
|
||||
|
||||
/** 客户端key */
|
||||
@ApiModelProperty("客户端key")
|
||||
private String clientKey;
|
||||
|
||||
/** 客户端秘钥 */
|
||||
@ApiModelProperty("客户端秘钥")
|
||||
private String clientSecret;
|
||||
|
||||
/** 客户端token */
|
||||
@ApiModelProperty("客户端token")
|
||||
private String token;
|
||||
|
||||
/** 授权类型 */
|
||||
@ApiModelProperty("授权类型")
|
||||
private String grantType;
|
||||
|
||||
/** 设备类型 */
|
||||
@ApiModelProperty("设备类型")
|
||||
private String deviceType;
|
||||
|
||||
/** token固定超时 */
|
||||
@ApiModelProperty("token固定超时")
|
||||
private Long timeout;
|
||||
|
||||
/** 是否生效(0-不生效,1-生效) */
|
||||
@ApiModelProperty("是否生效")
|
||||
private String enable;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
@ApiModelProperty("删除标志")
|
||||
@TableLogic
|
||||
private String delFlag;
|
||||
|
||||
}
|
||||
@@ -1,19 +1,18 @@
|
||||
package com.fastbee.system.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fastbee.common.annotation.Excel;
|
||||
import com.fastbee.common.annotation.Excel.ColumnType;
|
||||
import com.fastbee.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 操作日志记录表 oper_log
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@ApiModel(value = "SysOperLog", description = "操作日志记录表 oper_log")
|
||||
public class SysOperLog extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -103,6 +102,10 @@ public class SysOperLog extends BaseEntity
|
||||
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date operTime;
|
||||
|
||||
/** 消耗时间 */
|
||||
@Excel(name = "消耗时间", suffix = "毫秒")
|
||||
private Long costTime;
|
||||
|
||||
public Long getOperId()
|
||||
{
|
||||
return operId;
|
||||
@@ -272,4 +275,14 @@ public class SysOperLog extends BaseEntity
|
||||
{
|
||||
this.operTime = operTime;
|
||||
}
|
||||
|
||||
public Long getCostTime()
|
||||
{
|
||||
return costTime;
|
||||
}
|
||||
|
||||
public void setCostTime(Long costTime)
|
||||
{
|
||||
this.costTime = costTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.fastbee.system.domain.vo;
|
||||
|
||||
import com.fastbee.common.annotation.Excel;
|
||||
import com.fastbee.common.core.domain.PageEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* 系统授权对象 sys_client
|
||||
*
|
||||
* @author zhuangpeng.li
|
||||
* @date 2024-12-12
|
||||
*/
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "SysClientVO", description = "系统授权 sys_client")
|
||||
@Data
|
||||
public class SysClientVO extends PageEntity {
|
||||
/** 代码生成区域 可直接覆盖**/
|
||||
/** id唯一标识 */
|
||||
@Excel(name = "id唯一标识")
|
||||
@ApiModelProperty("id唯一标识")
|
||||
private Long id;
|
||||
|
||||
/** 客户端key */
|
||||
@Excel(name = "客户端key")
|
||||
@ApiModelProperty("客户端key")
|
||||
private String clientKey;
|
||||
|
||||
/** 客户端秘钥 */
|
||||
@Excel(name = "客户端秘钥")
|
||||
@ApiModelProperty("客户端秘钥")
|
||||
private String clientSecret;
|
||||
|
||||
/** 客户端token */
|
||||
@Excel(name = "客户端token")
|
||||
@ApiModelProperty("客户端token")
|
||||
private String token;
|
||||
|
||||
/** 授权类型 */
|
||||
@Excel(name = "授权类型")
|
||||
@ApiModelProperty("授权类型")
|
||||
private String grantType;
|
||||
|
||||
/** 设备类型 */
|
||||
@Excel(name = "设备类型")
|
||||
@ApiModelProperty("设备类型")
|
||||
private String deviceType;
|
||||
|
||||
/** token固定超时 */
|
||||
@Excel(name = "token固定超时")
|
||||
@ApiModelProperty("token固定超时")
|
||||
private Long timeout;
|
||||
|
||||
/** 是否生效(0-不生效,1-生效) */
|
||||
@ApiModelProperty("是否生效")
|
||||
@Excel(name = "是否生效")
|
||||
private String enable;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
@ApiModelProperty("删除标志")
|
||||
@Excel(name = "删除标志")
|
||||
private String delFlag;
|
||||
|
||||
/** 创建者 */
|
||||
@Excel(name = "创建者")
|
||||
@ApiModelProperty("创建者")
|
||||
private String createBy;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("创建时间")
|
||||
@Excel(name = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/** 更新者 */
|
||||
@Excel(name = "更新者")
|
||||
@ApiModelProperty("更新者")
|
||||
private String updateBy;
|
||||
|
||||
/** 更新时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("更新时间")
|
||||
@Excel(name = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/** 备注 */
|
||||
@Excel(name = "备注")
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
/** 代码生成区域 可直接覆盖END**/
|
||||
|
||||
/** 自定义代码区域 **/
|
||||
|
||||
|
||||
/** 自定义代码区域 END**/
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.fastbee.system.handle;
|
||||
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.sql.*;
|
||||
|
||||
import static cn.hutool.core.io.file.FileWrapper.DEFAULT_CHARSET;
|
||||
|
||||
|
||||
public class BlobToStringHandler extends BaseTypeHandler<String> {
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement preparedStatement, int i, String parameter, JdbcType jdbcType) throws SQLException {
|
||||
ByteArrayInputStream inputStream;
|
||||
byte[] bytes;
|
||||
bytes = parameter.getBytes(DEFAULT_CHARSET);
|
||||
// 把String转化成byte流
|
||||
inputStream = new ByteArrayInputStream(bytes);
|
||||
preparedStatement.setBinaryStream(i, inputStream, bytes.length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNullableResult(ResultSet resultSet, String columnName) throws SQLException {
|
||||
Blob blob = resultSet.getBlob(columnName);
|
||||
return getBlobToString(blob);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNullableResult(ResultSet resultSet, int columnIndex) throws SQLException {
|
||||
Blob blob = resultSet.getBlob(columnIndex);
|
||||
return getBlobToString(blob);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNullableResult(CallableStatement callableStatement, int columnIndex) throws SQLException {
|
||||
Blob blob = callableStatement.getBlob(columnIndex);
|
||||
return getBlobToString(blob);
|
||||
}
|
||||
|
||||
private String getBlobToString(Blob blob) throws SQLException {
|
||||
byte[] returnValue = null;
|
||||
String result = null;
|
||||
if (null != blob) {
|
||||
returnValue = blob.getBytes(1, (int) blob.length());
|
||||
}
|
||||
if (null != returnValue) {
|
||||
// 把byte转化成string
|
||||
result = new String(returnValue, DEFAULT_CHARSET);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.fastbee.system.mapper;
|
||||
|
||||
|
||||
import com.fastbee.common.mybatis.mapper.BaseMapperX;
|
||||
import com.fastbee.system.domain.SysClient;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统授权Mapper接口
|
||||
*
|
||||
* @author zhuangpeng.li
|
||||
* @date 2024-07-26
|
||||
*/
|
||||
public interface SysClientMapper extends BaseMapperX<SysClient>
|
||||
{
|
||||
/**
|
||||
* 查询系统授权
|
||||
*
|
||||
* @param id 系统授权主键
|
||||
* @return 系统授权
|
||||
*/
|
||||
public SysClient selectSysClientById(Long id);
|
||||
|
||||
/**
|
||||
* 查询系统授权列表
|
||||
*
|
||||
* @param sysClient 系统授权
|
||||
* @return 系统授权集合
|
||||
*/
|
||||
public List<SysClient> selectSysClientList(SysClient sysClient);
|
||||
|
||||
/**
|
||||
* 新增系统授权
|
||||
*
|
||||
* @param sysClient 系统授权
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysClient(SysClient sysClient);
|
||||
|
||||
/**
|
||||
* 修改系统授权
|
||||
*
|
||||
* @param sysClient 系统授权
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysClient(SysClient sysClient);
|
||||
|
||||
}
|
||||
@@ -5,21 +5,21 @@ import com.fastbee.system.domain.SysOperLog;
|
||||
|
||||
/**
|
||||
* 操作日志 数据层
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface SysOperLogMapper
|
||||
{
|
||||
/**
|
||||
* 新增操作日志
|
||||
*
|
||||
*
|
||||
* @param operLog 操作日志对象
|
||||
*/
|
||||
public void insertOperlog(SysOperLog operLog);
|
||||
|
||||
/**
|
||||
* 查询系统操作日志集合
|
||||
*
|
||||
*
|
||||
* @param operLog 操作日志对象
|
||||
* @return 操作日志集合
|
||||
*/
|
||||
@@ -27,7 +27,7 @@ public interface SysOperLogMapper
|
||||
|
||||
/**
|
||||
* 批量删除系统操作日志
|
||||
*
|
||||
*
|
||||
* @param operIds 需要删除的操作日志ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -35,7 +35,7 @@ public interface SysOperLogMapper
|
||||
|
||||
/**
|
||||
* 查询操作日志详细
|
||||
*
|
||||
*
|
||||
* @param operId 操作ID
|
||||
* @return 操作日志对象
|
||||
*/
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
package com.fastbee.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.common.core.domain.entity.SysRole;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色表 数据层
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface SysRoleMapper
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询角色数据
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 角色数据集合信息
|
||||
*/
|
||||
@@ -20,7 +21,7 @@ public interface SysRoleMapper
|
||||
|
||||
/**
|
||||
* 根据用户ID查询角色
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 角色列表
|
||||
*/
|
||||
@@ -28,14 +29,14 @@ public interface SysRoleMapper
|
||||
|
||||
/**
|
||||
* 查询所有角色
|
||||
*
|
||||
*
|
||||
* @return 角色列表
|
||||
*/
|
||||
public List<SysRole> selectRoleAll();
|
||||
|
||||
/**
|
||||
* 根据用户ID获取角色选择框列表
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 选中角色ID列表
|
||||
*/
|
||||
@@ -43,7 +44,7 @@ public interface SysRoleMapper
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
@@ -51,7 +52,7 @@ public interface SysRoleMapper
|
||||
|
||||
/**
|
||||
* 根据用户ID查询角色
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 角色列表
|
||||
*/
|
||||
@@ -59,7 +60,7 @@ public interface SysRoleMapper
|
||||
|
||||
/**
|
||||
* 校验角色名称是否唯一
|
||||
*
|
||||
*
|
||||
* @param roleName 角色名称
|
||||
* @return 角色信息
|
||||
*/
|
||||
@@ -67,7 +68,7 @@ public interface SysRoleMapper
|
||||
|
||||
/**
|
||||
* 校验角色权限是否唯一
|
||||
*
|
||||
*
|
||||
* @param roleKey 角色权限
|
||||
* @return 角色信息
|
||||
*/
|
||||
@@ -75,7 +76,7 @@ public interface SysRoleMapper
|
||||
|
||||
/**
|
||||
* 修改角色信息
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -83,7 +84,7 @@ public interface SysRoleMapper
|
||||
|
||||
/**
|
||||
* 新增角色信息
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -91,7 +92,7 @@ public interface SysRoleMapper
|
||||
|
||||
/**
|
||||
* 通过角色ID删除角色
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -99,7 +100,7 @@ public interface SysRoleMapper
|
||||
|
||||
/**
|
||||
* 批量删除角色信息
|
||||
*
|
||||
*
|
||||
* @param roleIds 需要删除的角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.fastbee.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fastbee.system.domain.SysClient;
|
||||
import com.fastbee.system.domain.vo.SysClientVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 系统授权Service接口
|
||||
*
|
||||
* @author zhuangpeng.li
|
||||
* @date 2024-07-26
|
||||
*/
|
||||
public interface ISysClientService extends IService<SysClient>
|
||||
{
|
||||
/**
|
||||
* 查询系统授权
|
||||
*
|
||||
* @param id 系统授权主键
|
||||
* @return 系统授权
|
||||
*/
|
||||
public SysClient selectSysClientById(Long id);
|
||||
|
||||
/**
|
||||
* 查询系统授权列表
|
||||
*
|
||||
* @param sysClient 系统授权
|
||||
* @return 系统授权集合
|
||||
*/
|
||||
public List<SysClientVO> selectSysClientList(SysClient sysClient);
|
||||
|
||||
/**
|
||||
* 查询系统授权列表
|
||||
*
|
||||
* @param sysClient 系统授权
|
||||
* @return 系统授权分页集合
|
||||
*/
|
||||
Page<SysClientVO> pageSysClientVO(SysClient sysClient);
|
||||
|
||||
/**
|
||||
* 新增系统授权
|
||||
*
|
||||
* @param sysClient 系统授权
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysClient(SysClient sysClient);
|
||||
|
||||
/**
|
||||
* 修改系统授权
|
||||
*
|
||||
* @param sysClient 系统授权
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysClient(SysClient sysClient);
|
||||
|
||||
/**
|
||||
* 批量删除系统授权
|
||||
*
|
||||
* @param ids 需要删除的系统授权主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysClientByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除系统授权信息
|
||||
*
|
||||
* @param id 系统授权主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysClientById(Long id);
|
||||
}
|
||||
@@ -1,18 +1,19 @@
|
||||
package com.fastbee.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.system.domain.SysConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 参数配置 服务层
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ISysConfigService
|
||||
{
|
||||
/**
|
||||
* 查询参数配置信息
|
||||
*
|
||||
*
|
||||
* @param configId 参数配置ID
|
||||
* @return 参数配置信息
|
||||
*/
|
||||
@@ -20,7 +21,7 @@ public interface ISysConfigService
|
||||
|
||||
/**
|
||||
* 根据键名查询参数配置信息
|
||||
*
|
||||
*
|
||||
* @param configKey 参数键名
|
||||
* @return 参数键值
|
||||
*/
|
||||
@@ -28,14 +29,14 @@ public interface ISysConfigService
|
||||
|
||||
/**
|
||||
* 获取验证码开关
|
||||
*
|
||||
*
|
||||
* @return true开启,false关闭
|
||||
*/
|
||||
public boolean selectCaptchaEnabled();
|
||||
|
||||
/**
|
||||
* 查询参数配置列表
|
||||
*
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 参数配置集合
|
||||
*/
|
||||
@@ -43,7 +44,7 @@ public interface ISysConfigService
|
||||
|
||||
/**
|
||||
* 新增参数配置
|
||||
*
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -51,7 +52,7 @@ public interface ISysConfigService
|
||||
|
||||
/**
|
||||
* 修改参数配置
|
||||
*
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -59,7 +60,7 @@ public interface ISysConfigService
|
||||
|
||||
/**
|
||||
* 批量删除参数信息
|
||||
*
|
||||
*
|
||||
* @param configIds 需要删除的参数ID
|
||||
*/
|
||||
public void deleteConfigByIds(Long[] configIds);
|
||||
@@ -81,9 +82,9 @@ public interface ISysConfigService
|
||||
|
||||
/**
|
||||
* 校验参数键名是否唯一
|
||||
*
|
||||
*
|
||||
* @param config 参数信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkConfigKeyUnique(SysConfig config);
|
||||
public boolean checkConfigKeyUnique(SysConfig config);
|
||||
}
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
package com.fastbee.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.common.core.domain.TreeSelect;
|
||||
import com.fastbee.common.core.domain.entity.SysDept;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门管理 服务层
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ISysDeptService
|
||||
{
|
||||
/**
|
||||
* 查询部门管理数据
|
||||
*
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
@@ -21,7 +22,7 @@ public interface ISysDeptService
|
||||
|
||||
/**
|
||||
* 查询部门树结构信息
|
||||
*
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 部门树信息集合
|
||||
*/
|
||||
@@ -29,7 +30,7 @@ public interface ISysDeptService
|
||||
|
||||
/**
|
||||
* 构建前端所需要树结构
|
||||
*
|
||||
*
|
||||
* @param depts 部门列表
|
||||
* @return 树结构列表
|
||||
*/
|
||||
@@ -37,7 +38,7 @@ public interface ISysDeptService
|
||||
|
||||
/**
|
||||
* 构建前端所需要下拉树结构
|
||||
*
|
||||
*
|
||||
* @param depts 部门列表
|
||||
* @return 下拉树结构列表
|
||||
*/
|
||||
@@ -45,7 +46,7 @@ public interface ISysDeptService
|
||||
|
||||
/**
|
||||
* 根据角色ID查询部门树信息
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 选中部门列表
|
||||
*/
|
||||
@@ -53,7 +54,7 @@ public interface ISysDeptService
|
||||
|
||||
/**
|
||||
* 根据部门ID查询信息
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 部门信息
|
||||
*/
|
||||
@@ -61,7 +62,7 @@ public interface ISysDeptService
|
||||
|
||||
/**
|
||||
* 根据ID查询所有子部门(正常状态)
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 子部门数
|
||||
*/
|
||||
@@ -69,7 +70,7 @@ public interface ISysDeptService
|
||||
|
||||
/**
|
||||
* 是否存在部门子节点
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -77,7 +78,7 @@ public interface ISysDeptService
|
||||
|
||||
/**
|
||||
* 查询部门是否存在用户
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果 true 存在 false 不存在
|
||||
*/
|
||||
@@ -85,22 +86,22 @@ public interface ISysDeptService
|
||||
|
||||
/**
|
||||
* 校验部门名称是否唯一
|
||||
*
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkDeptNameUnique(SysDept dept);
|
||||
public boolean checkDeptNameUnique(SysDept dept);
|
||||
|
||||
/**
|
||||
* 校验部门是否有数据权限
|
||||
*
|
||||
*
|
||||
* @param deptId 部门id
|
||||
*/
|
||||
public void checkDeptDataScope(Long deptId);
|
||||
|
||||
/**
|
||||
* 新增保存部门信息
|
||||
*
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -108,7 +109,7 @@ public interface ISysDeptService
|
||||
|
||||
/**
|
||||
* 修改保存部门信息
|
||||
*
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -116,7 +117,7 @@ public interface ISysDeptService
|
||||
|
||||
/**
|
||||
* 删除部门管理信息
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
package com.fastbee.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.common.core.domain.entity.SysDictData;
|
||||
import com.fastbee.common.core.domain.entity.SysDictType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典 业务层
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ISysDictTypeService
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询字典类型
|
||||
*
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 字典类型集合信息
|
||||
*/
|
||||
@@ -21,14 +22,14 @@ public interface ISysDictTypeService
|
||||
|
||||
/**
|
||||
* 根据所有字典类型
|
||||
*
|
||||
*
|
||||
* @return 字典类型集合信息
|
||||
*/
|
||||
public List<SysDictType> selectDictTypeAll();
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据
|
||||
*
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 字典数据集合信息
|
||||
*/
|
||||
@@ -36,7 +37,7 @@ public interface ISysDictTypeService
|
||||
|
||||
/**
|
||||
* 根据字典类型ID查询信息
|
||||
*
|
||||
*
|
||||
* @param dictId 字典类型ID
|
||||
* @return 字典类型
|
||||
*/
|
||||
@@ -44,7 +45,7 @@ public interface ISysDictTypeService
|
||||
|
||||
/**
|
||||
* 根据字典类型查询信息
|
||||
*
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 字典类型
|
||||
*/
|
||||
@@ -52,7 +53,7 @@ public interface ISysDictTypeService
|
||||
|
||||
/**
|
||||
* 批量删除字典信息
|
||||
*
|
||||
*
|
||||
* @param dictIds 需要删除的字典ID
|
||||
*/
|
||||
public void deleteDictTypeByIds(Long[] dictIds);
|
||||
@@ -74,7 +75,7 @@ public interface ISysDictTypeService
|
||||
|
||||
/**
|
||||
* 新增保存字典类型信息
|
||||
*
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -82,7 +83,7 @@ public interface ISysDictTypeService
|
||||
|
||||
/**
|
||||
* 修改保存字典类型信息
|
||||
*
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -90,9 +91,9 @@ public interface ISysDictTypeService
|
||||
|
||||
/**
|
||||
* 校验字典类型称是否唯一
|
||||
*
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkDictTypeUnique(SysDictType dictType);
|
||||
public boolean checkDictTypeUnique(SysDictType dictType);
|
||||
}
|
||||
|
||||
@@ -8,14 +8,14 @@ import com.fastbee.system.domain.vo.RouterVo;
|
||||
|
||||
/**
|
||||
* 菜单 业务层
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ISysMenuService
|
||||
{
|
||||
/**
|
||||
* 根据用户查询系统菜单列表
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 菜单列表
|
||||
*/
|
||||
@@ -23,7 +23,7 @@ public interface ISysMenuService
|
||||
|
||||
/**
|
||||
* 根据用户查询系统菜单列表
|
||||
*
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @param userId 用户ID
|
||||
* @return 菜单列表
|
||||
@@ -32,7 +32,7 @@ public interface ISysMenuService
|
||||
|
||||
/**
|
||||
* 根据用户ID查询权限
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 权限列表
|
||||
*/
|
||||
@@ -40,7 +40,7 @@ public interface ISysMenuService
|
||||
|
||||
/**
|
||||
* 根据角色ID查询权限
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 权限列表
|
||||
*/
|
||||
@@ -48,7 +48,7 @@ public interface ISysMenuService
|
||||
|
||||
/**
|
||||
* 根据用户ID查询菜单树信息
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 菜单列表
|
||||
*/
|
||||
@@ -56,7 +56,7 @@ public interface ISysMenuService
|
||||
|
||||
/**
|
||||
* 根据角色ID查询菜单树信息
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 选中菜单列表
|
||||
*/
|
||||
@@ -64,7 +64,7 @@ public interface ISysMenuService
|
||||
|
||||
/**
|
||||
* 构建前端路由所需要的菜单
|
||||
*
|
||||
*
|
||||
* @param menus 菜单列表
|
||||
* @return 路由列表
|
||||
*/
|
||||
@@ -72,7 +72,7 @@ public interface ISysMenuService
|
||||
|
||||
/**
|
||||
* 构建前端所需要树结构
|
||||
*
|
||||
*
|
||||
* @param menus 菜单列表
|
||||
* @return 树结构列表
|
||||
*/
|
||||
@@ -80,7 +80,7 @@ public interface ISysMenuService
|
||||
|
||||
/**
|
||||
* 构建前端所需要下拉树结构
|
||||
*
|
||||
*
|
||||
* @param menus 菜单列表
|
||||
* @return 下拉树结构列表
|
||||
*/
|
||||
@@ -88,7 +88,7 @@ public interface ISysMenuService
|
||||
|
||||
/**
|
||||
* 根据菜单ID查询信息
|
||||
*
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
* @return 菜单信息
|
||||
*/
|
||||
@@ -96,7 +96,7 @@ public interface ISysMenuService
|
||||
|
||||
/**
|
||||
* 是否存在菜单子节点
|
||||
*
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
* @return 结果 true 存在 false 不存在
|
||||
*/
|
||||
@@ -104,7 +104,7 @@ public interface ISysMenuService
|
||||
|
||||
/**
|
||||
* 查询菜单是否存在角色
|
||||
*
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
* @return 结果 true 存在 false 不存在
|
||||
*/
|
||||
@@ -112,7 +112,7 @@ public interface ISysMenuService
|
||||
|
||||
/**
|
||||
* 新增保存菜单信息
|
||||
*
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -120,7 +120,7 @@ public interface ISysMenuService
|
||||
|
||||
/**
|
||||
* 修改保存菜单信息
|
||||
*
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -128,7 +128,7 @@ public interface ISysMenuService
|
||||
|
||||
/**
|
||||
* 删除菜单管理信息
|
||||
*
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -136,9 +136,9 @@ public interface ISysMenuService
|
||||
|
||||
/**
|
||||
* 校验菜单名称是否唯一
|
||||
*
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkMenuNameUnique(SysMenu menu);
|
||||
public boolean checkMenuNameUnique(SysMenu menu);
|
||||
}
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
package com.fastbee.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.system.domain.SysOperLog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作日志 服务层
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ISysOperLogService
|
||||
{
|
||||
/**
|
||||
* 新增操作日志
|
||||
*
|
||||
*
|
||||
* @param operLog 操作日志对象
|
||||
*/
|
||||
public void insertOperlog(SysOperLog operLog);
|
||||
|
||||
/**
|
||||
* 查询系统操作日志集合
|
||||
*
|
||||
*
|
||||
* @param operLog 操作日志对象
|
||||
* @return 操作日志集合
|
||||
*/
|
||||
@@ -27,7 +28,7 @@ public interface ISysOperLogService
|
||||
|
||||
/**
|
||||
* 批量删除系统操作日志
|
||||
*
|
||||
*
|
||||
* @param operIds 需要删除的操作日志ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -35,7 +36,7 @@ public interface ISysOperLogService
|
||||
|
||||
/**
|
||||
* 查询操作日志详细
|
||||
*
|
||||
*
|
||||
* @param operId 操作ID
|
||||
* @return 操作日志对象
|
||||
*/
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
package com.fastbee.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.system.domain.SysPost;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 岗位信息 服务层
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ISysPostService
|
||||
{
|
||||
/**
|
||||
* 查询岗位信息集合
|
||||
*
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 岗位列表
|
||||
*/
|
||||
@@ -20,14 +21,14 @@ public interface ISysPostService
|
||||
|
||||
/**
|
||||
* 查询所有岗位
|
||||
*
|
||||
*
|
||||
* @return 岗位列表
|
||||
*/
|
||||
public List<SysPost> selectPostAll();
|
||||
|
||||
/**
|
||||
* 通过岗位ID查询岗位信息
|
||||
*
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
@@ -35,7 +36,7 @@ public interface ISysPostService
|
||||
|
||||
/**
|
||||
* 根据用户ID获取岗位选择框列表
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 选中岗位ID列表
|
||||
*/
|
||||
@@ -43,23 +44,23 @@ public interface ISysPostService
|
||||
|
||||
/**
|
||||
* 校验岗位名称
|
||||
*
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkPostNameUnique(SysPost post);
|
||||
public boolean checkPostNameUnique(SysPost post);
|
||||
|
||||
/**
|
||||
* 校验岗位编码
|
||||
*
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkPostCodeUnique(SysPost post);
|
||||
public boolean checkPostCodeUnique(SysPost post);
|
||||
|
||||
/**
|
||||
* 通过岗位ID查询岗位使用数量
|
||||
*
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -67,7 +68,7 @@ public interface ISysPostService
|
||||
|
||||
/**
|
||||
* 删除岗位信息
|
||||
*
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -75,7 +76,7 @@ public interface ISysPostService
|
||||
|
||||
/**
|
||||
* 批量删除岗位信息
|
||||
*
|
||||
*
|
||||
* @param postIds 需要删除的岗位ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -83,7 +84,7 @@ public interface ISysPostService
|
||||
|
||||
/**
|
||||
* 新增保存岗位信息
|
||||
*
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -91,7 +92,7 @@ public interface ISysPostService
|
||||
|
||||
/**
|
||||
* 修改保存岗位信息
|
||||
*
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
package com.fastbee.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import com.fastbee.common.core.domain.entity.SysRole;
|
||||
import com.fastbee.system.domain.SysUserRole;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 角色业务层
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ISysRoleService
|
||||
{
|
||||
/**
|
||||
* 根据条件分页查询角色数据
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 角色数据集合信息
|
||||
*/
|
||||
@@ -22,7 +23,7 @@ public interface ISysRoleService
|
||||
|
||||
/**
|
||||
* 根据用户ID查询角色列表
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 角色列表
|
||||
*/
|
||||
@@ -30,7 +31,7 @@ public interface ISysRoleService
|
||||
|
||||
/**
|
||||
* 根据用户ID查询角色权限
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 权限列表
|
||||
*/
|
||||
@@ -38,14 +39,14 @@ public interface ISysRoleService
|
||||
|
||||
/**
|
||||
* 查询所有角色
|
||||
*
|
||||
*
|
||||
* @return 角色列表
|
||||
*/
|
||||
public List<SysRole> selectRoleAll();
|
||||
|
||||
/**
|
||||
* 根据用户ID获取角色选择框列表
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 选中角色ID列表
|
||||
*/
|
||||
@@ -53,7 +54,7 @@ public interface ISysRoleService
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
@@ -61,37 +62,37 @@ public interface ISysRoleService
|
||||
|
||||
/**
|
||||
* 校验角色名称是否唯一
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkRoleNameUnique(SysRole role);
|
||||
public boolean checkRoleNameUnique(SysRole role);
|
||||
|
||||
/**
|
||||
* 校验角色权限是否唯一
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkRoleKeyUnique(SysRole role);
|
||||
public boolean checkRoleKeyUnique(SysRole role);
|
||||
|
||||
/**
|
||||
* 校验角色是否允许操作
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
*/
|
||||
public void checkRoleAllowed(SysRole role);
|
||||
|
||||
/**
|
||||
* 校验角色是否有数据权限
|
||||
*
|
||||
* @param roleId 角色id
|
||||
*
|
||||
* @param roleIds 角色id
|
||||
*/
|
||||
public void checkRoleDataScope(Long roleId);
|
||||
public void checkRoleDataScope(Long... roleIds);
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色使用数量
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -99,7 +100,7 @@ public interface ISysRoleService
|
||||
|
||||
/**
|
||||
* 新增保存角色信息
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -107,7 +108,7 @@ public interface ISysRoleService
|
||||
|
||||
/**
|
||||
* 修改保存角色信息
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -115,7 +116,7 @@ public interface ISysRoleService
|
||||
|
||||
/**
|
||||
* 修改角色状态
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -123,7 +124,7 @@ public interface ISysRoleService
|
||||
|
||||
/**
|
||||
* 修改数据权限信息
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -131,7 +132,7 @@ public interface ISysRoleService
|
||||
|
||||
/**
|
||||
* 通过角色ID删除角色
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -139,7 +140,7 @@ public interface ISysRoleService
|
||||
|
||||
/**
|
||||
* 批量删除角色信息
|
||||
*
|
||||
*
|
||||
* @param roleIds 需要删除的角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -147,7 +148,7 @@ public interface ISysRoleService
|
||||
|
||||
/**
|
||||
* 取消授权用户角色
|
||||
*
|
||||
*
|
||||
* @param userRole 用户和角色关联信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -155,7 +156,7 @@ public interface ISysRoleService
|
||||
|
||||
/**
|
||||
* 批量取消授权用户角色
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 需要取消授权的用户数据ID
|
||||
* @return 结果
|
||||
@@ -164,7 +165,7 @@ public interface ISysRoleService
|
||||
|
||||
/**
|
||||
* 批量选择授权用户角色
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 需要删除的用户数据ID
|
||||
* @return 结果
|
||||
|
||||
@@ -73,7 +73,7 @@ public interface ISysUserService
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkUserNameUnique(SysUser user);
|
||||
public boolean checkUserNameUnique(SysUser user);
|
||||
|
||||
/**
|
||||
* 校验手机号码是否唯一
|
||||
@@ -81,7 +81,7 @@ public interface ISysUserService
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkPhoneUnique(SysUser user);
|
||||
public boolean checkPhoneUnique(SysUser user);
|
||||
|
||||
/**
|
||||
* 校验email是否唯一
|
||||
@@ -89,7 +89,7 @@ public interface ISysUserService
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkEmailUnique(SysUser user);
|
||||
public boolean checkEmailUnique(SysUser user);
|
||||
|
||||
/**
|
||||
* 校验用户是否允许操作
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.fastbee.system.service.impl;
|
||||
|
||||
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fastbee.common.utils.DateUtils;
|
||||
import com.fastbee.common.utils.StringUtils;
|
||||
import com.fastbee.system.convert.SysClientConvert;
|
||||
import com.fastbee.system.domain.SysClient;
|
||||
import com.fastbee.system.domain.vo.SysClientVO;
|
||||
import com.fastbee.system.mapper.SysClientMapper;
|
||||
import com.fastbee.system.service.ISysClientService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 系统授权Service业务层处理
|
||||
*
|
||||
* @author zhuangpeng.li
|
||||
* @date 2024-07-26
|
||||
*/
|
||||
@Service
|
||||
public class SysClientServiceImpl extends ServiceImpl<SysClientMapper,SysClient> implements ISysClientService
|
||||
{
|
||||
@Resource
|
||||
private SysClientMapper sysClientMapper;
|
||||
|
||||
/**
|
||||
* 查询系统授权
|
||||
*
|
||||
* @param id 系统授权主键
|
||||
* @return 系统授权
|
||||
*/
|
||||
@Override
|
||||
public SysClient selectSysClientById(Long id)
|
||||
{
|
||||
return sysClientMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询系统授权列表
|
||||
*
|
||||
* @param sysClient 系统授权
|
||||
* @return 系统授权
|
||||
*/
|
||||
@Override
|
||||
public List<SysClientVO> selectSysClientList(SysClient sysClient)
|
||||
{
|
||||
LambdaQueryWrapper<SysClient> lqw = buildQueryWrapper(sysClient);
|
||||
List<SysClient> sysClientList = baseMapper.selectList(lqw);
|
||||
return SysClientConvert.INSTANCE.convertSysClientVOList(sysClientList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询系统授权分页列表
|
||||
*
|
||||
* @param sysClient 系统授权
|
||||
* @return 系统授权
|
||||
*/
|
||||
@Override
|
||||
public Page<SysClientVO> pageSysClientVO(SysClient sysClient) {
|
||||
LambdaQueryWrapper<SysClient> lqw = buildQueryWrapper(sysClient);
|
||||
Page<SysClient> sysClientPage = baseMapper.selectPage(new Page<>(sysClient.getPageNum(), sysClient.getPageSize()), lqw);
|
||||
return SysClientConvert.INSTANCE.convertSysClientVOPage(sysClientPage);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SysClient> buildQueryWrapper(SysClient query) {
|
||||
Map<String, Object> params = query.getParams();
|
||||
LambdaQueryWrapper<SysClient> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(query.getId() != null, SysClient::getId, query.getId());
|
||||
lqw.eq(StringUtils.isNotBlank(query.getClientKey()), SysClient::getClientKey, query.getClientKey());
|
||||
lqw.eq(StringUtils.isNotBlank(query.getClientSecret()), SysClient::getClientSecret, query.getClientSecret());
|
||||
lqw.eq(StringUtils.isNotBlank(query.getToken()), SysClient::getToken, query.getToken());
|
||||
lqw.eq(StringUtils.isNotBlank(query.getGrantType()), SysClient::getGrantType, query.getGrantType());
|
||||
lqw.eq(StringUtils.isNotBlank(query.getDeviceType()), SysClient::getDeviceType, query.getDeviceType());
|
||||
lqw.eq(query.getTimeout() != null, SysClient::getTimeout, query.getTimeout());
|
||||
lqw.eq(StringUtils.isNotBlank(query.getEnable()), SysClient::getEnable, query.getEnable());
|
||||
lqw.eq(StringUtils.isNotBlank(query.getDelFlag()), SysClient::getDelFlag, query.getDelFlag());
|
||||
lqw.eq(StringUtils.isNotBlank(query.getCreateBy()), SysClient::getCreateBy, query.getCreateBy());
|
||||
lqw.eq(query.getCreateTime() != null, SysClient::getCreateTime, query.getCreateTime());
|
||||
lqw.eq(StringUtils.isNotBlank(query.getUpdateBy()), SysClient::getUpdateBy, query.getUpdateBy());
|
||||
lqw.eq(query.getUpdateTime() != null, SysClient::getUpdateTime, query.getUpdateTime());
|
||||
lqw.eq(StringUtils.isNotBlank(query.getRemark()), SysClient::getRemark, query.getRemark());
|
||||
|
||||
if (!Objects.isNull(params.get("beginTime")) &&
|
||||
!Objects.isNull(params.get("endTime"))) {
|
||||
lqw.between(SysClient::getCreateTime, params.get("beginTime"), params.get("endTime"));
|
||||
}
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增系统授权
|
||||
*
|
||||
* @param sysClient 系统授权
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysClient(SysClient sysClient)
|
||||
{
|
||||
sysClient.setCreateTime(DateUtils.getNowDate());
|
||||
return sysClientMapper.insert(sysClient);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改系统授权
|
||||
*
|
||||
* @param sysClient 系统授权
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysClient(SysClient sysClient)
|
||||
{
|
||||
sysClient.setUpdateTime(DateUtils.getNowDate());
|
||||
return sysClientMapper.updateById(sysClient);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除系统授权
|
||||
*
|
||||
* @param ids 需要删除的系统授权主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysClientByIds(Long[] ids)
|
||||
{
|
||||
return sysClientMapper.deleteBatchIds(Arrays.asList(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除系统授权信息
|
||||
*
|
||||
* @param id 系统授权主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysClientById(Long id)
|
||||
{
|
||||
return sysClientMapper.deleteById(id);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,5 @@
|
||||
package com.fastbee.system.service.impl;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import javax.annotation.PostConstruct;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fastbee.common.annotation.DataSource;
|
||||
import com.fastbee.common.constant.CacheConstants;
|
||||
import com.fastbee.common.constant.UserConstants;
|
||||
@@ -16,10 +11,16 @@ import com.fastbee.common.utils.StringUtils;
|
||||
import com.fastbee.system.domain.SysConfig;
|
||||
import com.fastbee.system.mapper.SysConfigMapper;
|
||||
import com.fastbee.system.service.ISysConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 参数配置 服务层实现
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
@@ -42,7 +43,7 @@ public class SysConfigServiceImpl implements ISysConfigService
|
||||
|
||||
/**
|
||||
* 查询参数配置信息
|
||||
*
|
||||
*
|
||||
* @param configId 参数配置ID
|
||||
* @return 参数配置信息
|
||||
*/
|
||||
@@ -57,7 +58,7 @@ public class SysConfigServiceImpl implements ISysConfigService
|
||||
|
||||
/**
|
||||
* 根据键名查询参数配置信息
|
||||
*
|
||||
*
|
||||
* @param configKey 参数key
|
||||
* @return 参数键值
|
||||
*/
|
||||
@@ -82,7 +83,7 @@ public class SysConfigServiceImpl implements ISysConfigService
|
||||
|
||||
/**
|
||||
* 获取验证码开关
|
||||
*
|
||||
*
|
||||
* @return true开启,false关闭
|
||||
*/
|
||||
@Override
|
||||
@@ -98,7 +99,7 @@ public class SysConfigServiceImpl implements ISysConfigService
|
||||
|
||||
/**
|
||||
* 查询参数配置列表
|
||||
*
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 参数配置集合
|
||||
*/
|
||||
@@ -110,7 +111,7 @@ public class SysConfigServiceImpl implements ISysConfigService
|
||||
|
||||
/**
|
||||
* 新增参数配置
|
||||
*
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -127,7 +128,7 @@ public class SysConfigServiceImpl implements ISysConfigService
|
||||
|
||||
/**
|
||||
* 修改参数配置
|
||||
*
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -150,7 +151,7 @@ public class SysConfigServiceImpl implements ISysConfigService
|
||||
|
||||
/**
|
||||
* 批量删除参数信息
|
||||
*
|
||||
*
|
||||
* @param configIds 需要删除的参数ID
|
||||
*/
|
||||
@Override
|
||||
@@ -203,12 +204,12 @@ public class SysConfigServiceImpl implements ISysConfigService
|
||||
|
||||
/**
|
||||
* 校验参数键名是否唯一
|
||||
*
|
||||
*
|
||||
* @param config 参数配置信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkConfigKeyUnique(SysConfig config)
|
||||
public boolean checkConfigKeyUnique(SysConfig config)
|
||||
{
|
||||
Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId();
|
||||
SysConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey());
|
||||
@@ -221,7 +222,7 @@ public class SysConfigServiceImpl implements ISysConfigService
|
||||
|
||||
/**
|
||||
* 设置cache key
|
||||
*
|
||||
*
|
||||
* @param configKey 参数键
|
||||
* @return 缓存键key
|
||||
*/
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
package com.fastbee.system.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fastbee.common.annotation.DataScope;
|
||||
import com.fastbee.common.constant.UserConstants;
|
||||
import com.fastbee.common.core.domain.TreeSelect;
|
||||
@@ -20,10 +14,17 @@ import com.fastbee.common.utils.spring.SpringUtils;
|
||||
import com.fastbee.system.mapper.SysDeptMapper;
|
||||
import com.fastbee.system.mapper.SysRoleMapper;
|
||||
import com.fastbee.system.service.ISysDeptService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 部门管理 服务实现
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
@@ -37,7 +38,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||
|
||||
/**
|
||||
* 查询部门管理数据
|
||||
*
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 部门信息集合
|
||||
*/
|
||||
@@ -50,7 +51,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||
|
||||
/**
|
||||
* 查询部门树结构信息
|
||||
*
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 部门树信息集合
|
||||
*/
|
||||
@@ -63,7 +64,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||
|
||||
/**
|
||||
* 构建前端所需要树结构
|
||||
*
|
||||
*
|
||||
* @param depts 部门列表
|
||||
* @return 树结构列表
|
||||
*/
|
||||
@@ -90,7 +91,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||
|
||||
/**
|
||||
* 构建前端所需要下拉树结构
|
||||
*
|
||||
*
|
||||
* @param depts 部门列表
|
||||
* @return 下拉树结构列表
|
||||
*/
|
||||
@@ -103,7 +104,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||
|
||||
/**
|
||||
* 根据角色ID查询部门树信息
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 选中部门列表
|
||||
*/
|
||||
@@ -116,7 +117,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||
|
||||
/**
|
||||
* 根据部门ID查询信息
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 部门信息
|
||||
*/
|
||||
@@ -128,7 +129,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||
|
||||
/**
|
||||
* 根据ID查询所有子部门(正常状态)
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 子部门数
|
||||
*/
|
||||
@@ -140,7 +141,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||
|
||||
/**
|
||||
* 是否存在子节点
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -153,7 +154,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||
|
||||
/**
|
||||
* 查询部门是否存在用户
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果 true 存在 false 不存在
|
||||
*/
|
||||
@@ -166,12 +167,12 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||
|
||||
/**
|
||||
* 校验部门名称是否唯一
|
||||
*
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkDeptNameUnique(SysDept dept)
|
||||
public boolean checkDeptNameUnique(SysDept dept)
|
||||
{
|
||||
Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
|
||||
SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId());
|
||||
@@ -184,13 +185,13 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||
|
||||
/**
|
||||
* 校验部门是否有数据权限
|
||||
*
|
||||
*
|
||||
* @param deptId 部门id
|
||||
*/
|
||||
@Override
|
||||
public void checkDeptDataScope(Long deptId)
|
||||
{
|
||||
if (!SysUser.isAdmin(SecurityUtils.getUserId()))
|
||||
if (!SysUser.isAdmin(SecurityUtils.getUserId()) && StringUtils.isNotNull(deptId))
|
||||
{
|
||||
SysDept dept = new SysDept();
|
||||
dept.setDeptId(deptId);
|
||||
@@ -204,7 +205,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||
|
||||
/**
|
||||
* 新增保存部门信息
|
||||
*
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -223,7 +224,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||
|
||||
/**
|
||||
* 修改保存部门信息
|
||||
*
|
||||
*
|
||||
* @param dept 部门信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -251,7 +252,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||
|
||||
/**
|
||||
* 修改该部门的父级部门状态
|
||||
*
|
||||
*
|
||||
* @param dept 当前部门
|
||||
*/
|
||||
private void updateParentDeptStatusNormal(SysDept dept)
|
||||
@@ -263,7 +264,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||
|
||||
/**
|
||||
* 修改子元素关系
|
||||
*
|
||||
*
|
||||
* @param deptId 被修改的部门ID
|
||||
* @param newAncestors 新的父ID集合
|
||||
* @param oldAncestors 旧的父ID集合
|
||||
@@ -283,7 +284,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||
|
||||
/**
|
||||
* 删除部门管理信息
|
||||
*
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
package com.fastbee.system.service.impl;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.PostConstruct;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.fastbee.common.constant.UserConstants;
|
||||
import com.fastbee.common.core.domain.entity.SysDictData;
|
||||
import com.fastbee.common.core.domain.entity.SysDictType;
|
||||
@@ -17,10 +9,19 @@ import com.fastbee.common.utils.StringUtils;
|
||||
import com.fastbee.system.mapper.SysDictDataMapper;
|
||||
import com.fastbee.system.mapper.SysDictTypeMapper;
|
||||
import com.fastbee.system.service.ISysDictTypeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 字典 业务层处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
@@ -43,7 +44,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
||||
|
||||
/**
|
||||
* 根据条件分页查询字典类型
|
||||
*
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 字典类型集合信息
|
||||
*/
|
||||
@@ -55,7 +56,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
||||
|
||||
/**
|
||||
* 根据所有字典类型
|
||||
*
|
||||
*
|
||||
* @return 字典类型集合信息
|
||||
*/
|
||||
@Override
|
||||
@@ -66,7 +67,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据
|
||||
*
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 字典数据集合信息
|
||||
*/
|
||||
@@ -89,7 +90,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
||||
|
||||
/**
|
||||
* 根据字典类型ID查询信息
|
||||
*
|
||||
*
|
||||
* @param dictId 字典类型ID
|
||||
* @return 字典类型
|
||||
*/
|
||||
@@ -101,7 +102,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
||||
|
||||
/**
|
||||
* 根据字典类型查询信息
|
||||
*
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 字典类型
|
||||
*/
|
||||
@@ -113,7 +114,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
||||
|
||||
/**
|
||||
* 批量删除字典类型信息
|
||||
*
|
||||
*
|
||||
* @param dictIds 需要删除的字典ID
|
||||
*/
|
||||
@Override
|
||||
@@ -167,7 +168,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
||||
|
||||
/**
|
||||
* 新增保存字典类型信息
|
||||
*
|
||||
*
|
||||
* @param dict 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -184,7 +185,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
||||
|
||||
/**
|
||||
* 修改保存字典类型信息
|
||||
*
|
||||
*
|
||||
* @param dict 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -205,12 +206,12 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
||||
|
||||
/**
|
||||
* 校验字典类型称是否唯一
|
||||
*
|
||||
*
|
||||
* @param dict 字典类型
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkDictTypeUnique(SysDictType dict)
|
||||
public boolean checkDictTypeUnique(SysDictType dict)
|
||||
{
|
||||
Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId();
|
||||
SysDictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType());
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.fastbee.system.service.ISysMenuService;
|
||||
|
||||
/**
|
||||
* 菜单 业务层处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
@@ -46,7 +46,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 根据用户查询系统菜单列表
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 菜单列表
|
||||
*/
|
||||
@@ -58,7 +58,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 查询系统菜单列表
|
||||
*
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 菜单列表
|
||||
*/
|
||||
@@ -81,7 +81,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 根据用户ID查询权限
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 权限列表
|
||||
*/
|
||||
@@ -102,7 +102,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 根据角色ID查询权限
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 权限列表
|
||||
*/
|
||||
@@ -123,7 +123,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 根据用户ID查询菜单
|
||||
*
|
||||
*
|
||||
* @param userId 用户名称
|
||||
* @return 菜单列表
|
||||
*/
|
||||
@@ -144,7 +144,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 根据角色ID查询菜单树信息
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 选中菜单列表
|
||||
*/
|
||||
@@ -157,7 +157,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 构建前端路由所需要的菜单
|
||||
*
|
||||
*
|
||||
* @param menus 菜单列表
|
||||
* @return 路由列表
|
||||
*/
|
||||
@@ -175,7 +175,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
router.setQuery(menu.getQuery());
|
||||
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
|
||||
List<SysMenu> cMenus = menu.getChildren();
|
||||
if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType()))
|
||||
if (StringUtils.isNotEmpty(cMenus) && UserConstants.TYPE_DIR.equals(menu.getMenuType()))
|
||||
{
|
||||
router.setAlwaysShow(true);
|
||||
router.setRedirect("noRedirect");
|
||||
@@ -188,7 +188,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
RouterVo children = new RouterVo();
|
||||
children.setPath(menu.getPath());
|
||||
children.setComponent(menu.getComponent());
|
||||
children.setName(StringUtils.capitalize(menu.getPath()));
|
||||
children.setName(getRouteName(menu.getRouteName(), menu.getPath()));
|
||||
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
|
||||
children.setQuery(menu.getQuery());
|
||||
childrenList.add(children);
|
||||
@@ -203,7 +203,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
String routerPath = innerLinkReplaceEach(menu.getPath());
|
||||
children.setPath(routerPath);
|
||||
children.setComponent(UserConstants.INNER_LINK);
|
||||
children.setName(StringUtils.capitalize(routerPath));
|
||||
children.setName(getRouteName(menu.getRouteName(), routerPath));
|
||||
children.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), menu.getPath()));
|
||||
childrenList.add(children);
|
||||
router.setChildren(childrenList);
|
||||
@@ -215,7 +215,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 构建前端所需要树结构
|
||||
*
|
||||
*
|
||||
* @param menus 菜单列表
|
||||
* @return 树结构列表
|
||||
*/
|
||||
@@ -243,7 +243,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 构建前端所需要下拉树结构
|
||||
*
|
||||
*
|
||||
* @param menus 菜单列表
|
||||
* @return 下拉树结构列表
|
||||
*/
|
||||
@@ -256,7 +256,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 根据菜单ID查询信息
|
||||
*
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
* @return 菜单信息
|
||||
*/
|
||||
@@ -268,7 +268,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 是否存在菜单子节点
|
||||
*
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -281,7 +281,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 查询菜单使用数量
|
||||
*
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -294,7 +294,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 新增保存菜单信息
|
||||
*
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -306,7 +306,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 修改保存菜单信息
|
||||
*
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -318,7 +318,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 删除菜单管理信息
|
||||
*
|
||||
*
|
||||
* @param menuId 菜单ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -330,12 +330,12 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 校验菜单名称是否唯一
|
||||
*
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkMenuNameUnique(SysMenu menu)
|
||||
public boolean checkMenuNameUnique(SysMenu menu)
|
||||
{
|
||||
Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId();
|
||||
SysMenu info = menuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId());
|
||||
@@ -348,24 +348,36 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 获取路由名称
|
||||
*
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 路由名称
|
||||
*/
|
||||
public String getRouteName(SysMenu menu)
|
||||
{
|
||||
String routerName = StringUtils.capitalize(menu.getPath());
|
||||
// 非外链并且是一级目录(类型为目录)
|
||||
if (isMenuFrame(menu))
|
||||
{
|
||||
routerName = StringUtils.EMPTY;
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
return routerName;
|
||||
return getRouteName(menu.getRouteName(), menu.getPath());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取路由名称,如没有配置路由名称则取路由地址
|
||||
*
|
||||
* @param name 路由名称
|
||||
* @param path 路由地址
|
||||
* @return 路由名称(驼峰格式)
|
||||
*/
|
||||
public String getRouteName(String name, String path)
|
||||
{
|
||||
String routerName = StringUtils.isNotEmpty(name) ? name : path;
|
||||
return StringUtils.capitalize(routerName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取路由地址
|
||||
*
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 路由地址
|
||||
*/
|
||||
@@ -393,7 +405,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 获取组件信息
|
||||
*
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 组件信息
|
||||
*/
|
||||
@@ -417,7 +429,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 是否为菜单内部跳转
|
||||
*
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -429,7 +441,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 是否为内链组件
|
||||
*
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -440,7 +452,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 是否为parent_view组件
|
||||
*
|
||||
*
|
||||
* @param menu 菜单信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -451,7 +463,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 根据父节点的ID获取所有子节点
|
||||
*
|
||||
*
|
||||
* @param list 分类表
|
||||
* @param parentId 传入的父节点ID
|
||||
* @return String
|
||||
@@ -474,7 +486,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 递归列表
|
||||
*
|
||||
*
|
||||
* @param list 分类表
|
||||
* @param t 子节点
|
||||
*/
|
||||
@@ -520,12 +532,12 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||
|
||||
/**
|
||||
* 内链域名特殊字符替换
|
||||
*
|
||||
*
|
||||
* @return 替换后的内链域名
|
||||
*/
|
||||
public String innerLinkReplaceEach(String path)
|
||||
{
|
||||
return StringUtils.replaceEach(path, new String[] { Constants.HTTP, Constants.HTTPS, Constants.WWW, "." },
|
||||
new String[] { "", "", "", "/" });
|
||||
return StringUtils.replaceEach(path, new String[] { Constants.HTTP, Constants.HTTPS, Constants.WWW, ".", ":" },
|
||||
new String[] { "", "", "", "/", "/" });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
package com.fastbee.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fastbee.system.domain.SysOperLog;
|
||||
import com.fastbee.system.mapper.SysOperLogMapper;
|
||||
import com.fastbee.system.service.ISysOperLogService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作日志 服务层处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
@@ -20,7 +21,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService
|
||||
|
||||
/**
|
||||
* 新增操作日志
|
||||
*
|
||||
*
|
||||
* @param operLog 操作日志对象
|
||||
*/
|
||||
@Override
|
||||
@@ -31,7 +32,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService
|
||||
|
||||
/**
|
||||
* 查询系统操作日志集合
|
||||
*
|
||||
*
|
||||
* @param operLog 操作日志对象
|
||||
* @return 操作日志集合
|
||||
*/
|
||||
@@ -43,7 +44,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService
|
||||
|
||||
/**
|
||||
* 批量删除系统操作日志
|
||||
*
|
||||
*
|
||||
* @param operIds 需要删除的操作日志ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -55,7 +56,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService
|
||||
|
||||
/**
|
||||
* 查询操作日志详细
|
||||
*
|
||||
*
|
||||
* @param operId 操作ID
|
||||
* @return 操作日志对象
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package com.fastbee.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fastbee.common.constant.UserConstants;
|
||||
import com.fastbee.common.exception.ServiceException;
|
||||
import com.fastbee.common.utils.StringUtils;
|
||||
@@ -10,10 +7,14 @@ import com.fastbee.system.domain.SysPost;
|
||||
import com.fastbee.system.mapper.SysPostMapper;
|
||||
import com.fastbee.system.mapper.SysUserPostMapper;
|
||||
import com.fastbee.system.service.ISysPostService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 岗位信息 服务层处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
@@ -27,7 +28,7 @@ public class SysPostServiceImpl implements ISysPostService
|
||||
|
||||
/**
|
||||
* 查询岗位信息集合
|
||||
*
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 岗位信息集合
|
||||
*/
|
||||
@@ -39,7 +40,7 @@ public class SysPostServiceImpl implements ISysPostService
|
||||
|
||||
/**
|
||||
* 查询所有岗位
|
||||
*
|
||||
*
|
||||
* @return 岗位列表
|
||||
*/
|
||||
@Override
|
||||
@@ -50,7 +51,7 @@ public class SysPostServiceImpl implements ISysPostService
|
||||
|
||||
/**
|
||||
* 通过岗位ID查询岗位信息
|
||||
*
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
@@ -62,7 +63,7 @@ public class SysPostServiceImpl implements ISysPostService
|
||||
|
||||
/**
|
||||
* 根据用户ID获取岗位选择框列表
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 选中岗位ID列表
|
||||
*/
|
||||
@@ -74,12 +75,12 @@ public class SysPostServiceImpl implements ISysPostService
|
||||
|
||||
/**
|
||||
* 校验岗位名称是否唯一
|
||||
*
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkPostNameUnique(SysPost post)
|
||||
public boolean checkPostNameUnique(SysPost post)
|
||||
{
|
||||
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
|
||||
SysPost info = postMapper.checkPostNameUnique(post.getPostName());
|
||||
@@ -92,12 +93,12 @@ public class SysPostServiceImpl implements ISysPostService
|
||||
|
||||
/**
|
||||
* 校验岗位编码是否唯一
|
||||
*
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkPostCodeUnique(SysPost post)
|
||||
public boolean checkPostCodeUnique(SysPost post)
|
||||
{
|
||||
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
|
||||
SysPost info = postMapper.checkPostCodeUnique(post.getPostCode());
|
||||
@@ -110,7 +111,7 @@ public class SysPostServiceImpl implements ISysPostService
|
||||
|
||||
/**
|
||||
* 通过岗位ID查询岗位使用数量
|
||||
*
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -122,7 +123,7 @@ public class SysPostServiceImpl implements ISysPostService
|
||||
|
||||
/**
|
||||
* 删除岗位信息
|
||||
*
|
||||
*
|
||||
* @param postId 岗位ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -134,7 +135,7 @@ public class SysPostServiceImpl implements ISysPostService
|
||||
|
||||
/**
|
||||
* 批量删除岗位信息
|
||||
*
|
||||
*
|
||||
* @param postIds 需要删除的岗位ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -154,7 +155,7 @@ public class SysPostServiceImpl implements ISysPostService
|
||||
|
||||
/**
|
||||
* 新增保存岗位信息
|
||||
*
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -166,7 +167,7 @@ public class SysPostServiceImpl implements ISysPostService
|
||||
|
||||
/**
|
||||
* 修改保存岗位信息
|
||||
*
|
||||
*
|
||||
* @param post 岗位信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
package com.fastbee.system.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.fastbee.common.annotation.DataScope;
|
||||
import com.fastbee.common.constant.UserConstants;
|
||||
import com.fastbee.common.core.domain.entity.SysRole;
|
||||
@@ -24,10 +16,15 @@ import com.fastbee.system.mapper.SysRoleMapper;
|
||||
import com.fastbee.system.mapper.SysRoleMenuMapper;
|
||||
import com.fastbee.system.mapper.SysUserRoleMapper;
|
||||
import com.fastbee.system.service.ISysRoleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 角色 业务层处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
@@ -47,7 +44,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
|
||||
/**
|
||||
* 根据条件分页查询角色数据
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 角色数据集合信息
|
||||
*/
|
||||
@@ -60,7 +57,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
|
||||
/**
|
||||
* 根据用户ID查询角色
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 角色列表
|
||||
*/
|
||||
@@ -85,7 +82,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
|
||||
/**
|
||||
* 根据用户ID查询权限
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 权限列表
|
||||
*/
|
||||
@@ -106,7 +103,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
|
||||
/**
|
||||
* 查询所有角色
|
||||
*
|
||||
*
|
||||
* @return 角色列表
|
||||
*/
|
||||
@Override
|
||||
@@ -117,7 +114,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
|
||||
/**
|
||||
* 根据用户ID获取角色选择框列表
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 选中角色ID列表
|
||||
*/
|
||||
@@ -129,7 +126,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 角色对象信息
|
||||
*/
|
||||
@@ -141,12 +138,12 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
|
||||
/**
|
||||
* 校验角色名称是否唯一
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkRoleNameUnique(SysRole role)
|
||||
public boolean checkRoleNameUnique(SysRole role)
|
||||
{
|
||||
Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
|
||||
SysRole info = roleMapper.checkRoleNameUnique(role.getRoleName());
|
||||
@@ -159,12 +156,12 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
|
||||
/**
|
||||
* 校验角色权限是否唯一
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkRoleKeyUnique(SysRole role)
|
||||
public boolean checkRoleKeyUnique(SysRole role)
|
||||
{
|
||||
Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
|
||||
SysRole info = roleMapper.checkRoleKeyUnique(role.getRoleKey());
|
||||
@@ -177,7 +174,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
|
||||
/**
|
||||
* 校验角色是否允许操作
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
*/
|
||||
@Override
|
||||
@@ -191,27 +188,30 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
|
||||
/**
|
||||
* 校验角色是否有数据权限
|
||||
*
|
||||
* @param roleId 角色id
|
||||
*
|
||||
* @param roleIds 角色id
|
||||
*/
|
||||
@Override
|
||||
public void checkRoleDataScope(Long roleId)
|
||||
public void checkRoleDataScope(Long... roleIds)
|
||||
{
|
||||
if (!SysUser.isAdmin(SecurityUtils.getUserId()))
|
||||
{
|
||||
SysRole role = new SysRole();
|
||||
role.setRoleId(roleId);
|
||||
List<SysRole> roles = SpringUtils.getAopProxy(this).selectRoleList(role);
|
||||
if (StringUtils.isEmpty(roles))
|
||||
for (Long roleId : roleIds)
|
||||
{
|
||||
throw new ServiceException("没有权限访问角色数据!");
|
||||
SysRole role = new SysRole();
|
||||
role.setRoleId(roleId);
|
||||
List<SysRole> roles = SpringUtils.getAopProxy(this).selectRoleList(role);
|
||||
if (StringUtils.isEmpty(roles))
|
||||
{
|
||||
throw new ServiceException("没有权限访问角色数据!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色使用数量
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -223,7 +223,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
|
||||
/**
|
||||
* 新增保存角色信息
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -238,7 +238,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
|
||||
/**
|
||||
* 修改保存角色信息
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -255,7 +255,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
|
||||
/**
|
||||
* 修改角色状态
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -267,7 +267,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
|
||||
/**
|
||||
* 修改数据权限信息
|
||||
*
|
||||
*
|
||||
* @param role 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -285,7 +285,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
|
||||
/**
|
||||
* 新增角色菜单信息
|
||||
*
|
||||
*
|
||||
* @param role 角色对象
|
||||
*/
|
||||
public int insertRoleMenu(SysRole role)
|
||||
@@ -333,7 +333,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
|
||||
/**
|
||||
* 通过角色ID删除角色
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -350,7 +350,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
|
||||
/**
|
||||
* 批量删除角色信息
|
||||
*
|
||||
*
|
||||
* @param roleIds 需要删除的角色ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -377,7 +377,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
|
||||
/**
|
||||
* 取消授权用户角色
|
||||
*
|
||||
*
|
||||
* @param userRole 用户和角色关联信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -389,7 +389,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
|
||||
/**
|
||||
* 批量取消授权用户角色
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 需要取消授权的用户数据ID
|
||||
* @return 结果
|
||||
@@ -402,7 +402,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
|
||||
/**
|
||||
* 批量选择授权用户角色
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param userIds 需要授权的用户数据ID
|
||||
* @return 结果
|
||||
|
||||
@@ -13,12 +13,9 @@ import com.fastbee.common.utils.spring.SpringUtils;
|
||||
import com.fastbee.system.domain.SysPost;
|
||||
import com.fastbee.system.domain.SysUserPost;
|
||||
import com.fastbee.system.domain.SysUserRole;
|
||||
import com.fastbee.system.mapper.SysPostMapper;
|
||||
import com.fastbee.system.mapper.SysRoleMapper;
|
||||
import com.fastbee.system.mapper.SysUserMapper;
|
||||
import com.fastbee.system.mapper.SysUserPostMapper;
|
||||
import com.fastbee.system.mapper.SysUserRoleMapper;
|
||||
import com.fastbee.system.mapper.*;
|
||||
import com.fastbee.system.service.ISysConfigService;
|
||||
import com.fastbee.system.service.ISysDeptService;
|
||||
import com.fastbee.system.service.ISysUserService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -60,6 +57,9 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
@Autowired
|
||||
protected Validator validator;
|
||||
|
||||
@@ -167,7 +167,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkUserNameUnique(SysUser user)
|
||||
public boolean checkUserNameUnique(SysUser user)
|
||||
{
|
||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||
SysUser info = userMapper.checkUserNameUnique(user.getUserName());
|
||||
@@ -185,7 +185,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String checkPhoneUnique(SysUser user)
|
||||
public boolean checkPhoneUnique(SysUser user)
|
||||
{
|
||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||
SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
|
||||
@@ -203,7 +203,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String checkEmailUnique(SysUser user)
|
||||
public boolean checkEmailUnique(SysUser user)
|
||||
{
|
||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||
SysUser info = userMapper.checkEmailUnique(user.getEmail());
|
||||
@@ -495,7 +495,6 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
String password = configService.selectConfigByKey("sys.user.initPassword");
|
||||
for (SysUser user : userList)
|
||||
{
|
||||
try
|
||||
@@ -505,19 +504,23 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
if (StringUtils.isNull(u))
|
||||
{
|
||||
BeanValidators.validateWithException(validator, user);
|
||||
deptService.checkDeptDataScope(user.getDeptId());
|
||||
String password = configService.selectConfigByKey("sys.user.initPassword");
|
||||
user.setPassword(SecurityUtils.encryptPassword(password));
|
||||
user.setCreateBy(operName);
|
||||
this.insertUser(user);
|
||||
userMapper.insertUser(user);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 导入成功");
|
||||
}
|
||||
else if (isUpdateSupport)
|
||||
{
|
||||
BeanValidators.validateWithException(validator, user);
|
||||
checkUserAllowed(user);
|
||||
checkUserDataScope(user.getUserId());
|
||||
checkUserAllowed(u);
|
||||
checkUserDataScope(u.getUserId());
|
||||
deptService.checkDeptDataScope(user.getDeptId());
|
||||
user.setUserId(u.getUserId());
|
||||
user.setUpdateBy(operName);
|
||||
this.updateUser(user);
|
||||
userMapper.updateUser(user);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fastbee.system.mapper.SysClientMapper">
|
||||
|
||||
<resultMap type="SysClient" id="SysClientResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="clientKey" column="client_key" />
|
||||
<result property="clientSecret" column="client_secret" />
|
||||
<result property="token" column="token" />
|
||||
<result property="grantType" column="grant_type" />
|
||||
<result property="deviceType" column="device_type" />
|
||||
<result property="timeout" column="timeout" />
|
||||
<result property="enable" column="enable" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysClientVo">
|
||||
select id, client_key, client_secret, token, grant_type, device_type, timeout, enable, del_flag, create_by, create_time, update_by, update_time, remark from sys_client
|
||||
</sql>
|
||||
|
||||
<select id="selectSysClientList" parameterType="SysClient" resultMap="SysClientResult">
|
||||
<include refid="selectSysClientVo"/>
|
||||
<where>
|
||||
<if test="clientKey != null and clientKey != ''"> and client_key = #{clientKey}</if>
|
||||
<if test="clientSecret != null and clientSecret != ''"> and client_secret = #{clientSecret}</if>
|
||||
<if test="token != null and token != ''"> and token = #{token}</if>
|
||||
<if test="grantType != null and grantType != ''"> and grant_type = #{grantType}</if>
|
||||
<if test="deviceType != null and deviceType != ''"> and device_type = #{deviceType}</if>
|
||||
<if test="timeout != null "> and timeout = #{timeout}</if>
|
||||
<if test="enable != null and enable != ''"> and enable = #{enable}</if>
|
||||
and del_flag = '0'
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSysClientById" parameterType="Long" resultMap="SysClientResult">
|
||||
<include refid="selectSysClientVo"/>
|
||||
where id = #{id} and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<insert id="insertSysClient" parameterType="SysClient" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_client
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="clientKey != null">client_key,</if>
|
||||
<if test="clientSecret != null">client_secret,</if>
|
||||
<if test="token != null">token,</if>
|
||||
<if test="grantType != null">grant_type,</if>
|
||||
<if test="deviceType != null">device_type,</if>
|
||||
<if test="timeout != null">timeout,</if>
|
||||
<if test="enable != null">enable,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="clientKey != null">#{clientKey},</if>
|
||||
<if test="clientSecret != null">#{clientSecret},</if>
|
||||
<if test="token != null">#{token},</if>
|
||||
<if test="grantType != null">#{grantType},</if>
|
||||
<if test="deviceType != null">#{deviceType},</if>
|
||||
<if test="timeout != null">#{timeout},</if>
|
||||
<if test="enable != null">#{enable},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysClient" parameterType="SysClient">
|
||||
update sys_client
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="clientKey != null">client_key = #{clientKey},</if>
|
||||
<if test="clientSecret != null">client_secret = #{clientSecret},</if>
|
||||
<if test="token != null">token = #{token},</if>
|
||||
<if test="grantType != null">grant_type = #{grantType},</if>
|
||||
<if test="deviceType != null">device_type = #{deviceType},</if>
|
||||
<if test="timeout != null">timeout = #{timeout},</if>
|
||||
<if test="enable != null">enable = #{enable},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -8,7 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="noticeId" column="notice_id" />
|
||||
<result property="noticeTitle" column="notice_title" />
|
||||
<result property="noticeType" column="notice_type" />
|
||||
<result property="noticeContent" column="notice_content" />
|
||||
<result property="noticeContent" column="notice_content" typeHandler="com.fastbee.system.handle.BlobToStringHandler" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
@@ -18,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectNoticeVo">
|
||||
select notice_id, notice_title, notice_type, cast(notice_content as char) as notice_content, status, create_by, create_time, update_by, update_time, remark
|
||||
select notice_id, notice_title, notice_type, notice_content, status, create_by, create_time, update_by, update_time, remark
|
||||
from sys_notice
|
||||
</sql>
|
||||
|
||||
@@ -54,11 +54,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
)values(
|
||||
<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
|
||||
<if test="noticeType != null and noticeType != ''">#{noticeType}, </if>
|
||||
<if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>
|
||||
<if test="noticeContent != null and noticeContent != ''">#{noticeContent,typeHandler=com.fastbee.system.handle.BlobToStringHandler}, </if>
|
||||
<if test="status != null and status != ''">#{status}, </if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
CURRENT_TIMESTAMP
|
||||
)
|
||||
</insert>
|
||||
|
||||
@@ -67,10 +67,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<set>
|
||||
<if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>
|
||||
<if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
|
||||
<if test="noticeContent != null">notice_content = #{noticeContent}, </if>
|
||||
<if test="noticeContent != null">notice_content = #{noticeContent,typeHandler=com.fastbee.system.handle.BlobToStringHandler}, </if>
|
||||
<if test="status != null and status != ''">status = #{status}, </if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
update_time = sysdate()
|
||||
update_time = CURRENT_TIMESTAMP
|
||||
</set>
|
||||
where notice_id = #{noticeId}
|
||||
</update>
|
||||
|
||||
@@ -27,15 +27,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time
|
||||
from sys_oper_log
|
||||
</sql>
|
||||
|
||||
|
||||
<insert id="insertOperlog" parameterType="SysOperLog">
|
||||
insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time)
|
||||
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, sysdate())
|
||||
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, CURRENT_TIMESTAMP)
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">
|
||||
<include refid="selectOperLogVo"/>
|
||||
<where>
|
||||
<if test="operIp != null and operIp != ''">
|
||||
AND oper_ip like concat('%', #{operIp}, '%')
|
||||
</if>
|
||||
<if test="title != null and title != ''">
|
||||
AND title like concat('%', #{title}, '%')
|
||||
</if>
|
||||
@@ -46,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND business_type in
|
||||
<foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
|
||||
#{businessType}
|
||||
</foreach>
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
@@ -55,29 +58,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND oper_name like concat('%', #{operName}, '%')
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
and date_format(oper_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||
AND oper_time >= #{params.beginTime}
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
and date_format(oper_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||
AND oper_time <= #{params.endTime}
|
||||
</if>
|
||||
</where>
|
||||
order by oper_id desc
|
||||
</select>
|
||||
|
||||
|
||||
<delete id="deleteOperLogByIds" parameterType="Long">
|
||||
delete from sys_oper_log where oper_id in
|
||||
<foreach collection="array" item="operId" open="(" separator="," close=")">
|
||||
#{operId}
|
||||
</foreach>
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="selectOperLogById" parameterType="Long" resultMap="SysOperLogResult">
|
||||
<include refid="selectOperLogVo"/>
|
||||
where oper_id = #{operId}
|
||||
</select>
|
||||
|
||||
|
||||
<update id="cleanOperLog">
|
||||
truncate table sys_oper_log
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@@ -20,16 +20,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectRoleVo">
|
||||
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
|
||||
r.status, r.del_flag, r.create_time, r.remark
|
||||
r.status, r.del_flag, r.create_time, r.remark
|
||||
from sys_role r
|
||||
left join sys_user_role ur on ur.role_id = r.role_id
|
||||
left join sys_user u on u.user_id = ur.user_id
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult">
|
||||
<include refid="selectRoleVo"/>
|
||||
where r.del_flag = '0'
|
||||
@@ -46,25 +46,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND r.role_key like concat('%', #{roleKey}, '%')
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
and date_format(r.create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||
and date_format(r.create_time,'%Y%m%d') >= date_format(#{params.beginTime},'%Y%m%d')
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
and date_format(r.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||
and date_format(r.create_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d')
|
||||
</if>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
order by r.role_sort
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult">
|
||||
<include refid="selectRoleVo"/>
|
||||
WHERE r.del_flag = '0' and ur.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectRoleAll" resultMap="SysRoleResult">
|
||||
<include refid="selectRoleVo"/>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectRoleListByUserId" parameterType="Long" resultType="Long">
|
||||
select r.role_id
|
||||
from sys_role r
|
||||
@@ -72,27 +72,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
left join sys_user u on u.user_id = ur.user_id
|
||||
where u.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectRoleById" parameterType="Long" resultMap="SysRoleResult">
|
||||
<include refid="selectRoleVo"/>
|
||||
where r.role_id = #{roleId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleResult">
|
||||
<include refid="selectRoleVo"/>
|
||||
WHERE r.del_flag = '0' and u.user_name = #{userName}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult">
|
||||
<include refid="selectRoleVo"/>
|
||||
where r.role_name=#{roleName} and r.del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult">
|
||||
<include refid="selectRoleVo"/>
|
||||
where r.role_key=#{roleKey} and r.del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
|
||||
insert into sys_role(
|
||||
<if test="roleId != null and roleId != 0">role_id,</if>
|
||||
@@ -120,7 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="updateRole" parameterType="SysRole">
|
||||
update sys_role
|
||||
<set>
|
||||
@@ -137,16 +137,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</set>
|
||||
where role_id = #{roleId}
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="deleteRoleById" parameterType="Long">
|
||||
update sys_role set del_flag = '2' where role_id = #{roleId}
|
||||
</delete>
|
||||
|
||||
|
||||
<delete id="deleteRoleByIds" parameterType="Long">
|
||||
update sys_role set del_flag = '2' where role_id in
|
||||
<foreach collection="array" item="roleId" open="(" separator="," close=")">
|
||||
#{roleId}
|
||||
</foreach>
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -23,8 +23,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult" />
|
||||
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
|
||||
<association property="dept" javaType="SysDept" resultMap="deptResult" />
|
||||
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="deptResult" type="SysDept">
|
||||
@@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="roleName" column="role_name" />
|
||||
<result property="roleKey" column="role_key" />
|
||||
<result property="roleSort" column="role_sort" />
|
||||
<result property="dataScope" column="data_scope" />
|
||||
<result property="dataScope" column="data_scope" />
|
||||
<result property="status" column="role_status" />
|
||||
</resultMap>
|
||||
|
||||
@@ -73,10 +73,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
AND u.phonenumber like concat('%', #{phonenumber}, '%')
|
||||
</if>
|
||||
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
|
||||
AND date_format(u.create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
|
||||
AND date_format(u.create_time,'%Y%m%d') >= date_format(#{params.beginTime},'%Y%m%d')
|
||||
</if>
|
||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||
AND date_format(u.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||
AND date_format(u.create_time,'%Y%m%d') <= date_format(#{params.endTime},'%Y%m%d')
|
||||
</if>
|
||||
<if test="deptId != null and deptId != 0">
|
||||
AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
|
||||
@@ -142,12 +142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectUserByPhoneNumber" parameterType="String" resultMap="SysUserResult">
|
||||
<include refid="selectUserVo"/>
|
||||
where u.phonenumber = #{phoneNumber} and u.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
|
||||
insert into sys_user(
|
||||
<if test="userId != null and userId != 0">user_id,</if>
|
||||
<if test="deptId != null and deptId != 0">dept_id,</if>
|
||||
@@ -183,7 +178,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
update sys_user
|
||||
<set>
|
||||
<if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
|
||||
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
||||
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
|
||||
<if test="email != null ">email = #{email},</if>
|
||||
<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
|
||||
@@ -223,29 +217,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBySysUserIdAndSourceClient">
|
||||
update iot_social_user
|
||||
set del_flag = 1,
|
||||
update_time = now()
|
||||
where sys_user_id = #{sysUserId}
|
||||
and source_client in
|
||||
<foreach item="sourceClient" collection="sourceClientList" open="(" separator="," close=")">
|
||||
#{sourceClient}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBySysUserIdsAndSourceClient">
|
||||
update iot_social_user
|
||||
set del_flag = 1,
|
||||
update_time = now()
|
||||
where sys_user_id in
|
||||
<foreach item="sysUserId" collection="sysUserIds" open="(" separator="," close=")">
|
||||
#{sysUserId}
|
||||
</foreach>
|
||||
and source_client in
|
||||
<foreach item="sourceClient" collection="sourceClientList" open="(" separator="," close=")">
|
||||
#{sourceClient}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user