微服务版后端初始化
This commit is contained in:
170
xjrsoft-service/pom.xml
Normal file
170
xjrsoft-service/pom.xml
Normal file
@ -0,0 +1,170 @@
|
||||
<?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>xjrsoft-cloud</artifactId>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>xjrsoft-service</artifactId>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>xjrsoft-service-system</module>
|
||||
<module>xjrsoft-service-organization</module>
|
||||
<module>xjrsoft-service-desktop</module>
|
||||
<module>xjrsoft-service-generate</module>
|
||||
<module>xjrsoft-service-form</module>
|
||||
<module>xjrsoft-service-magicapi</module>
|
||||
<module>xjrsoft-service-app</module>
|
||||
<module>xjrsoft-service-bi</module>
|
||||
<module>xjrsoft-service-erp</module>
|
||||
<module>xjrsoft-service-workflow</module>
|
||||
<module>xjrsoft-service-demo</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<!--引入MyBatisPlus依赖-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--引入Mybatisplus 代码生成器依赖-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-generator</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 动态数据源 -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- Sa-Token 权限认证, 在线文档:http://sa-token.dev33.cn/ -->
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-common-satoken</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.dev33</groupId>
|
||||
<artifactId>sa-token-dao-redis-jackson</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-data-redis</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- Sa-Token 整合redis (使用jackson序列化方式) -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>cn.dev33</groupId>-->
|
||||
<!-- <artifactId>sa-token-dao-redis-jackson</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!--引入MySql依赖-->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- mybatis-plus 多表关联 -->
|
||||
<dependency>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 引入springboot jdbc依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!--引入nacos依赖-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!--引入spring-cloud-alibaba-nacos-config依赖-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--引入spring-cloud-alibaba-nacos-config bootstrap依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-bootstrap</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--引入sentinel依赖-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!--引入sentinel-datasource-nacos依赖-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.csp</groupId>
|
||||
<artifactId>sentinel-datasource-nacos</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
15
xjrsoft-service/xjrsoft-service-app/Dockerfile
Normal file
15
xjrsoft-service/xjrsoft-service-app/Dockerfile
Normal file
@ -0,0 +1,15 @@
|
||||
# 基础镜像
|
||||
FROM nexus.gdyditc.com:8082/openjdk:11-arm64
|
||||
# author
|
||||
MAINTAINER xjrsoft
|
||||
|
||||
# 挂载目录
|
||||
VOLUME /home/xjrsoft
|
||||
# 创建目录
|
||||
RUN mkdir -p /home/xjrsoft
|
||||
# 指定路径
|
||||
WORKDIR /home/xjrsoft
|
||||
# 复制jar文件到路径
|
||||
COPY ./target/xjrsoft-service-app.jar /home/xjrsoft/xjrsoft-service-app.jar
|
||||
# 启动认证服务
|
||||
ENTRYPOINT ["java","-jar","xjrsoft-service-app.jar","-Dfile.encoding=UTF-8"]
|
||||
69
xjrsoft-service/xjrsoft-service-app/pom.xml
Normal file
69
xjrsoft-service/xjrsoft-service-app/pom.xml
Normal file
@ -0,0 +1,69 @@
|
||||
<?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>xjrsoft-service</artifactId>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>xjrsoft-service-app</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-app-api</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-generate-api</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-system-api</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-common-mybatis</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-organization-api</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,24 @@
|
||||
package com.xjrsoft.app;
|
||||
|
||||
import com.xjrsoft.common.core.annotation.UniqueNameGenerator;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/20 10:49
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients(basePackages = "com.xjrsoft")
|
||||
@MapperScan(value = "com.xjrsoft.**.mapper")
|
||||
@ComponentScan(value = "com.xjrsoft", nameGenerator = UniqueNameGenerator.class)
|
||||
public class AppApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AppApplication.class, args);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package com.xjrsoft.app.client;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.app.dto.SetAppRoleAuthDto;
|
||||
import com.xjrsoft.app.entity.AppAuthorize;
|
||||
import com.xjrsoft.app.service.IAppAuthorizeService;
|
||||
import com.xjrsoft.app.vo.AppRoleAuthVo;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author hnyyzy
|
||||
* @version 1.0
|
||||
* @date 2024/1/24 15:30
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class AppAuthorizeClient implements IAppAuthorizeClient{
|
||||
|
||||
private final IAppAuthorizeService authorizeService;
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_APP_NAME + "/removeAppAuthorieFeign")
|
||||
public void removeAppAuthorieFeign(Long menuId) {
|
||||
|
||||
authorizeService.remove(Wrappers.<AppAuthorize>query().lambda().eq(AppAuthorize::getObjectId, menuId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置角色权限
|
||||
* @param
|
||||
*/
|
||||
@Override
|
||||
@PostMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_APP_NAME + "/setAppRoleAuthFeign")
|
||||
public Boolean setAppRoleAuthFeign(@RequestBody SetAppRoleAuthDto dto) {
|
||||
return authorizeService.setRoleAppAuth(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色权限
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_APP_NAME + "/getAppRoleAuthFeign")
|
||||
public AppRoleAuthVo getAppRoleAuthFeign(Long roleId) {
|
||||
return authorizeService.getRoleAppAuth(roleId);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
package com.xjrsoft.app.client;
|
||||
|
||||
import com.xjrsoft.app.entity.AppFuncDesign;
|
||||
import com.xjrsoft.app.service.IAppFuncDesignService;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/10 18:52
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class AppFuncDesignClient implements IAppFuncDesignClient {
|
||||
|
||||
private final IAppFuncDesignService funcDesignService;
|
||||
|
||||
/**
|
||||
* 根据关联id 获取app功能设计
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE + GlobalConstant.MODULE_APP_NAME + "/getAppFuncDesignFeign")
|
||||
public AppFuncDesign getAppFuncDesignFeign(Long id) {
|
||||
return funcDesignService.getById(id);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.xjrsoft.app.controller;
|
||||
|
||||
import com.xjrsoft.app.service.IAppAuthorizeService;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-12-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.APP_MODEL +"/app-authorize")
|
||||
@Tag(name = GlobalConstant.APP_MODEL +"/app-authorize", description = "app 权限模块")
|
||||
@AllArgsConstructor
|
||||
public class AppAuthorizeController {
|
||||
private final IAppAuthorizeService authorizeService;
|
||||
|
||||
@GetMapping("/app-menu-permissions")
|
||||
@Operation(summary="app用户菜单权限数据返回")
|
||||
public R appMenuPermissions(@RequestParam(required = false) Long menuId){
|
||||
return R.ok(authorizeService.getAppPermissions(menuId));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,130 @@
|
||||
package com.xjrsoft.app.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.yulichang.toolkit.MPJWrappers;
|
||||
import com.xjrsoft.app.dto.*;
|
||||
import com.xjrsoft.app.entity.AppFuncDesign;
|
||||
import com.xjrsoft.app.entity.AppMenu;
|
||||
import com.xjrsoft.app.service.IAppFuncDesignService;
|
||||
import com.xjrsoft.app.service.IAppMenuService;
|
||||
import com.xjrsoft.app.vo.AppFuncDesignPageVo;
|
||||
import com.xjrsoft.app.vo.AppFuncDesignVo;
|
||||
import com.xjrsoft.app.vo.AppMenuVo;
|
||||
import com.xjrsoft.common.core.annotation.XjrLog;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-07-26
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.APP_MODEL +"/func-design")
|
||||
@Tag(name = GlobalConstant.APP_MODEL +"/func-design", description = "app端功能页面设计")
|
||||
@AllArgsConstructor
|
||||
public class AppFuncDesignController {
|
||||
|
||||
private IAppFuncDesignService funcDesignService;
|
||||
|
||||
private IAppMenuService appMenuService;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "app端功能页面设计分页")
|
||||
public R page(AppFuncDesignPageDto dto) {
|
||||
|
||||
IPage<AppFuncDesignPageVo> page = funcDesignService.selectJoinListPage(ConventPage.getPage(dto), AppFuncDesignPageVo.class, MPJWrappers.<AppFuncDesign>lambdaJoin()
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()), AppMenu::getName, dto.getKeyword())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getEnabledMark()), AppFuncDesign::getEnabledMark, dto.getEnabledMark())
|
||||
.eq(dto.getFormType() != null, AppFuncDesign::getFormType, dto.getFormType())
|
||||
.select(AppFuncDesign::getId)
|
||||
.select(AppFuncDesign.class, x -> VoToColumnUtil.fieldsToColumns(AppFuncDesignPageVo.class).contains(x.getProperty()))
|
||||
.selectAs(AppMenu::getName, AppFuncDesignPageVo::getName)
|
||||
.selectAs(AppMenu::getRemark, AppFuncDesignPageVo::getMenuRemark)
|
||||
.leftJoin(AppMenu.class, AppMenu::getId, AppFuncDesign::getAppMenuId)
|
||||
.orderByDesc(AppFuncDesign::getCreateDate)
|
||||
);
|
||||
|
||||
PageOutput<AppFuncDesignPageVo> pageOutput = ConventPage.getPageOutput(page, AppFuncDesignPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增app端功能页面设计")
|
||||
public R add(@Valid @RequestBody AddFuncDesignDto dto) {
|
||||
return R.ok(funcDesignService.add(dto));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改app端功能页面设计")
|
||||
public R update(@Valid @RequestBody UpdateAppFuncDesignDto dto) {
|
||||
return R.ok(funcDesignService.modify(dto));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询数app端功能页面设计详细信息")
|
||||
public R info(@RequestParam Long id) {
|
||||
AppFuncDesign appFuncDesign = funcDesignService.getById(id);
|
||||
if (appFuncDesign == null) {
|
||||
return R.error("找不到此功能页面设计!");
|
||||
}
|
||||
AppFuncDesignVo appFuncDesignVo = BeanUtil.toBean(appFuncDesign, AppFuncDesignVo.class);
|
||||
AppMenu appMenu = appMenuService.getById(appFuncDesign.getAppMenuId());
|
||||
|
||||
appFuncDesignVo.setMenuConfigs(BeanUtil.toBean(appMenu, AppMenuVo.class));
|
||||
|
||||
|
||||
|
||||
return R.ok(appFuncDesignVo);
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@XjrLog(value = "删除app端展示页面设计")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R delete(@Valid @RequestBody DeleteAppPageDesignDto dto) {
|
||||
AppFuncDesign appFuncDesign = funcDesignService.getById(dto.getId());
|
||||
|
||||
appMenuService.removeById(appFuncDesign.getAppMenuId());
|
||||
|
||||
|
||||
funcDesignService.removeById(dto.getId());
|
||||
return R.ok(Boolean.TRUE);
|
||||
}
|
||||
|
||||
@PutMapping("/update-enable-mark")
|
||||
@Operation(summary = "修改启用状态")
|
||||
@XjrLog(value = "修改启用状态")
|
||||
public R updateEnableMark(@Valid @RequestBody UpdateEnableMarkDto dto) {
|
||||
AppFuncDesign appFuncDesign = new AppFuncDesign();
|
||||
appFuncDesign.setId(dto.getId());
|
||||
appFuncDesign.setEnabledMark(dto.getEnabledMark());
|
||||
funcDesignService.updateById(appFuncDesign);
|
||||
|
||||
AppFuncDesign one = funcDesignService.getOne(Wrappers.lambdaQuery(AppFuncDesign.class).eq(AppFuncDesign::getId, dto.getId()).select(AppFuncDesign::getAppMenuId));
|
||||
AppMenu appMenu = new AppMenu();
|
||||
appMenu.setId(one.getAppMenuId());
|
||||
appMenu.setEnabledMark(dto.getEnabledMark());
|
||||
appMenuService.updateById(appMenu);
|
||||
return R.ok(true);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,218 @@
|
||||
package com.xjrsoft.app.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.app.dto.AddAppMenuDto;
|
||||
import com.xjrsoft.app.dto.AppMenuListDto;
|
||||
import com.xjrsoft.app.dto.AppMenuPageDto;
|
||||
import com.xjrsoft.app.dto.UpdateAppMenuDto;
|
||||
import com.xjrsoft.app.entity.AppMenu;
|
||||
import com.xjrsoft.app.entity.AppMenuButton;
|
||||
import com.xjrsoft.app.entity.AppMenuColumn;
|
||||
import com.xjrsoft.app.entity.AppMenuForm;
|
||||
import com.xjrsoft.app.service.IAppMenuButtonService;
|
||||
import com.xjrsoft.app.service.IAppMenuColumnService;
|
||||
import com.xjrsoft.app.service.IAppMenuFormService;
|
||||
import com.xjrsoft.app.service.IAppMenuService;
|
||||
import com.xjrsoft.app.vo.AppMenuListVo;
|
||||
import com.xjrsoft.app.vo.AppMenuPageVo;
|
||||
import com.xjrsoft.app.vo.AppMenuSimpleTreeVo;
|
||||
import com.xjrsoft.app.vo.AppMenuVo;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.enums.EnabledMark;
|
||||
import com.xjrsoft.common.core.uitls.TreeUtil;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.system.client.IDictionaryDetailClient;
|
||||
import com.xjrsoft.system.dto.MenuTreeDto;
|
||||
import com.xjrsoft.system.entity.DictionaryDetail;
|
||||
import com.xjrsoft.system.vo.MenuButtonListVo;
|
||||
import com.xjrsoft.system.vo.MenuColumnListVo;
|
||||
import com.xjrsoft.system.vo.MenuFormListVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* app 菜单前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-07-26
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.APP_MODEL +"/menu")
|
||||
@Tag(name = GlobalConstant.APP_MODEL +"/menu", description = "app 菜单模块")
|
||||
@AllArgsConstructor
|
||||
public class AppMenuController {
|
||||
|
||||
private final IAppMenuService appMenuService;
|
||||
|
||||
private final IAppMenuButtonService appMenuButtonService;
|
||||
|
||||
private final IAppMenuColumnService appMenuColumnService;
|
||||
|
||||
private final IAppMenuFormService appMenuFormService;
|
||||
|
||||
private final IDictionaryDetailClient dictionaryDetailClient;
|
||||
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "app菜单分页接口")
|
||||
public R page(AppMenuPageDto dto){
|
||||
|
||||
LambdaQueryWrapper<AppMenu> queryWrapper = Wrappers.lambdaQuery(AppMenu.class)
|
||||
.eq(StrUtil.isNotBlank(dto.getName()), AppMenu::getName, dto.getName())
|
||||
.eq(StrUtil.isNotBlank(dto.getCode()), AppMenu::getCode, dto.getCode())
|
||||
.eq(ObjectUtil.isNotNull(dto.getCategoryId()), AppMenu::getCategoryId, dto.getCategoryId())
|
||||
.orderByAsc(AppMenu::getSortCode)
|
||||
.select(AppMenu.class, x -> VoToColumnUtil.fieldsToColumns(AppMenuPageVo.class).contains(x.getProperty()));
|
||||
|
||||
IPage<AppMenu> page = appMenuService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<AppMenuPageVo> pageOutput = ConventPage.getPageOutput(page, AppMenuPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "app菜单 列表 不分页")
|
||||
public R list(AppMenuListDto dto){
|
||||
|
||||
LambdaQueryWrapper<AppMenu> queryWrapper = Wrappers.lambdaQuery(AppMenu.class)
|
||||
.eq(StrUtil.isNotBlank(dto.getName()), AppMenu::getName, dto.getName())
|
||||
.eq(StrUtil.isNotBlank(dto.getCode()), AppMenu::getCode, dto.getCode())
|
||||
.eq(ObjectUtil.isNotNull(dto.getCategoryId()), AppMenu::getCategoryId, dto.getCategoryId())
|
||||
.eq(AppMenu::getEnabledMark, EnabledMark.ENABLED.getCode())
|
||||
.orderByAsc(AppMenu::getSortCode)
|
||||
.select(AppMenu.class, x -> VoToColumnUtil.fieldsToColumns(AppMenuPageVo.class).contains(x.getProperty()));
|
||||
|
||||
|
||||
List<AppMenu> list = appMenuService.list(queryWrapper);
|
||||
|
||||
List<AppMenuListVo> appMenuListVos = BeanUtil.copyToList(list, AppMenuListVo.class);
|
||||
|
||||
return R.ok(appMenuListVos);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增")
|
||||
public R add(@Valid @RequestBody AddAppMenuDto dto){
|
||||
|
||||
AppMenu appMenu = BeanUtil.toBean(dto, AppMenu.class);
|
||||
|
||||
return R.ok(appMenuService.save(appMenu));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改")
|
||||
public R update(@Valid @RequestBody UpdateAppMenuDto dto){
|
||||
|
||||
AppMenu appMenu = BeanUtil.toBean(dto, AppMenu.class);
|
||||
|
||||
return R.ok(appMenuService.updateById(appMenu));
|
||||
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
public R delete(@Valid @RequestBody List<Long> ids) {
|
||||
appMenuService.removeBatchByIds(ids);
|
||||
return R.ok(Boolean.TRUE);
|
||||
}
|
||||
|
||||
@GetMapping("/simple-tree")
|
||||
@Operation(summary = "获取所有app菜单(树结构)-以分类为父级")
|
||||
public R menuAuthTree(@Valid MenuTreeDto dto) {
|
||||
List<AppMenu> list = appMenuService.getAppAuthMenuList(dto);
|
||||
List<DictionaryDetail> dictionaryDetailList = dictionaryDetailClient.getDicDetailListByItemIdFeign(1673142942973763585L);
|
||||
List<AppMenuSimpleTreeVo> appMenuSimpleTreeVoList = new ArrayList<>();
|
||||
if (dictionaryDetailList.size() > 0){
|
||||
for (DictionaryDetail dictionaryDetail : dictionaryDetailList) {//以功能分类做为父级
|
||||
AppMenuSimpleTreeVo appMenuSimpleTreeVo = new AppMenuSimpleTreeVo();
|
||||
appMenuSimpleTreeVo.setId(dictionaryDetail.getId());
|
||||
appMenuSimpleTreeVo.setCategoryId(dictionaryDetail.getId());
|
||||
appMenuSimpleTreeVo.setName(dictionaryDetail.getName());
|
||||
appMenuSimpleTreeVo.setCode(dictionaryDetail.getCode());
|
||||
List<AppMenu> collect = list.stream().filter(x -> x.getCategoryId().equals(dictionaryDetail.getId())).collect(Collectors.toList());
|
||||
List<AppMenuVo> appMenuVos = BeanUtil.copyToList(collect, AppMenuVo.class);
|
||||
appMenuSimpleTreeVo.setChildren(appMenuVos);
|
||||
appMenuSimpleTreeVoList.add(appMenuSimpleTreeVo);
|
||||
}
|
||||
}
|
||||
return R.ok(appMenuSimpleTreeVoList);
|
||||
}
|
||||
|
||||
@GetMapping("/app-simple-tree")
|
||||
@Operation(summary = "获取所有app菜单(树结构)-以分类为父级")
|
||||
public R appMenuAuthTree(@Valid MenuTreeDto dto) {
|
||||
List<AppMenu> list = appMenuService.getAppAuthMenuList(dto);
|
||||
List<DictionaryDetail> dictionaryDetailList = dictionaryDetailClient.getDicDetailListByItemIdFeign(1673142942973763585L);
|
||||
List<AppMenuSimpleTreeVo> appMenuSimpleTreeVoList = new ArrayList<>();
|
||||
if (dictionaryDetailList.size() > 0){
|
||||
for (DictionaryDetail dictionaryDetail : dictionaryDetailList) {//以功能分类做为父级
|
||||
AppMenuSimpleTreeVo appMenuSimpleTreeVo = new AppMenuSimpleTreeVo();
|
||||
appMenuSimpleTreeVo.setId(dictionaryDetail.getId());
|
||||
appMenuSimpleTreeVo.setCategoryId(dictionaryDetail.getId());
|
||||
appMenuSimpleTreeVo.setName(dictionaryDetail.getName());
|
||||
appMenuSimpleTreeVo.setCode(dictionaryDetail.getCode());
|
||||
List<AppMenu> collect = list.stream().filter(x -> x.getCategoryId().equals(dictionaryDetail.getId())).collect(Collectors.toList());
|
||||
List<AppMenuVo> appMenuVos = BeanUtil.copyToList(collect, AppMenuVo.class);
|
||||
if (appMenuVos.size() > 0){
|
||||
appMenuSimpleTreeVo.setChildren(appMenuVos);
|
||||
appMenuSimpleTreeVoList.add(appMenuSimpleTreeVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return R.ok(appMenuSimpleTreeVoList);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/button-list")
|
||||
@Operation(summary = "app菜单按钮列表权限 不分页")
|
||||
public R buttonList(@RequestParam(required = false) Long menuId){
|
||||
if (menuId == null) {
|
||||
return R.ok(new ArrayList<>(0));
|
||||
}
|
||||
List<AppMenuButton> list = appMenuButtonService.list(Wrappers.<AppMenuButton>lambdaQuery().eq(menuId != 0, AppMenuButton::getMenuId, menuId));
|
||||
List<MenuButtonListVo> menuButtonListVos = BeanUtil.copyToList(list, MenuButtonListVo.class);
|
||||
return R.ok(menuButtonListVos);
|
||||
}
|
||||
|
||||
@GetMapping("/column-list")
|
||||
@Operation(summary = "app菜单列表字段权限 不分页")
|
||||
public R columnList(@RequestParam(required = false) Long menuId){
|
||||
if (menuId == null) {
|
||||
return R.ok(new ArrayList<>(0));
|
||||
}
|
||||
List<AppMenuColumn> list = appMenuColumnService.list(Wrappers.<AppMenuColumn>lambdaQuery().eq(menuId != 0, AppMenuColumn::getMenuId, menuId));
|
||||
List<MenuColumnListVo> menuColumnListVos = BeanUtil.copyToList(list, MenuColumnListVo.class);
|
||||
return R.ok(menuColumnListVos);
|
||||
}
|
||||
|
||||
@GetMapping("/form-list")
|
||||
@Operation(summary = "app菜单表单列表权限 不分页")
|
||||
public R formList(@RequestParam(required = false) Long menuId){
|
||||
if (menuId == null) {
|
||||
return R.ok(new ArrayList<>(0));
|
||||
}
|
||||
List<AppMenuForm> list = appMenuFormService.list(Wrappers.<AppMenuForm>lambdaQuery().eq(menuId != 0, AppMenuForm::getMenuId, menuId));
|
||||
List<MenuFormListVo> menuFormListVos = BeanUtil.copyToList(list, MenuFormListVo.class);
|
||||
return R.ok(TreeUtil.build(menuFormListVos));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,125 @@
|
||||
package com.xjrsoft.app.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.xjrsoft.app.dto.*;
|
||||
import com.xjrsoft.app.entity.AppPageDesign;
|
||||
import com.xjrsoft.app.service.IAppMenuService;
|
||||
import com.xjrsoft.app.service.IAppPageDesignService;
|
||||
import com.xjrsoft.app.vo.AppPageDesignVo;
|
||||
import com.xjrsoft.common.core.annotation.XjrLog;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* xjr_data_display【数据展示表】 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-06-25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.APP_MODEL +"/page-design")
|
||||
@Tag(name = GlobalConstant.APP_MODEL +"/page-design", description = "app端展示页面设计")
|
||||
@AllArgsConstructor
|
||||
public class AppPageDesignController {
|
||||
|
||||
private IAppPageDesignService pageDesignService;
|
||||
|
||||
private IAppMenuService appMenuService;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "app端展示页面设计分页")
|
||||
@XjrLog("app端展示页面设计分页")
|
||||
public R page(AppPageDesignDto dto) {
|
||||
LambdaQueryWrapper<AppPageDesign> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StrUtil.isNotBlank(dto.getKeyword()), AppPageDesign::getName, dto.getKeyword())
|
||||
.like(StrUtil.isNotBlank(dto.getName()), AppPageDesign::getName, dto.getName())
|
||||
.like(StrUtil.isNotBlank(dto.getCode()), AppPageDesign::getCode, dto.getCode())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getEnabledMark()), AppPageDesign::getEnabledMark,dto.getEnabledMark())
|
||||
.select(AppPageDesign.class, x -> VoToColumnUtil.fieldsToColumns(AppPageDesignVo.class).contains(x.getProperty()))
|
||||
.orderByAsc(AppPageDesign::getSortCode);
|
||||
|
||||
IPage<AppPageDesign> page = pageDesignService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<AppPageDesignVo> pageOutput = ConventPage.getPageOutput(page, AppPageDesignVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增app端展示页面设计")
|
||||
@XjrLog("新增app端展示页面设计")
|
||||
public R add(@Valid @RequestBody AddAppPageDesignDto dto) {
|
||||
|
||||
return R.ok(pageDesignService.add(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/draft")
|
||||
@Operation(summary = "app端展示页面设计保存草稿")
|
||||
@XjrLog("app端展示页面设计保存草稿")
|
||||
public R draft(@Valid @RequestBody AppPageDesignDraftDto dto) {
|
||||
AppPageDesign bean = BeanUtil.toBean(dto, AppPageDesign.class);
|
||||
return R.ok(pageDesignService.saveOrUpdate(bean));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改app端展示页面设计")
|
||||
@XjrLog("修改app端展示页面设计")
|
||||
public R update(@Valid @RequestBody UpdateAppPageDesignDto dto) {
|
||||
return R.ok(pageDesignService.modify(dto));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询数app端展示页面设计详细信息")
|
||||
@XjrLog("根据id查询数app端展示页面设计详细信息")
|
||||
public R info(@RequestParam Long id) {
|
||||
AppPageDesign appPageDesign = pageDesignService.getById(id);
|
||||
if (appPageDesign == null) {
|
||||
R.error("找不到此数据展示页!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(appPageDesign, AppPageDesign.class));
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@XjrLog(value = "删除app端展示页面设计")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public R delete(@Valid @RequestBody DeleteAppPageDesignDto dto) {
|
||||
|
||||
AppPageDesign pageDesign = pageDesignService.getById(dto.getId());
|
||||
|
||||
if (ObjectUtils.isNotEmpty(pageDesign.getAppMenuId())) {
|
||||
appMenuService.removeById(pageDesign.getAppMenuId());
|
||||
}
|
||||
|
||||
pageDesignService.removeById(dto.getId());
|
||||
return R.ok(true);
|
||||
}
|
||||
|
||||
@PutMapping("/update-enable-mark")
|
||||
@Operation(summary = "修改启用状态")
|
||||
@XjrLog(value = "修改启用状态")
|
||||
public R updateEnableMark(@Valid @RequestBody UpdateEnableMarkDto dto) {
|
||||
AppPageDesign appPageDesign = new AppPageDesign();
|
||||
appPageDesign.setId(dto.getId());
|
||||
appPageDesign.setEnabledMark(dto.getEnabledMark());
|
||||
pageDesignService.updateById(appPageDesign);
|
||||
return R.ok(true);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.xjrsoft.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.app.dto.SetAppRoleAuthDto;
|
||||
import com.xjrsoft.app.entity.AppAuthorize;
|
||||
import com.xjrsoft.app.vo.AppRoleAuthVo;
|
||||
import com.xjrsoft.system.vo.MenuAuthVo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-12-25
|
||||
*/
|
||||
public interface IAppAuthorizeService extends IService<AppAuthorize> {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dto 按钮id
|
||||
* @return 是否成功
|
||||
*/
|
||||
Boolean setRoleAppAuth(SetAppRoleAuthDto dto);
|
||||
|
||||
|
||||
/**
|
||||
* 获取角色权限
|
||||
*
|
||||
* @param id 角色id
|
||||
* @return 角色权限
|
||||
*/
|
||||
AppRoleAuthVo getRoleAppAuth(Long id);
|
||||
|
||||
/**
|
||||
* 根据登陆人获取app用户菜单权限数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
MenuAuthVo getAppPermissions(Long menuId);
|
||||
}
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
package com.xjrsoft.app.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.app.dto.AddFuncDesignDto;
|
||||
import com.xjrsoft.app.dto.UpdateAppFuncDesignDto;
|
||||
import com.xjrsoft.app.entity.AppFuncDesign;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-07-26
|
||||
*/
|
||||
public interface IAppFuncDesignService extends MPJBaseService<AppFuncDesign> {
|
||||
|
||||
Boolean add(AddFuncDesignDto dto);
|
||||
|
||||
Boolean modify(UpdateAppFuncDesignDto dto);
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xjrsoft.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.app.entity.AppMenuButton;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* app菜单按钮 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-12-25
|
||||
*/
|
||||
public interface IAppMenuButtonService extends IService<AppMenuButton> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xjrsoft.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.app.entity.AppMenuColumn;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* app菜单列表字段 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-12-25
|
||||
*/
|
||||
public interface IAppMenuColumnService extends IService<AppMenuColumn> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xjrsoft.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.app.entity.AppMenuForm;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* app菜单表单字段 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-12-25
|
||||
*/
|
||||
public interface IAppMenuFormService extends IService<AppMenuForm> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.xjrsoft.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.app.entity.AppMenu;
|
||||
import com.xjrsoft.system.dto.MenuTreeDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-07-26
|
||||
*/
|
||||
public interface IAppMenuService extends IService<AppMenu> {
|
||||
List<AppMenu> getAppAuthMenuList(MenuTreeDto dto);
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.xjrsoft.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.app.dto.AddAppPageDesignDto;
|
||||
import com.xjrsoft.app.dto.UpdateAppPageDesignDto;
|
||||
import com.xjrsoft.app.entity.AppPageDesign;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* xjr_data_display【数据展示表】 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-06-25
|
||||
*/
|
||||
public interface IAppPageDesignService extends IService<AppPageDesign> {
|
||||
|
||||
Boolean add(AddAppPageDesignDto dto);
|
||||
|
||||
Boolean modify(UpdateAppPageDesignDto dto);
|
||||
|
||||
}
|
||||
@ -0,0 +1,277 @@
|
||||
package com.xjrsoft.app.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.xjrsoft.app.dto.SetAppRoleAuthDto;
|
||||
import com.xjrsoft.app.entity.*;
|
||||
import com.xjrsoft.app.mapper.*;
|
||||
import com.xjrsoft.app.service.IAppAuthorizeService;
|
||||
import com.xjrsoft.app.vo.AppRoleAuthVo;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.tree.ITreeNode;
|
||||
import com.xjrsoft.common.core.enums.AuthorizeType;
|
||||
import com.xjrsoft.common.core.enums.EnabledMark;
|
||||
import com.xjrsoft.common.core.uitls.TreeUtil;
|
||||
import com.xjrsoft.organization.client.IRoleClient;
|
||||
import com.xjrsoft.organization.client.IUserRoleRelationClient;
|
||||
import com.xjrsoft.organization.entity.Role;
|
||||
import com.xjrsoft.organization.entity.UserRoleRelation;
|
||||
import com.xjrsoft.system.vo.MenuAuthVo;
|
||||
import com.xjrsoft.system.vo.MenuFormTreeVo;
|
||||
import com.xjrsoft.tenant.util.SecureUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-12-25
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class AppAuthorizeServiceImpl extends ServiceImpl<AppAuthorizeMapper, AppAuthorize> implements IAppAuthorizeService {
|
||||
|
||||
private final IUserRoleRelationClient userRoleRelationClient;
|
||||
|
||||
private final AppMenuMapper appMenuMapper;
|
||||
|
||||
private final AppMenuButtonMapper appMenuButtonMapper;
|
||||
|
||||
private final AppMenuColumnMapper appMenuColumnMapper;
|
||||
|
||||
private final AppMenuFormMapper appMenuFormMapper;
|
||||
|
||||
private final AppAuthorizeMapper appAuthorizeMapper;
|
||||
|
||||
private final IRoleClient roleClient;
|
||||
|
||||
@Override
|
||||
public MenuAuthVo getAppPermissions(Long menuId) {
|
||||
|
||||
long userId = StpUtil.getLoginIdAsLong();
|
||||
|
||||
List<UserRoleRelation> relations = userRoleRelationClient.getUserRoleRelationListByUserIdFeign(userId);
|
||||
|
||||
List<Long> relationIds = relations.stream().map(UserRoleRelation::getRoleId).collect(Collectors.toList());
|
||||
|
||||
List<Role> roleList = roleClient.getRoleListByRelationIdsFeign(relationIds);
|
||||
|
||||
List<Long> roleIdList = roleList.stream().map(Role::getId).collect(Collectors.toList());
|
||||
|
||||
//如果包含超级管理员权限 默认返回当前菜单所有权限
|
||||
List<AppMenuButton> buttonList = appMenuButtonMapper.selectList(Wrappers.<AppMenuButton>lambdaQuery().eq(AppMenuButton::getMenuId,menuId));
|
||||
List<AppMenuColumn> columnList = appMenuColumnMapper.selectList(Wrappers.<AppMenuColumn>lambdaQuery().eq(AppMenuColumn::getMenuId,menuId));
|
||||
List<AppMenuForm> formList = appMenuFormMapper.selectList(Wrappers.<AppMenuForm>lambdaQuery().eq(AppMenuForm::getMenuId,menuId));
|
||||
if (!SecureUtil.isAdmin(roleIdList)) {
|
||||
List<AppAuthorize> authorizeList = appAuthorizeMapper.selectList(Wrappers.lambdaQuery(AppAuthorize.class)
|
||||
.in(roleIdList.size() > 0,AppAuthorize::getRoleId, roleIdList)
|
||||
);
|
||||
|
||||
List<Long> buttonIds = authorizeList.stream().filter(x -> x.getAppAuthorizeType() == AuthorizeType.BUTTON.getCode()).map(AppAuthorize::getObjectId).collect(Collectors.toList());
|
||||
if (buttonIds.size() > 0) {
|
||||
buttonList = buttonList.stream().filter(x->buttonIds.contains(x.getId())).collect(Collectors.toList());
|
||||
}else {
|
||||
buttonList = new ArrayList<>(0);
|
||||
}
|
||||
|
||||
List<Long> columnIds = authorizeList.stream().filter(x -> x.getAppAuthorizeType() == AuthorizeType.COLUMN.getCode()).map(AppAuthorize::getObjectId).collect(Collectors.toList());
|
||||
if (columnIds.size() > 0) {
|
||||
columnList = columnList.stream().filter(x->columnIds.contains(x.getId())).collect(Collectors.toList());
|
||||
}else {
|
||||
columnList = new ArrayList<>(0);
|
||||
}
|
||||
|
||||
List<Long> formIds = authorizeList.stream().filter(x -> x.getAppAuthorizeType() == AuthorizeType.FORM.getCode()).map(AppAuthorize::getObjectId).collect(Collectors.toList());
|
||||
if (formIds.size() > 0) {
|
||||
LambdaQueryWrapper<AppMenuForm> queryWrapper = Wrappers.lambdaQuery(AppMenuForm.class);
|
||||
queryWrapper.in(AppMenuForm::getId, formIds);
|
||||
formList = formList.stream().filter(x->formIds.contains(x.getId())).collect(Collectors.toList());
|
||||
}
|
||||
else {
|
||||
formList = new ArrayList<>(0);
|
||||
}
|
||||
}
|
||||
|
||||
List<MenuFormTreeVo> formTreeVoList = TreeUtil.build(BeanUtil.copyToList(formList, MenuFormTreeVo.class));
|
||||
|
||||
MenuAuthVo vo = new MenuAuthVo();
|
||||
vo.setMenuId(menuId);
|
||||
vo.setButtonAuthCode(buttonList.stream().map(AppMenuButton::getCode).collect(Collectors.toSet()));
|
||||
vo.setColumnAuthCode(columnList.stream().map(AppMenuColumn::getCode).collect(Collectors.toSet()));
|
||||
// 处理表单字段,可能存在子表的情况
|
||||
Set<Object> formAuthCodeList = new LinkedHashSet<>(formTreeVoList.size());
|
||||
for (MenuFormTreeVo treeVo : formTreeVoList) {
|
||||
List<MenuFormTreeVo> children = treeVo.getChildren();
|
||||
if (CollectionUtils.isNotEmpty(children)) {
|
||||
Set<String> subCodeList = new LinkedHashSet<>(children.size());
|
||||
for (MenuFormTreeVo child : children) {
|
||||
subCodeList.add(child.getCode());
|
||||
}
|
||||
Map<String, Set<String>> subTableCodeMap = new HashMap<>(1);
|
||||
subTableCodeMap.put(treeVo.getCode(), subCodeList);
|
||||
formAuthCodeList.add(subTableCodeMap);
|
||||
} else {
|
||||
formAuthCodeList.add(treeVo.getCode());
|
||||
}
|
||||
}
|
||||
vo.setFormAuthCode(formAuthCodeList);
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean setRoleAppAuth(SetAppRoleAuthDto dto) {
|
||||
//添加菜单权限
|
||||
Long id = dto.getId();
|
||||
List<AppAuthorize> savedAuthList = new ArrayList<>();
|
||||
//菜单
|
||||
buildAppAuthorize(id, dto.getMenuIds(), AuthorizeType.MENU.getCode(), savedAuthList);
|
||||
//按钮
|
||||
buildAppAuthorize(id, dto.getButtonIds(), AuthorizeType.BUTTON.getCode(), savedAuthList);
|
||||
//列表字段
|
||||
buildAppAuthorize(id, dto.getColumnIds(), AuthorizeType.COLUMN.getCode(), savedAuthList);
|
||||
//表单字段
|
||||
buildAppAuthorize(id, dto.getFormIds(), AuthorizeType.FORM.getCode(), savedAuthList);
|
||||
|
||||
//删除当前角色所有权限
|
||||
this.remove(Wrappers.<AppAuthorize>query().lambda().eq(AppAuthorize::getRoleId, id).in(AppAuthorize::getAppAuthorizeType, 0, 1, 2, 3));
|
||||
//先保存角色权限
|
||||
this.saveBatch(savedAuthList);
|
||||
//再更新角色权限的缓存
|
||||
logoutByRoleId(id);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AppRoleAuthVo getRoleAppAuth(Long id) {
|
||||
//如果是超级管理员 默认返回所有权限
|
||||
List<AppMenu> menus = appMenuMapper.selectList(Wrappers.lambdaQuery(AppMenu.class)
|
||||
.eq(AppMenu::getEnabledMark, EnabledMark.ENABLED.getCode()));
|
||||
if (Objects.equals(id, GlobalConstant.SUPER_ADMIN_ROLE_ID)) {
|
||||
List<AppMenuButton> buttons = appMenuButtonMapper.selectList(Wrappers.lambdaQuery(AppMenuButton.class).select(AppMenuButton::getId));
|
||||
|
||||
AppRoleAuthVo adminVo = new AppRoleAuthVo();
|
||||
adminVo.setMenuIds(menus.stream().map(AppMenu::getId).collect(Collectors.toList()));
|
||||
adminVo.setButtonIds(buttons.stream().map(AppMenuButton::getId).collect(Collectors.toList()));
|
||||
return adminVo;
|
||||
}
|
||||
|
||||
//获取角色所有权限
|
||||
List<AppAuthorize> authorizeList = appAuthorizeMapper.selectList(Wrappers.lambdaQuery(AppAuthorize.class).eq(AppAuthorize::getRoleId, id));
|
||||
//将角色权限分为 菜单、按钮、列表字段和表单字段权限
|
||||
List<Long> menuIdList = new ArrayList<>();
|
||||
List<Long> btnIdList = new ArrayList<>();
|
||||
List<Long> colIdList = new ArrayList<>();
|
||||
List<Long> formIdList = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(authorizeList)) {
|
||||
for (AppAuthorize authorize : authorizeList) {
|
||||
Integer authorizeType = authorize.getAppAuthorizeType();
|
||||
Long authorizeId = authorize.getObjectId();
|
||||
if (authorizeType == AuthorizeType.MENU.getCode()) {
|
||||
menuIdList.add(authorizeId);
|
||||
} else if (authorizeType == AuthorizeType.BUTTON.getCode()) {
|
||||
btnIdList.add(authorizeId);
|
||||
} else if (authorizeType == AuthorizeType.COLUMN.getCode()) {
|
||||
colIdList.add(authorizeId);
|
||||
} else if (authorizeType == AuthorizeType.FORM.getCode()) {
|
||||
formIdList.add(authorizeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
AppRoleAuthVo roleAuthVo = new AppRoleAuthVo();
|
||||
if (CollectionUtils.isNotEmpty(menuIdList)) {
|
||||
List<Long> authMenuIdsList = menus.stream().filter(menu -> menuIdList.contains(menu.getId())).map(AppMenu::getId).collect(Collectors.toList());
|
||||
roleAuthVo.setMenuIds(authMenuIdsList);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(btnIdList)) {
|
||||
// 过滤按钮id
|
||||
List<AppMenuButton> menuButtonList = appMenuButtonMapper.selectList(Wrappers.<AppMenuButton>query().lambda()
|
||||
.select(AppMenuButton::getId).in(AppMenuButton::getId, btnIdList));
|
||||
roleAuthVo.setButtonIds(menuButtonList.stream().map(AppMenuButton::getId).collect(Collectors.toList()));
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(colIdList)) {
|
||||
// 过滤列表字段id
|
||||
List<AppMenuColumn> menuColumnList = appMenuColumnMapper.selectList(Wrappers.<AppMenuColumn>query().lambda()
|
||||
.select(AppMenuColumn::getId).in(AppMenuColumn::getId, colIdList));
|
||||
roleAuthVo.setColumnIds(menuColumnList.stream().map(AppMenuColumn::getId).collect(Collectors.toList()));
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(formIdList)) {
|
||||
// 过滤掉按钮id
|
||||
List<AppMenuForm> menuList = appMenuFormMapper.selectList(Wrappers.<AppMenuForm>query().lambda()
|
||||
.select(AppMenuForm::getParentId, AppMenuForm::getId));
|
||||
List<AppMenuForm> authMenuFormList = new ArrayList<>();
|
||||
Set<Long> parentIdSet = new LinkedHashSet<>();
|
||||
for (AppMenuForm menuForm : menuList) {
|
||||
if (formIdList.contains(menuForm.getId())) {
|
||||
authMenuFormList.add(menuForm);
|
||||
}
|
||||
parentIdSet.add(menuForm.getParentId());
|
||||
}
|
||||
List<MenuFormTreeVo> menuFormTreeVos = BeanUtil.copyToList(authMenuFormList, MenuFormTreeVo.class);
|
||||
List<MenuFormTreeVo> menuFormTreeList = TreeUtil.build(menuFormTreeVos);
|
||||
buildLastChildIds(menuFormTreeList, roleAuthVo.getFormIds(), parentIdSet);
|
||||
}
|
||||
return roleAuthVo;
|
||||
}
|
||||
|
||||
|
||||
private <T extends ITreeNode<T, Long>> void buildLastChildIds(List<T> treeList, List<Long> idList, Set<Long> parentIdList) {
|
||||
if (CollectionUtils.isEmpty(treeList)) {
|
||||
return;
|
||||
}
|
||||
for (ITreeNode<T, Long> treeVo : treeList) {
|
||||
List<T> children = treeVo.getChildren();
|
||||
if (CollectionUtils.isNotEmpty(children)) {
|
||||
buildLastChildIds(children, idList, parentIdList);
|
||||
} else if (!parentIdList.contains(treeVo.getId())){
|
||||
idList.add(treeVo.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建授权数据
|
||||
*
|
||||
* @param roleId 角色id
|
||||
* @param itemIdList 菜单id
|
||||
* @param itemType 菜单类型,0-菜单,1-按钮,2-列表字段,3-表单字段
|
||||
* @param authorizeList 构建的保存对象集合
|
||||
*/
|
||||
private void buildAppAuthorize(Long roleId, List<Long> itemIdList, Integer itemType, List<AppAuthorize> authorizeList) {
|
||||
if (CollectionUtils.isNotEmpty(itemIdList)) {
|
||||
for (Long itemId : itemIdList) {
|
||||
AppAuthorize authorize = new AppAuthorize();
|
||||
authorize.setAppAuthorizeType(itemType);
|
||||
authorize.setObjectId(itemId);
|
||||
authorize.setRoleId(roleId);
|
||||
authorizeList.add(authorize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据roleId 登出所有用户 用于:角色权限变化,所有拥有此权限的用户 必须全部重新登录
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
private void logoutByRoleId(Long id) {
|
||||
List<UserRoleRelation> relations = userRoleRelationClient.getUserRoleRelationListByRoleIdFeigh(id);
|
||||
|
||||
List<Long> currentRoleUser = relations.stream().map(UserRoleRelation::getUserId).collect(Collectors.toList());
|
||||
currentRoleUser.forEach(StpUtil::logout);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,531 @@
|
||||
package com.xjrsoft.app.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.db.Db;
|
||||
import cn.hutool.db.meta.MetaUtil;
|
||||
import cn.hutool.db.meta.Table;
|
||||
import cn.hutool.json.JSON;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.app.dto.AddAppMenuDto;
|
||||
import com.xjrsoft.app.dto.AddFuncDesignDto;
|
||||
import com.xjrsoft.app.dto.UpdateAppFuncDesignDto;
|
||||
import com.xjrsoft.app.entity.*;
|
||||
import com.xjrsoft.app.mapper.AppFuncDesignMapper;
|
||||
import com.xjrsoft.app.mapper.AppMenuMapper;
|
||||
import com.xjrsoft.app.service.*;
|
||||
import com.xjrsoft.common.core.config.GeneratePathConfig;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.generator.ComponentConfig;
|
||||
import com.xjrsoft.common.core.enums.FormTemplateType;
|
||||
import com.xjrsoft.common.core.enums.YesOrNoEnum;
|
||||
import com.xjrsoft.common.core.exception.MyException;
|
||||
import com.xjrsoft.common.generate.model.*;
|
||||
import com.xjrsoft.common.mybatis.utils.DatasourceUtil;
|
||||
import com.xjrsoft.generate.client.IGenerateClient;
|
||||
import com.xjrsoft.generate.constant.ComponentTypeConstant;
|
||||
import com.xjrsoft.generate.dto.GeneratorAppDto;
|
||||
import com.xjrsoft.generate.utils.GeneratorUtil;
|
||||
import com.xjrsoft.generate.utils.SqlUtil;
|
||||
import com.xjrsoft.system.client.IDatabaselinkClient;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-07-26
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class AppFuncDesignServiceImpl extends MPJBaseServiceImpl<AppFuncDesignMapper, AppFuncDesign> implements IAppFuncDesignService {
|
||||
|
||||
private static final Boolean isOutputDirLowerName=false;
|
||||
|
||||
private final AppMenuMapper appMenuMapper;
|
||||
|
||||
private final IGenerateClient generateClient;
|
||||
|
||||
|
||||
private final GeneratePathConfig generatePathConfig;
|
||||
|
||||
private final IDatabaselinkClient databaselinkClient;
|
||||
|
||||
private final IAppMenuButtonService appMenuButtonService;
|
||||
|
||||
private final IAppMenuColumnService appMenuColumnService;
|
||||
|
||||
private final IAppMenuFormService appMenuFormService;
|
||||
|
||||
private final IAppAuthorizeService appAuthorizeService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean add(AddFuncDesignDto dto) {
|
||||
|
||||
AppFuncDesign appFuncDesign = BeanUtil.toBean(dto, AppFuncDesign.class);
|
||||
|
||||
|
||||
//如果是自定义表单 不需要生成代码 以及 page.json
|
||||
if (dto.getFormType() == FormTemplateType.CUSTOM.getCode() && dto.getIsGeneratorCode() != YesOrNoEnum.YES.getCode()) {
|
||||
GeneratorConfig generatorConfig = JSONUtil.toBean(dto.getJsonContent(), GeneratorConfig.class);
|
||||
AppMenu appMenu = BeanUtil.toBean(dto.getMenuConfigs(), AppMenu.class);
|
||||
|
||||
|
||||
long snowflakeNextId = IdUtil.getSnowflakeNextId();
|
||||
appMenu.setUrl(appMenu.getUrl() + StringPool.QUESTION_MARK + "id=" + snowflakeNextId);
|
||||
|
||||
appMenuMapper.insert(appMenu);
|
||||
insertAppMenuConfig(generatorConfig,appMenu,false);
|
||||
|
||||
appFuncDesign.setId(snowflakeNextId);
|
||||
appFuncDesign.setAppMenuId(appMenu.getId());
|
||||
save(appFuncDesign);
|
||||
|
||||
} else {
|
||||
GeneratorConfig generatorConfig = JSONUtil.toBean(dto.getJsonContent(), GeneratorConfig.class);
|
||||
if(dto.getFormType() == FormTemplateType.CUSTOM.getCode()){
|
||||
generatorEndCode(generatorConfig);
|
||||
}
|
||||
AppMenu appMenu = BeanUtil.toBean(dto.getMenuConfigs(), AppMenu.class);
|
||||
|
||||
|
||||
appMenu.setUrl("/pages/" + dto.getCodes().getOutputValue() + StringPool.SLASH + (isOutputDirLowerName?dto.getCodes().getClassName().toLowerCase():dto.getCodes().getClassName()) + StringPool.SLASH + "list");
|
||||
appMenuMapper.insert(appMenu);
|
||||
insertAppMenuConfig(generatorConfig,appMenu,true);
|
||||
|
||||
appFuncDesign.setAppMenuId(appMenu.getId());
|
||||
save(appFuncDesign);
|
||||
|
||||
//保存成功之后 生成代码
|
||||
modifyPageJsonFile(dto.getCodes(), dto.getMenuConfigs());
|
||||
|
||||
generateClient.generateAppCodesFeign(dto.getCodes());
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入app端默认菜单数据
|
||||
* @param generatorConfig
|
||||
* @param appMenu
|
||||
* @param isUnderlineToCamel 是否需要转驼峰,自定义表单不需要生成代码不转驼峰,其它都转
|
||||
* @return
|
||||
*/
|
||||
private Boolean insertAppMenuConfig(GeneratorConfig generatorConfig,AppMenu appMenu,boolean isUnderlineToCamel){
|
||||
List<ButtonConfig> buttonConfigs = generatorConfig.getListConfig().getButtonConfigs();
|
||||
List<AppMenuButton> oldBtnList = appMenuButtonService.list(Wrappers.lambdaQuery(AppMenuButton.class)
|
||||
.select(AppMenuButton::getId, AppMenuButton::getCode).eq(AppMenuButton::getMenuId, appMenu.getId()));
|
||||
Map<String, Long> btnCodeIdMap = oldBtnList.stream().collect(Collectors.toMap(m ->
|
||||
StringUtils.defaultIfBlank(StringUtils.substringAfterLast(m.getCode(), StringPool.COLON), m.getCode()), AppMenuButton::getId));
|
||||
|
||||
List<AppMenuButton> btnList = new ArrayList<>();
|
||||
buttonConfigs.forEach(buttonConfig -> {
|
||||
String code = StringPool.EMPTY;
|
||||
if (BooleanUtils.isTrue(buttonConfig.getIsUse())) {
|
||||
code = buttonConfig.getCode();
|
||||
AppMenuButton menuButton = new AppMenuButton();
|
||||
menuButton.setId(btnCodeIdMap.get(StringUtils.defaultIfBlank(StringUtils.substringAfterLast(code, StringPool.COLON), code)));
|
||||
menuButton.setMenuId(appMenu.getId());
|
||||
menuButton.setName(buttonConfig.getName());
|
||||
menuButton.setCode(code);
|
||||
menuButton.setIcon(buttonConfig.getIcon());
|
||||
btnList.add(menuButton);
|
||||
}
|
||||
});
|
||||
|
||||
List<ColumnConfig> columnConfigs = generatorConfig.getListConfig().getColumnConfigs();
|
||||
List<AppMenuColumn> oldColList = appMenuColumnService.list(Wrappers.lambdaQuery(AppMenuColumn.class)
|
||||
.select(AppMenuColumn::getId, AppMenuColumn::getCode).eq(AppMenuColumn::getMenuId, appMenu.getId()));
|
||||
Map<String, Long> colCodeIdMap = oldColList.stream().collect(Collectors.toMap(AppMenuColumn::getCode, AppMenuColumn::getId));
|
||||
List<AppMenuColumn> colList = new ArrayList<>();
|
||||
for (ColumnConfig columnConfig : columnConfigs) {
|
||||
AppMenuColumn menuColumn = new AppMenuColumn();
|
||||
menuColumn.setMenuId(appMenu.getId());
|
||||
menuColumn.setName(columnConfig.getLabel());
|
||||
String code = columnConfig.getColumnName();
|
||||
if (isUnderlineToCamel){//转驼峰
|
||||
code = com.baomidou.mybatisplus.core.toolkit.StringUtils.underlineToCamel(columnConfig.getColumnName());
|
||||
menuColumn.setId(colCodeIdMap.get(com.baomidou.mybatisplus.core.toolkit.StringUtils.underlineToCamel(columnConfig.getColumnName())));
|
||||
}else {
|
||||
menuColumn.setId(colCodeIdMap.get(columnConfig.getColumnName()));
|
||||
}
|
||||
menuColumn.setCode(code);
|
||||
colList.add(menuColumn);
|
||||
}
|
||||
List<ComponentConfig> componentConfigList = GeneratorUtil.getFormComponentListWithoutLayout(generatorConfig.getFormJson().getList());
|
||||
List<AppMenuForm> oldFormList = appMenuFormService.list(Wrappers.lambdaQuery(AppMenuForm.class)
|
||||
.select(AppMenuForm::getId, AppMenuForm::getCode).eq(AppMenuForm::getMenuId, appMenu.getId()));
|
||||
Map<String, Long> formCodeIdMap = oldFormList.stream().collect(Collectors.toMap(m -> m.getParentId() + StringPool.AMPERSAND + m.getCode(), AppMenuForm::getId));
|
||||
List<AppMenuForm> formList = new ArrayList<>();
|
||||
for (ComponentConfig componentConfig : componentConfigList) {
|
||||
String type = componentConfig.getType();
|
||||
if (StrUtil.equalsIgnoreCase(type, ComponentTypeConstant.SUB_FORM) || StrUtil.equalsIgnoreCase(type, ComponentTypeConstant.ONE_FOR_ONE_FORM)) {
|
||||
Long oldId = formCodeIdMap.get(StringPool.ZERO + StringPool.AMPERSAND + StrUtil.toCamelCase(componentConfig.getBindTable()));
|
||||
long id = oldId == null ? IdUtil.getSnowflakeNextId() : oldId;
|
||||
IdWorker.getId();
|
||||
AppMenuForm menuForm = new AppMenuForm();
|
||||
menuForm.setId(id);
|
||||
menuForm.setMenuId(appMenu.getId());
|
||||
if (isUnderlineToCamel){
|
||||
menuForm.setCode(StrUtil.toCamelCase(componentConfig.getBindTable()));
|
||||
}else {
|
||||
menuForm.setCode(componentConfig.getBindTable());
|
||||
}
|
||||
menuForm.setName(componentConfig.getLabel());
|
||||
formList.add(menuForm);
|
||||
for (ComponentConfig subConfig : componentConfig.getChildren()) {
|
||||
AppMenuForm form = buildAppMenuForm(id, appMenu.getId(), subConfig,isUnderlineToCamel);
|
||||
form.setId(formCodeIdMap.get(id + StringPool.AMPERSAND + form.getCode()));
|
||||
formList.add(form);
|
||||
}
|
||||
} else {
|
||||
AppMenuForm form = buildAppMenuForm(0L, appMenu.getId(), componentConfig,isUnderlineToCamel);
|
||||
form.setId(formCodeIdMap.get(StringPool.ZERO + StringPool.AMPERSAND + form.getCode()));
|
||||
formList.add(form);
|
||||
}
|
||||
}
|
||||
List<Long> oldAppAuthIds = new ArrayList<>();
|
||||
oldAppAuthIds.add(appMenu.getId());
|
||||
List<AppMenuButton> appMenuButtonList = appMenuButtonService.list(Wrappers.lambdaQuery(AppMenuButton.class).select(AppMenuButton::getId).eq(AppMenuButton::getMenuId, appMenu.getId()));
|
||||
if (appMenuButtonList.size() > 0){
|
||||
List<Long> oldButtonIds = appMenuButtonList.stream().map(AppMenuButton::getId).collect(Collectors.toList());
|
||||
//删除之前的按钮信息
|
||||
appMenuButtonService.removeByIds(oldButtonIds);
|
||||
oldAppAuthIds.addAll(oldButtonIds);
|
||||
}
|
||||
List<AppMenuColumn> appMenuColumnList = appMenuColumnService.list(Wrappers.lambdaQuery(AppMenuColumn.class).select(AppMenuColumn::getId).eq(AppMenuColumn::getMenuId, appMenu.getId()));
|
||||
if (appMenuColumnList.size() > 0){
|
||||
List<Long> oldColumnIds = appMenuColumnList.stream().map(AppMenuColumn::getId).collect(Collectors.toList());
|
||||
appMenuColumnService.removeByIds(oldColumnIds);
|
||||
oldAppAuthIds.addAll(oldColumnIds);
|
||||
}
|
||||
|
||||
List<AppMenuForm> appMenuFormList = appMenuFormService.list(Wrappers.lambdaQuery(AppMenuForm.class).select(AppMenuForm::getId).eq(AppMenuForm::getMenuId, appMenu.getId()));
|
||||
if (appMenuFormList.size() > 0){
|
||||
List<Long> oldFormIds = appMenuFormList.stream().map(AppMenuForm::getId).collect(Collectors.toList());
|
||||
appMenuFormService.removeByIds(oldFormIds);
|
||||
oldAppAuthIds.addAll(oldFormIds);
|
||||
}
|
||||
|
||||
//删除之前的授权信息
|
||||
if (oldAppAuthIds.size() > 0){
|
||||
appAuthorizeService.remove(Wrappers.lambdaQuery(AppAuthorize.class).in(AppAuthorize::getObjectId,oldAppAuthIds));
|
||||
}
|
||||
appMenuButtonService.saveBatch(btnList);
|
||||
appMenuColumnService.saveBatch(colList);
|
||||
appMenuFormService.saveBatch(formList);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private AppMenuForm buildAppMenuForm(Long parentId, Long menuId, ComponentConfig componentConfig,boolean isUnderlineToCamel) {
|
||||
String field = null;
|
||||
String type = componentConfig.getType();
|
||||
if (StrUtil.equalsIgnoreCase(type, ComponentTypeConstant.DATE_RANGE)
|
||||
|| StrUtil.equalsIgnoreCase(type, ComponentTypeConstant.TIME_RANGE)) {
|
||||
if (isUnderlineToCamel){
|
||||
field = com.baomidou.mybatisplus.core.toolkit.StringUtils.underlineToCamel(componentConfig.getBindStartTime()) + StringPool.COMMA + com.baomidou.mybatisplus.core.toolkit.StringUtils.underlineToCamel(componentConfig.getBindEndTime());
|
||||
}else {
|
||||
field = componentConfig.getBindStartTime() + StringPool.COMMA + componentConfig.getBindEndTime();
|
||||
}
|
||||
} else {
|
||||
if (isUnderlineToCamel){
|
||||
field = StrUtil.isEmpty(componentConfig.getBindField()) ? componentConfig.getKey() : com.baomidou.mybatisplus.core.toolkit.StringUtils.underlineToCamel(componentConfig.getBindField());
|
||||
}else {
|
||||
field = StrUtil.isEmpty(componentConfig.getBindField()) ? componentConfig.getKey() : componentConfig.getBindField();
|
||||
}
|
||||
}
|
||||
Boolean isRequired = MapUtils.getBoolean(componentConfig.getOptions(), "required", Boolean.FALSE);
|
||||
AppMenuForm subMenuForm = new AppMenuForm();
|
||||
subMenuForm.setParentId(parentId);
|
||||
subMenuForm.setMenuId(menuId);
|
||||
subMenuForm.setCode(field);
|
||||
subMenuForm.setName(componentConfig.getLabel());
|
||||
subMenuForm.setIsRequired(isRequired ? YesOrNoEnum.YES.getCode() : YesOrNoEnum.NO.getCode());
|
||||
return subMenuForm;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean modify(UpdateAppFuncDesignDto dto) {
|
||||
|
||||
AppFuncDesign appFuncDesign = BeanUtil.toBean(dto, AppFuncDesign.class);
|
||||
|
||||
//如果是自定义表单 不需要生成代码 以及 page.json
|
||||
if (dto.getFormType() == FormTemplateType.CUSTOM.getCode() && dto.getIsGeneratorCode() != YesOrNoEnum.YES.getCode()) {
|
||||
GeneratorConfig generatorConfig = JSONUtil.toBean(dto.getJsonContent(), GeneratorConfig.class);
|
||||
AppMenu appMenu = BeanUtil.toBean(dto.getMenuConfigs(), AppMenu.class);
|
||||
|
||||
appMenu.setId(dto.getAppMenuId());
|
||||
appMenu.setUrl(appMenu.getUrl() + StringPool.QUESTION_MARK + "id=" + appFuncDesign.getId());
|
||||
|
||||
appMenuMapper.updateById(appMenu);
|
||||
insertAppMenuConfig(generatorConfig,appMenu,false);
|
||||
|
||||
appFuncDesign.setAppMenuId(appMenu.getId());
|
||||
updateById(appFuncDesign);
|
||||
|
||||
} else {
|
||||
GeneratorConfig generatorConfig = JSONUtil.toBean(dto.getJsonContent(), GeneratorConfig.class);
|
||||
if(dto.getFormType() == FormTemplateType.CUSTOM.getCode()){
|
||||
generatorEndCode(generatorConfig);
|
||||
}
|
||||
|
||||
AppMenu appMenu = BeanUtil.toBean(dto.getMenuConfigs(), AppMenu.class);
|
||||
|
||||
appMenu.setId(dto.getAppMenuId());
|
||||
appMenu.setUrl("/pages/" + dto.getCodes().getOutputValue() + StringPool.SLASH + (isOutputDirLowerName?dto.getCodes().getClassName().toLowerCase():dto.getCodes().getClassName()) + StringPool.SLASH + "list");
|
||||
appMenuMapper.updateById(appMenu);
|
||||
insertAppMenuConfig(generatorConfig,appMenu,true);
|
||||
|
||||
updateById(appFuncDesign);
|
||||
|
||||
//保存成功之后 生成代码
|
||||
modifyPageJsonFile(dto.getCodes(), dto.getMenuConfigs());
|
||||
|
||||
|
||||
generateClient.generateAppCodesFeign(dto.getCodes());
|
||||
}
|
||||
|
||||
|
||||
return Boolean.TRUE;
|
||||
|
||||
}
|
||||
|
||||
private void modifyPageJsonFile(GeneratorAppDto dto, AddAppMenuDto menuDto) {
|
||||
File tempFile = FileUtil.file(generatePathConfig.getAppPath() + StringPool.SLASH + "pages.json");
|
||||
|
||||
JSON jsonContent = JSONUtil.readJSON(tempFile, StandardCharsets.UTF_8);
|
||||
|
||||
Boolean isPageCreated=false;
|
||||
if (jsonContent.getByPath("pages").toString().contains( "pages/" + dto.getOutputValue() + StringPool.SLASH + (isOutputDirLowerName?dto.getClassName().toLowerCase():dto.getClassName()) + StringPool.SLASH + "list")) {
|
||||
isPageCreated=true;
|
||||
}
|
||||
Boolean isEasycomCreated=false;
|
||||
if (jsonContent.getByPath("easycom").toString().contains( "^sys-" + dto.getOutputValue() + "-(.*)")) {
|
||||
isEasycomCreated=true;
|
||||
}
|
||||
//如果已经包含了此地址 就不再生成
|
||||
if(isPageCreated&&isEasycomCreated){
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isPageCreated) {
|
||||
Map<String, Object> listJsonMap = new HashMap<>();
|
||||
listJsonMap.put("path", "pages/" + dto.getOutputValue() + StringPool.SLASH + (isOutputDirLowerName ? dto.getClassName().toLowerCase() : dto.getClassName()) + StringPool.SLASH + "list");
|
||||
Map<String, Object> listStyleMap = new HashMap<>();
|
||||
listStyleMap.put("navigationBarTitleText", menuDto.getName());
|
||||
listJsonMap.put("style", listStyleMap);
|
||||
|
||||
|
||||
// Map<String, Object> formJsonMap = new HashMap<>();
|
||||
// formJsonMap.put("path", "pages/" + dto.getOutputValue() + StringPool.SLASH + dto.getClassName().toLowerCase() + StringPool.SLASH + "form");
|
||||
// Map<String, Object> formStyleMap = new HashMap<>();
|
||||
// formStyleMap.put("navigationBarTitleText", "新增");
|
||||
// formJsonMap.put("style", formStyleMap);
|
||||
|
||||
Map<String, Object> containerJsonMap = new HashMap<>();
|
||||
containerJsonMap.put("path", "pages/" + dto.getOutputValue() + StringPool.SLASH + dto.getClassName().toLowerCase() + StringPool.SLASH + "container");
|
||||
Map<String, Object> containerStyleMap = new HashMap<>();
|
||||
containerStyleMap.put("navigationBarTitleText", "新增");
|
||||
containerJsonMap.put("style", containerStyleMap);
|
||||
|
||||
JSONArray pages = JSONUtil.parseArray(jsonContent.getByPath("pages").toString());
|
||||
|
||||
pages.add(listJsonMap);
|
||||
// pages.add(formJsonMap);
|
||||
pages.add(containerJsonMap);
|
||||
|
||||
jsonContent.putByPath("pages", pages);
|
||||
}
|
||||
|
||||
if(!isEasycomCreated){
|
||||
JSONObject easycom = JSONUtil.parseObj(jsonContent.getByPath("easycom").toString());
|
||||
JSONObject custom = easycom.getJSONObject("custom");
|
||||
custom.putIfAbsent("^sys-" + dto.getOutputValue() + "-(.*)","@/pages/" + dto.getOutputValue() + "/$1/form.vue");
|
||||
|
||||
jsonContent.putByPath("easycom", easycom);
|
||||
}
|
||||
|
||||
FileUtil.writeString(jsonContent.toJSONString(4), tempFile, StandardCharsets.UTF_8);
|
||||
|
||||
// \components\system-form\index.vue 文件修改
|
||||
String indexFilePath = generatePathConfig.getAppPath() + StringPool.SLASH +
|
||||
"components" + StringPool.SLASH + "system-form" + StringPool.SLASH + "index.vue";
|
||||
String indexFileContent = FileUtil.readUtf8String(indexFilePath);
|
||||
String newIndexFileContent = StringUtils.replace(indexFileContent, "<!--html-->", dto.getTagString());
|
||||
FileUtil.writeUtf8String(newIndexFileContent, indexFilePath);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据json 生成后端代码
|
||||
* @param generatorConfig
|
||||
*/
|
||||
@SneakyThrows
|
||||
private void generatorEndCode(GeneratorConfig generatorConfig){
|
||||
|
||||
Optional<TableConfig> tableConfigOptional = generatorConfig.getTableConfigs().stream().filter(TableConfig::getIsMain).findFirst();
|
||||
//主表
|
||||
TableConfig mainTable;
|
||||
if (tableConfigOptional.isPresent()) {
|
||||
mainTable = tableConfigOptional.get();
|
||||
} else {
|
||||
throw new MyException("请选择主表");
|
||||
}
|
||||
|
||||
OutputConfig outputConfig = generatorConfig.getOutputConfig();
|
||||
String databaseId = generatorConfig.getDatabaseId();
|
||||
if (BooleanUtils.isTrue(outputConfig.getIsDataAuth())) {
|
||||
// 添加权限字段 rule_user_id
|
||||
DataSource dataSource = DatasourceUtil.getDataSource(databaseId);
|
||||
String[] columnNames = MetaUtil.getColumnNames(dataSource, mainTable.getTableName());
|
||||
if (!ArrayUtils.contains(columnNames, GlobalConstant.AUTH_USER_ID)) {
|
||||
DbType dbType = databaselinkClient.getDatabaselinkDbTypeFeign(databaseId);
|
||||
Db.use(dataSource).executeBatch(SqlUtil.buildAddDataAuthFieldSqls(dbType, mainTable.getTableName()));
|
||||
}
|
||||
}
|
||||
|
||||
//修改 getTableInfos 也记得修改 FromTemplateServiceImpl 的同名方法
|
||||
List<Table> tableInfos = getTableInfos(generatorConfig);
|
||||
|
||||
createCodeFile(generatorConfig, mainTable, tableInfos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表结构信息
|
||||
*
|
||||
* @param generatorConfig
|
||||
* @return
|
||||
*/
|
||||
private List<Table> getTableInfos(GeneratorConfig generatorConfig) {
|
||||
List<Table> tableInfos = new ArrayList<>();
|
||||
for (TableConfig tableConfig : generatorConfig.getTableConfigs()) {
|
||||
//判断是否为默认数据源
|
||||
if (StrUtil.equalsIgnoreCase(generatorConfig.getDatabaseId(), GlobalConstant.DEFAULT_DATASOURCE_KEY)) {
|
||||
tableInfos.add(MetaUtil.getTableMeta(DatasourceUtil.getDatasourceMaster(), tableConfig.getTableName()));
|
||||
} else {
|
||||
tableInfos.add(MetaUtil.getTableMeta(DatasourceUtil.getDataSource(generatorConfig.getDatabaseId()), tableConfig.getTableName()));
|
||||
}
|
||||
}
|
||||
return tableInfos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据配置生成文件
|
||||
*
|
||||
* @param generatorConfig
|
||||
* @param mainTable
|
||||
* @param tableInfos
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
private void createCodeFile(GeneratorConfig generatorConfig, TableConfig mainTable, List<Table> tableInfos) throws FileNotFoundException {
|
||||
String className = generatorConfig.getOutputConfig().getClassName();
|
||||
// 输出区域 在 微服务中 的 代表 选择服务模块
|
||||
String dirValue = generatorConfig.getOutputConfig().getOutputValue();
|
||||
|
||||
//---------------------------------------生成entity开始----------------------------------------------------
|
||||
{
|
||||
Map<String, String> entityCodeMap = GeneratorUtil.getEntityCode(generatorConfig, tableInfos);
|
||||
|
||||
for (Map.Entry<String, String> entry : entityCodeMap.entrySet()) {
|
||||
GeneratorUtil.writeFile(GeneratorUtil.getEntityOutputDir(dirValue), entry.getKey() + StringPool.DOT_JAVA, entry.getValue());
|
||||
}
|
||||
}
|
||||
//---------------------------------------生成entity结束----------------------------------------------------
|
||||
|
||||
|
||||
//********************************************生成dto开始************************************************
|
||||
{
|
||||
Map<String, String> dtoMap = new HashMap<>(3);
|
||||
dtoMap.putAll(GeneratorUtil.getAddDtoCode(generatorConfig, tableInfos));
|
||||
dtoMap.putAll(GeneratorUtil.getUpdateDtoCode(generatorConfig, tableInfos));
|
||||
dtoMap.putAll(GeneratorUtil.getPageDtoCode(generatorConfig, tableInfos, mainTable));
|
||||
|
||||
for (Map.Entry<String, String> entry : dtoMap.entrySet()) {
|
||||
GeneratorUtil.writeFile(GeneratorUtil.getDtoOutputDir(dirValue), entry.getKey() + StringPool.DOT_JAVA, entry.getValue());
|
||||
}
|
||||
}
|
||||
//********************************************生成dto结束************************************************
|
||||
|
||||
//###############################################生成Vo开始###############################################
|
||||
{
|
||||
Map<String, String> voMap = new HashMap<>(2);
|
||||
voMap.putAll(GeneratorUtil.getPageVoCode(generatorConfig, tableInfos, mainTable));
|
||||
voMap.putAll(GeneratorUtil.getInfoVoCode(generatorConfig, tableInfos, mainTable));
|
||||
|
||||
for (Map.Entry<String, String> entry : voMap.entrySet()) {
|
||||
GeneratorUtil.writeFile(GeneratorUtil.getVoOutputDir(dirValue), entry.getKey() + StringPool.DOT_JAVA, entry.getValue());
|
||||
}
|
||||
}
|
||||
//###############################################生成Vo结束###############################################
|
||||
|
||||
|
||||
//---------------------------------------生成三层代码开始----------------------------------------------------
|
||||
{
|
||||
Map<String, String> mapperCode = GeneratorUtil.getMapperCode(generatorConfig, tableInfos);
|
||||
|
||||
for (Map.Entry<String, String> entry : mapperCode.entrySet()) {
|
||||
GeneratorUtil.writeFile(GeneratorUtil.getMapperOutputDir(dirValue), entry.getKey() + StringPool.DOT_JAVA, entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
Map<String, String> serviceCode = GeneratorUtil.getServiceCode(generatorConfig, mainTable, tableInfos.size() > 1);
|
||||
|
||||
for (Map.Entry<String, String> entry : serviceCode.entrySet()) {
|
||||
GeneratorUtil.writeFile(GeneratorUtil.getServiceOutputDir(dirValue), entry.getKey() + StringPool.DOT_JAVA, entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
Map<String, String> serviceImplCode = GeneratorUtil.getServiceImplCode(generatorConfig, mainTable, tableInfos.size() > 1);
|
||||
for (Map.Entry<String, String> entry : serviceImplCode.entrySet()) {
|
||||
GeneratorUtil.writeFile(GeneratorUtil.getServiceImplOutputDir(dirValue), entry.getKey() + StringPool.DOT_JAVA, entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
Map<String, String> controllerCode = GeneratorUtil.getControllerCode(generatorConfig, tableInfos, mainTable);
|
||||
for (Map.Entry<String, String> entry : controllerCode.entrySet()) {
|
||||
GeneratorUtil.writeFile(GeneratorUtil.getControllerOutputDir(dirValue), entry.getKey() + StringPool.DOT_JAVA, entry.getValue());
|
||||
}
|
||||
}
|
||||
//---------------------------------------生成三层代码结束----------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.xjrsoft.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.xjrsoft.app.entity.AppMenuButton;
|
||||
import com.xjrsoft.app.mapper.AppMenuButtonMapper;
|
||||
import com.xjrsoft.app.service.IAppMenuButtonService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* app菜单按钮 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-12-25
|
||||
*/
|
||||
@Service
|
||||
public class AppMenuButtonServiceImpl extends ServiceImpl<AppMenuButtonMapper, AppMenuButton> implements IAppMenuButtonService {
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
package com.xjrsoft.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.xjrsoft.app.entity.AppMenuColumn;
|
||||
import com.xjrsoft.app.mapper.AppMenuColumnMapper;
|
||||
import com.xjrsoft.app.service.IAppMenuColumnService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* app菜单列表字段 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-12-25
|
||||
*/
|
||||
@Service
|
||||
public class AppMenuColumnServiceImpl extends ServiceImpl<AppMenuColumnMapper, AppMenuColumn> implements IAppMenuColumnService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.xjrsoft.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.xjrsoft.app.entity.AppMenuForm;
|
||||
import com.xjrsoft.app.mapper.AppMenuFormMapper;
|
||||
import com.xjrsoft.app.service.IAppMenuFormService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* app菜单表单字段 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-12-25
|
||||
*/
|
||||
@Service
|
||||
public class AppMenuFormServiceImpl extends ServiceImpl<AppMenuFormMapper, AppMenuForm> implements IAppMenuFormService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package com.xjrsoft.app.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.xjrsoft.app.entity.AppAuthorize;
|
||||
import com.xjrsoft.app.entity.AppMenu;
|
||||
import com.xjrsoft.app.mapper.AppAuthorizeMapper;
|
||||
import com.xjrsoft.app.mapper.AppMenuMapper;
|
||||
import com.xjrsoft.app.service.IAppMenuService;
|
||||
import com.xjrsoft.common.core.enums.AuthorizeType;
|
||||
import com.xjrsoft.common.core.enums.EnabledMark;
|
||||
import com.xjrsoft.organization.client.IUserRoleRelationClient;
|
||||
import com.xjrsoft.organization.entity.UserRoleRelation;
|
||||
import com.xjrsoft.system.dto.MenuTreeDto;
|
||||
import com.xjrsoft.tenant.util.SecureUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-07-26
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class AppMenuServiceImpl extends ServiceImpl<AppMenuMapper, AppMenu> implements IAppMenuService {
|
||||
|
||||
private final IUserRoleRelationClient userRoleRelationClient;
|
||||
|
||||
private final AppAuthorizeMapper appAuthorizeMapper;
|
||||
|
||||
@Override
|
||||
public List<AppMenu> getAppAuthMenuList(MenuTreeDto dto) {
|
||||
List<UserRoleRelation> relations = userRoleRelationClient.getUserRoleRelationListByUserIdFeign(StpUtil.getLoginIdAsLong());
|
||||
if (CollectionUtils.isEmpty(relations)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<Long> roleIds = relations.stream().map(UserRoleRelation::getRoleId).collect(Collectors.toList());
|
||||
List<Long> authMenuIdList = null;
|
||||
// 非超级管理员权限过滤
|
||||
if (!SecureUtil.isAdmin(roleIds)) {
|
||||
List<AppAuthorize> authorizeList = appAuthorizeMapper.selectList(Wrappers.<AppAuthorize>lambdaQuery()
|
||||
.eq(AppAuthorize::getAppAuthorizeType, AuthorizeType.MENU.getCode())
|
||||
.in(AppAuthorize::getRoleId, roleIds));
|
||||
if (CollectionUtils.isEmpty(authorizeList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
authMenuIdList = authorizeList.stream().map(AppAuthorize::getObjectId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
return this.list(Wrappers.<AppMenu>lambdaQuery()
|
||||
.like(StrUtil.isNotBlank(dto.getCode()), AppMenu::getCode, dto.getCode())
|
||||
.like(StrUtil.isNotBlank(dto.getName()), AppMenu::getName, dto.getName())
|
||||
.in(CollectionUtils.isNotEmpty(authMenuIdList), AppMenu::getId, authMenuIdList)
|
||||
.eq(AppMenu::getEnabledMark, EnabledMark.ENABLED.getCode())
|
||||
.orderByAsc(AppMenu::getSortCode)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,225 @@
|
||||
package com.xjrsoft.app.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSON;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.xjrsoft.app.dto.AddAppPageDesignDto;
|
||||
import com.xjrsoft.app.dto.UpdateAppPageDesignDto;
|
||||
import com.xjrsoft.app.entity.AppMenu;
|
||||
import com.xjrsoft.app.entity.AppPageDesign;
|
||||
import com.xjrsoft.app.mapper.AppMenuMapper;
|
||||
import com.xjrsoft.app.mapper.AppPageDesignMapper;
|
||||
import com.xjrsoft.app.service.IAppPageDesignService;
|
||||
import com.xjrsoft.common.core.config.GeneratePathConfig;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.enums.YesOrNoEnum;
|
||||
import com.xjrsoft.common.core.exception.MyException;
|
||||
import com.xjrsoft.common.redis.service.RedisUtil;
|
||||
import com.xjrsoft.generate.utils.GeneratorUtil;
|
||||
import com.xjrsoft.system.entity.DictionaryDetail;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* xjr_data_display【数据展示表】 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-06-25
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class AppPageDesignServiceImpl extends ServiceImpl<AppPageDesignMapper, AppPageDesign> implements IAppPageDesignService {
|
||||
|
||||
private final AppMenuMapper appMenuMapper;
|
||||
|
||||
private final GeneratePathConfig generatePathConfig;
|
||||
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@SneakyThrows
|
||||
public Boolean add(AddAppPageDesignDto dto) {
|
||||
long count = count(Wrappers.<AppPageDesign>query().lambda().eq(AppPageDesign::getName, dto.getName()));
|
||||
if (count > 0) {
|
||||
throw new MyException("此数据展示页已经存在!");
|
||||
}
|
||||
AppPageDesign appPageDesign = BeanUtil.toBean(dto, AppPageDesign.class);
|
||||
|
||||
List<DictionaryDetail> detailList = redisUtil.get(GlobalConstant.DIC_DETAIL_CACHE_KEY, new TypeReference<List<DictionaryDetail>>() {
|
||||
});
|
||||
|
||||
|
||||
if (dto.getIsMenu() == YesOrNoEnum.YES.getCode()) {
|
||||
|
||||
|
||||
Optional<DictionaryDetail> first = detailList.stream().filter(x -> x.getId().equals(dto.getCategoryId())).findFirst();
|
||||
|
||||
if (!first.isPresent()) {
|
||||
throw new MyException("找不到当前功能类别信息!");
|
||||
}
|
||||
AppMenu appMenu = new AppMenu();
|
||||
appMenu.setCode(dto.getCode());
|
||||
appMenu.setName(dto.getName());
|
||||
appMenu.setIcon(dto.getIcon());
|
||||
appMenu.setCategoryId(dto.getCategoryId());
|
||||
appMenu.setRemark(dto.getRemark());
|
||||
appMenu.setUrl(StringPool.SLASH+"pages"+StringPool.SLASH +first.get().getValue().toLowerCase() + StringPool.SLASH + dto.getCode().toLowerCase());
|
||||
appMenuMapper.insert(appMenu);
|
||||
|
||||
appPageDesign.setAppMenuId(appMenu.getId());
|
||||
save(appPageDesign);
|
||||
|
||||
//保存成功之后 生成代码
|
||||
GeneratorUtil.writeFile(getPageOutputDir(first.get().getValue()), dto.getCode().toLowerCase() + StringPool.DOT + "vue", dto.getPageCode());
|
||||
|
||||
File tempFile = FileUtil.file(generatePathConfig.getAppPath() + StringPool.SLASH + "pages.json");
|
||||
|
||||
JSON jsonContent = JSONUtil.readJSON(tempFile, StandardCharsets.UTF_8);
|
||||
|
||||
Map<String, Object> pageJsonMap = new HashMap<>();
|
||||
pageJsonMap.put("path", "pages/" + first.get().getValue().toLowerCase() + StringPool.SLASH + dto.getCode().toLowerCase());
|
||||
Map<String, Object> styleMap = new HashMap<>();
|
||||
styleMap.put("navigationBarTitleText", dto.getName());
|
||||
pageJsonMap.put("style", styleMap);
|
||||
|
||||
JSONArray pages = JSONUtil.parseArray(jsonContent.getByPath("pages").toString());
|
||||
|
||||
pages.add(pageJsonMap);
|
||||
|
||||
jsonContent.putByPath("pages", pages);
|
||||
|
||||
FileUtil.writeString(jsonContent.toJSONString(4), tempFile, StandardCharsets.UTF_8);
|
||||
|
||||
|
||||
} else {
|
||||
save(appPageDesign);
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@SneakyThrows
|
||||
public Boolean modify(UpdateAppPageDesignDto dto) {
|
||||
|
||||
AppPageDesign appPageDesign = BeanUtil.toBean(dto, AppPageDesign.class);
|
||||
|
||||
|
||||
if (dto.getIsMenu() == YesOrNoEnum.YES.getCode()) {
|
||||
List<DictionaryDetail> detailList = redisUtil.get(GlobalConstant.DIC_DETAIL_CACHE_KEY, new TypeReference<List<DictionaryDetail>>() {
|
||||
});
|
||||
|
||||
Optional<DictionaryDetail> first = detailList.stream().filter(x -> x.getId().equals(dto.getCategoryId())).findFirst();
|
||||
|
||||
if (!first.isPresent()) {
|
||||
throw new MyException("找不到当前功能类别信息!");
|
||||
}
|
||||
GeneratorUtil.writeFile(getPageOutputDir(first.get().getValue().toLowerCase()), dto.getCode().toLowerCase() + StringPool.DOT + "vue", dto.getPageCode());
|
||||
|
||||
AppMenu appMenu = new AppMenu();
|
||||
appMenu.setCode(dto.getCode());
|
||||
appMenu.setName(dto.getName());
|
||||
appMenu.setIcon(dto.getIcon());
|
||||
appMenu.setCategoryId(dto.getCategoryId());
|
||||
appMenu.setUrl(StringPool.SLASH+"pages"+StringPool.SLASH +first.get().getValue().toLowerCase() + StringPool.SLASH + dto.getCode().toLowerCase());
|
||||
appMenu.setRemark(dto.getRemark());
|
||||
//如果发布菜单 menuid 不为空 则需要修改
|
||||
if (ObjectUtil.isNotNull(dto.getAppMenuId())) {
|
||||
appMenu.setId(dto.getAppMenuId());
|
||||
|
||||
appMenuMapper.updateById(appMenu);
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
appMenuMapper.insert(appMenu);
|
||||
}
|
||||
|
||||
// //保存成功之后 生成代码
|
||||
// GeneratorUtil.writeFile(getPageOutputDir(first.get().getValue()), dto.getCode().toLowerCase() + StringPool.DOT + "vue", dto.getPageCode());
|
||||
|
||||
File tempFile = FileUtil.file(generatePathConfig.getAppPath() + StringPool.SLASH + "pages.json");
|
||||
|
||||
JSON jsonContent = JSONUtil.readJSON(tempFile, StandardCharsets.UTF_8);
|
||||
|
||||
//判断page.json里面是否有对应的路径,没有就进行生成
|
||||
String path = "pages/" + first.get().getValue().toLowerCase() + StringPool.SLASH + dto.getCode().toLowerCase();
|
||||
|
||||
if (((JSONObject) jsonContent).get("pages").toString().contains(path)){
|
||||
JSONArray pages = JSONUtil.parseArray(jsonContent.getByPath("pages").toString());
|
||||
for (Object page : pages) {
|
||||
if (page.toString().contains(path) && !page.toString().contains(dto.getName())){//找到这个path路径的值,再判断页面名称是否改变,改变则先移除,再新增
|
||||
pages.remove(page);
|
||||
Map<String, Object> pageJsonMap = new HashMap<>();
|
||||
pageJsonMap.put("path", path);
|
||||
Map<String, Object> styleMap = new HashMap<>();
|
||||
styleMap.put("navigationBarTitleText", dto.getName());
|
||||
pageJsonMap.put("style", styleMap);
|
||||
pages.add(pageJsonMap);
|
||||
jsonContent.putByPath("pages", pages);
|
||||
FileUtil.writeString(jsonContent.toJSONString(4), tempFile, StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
Map<String, Object> pageJsonMap = new HashMap<>();
|
||||
pageJsonMap.put("path", path);
|
||||
Map<String, Object> styleMap = new HashMap<>();
|
||||
styleMap.put("navigationBarTitleText", dto.getName());
|
||||
pageJsonMap.put("style", styleMap);
|
||||
JSONArray pages = JSONUtil.parseArray(jsonContent.getByPath("pages").toString());
|
||||
pages.add(pageJsonMap);
|
||||
jsonContent.putByPath("pages", pages);
|
||||
FileUtil.writeString(jsonContent.toJSONString(4), tempFile, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
appPageDesign.setAppMenuId(appMenu.getId());
|
||||
|
||||
} else {
|
||||
//如果不发布菜单 并且 appmenuId又在 需要删除菜单
|
||||
if (ObjectUtil.isNotNull(dto.getAppMenuId())) {
|
||||
appMenuMapper.deleteById(dto.getAppMenuId());
|
||||
}
|
||||
}
|
||||
updateById(appPageDesign);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取实体类生成目录
|
||||
*
|
||||
* @param outputArea
|
||||
* @return
|
||||
*/
|
||||
private String getPageOutputDir(String outputArea) {
|
||||
return generatePathConfig.getAppPath() + StringPool.SLASH + "pages" + StringPool.SLASH + outputArea.toLowerCase();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: public
|
||||
@ -0,0 +1,76 @@
|
||||
server:
|
||||
port: 3004
|
||||
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: app-service
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
autoconfigure:
|
||||
#自动化配置 例外处理
|
||||
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
dynamic:
|
||||
primary: master
|
||||
datasource:
|
||||
master:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://new-energy-mysqlt.itc.gdyd.com:3307/fcd2-msat-init?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
|
||||
username: learun4dev
|
||||
password: ABcd1234@
|
||||
|
||||
cloud:
|
||||
nacos: #nacos监控
|
||||
discovery:
|
||||
server-addr: 10.0.252.1:8848
|
||||
namespace: ITC
|
||||
group: DNE
|
||||
username: nacos
|
||||
password: ABcd1234@
|
||||
config:
|
||||
server-addr: 10.0.252.1:8848 # nacos 配置中心地址
|
||||
namespace: ITC
|
||||
group: DNE
|
||||
username: nacos
|
||||
password: ABcd1234@
|
||||
file-extension: yml # 指定格式 xjrsoft-demo-service-dev.yml
|
||||
extension-configs:
|
||||
- data-id: global-config.yml #导入全局配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
- data-id: mybatis-plus-config.yml #导入mybatisplus 配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
- data-id: sa-token-client-config.yml #导入sa-token配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
- data-id: redis-config.yml #导入redis配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
- data-id: seata-config.yml #导入seata配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
sentinel:
|
||||
transport:
|
||||
dashboard: localhost:8080 #sentinel dashboard 地址
|
||||
port: 8719 #默认端口, 如果 被占用,会一直+1 直到未被占用为止
|
||||
|
||||
|
||||
|
||||
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
path: /swagger-ui.html
|
||||
tags-sorter: alpha
|
||||
operations-sorter: alpha
|
||||
show-extensions: true
|
||||
api-docs:
|
||||
path: /app/v3/api-docs
|
||||
group-configs:
|
||||
- group: 'default'
|
||||
paths-to-match: '/app/**'
|
||||
packages-to-scan: com.xjrsoft.app
|
||||
default-flat-param-object: false
|
||||
|
||||
16
xjrsoft-service/xjrsoft-service-bi/Dockerfile
Normal file
16
xjrsoft-service/xjrsoft-service-bi/Dockerfile
Normal file
@ -0,0 +1,16 @@
|
||||
# 基础镜像
|
||||
FROM nexus.gdyditc.com:8082/openjdk:11-arm64
|
||||
# author
|
||||
MAINTAINER xjrsoft
|
||||
|
||||
# 挂载目录
|
||||
VOLUME /home/xjrsoft
|
||||
# 创建目录
|
||||
RUN mkdir -p /home/xjrsoft
|
||||
# 指定路径
|
||||
WORKDIR /home/xjrsoft
|
||||
# 复制jar文件到路径
|
||||
RUN ls
|
||||
COPY ./target/xjrsoft-service-bi.jar /home/xjrsoft/xjrsoft-service-bi.jar
|
||||
# 启动认证服务
|
||||
ENTRYPOINT ["java","-Dfile.encoding=utf-8","--add-opens","java.base/java.lang.reflect=ALL-UNNAMED","-jar","xjrsoft-service-bi.jar"]
|
||||
75
xjrsoft-service/xjrsoft-service-bi/pom.xml
Normal file
75
xjrsoft-service/xjrsoft-service-bi/pom.xml
Normal file
@ -0,0 +1,75 @@
|
||||
<?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>xjrsoft-service</artifactId>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>xjrsoft-service-bi</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-system-api</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-common-core</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-common-mybatis</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-bi-api</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-loadbalancer</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,23 @@
|
||||
package com.xjrsoft.bi;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/17 9:40
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients(basePackages = "com.xjrsoft")
|
||||
@MapperScan(value = "com.xjrsoft.**.mapper")
|
||||
@ComponentScan(value = "com.xjrsoft")
|
||||
public class BiApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(BiApplication.class, args);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,122 @@
|
||||
package com.xjrsoft.bi.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.xjrsoft.bi.dto.*;
|
||||
import com.xjrsoft.bi.entity.Project;
|
||||
import com.xjrsoft.bi.service.IProjectService;
|
||||
import com.xjrsoft.bi.vo.ProjectInfoVo;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.enums.YesOrNoEnum;
|
||||
import com.xjrsoft.system.client.IMenuClient;
|
||||
import com.xjrsoft.system.entity.Menu;
|
||||
import com.xjrsoft.system.vo.MenuVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 项目表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-11-06
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.BI_MODULE_PREFIX + "/project")
|
||||
@Tag(name = GlobalConstant.BI_MODULE_PREFIX + "/project", description = "BI大屏设计模块")
|
||||
@AllArgsConstructor
|
||||
public class ProjectController {
|
||||
|
||||
private final IProjectService projectService;
|
||||
|
||||
private final IMenuClient menuClient;
|
||||
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "查询bi大屏列表(分页)")
|
||||
public R page(@Valid ProjectPageDto dto) {
|
||||
return R.ok(projectService.getPage(dto));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "查看详情")
|
||||
public R info(@RequestParam Long id) {
|
||||
Project project = projectService.getById(id);
|
||||
return R.ok(BeanUtil.toBean(project, ProjectInfoVo.class));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/old")
|
||||
@Operation(summary = "获取以前发布菜单的数据")
|
||||
public R getOldValue(@RequestParam Long menuId) {
|
||||
Menu menu = menuClient.getMenuByIdFeign(menuId);
|
||||
|
||||
return R.ok(BeanUtil.toBean(menu, MenuVo.class));
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/index-image")
|
||||
@Operation(summary = "修改项目首页图片")
|
||||
public R updateIndexImage(@Valid @RequestBody UpdateProjectIndexImageDto dto) {
|
||||
Project project = BeanUtil.toBean(dto, Project.class);
|
||||
return R.ok(projectService.updateById(project));
|
||||
}
|
||||
|
||||
@PutMapping("/content")
|
||||
@Operation(summary = "修改项目json")
|
||||
public R updateContent(@Valid @RequestBody UpdateProjectContentDto dto) {
|
||||
Project project = BeanUtil.toBean(dto, Project.class);
|
||||
return R.ok(projectService.updateById(project));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "创建项目")
|
||||
public R add(@Valid @RequestBody AddProjectDto dto) {
|
||||
Project project = BeanUtil.toBean(dto, Project.class);
|
||||
// project.setContent("{}");
|
||||
project.setState(YesOrNoEnum.YES.getCode());
|
||||
projectService.save(project);
|
||||
return R.ok(project.getId());
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "保存项目")
|
||||
public R update(@Valid @RequestBody UpdateProjectDto dto) {
|
||||
Project project = BeanUtil.toBean(dto, Project.class);
|
||||
projectService.updateById(project);
|
||||
return R.ok(project.getId());
|
||||
}
|
||||
|
||||
@PutMapping("/publish")
|
||||
@Operation(summary = "发布/不发布")
|
||||
public R publish(@Valid @RequestBody PublishProjectDto dto) {
|
||||
Project project = BeanUtil.toBean(dto, Project.class);
|
||||
return R.ok(projectService.updateById(project));
|
||||
}
|
||||
|
||||
@PostMapping("/publish-menu")
|
||||
@Operation(summary = "发布菜单")
|
||||
public R publishMenu(@Valid @RequestBody PublishMenuDto dto) {
|
||||
return R.ok(projectService.publishMenu(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/cancel-menu")
|
||||
@Operation(summary = "取消发布菜单")
|
||||
public R cancelMenu(@Valid @RequestBody CancelMenuDto dto) {
|
||||
return R.ok(projectService.cancelMenu(dto));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
public R delete(@RequestBody List<Long> ids) {
|
||||
return R.ok(projectService.deleteProject(ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.xjrsoft.bi.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.bi.dto.CancelMenuDto;
|
||||
import com.xjrsoft.bi.dto.ProjectPageDto;
|
||||
import com.xjrsoft.bi.dto.PublishMenuDto;
|
||||
import com.xjrsoft.bi.entity.Project;
|
||||
import com.xjrsoft.bi.vo.ProjectPageVo;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 项目表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-11-06
|
||||
*/
|
||||
public interface IProjectService extends MPJBaseService<Project> {
|
||||
|
||||
|
||||
PageOutput<ProjectPageVo> getPage(ProjectPageDto dto);
|
||||
|
||||
/**
|
||||
* 发布菜单
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
boolean publishMenu(PublishMenuDto dto);
|
||||
|
||||
/**
|
||||
* 取消发布
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
boolean cancelMenu(CancelMenuDto dto);
|
||||
|
||||
/**
|
||||
* 删除项目
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
boolean deleteProject(List<Long> ids);
|
||||
}
|
||||
@ -0,0 +1,170 @@
|
||||
package com.xjrsoft.bi.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.db.DbUtil;
|
||||
import cn.hutool.db.Entity;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.bi.dto.CancelMenuDto;
|
||||
import com.xjrsoft.bi.dto.ProjectPageDto;
|
||||
import com.xjrsoft.bi.dto.PublishMenuDto;
|
||||
import com.xjrsoft.bi.entity.Project;
|
||||
import com.xjrsoft.bi.mapper.ProjectMapper;
|
||||
import com.xjrsoft.bi.service.IProjectService;
|
||||
import com.xjrsoft.bi.vo.ProjectPageVo;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.enums.MenuType;
|
||||
import com.xjrsoft.common.core.enums.PublishStateType;
|
||||
import com.xjrsoft.common.core.enums.YesOrNoEnum;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.common.mybatis.utils.DatasourceUtil;
|
||||
import com.xjrsoft.system.client.IMenuClient;
|
||||
import com.xjrsoft.system.entity.Menu;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 项目表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2022-11-06
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class ProjectServiceImpl extends MPJBaseServiceImpl<ProjectMapper, Project> implements IProjectService {
|
||||
|
||||
private final static String PREVIEW_URL_PRE = "/#/chart/preview/";
|
||||
|
||||
private final static String IFARME_STRING = "IFrame";
|
||||
private final IMenuClient menuClient;
|
||||
|
||||
@Override
|
||||
public PageOutput<ProjectPageVo> getPage(ProjectPageDto dto) {
|
||||
|
||||
LambdaQueryWrapper<Project> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StrUtil.isNotBlank(dto.getKeyword()), Project::getProjectName, dto.getKeyword())
|
||||
.select(Project.class, x -> VoToColumnUtil.fieldsToColumns(ProjectPageVo.class).contains(x.getProperty()));
|
||||
|
||||
IPage<Project> page = page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<ProjectPageVo> pageOutput = ConventPage.getPageOutput(page, ProjectPageVo.class);
|
||||
|
||||
List<Long> allMenuId = pageOutput.getList().stream().map(ProjectPageVo::getMenuId).collect(Collectors.toList());
|
||||
|
||||
List<Menu> menuList = menuClient.getMenuListByIdsFeign(allMenuId);
|
||||
|
||||
for (ProjectPageVo projectPageVo : pageOutput.getList()) {
|
||||
Optional<Menu> menuOptional = menuList.stream().filter(x -> x.getId().equals(projectPageVo.getMenuId())).findFirst();
|
||||
|
||||
//如果能查询到菜单数据 代表 要么 发布过 要么 正在发布
|
||||
if (menuOptional.isPresent()) {
|
||||
// 如果式已删除状态 属于 发布过已经取消状态
|
||||
if (menuOptional.get().getDeleteMark() == YesOrNoEnum.YES.getCode()) {
|
||||
projectPageVo.setPublishState(PublishStateType.PT.getCode());
|
||||
} else {
|
||||
projectPageVo.setPublishState(PublishStateType.ING.getCode());
|
||||
}
|
||||
|
||||
} else {
|
||||
projectPageVo.setPublishState(PublishStateType.NO.getCode());
|
||||
}
|
||||
|
||||
}
|
||||
return pageOutput;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@SneakyThrows
|
||||
public boolean publishMenu(PublishMenuDto dto) {
|
||||
|
||||
Menu menu = BeanUtil.toBean(dto, Menu.class);
|
||||
|
||||
if (ObjectUtil.isEmpty(menu.getParentId())){
|
||||
menu.setParentId(0L);
|
||||
}
|
||||
if (ObjectUtil.isEmpty(menu.getSystemId())){
|
||||
menu.setSystemId(1L);
|
||||
}
|
||||
menu.setComponent(IFARME_STRING);
|
||||
menu.setComponentType(YesOrNoEnum.YES.getCode());
|
||||
menu.setPath(dto.getUrl() + PREVIEW_URL_PRE + dto.getProjectId());
|
||||
menu.setMenuType(MenuType.FUNCTION.getCode());
|
||||
menu.setDisplay(YesOrNoEnum.YES.getCode());
|
||||
menu.setAllowDelete(YesOrNoEnum.YES.getCode());
|
||||
menu.setAllowModify(YesOrNoEnum.YES.getCode());
|
||||
menu.setOutLink(YesOrNoEnum.YES.getCode());
|
||||
menu.setKeepAlive(YesOrNoEnum.NO.getCode());
|
||||
menu.setName(menu.getTitle());
|
||||
|
||||
//如果没有传入 menuId 默认是新增 如果传入了 就是修改
|
||||
if (ObjectUtil.isNotNull(dto.getMenuId())) {
|
||||
// menu.setDeleteMark(YesOrNoEnum.NO.getCode());
|
||||
menuClient.updateMenuFeign(menu);
|
||||
|
||||
String tableName = "xjr_menu";
|
||||
|
||||
DataSource datasourceMaster = DatasourceUtil.getDatasourceMaster();
|
||||
Entity entity = Entity.create(tableName).set(GlobalConstant.DELETE_MARK, YesOrNoEnum.NO.getCode());
|
||||
Entity where = Entity.create(tableName).set(GlobalConstant.DEFAULT_PK, menu.getId());
|
||||
DbUtil.use(datasourceMaster).update(entity, where);
|
||||
} else {
|
||||
menuClient.insertMenuFeign(menu);
|
||||
}
|
||||
|
||||
Project project = new Project();
|
||||
project.setId(dto.getProjectId());
|
||||
project.setMenuId(menu.getId());
|
||||
|
||||
updateById(project);
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean cancelMenu(CancelMenuDto dto) {
|
||||
|
||||
Project project = new Project();
|
||||
project.setId(dto.getId());
|
||||
|
||||
updateById(project);
|
||||
|
||||
menuClient.deleteMenuFeign(dto.getMenuId());
|
||||
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean deleteProject(List<Long> ids) {
|
||||
|
||||
LambdaQueryWrapper<Project> select = Wrappers.lambdaQuery(Project.class).in(Project::getId, ids).isNotNull(Project::getMenuId).select(Project::getMenuId);
|
||||
List<Project> list = list(select);
|
||||
|
||||
if (list.size() > 0) {
|
||||
List<Long> menuId = list.stream().map(Project::getMenuId).collect(Collectors.toList());
|
||||
|
||||
menuClient.deleteMenuBatchFeign(menuId);
|
||||
}
|
||||
|
||||
|
||||
removeByIds(ids);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: public
|
||||
@ -0,0 +1,75 @@
|
||||
server:
|
||||
port: 3005
|
||||
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: bi-service
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
autoconfigure:
|
||||
#自动化配置 例外处理
|
||||
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
dynamic:
|
||||
primary: master
|
||||
datasource:
|
||||
master:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://new-energy-mysqlt.itc.gdyd.com:3307/fcd2-msat-init?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
|
||||
username: learun4dev
|
||||
password: ABcd1234@
|
||||
|
||||
cloud:
|
||||
nacos: #nacos监控
|
||||
discovery:
|
||||
server-addr: 10.0.252.1:8848
|
||||
namespace: ITC
|
||||
group: DNE
|
||||
username: nacos
|
||||
password: ABcd1234@
|
||||
config:
|
||||
server-addr: 10.0.252.1:8848 # nacos 配置中心地址
|
||||
namespace: ITC
|
||||
group: DNE
|
||||
username: nacos
|
||||
password: ABcd1234@
|
||||
file-extension: yml # 指定格式 xjrsoft-demo-service-dev.yml
|
||||
extension-configs:
|
||||
- data-id: global-config.yml #导入全局配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
- data-id: mybatis-plus-config.yml #导入mybatisplus 配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
- data-id: sa-token-client-config.yml #导入sa-token配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
- data-id: redis-config.yml #导入redis配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
- data-id: seata-config.yml #导入seata配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
sentinel:
|
||||
transport:
|
||||
dashboard: localhost:8080 #sentinel dashboard 地址
|
||||
port: 8719 #默认端口, 如果 被占用,会一直+1 直到未被占用为止
|
||||
|
||||
|
||||
|
||||
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
path: /swagger-ui.html
|
||||
tags-sorter: alpha
|
||||
operations-sorter: alpha
|
||||
show-extensions: true
|
||||
api-docs:
|
||||
path: /bi/v3/api-docs
|
||||
group-configs:
|
||||
- group: 'default'
|
||||
paths-to-match: '/bi/**'
|
||||
packages-to-scan: com.xjrsoft.bi
|
||||
default-flat-param-object: false
|
||||
16
xjrsoft-service/xjrsoft-service-demo/Dockerfile
Normal file
16
xjrsoft-service/xjrsoft-service-demo/Dockerfile
Normal file
@ -0,0 +1,16 @@
|
||||
# 基础镜像
|
||||
FROM nexus.gdyditc.com:8082/openjdk:11-arm64
|
||||
# author
|
||||
MAINTAINER xjrsoft
|
||||
|
||||
# 挂载目录
|
||||
VOLUME /home/xjrsoft
|
||||
# 创建目录
|
||||
RUN mkdir -p /home/xjrsoft
|
||||
# 指定路径
|
||||
WORKDIR /home/xjrsoft
|
||||
# 复制jar文件到路径
|
||||
RUN ls
|
||||
COPY ./target/xjrsoft-service-demo.jar /home/xjrsoft/xjrsoft-service-demo.jar
|
||||
# 启动认证服务
|
||||
ENTRYPOINT ["java","-Dfile.encoding=utf-8","--add-opens","java.base/java.lang.reflect=ALL-UNNAMED","-jar","xjrsoft-service-demo.jar"]
|
||||
64
xjrsoft-service/xjrsoft-service-demo/pom.xml
Normal file
64
xjrsoft-service/xjrsoft-service-demo/pom.xml
Normal file
@ -0,0 +1,64 @@
|
||||
<?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>xjrsoft-service</artifactId>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>xjrsoft-service-demo</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-demo-api</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-common-mybatis</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-system-api</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-common-advice</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,23 @@
|
||||
package com.xjrsoft.demo;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/24 15:22
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients(basePackages = "com.xjrsoft")
|
||||
@MapperScan(value = "com.xjrsoft.**.mapper")
|
||||
@ComponentScan(value = "com.xjrsoft")
|
||||
public class DemoApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DemoApplication.class, args);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,104 @@
|
||||
package com.xjrsoft.demo.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.demo.dto.AddTest0055Dto;
|
||||
import com.xjrsoft.demo.dto.UpdateTest0055Dto;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import com.xjrsoft.demo.dto.Test0055PageDto;
|
||||
import com.xjrsoft.demo.entity.Test0055;
|
||||
import com.xjrsoft.demo.service.ITest0055Service;
|
||||
import com.xjrsoft.demo.vo.Test0055PageVo;
|
||||
|
||||
import com.xjrsoft.demo.vo.Test0055Vo;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: test0055
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/demo" + "/test0055")
|
||||
@Tag(name = "/demo" + "/test0055",description = "test0055代码")
|
||||
@AllArgsConstructor
|
||||
public class Test0055Controller {
|
||||
|
||||
|
||||
private final ITest0055Service test0055Service;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "Test0055列表(分页)")
|
||||
@SaCheckPermission("test0055:detail")
|
||||
public R page(@Valid Test0055PageDto dto){
|
||||
|
||||
LambdaQueryWrapper<Test0055> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen8385()),Test0055::getDanXingWenBen8385,dto.getDanXingWenBen8385())
|
||||
.eq(ObjectUtil.isNotNull(dto.getJiShuZuJian4979()),Test0055::getJiShuZuJian4979,dto.getJiShuZuJian4979())
|
||||
.orderByDesc(Test0055::getId)
|
||||
.select(Test0055.class,x -> VoToColumnUtil.fieldsToColumns(Test0055PageVo.class).contains(x.getProperty()));
|
||||
IPage<Test0055> page = test0055Service.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<Test0055PageVo> pageOutput = ConventPage.getPageOutput(page, Test0055PageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询Test0055信息")
|
||||
@SaCheckPermission("test0055:detail")
|
||||
public R info(@RequestParam Long id){
|
||||
Test0055 test0055 = test0055Service.getById(id);
|
||||
if (test0055 == null) {
|
||||
return R.error("找不到此数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(test0055, Test0055Vo.class));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增Test0055")
|
||||
@SaCheckPermission("test0055:add")
|
||||
public R add(@Valid @RequestBody AddTest0055Dto dto){
|
||||
Test0055 test0055 = BeanUtil.toBean(dto, Test0055.class);
|
||||
boolean isSuccess = test0055Service.save(test0055);
|
||||
return R.ok(isSuccess);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改Test0055")
|
||||
@SaCheckPermission("test0055:edit")
|
||||
public R update(@Valid @RequestBody UpdateTest0055Dto dto){
|
||||
|
||||
Test0055 test0055 = BeanUtil.toBean(dto, Test0055.class);
|
||||
return R.ok(test0055Service.updateById(test0055));
|
||||
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@SaCheckPermission("test0055:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(test0055Service.removeBatchByIds(ids));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,104 @@
|
||||
package com.xjrsoft.demo.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.demo.dto.AddTest0111Dto;
|
||||
import com.xjrsoft.demo.dto.UpdateTest0111Dto;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import com.xjrsoft.demo.dto.Test0111PageDto;
|
||||
import com.xjrsoft.demo.entity.Test0111;
|
||||
import com.xjrsoft.demo.service.ITest0111Service;
|
||||
import com.xjrsoft.demo.vo.Test0111PageVo;
|
||||
|
||||
import com.xjrsoft.demo.vo.Test0111Vo;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: test0111
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/demo" + "/test0111")
|
||||
@Tag(name = "/demo" + "/test0111",description = "test0111代码")
|
||||
@AllArgsConstructor
|
||||
public class Test0111Controller {
|
||||
|
||||
|
||||
private final ITest0111Service test0111Service;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "Test0111列表(分页)")
|
||||
@SaCheckPermission("test0111:detail")
|
||||
public R page(@Valid Test0111PageDto dto){
|
||||
|
||||
LambdaQueryWrapper<Test0111> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen3114()),Test0111::getDanXingWenBen3114,dto.getDanXingWenBen3114())
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen8682()),Test0111::getDanXingWenBen8682,dto.getDanXingWenBen8682())
|
||||
.orderByDesc(Test0111::getId)
|
||||
.select(Test0111.class,x -> VoToColumnUtil.fieldsToColumns(Test0111PageVo.class).contains(x.getProperty()));
|
||||
IPage<Test0111> page = test0111Service.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<Test0111PageVo> pageOutput = ConventPage.getPageOutput(page, Test0111PageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询Test0111信息")
|
||||
@SaCheckPermission("test0111:detail")
|
||||
public R info(@RequestParam Long id){
|
||||
Test0111 test0111 = test0111Service.getById(id);
|
||||
if (test0111 == null) {
|
||||
return R.error("找不到此数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(test0111, Test0111Vo.class));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增Test0111")
|
||||
@SaCheckPermission("test0111:add")
|
||||
public R add(@Valid @RequestBody AddTest0111Dto dto){
|
||||
Test0111 test0111 = BeanUtil.toBean(dto, Test0111.class);
|
||||
boolean isSuccess = test0111Service.save(test0111);
|
||||
return R.ok(isSuccess);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改Test0111")
|
||||
@SaCheckPermission("test0111:edit")
|
||||
public R update(@Valid @RequestBody UpdateTest0111Dto dto){
|
||||
|
||||
Test0111 test0111 = BeanUtil.toBean(dto, Test0111.class);
|
||||
return R.ok(test0111Service.updateById(test0111));
|
||||
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@SaCheckPermission("test0111:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(test0111Service.removeBatchByIds(ids));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,104 @@
|
||||
package com.xjrsoft.demo.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.demo.dto.AddTest0222Dto;
|
||||
import com.xjrsoft.demo.dto.UpdateTest0222Dto;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import com.xjrsoft.demo.dto.Test0222PageDto;
|
||||
import com.xjrsoft.demo.entity.Test0222;
|
||||
import com.xjrsoft.demo.service.ITest0222Service;
|
||||
import com.xjrsoft.demo.vo.Test0222PageVo;
|
||||
|
||||
import com.xjrsoft.demo.vo.Test0222Vo;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: test0222
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/demo" + "/test0222")
|
||||
@Tag(name = "/demo" + "/test0222",description = "test0222代码")
|
||||
@AllArgsConstructor
|
||||
public class Test0222Controller {
|
||||
|
||||
|
||||
private final ITest0222Service test0222Service;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "Test0222列表(分页)")
|
||||
@SaCheckPermission("test0222:detail")
|
||||
public R page(@Valid Test0222PageDto dto){
|
||||
|
||||
LambdaQueryWrapper<Test0222> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen4755()),Test0222::getDanXingWenBen4755,dto.getDanXingWenBen4755())
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen5512()),Test0222::getDanXingWenBen5512,dto.getDanXingWenBen5512())
|
||||
.orderByDesc(Test0222::getId)
|
||||
.select(Test0222.class,x -> VoToColumnUtil.fieldsToColumns(Test0222PageVo.class).contains(x.getProperty()));
|
||||
IPage<Test0222> page = test0222Service.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<Test0222PageVo> pageOutput = ConventPage.getPageOutput(page, Test0222PageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询Test0222信息")
|
||||
@SaCheckPermission("test0222:detail")
|
||||
public R info(@RequestParam Long id){
|
||||
Test0222 test0222 = test0222Service.getById(id);
|
||||
if (test0222 == null) {
|
||||
return R.error("找不到此数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(test0222, Test0222Vo.class));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增Test0222")
|
||||
@SaCheckPermission("test0222:add")
|
||||
public R add(@Valid @RequestBody AddTest0222Dto dto){
|
||||
Test0222 test0222 = BeanUtil.toBean(dto, Test0222.class);
|
||||
boolean isSuccess = test0222Service.save(test0222);
|
||||
return R.ok(isSuccess);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改Test0222")
|
||||
@SaCheckPermission("test0222:edit")
|
||||
public R update(@Valid @RequestBody UpdateTest0222Dto dto){
|
||||
|
||||
Test0222 test0222 = BeanUtil.toBean(dto, Test0222.class);
|
||||
return R.ok(test0222Service.updateById(test0222));
|
||||
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@SaCheckPermission("test0222:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(test0222Service.removeBatchByIds(ids));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,104 @@
|
||||
package com.xjrsoft.demo.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.demo.dto.AddTest033Dto;
|
||||
import com.xjrsoft.demo.dto.UpdateTest033Dto;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import com.xjrsoft.demo.dto.Test033PageDto;
|
||||
import com.xjrsoft.demo.entity.Test033;
|
||||
import com.xjrsoft.demo.service.ITest033Service;
|
||||
import com.xjrsoft.demo.vo.Test033PageVo;
|
||||
|
||||
import com.xjrsoft.demo.vo.Test033Vo;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: test033
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/demo" + "/test033")
|
||||
@Tag(name = "/demo" + "/test033",description = "test033代码")
|
||||
@AllArgsConstructor
|
||||
public class Test033Controller {
|
||||
|
||||
|
||||
private final ITest033Service test033Service;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "Test033列表(分页)")
|
||||
@SaCheckPermission("test033:detail")
|
||||
public R page(@Valid Test033PageDto dto){
|
||||
|
||||
LambdaQueryWrapper<Test033> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen8587()),Test033::getDanXingWenBen8587,dto.getDanXingWenBen8587())
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen2884()),Test033::getDanXingWenBen2884,dto.getDanXingWenBen2884())
|
||||
.orderByDesc(Test033::getId)
|
||||
.select(Test033.class,x -> VoToColumnUtil.fieldsToColumns(Test033PageVo.class).contains(x.getProperty()));
|
||||
IPage<Test033> page = test033Service.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<Test033PageVo> pageOutput = ConventPage.getPageOutput(page, Test033PageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询Test033信息")
|
||||
@SaCheckPermission("test033:detail")
|
||||
public R info(@RequestParam Long id){
|
||||
Test033 test033 = test033Service.getById(id);
|
||||
if (test033 == null) {
|
||||
return R.error("找不到此数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(test033, Test033Vo.class));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增Test033")
|
||||
@SaCheckPermission("test033:add")
|
||||
public R add(@Valid @RequestBody AddTest033Dto dto){
|
||||
Test033 test033 = BeanUtil.toBean(dto, Test033.class);
|
||||
boolean isSuccess = test033Service.save(test033);
|
||||
return R.ok(isSuccess);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改Test033")
|
||||
@SaCheckPermission("test033:edit")
|
||||
public R update(@Valid @RequestBody UpdateTest033Dto dto){
|
||||
|
||||
Test033 test033 = BeanUtil.toBean(dto, Test033.class);
|
||||
return R.ok(test033Service.updateById(test033));
|
||||
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@SaCheckPermission("test033:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(test033Service.removeBatchByIds(ids));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,104 @@
|
||||
package com.xjrsoft.demo.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.demo.dto.AddTest066Dto;
|
||||
import com.xjrsoft.demo.dto.UpdateTest066Dto;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import com.xjrsoft.demo.dto.Test066PageDto;
|
||||
import com.xjrsoft.demo.entity.Test066;
|
||||
import com.xjrsoft.demo.service.ITest066Service;
|
||||
import com.xjrsoft.demo.vo.Test066PageVo;
|
||||
|
||||
import com.xjrsoft.demo.vo.Test066Vo;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: test066
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/demo" + "/test066")
|
||||
@Tag(name = "/demo" + "/test066",description = "test066代码")
|
||||
@AllArgsConstructor
|
||||
public class Test066Controller {
|
||||
|
||||
|
||||
private final ITest066Service test066Service;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "Test066列表(分页)")
|
||||
@SaCheckPermission("test066:detail")
|
||||
public R page(@Valid Test066PageDto dto){
|
||||
|
||||
LambdaQueryWrapper<Test066> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen1742()),Test066::getDanXingWenBen1742,dto.getDanXingWenBen1742())
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen6621()),Test066::getDanXingWenBen6621,dto.getDanXingWenBen6621())
|
||||
.orderByDesc(Test066::getId)
|
||||
.select(Test066.class,x -> VoToColumnUtil.fieldsToColumns(Test066PageVo.class).contains(x.getProperty()));
|
||||
IPage<Test066> page = test066Service.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<Test066PageVo> pageOutput = ConventPage.getPageOutput(page, Test066PageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询Test066信息")
|
||||
@SaCheckPermission("test066:detail")
|
||||
public R info(@RequestParam Long id){
|
||||
Test066 test066 = test066Service.getById(id);
|
||||
if (test066 == null) {
|
||||
return R.error("找不到此数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(test066, Test066Vo.class));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增Test066")
|
||||
@SaCheckPermission("test066:add")
|
||||
public R add(@Valid @RequestBody AddTest066Dto dto){
|
||||
Test066 test066 = BeanUtil.toBean(dto, Test066.class);
|
||||
boolean isSuccess = test066Service.save(test066);
|
||||
return R.ok(isSuccess);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改Test066")
|
||||
@SaCheckPermission("test066:edit")
|
||||
public R update(@Valid @RequestBody UpdateTest066Dto dto){
|
||||
|
||||
Test066 test066 = BeanUtil.toBean(dto, Test066.class);
|
||||
return R.ok(test066Service.updateById(test066));
|
||||
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@SaCheckPermission("test066:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(test066Service.removeBatchByIds(ids));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,105 @@
|
||||
package com.xjrsoft.demo.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.demo.dto.AddTest07778Dto;
|
||||
import com.xjrsoft.demo.dto.UpdateTest07778Dto;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import com.xjrsoft.demo.dto.Test07778PageDto;
|
||||
import com.xjrsoft.demo.entity.Test07778;
|
||||
import com.xjrsoft.demo.service.ITest07778Service;
|
||||
import com.xjrsoft.demo.vo.Test07778PageVo;
|
||||
|
||||
import com.xjrsoft.demo.vo.Test07778Vo;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: test07778
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/demo" + "/test07778")
|
||||
@Tag(name = "/demo" + "/test07778",description = "test07778代码")
|
||||
@AllArgsConstructor
|
||||
public class Test07778Controller {
|
||||
|
||||
|
||||
private final ITest07778Service test07778Service;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "Test07778列表(分页)")
|
||||
@SaCheckPermission("test07778:detail")
|
||||
public R page(@Valid Test07778PageDto dto){
|
||||
|
||||
LambdaQueryWrapper<Test07778> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen5261()),Test07778::getDanXingWenBen5261,dto.getDanXingWenBen5261())
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen2207()),Test07778::getDanXingWenBen2207,dto.getDanXingWenBen2207())
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen9455()),Test07778::getDanXingWenBen9455,dto.getDanXingWenBen9455())
|
||||
.orderByDesc(Test07778::getId)
|
||||
.select(Test07778.class,x -> VoToColumnUtil.fieldsToColumns(Test07778PageVo.class).contains(x.getProperty()));
|
||||
IPage<Test07778> page = test07778Service.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<Test07778PageVo> pageOutput = ConventPage.getPageOutput(page, Test07778PageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询Test07778信息")
|
||||
@SaCheckPermission("test07778:detail")
|
||||
public R info(@RequestParam Long id){
|
||||
Test07778 test07778 = test07778Service.getById(id);
|
||||
if (test07778 == null) {
|
||||
return R.error("找不到此数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(test07778, Test07778Vo.class));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增Test07778")
|
||||
@SaCheckPermission("test07778:add")
|
||||
public R add(@Valid @RequestBody AddTest07778Dto dto){
|
||||
Test07778 test07778 = BeanUtil.toBean(dto, Test07778.class);
|
||||
boolean isSuccess = test07778Service.save(test07778);
|
||||
return R.ok(isSuccess);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改Test07778")
|
||||
@SaCheckPermission("test07778:edit")
|
||||
public R update(@Valid @RequestBody UpdateTest07778Dto dto){
|
||||
|
||||
Test07778 test07778 = BeanUtil.toBean(dto, Test07778.class);
|
||||
return R.ok(test07778Service.updateById(test07778));
|
||||
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@SaCheckPermission("test07778:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(test07778Service.removeBatchByIds(ids));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,104 @@
|
||||
package com.xjrsoft.demo.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.demo.dto.AddTest077Dto;
|
||||
import com.xjrsoft.demo.dto.UpdateTest077Dto;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import com.xjrsoft.demo.dto.Test077PageDto;
|
||||
import com.xjrsoft.demo.entity.Test077;
|
||||
import com.xjrsoft.demo.service.ITest077Service;
|
||||
import com.xjrsoft.demo.vo.Test077PageVo;
|
||||
|
||||
import com.xjrsoft.demo.vo.Test077Vo;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: test077
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/demo" + "/test077")
|
||||
@Tag(name = "/demo" + "/test077",description = "test077代码")
|
||||
@AllArgsConstructor
|
||||
public class Test077Controller {
|
||||
|
||||
|
||||
private final ITest077Service test077Service;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "Test077列表(分页)")
|
||||
@SaCheckPermission("test077:detail")
|
||||
public R page(@Valid Test077PageDto dto){
|
||||
|
||||
LambdaQueryWrapper<Test077> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen5537()),Test077::getDanXingWenBen5537,dto.getDanXingWenBen5537())
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen5446()),Test077::getDanXingWenBen5446,dto.getDanXingWenBen5446())
|
||||
.orderByDesc(Test077::getId)
|
||||
.select(Test077.class,x -> VoToColumnUtil.fieldsToColumns(Test077PageVo.class).contains(x.getProperty()));
|
||||
IPage<Test077> page = test077Service.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<Test077PageVo> pageOutput = ConventPage.getPageOutput(page, Test077PageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询Test077信息")
|
||||
@SaCheckPermission("test077:detail")
|
||||
public R info(@RequestParam Long id){
|
||||
Test077 test077 = test077Service.getById(id);
|
||||
if (test077 == null) {
|
||||
return R.error("找不到此数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(test077, Test077Vo.class));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增Test077")
|
||||
@SaCheckPermission("test077:add")
|
||||
public R add(@Valid @RequestBody AddTest077Dto dto){
|
||||
Test077 test077 = BeanUtil.toBean(dto, Test077.class);
|
||||
boolean isSuccess = test077Service.save(test077);
|
||||
return R.ok(isSuccess);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改Test077")
|
||||
@SaCheckPermission("test077:edit")
|
||||
public R update(@Valid @RequestBody UpdateTest077Dto dto){
|
||||
|
||||
Test077 test077 = BeanUtil.toBean(dto, Test077.class);
|
||||
return R.ok(test077Service.updateById(test077));
|
||||
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@SaCheckPermission("test077:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(test077Service.removeBatchByIds(ids));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,104 @@
|
||||
package com.xjrsoft.demo.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.demo.dto.AddTest099Dto;
|
||||
import com.xjrsoft.demo.dto.UpdateTest099Dto;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import com.xjrsoft.demo.dto.Test099PageDto;
|
||||
import com.xjrsoft.demo.entity.Test099;
|
||||
import com.xjrsoft.demo.service.ITest099Service;
|
||||
import com.xjrsoft.demo.vo.Test099PageVo;
|
||||
|
||||
import com.xjrsoft.demo.vo.Test099Vo;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: test099
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/demo" + "/test099")
|
||||
@Tag(name = "/demo" + "/test099",description = "test099代码")
|
||||
@AllArgsConstructor
|
||||
public class Test099Controller {
|
||||
|
||||
|
||||
private final ITest099Service test099Service;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "Test099列表(分页)")
|
||||
@SaCheckPermission("test099:detail")
|
||||
public R page(@Valid Test099PageDto dto){
|
||||
|
||||
LambdaQueryWrapper<Test099> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen9839()),Test099::getDanXingWenBen9839,dto.getDanXingWenBen9839())
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen7646()),Test099::getDanXingWenBen7646,dto.getDanXingWenBen7646())
|
||||
.orderByDesc(Test099::getId)
|
||||
.select(Test099.class,x -> VoToColumnUtil.fieldsToColumns(Test099PageVo.class).contains(x.getProperty()));
|
||||
IPage<Test099> page = test099Service.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<Test099PageVo> pageOutput = ConventPage.getPageOutput(page, Test099PageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询Test099信息")
|
||||
@SaCheckPermission("test099:detail")
|
||||
public R info(@RequestParam Long id){
|
||||
Test099 test099 = test099Service.getById(id);
|
||||
if (test099 == null) {
|
||||
return R.error("找不到此数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(test099, Test099Vo.class));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增Test099")
|
||||
@SaCheckPermission("test099:add")
|
||||
public R add(@Valid @RequestBody AddTest099Dto dto){
|
||||
Test099 test099 = BeanUtil.toBean(dto, Test099.class);
|
||||
boolean isSuccess = test099Service.save(test099);
|
||||
return R.ok(isSuccess);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改Test099")
|
||||
@SaCheckPermission("test099:edit")
|
||||
public R update(@Valid @RequestBody UpdateTest099Dto dto){
|
||||
|
||||
Test099 test099 = BeanUtil.toBean(dto, Test099.class);
|
||||
return R.ok(test099Service.updateById(test099));
|
||||
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@SaCheckPermission("test099:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(test099Service.removeBatchByIds(ids));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,104 @@
|
||||
package com.xjrsoft.demo.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.demo.dto.AddTest6666Dto;
|
||||
import com.xjrsoft.demo.dto.UpdateTest6666Dto;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import com.xjrsoft.demo.dto.Test6666PageDto;
|
||||
import com.xjrsoft.demo.entity.Test6666;
|
||||
import com.xjrsoft.demo.service.ITest6666Service;
|
||||
import com.xjrsoft.demo.vo.Test6666PageVo;
|
||||
|
||||
import com.xjrsoft.demo.vo.Test6666Vo;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: test6666
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/demo" + "/test6666")
|
||||
@Tag(name = "/demo" + "/test6666",description = "test6666代码")
|
||||
@AllArgsConstructor
|
||||
public class Test6666Controller {
|
||||
|
||||
|
||||
private final ITest6666Service test6666Service;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "Test6666列表(分页)")
|
||||
@SaCheckPermission("test6666:detail")
|
||||
public R page(@Valid Test6666PageDto dto){
|
||||
|
||||
LambdaQueryWrapper<Test6666> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen5415()),Test6666::getDanXingWenBen5415,dto.getDanXingWenBen5415())
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen7480()),Test6666::getDanXingWenBen7480,dto.getDanXingWenBen7480())
|
||||
.orderByDesc(Test6666::getId)
|
||||
.select(Test6666.class,x -> VoToColumnUtil.fieldsToColumns(Test6666PageVo.class).contains(x.getProperty()));
|
||||
IPage<Test6666> page = test6666Service.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<Test6666PageVo> pageOutput = ConventPage.getPageOutput(page, Test6666PageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询Test6666信息")
|
||||
@SaCheckPermission("test6666:detail")
|
||||
public R info(@RequestParam Long id){
|
||||
Test6666 test6666 = test6666Service.getById(id);
|
||||
if (test6666 == null) {
|
||||
return R.error("找不到此数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(test6666, Test6666Vo.class));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增Test6666")
|
||||
@SaCheckPermission("test6666:add")
|
||||
public R add(@Valid @RequestBody AddTest6666Dto dto){
|
||||
Test6666 test6666 = BeanUtil.toBean(dto, Test6666.class);
|
||||
boolean isSuccess = test6666Service.save(test6666);
|
||||
return R.ok(isSuccess);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改Test6666")
|
||||
@SaCheckPermission("test6666:edit")
|
||||
public R update(@Valid @RequestBody UpdateTest6666Dto dto){
|
||||
|
||||
Test6666 test6666 = BeanUtil.toBean(dto, Test6666.class);
|
||||
return R.ok(test6666Service.updateById(test6666));
|
||||
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@SaCheckPermission("test6666:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(test6666Service.removeBatchByIds(ids));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,104 @@
|
||||
package com.xjrsoft.demo.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.demo.dto.AddTestInsertMenuDto;
|
||||
import com.xjrsoft.demo.dto.UpdateTestInsertMenuDto;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import com.xjrsoft.demo.dto.TestInsertMenuPageDto;
|
||||
import com.xjrsoft.demo.entity.TestInsertMenu;
|
||||
import com.xjrsoft.demo.service.ITestInsertMenuService;
|
||||
import com.xjrsoft.demo.vo.TestInsertMenuPageVo;
|
||||
|
||||
import com.xjrsoft.demo.vo.TestInsertMenuVo;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: testInsertMenu
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/demo" + "/testinsertmenu")
|
||||
@Tag(name = "/demo" + "/testinsertmenu",description = "testInsertMenu代码")
|
||||
@AllArgsConstructor
|
||||
public class TestInsertMenuController {
|
||||
|
||||
|
||||
private final ITestInsertMenuService testInsertMenuService;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "TestInsertMenu列表(分页)")
|
||||
@SaCheckPermission("testinsertmenu:detail")
|
||||
public R page(@Valid TestInsertMenuPageDto dto){
|
||||
|
||||
LambdaQueryWrapper<TestInsertMenu> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen7496()),TestInsertMenu::getDanXingWenBen7496,dto.getDanXingWenBen7496())
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen5453()),TestInsertMenu::getDanXingWenBen5453,dto.getDanXingWenBen5453())
|
||||
.orderByDesc(TestInsertMenu::getId)
|
||||
.select(TestInsertMenu.class,x -> VoToColumnUtil.fieldsToColumns(TestInsertMenuPageVo.class).contains(x.getProperty()));
|
||||
IPage<TestInsertMenu> page = testInsertMenuService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<TestInsertMenuPageVo> pageOutput = ConventPage.getPageOutput(page, TestInsertMenuPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询TestInsertMenu信息")
|
||||
@SaCheckPermission("testinsertmenu:detail")
|
||||
public R info(@RequestParam Long id){
|
||||
TestInsertMenu testInsertMenu = testInsertMenuService.getById(id);
|
||||
if (testInsertMenu == null) {
|
||||
return R.error("找不到此数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(testInsertMenu, TestInsertMenuVo.class));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增TestInsertMenu")
|
||||
@SaCheckPermission("testinsertmenu:add")
|
||||
public R add(@Valid @RequestBody AddTestInsertMenuDto dto){
|
||||
TestInsertMenu testInsertMenu = BeanUtil.toBean(dto, TestInsertMenu.class);
|
||||
boolean isSuccess = testInsertMenuService.save(testInsertMenu);
|
||||
return R.ok(isSuccess);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改TestInsertMenu")
|
||||
@SaCheckPermission("testinsertmenu:edit")
|
||||
public R update(@Valid @RequestBody UpdateTestInsertMenuDto dto){
|
||||
|
||||
TestInsertMenu testInsertMenu = BeanUtil.toBean(dto, TestInsertMenu.class);
|
||||
return R.ok(testInsertMenuService.updateById(testInsertMenu));
|
||||
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@SaCheckPermission("testinsertmenu:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(testInsertMenuService.removeBatchByIds(ids));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,104 @@
|
||||
package com.xjrsoft.demo.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.demo.dto.AddTestcode24Dto;
|
||||
import com.xjrsoft.demo.dto.UpdateTestcode24Dto;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
|
||||
import com.xjrsoft.demo.dto.Testcode24PageDto;
|
||||
import com.xjrsoft.demo.entity.Testcode24;
|
||||
import com.xjrsoft.demo.service.ITestcode24Service;
|
||||
import com.xjrsoft.demo.vo.Testcode24PageVo;
|
||||
|
||||
import com.xjrsoft.demo.vo.Testcode24Vo;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: 测试
|
||||
* @Author 管理员
|
||||
* @Date: 2024-02-02
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/demo" + "/testcode24")
|
||||
@Tag(name = "/demo" + "/testcode24",description = "测试代码")
|
||||
@AllArgsConstructor
|
||||
public class Testcode24Controller {
|
||||
|
||||
|
||||
private final ITestcode24Service testcode24Service;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "Testcode24列表(分页)")
|
||||
@SaCheckPermission("testcode24:detail")
|
||||
public R page(@Valid Testcode24PageDto dto){
|
||||
|
||||
LambdaQueryWrapper<Testcode24> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen8706()),Testcode24::getDanXingWenBen8706,dto.getDanXingWenBen8706())
|
||||
.like(StrUtil.isNotBlank(dto.getDanXingWenBen4899()),Testcode24::getDanXingWenBen4899,dto.getDanXingWenBen4899())
|
||||
.orderByDesc(Testcode24::getId)
|
||||
.select(Testcode24.class,x -> VoToColumnUtil.fieldsToColumns(Testcode24PageVo.class).contains(x.getProperty()));
|
||||
IPage<Testcode24> page = testcode24Service.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<Testcode24PageVo> pageOutput = ConventPage.getPageOutput(page, Testcode24PageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询Testcode24信息")
|
||||
@SaCheckPermission("testcode24:detail")
|
||||
public R info(@RequestParam Long id){
|
||||
Testcode24 testcode24 = testcode24Service.getById(id);
|
||||
if (testcode24 == null) {
|
||||
return R.error("找不到此数据!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(testcode24, Testcode24Vo.class));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增Testcode24")
|
||||
@SaCheckPermission("testcode24:add")
|
||||
public R add(@Valid @RequestBody AddTestcode24Dto dto){
|
||||
Testcode24 testcode24 = BeanUtil.toBean(dto, Testcode24.class);
|
||||
boolean isSuccess = testcode24Service.save(testcode24);
|
||||
return R.ok(testcode24.getId());
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改Testcode24")
|
||||
@SaCheckPermission("testcode24:edit")
|
||||
public R update(@Valid @RequestBody UpdateTestcode24Dto dto){
|
||||
|
||||
Testcode24 testcode24 = BeanUtil.toBean(dto, Testcode24.class);
|
||||
return R.ok(testcode24Service.updateById(testcode24));
|
||||
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@SaCheckPermission("testcode24:delete")
|
||||
public R delete(@Valid @RequestBody List<Long> ids){
|
||||
return R.ok(testcode24Service.removeBatchByIds(ids));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.demo.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.demo.entity.Test0055;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface ITest0055Service extends IService<Test0055> {
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.demo.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.demo.entity.Test0111;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface ITest0111Service extends IService<Test0111> {
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.demo.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.demo.entity.Test0222;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface ITest0222Service extends IService<Test0222> {
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.demo.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.demo.entity.Test033;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface ITest033Service extends IService<Test033> {
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.demo.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.demo.entity.Test066;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface ITest066Service extends IService<Test066> {
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.demo.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.demo.entity.Test07778;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface ITest07778Service extends IService<Test07778> {
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.demo.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.demo.entity.Test077;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface ITest077Service extends IService<Test077> {
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.demo.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.demo.entity.Test099;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface ITest099Service extends IService<Test099> {
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.demo.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.demo.entity.Test6666;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface ITest6666Service extends IService<Test6666> {
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.demo.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.demo.entity.TestInsertMenu;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface ITestInsertMenuService extends IService<TestInsertMenu> {
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xjrsoft.demo.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.demo.entity.Testcode24;
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2024-02-02
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
public interface ITestcode24Service extends IService<Testcode24> {
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xjrsoft.demo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.demo.entity.Test0055;
|
||||
import com.xjrsoft.demo.mapper.Test0055Mapper;
|
||||
import com.xjrsoft.demo.service.ITest0055Service;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class Test0055ServiceImpl extends ServiceImpl<Test0055Mapper, Test0055> implements ITest0055Service {
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xjrsoft.demo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.demo.entity.Test0111;
|
||||
import com.xjrsoft.demo.mapper.Test0111Mapper;
|
||||
import com.xjrsoft.demo.service.ITest0111Service;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class Test0111ServiceImpl extends ServiceImpl<Test0111Mapper, Test0111> implements ITest0111Service {
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xjrsoft.demo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.demo.entity.Test0222;
|
||||
import com.xjrsoft.demo.mapper.Test0222Mapper;
|
||||
import com.xjrsoft.demo.service.ITest0222Service;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class Test0222ServiceImpl extends ServiceImpl<Test0222Mapper, Test0222> implements ITest0222Service {
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xjrsoft.demo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.demo.entity.Test033;
|
||||
import com.xjrsoft.demo.mapper.Test033Mapper;
|
||||
import com.xjrsoft.demo.service.ITest033Service;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class Test033ServiceImpl extends ServiceImpl<Test033Mapper, Test033> implements ITest033Service {
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xjrsoft.demo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.demo.entity.Test066;
|
||||
import com.xjrsoft.demo.mapper.Test066Mapper;
|
||||
import com.xjrsoft.demo.service.ITest066Service;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class Test066ServiceImpl extends ServiceImpl<Test066Mapper, Test066> implements ITest066Service {
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xjrsoft.demo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.demo.entity.Test07778;
|
||||
import com.xjrsoft.demo.mapper.Test07778Mapper;
|
||||
import com.xjrsoft.demo.service.ITest07778Service;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class Test07778ServiceImpl extends ServiceImpl<Test07778Mapper, Test07778> implements ITest07778Service {
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xjrsoft.demo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.demo.entity.Test077;
|
||||
import com.xjrsoft.demo.mapper.Test077Mapper;
|
||||
import com.xjrsoft.demo.service.ITest077Service;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class Test077ServiceImpl extends ServiceImpl<Test077Mapper, Test077> implements ITest077Service {
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xjrsoft.demo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.demo.entity.Test099;
|
||||
import com.xjrsoft.demo.mapper.Test099Mapper;
|
||||
import com.xjrsoft.demo.service.ITest099Service;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class Test099ServiceImpl extends ServiceImpl<Test099Mapper, Test099> implements ITest099Service {
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xjrsoft.demo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.demo.entity.Test6666;
|
||||
import com.xjrsoft.demo.mapper.Test6666Mapper;
|
||||
import com.xjrsoft.demo.service.ITest6666Service;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class Test6666ServiceImpl extends ServiceImpl<Test6666Mapper, Test6666> implements ITest6666Service {
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xjrsoft.demo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.demo.entity.TestInsertMenu;
|
||||
import com.xjrsoft.demo.mapper.TestInsertMenuMapper;
|
||||
import com.xjrsoft.demo.service.ITestInsertMenuService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2023-10-25
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class TestInsertMenuServiceImpl extends ServiceImpl<TestInsertMenuMapper, TestInsertMenu> implements ITestInsertMenuService {
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xjrsoft.demo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.demo.entity.Testcode24;
|
||||
import com.xjrsoft.demo.mapper.Testcode24Mapper;
|
||||
import com.xjrsoft.demo.service.ITestcode24Service;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
|
||||
/**
|
||||
* @title: service
|
||||
* @Author 管理员
|
||||
* @Date: 2024-02-02
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class Testcode24ServiceImpl extends ServiceImpl<Testcode24Mapper, Testcode24> implements ITestcode24Service {
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: public
|
||||
@ -0,0 +1,75 @@
|
||||
server:
|
||||
port: 3011
|
||||
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: demo-service
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
autoconfigure:
|
||||
#自动化配置 例外处理
|
||||
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
dynamic:
|
||||
primary: master
|
||||
datasource:
|
||||
master:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://new-energy-mysqlt.itc.gdyd.com:3307/fcd2-msat-init?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
|
||||
username: learun4dev
|
||||
password: ABcd1234@
|
||||
|
||||
cloud:
|
||||
nacos: #nacos监控
|
||||
discovery:
|
||||
server-addr: 10.0.252.1:8848
|
||||
namespace: ITC
|
||||
group: DNE
|
||||
username: nacos
|
||||
password: ABcd1234@
|
||||
config:
|
||||
server-addr: 10.0.252.1:8848 # nacos 配置中心地址
|
||||
namespace: ITC
|
||||
group: DNE
|
||||
username: nacos
|
||||
password: ABcd1234@
|
||||
file-extension: yml # 指定格式 xjrsoft-demo-service-dev.yml
|
||||
extension-configs:
|
||||
- data-id: global-config.yml #导入全局配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
- data-id: mybatis-plus-config.yml #导入mybatisplus 配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
- data-id: sa-token-client-config.yml #导入sa-token配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
- data-id: redis-config.yml #导入redis配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
- data-id: seata-config.yml #导入seata配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
sentinel:
|
||||
transport:
|
||||
dashboard: localhost:8080 #sentinel dashboard 地址
|
||||
port: 8719 #默认端口, 如果 被占用,会一直+1 直到未被占用为止
|
||||
|
||||
|
||||
|
||||
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
path: /swagger-ui.html
|
||||
tags-sorter: alpha
|
||||
operations-sorter: alpha
|
||||
show-extensions: true
|
||||
api-docs:
|
||||
path: /demo/v3/api-docs
|
||||
group-configs:
|
||||
- group: 'default'
|
||||
paths-to-match: '/demo/**'
|
||||
packages-to-scan: com.xjrsoft.demo
|
||||
default-flat-param-object: false
|
||||
16
xjrsoft-service/xjrsoft-service-desktop/Dockerfile
Normal file
16
xjrsoft-service/xjrsoft-service-desktop/Dockerfile
Normal file
@ -0,0 +1,16 @@
|
||||
# 基础镜像
|
||||
FROM nexus.gdyditc.com:8082/openjdk:11-arm64
|
||||
# author
|
||||
MAINTAINER xjrsoft
|
||||
|
||||
# 挂载目录
|
||||
VOLUME /home/xjrsoft
|
||||
# 创建目录
|
||||
RUN mkdir -p /home/xjrsoft
|
||||
# 指定路径
|
||||
WORKDIR /home/xjrsoft
|
||||
# 复制jar文件到路径
|
||||
RUN ls
|
||||
COPY ./target/xjrsoft-service-desktop.jar /home/xjrsoft/xjrsoft-service-desktop.jar
|
||||
# 启动认证服务
|
||||
ENTRYPOINT ["java","-Dfile.encoding=utf-8","--add-opens","java.base/java.lang.reflect=ALL-UNNAMED","-jar","xjrsoft-service-desktop.jar"]
|
||||
87
xjrsoft-service/xjrsoft-service-desktop/pom.xml
Normal file
87
xjrsoft-service/xjrsoft-service-desktop/pom.xml
Normal file
@ -0,0 +1,87 @@
|
||||
<?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>xjrsoft-service</artifactId>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>xjrsoft-service-desktop</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-system-api</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-common-core</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-common-mybatis</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-desktop-api</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-organization-api</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-form-api</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-loadbalancer</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xjrsoft.desktop;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/10 17:16
|
||||
*/
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients(basePackages = "com.xjrsoft")
|
||||
@MapperScan(value = "com.xjrsoft.**.mapper")
|
||||
@ComponentScan(value = "com.xjrsoft")
|
||||
public class DesktopApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DesktopApplication.class, args);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package com.xjrsoft.desktop.client;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.enums.YesOrNoEnum;
|
||||
import com.xjrsoft.desktop.entity.DesktopSchema;
|
||||
import com.xjrsoft.desktop.entity.UserDesktopRelation;
|
||||
import com.xjrsoft.desktop.mapper.DesktopSchemaMapper;
|
||||
import com.xjrsoft.desktop.mapper.UserDesktopRelationMapper;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/11 16:35
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class DesktopSchemaClient implements IDesktopSchemaClient {
|
||||
private final DesktopSchemaMapper desktopSchemaMapper;
|
||||
|
||||
|
||||
private final UserDesktopRelationMapper userDesktopRelationMapper;
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE+ GlobalConstant.MODULE_DESKTOP_NAME + "/getDesktopSchemaFeign")
|
||||
public DesktopSchema getDesktopSchemaFeign(Long desktopId) {
|
||||
return desktopSchemaMapper.selectById(desktopId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@GetMapping(GlobalConstant.CLIENT_API_PRE+ GlobalConstant.MODULE_DESKTOP_NAME + "/getDesktopSchemaByUserIdFeign")
|
||||
public DesktopSchema getDesktopSchemaByUserIdFeign(Long userId) {
|
||||
|
||||
|
||||
UserDesktopRelation userDesktopRelation = userDesktopRelationMapper.selectOne(
|
||||
Wrappers.lambdaQuery(UserDesktopRelation.class).eq(UserDesktopRelation::getUserId, userId));
|
||||
|
||||
Long desktopId = userDesktopRelation == null ? null : userDesktopRelation.getDesktopId();
|
||||
|
||||
|
||||
return desktopSchemaMapper.selectOne(
|
||||
Wrappers.lambdaQuery(DesktopSchema.class)
|
||||
.eq(desktopId == null, DesktopSchema::getIsFirst, YesOrNoEnum.YES.getCode())
|
||||
.eq(desktopId != null, DesktopSchema::getId, desktopId));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xjrsoft.desktop.client;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/10 14:50
|
||||
*/
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class UserDesktopRelationClient implements IUserDesktopRelationClient {
|
||||
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
package com.xjrsoft.desktop.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.yulichang.toolkit.MPJWrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.desktop.dto.DesktopHistoryPageDto;
|
||||
import com.xjrsoft.desktop.dto.SetActivityDto;
|
||||
import com.xjrsoft.desktop.entity.DesktopHistory;
|
||||
import com.xjrsoft.desktop.service.IDesktopHistoryService;
|
||||
import com.xjrsoft.desktop.vo.DesktopHistoryPageVo;
|
||||
import com.xjrsoft.organization.entity.User;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-04-13
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.DESKTOP_MODULE_PREFIX + "/history")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/history", description = "桌面设计历史记录接口")
|
||||
@AllArgsConstructor
|
||||
public class DesktopHistoryController {
|
||||
|
||||
private final IDesktopHistoryService desktopHistoryService;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "桌面设计历史记录列表(分页)")
|
||||
public R page(@Valid DesktopHistoryPageDto dto) {
|
||||
|
||||
IPage<DesktopHistoryPageVo> desktopHistoryPageVoIPage = desktopHistoryService.selectJoinListPage(ConventPage.getPage(dto), DesktopHistoryPageVo.class,
|
||||
MPJWrappers.<DesktopHistory>lambdaJoin().disableSubLogicDel()
|
||||
.orderByDesc(DesktopHistory::getId)
|
||||
.select(DesktopHistory::getId)
|
||||
.selectAs(User::getName, DesktopHistoryPageVo::getCreateUserName)
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getSchemaId()), DesktopHistory::getSchemaId, dto.getSchemaId())
|
||||
.eq(StrUtil.isNotBlank(dto.getKeyword()), DesktopHistory::getSchemaId, dto.getSchemaId())
|
||||
.select(DesktopHistory.class, x -> VoToColumnUtil.fieldsToColumns(DesktopHistoryPageVo.class).contains(x.getProperty()))
|
||||
.leftJoin(User.class, User::getId, DesktopHistory::getCreateUserId)
|
||||
);
|
||||
PageOutput<DesktopHistoryPageVo> pageOutput = ConventPage.getPageOutput(desktopHistoryPageVoIPage);
|
||||
// LambdaQueryWrapper<DesktopHistory> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// queryWrapper
|
||||
// .eq(ObjectUtil.isNotEmpty(dto.getSchemaId()), DesktopHistory::getSchemaId, dto.getSchemaId())
|
||||
// .eq(StrUtil.isNotBlank(dto.getKeyword()), DesktopHistory::getSchemaId, dto.getSchemaId());
|
||||
// IPage<DesktopHistory> page = desktopHistoryService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
// PageOutput<DesktopHistory> pageOutput = ConventPage.getPageOutput(page, DesktopHistory.class);
|
||||
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "桌面设计历史记录详情")
|
||||
public R info(@RequestParam Long id) {
|
||||
return R.ok(desktopHistoryService.getById(id));
|
||||
}
|
||||
|
||||
@PutMapping("/set-activity")
|
||||
@Operation(summary = "设置为活动版本")
|
||||
public R setActivity(@Valid @RequestBody SetActivityDto dto) {
|
||||
return R.ok(desktopHistoryService.setActivity(dto));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,116 @@
|
||||
package com.xjrsoft.desktop.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.ListInput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.enums.EnabledMark;
|
||||
import com.xjrsoft.common.core.enums.YesOrNoEnum;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.desktop.dto.SetDesktopRelationDto;
|
||||
import com.xjrsoft.desktop.entity.DesktopRelation;
|
||||
import com.xjrsoft.desktop.entity.DesktopSchema;
|
||||
import com.xjrsoft.desktop.service.IDesktopRelationService;
|
||||
import com.xjrsoft.desktop.service.IDesktopSchemaService;
|
||||
import com.xjrsoft.desktop.vo.DesktopSchemaVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 桌面设计授权表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-06-01
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.DESKTOP_MODULE_PREFIX + "/relation")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/relation", description = "桌面设计权限接口")
|
||||
@AllArgsConstructor
|
||||
public class DesktopRelationController {
|
||||
|
||||
private final IDesktopRelationService relationService;
|
||||
|
||||
private final IDesktopSchemaService desktopSchemaService;
|
||||
|
||||
@GetMapping(value = "/role")
|
||||
@Operation(summary = "查询角色授权的桌面设计")
|
||||
public R getRelationsOfRole(@RequestParam Long roleId) {
|
||||
List<DesktopRelation> relationList = relationService.list(Wrappers.lambdaQuery(DesktopRelation.class)
|
||||
.eq(DesktopRelation::getRoleId, roleId));
|
||||
if (CollectionUtils.isNotEmpty(relationList)) {
|
||||
Set<Long> desktopIdList = relationList.stream().map(DesktopRelation::getDesktopId).collect(Collectors.toSet());
|
||||
List<DesktopSchema> desktopSchemaList = desktopSchemaService.list(Wrappers.lambdaQuery(DesktopSchema.class)
|
||||
.select(DesktopSchema.class, x -> VoToColumnUtil.fieldsToColumns(DesktopSchemaVo.class).contains(x.getProperty()))
|
||||
.in(DesktopSchema::getId, desktopIdList)
|
||||
.eq(DesktopSchema::getEnabledMark, EnabledMark.ENABLED.getCode()));
|
||||
return R.ok(BeanUtil.copyToList(desktopSchemaList, DesktopSchemaVo.class));
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "保存角色的桌面设计权限")
|
||||
@Transactional
|
||||
public R add(@Valid @RequestBody SetDesktopRelationDto dto) {
|
||||
Long roleId = dto.getRoleId();
|
||||
// 先删除角色的权限
|
||||
relationService.remove(Wrappers.<DesktopRelation>query().lambda().eq(DesktopRelation::getRoleId, roleId));
|
||||
List<Long> desktopIds = dto.getDesktopIds();
|
||||
if (CollectionUtils.isNotEmpty(desktopIds)) {
|
||||
List<DesktopRelation> toSaveList = new ArrayList<>(desktopIds.size());
|
||||
for (Long desktopId : desktopIds) {
|
||||
DesktopRelation relation = new DesktopRelation();
|
||||
relation.setRoleId(roleId);
|
||||
relation.setDesktopId(desktopId);
|
||||
toSaveList.add(relation);
|
||||
}
|
||||
relationService.saveBatch(toSaveList);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@GetMapping(value = "/current-desktops")
|
||||
@Operation(summary = "查询当前用户拥有权限的桌面设计")
|
||||
public R getDesktopsOfCurrentUser(ListInput dto) {
|
||||
List<DesktopSchemaVo> resultList = new ArrayList<>();
|
||||
// 查询默认首页
|
||||
DesktopSchema firstDesktop = desktopSchemaService.getOne(Wrappers.lambdaQuery(DesktopSchema.class)
|
||||
.eq(DesktopSchema::getIsFirst, YesOrNoEnum.YES.getCode())
|
||||
.select(DesktopSchema.class, x -> VoToColumnUtil.fieldsToColumns(DesktopSchemaVo.class).contains(x.getProperty())));
|
||||
if (firstDesktop != null&&StrUtil.isBlank(dto.getKeyword())) {//当搜索关键字为空时将默认首页添加进去
|
||||
resultList.add(BeanUtil.toBean(firstDesktop, DesktopSchemaVo.class));
|
||||
}
|
||||
// 查询授权的桌面设计
|
||||
List<Long> currentRoleIdList = StpUtil.getTokenSession().get(GlobalConstant.LOGIN_USER_ROLE_ID_KEY, new ArrayList<>());
|
||||
if(CollectionUtils.isNotEmpty(currentRoleIdList)) {
|
||||
List<DesktopRelation> desktopRelationList = relationService.list(
|
||||
Wrappers.lambdaQuery(DesktopRelation.class).in(DesktopRelation::getRoleId, currentRoleIdList));
|
||||
if (CollectionUtils.isNotEmpty(desktopRelationList)) {
|
||||
Set<Long> desktopIdList = desktopRelationList.stream().map(DesktopRelation::getDesktopId).collect(Collectors.toSet());
|
||||
List<DesktopSchema> desktopSchemaList = desktopSchemaService.list(Wrappers.lambdaQuery(DesktopSchema.class)
|
||||
.select(DesktopSchema.class, x -> VoToColumnUtil.fieldsToColumns(DesktopSchemaVo.class).contains(x.getProperty()))
|
||||
.in(DesktopSchema::getId, desktopIdList)
|
||||
.eq(DesktopSchema::getEnabledMark, EnabledMark.ENABLED.getCode())
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()), DesktopSchema::getName, dto.getKeyword()));
|
||||
resultList.addAll(BeanUtil.copyToList(desktopSchemaList, DesktopSchemaVo.class));
|
||||
}
|
||||
}
|
||||
List<DesktopSchemaVo> collect = resultList.stream().distinct().collect(Collectors.toList());//去重操作,防止默认首页出现两次
|
||||
return R.ok(collect);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,233 @@
|
||||
package com.xjrsoft.desktop.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.page.PageOutput;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.enums.EnabledMark;
|
||||
import com.xjrsoft.common.core.enums.YesOrNoEnum;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.common.mybatis.utils.ConventPage;
|
||||
import com.xjrsoft.desktop.dto.*;
|
||||
import com.xjrsoft.desktop.entity.DesktopSchema;
|
||||
import com.xjrsoft.desktop.service.IDesktopSchemaService;
|
||||
import com.xjrsoft.desktop.vo.DesktopSchemaInfoVo;
|
||||
import com.xjrsoft.desktop.vo.DesktopSchemaPageVo;
|
||||
import com.xjrsoft.form.client.IFormExecuteClient;
|
||||
import com.xjrsoft.system.client.IMenuClient;
|
||||
import com.xjrsoft.system.entity.Menu;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 桌面设计历史记录 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-04-13
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.DESKTOP_MODULE_PREFIX + "/schema")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/schema", description = "桌面设计模块接口")
|
||||
@AllArgsConstructor
|
||||
public class DesktopSchemaController {
|
||||
|
||||
private final IDesktopSchemaService desktopSchemaService;
|
||||
|
||||
private final IMenuClient menuClient;
|
||||
|
||||
private final IFormExecuteClient formExecuteClient;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "桌面设计列表(分页)")
|
||||
public R page(@Valid DesktopSchemaPageDto dto) {
|
||||
|
||||
LambdaQueryWrapper<DesktopSchema> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()), DesktopSchema::getCode, dto.getKeyword())
|
||||
.or()
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()), DesktopSchema::getName, dto.getKeyword())
|
||||
.select(DesktopSchema.class, x -> VoToColumnUtil.fieldsToColumns(DesktopSchemaPageVo.class).contains(x.getProperty()));
|
||||
IPage<DesktopSchema> page = desktopSchemaService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<DesktopSchemaPageVo> pageOutput = ConventPage.getPageOutput(page, DesktopSchemaPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/enabled-page")
|
||||
@Operation(summary = "桌面设计列表(分页, 有效标记为1,不是默认首页)")
|
||||
public R enabledPage(@Valid DesktopSchemaPageDto dto) {
|
||||
|
||||
LambdaQueryWrapper<DesktopSchema> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()), DesktopSchema::getCode, dto.getKeyword())
|
||||
.or()
|
||||
.like(StrUtil.isNotBlank(dto.getKeyword()), DesktopSchema::getName, dto.getKeyword())
|
||||
.select(DesktopSchema.class, x -> VoToColumnUtil.fieldsToColumns(DesktopSchemaPageVo.class).contains(x.getProperty()))
|
||||
.eq(DesktopSchema::getIsFirst, YesOrNoEnum.NO.getCode())
|
||||
.eq(DesktopSchema::getEnabledMark, EnabledMark.ENABLED.getCode());
|
||||
IPage<DesktopSchema> page = desktopSchemaService.page(ConventPage.getPage(dto), queryWrapper);
|
||||
PageOutput<DesktopSchemaPageVo> pageOutput = ConventPage.getPageOutput(page, DesktopSchemaPageVo.class);
|
||||
return R.ok(pageOutput);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "桌面设计详情")
|
||||
public R info(@RequestParam Long id){
|
||||
DesktopSchema desktopSchema = desktopSchemaService.getById(id);
|
||||
DesktopSchemaInfoVo infoVo = BeanUtil.toBean(desktopSchema, DesktopSchemaInfoVo.class);
|
||||
Integer isMenu = desktopSchema.getIsMenu();
|
||||
if (isMenu != null && isMenu == 1) {
|
||||
Menu menu = menuClient.getMenuByIdFeign(desktopSchema.getMenuId());
|
||||
if (menu == null) {
|
||||
infoVo.setIsMenu(0);
|
||||
infoVo.setMenuId(0L);
|
||||
} else {
|
||||
infoVo.setParentId(menu.getParentId());
|
||||
infoVo.setIcon(menu.getIcon());
|
||||
}
|
||||
}
|
||||
return R.ok(infoVo);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "桌面设计新增")
|
||||
public R add(@Valid @RequestBody AddDesktopSchemaDto dto){
|
||||
return R.ok(desktopSchemaService.add(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/copy")
|
||||
@Operation(summary = "复制桌面设计")
|
||||
public R copy(@Valid @RequestBody CopyDesktopSchemaDto dto){
|
||||
return R.ok(desktopSchemaService.copy(dto));
|
||||
}
|
||||
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "桌面设计修改")
|
||||
public R update(@Valid @RequestBody UpdateDesktopSchemaDto dto){
|
||||
return R.ok(desktopSchemaService.update(dto));
|
||||
}
|
||||
|
||||
@PutMapping("/set-default")
|
||||
@Operation(summary = "设置桌面设计为默认首页")
|
||||
public R setFirst(@Valid @RequestBody SetFirstDto dto){
|
||||
return R.ok(desktopSchemaService.setFirst(dto));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "桌面设计删除")
|
||||
public R delete(@RequestBody List<Long> ids){
|
||||
return R.ok(desktopSchemaService.delete(ids));
|
||||
}
|
||||
|
||||
@GetMapping("/export")
|
||||
@Operation(summary = "导出模板")
|
||||
@SneakyThrows
|
||||
public R export(@RequestParam Long id) {
|
||||
DesktopSchema desktopSchema = desktopSchemaService.getById(id);
|
||||
return R.ok(JSONUtil.toJsonStr(desktopSchema));
|
||||
}
|
||||
|
||||
@PostMapping("/import")
|
||||
@Operation(summary = "导入模板")
|
||||
@SneakyThrows
|
||||
public R importSchema(@RequestParam(value = "file") MultipartFile multipartFile) {
|
||||
return R.ok(desktopSchemaService.importDesktopSchema(multipartFile));
|
||||
}
|
||||
|
||||
@PutMapping("/enabled")
|
||||
@Operation(summary = "启用/禁用")
|
||||
public R enabled(@Valid @RequestBody DesktopEnabledDto dto) {
|
||||
DesktopSchema desktopSchema = new DesktopSchema();
|
||||
desktopSchema.setId(dto.getId());
|
||||
desktopSchema.setEnabledMark(dto.getEnabledMark());
|
||||
return R.ok(desktopSchemaService.updateById(desktopSchema));
|
||||
|
||||
}
|
||||
|
||||
@PutMapping("/first")
|
||||
@Operation(summary = "设置首页")
|
||||
public R setFirst(@Valid @RequestBody DesktopFirstDto dto) {
|
||||
DesktopSchema desktopSchema = new DesktopSchema();
|
||||
desktopSchema.setId(dto.getId());
|
||||
desktopSchema.setIsFirst(dto.getIsFirst());
|
||||
if (dto.getIsFirst() != null && dto.getIsFirst().equals(1)) {
|
||||
// 将其他桌面设计设置为非首页
|
||||
desktopSchemaService.update(Wrappers.<DesktopSchema>update().lambda().set(DesktopSchema::getIsFirst, 0).eq(DesktopSchema::getIsFirst, 1));
|
||||
}
|
||||
return R.ok(desktopSchemaService.updateById(desktopSchema));
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/complex-add")
|
||||
@Operation(summary = "桌面设计-复杂列表页-新增(公共接口)")
|
||||
public R complexAdd(@Valid @RequestBody AddDeskComplexDto dto){
|
||||
return R.ok(formExecuteClient.complexAddFeign(dto));
|
||||
}
|
||||
|
||||
@PutMapping("/complex-update")
|
||||
@Operation(summary = "桌面设计-复杂列表页-编辑(公共接口)")
|
||||
public R complexUpdate(@Valid @RequestBody UpdateDeskComplexDto dto){
|
||||
return R.ok(formExecuteClient.complexUpdateFeign(dto));
|
||||
}
|
||||
|
||||
@DeleteMapping("/complex-delete")
|
||||
@Operation(summary = "桌面设计-复杂列表页-删除(公共接口)")
|
||||
public R complexDelete(@Valid @RequestBody DeleteDeskComplexDto dto){
|
||||
return R.ok(formExecuteClient.complexDeleteFeign(dto));
|
||||
}
|
||||
@PostMapping(value = "/complex-info")
|
||||
@Operation(summary = "桌面设计-复杂列表页-数据(公共接口)")
|
||||
public R complexInfo(@Valid @RequestBody DeskComplexInfoDto dto) {
|
||||
return R.ok(formExecuteClient.complexInfoFeign(dto));
|
||||
}
|
||||
|
||||
@GetMapping("/get-release-info")
|
||||
@Operation(summary = "桌面设计-复杂列表页-根据表单id查询发布信息")
|
||||
@SneakyThrows
|
||||
public R getReleaseInfo(@RequestParam Long formId) {
|
||||
return R.ok(formExecuteClient.getReleaseInfoFeign(formId));
|
||||
}
|
||||
|
||||
@PostMapping("/complex-query")
|
||||
@Operation(summary = "桌面设计-复杂列表页-根据发布id获取查询配置数据")
|
||||
@SneakyThrows
|
||||
public R complexQuery(@Valid @RequestBody ComplexQueryDto dto) {
|
||||
return R.ok(formExecuteClient.complexQueryFeign(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 桌面设计-复杂列表页-获取列表数据 分页
|
||||
*
|
||||
* @param dto
|
||||
*/
|
||||
@PostMapping(value = "/complex-page")
|
||||
@Operation(summary = "桌面设计-复杂列表页-获取列表数据 分页")
|
||||
public R complexPage(@Valid @RequestBody ComplexPageDto dto) {
|
||||
return R.ok(formExecuteClient.complexPageFeign(dto));
|
||||
}
|
||||
|
||||
@GetMapping("/get-table-info")
|
||||
@Operation(summary = "桌面设计-复杂列表页-根据表单id查询表单信息")
|
||||
@SneakyThrows
|
||||
public R getTableInfo(@RequestParam Long formId) {
|
||||
return R.ok(formExecuteClient.getTableInfoFeign(formId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.xjrsoft.desktop.controller;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.desktop.dto.UserDesktopRelationDto;
|
||||
import com.xjrsoft.desktop.entity.UserDesktopRelation;
|
||||
import com.xjrsoft.desktop.service.IUserDesktopRelationService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户桌面设计首页关系表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-06-02
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.DESKTOP_MODULE_PREFIX + "/user-relation")
|
||||
@Tag(name = GlobalConstant.SYSTEM_MODULE_PREFIX + "/user-relation", description = "用户和桌面设计关系模块接口")
|
||||
@AllArgsConstructor
|
||||
public class UserDesktopRelationController {
|
||||
|
||||
private final IUserDesktopRelationService relationService;
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "设置用户首页")
|
||||
public R add(@Valid @RequestBody UserDesktopRelationDto dto) {
|
||||
long loginUserId = StpUtil.getLoginIdAsLong();
|
||||
relationService.remove(Wrappers.lambdaQuery(UserDesktopRelation.class).eq(UserDesktopRelation::getUserId, loginUserId));
|
||||
UserDesktopRelation relation = new UserDesktopRelation();
|
||||
relation.setDesktopId(dto.getDesktopId());
|
||||
relation.setUserId(loginUserId);
|
||||
return R.ok(relationService.save(relation));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.xjrsoft.desktop.service;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseService;
|
||||
import com.xjrsoft.desktop.dto.SetActivityDto;
|
||||
import com.xjrsoft.desktop.entity.DesktopHistory;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-04-13
|
||||
*/
|
||||
public interface IDesktopHistoryService extends MPJBaseService<DesktopHistory> {
|
||||
|
||||
boolean setActivity(SetActivityDto dto);
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xjrsoft.desktop.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.desktop.entity.DesktopRelation;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 桌面设计授权表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-06-01
|
||||
*/
|
||||
public interface IDesktopRelationService extends IService<DesktopRelation> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.xjrsoft.desktop.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.desktop.dto.AddDesktopSchemaDto;
|
||||
import com.xjrsoft.desktop.dto.CopyDesktopSchemaDto;
|
||||
import com.xjrsoft.desktop.dto.SetFirstDto;
|
||||
import com.xjrsoft.desktop.dto.UpdateDesktopSchemaDto;
|
||||
import com.xjrsoft.desktop.entity.DesktopSchema;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 桌面设计历史记录 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-04-13
|
||||
*/
|
||||
public interface IDesktopSchemaService extends IService<DesktopSchema> {
|
||||
|
||||
boolean add(AddDesktopSchemaDto dto);
|
||||
|
||||
boolean update(UpdateDesktopSchemaDto dto);
|
||||
|
||||
boolean delete(List<Long> ids);
|
||||
|
||||
boolean copy(CopyDesktopSchemaDto dto);
|
||||
|
||||
boolean setFirst(SetFirstDto dto);
|
||||
|
||||
boolean importDesktopSchema(MultipartFile multipartFile);
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.xjrsoft.desktop.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjrsoft.desktop.entity.UserDesktopRelation;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户桌面设计首页关系表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-06-02
|
||||
*/
|
||||
public interface IUserDesktopRelationService extends IService<UserDesktopRelation> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.xjrsoft.desktop.service.impl;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseServiceImpl;
|
||||
import com.xjrsoft.common.core.enums.YesOrNoEnum;
|
||||
import com.xjrsoft.desktop.dto.SetActivityDto;
|
||||
import com.xjrsoft.desktop.entity.DesktopHistory;
|
||||
import com.xjrsoft.desktop.entity.DesktopSchema;
|
||||
import com.xjrsoft.desktop.mapper.DesktopHistoryMapper;
|
||||
import com.xjrsoft.desktop.mapper.DesktopSchemaMapper;
|
||||
import com.xjrsoft.desktop.service.IDesktopHistoryService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-04-13
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class DesktopHistoryServiceImpl extends MPJBaseServiceImpl<DesktopHistoryMapper, DesktopHistory> implements IDesktopHistoryService {
|
||||
|
||||
private final DesktopSchemaMapper desktopSchemaMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean setActivity(SetActivityDto dto) {
|
||||
DesktopHistory history = getById(dto.getId());
|
||||
history.setActivityFlag(YesOrNoEnum.YES.getCode());
|
||||
|
||||
DesktopSchema desktopSchema = desktopSchemaMapper.selectById(history.getSchemaId());
|
||||
|
||||
desktopSchema.setJsonContent(history.getJsonContent());
|
||||
|
||||
updateById(history);
|
||||
|
||||
desktopSchemaMapper.updateById(desktopSchema);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.xjrsoft.desktop.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.xjrsoft.desktop.entity.DesktopRelation;
|
||||
import com.xjrsoft.desktop.mapper.DesktopRelationMapper;
|
||||
import com.xjrsoft.desktop.service.IDesktopRelationService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 桌面设计授权表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-06-01
|
||||
*/
|
||||
@Service
|
||||
public class DesktopRelationServiceImpl extends ServiceImpl<DesktopRelationMapper, DesktopRelation> implements IDesktopRelationService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,300 @@
|
||||
package com.xjrsoft.desktop.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.xjrsoft.common.core.enums.MenuType;
|
||||
import com.xjrsoft.common.core.enums.YesOrNoEnum;
|
||||
import com.xjrsoft.desktop.dto.AddDesktopSchemaDto;
|
||||
import com.xjrsoft.desktop.dto.CopyDesktopSchemaDto;
|
||||
import com.xjrsoft.desktop.dto.SetFirstDto;
|
||||
import com.xjrsoft.desktop.dto.UpdateDesktopSchemaDto;
|
||||
import com.xjrsoft.desktop.entity.DesktopHistory;
|
||||
import com.xjrsoft.desktop.entity.DesktopSchema;
|
||||
import com.xjrsoft.desktop.mapper.DesktopHistoryMapper;
|
||||
import com.xjrsoft.desktop.mapper.DesktopSchemaMapper;
|
||||
import com.xjrsoft.desktop.service.IDesktopSchemaService;
|
||||
import com.xjrsoft.system.client.IMenuClient;
|
||||
import com.xjrsoft.system.entity.Menu;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 桌面设计历史记录 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-04-13
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class DesktopSchemaServiceImpl extends ServiceImpl<DesktopSchemaMapper, DesktopSchema> implements IDesktopSchemaService {
|
||||
|
||||
private final DesktopHistoryMapper desktopHistoryMapper;
|
||||
|
||||
private final IMenuClient menuClient;
|
||||
|
||||
public final String componentPath = "/generator/desktop/home";
|
||||
|
||||
public final String urlPath = "/desktop-home/";
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean add(AddDesktopSchemaDto dto) {
|
||||
DesktopSchema desktopSchema = BeanUtil.toBean(dto, DesktopSchema.class);
|
||||
|
||||
long snowflakeNextId = IdUtil.getSnowflakeNextId();
|
||||
desktopSchema.setId(snowflakeNextId);
|
||||
|
||||
//是否菜单
|
||||
if (desktopSchema.getIsMenu() == YesOrNoEnum.YES.getCode()) {
|
||||
Menu menu = new Menu();
|
||||
long menuId = IdUtil.getSnowflakeNextId();
|
||||
desktopSchema.setMenuId(menuId);
|
||||
menu.setId(menuId);
|
||||
menu.setCode(desktopSchema.getCode());
|
||||
menu.setName(desktopSchema.getName());
|
||||
menu.setParentId(dto.getParentId());
|
||||
menu.setTitle(desktopSchema.getName());
|
||||
menu.setSystemId(desktopSchema.getSystemId());
|
||||
menu.setIcon(dto.getIcon());
|
||||
menu.setPath(urlPath + snowflakeNextId);
|
||||
menu.setComponent(componentPath);
|
||||
menu.setMenuType(MenuType.FUNCTION.getCode());
|
||||
menu.setDisplay(YesOrNoEnum.YES.getCode());
|
||||
menu.setAllowModify(YesOrNoEnum.YES.getCode());
|
||||
menu.setAllowDelete(YesOrNoEnum.YES.getCode());
|
||||
menu.setOutLink(YesOrNoEnum.NO.getCode());
|
||||
menu.setKeepAlive(YesOrNoEnum.NO.getCode());
|
||||
menu.setRemark(desktopSchema.getRemark());
|
||||
menu.setSortCode(dto.getSortCode());
|
||||
|
||||
menuClient.insertMenuFeign(menu);
|
||||
}
|
||||
|
||||
//如果此模板为首屏 需要吧其他的所有 设置为非首屏
|
||||
if (desktopSchema.getIsFirst() == YesOrNoEnum.YES.getCode()) {
|
||||
//将所有模板设置为 非默认
|
||||
LambdaQueryWrapper<DesktopSchema> select = Wrappers.lambdaQuery(DesktopSchema.class).eq(DesktopSchema::getIsFirst, YesOrNoEnum.YES.getCode()).select(DesktopSchema::getId);
|
||||
|
||||
List<DesktopSchema> list = list(select);
|
||||
|
||||
for (DesktopSchema schema : list) {
|
||||
schema.setIsFirst(YesOrNoEnum.NO.getCode());
|
||||
}
|
||||
updateBatchById(list);
|
||||
}
|
||||
save(desktopSchema);
|
||||
|
||||
|
||||
DesktopHistory history = new DesktopHistory();
|
||||
history.setSchemaId(desktopSchema.getId());
|
||||
history.setActivityFlag(YesOrNoEnum.YES.getCode());
|
||||
history.setJsonContent(desktopSchema.getJsonContent());
|
||||
desktopHistoryMapper.insert(history);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean update(UpdateDesktopSchemaDto dto) {
|
||||
DesktopSchema desktopSchema = BeanUtil.toBean(dto, DesktopSchema.class);
|
||||
|
||||
//是否菜单
|
||||
if (desktopSchema.getIsMenu() == YesOrNoEnum.YES.getCode()) {
|
||||
Menu menu = new Menu();
|
||||
menu.setCode(desktopSchema.getCode());
|
||||
menu.setName(desktopSchema.getName());
|
||||
menu.setParentId(dto.getParentId());
|
||||
menu.setTitle(desktopSchema.getName());
|
||||
menu.setSystemId(desktopSchema.getSystemId());
|
||||
menu.setIcon(dto.getIcon());
|
||||
menu.setId(dto.getMenuId());
|
||||
//如果是已经存在菜单 默认是修改原菜单
|
||||
if (ObjectUtil.isNotNull(dto.getMenuId()) && !dto.getMenuId().equals(0L)) {
|
||||
menuClient.updateMenuFeign(menu);
|
||||
}
|
||||
//如果取消了菜单 菜单数据不在 需要重新新增
|
||||
else {
|
||||
long menuId = IdUtil.getSnowflakeNextId();
|
||||
desktopSchema.setMenuId(menuId);
|
||||
menu.setId(menuId);
|
||||
menu.setPath(urlPath + dto.getId());
|
||||
menu.setComponent(componentPath);
|
||||
menu.setComponentType(YesOrNoEnum.YES.getCode());
|
||||
menu.setMenuType(MenuType.FUNCTION.getCode());
|
||||
menu.setDisplay(YesOrNoEnum.YES.getCode());
|
||||
menu.setAllowModify(YesOrNoEnum.YES.getCode());
|
||||
menu.setAllowDelete(YesOrNoEnum.YES.getCode());
|
||||
menu.setOutLink(YesOrNoEnum.NO.getCode());
|
||||
menu.setKeepAlive(YesOrNoEnum.NO.getCode());
|
||||
menu.setRemark(desktopSchema.getRemark());
|
||||
|
||||
menuClient.insertMenuFeign(menu);
|
||||
}
|
||||
|
||||
desktopSchema.setMenuId(menu.getId());
|
||||
}
|
||||
//如果不是菜单 需要把原菜单删除
|
||||
else {
|
||||
if(ObjectUtil.isNotNull(dto.getMenuId()) && dto.getMenuId() != 0L){
|
||||
menuClient.deleteMenuFeign(dto.getMenuId());
|
||||
desktopSchema.setMenuId(0L);
|
||||
}
|
||||
}
|
||||
|
||||
//如果此模板为首屏 需要吧其他的所有 设置为非首屏
|
||||
if (desktopSchema.getIsFirst() == YesOrNoEnum.YES.getCode()) {
|
||||
//将所有模板设置为 非默认
|
||||
//将所有模板设置为 非默认
|
||||
LambdaQueryWrapper<DesktopSchema> select = Wrappers.lambdaQuery(DesktopSchema.class).eq(DesktopSchema::getIsFirst, YesOrNoEnum.YES.getCode()).select(DesktopSchema::getId);
|
||||
|
||||
List<DesktopSchema> list = list(select);
|
||||
|
||||
for (DesktopSchema schema : list) {
|
||||
schema.setIsFirst(YesOrNoEnum.NO.getCode());
|
||||
}
|
||||
updateBatchById(list);
|
||||
}
|
||||
|
||||
updateById(desktopSchema);
|
||||
|
||||
|
||||
|
||||
|
||||
//修改原有历史记录 当前版本 标记
|
||||
DesktopHistory old = new DesktopHistory();
|
||||
old.setActivityFlag(YesOrNoEnum.NO.getCode());
|
||||
LambdaQueryWrapper<DesktopHistory> updateWrapper = Wrappers.lambdaQuery(DesktopHistory.class).eq(DesktopHistory::getSchemaId, desktopSchema.getId());
|
||||
desktopHistoryMapper.update(old, updateWrapper);
|
||||
|
||||
//新增一条历史记录
|
||||
DesktopHistory history = new DesktopHistory();
|
||||
history.setSchemaId(desktopSchema.getId());
|
||||
history.setActivityFlag(YesOrNoEnum.YES.getCode());
|
||||
history.setJsonContent(desktopSchema.getJsonContent());
|
||||
desktopHistoryMapper.insert(history);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean delete(List<Long> ids) {
|
||||
if (CollectionUtil.isEmpty(ids)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<DesktopSchema> wrapper = Wrappers.lambdaQuery(DesktopSchema.class)
|
||||
.eq(DesktopSchema::getIsMenu,YesOrNoEnum.YES.getCode())
|
||||
.isNotNull(DesktopSchema::getMenuId)
|
||||
.in(DesktopSchema::getId, ids).select(DesktopSchema::getId,DesktopSchema::getMenuId);
|
||||
|
||||
List<DesktopSchema> list = list(wrapper);
|
||||
List<Long> menuIds = list.stream().map(DesktopSchema::getMenuId).collect(Collectors.toList());
|
||||
|
||||
if (menuIds.size() > 0) {
|
||||
menuClient.deleteMenuBatchFeign(menuIds);
|
||||
}
|
||||
|
||||
removeBatchByIds(ids);
|
||||
|
||||
desktopHistoryMapper.delete(Wrappers.lambdaQuery(DesktopHistory.class).in(DesktopHistory::getSchemaId, ids));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean copy(CopyDesktopSchemaDto dto) {
|
||||
|
||||
DesktopSchema copySchema = getById(dto.getId());
|
||||
//不生成菜单
|
||||
copySchema.setId(null);
|
||||
copySchema.setIsFirst(YesOrNoEnum.NO.getCode());
|
||||
copySchema.setIsMenu(YesOrNoEnum.NO.getCode());
|
||||
copySchema.setMenuId(null);
|
||||
|
||||
save(copySchema);
|
||||
|
||||
DesktopHistory history = new DesktopHistory();
|
||||
history.setSchemaId(copySchema.getId());
|
||||
history.setActivityFlag(YesOrNoEnum.YES.getCode());
|
||||
history.setJsonContent(copySchema.getJsonContent());
|
||||
desktopHistoryMapper.insert(history);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setFirst(SetFirstDto dto) {
|
||||
//将所有模板设置为 非默认
|
||||
LambdaQueryWrapper<DesktopSchema> select = Wrappers.lambdaQuery(DesktopSchema.class).eq(DesktopSchema::getIsFirst, YesOrNoEnum.YES.getCode()).select(DesktopSchema::getId);
|
||||
|
||||
List<DesktopSchema> list = list(select);
|
||||
|
||||
for (DesktopSchema desktopSchema : list) {
|
||||
desktopSchema.setIsFirst(YesOrNoEnum.NO.getCode());
|
||||
}
|
||||
updateBatchById(list);
|
||||
|
||||
//将当前模板所选模板设置为默认
|
||||
DesktopSchema schema = new DesktopSchema();
|
||||
schema.setId(dto.getId());
|
||||
schema.setIsFirst(YesOrNoEnum.YES.getCode());
|
||||
schema.setEnabledMark(YesOrNoEnum.YES.getCode());
|
||||
updateById(schema);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean importDesktopSchema(MultipartFile multipartFile) {
|
||||
//用流读取文件
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(multipartFile.getInputStream()));
|
||||
String line;
|
||||
StringBuilder content = new StringBuilder();
|
||||
// 读取想定文件
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
content.append(line);
|
||||
}
|
||||
|
||||
DesktopSchema desktopSchema = JSONUtil.toBean(content.toString(), DesktopSchema.class);
|
||||
|
||||
//不生成菜单
|
||||
desktopSchema.setId(null);
|
||||
desktopSchema.setIsFirst(YesOrNoEnum.NO.getCode());
|
||||
desktopSchema.setIsMenu(YesOrNoEnum.NO.getCode());
|
||||
desktopSchema.setMenuId(null);
|
||||
|
||||
save(desktopSchema);
|
||||
|
||||
|
||||
DesktopHistory history = new DesktopHistory();
|
||||
history.setSchemaId(desktopSchema.getId());
|
||||
history.setActivityFlag(YesOrNoEnum.YES.getCode());
|
||||
history.setJsonContent(desktopSchema.getJsonContent());
|
||||
desktopHistoryMapper.insert(history);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.xjrsoft.desktop.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.xjrsoft.desktop.entity.UserDesktopRelation;
|
||||
import com.xjrsoft.desktop.mapper.UserDesktopRelationMapper;
|
||||
import com.xjrsoft.desktop.service.IUserDesktopRelationService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户桌面设计首页关系表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author tzx
|
||||
* @since 2023-06-02
|
||||
*/
|
||||
@Service
|
||||
public class UserDesktopRelationServiceImpl extends ServiceImpl<UserDesktopRelationMapper, UserDesktopRelation> implements IUserDesktopRelationService {
|
||||
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: public
|
||||
@ -0,0 +1,75 @@
|
||||
server:
|
||||
port: 3003
|
||||
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: desktop-service
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
autoconfigure:
|
||||
#自动化配置 例外处理
|
||||
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
dynamic:
|
||||
primary: master
|
||||
datasource:
|
||||
master:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://new-energy-mysqlt.itc.gdyd.com:3307/fcd2-msat-init?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
|
||||
username: learun4dev
|
||||
password: ABcd1234@
|
||||
|
||||
cloud:
|
||||
nacos: #nacos监控
|
||||
discovery:
|
||||
server-addr: 10.0.252.1:8848
|
||||
namespace: ITC
|
||||
group: DNE
|
||||
username: nacos
|
||||
password: ABcd1234@
|
||||
config:
|
||||
server-addr: 10.0.252.1:8848 # nacos 配置中心地址
|
||||
namespace: ITC
|
||||
group: DNE
|
||||
username: nacos
|
||||
password: ABcd1234@
|
||||
file-extension: yml # 指定格式 xjrsoft-demo-service-dev.yml
|
||||
extension-configs:
|
||||
- data-id: global-config.yml #导入全局配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
- data-id: mybatis-plus-config.yml #导入mybatisplus 配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
- data-id: sa-token-client-config.yml #导入sa-token配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
- data-id: redis-config.yml #导入redis配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
- data-id: seata-config.yml #导入seata配置
|
||||
refresh: true
|
||||
group: DNE
|
||||
sentinel:
|
||||
transport:
|
||||
dashboard: localhost:8080 #sentinel dashboard 地址
|
||||
port: 8719 #默认端口, 如果 被占用,会一直+1 直到未被占用为止
|
||||
|
||||
|
||||
|
||||
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
path: /swagger-ui.html
|
||||
tags-sorter: alpha
|
||||
operations-sorter: alpha
|
||||
show-extensions: true
|
||||
api-docs:
|
||||
path: /desktop/v3/api-docs
|
||||
group-configs:
|
||||
- group: 'default'
|
||||
paths-to-match: '/desktop/**'
|
||||
packages-to-scan: com.xjrsoft.desktop
|
||||
default-flat-param-object: false
|
||||
16
xjrsoft-service/xjrsoft-service-erp/Dockerfile
Normal file
16
xjrsoft-service/xjrsoft-service-erp/Dockerfile
Normal file
@ -0,0 +1,16 @@
|
||||
# 基础镜像
|
||||
FROM nexus.gdyditc.com:8082/openjdk:11-arm64
|
||||
# author
|
||||
MAINTAINER xjrsoft
|
||||
|
||||
# 挂载目录
|
||||
VOLUME /home/xjrsoft
|
||||
# 创建目录
|
||||
RUN mkdir -p /home/xjrsoft
|
||||
# 指定路径
|
||||
WORKDIR /home/xjrsoft
|
||||
# 复制jar文件到路径
|
||||
RUN ls
|
||||
COPY ./target/xjrsoft-service-erp.jar /home/xjrsoft/xjrsoft-service-erp.jar
|
||||
# 启动认证服务
|
||||
ENTRYPOINT ["java","-Dfile.encoding=utf-8","--add-opens","java.base/java.lang.reflect=ALL-UNNAMED","-jar","xjrsoft-service-erp.jar"]
|
||||
86
xjrsoft-service/xjrsoft-service-erp/pom.xml
Normal file
86
xjrsoft-service/xjrsoft-service-erp/pom.xml
Normal file
@ -0,0 +1,86 @@
|
||||
<?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>xjrsoft-service</artifactId>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>xjrsoft-service-erp</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-erp-api</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-common-core</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-common-mybatis</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-organization-api</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-service-workflow-api</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.xjrsoft</groupId>
|
||||
<artifactId>xjrsoft-common-advice</artifactId>
|
||||
<version>${xjrsoft.framework.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,24 @@
|
||||
package com.xjrsoft.erp;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
/**
|
||||
* @Author: tzx
|
||||
* @Date: 2023/10/19 14:57
|
||||
*/
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
@EnableFeignClients(basePackages = "com.xjrsoft")
|
||||
@MapperScan(value = "com.xjrsoft.**.mapper")
|
||||
@ComponentScan(value = "com.xjrsoft")
|
||||
public class ErpApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ErpApplication.class, args);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,294 @@
|
||||
package com.xjrsoft.erp.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.support.ExcelTypeEnum;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.yulichang.toolkit.MPJWrappers;
|
||||
import com.xjrsoft.common.core.annotation.XjrLog;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.core.uitls.TreeUtil;
|
||||
import com.xjrsoft.common.core.uitls.VoToColumnUtil;
|
||||
import com.xjrsoft.erp.dto.AddCaseErpBomDto;
|
||||
import com.xjrsoft.erp.dto.ImportCaseErpBomDto;
|
||||
import com.xjrsoft.erp.dto.ImportCaseErpBomVo;
|
||||
import com.xjrsoft.erp.dto.UpdateCaseErpBomDto;
|
||||
import com.xjrsoft.erp.entity.CaseErpBom;
|
||||
import com.xjrsoft.erp.entity.CaseErpMaterial;
|
||||
import com.xjrsoft.erp.service.ICaseErpBomService;
|
||||
import com.xjrsoft.erp.service.ICaseErpMaterialService;
|
||||
import com.xjrsoft.erp.vo.CaseErpBomExportVo;
|
||||
import com.xjrsoft.erp.vo.CaseErpBomTreeVo;
|
||||
import com.xjrsoft.erp.vo.CaseErpBomVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* BOM信息【case_erp_bom】 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-06-19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.CASE_ERP_BOM +"/caseErpBom")
|
||||
@Tag(name = GlobalConstant.CASE_ERP_BOM +"/caseErpBom", description = "BOM信息")
|
||||
@AllArgsConstructor
|
||||
public class CaseErpBomController {
|
||||
private ICaseErpBomService caseErpBomService;
|
||||
|
||||
private ICaseErpMaterialService caseErpMaterialService;
|
||||
|
||||
@GetMapping(value = "/tree")
|
||||
@Operation(summary = "Bom信息树")
|
||||
public R tree() {
|
||||
List<CaseErpBom> list = caseErpBomService.list(Wrappers.<CaseErpBom>lambdaQuery()
|
||||
.orderByDesc(CaseErpBom::getCreateDate)
|
||||
.select(CaseErpBom.class, x -> VoToColumnUtil.fieldsToColumns(CaseErpBomTreeVo.class).contains(x.getProperty())));
|
||||
List<CaseErpBomTreeVo> voList = BeanUtil.copyToList(list, CaseErpBomTreeVo.class);
|
||||
List<CaseErpBomTreeVo> treeVoList = TreeUtil.build(voList);
|
||||
return R.ok(treeVoList);
|
||||
}
|
||||
|
||||
@GetMapping("/verification")
|
||||
@Operation(summary = "系统验证")
|
||||
public R verification(@RequestParam Long id){
|
||||
List<CaseErpBom> list = caseErpBomService.list();
|
||||
List<Long> ids = list.stream().map(o -> o.getMaterialId()).collect(Collectors.toList());
|
||||
if(ids.contains(id)){
|
||||
return R.error("该物料已进行过bom配置不能再次配置");
|
||||
}else {
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增BOM物料")
|
||||
public R add(@RequestBody AddCaseErpBomDto dto){
|
||||
List<CaseErpBom> list = caseErpBomService.list();
|
||||
List<CaseErpMaterial> caseErpMaterialList = caseErpMaterialService.list();
|
||||
CaseErpBom copy = BeanUtil.toBean(dto, CaseErpBom.class);
|
||||
if(ObjectUtil.isNotEmpty(dto.getParentId()) && dto.getParentId()!= 0L){
|
||||
CaseErpBom caseErpBom = list.stream().filter(x -> x.getId().equals(dto.getParentId())).findFirst().orElse(new CaseErpBom());
|
||||
if (StrUtil.isNotBlank(caseErpBom.getBomLevel())){
|
||||
List<Long> ids = StrUtil.split(caseErpBom.getBomLevel().toString(), StringPool.DASH)
|
||||
.stream().map(str -> Long.valueOf(str)).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(ids)){
|
||||
List<Long> materialIds = list.stream().filter(x -> ids.contains(x.getId())).map(CaseErpBom::getMaterialId).collect(Collectors.toList());
|
||||
if(materialIds.contains(dto.getMaterialId())){
|
||||
return R.error("不允许添加包括该子物料在内和所有直系的上级物料");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
copy.setCount(new BigDecimal("1"));
|
||||
copy.setParentId(0L);
|
||||
}
|
||||
if (StrUtil.isNotBlank(copy.getCode())){
|
||||
CaseErpMaterial caseErpMaterial = caseErpMaterialList.stream().filter(x -> x.getCode().equals(copy.getCode())).findFirst().orElse(new CaseErpMaterial());
|
||||
if (ObjectUtil.isNotEmpty(caseErpMaterial.getId())){
|
||||
copy.setMaterialId(caseErpMaterial.getId());
|
||||
}else {
|
||||
R.error("此物料不存在");
|
||||
}
|
||||
}
|
||||
caseErpBomService.save(copy);
|
||||
//保存层级
|
||||
if (ObjectUtil.isNotEmpty(dto.getParentId())&& dto.getParentId()!= 0L){
|
||||
CaseErpBom caseErpBom = list.stream().filter(x -> x.getId().equals(dto.getParentId())).findFirst().orElse(new CaseErpBom());
|
||||
copy.setBomLevel(caseErpBom.getBomLevel()+ StringPool.DASH + copy.getId());
|
||||
}else {
|
||||
copy.setBomLevel(copy.getId().toString());
|
||||
}
|
||||
caseErpBomService.updateById(copy);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询物料信息(当前以及子级信息)")
|
||||
public R info(@RequestParam(required = false) Long id) {
|
||||
if (ObjectUtil.isNotEmpty(id)){
|
||||
CaseErpBomVo caseErpBomVo = caseErpBomService.selectJoinOne(CaseErpBomVo.class,
|
||||
MPJWrappers.<CaseErpBom>lambdaJoin()
|
||||
.distinct()
|
||||
.eq(CaseErpBom::getId,id)
|
||||
.select(CaseErpBom::getId)
|
||||
.select(CaseErpBom.class, x -> VoToColumnUtil.fieldsToColumns(CaseErpBomVo.class).contains(x.getProperty())));
|
||||
//子级物料信息
|
||||
List<Long> childIds = caseErpBomService.list().stream().filter(x -> StrUtil.isNotBlank(x.getBomLevel())
|
||||
&& x.getBomLevel().contains(id + StringPool.DASH)).map(CaseErpBom::getId).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(childIds)){
|
||||
List<CaseErpBomVo> caseErpBomVoList = caseErpBomService.selectJoinList(CaseErpBomVo.class,
|
||||
MPJWrappers.<CaseErpBom>lambdaJoin()
|
||||
.distinct()
|
||||
.in(CaseErpBom::getId, childIds)
|
||||
.select(CaseErpBom::getId)
|
||||
.select(CaseErpBom.class, x -> VoToColumnUtil.fieldsToColumns(CaseErpBomVo.class).contains(x.getProperty())));
|
||||
if (CollectionUtil.isNotEmpty(caseErpBomVoList)){
|
||||
caseErpBomVo.setChildList(caseErpBomVoList);
|
||||
}
|
||||
}
|
||||
CaseErpBomVo arr[];
|
||||
arr = new CaseErpBomVo[1];
|
||||
arr[0] = caseErpBomVo;
|
||||
return R.ok(arr);
|
||||
}else {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改Bom信息")
|
||||
public R update(@Valid @RequestBody UpdateCaseErpBomDto dto) {
|
||||
List<CaseErpBom> list = caseErpBomService.list();
|
||||
if(ObjectUtil.isNotEmpty(dto.getParentId())){
|
||||
CaseErpBom caseErpBom = list.stream().filter(x -> x.getId().equals(dto.getParentId())).findFirst().orElse(new CaseErpBom());
|
||||
if (StrUtil.isNotBlank(caseErpBom.getBomLevel())){
|
||||
//上级bom信息
|
||||
List<Long> ids = StrUtil.split(caseErpBom.getBomLevel().toString(), StringPool.DASH)
|
||||
.stream().map(str -> Long.valueOf(str)).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(ids)){
|
||||
List<Long> materialIds = list.stream().filter(x -> ids.contains(x.getId())).map(CaseErpBom::getMaterialId).collect(Collectors.toList());
|
||||
if(materialIds.contains(dto.getMaterialId())){
|
||||
return R.error("不允许修改包括该子物料在内和所有直系的上级物料");
|
||||
}
|
||||
}
|
||||
//下级bom信息
|
||||
List<Long> childIds = list.stream().filter(x -> StrUtil.isNotBlank(x.getBomLevel())
|
||||
&& x.getBomLevel().contains(caseErpBom.getId() + StringPool.DASH)).map(CaseErpBom::getId).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(childIds)){
|
||||
List<Long> materialIds = list.stream().filter(x -> childIds.contains(x.getId())).map(CaseErpBom::getMaterialId).collect(Collectors.toList());
|
||||
if(materialIds.contains(dto.getMaterialId())){
|
||||
return R.error("不允许修改成为:该级别物料子物料在内和所有直系的下级物料");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
CaseErpBom copy = BeanUtil.toBean(dto, CaseErpBom.class);
|
||||
List<CaseErpMaterial> caseErpMaterialList = caseErpMaterialService.list();
|
||||
if (StrUtil.isNotBlank(copy.getCode())){
|
||||
CaseErpMaterial caseErpMaterial = caseErpMaterialList.stream().filter(x -> x.getCode().equals(copy.getCode())).findFirst().orElse(new CaseErpMaterial());
|
||||
if (ObjectUtil.isNotEmpty(caseErpMaterial.getId())){
|
||||
copy.setMaterialId(caseErpMaterial.getId());
|
||||
}else {
|
||||
R.error("此物料不存在");
|
||||
}
|
||||
}
|
||||
caseErpBomService.updateById(copy);
|
||||
return R.ok(true);
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@XjrLog(value = "删除bom信息")
|
||||
public R delete(@Valid @RequestBody Long id) {
|
||||
List<CaseErpBom> list = caseErpBomService.list();
|
||||
CaseErpBom caseErpBom = list.stream().filter(x -> x.getId().equals(id)).findFirst().orElse(new CaseErpBom());
|
||||
if (ObjectUtil.isNotEmpty(caseErpBom)){
|
||||
//下级物料信息
|
||||
List<Long> childIds = list.stream().filter(x -> StrUtil.isNotBlank(x.getBomLevel())
|
||||
&& x.getBomLevel().contains(caseErpBom.getId() + StringPool.DASH)).map(CaseErpBom::getId).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(childIds)){
|
||||
return R.error("存在下级物料信息,不允许删除");
|
||||
}
|
||||
else {
|
||||
caseErpBomService.removeById(id);
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/export")
|
||||
@Operation(summary = "导出")
|
||||
@XjrLog(value = "导出Bom信息")
|
||||
public ResponseEntity<byte[]> exportAll() {
|
||||
List<CaseErpBomExportVo> caseErpBomVoList = caseErpBomService.selectJoinList(CaseErpBomExportVo.class,
|
||||
MPJWrappers.<CaseErpBom>lambdaJoin()
|
||||
.distinct()
|
||||
.select(CaseErpBom::getId)
|
||||
.select(CaseErpBom.class, x -> VoToColumnUtil.fieldsToColumns(CaseErpBomExportVo.class).contains(x.getProperty())));
|
||||
ByteArrayOutputStream bot = new ByteArrayOutputStream();
|
||||
|
||||
EasyExcel.write(bot, CaseErpBomExportVo.class).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(caseErpBomVoList);
|
||||
return R.fileStream(bot.toByteArray(), "产品Bom信息" + ExcelTypeEnum.XLSX.getValue());
|
||||
}
|
||||
|
||||
@PostMapping("/import")
|
||||
@Operation(summary = "导入")
|
||||
public R importData(@RequestParam MultipartFile file) throws IOException {
|
||||
List<ImportCaseErpBomVo> voList = EasyExcel.read(file.getInputStream()).head(ImportCaseErpBomVo.class).sheet().doReadSync();
|
||||
List<ImportCaseErpBomDto> importCaseErpBomDtoList = BeanUtil.copyToList(voList, ImportCaseErpBomDto.class);
|
||||
List<CaseErpMaterial> caseErpMaterialList = caseErpMaterialService.list();
|
||||
List<CaseErpBom> list = caseErpBomService.list();
|
||||
List<AddCaseErpBomDto> addCaseErpBomDtoList = new ArrayList<>();
|
||||
for (ImportCaseErpBomDto importCaseErpBomDto : importCaseErpBomDtoList) {
|
||||
if (StrUtil.isBlank(importCaseErpBomDto.getParentName())){
|
||||
importCaseErpBomDto.setParentId(0L);
|
||||
}else {
|
||||
CaseErpBom caseErpBom = list.stream().filter(x -> x.getName().equals(importCaseErpBomDto.getParentName())).findFirst().orElse(new CaseErpBom());
|
||||
if (ObjectUtil.isNotEmpty(caseErpBom.getId())){
|
||||
importCaseErpBomDto.setParentId(caseErpBom.getId());
|
||||
}else {
|
||||
importCaseErpBomDto.setParentId(0L);
|
||||
return R.error("父级名称填写错误");
|
||||
}
|
||||
}
|
||||
AddCaseErpBomDto addCaseErpBomDto = BeanUtil.toBean(importCaseErpBomDto, AddCaseErpBomDto.class);
|
||||
if (StrUtil.isNotBlank(importCaseErpBomDto.getCode())){
|
||||
CaseErpMaterial caseErpMaterial = caseErpMaterialList.stream().filter(x -> x.getCode().equals(importCaseErpBomDto.getCode())).findFirst().orElse(new CaseErpMaterial());
|
||||
if (ObjectUtil.isNotEmpty(caseErpMaterial.getId())){
|
||||
addCaseErpBomDto.setMaterialId(caseErpMaterial.getId());
|
||||
}else {
|
||||
return R.error("此物料不存在");
|
||||
}
|
||||
}
|
||||
addCaseErpBomDtoList.add(addCaseErpBomDto);
|
||||
}
|
||||
List<CaseErpBom> caseErpBomList = BeanUtil.copyToList(addCaseErpBomDtoList, CaseErpBom.class);
|
||||
caseErpBomService.saveBatch(caseErpBomList);
|
||||
for (CaseErpBom caseErpBom : caseErpBomList) {
|
||||
//保存层级
|
||||
if (ObjectUtil.isNotEmpty(caseErpBom.getParentId())&& caseErpBom.getParentId()!= 0L){
|
||||
CaseErpBom caseErpBom1 = list.stream().filter(x -> x.getId().equals(caseErpBom.getParentId())).findFirst().orElse(new CaseErpBom());
|
||||
caseErpBom.setBomLevel(caseErpBom1.getBomLevel()+ StringPool.DASH + caseErpBom.getId());
|
||||
}else {
|
||||
caseErpBom.setBomLevel(caseErpBom.getId().toString());
|
||||
}
|
||||
}
|
||||
caseErpBomService.updateBatchById(caseErpBomList);
|
||||
return R.ok(true);
|
||||
}
|
||||
|
||||
@GetMapping("/export")
|
||||
@Operation(summary = "下载模板")
|
||||
@SneakyThrows
|
||||
public ResponseEntity<byte[]> export() {
|
||||
List<ImportCaseErpBomVo> caseErpBomVoList = new ArrayList<>();
|
||||
ByteArrayOutputStream bot = new ByteArrayOutputStream();
|
||||
EasyExcel.write(bot, ImportCaseErpBomVo.class).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(BeanUtil.copyToList(caseErpBomVoList, ImportCaseErpBomVo.class));
|
||||
return R.fileStream(bot.toByteArray(), "产品Bom信息模板" + ExcelTypeEnum.XLSX.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package com.xjrsoft.erp.controller;
|
||||
|
||||
import com.xjrsoft.common.core.annotation.XjrLog;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.erp.dto.AddCaseErpCustomerContactsDto;
|
||||
import com.xjrsoft.erp.dto.UpdateCaseErpCustomerContactsDto;
|
||||
import com.xjrsoft.erp.entity.CaseErpCustomerContacts;
|
||||
import com.xjrsoft.erp.service.ICaseErpCustomerContactsService;
|
||||
import com.xjrsoft.erp.service.ICaseErpLogService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 客户联系人【case_erp_customer_contacts】 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-07-11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.CASE_ERP_CUSTOMER +"/caseErpCustomerContacts")
|
||||
@Tag(name = GlobalConstant.CASE_ERP_CUSTOMER +"/caseErpCustomerContacts", description = "客户联系人")
|
||||
@AllArgsConstructor
|
||||
public class CaseErpCustomerContactsController {
|
||||
private ICaseErpCustomerContactsService caseErpCustomerContactsService;
|
||||
|
||||
private ICaseErpLogService caseErpLogService;
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增客户联系人信息")
|
||||
public R add(@Valid @RequestBody AddCaseErpCustomerContactsDto dto) {
|
||||
return R.ok(caseErpCustomerContactsService.add(dto));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改客户联系人信息")
|
||||
public R update(@Valid @RequestBody UpdateCaseErpCustomerContactsDto dto) {
|
||||
return R.ok(caseErpCustomerContactsService.update(dto));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询客户联系人信息")
|
||||
public R info(@RequestParam Long id) {
|
||||
CaseErpCustomerContacts caseErpCustomerContacts = caseErpCustomerContactsService.getById(id);
|
||||
if (caseErpCustomerContacts == null) {
|
||||
R.error("找不到此客户联系人信息!");
|
||||
}
|
||||
return R.ok(caseErpCustomerContacts);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@XjrLog(value = "删除客户联系人信息")
|
||||
public R delete(@Valid @RequestBody Long id) {
|
||||
return R.ok(caseErpCustomerContactsService.removeById(id));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,232 @@
|
||||
package com.xjrsoft.erp.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.support.ExcelTypeEnum;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.xjrsoft.common.core.annotation.XjrLog;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.redis.service.RedisUtil;
|
||||
import com.xjrsoft.erp.dto.*;
|
||||
import com.xjrsoft.erp.entity.CaseErpCustomer;
|
||||
import com.xjrsoft.erp.service.ICaseErpCustomerService;
|
||||
import com.xjrsoft.erp.vo.*;
|
||||
import com.xjrsoft.organization.entity.User;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 客户信息【case_erp_customer】 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-07-11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.CASE_ERP_CUSTOMER+"/caseErpCustomer")
|
||||
@Tag(name = GlobalConstant.CASE_ERP_CUSTOMER +"/caseErpCustomer", description = "客户信息")
|
||||
@AllArgsConstructor
|
||||
public class CaseErpCustomerController {
|
||||
private ICaseErpCustomerService caseErpCustomerService;
|
||||
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@GetMapping(value = "/list")
|
||||
@Operation(summary = "所有客户列表,不分页")
|
||||
public R list() {
|
||||
List<CaseErpCustomer> list = caseErpCustomerService.list();
|
||||
List<CaseErpCustomerListVo> caseErpCustomerListVos = BeanUtil.copyToList(list, CaseErpCustomerListVo.class);
|
||||
List<User> userList = redisUtil.get(GlobalConstant.USER_CACHE_KEY, new TypeReference<List<User>>() {
|
||||
});
|
||||
for (CaseErpCustomerListVo caseErpCustomerListVo : caseErpCustomerListVos) {
|
||||
if (StrUtil.isNotBlank(caseErpCustomerListVo.getSaleIds())){
|
||||
String allUserIdStr = StrUtil.join(StringPool.COMMA, caseErpCustomerListVo.getSaleIds());
|
||||
List<Long> ids = Arrays.stream(allUserIdStr.split(StringPool.COMMA)).map(Convert::toLong).collect(Collectors.toList());
|
||||
List<String> names = userList.stream().filter(x -> ids.contains(x.getId())).map(User::getName).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(names)){
|
||||
caseErpCustomerListVo.setSaleNames(StrUtil.join(StringPool.COMMA,names));
|
||||
}
|
||||
}
|
||||
caseErpCustomerListVo.setSalePhone("18333333333");
|
||||
}
|
||||
return R.ok(caseErpCustomerListVos);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "客户信息、客户公海列表分页")
|
||||
public R page(CaseErpCustomerDto dto) {
|
||||
return R.ok(caseErpCustomerService.getPageList(dto));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增客户信息、公海信息")
|
||||
public R add(@Valid @RequestBody AddCaseErpCustomerDto dto) {
|
||||
long count = caseErpCustomerService.count(Wrappers.<CaseErpCustomer>query().lambda().eq(CaseErpCustomer::getName, dto.getName()));
|
||||
if (count > 0) {
|
||||
return R.error("此客户信息已经存在!");
|
||||
}
|
||||
return R.ok(caseErpCustomerService.add(dto));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改客户信息、公海信息")
|
||||
public R update(@Valid @RequestBody UpdateCaseErpCustomerDto dto) {
|
||||
return R.ok(caseErpCustomerService.update(dto));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询客户信息、公海信息(返回id值,编辑使用)")
|
||||
public R info(@RequestParam Long id) {
|
||||
CaseErpCustomer caseErpCustomer = caseErpCustomerService.getById(id);
|
||||
if (caseErpCustomer == null) {
|
||||
R.error("找不到此客户信息!");
|
||||
}
|
||||
CaseErpCustomerInfoVo caseErpCustomerInfoVo = caseErpCustomerService.info(caseErpCustomer);
|
||||
return R.ok(caseErpCustomerInfoVo);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/base-info")
|
||||
@Operation(summary = "根据id查询客户基本信息(返回名称值,详情查看使用)")
|
||||
public R baseInfo(@RequestParam Long id) {
|
||||
CaseErpCustomer caseErpCustomer = caseErpCustomerService.getById(id);
|
||||
if (caseErpCustomer == null) {
|
||||
R.error("找不到此客户信息!");
|
||||
}
|
||||
CaseErpCustomerVo caseErpCustomerVo = caseErpCustomerService.baseInfo(caseErpCustomer);
|
||||
return R.ok(caseErpCustomerVo);
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@XjrLog(value = "删除客户信息、公海信息")
|
||||
public R delete(@Valid @RequestBody Long id) {
|
||||
return R.ok(caseErpCustomerService.delete(id));
|
||||
}
|
||||
|
||||
@PutMapping("/common")
|
||||
@Operation(summary = "移入公海")
|
||||
public R common(@Valid @RequestBody List<Long> ids) {
|
||||
return R.ok( caseErpCustomerService.common(ids));
|
||||
}
|
||||
|
||||
@PutMapping("/transfer")
|
||||
@Operation(summary = "转移")
|
||||
public R transfer(@Valid @RequestBody TransferCaseErpCustomerDto dto) {
|
||||
return R.ok( caseErpCustomerService.transfer(dto));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/export")
|
||||
@Operation(summary = "客户列表导出")
|
||||
@XjrLog(value = "导出表单数据")
|
||||
public ResponseEntity<byte[]> export(@RequestBody List<Long> ids) {
|
||||
List<CaseErpCustomerExportVo> exportVoList = caseErpCustomerService.export(ids);
|
||||
ByteArrayOutputStream bot = new ByteArrayOutputStream();
|
||||
EasyExcel.write(bot, CaseErpCustomerExportVo.class).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(exportVoList);
|
||||
return R.fileStream(bot.toByteArray(), "客户列表" + ExcelTypeEnum.XLSX.getValue());
|
||||
}
|
||||
|
||||
@PostMapping("/import")
|
||||
@Operation(summary = "客户列表导入")
|
||||
public R importData(@RequestParam MultipartFile file) throws IOException {
|
||||
return R.ok(caseErpCustomerService.importData(file));
|
||||
}
|
||||
|
||||
@GetMapping("/export")
|
||||
@Operation(summary = "客户列表下载模板")
|
||||
@SneakyThrows
|
||||
public ResponseEntity<byte[]> export() {
|
||||
List<ImportCaseErpCustomerDto> importCaseErpUnitDtos = new ArrayList<>();
|
||||
ByteArrayOutputStream bot = new ByteArrayOutputStream();
|
||||
EasyExcel.write(bot, ImportCaseErpCustomerDto.class).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(BeanUtil.copyToList(importCaseErpUnitDtos, ImportCaseErpCustomerDto.class));
|
||||
return R.fileStream(bot.toByteArray(), "客户列表模板" + ExcelTypeEnum.XLSX.getValue());
|
||||
}
|
||||
|
||||
@PostMapping(value = "/export-common")
|
||||
@Operation(summary = "客户公海导出")
|
||||
@XjrLog(value = "导出表单数据")
|
||||
public ResponseEntity<byte[]> exportCommonAll() {
|
||||
List<CaseErpCustomerCommonExportVo> exportVoList = caseErpCustomerService.exportCommon();
|
||||
ByteArrayOutputStream bot = new ByteArrayOutputStream();
|
||||
EasyExcel.write(bot, CaseErpCustomerCommonExportVo.class).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(exportVoList);
|
||||
return R.fileStream(bot.toByteArray(), "客户公海" + ExcelTypeEnum.XLSX.getValue());
|
||||
}
|
||||
|
||||
@PostMapping("/import-common")
|
||||
@Operation(summary = "客户公海导入")
|
||||
public R importCommonData(@RequestParam MultipartFile file) throws IOException {
|
||||
return R.ok(caseErpCustomerService.importCommonData(file));
|
||||
}
|
||||
|
||||
@GetMapping("/export-common")
|
||||
@Operation(summary = "客户公海下载模板")
|
||||
@SneakyThrows
|
||||
public ResponseEntity<byte[]> exportCommon() {
|
||||
List<ImportCaseErpCustomerDto> importCaseErpUnitDtos = new ArrayList<>();
|
||||
ByteArrayOutputStream bot = new ByteArrayOutputStream();
|
||||
EasyExcel.write(bot, ImportCaseErpCustomerDto.class).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(BeanUtil.copyToList(importCaseErpUnitDtos, ImportCaseErpCustomerDto.class));
|
||||
return R.fileStream(bot.toByteArray(), "客户公海模板" + ExcelTypeEnum.XLSX.getValue());
|
||||
}
|
||||
|
||||
@GetMapping(value = "/detail-info")
|
||||
@Operation(summary = "根据id查询详情信息")
|
||||
public R detailInfo(@RequestParam Long id) {
|
||||
CaseErpCustomer caseErpCustomer = caseErpCustomerService.getById(id);
|
||||
if (caseErpCustomer == null) {
|
||||
R.error("找不到此客户信息!");
|
||||
}
|
||||
return R.ok(caseErpCustomerService.detailInfo(caseErpCustomer));
|
||||
}
|
||||
|
||||
@PutMapping(value = "/get-from-common")
|
||||
@Operation(summary = "根据id领取客户")
|
||||
public R getFromCommon(@Valid @RequestBody TransferCaseErpCustomerDto dto) {
|
||||
return R.ok(caseErpCustomerService.getFromCommon(dto.getId()));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/customer-source")
|
||||
@Operation(summary ="客户来源统计")
|
||||
public R customerSource() {
|
||||
return R.ok(caseErpCustomerService.getCustomerSource());
|
||||
}
|
||||
|
||||
@GetMapping("/customer-statistics")
|
||||
@Operation(summary ="统计今日客户数据")
|
||||
public R customerStatistics() {
|
||||
return R.ok(caseErpCustomerService.getAll());
|
||||
}
|
||||
|
||||
@GetMapping("/customer-gather")
|
||||
@Operation(summary = "客户回款")
|
||||
public R customerGather() {
|
||||
return R.ok(caseErpCustomerService.getCustomerPaymexnt());
|
||||
}
|
||||
|
||||
@GetMapping("/customer-type")
|
||||
@Operation(summary ="客户类型分布")
|
||||
public R getCustomerType() {
|
||||
return R.ok(caseErpCustomerService.getCustomerType());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
package com.xjrsoft.erp.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.xjrsoft.common.core.annotation.XjrLog;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.erp.dto.AddCaseErpCustomerFollowDto;
|
||||
import com.xjrsoft.erp.dto.UpdateCaseErpCustomerFollowDto;
|
||||
import com.xjrsoft.erp.entity.CaseErpCustomerFollow;
|
||||
import com.xjrsoft.erp.entity.CaseErpLog;
|
||||
import com.xjrsoft.erp.service.ICaseErpCustomerFollowService;
|
||||
import com.xjrsoft.erp.service.ICaseErpLogService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 客户跟进【case_erp_customer_follow】 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-07-11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.CASE_ERP_CUSTOMER+"/caseErpCustomerFollow")
|
||||
@Tag(name = GlobalConstant.CASE_ERP_CUSTOMER +"/caseErpCustomerFollow", description = "客户跟进")
|
||||
@AllArgsConstructor
|
||||
public class CaseErpCustomerFollowController {
|
||||
|
||||
private ICaseErpCustomerFollowService caseErpCustomerFollowService;
|
||||
|
||||
private ICaseErpLogService caseErpLogService;
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增客户跟进信息")
|
||||
public R add(@Valid @RequestBody AddCaseErpCustomerFollowDto dto) {
|
||||
CaseErpCustomerFollow caseErpCustomerFollow = BeanUtil.toBean(dto, CaseErpCustomerFollow.class);
|
||||
caseErpCustomerFollowService.save(caseErpCustomerFollow);
|
||||
|
||||
CaseErpLog log = new CaseErpLog();
|
||||
log.setKeyId(dto.getCustomerId());
|
||||
log.setCategoryId(0);
|
||||
log.setExecuteResultJson("新增客户跟进");
|
||||
caseErpLogService.save(log);
|
||||
|
||||
return R.ok(true);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改客户跟进信息")
|
||||
public R update(@Valid @RequestBody UpdateCaseErpCustomerFollowDto dto) {
|
||||
CaseErpCustomerFollow caseErpCustomerFollow = BeanUtil.toBean(dto, CaseErpCustomerFollow.class);
|
||||
caseErpCustomerFollowService.updateById(caseErpCustomerFollow);
|
||||
|
||||
CaseErpLog log = new CaseErpLog();
|
||||
log.setKeyId(dto.getCustomerId());
|
||||
log.setCategoryId(0);
|
||||
log.setExecuteResultJson("修改客户跟进");
|
||||
caseErpLogService.save(log);
|
||||
|
||||
return R.ok(true);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询客户跟进信息")
|
||||
public R info(@RequestParam Long id) {
|
||||
CaseErpCustomerFollow caseErpCustomerFollow = caseErpCustomerFollowService.getById(id);
|
||||
if (caseErpCustomerFollow == null) {
|
||||
R.error("找不到此客户跟进信息!");
|
||||
}
|
||||
return R.ok(caseErpCustomerFollow);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@XjrLog(value = "删除客户跟进信息")
|
||||
public R delete(@Valid @RequestBody Long id) {
|
||||
return R.ok(caseErpCustomerFollowService.removeById(id));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,117 @@
|
||||
package com.xjrsoft.erp.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.xjrsoft.common.core.annotation.XjrLog;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.common.redis.service.RedisUtil;
|
||||
import com.xjrsoft.erp.dto.AddCaseErpCustomerGatherDto;
|
||||
import com.xjrsoft.erp.dto.CaseErpCustomerGatherDto;
|
||||
import com.xjrsoft.erp.dto.UpdateCaseErpCustomerGatherDto;
|
||||
import com.xjrsoft.erp.entity.CaseErpCustomer;
|
||||
import com.xjrsoft.erp.entity.CaseErpCustomerGather;
|
||||
import com.xjrsoft.erp.service.ICaseErpCustomerGatherService;
|
||||
import com.xjrsoft.erp.service.ICaseErpCustomerService;
|
||||
import com.xjrsoft.organization.entity.User;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 客户回款【case_erp_customer_gather】 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-07-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.CASE_ERP_CUSTOMER +"/caseErpCustomerGather")
|
||||
@Tag(name = GlobalConstant.CASE_ERP_CUSTOMER +"/caseErpCustomerGather", description = "客户回款")
|
||||
@AllArgsConstructor
|
||||
public class CaseErpCustomerGatherController {
|
||||
private ICaseErpCustomerGatherService caseErpCustomerGatherService;
|
||||
|
||||
private ICaseErpCustomerService caseErpCustomerService;
|
||||
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "客户回款分页")
|
||||
public R page(CaseErpCustomerGatherDto dto) {
|
||||
return R.ok(caseErpCustomerGatherService.getPageList(dto));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增客户回款信息")
|
||||
public R add(@Valid @RequestBody AddCaseErpCustomerGatherDto dto) {
|
||||
CaseErpCustomerGather caseErpCustomerGather = BeanUtil.toBean(dto, CaseErpCustomerGather.class);
|
||||
CaseErpCustomer byId = caseErpCustomerService.getById(dto.getCustomerId());
|
||||
if (StrUtil.isNotBlank(byId.getName())){
|
||||
caseErpCustomerGather.setName(byId.getName());
|
||||
}
|
||||
caseErpCustomerGather.setAlreadyAmount(BigDecimal.ZERO);
|
||||
caseErpCustomerGather.setUnpaidAmount(dto.getWaitAmount());
|
||||
List<User> allUser = redisUtil.get(GlobalConstant.USER_CACHE_KEY, new TypeReference<List<User>>() {
|
||||
});
|
||||
String allUserIdStr = StrUtil.join(StringPool.COMMA, dto.getPrincipalIds());
|
||||
List<Long> ids = Arrays.stream(allUserIdStr.split(StringPool.COMMA)).map(Convert::toLong).collect(Collectors.toList());
|
||||
List<String> names = allUser.stream().filter(x -> ids.contains(x.getId())).map(User::getName).collect(Collectors.toList());
|
||||
caseErpCustomerGather.setPrincipalNames(StrUtil.join(StringPool.COMMA,names));
|
||||
caseErpCustomerGatherService.save(caseErpCustomerGather);
|
||||
return R.ok(true);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改客户回款信息")
|
||||
public R update(@Valid @RequestBody UpdateCaseErpCustomerGatherDto dto) {
|
||||
CaseErpCustomerGather caseErpCustomerGather = BeanUtil.toBean(dto, CaseErpCustomerGather.class);
|
||||
CaseErpCustomer byId = caseErpCustomerService.getById(dto.getCustomerId());
|
||||
if (StrUtil.isNotBlank(byId.getName())){
|
||||
caseErpCustomerGather.setName(byId.getName());
|
||||
}
|
||||
List<User> allUser = redisUtil.get(GlobalConstant.USER_CACHE_KEY, new TypeReference<List<User>>() {
|
||||
});
|
||||
String allUserIdStr = StrUtil.join(StringPool.COMMA, dto.getPrincipalIds());
|
||||
List<Long> ids = Arrays.stream(allUserIdStr.split(StringPool.COMMA)).map(Convert::toLong).collect(Collectors.toList());
|
||||
List<String> names = allUser.stream().filter(x -> ids.contains(x.getId())).map(User::getName).collect(Collectors.toList());
|
||||
caseErpCustomerGather.setPrincipalNames(StrUtil.join(StringPool.COMMA,names));
|
||||
return R.ok(caseErpCustomerGatherService.updateById(caseErpCustomerGather));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询客户回款信息")
|
||||
public R info(@RequestParam Long id) {
|
||||
CaseErpCustomerGather caseErpCustomerGather = caseErpCustomerGatherService.getById(id);
|
||||
if (caseErpCustomerGather == null) {
|
||||
R.error("找不到此客户回款信息!");
|
||||
}
|
||||
return R.ok(caseErpCustomerGather);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@XjrLog(value = "删除客户回款信息")
|
||||
public R delete(@Valid @RequestBody Long id) {
|
||||
return R.ok(caseErpCustomerGatherService.removeById(id));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/gather-detail-info")
|
||||
@Operation(summary = "根据客户回款id查询客户回款记录信息")
|
||||
public R gatherDetailInfo(@RequestParam Long id) {
|
||||
return R.ok(caseErpCustomerGatherService.gatherDetailInfo(id));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
package com.xjrsoft.erp.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.xjrsoft.common.core.annotation.XjrLog;
|
||||
import com.xjrsoft.common.core.constant.GlobalConstant;
|
||||
import com.xjrsoft.common.core.domain.result.R;
|
||||
import com.xjrsoft.erp.dto.AddCaseErpCustomerGatherDetailDto;
|
||||
import com.xjrsoft.erp.dto.UpdateCaseErpCustomerGatherDetailDto;
|
||||
import com.xjrsoft.erp.entity.CaseErpCustomerGatherDetail;
|
||||
import com.xjrsoft.erp.service.ICaseErpCustomerGatherDetailService;
|
||||
import com.xjrsoft.erp.vo.CaseErpCusGatherDetailInfo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 客户回款详情【case_erp_customer_gather_detail】 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author hnyyzy
|
||||
* @since 2023-07-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(GlobalConstant.CASE_ERP_CUSTOMER +"/caseErpCustomerGatherDetail")
|
||||
@Tag(name = GlobalConstant.CASE_ERP_CUSTOMER +"/caseErpCustomerGatherDetail", description = "客户回款详情")
|
||||
@AllArgsConstructor
|
||||
public class CaseErpCustomerGatherDetailController {
|
||||
|
||||
private ICaseErpCustomerGatherDetailService caseErpCustomerGatherDetailService;
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Operation(summary = "新增客户回款详情信息")
|
||||
public R add(@Valid @RequestBody AddCaseErpCustomerGatherDetailDto dto) {
|
||||
return R.ok(caseErpCustomerGatherDetailService.add(dto));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改客户回款详情信息")
|
||||
public R update(@Valid @RequestBody UpdateCaseErpCustomerGatherDetailDto dto) {
|
||||
return R.ok(caseErpCustomerGatherDetailService.edit(dto));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/info")
|
||||
@Operation(summary = "根据id查询客户回款详情信息")
|
||||
public R info(@RequestParam Long id) {
|
||||
CaseErpCustomerGatherDetail caseErpCustomerGatherDetail = caseErpCustomerGatherDetailService.getById(id);
|
||||
if (caseErpCustomerGatherDetail == null) {
|
||||
R.error("找不到此客户回款详情信息!");
|
||||
}
|
||||
return R.ok(BeanUtil.toBean(caseErpCustomerGatherDetail, CaseErpCusGatherDetailInfo.class));
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
@XjrLog(value = "删除客户回款详情信息")
|
||||
public R delete(@Valid @RequestBody Long id) {
|
||||
return R.ok(caseErpCustomerGatherDetailService.delete(id));
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user