init
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>data-system-service-parent</artifactId>
|
||||
<groupId>com.platform</groupId>
|
||||
<version>0.4.x</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<version>0.4.x</version>
|
||||
<artifactId>data-system-service</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!--web 模块-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
</dependency>
|
||||
<!--配置中心客户端 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-config</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
<version>${mapstruct.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
<version>${mapstruct.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>eu.bitwalker</groupId>
|
||||
<artifactId>UserAgentUtils</artifactId>
|
||||
<version>${bitwalker.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.platform</groupId>
|
||||
<artifactId>common-mybatis</artifactId>
|
||||
<version>0.4.x</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.platform</groupId>
|
||||
<artifactId>common-redis</artifactId>
|
||||
<version>0.4.x</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.platform</groupId>
|
||||
<artifactId>common-security</artifactId>
|
||||
<version>0.4.x</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.platform</groupId>
|
||||
<artifactId>common-log</artifactId>
|
||||
<version>0.4.x</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.platform</groupId>
|
||||
<artifactId>data-system-service-api</artifactId>
|
||||
<version>0.4.x</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,15 @@
|
||||
package cn.datax.service.system;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
@EnableFeignClients(basePackages = {"cn.datax.service.system.api.feign"})
|
||||
@SpringCloudApplication
|
||||
public class DataxSystemApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DataxSystemApplication.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.datax.service.system.async;
|
||||
|
||||
import cn.datax.service.system.api.dto.LogDto;
|
||||
import cn.datax.service.system.service.LogService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 异步处理 分布式获取请求头有问题
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AsyncTask {
|
||||
|
||||
@Autowired
|
||||
private LogService logService;
|
||||
|
||||
@Async("taskExecutor")
|
||||
public void doTask(LogDto logDto) {
|
||||
logService.saveLog(logDto);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package cn.datax.service.system.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
@EnableAsync
|
||||
@Configuration
|
||||
public class AsyncConfig {
|
||||
|
||||
@Bean("taskExecutor")
|
||||
public Executor taskExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setCorePoolSize(5);
|
||||
executor.setMaxPoolSize(20);
|
||||
executor.setQueueCapacity(100);
|
||||
executor.setKeepAliveSeconds(30);
|
||||
executor.setThreadNamePrefix("datax-async-service-");
|
||||
executor.setWaitForTasksToCompleteOnShutdown(true);
|
||||
executor.setAwaitTerminationSeconds(60);
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package cn.datax.service.system.config;
|
||||
|
||||
import cn.datax.common.core.DataConstant;
|
||||
import cn.datax.common.core.RedisConstant;
|
||||
import cn.datax.common.redis.service.RedisService;
|
||||
import cn.datax.service.system.api.entity.ConfigEntity;
|
||||
import cn.datax.service.system.api.entity.DictEntity;
|
||||
import cn.datax.service.system.dao.ConfigDao;
|
||||
import cn.datax.service.system.dao.DictDao;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class StartedUpRunner implements ApplicationRunner {
|
||||
|
||||
private final ConfigurableApplicationContext context;
|
||||
private final Environment environment;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
@Autowired
|
||||
private DictDao dictDao;
|
||||
@Autowired
|
||||
private ConfigDao configDao;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) {
|
||||
if (context.isActive()) {
|
||||
String banner = "-----------------------------------------\n" +
|
||||
"服务启动成功,时间:" + DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now()) + "\n" +
|
||||
"服务名称:" + environment.getProperty("spring.application.name") + "\n" +
|
||||
"端口号:" + environment.getProperty("server.port") + "\n" +
|
||||
"-----------------------------------------";
|
||||
System.out.println(banner);
|
||||
|
||||
// 项目启动时,初始化缓存
|
||||
String dictKey = RedisConstant.SYSTEM_DICT_KEY;
|
||||
Boolean hasDictKey = redisService.hasKey(dictKey);
|
||||
if (!hasDictKey) {
|
||||
List<DictEntity> dictEntityList = dictDao.queryDictList(DataConstant.EnableState.ENABLE.getKey());
|
||||
redisService.set(dictKey, dictEntityList);
|
||||
}
|
||||
String configKey = RedisConstant.SYSTEM_CONFIG_KEY;
|
||||
Boolean hasConfigKey = redisService.hasKey(configKey);
|
||||
if (!hasConfigKey) {
|
||||
List<ConfigEntity> configEntityList = configDao.queryConfigList(DataConstant.EnableState.ENABLE.getKey());
|
||||
Map<String, Object> map = configEntityList.stream().collect(Collectors.toMap(ConfigEntity::getConfigKey, ConfigEntity::getConfigValue));
|
||||
redisService.hmset(configKey, map);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package cn.datax.service.system.config;
|
||||
|
||||
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
|
||||
import springfox.documentation.builders.*;
|
||||
import springfox.documentation.schema.ModelRef;
|
||||
import springfox.documentation.service.*;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnProperty(prefix = "swagger", name = "enable", havingValue = "true")
|
||||
@EnableConfigurationProperties(SwaggerProperties.class)
|
||||
@EnableSwagger2
|
||||
@EnableKnife4j
|
||||
@Import(BeanValidatorPluginsConfiguration.class)
|
||||
public class SwaggerConfig {
|
||||
|
||||
@Autowired
|
||||
private SwaggerProperties swaggerProperties;
|
||||
|
||||
/**
|
||||
* 创建API应用
|
||||
* apiInfo() 增加API相关信息
|
||||
* 通过select()函数返回一个ApiSelectorBuilder实例,用来控制哪些接口暴露给Swagger来展现,
|
||||
* 本例采用指定扫描的包路径来定义指定要建立API的目录。
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public Docket createRestApi(){
|
||||
//版本类型是swagger2
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
//通过调用自定义方法apiInfo,获得文档的主要信息
|
||||
.apiInfo(apiInfo())
|
||||
//设置全局参数
|
||||
.globalOperationParameters(globalParamBuilder())
|
||||
//设置全局响应参数
|
||||
.globalResponseMessage(RequestMethod.GET,responseBuilder())
|
||||
.globalResponseMessage(RequestMethod.POST,responseBuilder())
|
||||
.globalResponseMessage(RequestMethod.PUT,responseBuilder())
|
||||
.globalResponseMessage(RequestMethod.DELETE,responseBuilder())
|
||||
.select()
|
||||
//扫描该包下面的API注解
|
||||
.apis(RequestHandlerSelectors.basePackage(swaggerProperties.getBasePackage()))
|
||||
.paths(PathSelectors.any())
|
||||
.build()
|
||||
//设置安全认证
|
||||
.securitySchemes(security());
|
||||
}
|
||||
/**
|
||||
* 创建该API的基本信息(这些基本信息会展现在文档页面中)
|
||||
* 访问地址:http://项目实际地址/swagger-ui.html
|
||||
* @return
|
||||
*/
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title(swaggerProperties.getTitle())
|
||||
.description(swaggerProperties.getDescription())
|
||||
.termsOfServiceUrl(swaggerProperties.getTermsOfServiceUrl())
|
||||
.version(swaggerProperties.getVersion())
|
||||
.contact(new Contact(swaggerProperties.getContact().getName(), swaggerProperties.getContact().getUrl(), swaggerProperties.getContact().getEmail()))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全认证参数
|
||||
* @return
|
||||
*/
|
||||
private List<ApiKey> security() {
|
||||
List<ApiKey> apiKeys = new ArrayList<>();
|
||||
apiKeys.add(new ApiKey("Authorization", "Authorization", "header"));
|
||||
return apiKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建全局参数列表
|
||||
* @return
|
||||
*/
|
||||
private List<Parameter> globalParamBuilder(){
|
||||
List<Parameter> pars = new ArrayList<>();
|
||||
pars.add(parameterBuilder("Authorization","令牌","string","header",false).build());
|
||||
return pars;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建参数
|
||||
* @return
|
||||
*/
|
||||
private ParameterBuilder parameterBuilder(String name, String desc, String type, String parameterType, boolean required) {
|
||||
ParameterBuilder tokenPar = new ParameterBuilder();
|
||||
tokenPar.name(name).description(desc).modelRef(new ModelRef(type)).parameterType(parameterType).required(required).build();
|
||||
return tokenPar;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建全局响应值
|
||||
* @return
|
||||
*/
|
||||
private List<ResponseMessage> responseBuilder() {
|
||||
List<ResponseMessage> responseMessageList = new ArrayList<>();
|
||||
responseMessageList.add(new ResponseMessageBuilder().code(200).message("响应成功").build());
|
||||
responseMessageList.add(new ResponseMessageBuilder().code(500).message("服务器内部错误").build());
|
||||
return responseMessageList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package cn.datax.service.system.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties(ignoreUnknownFields = false, prefix = "swagger")
|
||||
public class SwaggerProperties {
|
||||
|
||||
private Boolean enable;
|
||||
private String title;
|
||||
private String description;
|
||||
private String version;
|
||||
private String termsOfServiceUrl;
|
||||
private String basePackage;
|
||||
private Contact contact;
|
||||
|
||||
public Boolean getEnable() {
|
||||
return enable;
|
||||
}
|
||||
|
||||
public void setEnable(Boolean enable) {
|
||||
this.enable = enable;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getTermsOfServiceUrl() {
|
||||
return termsOfServiceUrl;
|
||||
}
|
||||
|
||||
public void setTermsOfServiceUrl(String termsOfServiceUrl) {
|
||||
this.termsOfServiceUrl = termsOfServiceUrl;
|
||||
}
|
||||
|
||||
public String getBasePackage() {
|
||||
return basePackage;
|
||||
}
|
||||
|
||||
public void setBasePackage(String basePackage) {
|
||||
this.basePackage = basePackage;
|
||||
}
|
||||
|
||||
public Contact getContact() {
|
||||
return contact;
|
||||
}
|
||||
|
||||
public void setContact(Contact contact) {
|
||||
this.contact = contact;
|
||||
}
|
||||
|
||||
public static class Contact {
|
||||
private String name;
|
||||
private String url;
|
||||
private String email;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package cn.datax.service.system.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity(debug = false)
|
||||
public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http.csrf().disable().authorizeRequests().anyRequest().permitAll().and().logout().permitAll();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
package cn.datax.service.system.controller;
|
||||
|
||||
import cn.datax.common.core.JsonPage;
|
||||
import cn.datax.common.core.R;
|
||||
import cn.datax.common.validate.ValidationGroups;
|
||||
import cn.datax.service.system.api.dto.ConfigDto;
|
||||
import cn.datax.service.system.api.entity.ConfigEntity;
|
||||
import cn.datax.service.system.api.vo.ConfigVo;
|
||||
import cn.datax.service.system.api.query.ConfigQuery;
|
||||
import cn.datax.service.system.mapstruct.ConfigMapper;
|
||||
import cn.datax.service.system.service.ConfigService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.datax.common.base.BaseController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统参数配置信息表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-05-19
|
||||
*/
|
||||
@Api(tags = {"系统参数配置信息表"})
|
||||
@RestController
|
||||
@RequestMapping("/configs")
|
||||
public class ConfigController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ConfigService configService;
|
||||
|
||||
@Autowired
|
||||
private ConfigMapper configMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取详细信息", notes = "根据url的id来获取详细信息")
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping("/{id}")
|
||||
public R getConfigById(@PathVariable String id) {
|
||||
ConfigEntity configEntity = configService.getConfigById(id);
|
||||
return R.ok().setData(configMapper.toVO(configEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询信息
|
||||
*
|
||||
* @param configQuery
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "configQuery", value = "查询实体configQuery", required = true, dataTypeClass = ConfigQuery.class)
|
||||
})
|
||||
@GetMapping("/page")
|
||||
public R getConfigPage(ConfigQuery configQuery) {
|
||||
QueryWrapper<ConfigEntity> queryWrapper = new QueryWrapper<>();
|
||||
IPage<ConfigEntity> page = configService.page(new Page<>(configQuery.getPageNum(), configQuery.getPageSize()), queryWrapper);
|
||||
List<ConfigVo> collect = page.getRecords().stream().map(configMapper::toVO).collect(Collectors.toList());
|
||||
JsonPage<ConfigVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), collect);
|
||||
return R.ok().setData(jsonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param config
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "添加信息", notes = "根据config对象添加信息")
|
||||
@ApiImplicitParam(name = "config", value = "详细实体config", required = true, dataType = "ConfigDto")
|
||||
@PostMapping()
|
||||
public R saveConfig(@RequestBody @Validated({ValidationGroups.Insert.class}) ConfigDto config) {
|
||||
ConfigEntity configEntity = configService.saveConfig(config);
|
||||
return R.ok().setData(configMapper.toVO(configEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param config
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "修改信息", notes = "根据url的id来指定修改对象,并根据传过来的信息来修改详细信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "config", value = "详细实体config", required = true, dataType = "ConfigDto")
|
||||
})
|
||||
@PutMapping("/{id}")
|
||||
public R updateConfig(@PathVariable String id, @RequestBody @Validated({ValidationGroups.Update.class}) ConfigDto config) {
|
||||
ConfigEntity configEntity = configService.updateConfig(config);
|
||||
return R.ok().setData(configMapper.toVO(configEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除", notes = "根据url的id来指定删除对象")
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public R deleteConfigById(@PathVariable String id) {
|
||||
configService.deleteConfigById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除", notes = "根据url的ids来批量删除对象")
|
||||
@ApiImplicitParam(name = "ids", value = "ID集合", required = true, dataType = "List", paramType = "path")
|
||||
@DeleteMapping("/batch/{ids}")
|
||||
public R deleteConfigBatch(@PathVariable List<String> ids) {
|
||||
configService.deleteConfigBatch(ids);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取参数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/key/{key}")
|
||||
public R getConfig(@PathVariable String key) {
|
||||
String val = configService.getConfig(key);
|
||||
return R.ok().setData(val);
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新参数缓存
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/refresh")
|
||||
public R refreshConfig() {
|
||||
configService.refreshConfig();
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package cn.datax.service.system.controller;
|
||||
|
||||
import cn.datax.common.core.R;
|
||||
import cn.datax.common.validate.ValidationGroups;
|
||||
import cn.datax.service.system.api.dto.DeptDto;
|
||||
import cn.datax.service.system.api.entity.DeptEntity;
|
||||
import cn.datax.service.system.api.vo.DeptVo;
|
||||
import cn.datax.service.system.mapstruct.DeptMapper;
|
||||
import cn.datax.service.system.service.DeptService;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.datax.common.base.BaseController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-09-04
|
||||
*/
|
||||
@Api(value="系统管理接口", tags = {"系统管理"})
|
||||
@RestController
|
||||
@RequestMapping("/depts")
|
||||
public class DeptController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private DeptService deptService;
|
||||
|
||||
@Autowired
|
||||
private DeptMapper deptMapper;
|
||||
|
||||
@ApiOperation(value = "获取部门详细信息", notes = "根据url的id来获取部门详细信息")
|
||||
@ApiImplicitParam(name = "id", value = "部门ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping("/{id}")
|
||||
public R getDeptById(@PathVariable String id) {
|
||||
DeptEntity deptEntity = deptService.getById(id);
|
||||
return R.ok().setData(deptMapper.toVO(deptEntity));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取部门列表", notes = "")
|
||||
@GetMapping("/list")
|
||||
public R getDeptList() {
|
||||
List<DeptEntity> list = deptService.list(Wrappers.emptyWrapper());
|
||||
List<DeptVo> collect = list.stream().map(deptMapper::toVO).collect(Collectors.toList());
|
||||
return R.ok().setData(collect);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "创建部门", notes = "根据dept对象创建部门")
|
||||
@ApiImplicitParam(name = "dept", value = "部门详细实体dept", required = true, dataType = "DeptDto")
|
||||
@PostMapping()
|
||||
public R saveDept(@RequestBody @Validated({ValidationGroups.Insert.class}) DeptDto dept) {
|
||||
DeptEntity deptEntity = deptService.saveDept(dept);
|
||||
return R.ok().setData(deptMapper.toVO(deptEntity));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新部门详细信息", notes = "根据url的id来指定更新对象,并根据传过来的dept信息来更新部门详细信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "部门ID", required = true, dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "dept", value = "部门详细实体dept", required = true, dataType = "DeptDto")
|
||||
})
|
||||
@PutMapping("/{id}")
|
||||
public R updateDept(@PathVariable String id, @RequestBody @Validated({ValidationGroups.Update.class}) DeptDto dept) {
|
||||
DeptEntity deptEntity = deptService.updateDept(dept);
|
||||
return R.ok().setData(deptMapper.toVO(deptEntity));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除部门", notes = "根据url的id来指定删除对象")
|
||||
@ApiImplicitParam(name = "id", value = "部门ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public R deleteDept(@PathVariable String id) {
|
||||
deptService.deleteDeptById(id);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
package cn.datax.service.system.controller;
|
||||
|
||||
import cn.datax.common.core.JsonPage;
|
||||
import cn.datax.common.core.R;
|
||||
import cn.datax.common.validate.ValidationGroups;
|
||||
import cn.datax.service.system.api.dto.DictDto;
|
||||
import cn.datax.service.system.api.entity.DictEntity;
|
||||
import cn.datax.service.system.api.entity.DictItemEntity;
|
||||
import cn.datax.service.system.api.vo.DictItemVo;
|
||||
import cn.datax.service.system.api.vo.DictVo;
|
||||
import cn.datax.service.system.api.query.DictQuery;
|
||||
import cn.datax.service.system.mapstruct.DictItemMapper;
|
||||
import cn.datax.service.system.mapstruct.DictMapper;
|
||||
import cn.datax.service.system.service.DictService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.datax.common.base.BaseController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典编码信息表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-04-17
|
||||
*/
|
||||
@Api(tags = {"字典编码信息表"})
|
||||
@RestController
|
||||
@RequestMapping("/dicts")
|
||||
public class DictController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private DictService dictService;
|
||||
|
||||
@Autowired
|
||||
private DictMapper dictMapper;
|
||||
|
||||
@Autowired
|
||||
private DictItemMapper dictItemMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取详细信息", notes = "根据url的id来获取详细信息")
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping("/{id}")
|
||||
public R getDictById(@PathVariable String id) {
|
||||
DictEntity dictEntity = dictService.getById(id);
|
||||
return R.ok().setData(dictMapper.toVO(dictEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询信息
|
||||
*
|
||||
* @param dictQuery
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "dictQuery", value = "查询实体dictQuery", required = true, dataTypeClass = DictQuery.class)
|
||||
})
|
||||
@GetMapping("/page")
|
||||
public R getDictPage(DictQuery dictQuery) {
|
||||
QueryWrapper<DictEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.like(StrUtil.isNotBlank(dictQuery.getDictName()), "dict_name", dictQuery.getDictName());
|
||||
queryWrapper.like(StrUtil.isNotBlank(dictQuery.getDictCode()), "dict_code", dictQuery.getDictCode());
|
||||
IPage<DictEntity> page = dictService.page(new Page<>(dictQuery.getPageNum(), dictQuery.getPageSize()), queryWrapper);
|
||||
List<DictVo> collect = page.getRecords().stream().map(dictMapper::toVO).collect(Collectors.toList());
|
||||
JsonPage<DictVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), collect);
|
||||
return R.ok().setData(jsonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param dict
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "添加信息", notes = "根据dict对象添加信息")
|
||||
@ApiImplicitParam(name = "dict", value = "详细实体dict", required = true, dataType = "DictDto")
|
||||
@PostMapping()
|
||||
public R saveDict(@RequestBody @Validated({ValidationGroups.Insert.class}) DictDto dict) {
|
||||
DictEntity dictEntity = dictService.saveDict(dict);
|
||||
return R.ok().setData(dictMapper.toVO(dictEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param dict
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "修改信息", notes = "根据url的id来指定修改对象,并根据传过来的信息来修改详细信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "dict", value = "详细实体dict", required = true, dataType = "DictDto")
|
||||
})
|
||||
@PutMapping("/{id}")
|
||||
public R updateDict(@PathVariable String id, @RequestBody @Validated({ValidationGroups.Update.class}) DictDto dict) {
|
||||
DictEntity dictEntity = dictService.updateDict(dict);
|
||||
return R.ok().setData(dictMapper.toVO(dictEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除", notes = "根据url的id来指定删除对象")
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public R deleteDictById(@PathVariable String id) {
|
||||
dictService.deleteDictById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除", notes = "根据url的ids来批量删除对象")
|
||||
@ApiImplicitParam(name = "ids", value = "ID集合", required = true, dataType = "List", paramType = "path")
|
||||
@DeleteMapping("/batch/{ids}")
|
||||
public R deleteDictBatch(@PathVariable List<String> ids) {
|
||||
dictService.deleteDictBatch(ids);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典项
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/code/{code}")
|
||||
public R getDictItems(@PathVariable String code) {
|
||||
List<DictItemEntity> list = dictService.getDictItems(code);
|
||||
List<DictItemVo> collect = list.stream().map(dictItemMapper::toVO).collect(Collectors.toList());
|
||||
return R.ok().setData(collect);
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新字典缓存
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/refresh")
|
||||
public R refreshDict() {
|
||||
dictService.refreshDict();
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package cn.datax.service.system.controller;
|
||||
|
||||
import cn.datax.common.core.JsonPage;
|
||||
import cn.datax.common.core.R;
|
||||
import cn.datax.common.validate.ValidationGroups;
|
||||
import cn.datax.service.system.api.dto.DictItemDto;
|
||||
import cn.datax.service.system.api.entity.DictItemEntity;
|
||||
import cn.datax.service.system.api.vo.DictItemVo;
|
||||
import cn.datax.service.system.api.query.DictItemQuery;
|
||||
import cn.datax.service.system.mapstruct.DictItemMapper;
|
||||
import cn.datax.service.system.service.DictItemService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.datax.common.base.BaseController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典项信息表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-04-17
|
||||
*/
|
||||
@Api(tags = {"字典项信息表"})
|
||||
@RestController
|
||||
@RequestMapping("/dict/items")
|
||||
public class DictItemController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private DictItemService dictItemService;
|
||||
|
||||
@Autowired
|
||||
private DictItemMapper dictItemMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取详细信息", notes = "根据url的id来获取详细信息")
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping("/{id}")
|
||||
public R getDictItemById(@PathVariable String id) {
|
||||
DictItemEntity dictItemEntity = dictItemService.getById(id);
|
||||
return R.ok().setData(dictItemMapper.toVO(dictItemEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询信息
|
||||
*
|
||||
* @param dictItemQuery
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "dictItemQuery", value = "查询实体dictItemQuery", required = true, dataTypeClass = DictItemQuery.class)
|
||||
})
|
||||
@GetMapping("/page")
|
||||
public R getDictItemPage(DictItemQuery dictItemQuery) {
|
||||
QueryWrapper<DictItemEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.like(StrUtil.isNotBlank(dictItemQuery.getItemText()), "item_text", dictItemQuery.getItemText());
|
||||
queryWrapper.like(StrUtil.isNotBlank(dictItemQuery.getItemValue()), "item_value", dictItemQuery.getItemValue());
|
||||
queryWrapper.eq(StrUtil.isNotBlank(dictItemQuery.getDictId()), "dict_id", dictItemQuery.getDictId());
|
||||
IPage<DictItemEntity> page = dictItemService.page(new Page<>(dictItemQuery.getPageNum(), dictItemQuery.getPageSize()), queryWrapper);
|
||||
List<DictItemVo> collect = page.getRecords().stream().map(dictItemMapper::toVO).collect(Collectors.toList());
|
||||
JsonPage<DictItemVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), collect);
|
||||
return R.ok().setData(jsonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param dictItem
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "添加信息", notes = "根据dictItem对象添加信息")
|
||||
@ApiImplicitParam(name = "dictItem", value = "详细实体dictItem", required = true, dataType = "DictItemDto")
|
||||
@PostMapping()
|
||||
public R saveDictItem(@RequestBody @Validated({ValidationGroups.Insert.class}) DictItemDto dictItem) {
|
||||
DictItemEntity dictItemEntity = dictItemService.saveDictItem(dictItem);
|
||||
return R.ok().setData(dictItemMapper.toVO(dictItemEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param dictItem
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "修改信息", notes = "根据url的id来指定修改对象,并根据传过来的信息来修改详细信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "dictItem", value = "详细实体dictItem", required = true, dataType = "DictItemDto")
|
||||
})
|
||||
@PutMapping("/{id}")
|
||||
public R updateDictItem(@PathVariable String id, @RequestBody @Validated({ValidationGroups.Update.class}) DictItemDto dictItem) {
|
||||
DictItemEntity dictItemEntity = dictItemService.updateDictItem(dictItem);
|
||||
return R.ok().setData(dictItemMapper.toVO(dictItemEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除", notes = "根据url的id来指定删除对象")
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public R deleteDictItemById(@PathVariable String id) {
|
||||
dictItemService.deleteDictItemById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除", notes = "根据url的ids来批量删除对象")
|
||||
@ApiImplicitParam(name = "ids", value = "ID集合", required = true, dataType = "List", paramType = "path")
|
||||
@DeleteMapping("/batch/{ids}")
|
||||
public R deleteDictItemBatch(@PathVariable List<String> ids) {
|
||||
dictItemService.deleteDictItemBatch(ids);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package cn.datax.service.system.controller;
|
||||
|
||||
import cn.datax.common.base.BaseController;
|
||||
import cn.datax.common.security.annotation.DataInner;
|
||||
import cn.datax.service.system.api.dto.LogDto;
|
||||
import cn.datax.service.system.async.AsyncTask;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/inner")
|
||||
public class InnerController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private AsyncTask asyncTask;
|
||||
|
||||
@DataInner
|
||||
@PostMapping("/logs")
|
||||
public void saveLog(@RequestBody LogDto log) {
|
||||
asyncTask.doTask(log);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package cn.datax.service.system.controller;
|
||||
|
||||
import cn.datax.common.base.BaseController;
|
||||
import cn.datax.common.core.JsonPage;
|
||||
import cn.datax.common.core.R;
|
||||
import cn.datax.service.system.api.entity.LogEntity;
|
||||
import cn.datax.service.system.api.query.LogQuery;
|
||||
import cn.datax.service.system.api.vo.LogVo;
|
||||
import cn.datax.service.system.mapstruct.LogMapper;
|
||||
import cn.datax.service.system.service.LogService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-09-04
|
||||
*/
|
||||
@Api(value="系统管理接口", tags = {"系统管理"})
|
||||
@RestController
|
||||
@RequestMapping("/logs")
|
||||
public class LogController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private LogService logService;
|
||||
|
||||
@Autowired
|
||||
private LogMapper logMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取详细信息", notes = "根据url的id来获取详细信息")
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping("/{id}")
|
||||
public R getLogById(@PathVariable String id) {
|
||||
LogEntity logEntity = logService.getLogById(id);
|
||||
return R.ok().setData(logMapper.toVO(logEntity));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "日志分页查询", notes = "")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "logQuery", value = "查询实体logQuery", required = true, dataTypeClass = LogQuery.class)
|
||||
})
|
||||
@GetMapping("/page")
|
||||
public R getLogPage(LogQuery logQuery) {
|
||||
QueryWrapper<LogEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.like(StrUtil.isNotBlank(logQuery.getTitle()), "title", logQuery.getTitle());
|
||||
queryWrapper.like(StrUtil.isNotBlank(logQuery.getModule()), "module", logQuery.getModule());
|
||||
queryWrapper.like(StrUtil.isNotBlank(logQuery.getUserName()), "user_name", logQuery.getUserName());
|
||||
IPage<LogEntity> page = logService.page(new Page<>(logQuery.getPageNum(), logQuery.getPageSize()), queryWrapper);
|
||||
List<LogVo> collect = page.getRecords().stream().map(logMapper::toVO).collect(Collectors.toList());
|
||||
JsonPage<LogVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), collect);
|
||||
return R.ok().setData(jsonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除", notes = "根据url的id来指定删除对象")
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public R deleteLogById(@PathVariable String id) {
|
||||
logService.deleteLogById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "批量删除角色", notes = "根据url的ids来批量删除对象")
|
||||
@ApiImplicitParam(name = "ids", value = "ID集合", required = true, dataType = "List", paramType = "path")
|
||||
@DeleteMapping("/batch/{ids}")
|
||||
public R deleteLogBatch(@PathVariable List<String> ids) {
|
||||
logService.deleteLogBatch(ids);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package cn.datax.service.system.controller;
|
||||
|
||||
import cn.datax.common.core.JsonPage;
|
||||
import cn.datax.common.core.R;
|
||||
import cn.datax.service.system.api.entity.LoginLogEntity;
|
||||
import cn.datax.service.system.api.vo.LoginLogVo;
|
||||
import cn.datax.service.system.api.query.LoginLogQuery;
|
||||
import cn.datax.service.system.mapstruct.LoginLogMapper;
|
||||
import cn.datax.service.system.service.LoginLogService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.datax.common.base.BaseController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 登录日志信息表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-05-29
|
||||
*/
|
||||
@Api(tags = {"登录日志信息表"})
|
||||
@RestController
|
||||
@RequestMapping("/login/logs")
|
||||
public class LoginLogController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private LoginLogService loginLogService;
|
||||
|
||||
@Autowired
|
||||
private LoginLogMapper loginLogMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取详细信息", notes = "根据url的id来获取详细信息")
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping("/{id}")
|
||||
public R getLoginLogById(@PathVariable String id) {
|
||||
LoginLogEntity loginLogEntity = loginLogService.getLoginLogById(id);
|
||||
return R.ok().setData(loginLogMapper.toVO(loginLogEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询信息
|
||||
*
|
||||
* @param loginLogQuery
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "loginLogQuery", value = "查询实体loginLogQuery", required = true, dataTypeClass = LoginLogQuery.class)
|
||||
})
|
||||
@GetMapping("/page")
|
||||
public R getLoginLogPage(LoginLogQuery loginLogQuery) {
|
||||
QueryWrapper<LoginLogEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.like(StrUtil.isNotBlank(loginLogQuery.getUserName()), "user_name", loginLogQuery.getUserName());
|
||||
IPage<LoginLogEntity> page = loginLogService.page(new Page<>(loginLogQuery.getPageNum(), loginLogQuery.getPageSize()), queryWrapper);
|
||||
List<LoginLogVo> collect = page.getRecords().stream().map(loginLogMapper::toVO).collect(Collectors.toList());
|
||||
JsonPage<LoginLogVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), collect);
|
||||
return R.ok().setData(jsonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加登录日志
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "添加信息", notes = "根据request对象添加信息")
|
||||
@PostMapping()
|
||||
public R loginLog(HttpServletRequest request) {
|
||||
loginLogService.saveLoginLog(request);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除", notes = "根据url的id来指定删除对象")
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public R deleteLoginLogById(@PathVariable String id) {
|
||||
loginLogService.deleteLoginLogById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "批量删除角色", notes = "根据url的ids来批量删除对象")
|
||||
@ApiImplicitParam(name = "ids", value = "ID集合", required = true, dataType = "List", paramType = "path")
|
||||
@DeleteMapping("/batch/{ids}")
|
||||
public R deleteLoginLogBatch(@PathVariable List<String> ids) {
|
||||
loginLogService.deleteLoginLogBatch(ids);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package cn.datax.service.system.controller;
|
||||
|
||||
import cn.datax.common.core.DataConstant;
|
||||
import cn.datax.common.core.R;
|
||||
import cn.datax.common.validate.ValidationGroups;
|
||||
import cn.datax.service.system.api.dto.MenuDto;
|
||||
import cn.datax.service.system.api.entity.MenuEntity;
|
||||
import cn.datax.service.system.api.entity.RoleEntity;
|
||||
import cn.datax.service.system.api.vo.MenuVo;
|
||||
import cn.datax.service.system.mapstruct.MenuMapper;
|
||||
import cn.datax.service.system.service.MenuService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.datax.common.base.BaseController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-09-11
|
||||
*/
|
||||
@Api(value="系统管理接口", tags = {"系统管理"})
|
||||
@RestController
|
||||
@RequestMapping("/menus")
|
||||
public class MenuController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
@Autowired
|
||||
private MenuMapper menuMapper;
|
||||
|
||||
@ApiOperation(value = "获取资源详细信息", notes = "根据url的id来获取资源详细信息")
|
||||
@ApiImplicitParam(name = "id", value = "资源ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping("/{id}")
|
||||
public R getMenuById(@PathVariable String id) {
|
||||
MenuEntity menuEntity = menuService.getById(id);
|
||||
return R.ok().setData(menuMapper.toVO(menuEntity));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取资源列表", notes = "")
|
||||
@GetMapping("/list")
|
||||
public R getMenuList() {
|
||||
List<MenuEntity> list = menuService.list(Wrappers.emptyWrapper());
|
||||
List<MenuVo> collect = list.stream().map(menuMapper::toVO).collect(Collectors.toList());
|
||||
return R.ok().setData(collect);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "创建资源", notes = "根据menu对象创建资源")
|
||||
@ApiImplicitParam(name = "menu", value = "资源详细实体menu", required = true, dataType = "MenuDto")
|
||||
@PostMapping()
|
||||
public R saveMenu(@RequestBody @Validated({ValidationGroups.Insert.class}) MenuDto menu) {
|
||||
MenuEntity menuEntity = menuService.saveMenu(menu);
|
||||
return R.ok().setData(menuMapper.toVO(menuEntity));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新资源详细信息", notes = "根据url的id来指定更新对象,并根据传过来的menu信息来更新资源详细信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "资源ID", required = true, dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "menu", value = "资源详细实体menu", required = true, dataType = "MenuDto")
|
||||
})
|
||||
@PutMapping("/{id}")
|
||||
public R updateMenu(@PathVariable String id, @RequestBody @Validated({ValidationGroups.Update.class}) MenuDto menu) {
|
||||
MenuEntity menuEntity = menuService.updateMenu(menu);
|
||||
return R.ok().setData(menuMapper.toVO(menuEntity));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除资源", notes = "根据url的id来指定删除对象")
|
||||
@ApiImplicitParam(name = "id", value = "资源ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public R deleteMenu(@PathVariable String id) {
|
||||
menuService.deleteMenuById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取工作流资源列表", notes = "")
|
||||
@GetMapping("/list/flow")
|
||||
public R getMenuListForFlow() {
|
||||
QueryWrapper<MenuEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("status", DataConstant.EnableState.ENABLE.getKey());
|
||||
queryWrapper.eq("menu_type", DataConstant.MenuType.MENU.getKey());
|
||||
queryWrapper.eq("menu_hidden", DataConstant.EnableState.DISABLE.getKey());
|
||||
queryWrapper.isNotNull("menu_code");
|
||||
List<MenuEntity> list = menuService.list(queryWrapper);
|
||||
List<MenuVo> collect = list.stream().map(menuMapper::toVO).collect(Collectors.toList());
|
||||
return R.ok().setData(collect);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
package cn.datax.service.system.controller;
|
||||
|
||||
import cn.datax.common.core.DataConstant;
|
||||
import cn.datax.common.core.JsonPage;
|
||||
import cn.datax.common.core.R;
|
||||
import cn.datax.common.validate.ValidationGroups;
|
||||
import cn.datax.service.system.api.dto.PostDto;
|
||||
import cn.datax.service.system.api.entity.PostEntity;
|
||||
import cn.datax.service.system.api.query.PostQuery;
|
||||
import cn.datax.service.system.api.vo.PostVo;
|
||||
import cn.datax.service.system.mapstruct.PostMapper;
|
||||
import cn.datax.service.system.service.PostService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.datax.common.base.BaseController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-09-11
|
||||
*/
|
||||
@Api(value="系统管理接口", tags = {"系统管理"})
|
||||
@RestController
|
||||
@RequestMapping("/posts")
|
||||
public class PostController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private PostService postService;
|
||||
|
||||
@Autowired
|
||||
private PostMapper postMapper;
|
||||
|
||||
@ApiOperation(value = "获取岗位详细信息", notes = "根据url的id来获取岗位详细信息")
|
||||
@ApiImplicitParam(name = "id", value = "岗位ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping("/{id}")
|
||||
public R getPostById(@PathVariable String id) {
|
||||
PostEntity postEntity = postService.getById(id);
|
||||
return R.ok().setData(postMapper.toVO(postEntity));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取岗位列表", notes = "")
|
||||
@GetMapping("/list")
|
||||
public R getPostList() {
|
||||
QueryWrapper<PostEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("status", DataConstant.EnableState.ENABLE.getKey());
|
||||
List<PostEntity> list = postService.list(queryWrapper);
|
||||
List<PostVo> collect = list.stream().map(postMapper::toVO).collect(Collectors.toList());
|
||||
return R.ok().setData(collect);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "岗位分页查询", notes = "")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "postQuery", value = "查询实体postQuery", required = true, dataTypeClass = PostQuery.class)
|
||||
})
|
||||
@GetMapping("/page")
|
||||
public R getPostPage(PostQuery postQuery) {
|
||||
QueryWrapper<PostEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.like(StrUtil.isNotBlank(postQuery.getPostName()), "post_name", postQuery.getPostName());
|
||||
IPage<PostEntity> page = postService.page(new Page<>(postQuery.getPageNum(), postQuery.getPageSize()), queryWrapper);
|
||||
List<PostVo> collect = page.getRecords().stream().map(postMapper::toVO).collect(Collectors.toList());
|
||||
JsonPage<PostVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), collect);
|
||||
return R.ok().setData(jsonPage);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "创建岗位", notes = "根据post对象创建岗位")
|
||||
@ApiImplicitParam(name = "post", value = "岗位详细实体post", required = true, dataType = "PostDto")
|
||||
@PostMapping()
|
||||
public R savePost(@RequestBody @Validated({ValidationGroups.Insert.class}) PostDto post) {
|
||||
PostEntity postEntity = postService.savePost(post);
|
||||
return R.ok().setData(postMapper.toVO(postEntity));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新岗位详细信息", notes = "根据url的id来指定更新对象,并根据传过来的post信息来更新岗位详细信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "岗位ID", required = true, dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "post", value = "岗位详细实体post", required = true, dataType = "PostDto")
|
||||
})
|
||||
@PutMapping("/{id}")
|
||||
public R updatePost(@PathVariable String id, @RequestBody @Validated({ValidationGroups.Update.class}) PostDto post) {
|
||||
PostEntity postEntity = postService.updatePost(post);
|
||||
return R.ok().setData(postMapper.toVO(postEntity));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除岗位", notes = "根据url的id来指定删除对象")
|
||||
@ApiImplicitParam(name = "id", value = "岗位ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public R deletePost(@PathVariable String id) {
|
||||
postService.deletePostById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除岗位", notes = "根据url的ids来批量删除对象")
|
||||
@ApiImplicitParam(name = "ids", value = "岗位ID集合", required = true, dataType = "List", paramType = "path")
|
||||
@DeleteMapping("/batch/{ids}")
|
||||
public R deletePostBatch(@PathVariable List<String> ids) {
|
||||
postService.deletePostBatch(ids);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
package cn.datax.service.system.controller;
|
||||
|
||||
import cn.datax.common.core.DataConstant;
|
||||
import cn.datax.common.core.JsonPage;
|
||||
import cn.datax.common.core.R;
|
||||
import cn.datax.common.validate.ValidationGroups;
|
||||
import cn.datax.service.system.api.dto.RoleDto;
|
||||
import cn.datax.service.system.api.entity.RoleEntity;
|
||||
import cn.datax.service.system.api.query.RoleQuery;
|
||||
import cn.datax.service.system.api.vo.RoleVo;
|
||||
import cn.datax.service.system.mapstruct.RoleMapper;
|
||||
import cn.datax.service.system.service.RoleService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.datax.common.base.BaseController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-09-04
|
||||
*/
|
||||
@Api(value="系统管理接口", tags = {"系统管理"})
|
||||
@RestController
|
||||
@RequestMapping("/roles")
|
||||
public class RoleController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private RoleMapper roleMapper;
|
||||
|
||||
@ApiOperation(value = "获取角色详细信息", notes = "根据url的id来获取角色详细信息")
|
||||
@ApiImplicitParam(name = "id", value = "角色ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping("/{id}")
|
||||
public R getRoleById(@PathVariable String id) {
|
||||
RoleEntity roleEntity = roleService.getById(id);
|
||||
return R.ok().setData(roleMapper.toVO(roleEntity));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取角色列表", notes = "")
|
||||
@GetMapping("/list")
|
||||
public R getPostList() {
|
||||
QueryWrapper<RoleEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("status", DataConstant.EnableState.ENABLE.getKey());
|
||||
List<RoleEntity> list = roleService.list(queryWrapper);
|
||||
List<RoleVo> collect = list.stream().map(roleMapper::toVO).collect(Collectors.toList());
|
||||
return R.ok().setData(collect);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "角色分页查询", notes = "")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "roleQuery", value = "查询实体roleQuery", required = true, dataTypeClass = RoleQuery.class)
|
||||
})
|
||||
@GetMapping("/page")
|
||||
public R getRolePage(RoleQuery roleQuery) {
|
||||
QueryWrapper<RoleEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.like(StrUtil.isNotBlank(roleQuery.getRoleName()), "role_name", roleQuery.getRoleName());
|
||||
IPage<RoleEntity> page = roleService.page(new Page<>(roleQuery.getPageNum(), roleQuery.getPageSize()), queryWrapper);
|
||||
List<RoleVo> collect = page.getRecords().stream().map(roleMapper::toVO).collect(Collectors.toList());
|
||||
JsonPage<RoleVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), collect);
|
||||
return R.ok().setData(jsonPage);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "创建角色", notes = "根据role对象创建角色")
|
||||
@ApiImplicitParam(name = "role", value = "角色详细实体role", required = true, dataType = "RoleDto")
|
||||
@PostMapping()
|
||||
public R saveRole(@RequestBody @Validated({ValidationGroups.Insert.class}) RoleDto role) {
|
||||
RoleEntity roleEntity = roleService.saveRole(role);
|
||||
return R.ok().setData(roleMapper.toVO(roleEntity));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新角色详细信息", notes = "根据url的id来指定更新对象,并根据传过来的role信息来更新角色详细信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "角色ID", required = true, dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "role", value = "角色详细实体role", required = true, dataType = "RoleDto")
|
||||
})
|
||||
@PutMapping("/{id}")
|
||||
public R updateRole(@PathVariable String id, @RequestBody @Validated({ValidationGroups.Update.class}) RoleDto role) {
|
||||
RoleEntity roleEntity = roleService.updateRole(role);
|
||||
return R.ok().setData(roleMapper.toVO(roleEntity));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除角色", notes = "根据url的id来指定删除对象")
|
||||
@ApiImplicitParam(name = "id", value = "角色ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public R deleteRole(@PathVariable String id) {
|
||||
roleService.deleteRoleById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除角色", notes = "根据url的ids来批量删除对象")
|
||||
@ApiImplicitParam(name = "ids", value = "角色ID集合", required = true, dataType = "List", paramType = "path")
|
||||
@DeleteMapping("/batch/{ids}")
|
||||
public R deletePostBatch(@PathVariable List<String> ids) {
|
||||
roleService.deleteRoleBatch(ids);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.datax.service.system.dao;
|
||||
|
||||
import cn.datax.common.base.BaseDao;
|
||||
import cn.datax.service.system.api.entity.ConfigEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统参数配置信息表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-05-19
|
||||
*/
|
||||
@Mapper
|
||||
public interface ConfigDao extends BaseDao<ConfigEntity> {
|
||||
|
||||
/**
|
||||
* 查询有效参数集合
|
||||
*
|
||||
* @return
|
||||
* @param status
|
||||
*/
|
||||
List<ConfigEntity> queryConfigList(@Param("status") String status);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.datax.service.system.dao;
|
||||
|
||||
import cn.datax.common.base.BaseDao;
|
||||
import cn.datax.service.system.api.entity.DeptEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-09-04
|
||||
*/
|
||||
@Mapper
|
||||
public interface DeptDao extends BaseDao<DeptEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.datax.service.system.dao;
|
||||
|
||||
import cn.datax.service.system.api.entity.DeptRelationEntity;
|
||||
import cn.datax.common.base.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门关系表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-11-22
|
||||
*/
|
||||
@Mapper
|
||||
public interface DeptRelationDao extends BaseDao<DeptRelationEntity> {
|
||||
|
||||
void insertBatch(List<DeptRelationEntity> list);
|
||||
|
||||
void deleteByAncestor(String id);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.datax.service.system.dao;
|
||||
|
||||
import cn.datax.common.base.BaseDao;
|
||||
import cn.datax.service.system.api.entity.DictEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典编码信息表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-04-17
|
||||
*/
|
||||
@Mapper
|
||||
public interface DictDao extends BaseDao<DictEntity> {
|
||||
|
||||
/**
|
||||
* 查询有效字典集合
|
||||
*
|
||||
* @return
|
||||
* @param status
|
||||
*/
|
||||
List<DictEntity> queryDictList(@Param("status") String status);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.datax.service.system.dao;
|
||||
|
||||
import cn.datax.common.base.BaseDao;
|
||||
import cn.datax.service.system.api.entity.DictItemEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典项信息表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-04-17
|
||||
*/
|
||||
@Mapper
|
||||
public interface DictItemDao extends BaseDao<DictItemEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.datax.service.system.dao;
|
||||
|
||||
import cn.datax.common.base.BaseDao;
|
||||
import cn.datax.service.system.api.entity.LogEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-11-19
|
||||
*/
|
||||
@Mapper
|
||||
public interface LogDao extends BaseDao<LogEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.datax.service.system.dao;
|
||||
|
||||
import cn.datax.common.base.BaseDao;
|
||||
import cn.datax.service.system.api.entity.LoginLogEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 登录日志信息表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-05-29
|
||||
*/
|
||||
@Mapper
|
||||
public interface LoginLogDao extends BaseDao<LoginLogEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.datax.service.system.dao;
|
||||
|
||||
import cn.datax.service.system.api.entity.MenuEntity;
|
||||
import cn.datax.common.base.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-09-11
|
||||
*/
|
||||
@Mapper
|
||||
public interface MenuDao extends BaseDao<MenuEntity> {
|
||||
|
||||
List<MenuEntity> selectMenuByRoleIds(@Param("roleIds") List<String> roleIds);
|
||||
|
||||
List<MenuEntity> selectMenuByUserId(@Param("userId") String userId);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.datax.service.system.dao;
|
||||
|
||||
import cn.datax.service.system.api.entity.PostEntity;
|
||||
import cn.datax.common.base.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-09-11
|
||||
*/
|
||||
@Mapper
|
||||
public interface PostDao extends BaseDao<PostEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package cn.datax.service.system.dao;
|
||||
|
||||
import cn.datax.common.base.BaseDao;
|
||||
import cn.datax.service.system.api.entity.RoleEntity;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-09-04
|
||||
*/
|
||||
@Mapper
|
||||
public interface RoleDao extends BaseDao<RoleEntity> {
|
||||
|
||||
@Override
|
||||
RoleEntity selectById(Serializable id);
|
||||
|
||||
@Override
|
||||
<E extends IPage<RoleEntity>> E selectPage(E page, @Param(Constants.WRAPPER) Wrapper<RoleEntity> queryWrapper);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package cn.datax.service.system.dao;
|
||||
|
||||
import cn.datax.service.system.api.entity.RoleDeptEntity;
|
||||
import cn.datax.common.base.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色和部门关联表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-11-22
|
||||
*/
|
||||
@Mapper
|
||||
public interface RoleDeptDao extends BaseDao<RoleDeptEntity> {
|
||||
|
||||
void insertBatch(List<RoleDeptEntity> list);
|
||||
|
||||
void deleteByRoleId(String id);
|
||||
|
||||
void deleteByRoleIds(List<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package cn.datax.service.system.dao;
|
||||
|
||||
import cn.datax.service.system.api.entity.RoleMenuEntity;
|
||||
import cn.datax.common.base.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-09-11
|
||||
*/
|
||||
@Mapper
|
||||
public interface RoleMenuDao extends BaseDao<RoleMenuEntity> {
|
||||
|
||||
void insertBatch(List<RoleMenuEntity> list);
|
||||
|
||||
void deleteByRoleId(String id);
|
||||
|
||||
void deleteByRoleIds(List<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package cn.datax.service.system.dao;
|
||||
|
||||
import cn.datax.service.system.api.entity.UserPostEntity;
|
||||
import cn.datax.common.base.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-09-11
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserPostDao extends BaseDao<UserPostEntity> {
|
||||
|
||||
void insertBatch(List<UserPostEntity> list);
|
||||
|
||||
void deleteByUserId(String id);
|
||||
|
||||
void deleteByUserIds(List<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package cn.datax.service.system.dao;
|
||||
|
||||
import cn.datax.common.base.BaseDao;
|
||||
import cn.datax.service.system.api.entity.UserRoleEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-09-04
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserRoleDao extends BaseDao<UserRoleEntity> {
|
||||
|
||||
void insertBatch(List<UserRoleEntity> list);
|
||||
|
||||
void deleteByUserId(String id);
|
||||
|
||||
void deleteByUserIds(List<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.datax.service.system.mapstruct;
|
||||
|
||||
import cn.datax.common.mapstruct.EntityMapper;
|
||||
import cn.datax.service.system.api.dto.ConfigDto;
|
||||
import cn.datax.service.system.api.entity.ConfigEntity;
|
||||
import cn.datax.service.system.api.vo.ConfigVo;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统参数配置信息表 Mapper 实体映射
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-05-19
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface ConfigMapper extends EntityMapper<ConfigDto, ConfigEntity, ConfigVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package cn.datax.service.system.mapstruct;
|
||||
|
||||
import cn.datax.common.mapstruct.EntityMapper;
|
||||
import cn.datax.service.system.api.dto.DeptDto;
|
||||
import cn.datax.service.system.api.entity.DeptEntity;
|
||||
import cn.datax.service.system.api.vo.DeptVo;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface DeptMapper extends EntityMapper<DeptDto, DeptEntity, DeptVo> {
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.datax.service.system.mapstruct;
|
||||
|
||||
import cn.datax.common.mapstruct.EntityMapper;
|
||||
import cn.datax.service.system.api.dto.DictItemDto;
|
||||
import cn.datax.service.system.api.entity.DictItemEntity;
|
||||
import cn.datax.service.system.api.vo.DictItemVo;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典项信息表 Mapper 实体映射
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-04-17
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface DictItemMapper extends EntityMapper<DictItemDto, DictItemEntity, DictItemVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.datax.service.system.mapstruct;
|
||||
|
||||
import cn.datax.common.mapstruct.EntityMapper;
|
||||
import cn.datax.service.system.api.dto.DictDto;
|
||||
import cn.datax.service.system.api.entity.DictEntity;
|
||||
import cn.datax.service.system.api.vo.DictVo;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典编码信息表 Mapper 实体映射
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-04-17
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface DictMapper extends EntityMapper<DictDto, DictEntity, DictVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package cn.datax.service.system.mapstruct;
|
||||
|
||||
import cn.datax.common.mapstruct.EntityMapper;
|
||||
import cn.datax.service.system.api.dto.LogDto;
|
||||
import cn.datax.service.system.api.entity.LogEntity;
|
||||
import cn.datax.service.system.api.vo.LogVo;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface LogMapper extends EntityMapper<LogDto, LogEntity, LogVo> {
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.datax.service.system.mapstruct;
|
||||
|
||||
import cn.datax.common.mapstruct.EntityMapper;
|
||||
import cn.datax.service.system.api.dto.LoginLogDto;
|
||||
import cn.datax.service.system.api.entity.LoginLogEntity;
|
||||
import cn.datax.service.system.api.vo.LoginLogVo;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 登录日志信息表 Mapper 实体映射
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-05-29
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface LoginLogMapper extends EntityMapper<LoginLogDto, LoginLogEntity, LoginLogVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package cn.datax.service.system.mapstruct;
|
||||
|
||||
import cn.datax.common.mapstruct.EntityMapper;
|
||||
import cn.datax.service.system.api.dto.MenuDto;
|
||||
import cn.datax.service.system.api.entity.MenuEntity;
|
||||
import cn.datax.service.system.api.vo.MenuVo;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface MenuMapper extends EntityMapper<MenuDto, MenuEntity, MenuVo> {
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package cn.datax.service.system.mapstruct;
|
||||
|
||||
import cn.datax.common.mapstruct.EntityMapper;
|
||||
import cn.datax.service.system.api.dto.PostDto;
|
||||
import cn.datax.service.system.api.entity.PostEntity;
|
||||
import cn.datax.service.system.api.vo.PostVo;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface PostMapper extends EntityMapper<PostDto, PostEntity, PostVo> {
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package cn.datax.service.system.mapstruct;
|
||||
|
||||
import cn.datax.common.mapstruct.EntityMapper;
|
||||
import cn.datax.service.system.api.dto.RoleDto;
|
||||
import cn.datax.service.system.api.entity.RoleEntity;
|
||||
import cn.datax.service.system.api.vo.RoleVo;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface RoleMapper extends EntityMapper<RoleDto, RoleEntity, RoleVo> {
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package cn.datax.service.system.service;
|
||||
|
||||
import cn.datax.service.system.api.dto.ConfigDto;
|
||||
import cn.datax.service.system.api.entity.ConfigEntity;
|
||||
import cn.datax.common.base.BaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统参数配置信息表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-05-19
|
||||
*/
|
||||
public interface ConfigService extends BaseService<ConfigEntity> {
|
||||
|
||||
ConfigEntity saveConfig(ConfigDto sysConfig);
|
||||
|
||||
ConfigEntity updateConfig(ConfigDto sysConfig);
|
||||
|
||||
ConfigEntity getConfigById(String id);
|
||||
|
||||
void deleteConfigById(String id);
|
||||
|
||||
void deleteConfigBatch(List<String> ids);
|
||||
|
||||
String getConfig(String key);
|
||||
|
||||
void refreshConfig();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package cn.datax.service.system.service;
|
||||
|
||||
import cn.datax.common.base.BaseService;
|
||||
import cn.datax.service.system.api.dto.DeptDto;
|
||||
import cn.datax.service.system.api.entity.DeptEntity;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-09-04
|
||||
*/
|
||||
public interface DeptService extends BaseService<DeptEntity> {
|
||||
|
||||
DeptEntity saveDept(DeptDto dept);
|
||||
|
||||
DeptEntity updateDept(DeptDto dept);
|
||||
|
||||
void deleteDeptById(String id);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package cn.datax.service.system.service;
|
||||
|
||||
import cn.datax.service.system.api.entity.DictItemEntity;
|
||||
import cn.datax.service.system.api.dto.DictItemDto;
|
||||
import cn.datax.common.base.BaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典项信息表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-04-17
|
||||
*/
|
||||
public interface DictItemService extends BaseService<DictItemEntity> {
|
||||
|
||||
DictItemEntity saveDictItem(DictItemDto dictItem);
|
||||
|
||||
DictItemEntity updateDictItem(DictItemDto dictItem);
|
||||
|
||||
void deleteDictItemById(String id);
|
||||
|
||||
void deleteDictItemBatch(List<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package cn.datax.service.system.service;
|
||||
|
||||
import cn.datax.service.system.api.entity.DictEntity;
|
||||
import cn.datax.service.system.api.dto.DictDto;
|
||||
import cn.datax.common.base.BaseService;
|
||||
import cn.datax.service.system.api.entity.DictItemEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典编码信息表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-04-17
|
||||
*/
|
||||
public interface DictService extends BaseService<DictEntity> {
|
||||
|
||||
DictEntity saveDict(DictDto dict);
|
||||
|
||||
DictEntity updateDict(DictDto dict);
|
||||
|
||||
void deleteDictById(String id);
|
||||
|
||||
void deleteDictBatch(List<String> ids);
|
||||
|
||||
List<DictItemEntity> getDictItems(String code);
|
||||
|
||||
void refreshDict();
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package cn.datax.service.system.service;
|
||||
|
||||
import cn.datax.common.base.BaseService;
|
||||
import cn.datax.service.system.api.dto.LogDto;
|
||||
import cn.datax.service.system.api.entity.LogEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-11-19
|
||||
*/
|
||||
public interface LogService extends BaseService<LogEntity> {
|
||||
|
||||
void saveLog(LogDto log);
|
||||
|
||||
LogEntity getLogById(String id);
|
||||
|
||||
void deleteLogById(String id);
|
||||
|
||||
void deleteLogBatch(List<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package cn.datax.service.system.service;
|
||||
|
||||
import cn.datax.service.system.api.entity.LoginLogEntity;
|
||||
import cn.datax.common.base.BaseService;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 登录日志信息表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-05-29
|
||||
*/
|
||||
public interface LoginLogService extends BaseService<LoginLogEntity> {
|
||||
|
||||
void saveLoginLog(HttpServletRequest request);
|
||||
|
||||
LoginLogEntity getLoginLogById(String id);
|
||||
|
||||
void deleteLoginLogById(String id);
|
||||
|
||||
void deleteLoginLogBatch(List<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package cn.datax.service.system.service;
|
||||
|
||||
import cn.datax.service.system.api.dto.MenuDto;
|
||||
import cn.datax.service.system.api.entity.MenuEntity;
|
||||
import cn.datax.common.base.BaseService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-09-11
|
||||
*/
|
||||
public interface MenuService extends BaseService<MenuEntity> {
|
||||
|
||||
MenuEntity saveMenu(MenuDto menu);
|
||||
|
||||
MenuEntity updateMenu(MenuDto menu);
|
||||
|
||||
void deleteMenuById(String id);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package cn.datax.service.system.service;
|
||||
|
||||
import cn.datax.service.system.api.dto.PostDto;
|
||||
import cn.datax.service.system.api.entity.PostEntity;
|
||||
import cn.datax.common.base.BaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-09-11
|
||||
*/
|
||||
public interface PostService extends BaseService<PostEntity> {
|
||||
|
||||
PostEntity savePost(PostDto post);
|
||||
|
||||
PostEntity updatePost(PostDto post);
|
||||
|
||||
void deletePostById(String id);
|
||||
|
||||
void deletePostBatch(List<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package cn.datax.service.system.service;
|
||||
|
||||
import cn.datax.common.base.BaseService;
|
||||
import cn.datax.service.system.api.dto.RoleDto;
|
||||
import cn.datax.service.system.api.entity.RoleEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-09-04
|
||||
*/
|
||||
public interface RoleService extends BaseService<RoleEntity> {
|
||||
|
||||
RoleEntity saveRole(RoleDto role);
|
||||
|
||||
RoleEntity updateRole(RoleDto role);
|
||||
|
||||
void deleteRoleById(String id);
|
||||
|
||||
void deleteRoleBatch(List<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package cn.datax.service.system.service.impl;
|
||||
|
||||
import cn.datax.common.core.DataConstant;
|
||||
import cn.datax.common.core.RedisConstant;
|
||||
import cn.datax.common.redis.service.RedisService;
|
||||
import cn.datax.service.system.api.dto.ConfigDto;
|
||||
import cn.datax.service.system.api.entity.ConfigEntity;
|
||||
import cn.datax.service.system.service.ConfigService;
|
||||
import cn.datax.service.system.mapstruct.ConfigMapper;
|
||||
import cn.datax.service.system.dao.ConfigDao;
|
||||
import cn.datax.common.base.BaseServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统参数配置信息表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-05-19
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class ConfigServiceImpl extends BaseServiceImpl<ConfigDao, ConfigEntity> implements ConfigService {
|
||||
|
||||
@Autowired
|
||||
private ConfigDao configDao;
|
||||
|
||||
@Autowired
|
||||
private ConfigMapper configMapper;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ConfigEntity saveConfig(ConfigDto sysConfigDto) {
|
||||
ConfigEntity config = configMapper.toEntity(sysConfigDto);
|
||||
configDao.insert(config);
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ConfigEntity updateConfig(ConfigDto sysConfigDto) {
|
||||
ConfigEntity config = configMapper.toEntity(sysConfigDto);
|
||||
configDao.updateById(config);
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigEntity getConfigById(String id) {
|
||||
ConfigEntity configEntity = super.getById(id);
|
||||
return configEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteConfigById(String id) {
|
||||
configDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteConfigBatch(List<String> ids) {
|
||||
configDao.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConfig(String key) {
|
||||
Object o = redisService.hget(RedisConstant.SYSTEM_CONFIG_KEY, key);
|
||||
return (String) Optional.ofNullable(o).orElse("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshConfig() {
|
||||
String key = RedisConstant.SYSTEM_CONFIG_KEY;
|
||||
Boolean hasKey = redisService.hasKey(key);
|
||||
if (hasKey) {
|
||||
redisService.del(key);
|
||||
}
|
||||
List<ConfigEntity> configEntityList = configDao.queryConfigList(DataConstant.EnableState.ENABLE.getKey());
|
||||
Map<String, Object> map = configEntityList.stream().collect(Collectors.toMap(ConfigEntity::getConfigKey, ConfigEntity::getConfigValue));
|
||||
redisService.hmset(key, map);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package cn.datax.service.system.service.impl;
|
||||
|
||||
import cn.datax.common.exception.DataException;
|
||||
import cn.datax.service.system.api.dto.DeptDto;
|
||||
import cn.datax.service.system.api.entity.DeptEntity;
|
||||
import cn.datax.service.system.api.entity.DeptRelationEntity;
|
||||
import cn.datax.service.system.dao.DeptDao;
|
||||
import cn.datax.service.system.dao.DeptRelationDao;
|
||||
import cn.datax.service.system.mapstruct.DeptMapper;
|
||||
import cn.datax.service.system.service.DeptService;
|
||||
import cn.datax.common.base.BaseServiceImpl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-09-04
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class DeptServiceImpl extends BaseServiceImpl<DeptDao, DeptEntity> implements DeptService {
|
||||
|
||||
@Autowired
|
||||
private DeptDao deptDao;
|
||||
@Autowired
|
||||
private DeptRelationDao deptRelationDao;
|
||||
@Autowired
|
||||
private DeptMapper deptMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public DeptEntity saveDept(DeptDto deptDto) {
|
||||
DeptEntity dept = deptMapper.toEntity(deptDto);
|
||||
int n = deptDao.selectCount(Wrappers.<DeptEntity>lambdaQuery().eq(DeptEntity::getDeptName, dept.getDeptName()));
|
||||
if(n > 0){
|
||||
throw new DataException("该部门名已存在");
|
||||
}
|
||||
deptDao.insert(dept);
|
||||
insertBatchRelation(dept);
|
||||
return dept;
|
||||
}
|
||||
|
||||
private void insertBatchRelation(DeptEntity dept) {
|
||||
List<DeptRelationEntity> relationList = deptRelationDao
|
||||
.selectList(Wrappers.<DeptRelationEntity>lambdaQuery()
|
||||
.eq(DeptRelationEntity::getDescendant, dept.getParentId()))
|
||||
.stream().map(relation -> {
|
||||
relation.setDescendant(dept.getId());
|
||||
return relation;
|
||||
}).collect(Collectors.toList());
|
||||
DeptRelationEntity own = new DeptRelationEntity();
|
||||
own.setDescendant(dept.getId());
|
||||
own.setAncestor(dept.getId());
|
||||
relationList.add(own);
|
||||
if (CollUtil.isNotEmpty(relationList)) {
|
||||
deptRelationDao.insertBatch(relationList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public DeptEntity updateDept(DeptDto deptDto) {
|
||||
DeptEntity dept = deptMapper.toEntity(deptDto);
|
||||
deptDao.updateById(dept);
|
||||
deptRelationDao.delete(Wrappers.<DeptRelationEntity>lambdaQuery()
|
||||
.eq(DeptRelationEntity::getAncestor, dept.getId()));
|
||||
insertBatchRelation(dept);
|
||||
return dept;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteDeptById(String id) {
|
||||
int n = deptDao.selectCount(Wrappers.<DeptEntity>lambdaQuery().eq(DeptEntity::getParentId, id));
|
||||
if(n > 0){
|
||||
throw new DataException("该部门下存在子部门数据");
|
||||
}
|
||||
deptDao.deleteById(id);
|
||||
deptRelationDao.deleteByAncestor(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package cn.datax.service.system.service.impl;
|
||||
|
||||
import cn.datax.service.system.api.entity.DictItemEntity;
|
||||
import cn.datax.service.system.api.dto.DictItemDto;
|
||||
import cn.datax.service.system.service.DictItemService;
|
||||
import cn.datax.service.system.mapstruct.DictItemMapper;
|
||||
import cn.datax.service.system.dao.DictItemDao;
|
||||
import cn.datax.common.base.BaseServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典项信息表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-04-17
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class DictItemServiceImpl extends BaseServiceImpl<DictItemDao, DictItemEntity> implements DictItemService {
|
||||
|
||||
@Autowired
|
||||
private DictItemDao dictItemDao;
|
||||
|
||||
@Autowired
|
||||
private DictItemMapper dictItemMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public DictItemEntity saveDictItem(DictItemDto dictItemDto) {
|
||||
DictItemEntity dictItem = dictItemMapper.toEntity(dictItemDto);
|
||||
dictItemDao.insert(dictItem);
|
||||
return dictItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public DictItemEntity updateDictItem(DictItemDto dictItemDto) {
|
||||
DictItemEntity dictItem = dictItemMapper.toEntity(dictItemDto);
|
||||
dictItemDao.updateById(dictItem);
|
||||
return dictItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteDictItemById(String id) {
|
||||
dictItemDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteDictItemBatch(List<String> ids) {
|
||||
dictItemDao.deleteBatchIds(ids);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package cn.datax.service.system.service.impl;
|
||||
|
||||
import cn.datax.common.core.DataConstant;
|
||||
import cn.datax.common.core.RedisConstant;
|
||||
import cn.datax.common.exception.DataException;
|
||||
import cn.datax.common.redis.service.RedisService;
|
||||
import cn.datax.service.system.api.entity.DictEntity;
|
||||
import cn.datax.service.system.api.dto.DictDto;
|
||||
import cn.datax.service.system.api.entity.DictItemEntity;
|
||||
import cn.datax.service.system.service.DictService;
|
||||
import cn.datax.service.system.mapstruct.DictMapper;
|
||||
import cn.datax.service.system.dao.DictDao;
|
||||
import cn.datax.common.base.BaseServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典编码信息表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-04-17
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class DictServiceImpl extends BaseServiceImpl<DictDao, DictEntity> implements DictService {
|
||||
|
||||
@Autowired
|
||||
private DictDao dictDao;
|
||||
|
||||
@Autowired
|
||||
private DictMapper dictMapper;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public DictEntity saveDict(DictDto dictDto) {
|
||||
DictEntity dict = dictMapper.toEntity(dictDto);
|
||||
int n = dictDao.selectCount(Wrappers.<DictEntity>lambdaQuery().eq(DictEntity::getDictCode, dict.getDictCode()));
|
||||
if(n > 0){
|
||||
throw new DataException("该字典编码已存在");
|
||||
}
|
||||
dictDao.insert(dict);
|
||||
return dict;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public DictEntity updateDict(DictDto dictDto) {
|
||||
DictEntity dict = dictMapper.toEntity(dictDto);
|
||||
dictDao.updateById(dict);
|
||||
return dict;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteDictById(String id) {
|
||||
dictDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteDictBatch(List<String> ids) {
|
||||
dictDao.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictItemEntity> getDictItems(String code) {
|
||||
List<DictEntity> dictEntityList = (List<DictEntity>) redisService.get(RedisConstant.SYSTEM_DICT_KEY);
|
||||
Optional<DictEntity> dictEntityOptional = dictEntityList.stream().filter(s -> code.equals(s.getDictCode())).findFirst();
|
||||
if (dictEntityOptional.isPresent()) {
|
||||
return dictEntityOptional.get().getItems();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshDict() {
|
||||
String key = RedisConstant.SYSTEM_DICT_KEY;
|
||||
Boolean hasKey = redisService.hasKey(key);
|
||||
if (hasKey) {
|
||||
redisService.del(key);
|
||||
}
|
||||
List<DictEntity> dictEntityList = dictDao.queryDictList(DataConstant.EnableState.ENABLE.getKey());
|
||||
redisService.set(key, dictEntityList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package cn.datax.service.system.service.impl;
|
||||
|
||||
import cn.datax.service.system.api.dto.LogDto;
|
||||
import cn.datax.service.system.api.entity.LogEntity;
|
||||
import cn.datax.service.system.dao.LogDao;
|
||||
import cn.datax.service.system.mapstruct.LogMapper;
|
||||
import cn.datax.service.system.service.LogService;
|
||||
import cn.datax.common.base.BaseServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-11-19
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class LogServiceImpl extends BaseServiceImpl<LogDao, LogEntity> implements LogService {
|
||||
|
||||
@Autowired
|
||||
private LogDao logDao;
|
||||
@Autowired
|
||||
private LogMapper logMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveLog(LogDto logDto) {
|
||||
LogEntity log = logMapper.toEntity(logDto);
|
||||
logDao.insert(log);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LogEntity getLogById(String id) {
|
||||
LogEntity logEntity = super.getById(id);
|
||||
return logEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteLogById(String id) {
|
||||
logDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteLogBatch(List<String> ids) {
|
||||
logDao.deleteBatchIds(ids);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package cn.datax.service.system.service.impl;
|
||||
|
||||
import cn.datax.common.core.DataUser;
|
||||
import cn.datax.common.utils.IPUtil;
|
||||
import cn.datax.common.utils.SecurityUtil;
|
||||
import cn.datax.service.system.api.dto.JwtUserDto;
|
||||
import cn.datax.service.system.api.entity.LoginLogEntity;
|
||||
import cn.datax.service.system.service.LoginLogService;
|
||||
import cn.datax.service.system.mapstruct.LoginLogMapper;
|
||||
import cn.datax.service.system.dao.LoginLogDao;
|
||||
import cn.datax.common.base.BaseServiceImpl;
|
||||
import eu.bitwalker.useragentutils.UserAgent;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 登录日志信息表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-05-29
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class LoginLogServiceImpl extends BaseServiceImpl<LoginLogDao, LoginLogEntity> implements LoginLogService {
|
||||
|
||||
@Autowired
|
||||
private LoginLogDao loginLogDao;
|
||||
|
||||
@Autowired
|
||||
private LoginLogMapper loginLogMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveLoginLog(HttpServletRequest request) {
|
||||
String ip = IPUtil.getIpAddr(request);
|
||||
UserAgent userAgent = UserAgent.parseUserAgentString(request.getHeader("User-Agent"));
|
||||
String os = userAgent.getOperatingSystem().getName();
|
||||
String browser = userAgent.getBrowser().getName();
|
||||
JwtUserDto user = SecurityUtil.getDataUser();
|
||||
String username = user.getUsername();
|
||||
LoginLogEntity loginLog = new LoginLogEntity();
|
||||
loginLog.setOpIp(ip).setOpOs(os).setOpBrowser(browser).setUserId("test").setUserName(username).setOpDate(LocalDateTime.now());
|
||||
loginLogDao.insert(loginLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoginLogEntity getLoginLogById(String id) {
|
||||
LoginLogEntity loginLogEntity = super.getById(id);
|
||||
return loginLogEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteLoginLogById(String id) {
|
||||
loginLogDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteLoginLogBatch(List<String> ids) {
|
||||
loginLogDao.deleteBatchIds(ids);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package cn.datax.service.system.service.impl;
|
||||
|
||||
import cn.datax.common.exception.DataException;
|
||||
import cn.datax.service.system.api.dto.MenuDto;
|
||||
import cn.datax.service.system.api.entity.MenuEntity;
|
||||
import cn.datax.service.system.dao.MenuDao;
|
||||
import cn.datax.service.system.mapstruct.MenuMapper;
|
||||
import cn.datax.service.system.service.MenuService;
|
||||
import cn.datax.common.base.BaseServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-09-11
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class MenuServiceImpl extends BaseServiceImpl<MenuDao, MenuEntity> implements MenuService {
|
||||
|
||||
@Autowired
|
||||
private MenuDao menuDao;
|
||||
@Autowired
|
||||
private MenuMapper menuMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public MenuEntity saveMenu(MenuDto menuDto) {
|
||||
MenuEntity menu = menuMapper.toEntity(menuDto);
|
||||
menuDao.insert(menu);
|
||||
return menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public MenuEntity updateMenu(MenuDto menuDto) {
|
||||
MenuEntity menu = menuMapper.toEntity(menuDto);
|
||||
menuDao.updateById(menu);
|
||||
return menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteMenuById(String id) {
|
||||
int n = menuDao.selectCount(Wrappers.<MenuEntity>lambdaQuery().eq(MenuEntity::getParentId, id));
|
||||
if(n > 0){
|
||||
throw new DataException("该菜单下存在子菜单数据");
|
||||
}
|
||||
menuDao.deleteById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package cn.datax.service.system.service.impl;
|
||||
|
||||
import cn.datax.common.exception.DataException;
|
||||
import cn.datax.service.system.api.dto.PostDto;
|
||||
import cn.datax.service.system.api.entity.PostEntity;
|
||||
import cn.datax.service.system.dao.PostDao;
|
||||
import cn.datax.service.system.mapstruct.PostMapper;
|
||||
import cn.datax.service.system.service.PostService;
|
||||
import cn.datax.common.base.BaseServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-09-11
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class PostServiceImpl extends BaseServiceImpl<PostDao, PostEntity> implements PostService {
|
||||
|
||||
@Autowired
|
||||
private PostDao postDao;
|
||||
@Autowired
|
||||
private PostMapper postMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PostEntity savePost(PostDto postDto) {
|
||||
PostEntity post = postMapper.toEntity(postDto);
|
||||
int n = postDao.selectCount(Wrappers.<PostEntity>lambdaQuery().eq(PostEntity::getPostName, post.getPostName()));
|
||||
if(n > 0){
|
||||
throw new DataException("该岗位名已存在");
|
||||
}
|
||||
postDao.insert(post);
|
||||
return post;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public PostEntity updatePost(PostDto postDto) {
|
||||
PostEntity post = postMapper.toEntity(postDto);
|
||||
postDao.updateById(post);
|
||||
return post;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deletePostById(String id) {
|
||||
postDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deletePostBatch(List<String> ids) {
|
||||
postDao.deleteBatchIds(ids);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package cn.datax.service.system.service.impl;
|
||||
|
||||
import cn.datax.common.exception.DataException;
|
||||
import cn.datax.service.system.api.dto.RoleDto;
|
||||
import cn.datax.service.system.api.entity.RoleDeptEntity;
|
||||
import cn.datax.service.system.api.entity.RoleEntity;
|
||||
import cn.datax.service.system.api.entity.RoleMenuEntity;
|
||||
import cn.datax.service.system.dao.RoleDao;
|
||||
import cn.datax.service.system.dao.RoleDeptDao;
|
||||
import cn.datax.service.system.dao.RoleMenuDao;
|
||||
import cn.datax.service.system.mapstruct.RoleMapper;
|
||||
import cn.datax.service.system.service.RoleService;
|
||||
import cn.datax.common.base.BaseServiceImpl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author yuwei
|
||||
* @date 2022-09-04
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class RoleServiceImpl extends BaseServiceImpl<RoleDao, RoleEntity> implements RoleService {
|
||||
|
||||
@Autowired
|
||||
private RoleDao roleDao;
|
||||
@Autowired
|
||||
private RoleMenuDao roleMenuDao;
|
||||
@Autowired
|
||||
private RoleDeptDao roleDeptDao;
|
||||
@Autowired
|
||||
private RoleMapper roleMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public RoleEntity saveRole(RoleDto roleDto) {
|
||||
RoleEntity role = roleMapper.toEntity(roleDto);
|
||||
int n = roleDao.selectCount(Wrappers.<RoleEntity>lambdaQuery().eq(RoleEntity::getRoleName, role.getRoleName()));
|
||||
if(n > 0){
|
||||
throw new DataException("该角色名已存在");
|
||||
}
|
||||
roleDao.insert(role);
|
||||
if(CollUtil.isNotEmpty(roleDto.getMenuList())){
|
||||
insertBatchMenu(roleDto.getMenuList(), role.getId());
|
||||
}
|
||||
if(CollUtil.isNotEmpty(roleDto.getDeptList())){
|
||||
insertBatchDept(roleDto.getDeptList(), role.getId());
|
||||
}
|
||||
return role;
|
||||
}
|
||||
|
||||
private void insertBatchMenu(List<String> menus, String roleId) {
|
||||
List<RoleMenuEntity> roleMenuList = menus
|
||||
.stream().map(menuId -> {
|
||||
RoleMenuEntity roleMenu = new RoleMenuEntity();
|
||||
roleMenu.setRoleId(roleId);
|
||||
roleMenu.setMenuId(menuId);
|
||||
return roleMenu;
|
||||
}).collect(Collectors.toList());
|
||||
roleMenuDao.insertBatch(roleMenuList);
|
||||
}
|
||||
|
||||
private void insertBatchDept(List<String> depts, String roleId) {
|
||||
List<RoleDeptEntity> roleDeptList = depts
|
||||
.stream().map(deptId -> {
|
||||
RoleDeptEntity roleDept = new RoleDeptEntity();
|
||||
roleDept.setRoleId(roleId);
|
||||
roleDept.setDeptId(deptId);
|
||||
return roleDept;
|
||||
}).collect(Collectors.toList());
|
||||
roleDeptDao.insertBatch(roleDeptList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public RoleEntity updateRole(RoleDto roleDto) {
|
||||
RoleEntity role = roleMapper.toEntity(roleDto);
|
||||
roleDao.updateById(role);
|
||||
roleMenuDao.delete(Wrappers.<RoleMenuEntity>lambdaQuery()
|
||||
.eq(RoleMenuEntity::getRoleId, role.getId()));
|
||||
if(CollUtil.isNotEmpty(roleDto.getMenuList())){
|
||||
insertBatchMenu(roleDto.getMenuList(), role.getId());
|
||||
}
|
||||
roleDeptDao.delete(Wrappers.<RoleDeptEntity>lambdaQuery()
|
||||
.eq(RoleDeptEntity::getRoleId, role.getId()));
|
||||
if(CollUtil.isNotEmpty(roleDto.getDeptList())){
|
||||
insertBatchDept(roleDto.getDeptList(), role.getId());
|
||||
}
|
||||
return role;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteRoleById(String id) {
|
||||
roleMenuDao.deleteByRoleId(id);
|
||||
roleDeptDao.deleteByRoleId(id);
|
||||
roleDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteRoleBatch(List<String> ids) {
|
||||
roleMenuDao.deleteByRoleIds(ids);
|
||||
roleDeptDao.deleteByRoleIds(ids);
|
||||
roleDao.deleteBatchIds(ids);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
server:
|
||||
port: 8810
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: service-data-system
|
||||
profiles:
|
||||
active: dev
|
||||
cloud:
|
||||
config:
|
||||
label: master
|
||||
name: ${spring.application.name}
|
||||
profile: ${spring.profiles.active}
|
||||
discovery:
|
||||
enabled: true
|
||||
service-id: config
|
||||
|
||||
# 注册中心配置
|
||||
eureka:
|
||||
instance:
|
||||
lease-renewal-interval-in-seconds: 20
|
||||
# 设置使用IP
|
||||
prefer-ip-address: true
|
||||
# 设置外网IP号
|
||||
ip-address: 192.168.1.169
|
||||
client:
|
||||
register-with-eureka: true
|
||||
fetch-registry: true
|
||||
instance-info-replication-interval-seconds: 30
|
||||
registry-fetch-interval-seconds: 3
|
||||
service-url:
|
||||
defaultZone: http://192.168.1.169:8610/eureka
|
||||
Binary file not shown.
@@ -0,0 +1,260 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Created with Jaspersoft Studio version 6.9.0.final using JasperReports Library version 6.9.0-cb8f9004be492ccc537180b49c026951f4220bf3 -->
|
||||
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Blank_A4" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="38344e02-d6c7-4511-b933-c2fd86a66ab6">
|
||||
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
|
||||
<style name="Table_TH" mode="Opaque" backcolor="#F0F8FF">
|
||||
<box>
|
||||
<pen lineWidth="0.5" lineColor="#000000"/>
|
||||
<topPen lineWidth="0.5" lineColor="#000000"/>
|
||||
<leftPen lineWidth="0.5" lineColor="#000000"/>
|
||||
<bottomPen lineWidth="0.5" lineColor="#000000"/>
|
||||
<rightPen lineWidth="0.5" lineColor="#000000"/>
|
||||
</box>
|
||||
</style>
|
||||
<style name="Table_CH" mode="Opaque" backcolor="#BFE1FF">
|
||||
<box>
|
||||
<pen lineWidth="0.5" lineColor="#000000"/>
|
||||
<topPen lineWidth="0.5" lineColor="#000000"/>
|
||||
<leftPen lineWidth="0.5" lineColor="#000000"/>
|
||||
<bottomPen lineWidth="0.5" lineColor="#000000"/>
|
||||
<rightPen lineWidth="0.5" lineColor="#000000"/>
|
||||
</box>
|
||||
</style>
|
||||
<style name="Table_TD" mode="Opaque" backcolor="#FFFFFF">
|
||||
<box>
|
||||
<pen lineWidth="0.5" lineColor="#000000"/>
|
||||
<topPen lineWidth="0.5" lineColor="#000000"/>
|
||||
<leftPen lineWidth="0.5" lineColor="#000000"/>
|
||||
<bottomPen lineWidth="0.5" lineColor="#000000"/>
|
||||
<rightPen lineWidth="0.5" lineColor="#000000"/>
|
||||
</box>
|
||||
</style>
|
||||
<style name="Table 1_TH" mode="Opaque" backcolor="#F0F8FF">
|
||||
<box>
|
||||
<pen lineWidth="0.5" lineColor="#000000"/>
|
||||
<topPen lineWidth="0.5" lineColor="#000000"/>
|
||||
<leftPen lineWidth="0.5" lineColor="#000000"/>
|
||||
<bottomPen lineWidth="0.5" lineColor="#000000"/>
|
||||
<rightPen lineWidth="0.5" lineColor="#000000"/>
|
||||
</box>
|
||||
</style>
|
||||
<style name="Table 1_CH" mode="Opaque" backcolor="#BFE1FF">
|
||||
<box>
|
||||
<pen lineWidth="0.5" lineColor="#000000"/>
|
||||
<topPen lineWidth="0.5" lineColor="#000000"/>
|
||||
<leftPen lineWidth="0.5" lineColor="#000000"/>
|
||||
<bottomPen lineWidth="0.5" lineColor="#000000"/>
|
||||
<rightPen lineWidth="0.5" lineColor="#000000"/>
|
||||
</box>
|
||||
</style>
|
||||
<style name="Table 1_TD" mode="Opaque" backcolor="#FFFFFF">
|
||||
<box>
|
||||
<pen lineWidth="0.5" lineColor="#000000"/>
|
||||
<topPen lineWidth="0.5" lineColor="#000000"/>
|
||||
<leftPen lineWidth="0.5" lineColor="#000000"/>
|
||||
<bottomPen lineWidth="0.5" lineColor="#000000"/>
|
||||
<rightPen lineWidth="0.5" lineColor="#000000"/>
|
||||
</box>
|
||||
</style>
|
||||
<subDataset name="teachDataset" uuid="61f09c4c-6208-4e8e-91ec-58ea808b15d2">
|
||||
<queryString>
|
||||
<![CDATA[]]>
|
||||
</queryString>
|
||||
<field name="name" class="java.lang.String"/>
|
||||
<field name="job" class="java.lang.String"/>
|
||||
</subDataset>
|
||||
<subDataset name="studentDataset" uuid="a4321f7a-4629-42f5-86ea-942290d71273">
|
||||
<queryString>
|
||||
<![CDATA[]]>
|
||||
</queryString>
|
||||
<field name="name" class="java.lang.String"/>
|
||||
<field name="age" class="java.lang.String"/>
|
||||
<field name="sex" class="java.lang.String"/>
|
||||
</subDataset>
|
||||
<parameter name="teachList" class="java.util.List"/>
|
||||
<queryString>
|
||||
<![CDATA[]]>
|
||||
</queryString>
|
||||
<field name="grade" class="java.lang.String"/>
|
||||
<field name="studentList" class="java.util.List"/>
|
||||
<background>
|
||||
<band splitType="Stretch"/>
|
||||
</background>
|
||||
<title>
|
||||
<band height="100" splitType="Stretch">
|
||||
<staticText>
|
||||
<reportElement x="152" y="30" width="250" height="30" uuid="8bf85237-ab47-4d67-a6cb-9d8ba52749d7"/>
|
||||
<textElement textAlignment="Center" verticalAlignment="Middle">
|
||||
<font size="18" isBold="true"/>
|
||||
</textElement>
|
||||
<text><![CDATA[this is a title]]></text>
|
||||
</staticText>
|
||||
</band>
|
||||
</title>
|
||||
<pageHeader>
|
||||
<band height="110" splitType="Stretch">
|
||||
<componentElement>
|
||||
<reportElement x="10" y="40" width="410" height="60" uuid="2e1994ce-15a4-42c5-ac3f-67e6fb6c4a4e">
|
||||
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
|
||||
<property name="com.jaspersoft.studio.table.style.table_header" value="Table_TH"/>
|
||||
<property name="com.jaspersoft.studio.table.style.column_header" value="Table_CH"/>
|
||||
<property name="com.jaspersoft.studio.table.style.detail" value="Table_TD"/>
|
||||
</reportElement>
|
||||
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
|
||||
<datasetRun subDataset="teachDataset" uuid="c9528920-36a7-4ff0-8bae-17543c2d6e43">
|
||||
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($P{teachList})]]></dataSourceExpression>
|
||||
</datasetRun>
|
||||
<jr:column width="200" uuid="c288893e-544d-42ee-9ace-4561619ee17a">
|
||||
<jr:columnHeader style="Table_CH" height="30">
|
||||
<staticText>
|
||||
<reportElement x="0" y="0" width="200" height="30" uuid="1eb4a56e-1c0b-4826-bb71-b087090b5405"/>
|
||||
<textElement>
|
||||
<font fontName="微软雅黑" size="16"/>
|
||||
</textElement>
|
||||
<text><![CDATA[name]]></text>
|
||||
</staticText>
|
||||
</jr:columnHeader>
|
||||
<jr:detailCell style="Table_TD" height="30">
|
||||
<textField>
|
||||
<reportElement x="0" y="0" width="200" height="30" uuid="3b533ed6-eaf9-45a9-a8d8-83b5bec89a40"/>
|
||||
<textElement>
|
||||
<font fontName="微软雅黑" size="16"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
|
||||
</textField>
|
||||
</jr:detailCell>
|
||||
</jr:column>
|
||||
<jr:column width="200" uuid="05c82473-70e0-4ae1-b62e-1d6c56f6526e">
|
||||
<jr:columnHeader style="Table_CH" height="30">
|
||||
<staticText>
|
||||
<reportElement x="0" y="0" width="200" height="30" uuid="0c644eb6-98e0-4313-a6e2-f66e3dfa1c7b"/>
|
||||
<textElement>
|
||||
<font fontName="微软雅黑" size="16"/>
|
||||
</textElement>
|
||||
<text><![CDATA[job]]></text>
|
||||
</staticText>
|
||||
</jr:columnHeader>
|
||||
<jr:detailCell style="Table_TD" height="30">
|
||||
<textField>
|
||||
<reportElement x="0" y="0" width="200" height="30" uuid="c93b1e9c-a2c0-4057-b78f-9f7128f00f82"/>
|
||||
<textElement>
|
||||
<font fontName="微软雅黑" size="16"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$F{job}]]></textFieldExpression>
|
||||
</textField>
|
||||
</jr:detailCell>
|
||||
</jr:column>
|
||||
</jr:table>
|
||||
</componentElement>
|
||||
<staticText>
|
||||
<reportElement x="10" y="5" width="120" height="30" uuid="74f13250-da6c-4161-82a9-1c78ad0cc711"/>
|
||||
<textElement>
|
||||
<font fontName="微软雅黑" size="18"/>
|
||||
</textElement>
|
||||
<text><![CDATA[教师信息:]]></text>
|
||||
</staticText>
|
||||
</band>
|
||||
</pageHeader>
|
||||
<detail>
|
||||
<band height="124" splitType="Stretch">
|
||||
<componentElement>
|
||||
<reportElement x="10" y="48" width="555" height="70" uuid="3978dd9b-61f1-4d9f-a193-a9440617a405">
|
||||
<property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
|
||||
<property name="com.jaspersoft.studio.table.style.table_header" value="Table 1_TH"/>
|
||||
<property name="com.jaspersoft.studio.table.style.column_header" value="Table 1_CH"/>
|
||||
<property name="com.jaspersoft.studio.table.style.detail" value="Table 1_TD"/>
|
||||
</reportElement>
|
||||
<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
|
||||
<datasetRun subDataset="studentDataset" uuid="1b899de9-4598-4e98-bb1d-5ccca8806500">
|
||||
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{studentList})]]></dataSourceExpression>
|
||||
</datasetRun>
|
||||
<jr:column width="150" uuid="d1d6b41e-2f6c-448e-8e69-91d90af3ef35">
|
||||
<jr:columnHeader style="Table 1_CH" height="30">
|
||||
<staticText>
|
||||
<reportElement x="0" y="0" width="150" height="30" uuid="d4afdf7e-c21f-465d-aa89-b7a5bd6cfbba"/>
|
||||
<textElement>
|
||||
<font fontName="微软雅黑" size="16"/>
|
||||
</textElement>
|
||||
<text><![CDATA[name]]></text>
|
||||
</staticText>
|
||||
</jr:columnHeader>
|
||||
<jr:detailCell style="Table 1_TD" height="30">
|
||||
<textField>
|
||||
<reportElement x="0" y="0" width="150" height="30" uuid="1125b5da-51c5-4788-862e-c1bcf44ba925"/>
|
||||
<textElement>
|
||||
<font fontName="微软雅黑" size="16"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
|
||||
</textField>
|
||||
</jr:detailCell>
|
||||
</jr:column>
|
||||
<jr:column width="150" uuid="c2436b06-a277-4734-b20f-9267abd4fbc1">
|
||||
<jr:columnHeader style="Table 1_CH" height="30">
|
||||
<staticText>
|
||||
<reportElement x="0" y="0" width="150" height="30" uuid="c96df6f3-a619-40c1-800b-7c2da2d2b213"/>
|
||||
<textElement>
|
||||
<font fontName="微软雅黑" size="16"/>
|
||||
</textElement>
|
||||
<text><![CDATA[age]]></text>
|
||||
</staticText>
|
||||
</jr:columnHeader>
|
||||
<jr:detailCell style="Table 1_TD" height="30">
|
||||
<textField>
|
||||
<reportElement x="0" y="0" width="150" height="30" uuid="5f2b3646-1123-483a-ad59-88861acd135a"/>
|
||||
<textElement>
|
||||
<font fontName="微软雅黑" size="16"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$F{age}]]></textFieldExpression>
|
||||
</textField>
|
||||
</jr:detailCell>
|
||||
</jr:column>
|
||||
<jr:column width="150" uuid="deaa1801-4fde-4772-aec8-51d400cd1586">
|
||||
<jr:columnHeader style="Table 1_CH" height="30">
|
||||
<staticText>
|
||||
<reportElement x="0" y="0" width="150" height="30" uuid="7c1afdae-8253-47c4-b9bd-5109db184890"/>
|
||||
<textElement>
|
||||
<font fontName="微软雅黑" size="16"/>
|
||||
</textElement>
|
||||
<text><![CDATA[sex]]></text>
|
||||
</staticText>
|
||||
</jr:columnHeader>
|
||||
<jr:detailCell style="Table 1_TD" height="30">
|
||||
<textField>
|
||||
<reportElement x="0" y="0" width="150" height="30" uuid="85644613-99dc-4f84-ae2e-079a67fbebc5"/>
|
||||
<textElement>
|
||||
<font fontName="微软雅黑" size="16"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$F{sex}]]></textFieldExpression>
|
||||
</textField>
|
||||
</jr:detailCell>
|
||||
</jr:column>
|
||||
</jr:table>
|
||||
</componentElement>
|
||||
<textField>
|
||||
<reportElement x="10" y="10" width="180" height="30" uuid="ee364a60-3c8a-46b4-80f1-7dd628c0085e"/>
|
||||
<textElement>
|
||||
<font fontName="微软雅黑" size="18"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[$F{grade}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</detail>
|
||||
<pageFooter>
|
||||
<band height="52" splitType="Stretch">
|
||||
<textField>
|
||||
<reportElement x="360" y="12" width="87" height="30" uuid="ab37f0ef-5d4e-42d4-b86e-e1b0196951d3"/>
|
||||
<textElement textAlignment="Right">
|
||||
<font size="14"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA["Page " + $V{PAGE_NUMBER}]]></textFieldExpression>
|
||||
</textField>
|
||||
<textField evaluationTime="Report">
|
||||
<reportElement x="447" y="12" width="83" height="30" uuid="e0459980-6d52-4d16-adda-b63d5bc4423b"/>
|
||||
<textElement textAlignment="Left">
|
||||
<font size="14"/>
|
||||
</textElement>
|
||||
<textFieldExpression><![CDATA[" of " + $V{PAGE_NUMBER}]]></textFieldExpression>
|
||||
</textField>
|
||||
</band>
|
||||
</pageFooter>
|
||||
</jasperReport>
|
||||
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<springProperty scope="context" name="springAppName" source="spring.application.name"/>
|
||||
<property name="log.path" value="logs/datax-service-system"/>
|
||||
<property name="log.maxHistory" value="15"/>
|
||||
<property name="log.totalSizeCap" value="500MB"/>
|
||||
<property name="log.maxFileSize" value="10MB"/>
|
||||
<property name="log.colorPattern"
|
||||
value="%magenta(%d{yyyy-MM-dd HH:mm:ss}) %highlight(%-5level) %boldCyan(${springAppName:-}) %yellow(%thread) %green(%logger) %msg%n"/>
|
||||
<property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5level ${springAppName:-} %thread %logger %msg%n"/>
|
||||
|
||||
<!--输出到控制台-->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.colorPattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--输出到文件-->
|
||||
<!-- RollingFileAppender:滚动记录文件,先将日志记录到指定文件,当符合某个条件时,将日志记录到其他文件 -->
|
||||
<!-- 以下的大概意思是:1.先按日期存日志,日期变了,将前一天的日志文件名重命名为XXX%日期%索引,新的日志仍然是project_info.log -->
|
||||
<!-- 2.如果日期没有发生变化,但是当前日志的文件大小超过10MB时,对当前日志进行分割 重命名-->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!--日志文件路径和名称-->
|
||||
<File>${log.path}/info/info.log</File>
|
||||
<!--是否追加到文件末尾,默认为true-->
|
||||
<append>true</append>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!-- 日志文件的名字会根据fileNamePattern的值,每隔一段时间改变一次 -->
|
||||
<!-- 文件名:logs/project_info.2017-12-05.0.log -->
|
||||
<!-- 注意:SizeAndTimeBasedRollingPolicy中 %i和%d令牌都是强制性的,必须存在,要不会报错 -->
|
||||
<fileNamePattern>${log.path}/info/info.%d.%i.log</fileNamePattern>
|
||||
<!-- 每产生一个日志文件,该日志文件的保存期限为30天, ps:maxHistory的单位是根据fileNamePattern中的翻转策略自动推算出来的,例如上面选用了yyyy-MM-dd,则单位为天
|
||||
如果上面选用了yyyy-MM,则单位为月,另外上面的单位默认为yyyy-MM-dd-->
|
||||
<MaxHistory>${log.maxHistory}</MaxHistory>
|
||||
<!-- 每个日志文件到2mb的时候开始切分,最多保留30天,但最大到500MB,哪怕没到30天也要删除多余的日志 -->
|
||||
<totalSizeCap>${log.totalSizeCap}</totalSizeCap>
|
||||
<!-- maxFileSize:这是活动文件的大小,默认值是10MB,测试时可改成5KB看效果 -->
|
||||
<maxFileSize>${log.maxFileSize}</maxFileSize>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>INFO</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<File>${log.path}/error/error.log</File>
|
||||
<append>true</append>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/error/error.%d.%i.log</fileNamePattern>
|
||||
<MaxHistory>${log.maxHistory}</MaxHistory>
|
||||
<totalSizeCap>${log.totalSizeCap}</totalSizeCap>
|
||||
<maxFileSize>${log.maxFileSize}</maxFileSize>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>ERROR</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<root level="debug">
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info"/>
|
||||
<appender-ref ref="file_error"/>
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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="cn.datax.service.system.dao.ConfigDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.datax.service.system.api.entity.ConfigEntity">
|
||||
<result column="id" property="id" />
|
||||
<result column="status" property="status" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="remark" property="remark" />
|
||||
<result column="config_name" property="configName" />
|
||||
<result column="config_key" property="configKey" />
|
||||
<result column="config_value" property="configValue" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
status,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
remark, config_name, config_key, config_value
|
||||
</sql>
|
||||
|
||||
<select id="queryConfigList" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List"/>
|
||||
FROM sys_market_config
|
||||
WHERE status = #{status}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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="cn.datax.service.system.dao.DeptDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.datax.service.system.api.entity.DeptEntity">
|
||||
<result column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="parent_id" property="parentId" />
|
||||
<result column="dept_name" property="deptName" />
|
||||
<result column="dept_no" property="deptNo" />
|
||||
<result column="status" property="status" />
|
||||
<result column="remark" property="remark" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
parent_id, dept_name, dept_no, status, remark
|
||||
</sql>
|
||||
|
||||
<sql id="Dept_Column_List">
|
||||
${alias}.id,
|
||||
${alias}.create_by,
|
||||
${alias}.create_time,
|
||||
${alias}.update_by,
|
||||
${alias}.update_time,
|
||||
${alias}.parent_id, ${alias}.dept_name, ${alias}.dept_no, ${alias}.status, ${alias}.remark
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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="cn.datax.service.system.dao.DeptRelationDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.datax.service.system.api.entity.DeptRelationEntity">
|
||||
<result column="id" property="id" />
|
||||
<result column="ancestor" property="ancestor" />
|
||||
<result column="descendant" property="descendant" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
ancestor, descendant
|
||||
</sql>
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List">
|
||||
INSERT INTO sys_market_dept_relation
|
||||
(id, ancestor, descendant)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.id}, #{item.ancestor}, #{item.descendant})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByAncestor">
|
||||
DELETE FROM sys_market_dept_relation WHERE ancestor = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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="cn.datax.service.system.dao.DictItemDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.datax.service.system.api.entity.DictItemEntity">
|
||||
<result column="id" property="id" />
|
||||
<result column="status" property="status" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="dict_id" property="dictId" />
|
||||
<result column="item_text" property="itemText" />
|
||||
<result column="item_value" property="itemValue" />
|
||||
<result column="item_sort" property="itemSort" />
|
||||
<result column="remark" property="remark" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
status,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
dict_id, item_text, item_value, item_sort, remark
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?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="cn.datax.service.system.dao.DictDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.datax.service.system.api.entity.DictEntity">
|
||||
<result column="id" property="id" />
|
||||
<result column="status" property="status" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="dict_name" property="dictName" />
|
||||
<result column="dict_code" property="dictCode" />
|
||||
<result column="remark" property="remark" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
status,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
dict_name, dict_code, remark
|
||||
</sql>
|
||||
|
||||
<resultMap id="QueryDictResultMap" type="cn.datax.service.system.api.entity.DictEntity" extends="BaseResultMap">
|
||||
<collection property="items" javaType="java.util.ArrayList" ofType="cn.datax.service.system.api.entity.DictItemEntity">
|
||||
<id column="item_id" property="id"/>
|
||||
<result column="dict_id" property="dictId"/>
|
||||
<result column="item_text" property="itemText"/>
|
||||
<result column="item_value" property="itemValue"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<select id="queryDictList" resultMap="QueryDictResultMap">
|
||||
SELECT d.id, d.dict_name, d.dict_code,
|
||||
i.id as item_id, i.dict_id, i.item_text, i.item_value
|
||||
FROM sys_market_dict d
|
||||
LEFT JOIN sys_market_dict_item i ON d.id = i.dict_id AND i.status = #{status}
|
||||
WHERE d.status = #{status}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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="cn.datax.service.system.dao.LogDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.datax.service.system.api.entity.LogEntity">
|
||||
<result column="id" property="id" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="module" property="module" />
|
||||
<result column="title" property="title" />
|
||||
<result column="user_id" property="userId" />
|
||||
<result column="user_name" property="userName" />
|
||||
<result column="remote_addr" property="remoteAddr" />
|
||||
<result column="request_uri" property="requestUri" />
|
||||
<result column="class_name" property="className" />
|
||||
<result column="method_name" property="methodName" />
|
||||
<result column="params" property="params" />
|
||||
<result column="time" property="time" />
|
||||
<result column="browser" property="browser" />
|
||||
<result column="os" property="os" />
|
||||
<result column="ex_code" property="exCode" />
|
||||
<result column="ex_msg" property="exMsg" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
create_time,
|
||||
module, title, user_id, user_name, remote_addr, request_uri, class_name, method_name, params, time, browser, os, ex_code, ex_msg
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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="cn.datax.service.system.dao.LoginLogDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.datax.service.system.api.entity.LoginLogEntity">
|
||||
<result column="id" property="id" />
|
||||
<result column="op_os" property="opOs" />
|
||||
<result column="op_browser" property="opBrowser" />
|
||||
<result column="op_ip" property="opIp" />
|
||||
<result column="op_date" property="opDate" />
|
||||
<result column="user_id" property="userId" />
|
||||
<result column="user_name" property="userName" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
op_os, op_browser, op_ip, op_date, user_id, user_name
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,71 @@
|
||||
<?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="cn.datax.service.system.dao.MenuDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.datax.service.system.api.entity.MenuEntity">
|
||||
<result column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="parent_id" property="parentId" />
|
||||
<result column="menu_name" property="menuName" />
|
||||
<result column="menu_path" property="menuPath" />
|
||||
<result column="menu_component" property="menuComponent" />
|
||||
<result column="menu_redirect" property="menuRedirect" />
|
||||
<result column="menu_perms" property="menuPerms" />
|
||||
<result column="menu_icon" property="menuIcon" />
|
||||
<result column="menu_type" property="menuType" />
|
||||
<result column="menu_code" property="menuCode" />
|
||||
<result column="menu_sort" property="menuSort" />
|
||||
<result column="menu_hidden" property="menuHidden" />
|
||||
<result column="status" property="status" />
|
||||
<result column="remark" property="remark" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
parent_id, menu_name, menu_path, menu_component, menu_redirect, menu_perms, menu_icon, menu_type, menu_code, menu_sort, menu_hidden, status, remark
|
||||
</sql>
|
||||
|
||||
<sql id="Menu_Column_List">
|
||||
${alias}.id,
|
||||
${alias}.create_by,
|
||||
${alias}.create_time,
|
||||
${alias}.update_by,
|
||||
${alias}.update_time,
|
||||
${alias}.parent_id, ${alias}.menu_name, ${alias}.menu_path, ${alias}.menu_component, ${alias}.menu_redirect, ${alias}.menu_perms,
|
||||
${alias}.menu_icon, ${alias}.menu_type, ${alias}.menu_code, ${alias}.menu_sort, ${alias}.menu_hidden, ${alias}.status, ${alias}.remark
|
||||
</sql>
|
||||
|
||||
<select id="selectMenuByRoleIds" parameterType="java.util.List" resultMap="BaseResultMap">
|
||||
SELECT DISTINCT
|
||||
<include refid="Menu_Column_List"><property name="alias" value="m"/></include>
|
||||
FROM
|
||||
sys_market_menu m
|
||||
LEFT JOIN sys_market_role_menu rm ON m.id = rm.menu_id
|
||||
WHERE m.status = 1 AND rm.role_id IN
|
||||
<foreach collection="roleIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
ORDER BY m.menu_sort ASC
|
||||
</select>
|
||||
|
||||
<select id="selectMenuByUserId" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
SELECT DISTINCT
|
||||
<include refid="Menu_Column_List"><property name="alias" value="m"/></include>
|
||||
FROM
|
||||
sys_market_menu m
|
||||
LEFT JOIN sys_market_role_menu rm ON m.id = rm.menu_id
|
||||
LEFT JOIN sys_market_user_role ur ON rm.role_id = ur.role_id
|
||||
WHERE m.status = 1 AND ur.user_id = #{userId}
|
||||
ORDER BY m.menu_sort ASC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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="cn.datax.service.system.dao.PostDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.datax.service.system.api.entity.PostEntity">
|
||||
<result column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="post_name" property="postName" />
|
||||
<result column="status" property="status" />
|
||||
<result column="remark" property="remark" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
post_name, status, remark
|
||||
</sql>
|
||||
|
||||
<sql id="Post_Column_List">
|
||||
${alias}.id,
|
||||
${alias}.create_by,
|
||||
${alias}.create_time,
|
||||
${alias}.update_by,
|
||||
${alias}.update_time,
|
||||
${alias}.post_name, ${alias}.status, ${alias}.remark
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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="cn.datax.service.system.dao.RoleDeptDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.datax.service.system.api.entity.RoleDeptEntity">
|
||||
<result column="id" property="id" />
|
||||
<result column="role_id" property="roleId" />
|
||||
<result column="dept_id" property="deptId" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
role_id, dept_id
|
||||
</sql>
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List">
|
||||
INSERT INTO sys_market_role_dept
|
||||
(id, role_id, dept_id)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.id}, #{item.roleId}, #{item.deptId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByRoleId">
|
||||
DELETE FROM sys_market_role_dept WHERE role_id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByRoleIds">
|
||||
DELETE FROM sys_market_role_dept WHERE role_id IN
|
||||
<foreach collection='list' item='id' open='(' separator=',' close=')'>
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,83 @@
|
||||
<?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="cn.datax.service.system.dao.RoleDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.datax.service.system.api.entity.RoleEntity">
|
||||
<result column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="role_name" property="roleName" />
|
||||
<result column="role_code" property="roleCode" />
|
||||
<result column="data_scope" property="dataScope" />
|
||||
<result column="status" property="status" />
|
||||
<result column="remark" property="remark" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="ExtendResultMap" type="cn.datax.service.system.api.entity.RoleEntity" extends="BaseResultMap">
|
||||
<collection property="depts" column="{roleId=id}" select="getDeptList"></collection>
|
||||
<collection property="menus" column="{roleId=id}" select="getMenuList"></collection>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
role_name, role_code, data_scope, status, remark
|
||||
</sql>
|
||||
|
||||
<sql id="Role_Column_List">
|
||||
${alias}.id,
|
||||
${alias}.create_by,
|
||||
${alias}.create_time,
|
||||
${alias}.update_by,
|
||||
${alias}.update_time,
|
||||
${alias}.role_name, ${alias}.role_code, ${alias}.data_scope, ${alias}.status, ${alias}.remark
|
||||
</sql>
|
||||
|
||||
<select id="getDeptList" resultType="cn.datax.service.system.api.entity.DeptEntity">
|
||||
SELECT
|
||||
<include refid="cn.datax.service.system.dao.DeptDao.Dept_Column_List">
|
||||
<property name="alias" value="d"/>
|
||||
</include>
|
||||
FROM sys_market_dept d
|
||||
LEFT JOIN sys_market_role_dept rd ON d.id = rd.dept_id
|
||||
WHERE 1 = 1 AND d.status = 1
|
||||
<if test="null != roleId and '' != roleId">
|
||||
AND rd.role_id = #{roleId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getMenuList" resultType="cn.datax.service.system.api.entity.MenuEntity">
|
||||
SELECT
|
||||
<include refid="cn.datax.service.system.dao.MenuDao.Menu_Column_List">
|
||||
<property name="alias" value="m"/>
|
||||
</include>
|
||||
FROM sys_market_menu m
|
||||
LEFT JOIN sys_market_role_menu rm ON m.id = rm.menu_id
|
||||
WHERE 1 = 1 AND m.status = 1
|
||||
<if test="null != roleId and '' != roleId">
|
||||
AND rm.role_id = #{roleId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultMap="ExtendResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM sys_market_role
|
||||
WHERE 1 = 1 AND id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"></include>
|
||||
FROM sys_market_role
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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="cn.datax.service.system.dao.RoleMenuDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.datax.service.system.api.entity.RoleMenuEntity">
|
||||
<result column="id" property="id" />
|
||||
<result column="role_id" property="roleId" />
|
||||
<result column="menu_id" property="menuId" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
role_id, menu_id
|
||||
</sql>
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List">
|
||||
INSERT INTO sys_market_role_menu
|
||||
(id, role_id, menu_id)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.id}, #{item.roleId}, #{item.menuId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByRoleId">
|
||||
DELETE FROM sys_market_role_menu WHERE role_id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByRoleIds">
|
||||
DELETE FROM sys_market_role_menu WHERE role_id in
|
||||
<foreach collection='list' item='id' open='(' separator=',' close=')'>
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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="cn.datax.service.system.dao.UserPostDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.datax.service.system.api.entity.UserPostEntity">
|
||||
<result column="id" property="id" />
|
||||
<result column="user_id" property="userId" />
|
||||
<result column="post_id" property="postId" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
user_id, post_id
|
||||
</sql>
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List">
|
||||
INSERT INTO sys_market_user_post
|
||||
(id, user_id, post_id)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.id}, #{item.userId}, #{item.postId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByUserId">
|
||||
DELETE FROM sys_market_user_post WHERE user_id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByUserIds">
|
||||
DELETE FROM sys_market_user_post WHERE user_id in
|
||||
<foreach collection='list' item='id' open='(' separator=',' close=')'>
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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="cn.datax.service.system.dao.UserRoleDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.datax.service.system.api.entity.UserRoleEntity">
|
||||
<result column="id" property="id" />
|
||||
<result column="user_id" property="userId" />
|
||||
<result column="role_id" property="roleId" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
user_id, role_id
|
||||
</sql>
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List">
|
||||
INSERT INTO sys_market_user_role
|
||||
(id, user_id, role_id)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.id}, #{item.userId}, #{item.roleId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByUserId">
|
||||
DELETE FROM sys_market_user_role WHERE user_id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByUserIds">
|
||||
DELETE FROM sys_market_user_role WHERE user_id in
|
||||
<foreach collection='list' item='id' open='(' separator=',' close=')'>
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,25 @@
|
||||
module.log=com.p6spy.engine.logging.P6LogFactory,com.p6spy.engine.outage.P6OutageFactory
|
||||
# 自定义日志打印
|
||||
logMessageFormat=com.baomidou.mybatisplus.extension.p6spy.P6SpyLogger
|
||||
#日志输出到控制台
|
||||
appender=com.baomidou.mybatisplus.extension.p6spy.StdoutLogger
|
||||
# 使用日志系统记录 sql
|
||||
#appender=com.p6spy.engine.spy.appender.Slf4JLogger
|
||||
# 设置 p6spy driver 代理
|
||||
deregisterdrivers=true
|
||||
# 取消JDBC URL前缀
|
||||
useprefix=true
|
||||
# 配置记录 Log 例外,可去掉的结果集有error,info,batch,debug,statement,commit,rollback,result,resultset.
|
||||
excludecategories=info,debug,result,batch,resultset
|
||||
# 日期格式
|
||||
dateformat=yyyy-MM-dd HH:mm:ss
|
||||
# 实际驱动可多个
|
||||
#driverlist=org.h2.Driver
|
||||
# 是否开启慢SQL记录
|
||||
outagedetection=true
|
||||
# 慢SQL记录标准 2 秒
|
||||
outagedetectioninterval=2
|
||||
# 开启过滤
|
||||
filter=true
|
||||
# 配置不打印的内容
|
||||
exclude=select 1
|
||||
Reference in New Issue
Block a user