diff --git a/common/src/main/java/com/storeroom/config/AuditorConfig.java b/common/src/main/java/com/storeroom/config/AuditorConfig.java new file mode 100644 index 0000000..fa5dfab --- /dev/null +++ b/common/src/main/java/com/storeroom/config/AuditorConfig.java @@ -0,0 +1,24 @@ +package com.storeroom.config; + +import com.storeroom.utils.SecurityUtils; +import org.springframework.data.domain.AuditorAware; +import org.springframework.stereotype.Component; + +import java.util.Optional; + +@Component("auditorAware") +public class AuditorConfig implements AuditorAware { + + + /** + * 返回操作员标志信息 + * @return / + */ + @Override + public Optional getCurrentAuditor() { + try{ + return Optional.of(SecurityUtils.getCurrentUsername()); + }catch (Exception ignored){} + return Optional.of("System"); + } +} diff --git a/system/src/main/java/com/storeroom/modules/security/config/SpringSecurityConfig.java b/system/src/main/java/com/storeroom/modules/security/config/SpringSecurityConfig.java index 53e53c4..91125a0 100644 --- a/system/src/main/java/com/storeroom/modules/security/config/SpringSecurityConfig.java +++ b/system/src/main/java/com/storeroom/modules/security/config/SpringSecurityConfig.java @@ -122,7 +122,7 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter { // 所有类型的接口都放行 .antMatchers(anonymousUrls.get(RequestMethodEnum.ALL.getType()).toArray(new String[0])).permitAll() // 所有请求都需要认证 测试需求注释 - //.anyRequest().authenticated() + .anyRequest().authenticated() .and().apply(securityConfigurerAdapter()); } diff --git a/system/src/main/java/com/storeroom/modules/system/service/mapstruct/DeptSmallMapper.java b/system/src/main/java/com/storeroom/modules/system/service/mapstruct/DeptSmallMapper.java new file mode 100644 index 0000000..34a5aa7 --- /dev/null +++ b/system/src/main/java/com/storeroom/modules/system/service/mapstruct/DeptSmallMapper.java @@ -0,0 +1,11 @@ +package com.storeroom.modules.system.service.mapstruct; + +import com.storeroom.base.BaseMapper; +import com.storeroom.modules.system.domain.Dept; +import com.storeroom.modules.system.service.dto.DeptSmallDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface DeptSmallMapper extends BaseMapper { +} diff --git a/system/src/main/java/com/storeroom/modules/system/service/mapstruct/JobSmallMapper.java b/system/src/main/java/com/storeroom/modules/system/service/mapstruct/JobSmallMapper.java new file mode 100644 index 0000000..d5973ea --- /dev/null +++ b/system/src/main/java/com/storeroom/modules/system/service/mapstruct/JobSmallMapper.java @@ -0,0 +1,11 @@ +package com.storeroom.modules.system.service.mapstruct; + +import com.storeroom.base.BaseMapper; +import com.storeroom.modules.system.domain.Job; +import com.storeroom.modules.system.service.dto.JobSmallDto; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface JobSmallMapper extends BaseMapper { +}