forked from gitee/vben-java
~~
This commit is contained in:
@@ -1,29 +1,20 @@
|
||||
<div align="center"><h1 align="center">vboot-java</h1></div>
|
||||
<div align="center"><h3 align="center">一个开箱即用的快速开发平台.JAVA版</h3></div>
|
||||
|
||||
### 🍿 传送门
|
||||
* 在线体验传送门:[http://zsvg.gitee.io/vboot](http://zsvg.gitee.io/vboot)
|
||||
* QQ交流群传送门:[795417789](https://jq.qq.com/?_wv=1027&k=yoKKIlIG) 暂时就几个人哦,哈哈
|
||||
# 🍿 相关地址
|
||||
* 体验地址1:[http://zsvg.gitee.io/vue](http://zsvg.gitee.io/vue) (基于Element-Plus)
|
||||
* 体验地址2:[http://zsvg.gitee.io/vben](http://zsvg.gitee.io/vben) (基于Ant-Design-Vue)
|
||||
* 文档地址 :[http://zsvg.gitee.io/vnds](http://zsvg.gitee.io/vnds) (JAVA的暂无)
|
||||
* QQ交流群:[795417789](https://jq.qq.com/?_wv=1027&k=yoKKIlIG) (欢迎大家一起交流)
|
||||
|
||||
### 🍟 概述
|
||||
* 基于JAVA实现的快速开发平台。模块化插件式开发,前后端分离,开箱即用。
|
||||
* 后台基于SpringBoot框架,数据库访问同时集成了Jpa与MyBatis-Plus,即可自动生成数据库表结构,又可灵活编写sql。
|
||||
* 前端基于Vben-Admin vxe-table框架。
|
||||
* 核心模块包括:部门、用户、岗位、群组、角色、菜单、字典、日志、文件管理、定时任务等功能。
|
||||
* 前端基于vue-next-admin/vben框架,引入了bpmn.js工作流、VForm可视化表单。
|
||||
* 默认前端(Element-Plus)项目地址:[https://gitee.com/zsvg/vboot-vue](https://gitee.com/zsvg/vboot-vue)
|
||||
* Vben前端(Ant-Design-Vue)项目地址:[https://gitee.com/zsvg/vboot-vben](https://gitee.com/zsvg/vboot-vben)
|
||||
* .NET6实现的同功能项目地址[https://gitee.com/zsvg/vboot-net](https://gitee.com/zsvg/vboot-net) 两个项目会同步开发
|
||||
* 前端代码项目地址:[https://gitee.com/zsvg/vboot-vben](https://gitee.com/zsvg/vboot-vben)
|
||||
```
|
||||
如果对您有帮助,点击右上角⭐Star⭐关注 ,感谢支持开源!
|
||||
```
|
||||
|
||||
### 🎁 前后端一体化
|
||||
|
||||
将后台提供的Swagger接口直接生成对应前端的API文件,前端再也不需要手撸一个个的对应后后的API定义了。后台接口更新后,只需要重新生成一遍覆盖即可。
|
||||
|
||||
### 🥞 更新日志
|
||||
|
||||
更新日志 [点击查看](https://gitee.com/zsvg/vboot-java/CHANGELOG.md)
|
||||
|
||||
### 🍄 快速启动
|
||||
* 准备工作:1.配置一个名为vboot-java的mysql数据库,默认账号root,密码123456(可改) 2.开启redis 可不设置密码
|
||||
* 启动后台:打开项目,找到application启动类启动运行
|
||||
@@ -34,52 +25,38 @@
|
||||
```
|
||||
├─vboot-application ->业务应用层,在此写您具体业务代码
|
||||
├─vboot-core ->框架核心层
|
||||
├─vboot-extend-bi ->BI(报表与数据抽取),近期在开发中,以单独一个模块方式维护
|
||||
├─vboot-extend-wf ->WF(工作流),近期在开发中,以单独一个模块方式维护
|
||||
注:源码直接开发建议自己的业务代码直接写在【vboot-application】层里面,可随框架升级减少冲突。
|
||||
├─vboot-extend-bi ->BI(报表与数据抽取),以单独一个模块方式维护
|
||||
注:建议将自己的业务代码写在【vboot-application】层里面,可随框架升级减少冲突。
|
||||
```
|
||||
|
||||
### 📖 帮助文档
|
||||
|
||||
👉后台文档:
|
||||
* SpringBoot后台框架文档 [https://spring.io/projects/spring-boot](https://spring.io/projects/spring-boot)
|
||||
|
||||
👉前端文档:
|
||||
* VbenAdmin前端业务文档 [https://vvbin.cn/next/](https://vvbin.cn/next/)
|
||||
|
||||
|
||||
### 🍖 详细功能
|
||||
|
||||
1. 主控面板、控制台页面,可进行工作台,分析页,统计等功能的展示。
|
||||
2. 部门管理、部门维护,支持多层级结构的树形结构。
|
||||
3. 用户管理、用户维护,可设置用户部门,岗位,群组,职务,角色,数据权限等。
|
||||
4. 岗位管理、岗位维护,岗位可作为用户的一个标签,岗位也可与权限等其他功能挂钩。
|
||||
5. 群组管理、群组维护,群组可设置部门,用户,岗位,用于更广泛的权限设置。
|
||||
6. 菜单管理、菜单目录,菜单,和按钮的维护是权限控制的基本单位。
|
||||
7. 角色管理、角色绑定菜单后,可限制相关角色的人员登录系统的功能范围。
|
||||
8. 字典管理、系统内各种枚举类型的维护。
|
||||
9. 访问日志、用户的登录和退出日志的查看和管理。
|
||||
10. 操作日志、用户的操作业务的日志的查看和管理。
|
||||
11. 定时任务、定时任务的维护,通过cron表达式控制任务的执行频率。
|
||||
1. 主控面板:控制台页面,可进行工作台,分析页,统计等功能的展示。
|
||||
2. 部门管理:部门维护,支持多层级结构的树形结构。
|
||||
3. 用户管理:用户维护,可设置用户部门,岗位,群组,职务,角色,数据权限等。
|
||||
4. 岗位管理:岗位维护,岗位可作为用户的一个标签,岗位也可与权限等其他功能挂钩。
|
||||
5. 群组管理:群组维护,群组可设置部门,用户,岗位,用于更广泛的权限设置。
|
||||
6. 菜单管理:菜单目录,菜单,和按钮的维护是权限控制的基本单位。
|
||||
7. 角色管理:角色绑定菜单后,可限制相关角色的人员登录系统的功能范围。
|
||||
8. 字典管理:系统内各种枚举类型的维护。
|
||||
9. 访问日志:用户的登录和退出日志的查看和管理。
|
||||
10. 操作日志:用户的操作业务的日志的查看和管理。
|
||||
11. 定时任务:定时任务的维护,通过cron表达式控制任务的执行频率。
|
||||
12. 流程引擎:流程图展示,自解析bpmn.js,支持驳回、转办、废弃,跳转等功能
|
||||
13. 消息机制:待办待阅功能,联通钉钉与企业微信接口
|
||||
|
||||
### ⚡ 近期计划
|
||||
|
||||
- [ ] 文档编写
|
||||
- [ ] 在线用户
|
||||
- [ ] 文件存储 minio
|
||||
- [ ] 集成工作流
|
||||
|
||||
|
||||
### 🍻 贡献代码
|
||||
|
||||
`vboot-java` 遵循 `MIT` 开源协议,欢迎大家提交 `PR` 或 `Issue`。
|
||||
|
||||
- [ ] 完善文档
|
||||
- [ ] 完善工作流
|
||||
- [ ] 代码生成器
|
||||
|
||||
### 💐 特别鸣谢
|
||||
- 👉 eladmin:[https://gitee.com/elunez/eladmin](https://gitee.com/elunez/eladmin)
|
||||
- 👉 ruoyi:[https://gitee.com/y_project/RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue)
|
||||
- 👉 vben-admin:[https://vvbin.cn/doc-next/](https://vvbin.cn/doc-next/)
|
||||
- 👉 Vben-Admin:[https://vvbin.cn/doc-next](https://vvbin.cn/doc-next)
|
||||
- 👉 vue-next-admin:[https://gitee.com/lyt-top/vue-next-admin](https://gitee.com/lyt-top/vue-next-admin)
|
||||
- 👉 vxe-table:[https://gitee.com/xuliangzhan_admin/vxe-table](https://gitee.com/xuliangzhan_admin/vxe-table)
|
||||
- 👉 VForm:[https://www.vform666.com](https://www.vform666.com/)
|
||||
|
||||
```
|
||||
如果对您有帮助,您可以点右上角 💘Star💘支持一下,这样我们才有持续下去的动力,谢谢!!!
|
||||
如果对您有帮助,点击右上角⭐Star⭐关注 ,感谢支持开源!
|
||||
```
|
||||
@@ -7,13 +7,11 @@
|
||||
<groupId>com.zsvg</groupId>
|
||||
<artifactId>vboot</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>0.2</version>
|
||||
<version>0.1</version>
|
||||
<modules>
|
||||
<module>vboot-core</module>
|
||||
<module>vboot-application</module>
|
||||
<module>vboot-extend-bi</module>
|
||||
<module>vboot-extend-wf</module>
|
||||
<module>vboot-extend-ps</module>
|
||||
</modules>
|
||||
|
||||
<!--定义属性值-->
|
||||
@@ -21,7 +19,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<vboot.version>0.2</vboot.version>
|
||||
<vboot.version>0.1</vboot.version>
|
||||
<spring.boot.version>2.2.13.RELEASE</spring.boot.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>vboot</artifactId>
|
||||
<groupId>com.zsvg</groupId>
|
||||
<version>0.2</version>
|
||||
<version>0.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -18,32 +18,6 @@
|
||||
<version>${vboot.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--集成流程管理-->
|
||||
<dependency>
|
||||
<groupId>com.zsvg</groupId>
|
||||
<artifactId>vboot-extend-wf</artifactId>
|
||||
<version>${vboot.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.zsvg</groupId>
|
||||
<artifactId>vboot-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!--集成项目管理-->
|
||||
<dependency>
|
||||
<groupId>com.zsvg</groupId>
|
||||
<artifactId>vboot-extend-ps</artifactId>
|
||||
<version>${vboot.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.zsvg</groupId>
|
||||
<artifactId>vboot-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
@@ -51,6 +25,12 @@
|
||||
<!--<version>8.0.26</version>-->
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>1.14.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.abc;
|
||||
|
||||
import com.zsvg.vboot.common.util.lang.XstringUtil;
|
||||
import com.zsvg.vboot.common.util.web.XspringUtil;
|
||||
import vboot.common.util.lang.XstringUtil;
|
||||
import vboot.common.util.web.XspringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.domain.EntityScan;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
@@ -18,8 +17,8 @@ import java.net.UnknownHostException;
|
||||
|
||||
@EnableCaching
|
||||
@SpringBootApplication
|
||||
@ComponentScan({"com.zsvg","com.abc"})
|
||||
@EnableJpaRepositories({"com.zsvg","com.abc"})
|
||||
@ComponentScan({"vboot","com.abc"})
|
||||
@EnableJpaRepositories({"vboot","com.abc"})
|
||||
@Slf4j
|
||||
@EnableAsync
|
||||
//@EnableSwagger2
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
package com.abc;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.context.SecurityContextImpl;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@Component
|
||||
public class SecurityUtil {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(SecurityUtil.class);
|
||||
|
||||
@Autowired
|
||||
private UserDetailsService userDetailsService;
|
||||
|
||||
public void logInAs(String username) {
|
||||
|
||||
UserDetails user = userDetailsService.loadUserByUsername(username);
|
||||
if (user == null) {
|
||||
throw new IllegalStateException("User " + username + " doesn't exist, please provide a valid user");
|
||||
}
|
||||
logger.info("> Logged in as: " + username);
|
||||
SecurityContextHolder.setContext(new SecurityContextImpl(new Authentication() {
|
||||
@Override
|
||||
public Collection<? extends GrantedAuthority> getAuthorities() {
|
||||
return user.getAuthorities();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCredentials() {
|
||||
return user.getPassword();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getDetails() {
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getPrincipal() {
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAuthenticated() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return user.getUsername();
|
||||
}
|
||||
}));
|
||||
org.activiti.engine.impl.identity.Authentication.setAuthenticatedUserId(username);
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
package com.zsvg.vboot.wf.tem.cate;
|
||||
package com.abc.module.oa.doc.cate;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.entity.BaseCateEntity;
|
||||
import vboot.common.mvc.entity.BaseCateEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -11,14 +11,14 @@ import java.util.List;
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class WfTemCate extends BaseCateEntity {
|
||||
public class OaDocCate extends BaseCateEntity {
|
||||
|
||||
@ManyToOne(fetch= FetchType.EAGER)
|
||||
@JoinColumn(name = "pid")
|
||||
private WfTemCate parent;//父类别
|
||||
private OaDocCate parent;//父类别
|
||||
|
||||
@Transient
|
||||
private List<WfTemCate> children = new ArrayList<>(); //行项目
|
||||
private List<OaDocCate> children = new ArrayList<>(); //行项目
|
||||
|
||||
private String notes;//备注
|
||||
}
|
||||
+11
-11
@@ -1,18 +1,18 @@
|
||||
package com.zsvg.vboot.wf.tem.cate;
|
||||
package com.abc.module.oa.doc.cate;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.api.RestResult;
|
||||
import com.zsvg.vboot.common.mvc.dao.Sqler;
|
||||
import com.zsvg.vboot.common.mvc.pojo.Ztree;
|
||||
import vboot.common.mvc.api.RestResult;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import vboot.common.mvc.pojo.Ztree;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("wf/tem/cate")
|
||||
public class WfTemCateApi {
|
||||
@RequestMapping("oa/doc/cate")
|
||||
public class OaDocCateApi {
|
||||
|
||||
private String table = "wf_tem_cate";
|
||||
private String table = "oa_doc_cate";
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
@@ -25,7 +25,7 @@ public class WfTemCateApi {
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
WfTemCate cate = service.findOne(id);
|
||||
OaDocCate cate = service.findOne(id);
|
||||
return RestResult.ok(cate);
|
||||
}
|
||||
|
||||
@@ -36,12 +36,12 @@ public class WfTemCateApi {
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody WfTemCate main) {
|
||||
public RestResult post(@RequestBody OaDocCate main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody WfTemCate main) {
|
||||
public RestResult put(@RequestBody OaDocCate main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@@ -51,6 +51,6 @@ public class WfTemCateApi {
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private WfTemCateService service;
|
||||
private OaDocCateService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.abc.module.oa.doc.cate;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface OaDocCateRepo extends JpaRepository<OaDocCate,String> {
|
||||
|
||||
|
||||
}
|
||||
+13
-13
@@ -1,7 +1,7 @@
|
||||
package com.zsvg.vboot.wf.tem.cate;
|
||||
package com.abc.module.oa.doc.cate;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.dao.Sqler;
|
||||
import com.zsvg.vboot.common.mvc.service.BaseCateService;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import vboot.common.mvc.service.BaseCateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -11,23 +11,23 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class WfTemCateService extends BaseCateService<WfTemCate> {
|
||||
public class OaDocCateService extends BaseCateService<OaDocCate> {
|
||||
|
||||
|
||||
public List<WfTemCate> findTree(Sqler sqler) {
|
||||
List<WfTemCate> list = jdbcDao.getTp().query(sqler.getSql(), sqler.getParams(), new BeanPropertyRowMapper<>(WfTemCate.class));
|
||||
public List<OaDocCate> findTree(Sqler sqler) {
|
||||
List<OaDocCate> list = jdbcDao.getTp().query(sqler.getSql(), sqler.getParams(), new BeanPropertyRowMapper<>(OaDocCate.class));
|
||||
return buildByRecursive(list);
|
||||
}
|
||||
|
||||
//使用递归方法建树
|
||||
private List<WfTemCate> buildByRecursive(List<WfTemCate> nodes) {
|
||||
List<WfTemCate> list = new ArrayList<>();
|
||||
for (WfTemCate node : nodes) {
|
||||
private List<OaDocCate> buildByRecursive(List<OaDocCate> nodes) {
|
||||
List<OaDocCate> list = new ArrayList<>();
|
||||
for (OaDocCate node : nodes) {
|
||||
if (node.getPid() == null) {
|
||||
list.add(findChildrenByTier(node, nodes));
|
||||
} else {
|
||||
boolean flag = false;
|
||||
for (WfTemCate node2 : nodes) {
|
||||
for (OaDocCate node2 : nodes) {
|
||||
if (node.getPid().equals(node2.getId())) {
|
||||
flag = true;
|
||||
break;
|
||||
@@ -43,8 +43,8 @@ public class WfTemCateService extends BaseCateService<WfTemCate> {
|
||||
|
||||
|
||||
//递归查找子节点
|
||||
private WfTemCate findChildrenByTier(WfTemCate node, List<WfTemCate> nodes) {
|
||||
for (WfTemCate item : nodes) {
|
||||
private OaDocCate findChildrenByTier(OaDocCate node, List<OaDocCate> nodes) {
|
||||
for (OaDocCate item : nodes) {
|
||||
if (node.getId().equals(item.getPid())) {
|
||||
if (node.getChildren() == null) {
|
||||
node.setChildren(new ArrayList<>());
|
||||
@@ -57,7 +57,7 @@ public class WfTemCateService extends BaseCateService<WfTemCate> {
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private WfTemCateRepo repo;
|
||||
private OaDocCateRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.abc.module.oa.doc.main;
|
||||
|
||||
import vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class OaDocMain extends BaseMainEntity {
|
||||
|
||||
private String notes;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.abc.module.oa.doc.main;
|
||||
|
||||
import vboot.common.mvc.api.RestResult;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("oa/doc/main")
|
||||
public class OaDocMainApi {
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
Sqler sqler = new Sqler("oa_doc_main");
|
||||
sqler.addLike("t.name", name);
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
OaDocMain main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody OaDocMain main) throws DocumentException {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody OaDocMain main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private OaDocMainService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.abc.module.oa.doc.main;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface OaDocMainRepo extends JpaRepository<OaDocMain,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.abc.module.oa.doc.main;
|
||||
|
||||
import vboot.common.mvc.service.BaseMainService;
|
||||
import vboot.module.bpm.proc.main.BpmProcMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Service
|
||||
public class OaDocMainService extends BaseMainService<OaDocMain> {
|
||||
|
||||
public OaDocMain insert(OaDocMain OaDocMain) {
|
||||
OaDocMain dbMain = super.insert(OaDocMain);
|
||||
// BpmProcMain wfFlowMain = new BpmProcMain(dbMain);
|
||||
// flowService.start(wfFlowMain);
|
||||
return dbMain;
|
||||
}
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private BpmProcMainService flowService;
|
||||
|
||||
@Autowired
|
||||
private OaDocMainRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.abc.module.sa.agent.main;
|
||||
|
||||
import com.abc.module.te.feat.param.TeFeatParamOption;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import vboot.common.mvc.entity.BaseMainEntity;
|
||||
import vboot.module.sys.org.root.SysOrg;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class SaAgentMain extends BaseMainEntity {
|
||||
|
||||
private String addre;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String notes;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "opman")
|
||||
private SysOrg opman;//创建人
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(name = "sa_agent_main_viewer", joinColumns = {@JoinColumn(name = "mid")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "oid")})
|
||||
private List<SysOrg> viewers;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.abc.module.sa.agent.main;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import vboot.common.mvc.api.RestResult;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("sa/agent/main")
|
||||
public class SaAgentMainApi {
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name,String catid) {
|
||||
Sqler sqler = new Sqler("sa_agent_main");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.addre");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
SaAgentMain main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody SaAgentMain main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody SaAgentMain main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SaAgentMainService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.abc.module.sa.agent.main;
|
||||
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface SaAgentMainRepo extends JpaRepository<SaAgentMain,String> {
|
||||
|
||||
|
||||
}
|
||||
+6
-5
@@ -1,21 +1,22 @@
|
||||
package com.zsvg.vboot.ps.proj.stage;
|
||||
package com.abc.module.sa.agent.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import vboot.common.mvc.service.BaseMainService;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Service
|
||||
public class PsProjStageService extends BaseMainService<PsProjStage> {
|
||||
public class SaAgentMainService extends BaseMainService<SaAgentMain> {
|
||||
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private PsProjStageRepo repo;
|
||||
private SaAgentMainRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.abc.module.sa.draw.main;
|
||||
|
||||
import vboot.common.mvc.entity.BaseMainEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class SaDrawMain extends BaseMainEntity {
|
||||
|
||||
@Column(length = 32)
|
||||
private String catid;//所属分类
|
||||
|
||||
private Integer ornum;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String notes;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.abc.module.sa.draw.main;
|
||||
|
||||
import vboot.common.mvc.api.RestResult;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("sa/draw/main")
|
||||
public class SaDrawMainApi {
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name,String catid) {
|
||||
Sqler sqler = new Sqler("sa_draw_main");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addEqual("t.catid", catid);
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
SaDrawMain main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody SaDrawMain main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody SaDrawMain main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SaDrawMainService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.abc.module.sa.draw.main;
|
||||
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface SaDrawMainRepo extends JpaRepository<SaDrawMain,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.abc.module.sa.draw.main;
|
||||
|
||||
import vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Service
|
||||
public class SaDrawMainService extends BaseMainService<SaDrawMain> {
|
||||
|
||||
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private SaDrawMainRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.abc.module.sa.prod.feat;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class SaProdFeat {
|
||||
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
@GeneratedValue(generator = "jpa-uuid")
|
||||
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
|
||||
private String id;//ID
|
||||
|
||||
@Column(length = 100)
|
||||
private String name;//选项名称
|
||||
|
||||
private Integer ornum;//排序号
|
||||
|
||||
private String notes;//备注
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.abc.module.sa.prod.group;
|
||||
|
||||
import com.abc.module.sa.prod.main.SaProdMain;
|
||||
import vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class SaProdGroup extends BaseMainEntity {
|
||||
|
||||
|
||||
|
||||
|
||||
//备注
|
||||
private String notes;
|
||||
|
||||
@Column(length = 32)
|
||||
private String projid;//项目
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@JoinColumn(name = "groid")
|
||||
@OrderBy("ornum ASC")
|
||||
private List<SaProdMain> prods = new ArrayList<>();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+18
-10
@@ -1,18 +1,18 @@
|
||||
package com.abc.module.sd.proj.main;
|
||||
package com.abc.module.sa.prod.group;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.api.RestResult;
|
||||
import com.zsvg.vboot.common.mvc.dao.Sqler;
|
||||
import vboot.common.mvc.api.RestResult;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("sd/proj/main")
|
||||
public class SdProjMainApi {
|
||||
@RequestMapping("sa/prod/group")
|
||||
public class SaProdGroupApi {
|
||||
|
||||
//分页查询项目清单
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
Sqler sqler = new Sqler("sd_proj_main");
|
||||
Sqler sqler = new Sqler("sa_prod_group");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.addre,t.notes");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
@@ -21,19 +21,27 @@ public class SdProjMainApi {
|
||||
//查询单个项目
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
SdProjMain main = service.findOne(id);
|
||||
SaProdGroup main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
// //查询单个项目
|
||||
// @GetMapping("proj/{id}")
|
||||
// public RestResult getOneByProj(@PathVariable String id) {
|
||||
// List<SaProdGroup> groups = service.findAllByProjid(id);
|
||||
// return RestResult.ok(groups);
|
||||
// }
|
||||
|
||||
|
||||
//新增项目
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody SdProjMain main) {
|
||||
public RestResult post(@RequestBody SaProdGroup main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
//修改项目
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody SdProjMain main) {
|
||||
public RestResult put(@RequestBody SaProdGroup main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@@ -44,6 +52,6 @@ public class SdProjMainApi {
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SdProjMainService service;
|
||||
private SaProdGroupService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.abc.module.sa.prod.group;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SaProdGroupRepo extends JpaRepository<SaProdGroup,String> {
|
||||
|
||||
List<SaProdGroup> findAllByProjid(String projid);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.abc.module.sa.prod.group;
|
||||
|
||||
import vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
public class SaProdGroupService extends BaseMainService<SaProdGroup> {
|
||||
|
||||
public List<SaProdGroup> findAllByProjid(String projid){
|
||||
return repo.findAllByProjid(projid);
|
||||
}
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private SaProdGroupRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.abc.module.sa.prod.main;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class SaProdMain {
|
||||
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
@GeneratedValue(generator = "jpa-uuid")
|
||||
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
|
||||
private String id;//ID
|
||||
|
||||
@Column(length = 100)
|
||||
private String name;//选项名称
|
||||
|
||||
private Integer ornum;//排序号
|
||||
|
||||
private String notes;//备注
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.abc.module.sa.prod.tem;
|
||||
|
||||
import vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class SaProdTem extends BaseMainEntity {
|
||||
|
||||
private Integer ornum;
|
||||
|
||||
private String notes;
|
||||
|
||||
@Column(length = 32)
|
||||
private String modid;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.abc.module.sa.prod.tem;
|
||||
|
||||
import vboot.common.mvc.api.RestResult;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("sa/prod/tem")
|
||||
public class SaProdTemApi {
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
Sqler sqler = new Sqler("sa_prod_tem");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addLeftJoin("m.name as modna", "te_prod_model m", "m.id=t.modid");
|
||||
sqler.addOrder("t.ornum");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
SaProdTem main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody SaProdTem main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody SaProdTem main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SaProdTemService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.abc.module.sa.prod.tem;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
|
||||
public interface SaProdTemRepo extends JpaRepository<SaProdTem,String> {
|
||||
|
||||
|
||||
}
|
||||
+4
-13
@@ -1,31 +1,22 @@
|
||||
package com.zsvg.vboot.wf.ins.main;
|
||||
package com.abc.module.sa.prod.tem;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.service.BaseMainService;
|
||||
import vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
|
||||
@Service
|
||||
public class WfInsMainService extends BaseMainService<WfInsMain> {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class SaProdTemService extends BaseMainService<SaProdTem> {
|
||||
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private WfInsMainRepo repo;
|
||||
private SaProdTemRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.abc.module.sa.proj.main;
|
||||
|
||||
import com.abc.module.sa.prod.group.SaProdGroup;
|
||||
import vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Transient;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class SaProjMain extends BaseMainEntity {
|
||||
|
||||
//备注
|
||||
private String notes;
|
||||
|
||||
//项目地址
|
||||
private String addre;
|
||||
|
||||
@Transient
|
||||
private List<SaProdGroup> groups = new ArrayList<>(); //产品组
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.abc.module.sa.proj.main;
|
||||
|
||||
import com.abc.module.sa.prod.group.SaProdGroup;
|
||||
import com.abc.module.sa.prod.group.SaProdGroupService;
|
||||
import vboot.common.mvc.api.RestResult;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import vboot.common.mvc.pojo.Zinp;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("sa/proj/main")
|
||||
public class SaProjMainApi {
|
||||
|
||||
@GetMapping("tree")
|
||||
public RestResult getTree(String name) {
|
||||
List<Zinp> list = new ArrayList<>();
|
||||
Zinp zinp = new Zinp();
|
||||
zinp.setId("11");
|
||||
zinp.setName("测试1");
|
||||
|
||||
Zinp zinp2 = new Zinp();
|
||||
zinp2.setId("22");
|
||||
zinp2.setName("测试2");
|
||||
list.add(zinp);
|
||||
list.add(zinp2);
|
||||
return RestResult.ok(list);
|
||||
}
|
||||
|
||||
|
||||
//分页查询项目清单
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
Sqler sqler = new Sqler("sa_proj_main");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.addre,t.notes");
|
||||
System.out.println(new Date());
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
//查询单个项目
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
SaProjMain main = service.findOne(id);
|
||||
List<SaProdGroup> groups = groupService.findAllByProjid(id);
|
||||
main.setGroups(groups);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
//新增项目
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody SaProjMain main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
//修改项目
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody SaProjMain main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
//删除项目
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SaProjMainService service;
|
||||
|
||||
@Autowired
|
||||
private SaProdGroupService groupService;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.abc.module.sa.proj.main;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface SaProjMainRepo extends JpaRepository<SaProjMain,String> {
|
||||
|
||||
|
||||
}
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
package com.abc.module.sd.proj.main;
|
||||
package com.abc.module.sa.proj.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.service.BaseMainService;
|
||||
import vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -8,12 +8,12 @@ import javax.annotation.PostConstruct;
|
||||
|
||||
|
||||
@Service
|
||||
public class SdProjMainService extends BaseMainService<SdProjMain> {
|
||||
public class SaProjMainService extends BaseMainService<SaProjMain> {
|
||||
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private SdProjMainRepo repo;
|
||||
private SaProjMainRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.abc.module.sd.cust.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class SdCustMain extends BaseMainEntity {
|
||||
|
||||
//备注
|
||||
private String notes;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.abc.module.sd.cust.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.api.RestResult;
|
||||
import com.zsvg.vboot.common.mvc.dao.JdbcDao;
|
||||
import com.zsvg.vboot.common.mvc.dao.Sqler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("sd/cust/main")
|
||||
public class SdCustMainApi {
|
||||
|
||||
//分页查询项目清单
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
Sqler sqler = new Sqler("sd_cust_main");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.notes");
|
||||
return RestResult.ok(jdbcDao.findPageData(sqler));
|
||||
}
|
||||
|
||||
//查询单个项目
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
SdCustMain main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
//新增项目
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody SdCustMain main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
//修改项目
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody SdCustMain main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
//删除项目
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
|
||||
//同时使用JPA与mybatis-plus的事务测试
|
||||
@PostMapping("test")
|
||||
public RestResult postTest() {
|
||||
service.test();
|
||||
return RestResult.ok();
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SdCustMainService service;
|
||||
|
||||
@Autowired
|
||||
private JdbcDao jdbcDao;
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.abc.module.sd.cust.main;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SdCustMainMapper extends BaseMapper<SdCustMain>
|
||||
{
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.abc.module.sd.cust.main;
|
||||
|
||||
import com.abc.module.sd.proj.main.SdProjMain;
|
||||
import com.abc.module.sd.proj.main.SdProjMainRepo;
|
||||
import com.zsvg.vboot.common.util.lang.XstringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class SdCustMainService {
|
||||
|
||||
public SdCustMain findOne(String id) {
|
||||
|
||||
return custMapper.selectById(id);
|
||||
}
|
||||
|
||||
public String insert(SdCustMain cust) {
|
||||
cust.setId(XstringUtil.getUUID());
|
||||
custMapper.insert(cust);
|
||||
return cust.getId();
|
||||
}
|
||||
|
||||
public String update(SdCustMain cust) {
|
||||
custMapper.updateById(cust);
|
||||
return cust.getId();
|
||||
}
|
||||
|
||||
public int delete(String[] ids) {
|
||||
for (String id : ids) {
|
||||
custMapper.deleteById(id);
|
||||
}
|
||||
return ids.length;
|
||||
}
|
||||
|
||||
public void test() {
|
||||
//先通过JPA新增一个项目
|
||||
SdProjMain projMain=new SdProjMain();
|
||||
projMain.setId(XstringUtil.getUUID());
|
||||
projMain.setName("有事务的项目");
|
||||
projRepo.save(projMain);
|
||||
|
||||
//再通过mybatis-plus新增一个项目,并让它报错
|
||||
SdCustMain sdCustMain=new SdCustMain();
|
||||
sdCustMain.setId(XstringUtil.getUUID()+"XXXXXXXXXXXXXXXX");//超出长度保存出错
|
||||
sdCustMain.setNotes("有事务的客户");
|
||||
custMapper.insert(sdCustMain);
|
||||
}
|
||||
|
||||
@Resource
|
||||
private SdProjMainRepo projRepo;
|
||||
|
||||
@Resource
|
||||
private SdCustMainMapper custMapper;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.abc.module.sd.proj.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class SdProjMain extends BaseMainEntity {
|
||||
|
||||
//备注
|
||||
private String notes;
|
||||
|
||||
//项目地址
|
||||
private String addre;
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.abc.module.sd.proj.main;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface SdProjMainRepo extends JpaRepository<SdProjMain,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.abc.module.te.allot.check;
|
||||
|
||||
import vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class TeAllotCheck extends BaseMainEntity {
|
||||
|
||||
private Integer ornum;
|
||||
|
||||
private Integer venum;//版本号
|
||||
|
||||
private String notes;
|
||||
|
||||
@Column(length = 32)
|
||||
private String catid;//分类id
|
||||
|
||||
@Column(length = 32)
|
||||
private String serid;//系列id
|
||||
|
||||
@Column(length = 32)
|
||||
private String modid;//型号id
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@JoinColumn(name = "allid")
|
||||
private List<TeAllotCheckItem> items = new ArrayList<>();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.abc.module.te.allot.check;
|
||||
|
||||
import vboot.common.mvc.api.RestResult;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("te/allot/check")
|
||||
public class TeAllotCheckApi {
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name,String modid) {
|
||||
Sqler sqler = new Sqler("te_allot_check");
|
||||
sqler.addLike("t.name", name);
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
TeAllotCheck main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("checks")
|
||||
public RestResult checks(String id) {
|
||||
return RestResult.ok(service.findData(id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody TeAllotCheck main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody TeAllotCheck main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private TeAllotCheckService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.abc.module.te.allot.check;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class TeAllotCheckItem {
|
||||
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
@GeneratedValue(generator = "jpa-uuid")
|
||||
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
|
||||
private String id;//ID
|
||||
|
||||
@Column(length = 32)
|
||||
private String cheid;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.abc.module.te.allot.check;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface TeAllotCheckRepo extends JpaRepository<TeAllotCheck,String> {
|
||||
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.abc.module.te.allot.check;
|
||||
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class TeAllotCheckService extends BaseMainService<TeAllotCheck> {
|
||||
|
||||
public List<Zcheck> findData(String catid) {
|
||||
Sqler sqler = new Sqler("te_feat_check");
|
||||
sqler.addEqual("t.catid", catid);
|
||||
sqler.addOrder("t.ornum");
|
||||
List<Zcheck> list = jdbcDao.getTp().query(sqler.getSql(), sqler.getParams(), new BeanPropertyRowMapper<>(Zcheck.class));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private TeAllotCheckRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.abc.module.te.allot.check;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Zcheck {
|
||||
|
||||
private String id;
|
||||
|
||||
private String code;
|
||||
|
||||
private String name;
|
||||
|
||||
private Integer ornum;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.abc.module.te.allot.drive;
|
||||
|
||||
import vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class TeAllotDrive extends BaseMainEntity {
|
||||
|
||||
private Integer ornum;
|
||||
|
||||
private Integer venum;//版本号
|
||||
|
||||
private String notes;
|
||||
|
||||
@Column(length = 32)
|
||||
private String catid;
|
||||
|
||||
@Column(length = 32)
|
||||
private String serid;//系列id
|
||||
|
||||
@Column(length = 32)
|
||||
private String modid;//型号id
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@JoinColumn(name = "allid")
|
||||
private List<TeAllotDriveItem> items = new ArrayList<>();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.abc.module.te.allot.drive;
|
||||
|
||||
import vboot.common.mvc.api.RestResult;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("te/allot/drive")
|
||||
public class TeAllotDriveApi {
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name,String modid) {
|
||||
Sqler sqler = new Sqler("te_allot_drive");
|
||||
sqler.addLike("t.name", name);
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
TeAllotDrive main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("drives")
|
||||
public RestResult drives(String id) {
|
||||
return RestResult.ok(service.findData(id));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody TeAllotDrive main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody TeAllotDrive main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private TeAllotDriveService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.abc.module.te.allot.drive;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class TeAllotDriveItem {
|
||||
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
@GeneratedValue(generator = "jpa-uuid")
|
||||
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
|
||||
private String id;//ID
|
||||
|
||||
@Column(length = 32)
|
||||
private String driid;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.abc.module.te.allot.drive;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface TeAllotDriveRepo extends JpaRepository<TeAllotDrive,String> {
|
||||
|
||||
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.abc.module.te.allot.drive;
|
||||
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class TeAllotDriveService extends BaseMainService<TeAllotDrive> {
|
||||
|
||||
public List<Zdrive> findData(String catid) {
|
||||
Sqler sqler = new Sqler("te_feat_drive");
|
||||
sqler.addEqual("t.catid", catid);
|
||||
sqler.addOrder("t.ornum");
|
||||
List<Zdrive> list = jdbcDao.getTp().query(sqler.getSql(), sqler.getParams(), new BeanPropertyRowMapper<>(Zdrive.class));
|
||||
return list;
|
||||
}
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private TeAllotDriveRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.abc.module.te.allot.drive;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Zdrive {
|
||||
|
||||
private String id;
|
||||
|
||||
private String code;
|
||||
|
||||
private String name;
|
||||
|
||||
private Integer ornum;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.abc.module.te.allot.link;
|
||||
|
||||
import vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class TeAllotLink extends BaseMainEntity {
|
||||
|
||||
private Integer ornum;
|
||||
|
||||
private Integer venum;//版本号
|
||||
|
||||
private String notes;
|
||||
|
||||
@Column(length = 32)
|
||||
private String catid;
|
||||
|
||||
@Column(length = 32)
|
||||
private String serid;//系列id
|
||||
|
||||
@Column(length = 32)
|
||||
private String modid;//型号id
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@JoinColumn(name = "allid")
|
||||
private List<TeAllotLinkItem> items = new ArrayList<>();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.abc.module.te.allot.link;
|
||||
|
||||
import vboot.common.mvc.api.RestResult;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("te/allot/link")
|
||||
public class TeAllotLinkApi {
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name,String modid) {
|
||||
Sqler sqler = new Sqler("te_allot_link");
|
||||
sqler.addLike("t.name", name);
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
TeAllotLink main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@GetMapping("links")
|
||||
public RestResult links(String id) {
|
||||
return RestResult.ok(service.findData(id));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody TeAllotLink main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody TeAllotLink main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private TeAllotLinkService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.abc.module.te.allot.link;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class TeAllotLinkItem {
|
||||
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
@GeneratedValue(generator = "jpa-uuid")
|
||||
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
|
||||
private String id;//ID
|
||||
|
||||
@Column(length = 32)
|
||||
private String linid;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.abc.module.te.allot.link;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface TeAllotLinkRepo extends JpaRepository<TeAllotLink,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.abc.module.te.allot.link;
|
||||
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class TeAllotLinkService extends BaseMainService<TeAllotLink> {
|
||||
|
||||
public List<Zlink> findData(String catid) {
|
||||
Sqler sqler = new Sqler("te_feat_link");
|
||||
sqler.addEqual("t.catid", catid);
|
||||
sqler.addOrder("t.ornum");
|
||||
List<Zlink> list = jdbcDao.getTp().query(sqler.getSql(), sqler.getParams(), new BeanPropertyRowMapper<>(Zlink.class));
|
||||
return list;
|
||||
}
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private TeAllotLinkRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.abc.module.te.allot.link;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Zlink {
|
||||
|
||||
private String id;
|
||||
|
||||
private String code;
|
||||
|
||||
private String name;
|
||||
|
||||
private Integer ornum;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.abc.module.te.allot.param;
|
||||
|
||||
import vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class TeAllotParam extends BaseMainEntity {
|
||||
|
||||
private Boolean ornum;
|
||||
|
||||
private Boolean sptag;//专用标记
|
||||
|
||||
private Integer venum;//版本号
|
||||
|
||||
private String notes;
|
||||
|
||||
@Column(length = 32)
|
||||
private String catid;
|
||||
|
||||
@Column(length = 32)
|
||||
private String serid;//系列id
|
||||
|
||||
@Column(length = 32)
|
||||
private String modid;//型号id
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@JoinColumn(name = "allid")
|
||||
private List<TeAllotParamItem> items = new ArrayList<>();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.abc.module.te.allot.param;
|
||||
|
||||
import vboot.common.mvc.api.RestResult;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("te/allot/param")
|
||||
public class TeAllotParamApi {
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name,String modid) {
|
||||
Sqler sqler = new Sqler("te_allot_param");
|
||||
sqler.addLike("t.name", name);
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
TeAllotParam main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@GetMapping("screens")
|
||||
public RestResult screens(String id) {
|
||||
return RestResult.ok(service.findData(id));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody TeAllotParam main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody TeAllotParam main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private TeAllotParamService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.abc.module.te.allot.param;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class TeAllotParamItem {
|
||||
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
@GeneratedValue(generator = "jpa-uuid")
|
||||
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
|
||||
private String id;//ID
|
||||
|
||||
@Column(length = 32)
|
||||
private String parid;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.abc.module.te.allot.param;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface TeAllotParamRepo extends JpaRepository<TeAllotParam,String> {
|
||||
|
||||
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package com.abc.module.te.allot.param;
|
||||
|
||||
import com.abc.module.te.prod.model.Zscreen;
|
||||
import com.abc.module.te.prod.model.Zparam;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class TeAllotParamService extends BaseMainService<TeAllotParam> {
|
||||
|
||||
public List<Zscreen> findData(String catid){
|
||||
Sqler sqler2=new Sqler("te_feat_screen");
|
||||
sqler2.addEqual("t.catid", catid);
|
||||
sqler2.addOrder("t.ornum");
|
||||
List<Zscreen> zscreens=jdbcDao.getTp().query(sqler2.getSql(),sqler2.getParams(), new BeanPropertyRowMapper<>(Zscreen.class));
|
||||
|
||||
List<Zparam> zparams = new ArrayList<>();
|
||||
String sql3 = "select id,name,code,scrid,ornum from te_feat_param where scrid in (";
|
||||
String ins = "";
|
||||
for (Zscreen zscreen : zscreens) {
|
||||
ins += "'" + zscreen.getId() + "',";
|
||||
}
|
||||
if (!"".equals(ins)) {
|
||||
ins = ins.substring(0, ins.length() - 1);
|
||||
sql3 += ins + ") order by scrid,ornum";
|
||||
zparams=jdbcDao.getTp().query(sql3, new BeanPropertyRowMapper<>(Zparam.class));
|
||||
}
|
||||
|
||||
for (Zscreen zscreen : zscreens) {
|
||||
for (Zparam zparam : zparams) {
|
||||
if(zparam.getScrid().equals(zscreen.getId())){
|
||||
zscreen.getParams().add(zparam);
|
||||
}
|
||||
}
|
||||
}
|
||||
return zscreens;
|
||||
}
|
||||
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private TeAllotParamRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.abc.module.te.feat.check;
|
||||
|
||||
import vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class TeFeatCheck extends BaseMainEntity {
|
||||
|
||||
//te_feat_check
|
||||
@Column(length = 32)
|
||||
private String catid;//所属分类
|
||||
|
||||
private Integer ornum;
|
||||
|
||||
private String notes;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.abc.module.te.feat.check;
|
||||
|
||||
import vboot.common.mvc.api.RestResult;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("te/feat/check")
|
||||
public class TeFeatCheckApi {
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name,String catid) {
|
||||
Sqler sqler = new Sqler("te_feat_check");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addEqual("t.catid", catid);
|
||||
sqler.addLeftJoin("c.name as catna", "te_prod_cate c", "c.id=t.catid");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
TeFeatCheck main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody TeFeatCheck main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody TeFeatCheck main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private TeFeatCheckService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.abc.module.te.feat.check;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface TeFeatCheckRepo extends JpaRepository<TeFeatCheck,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.abc.module.te.feat.check;
|
||||
|
||||
import vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Service
|
||||
public class TeFeatCheckService extends BaseMainService<TeFeatCheck> {
|
||||
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private TeFeatCheckRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.abc.module.te.feat.comp;
|
||||
|
||||
import com.abc.module.te.allot.check.TeAllotCheck;
|
||||
import com.abc.module.te.allot.drive.TeAllotDrive;
|
||||
import com.abc.module.te.allot.param.TeAllotParam;
|
||||
import vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class TeFeatComp extends BaseMainEntity {
|
||||
|
||||
private Integer ornum;//排序号
|
||||
|
||||
@Column(length = 32)
|
||||
private String paway;//参数分配方式
|
||||
|
||||
@Column(length = 32)
|
||||
private String patid;//参数分配模板id
|
||||
|
||||
@Transient
|
||||
private TeAllotParam patem;//参数分配模板引用
|
||||
|
||||
@Column(length = 32)
|
||||
private String laway;//联动分配方式
|
||||
|
||||
// @Column(length = 32)
|
||||
// private String latid;//联动分配模板id
|
||||
|
||||
// @Transient
|
||||
// private TeAllotParam latem;//联动分配模板引用
|
||||
|
||||
@Column(length = 32)
|
||||
private String caway;//校验分配方式
|
||||
|
||||
@Column(length = 32)
|
||||
private String catid;//校验分配模板id
|
||||
|
||||
@Transient
|
||||
private TeAllotCheck catem;//校验分配模板引用
|
||||
|
||||
@Column(length = 32)
|
||||
private String daway;//驱动分配方式
|
||||
|
||||
@Column(length = 32)
|
||||
private String datid;//驱动分配模板id
|
||||
|
||||
@Transient
|
||||
private TeAllotDrive datem;//驱动分配模板引用
|
||||
|
||||
private String notes;
|
||||
|
||||
}
|
||||
+19
-21
@@ -1,45 +1,40 @@
|
||||
package com.zsvg.vboot.wf.ins.main;
|
||||
package com.abc.module.te.feat.comp;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.api.RestResult;
|
||||
import com.zsvg.vboot.common.mvc.dao.JdbcDao;
|
||||
import com.zsvg.vboot.common.mvc.dao.Sqler;
|
||||
import com.abc.module.te.allot.param.TeAllotParamService;
|
||||
import vboot.common.mvc.api.RestResult;
|
||||
import vboot.common.mvc.dao.JdbcDao;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import vboot.common.util.lang.XstringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("wf/ins/main")
|
||||
public class WfInsMainApi {
|
||||
|
||||
private String table = "wf_ins_main";
|
||||
@RequestMapping("te/feat/comp")
|
||||
public class TeFeatCompApi {
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
Sqler sqler = new Sqler("te_feat_comp");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.notes");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
WfInsMain main = service.findOne(id);
|
||||
if(main.getTemid()!=null){
|
||||
Sqler sqler = new Sqler("name","wf_tem_main");
|
||||
sqler.addEqual("id",main.getTemid());
|
||||
String name = jdbcDao.findOneString(sqler);
|
||||
main.setTemna(name);
|
||||
TeFeatComp main = service.findOne(id);
|
||||
if (XstringUtil.isNotBlank(main.getPatid())) {
|
||||
main.setPatem(apService.findOne(main.getPatid()));
|
||||
}
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody WfInsMain main) {
|
||||
public RestResult post(@RequestBody TeFeatComp main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody WfInsMain main) {
|
||||
public RestResult put(@RequestBody TeFeatComp main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@@ -49,9 +44,12 @@ public class WfInsMainApi {
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private JdbcDao jdbcDao;
|
||||
private TeFeatCompService service;
|
||||
|
||||
@Autowired
|
||||
private WfInsMainService service;
|
||||
private TeAllotParamService apService;
|
||||
|
||||
@Autowired
|
||||
private JdbcDao jdbcDao;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.abc.module.te.feat.comp;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface TeFeatCompRepo extends JpaRepository<TeFeatComp,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.abc.module.te.feat.comp;
|
||||
|
||||
import com.abc.module.te.allot.param.TeAllotParamRepo;
|
||||
import vboot.common.mvc.service.BaseMainService;
|
||||
import vboot.common.util.lang.XstringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Service
|
||||
public class TeFeatCompService extends BaseMainService<TeFeatComp> {
|
||||
|
||||
public TeFeatComp insert(TeFeatComp main){
|
||||
if(main.getPatem()!=null){
|
||||
String puuid = XstringUtil.getUUID();
|
||||
main.getPatem().setId(puuid);
|
||||
main.getPatem().setName(main.getName()+"专用");
|
||||
main.getPatem().setSptag(true);
|
||||
apRepo.save(main.getPatem());
|
||||
main.setPatid(puuid);
|
||||
}
|
||||
return super.insert(main);
|
||||
}
|
||||
|
||||
public TeFeatComp update(TeFeatComp main){
|
||||
if(main.getPatem()!=null){
|
||||
apRepo.save(main.getPatem());
|
||||
}
|
||||
return super.update(main);
|
||||
}
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private TeAllotParamRepo apRepo;
|
||||
|
||||
@Autowired
|
||||
private TeFeatCompRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.abc.module.te.feat.drive;
|
||||
|
||||
import vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class TeFeatDrive extends BaseMainEntity {
|
||||
|
||||
@Column(length = 32)
|
||||
private String catid;//所属分类
|
||||
|
||||
private Integer ornum;
|
||||
|
||||
private String notes;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.abc.module.te.feat.drive;
|
||||
|
||||
import vboot.common.mvc.api.RestResult;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("te/feat/drive")
|
||||
public class TeFeatDriveApi {
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name,String catid) {
|
||||
Sqler sqler = new Sqler("te_feat_drive");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addEqual("t.catid", catid);
|
||||
sqler.addLeftJoin("c.name as catna", "te_prod_cate c", "c.id=t.catid");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
TeFeatDrive main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody TeFeatDrive main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody TeFeatDrive main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private TeFeatDriveService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.abc.module.te.feat.drive;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface TeFeatDriveRepo extends JpaRepository<TeFeatDrive,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.abc.module.te.feat.drive;
|
||||
|
||||
import vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Service
|
||||
public class TeFeatDriveService extends BaseMainService<TeFeatDrive> {
|
||||
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private TeFeatDriveRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.abc.module.te.feat.link;
|
||||
|
||||
import vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class TeFeatLink extends BaseMainEntity {
|
||||
|
||||
@Column(length = 32)
|
||||
private String catid;//所属分类
|
||||
|
||||
@Column(length = 32)
|
||||
private String modid;//所属型号
|
||||
|
||||
@Column(length = 32)
|
||||
private String trpar;//触发参数
|
||||
|
||||
@Column(length = 32)
|
||||
private String trway;//触发方式
|
||||
|
||||
private Integer trnum;//触发顺序
|
||||
|
||||
private Integer trcon;//触发条件
|
||||
|
||||
private Integer ornum;//排序号
|
||||
|
||||
@Column(length = 32)
|
||||
private String liway;//联动方式
|
||||
|
||||
@Column(length = 2000)
|
||||
private String lifun;//联动函数
|
||||
|
||||
private String notes;
|
||||
|
||||
|
||||
// @Column(length = 64)
|
||||
// private String pacod;
|
||||
//
|
||||
// @Column(length = 64)
|
||||
// private String panam;
|
||||
//
|
||||
// @Column(length = 64)
|
||||
// private String pbcod;
|
||||
//
|
||||
// @Column(length = 64)
|
||||
// private String pbnam;
|
||||
//
|
||||
// @Column(length = 64)
|
||||
// private String pccod;
|
||||
//
|
||||
// @Column(length = 64)
|
||||
// private String pcnam;
|
||||
//
|
||||
// @Column(length = 64)
|
||||
// private String pdcod;
|
||||
//
|
||||
// @Column(length = 64)
|
||||
// private String pdnam;
|
||||
//
|
||||
// @Column(length = 64)
|
||||
// private String pxcod;
|
||||
//
|
||||
// @Column(length = 64)
|
||||
// private String pxnam;
|
||||
//
|
||||
// @Column(length = 64)
|
||||
// private String pycod;
|
||||
//
|
||||
// @Column(length = 64)
|
||||
// private String pynam;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@JoinColumn(name = "linid")
|
||||
@OrderBy("ornum ASC")
|
||||
private List<TeFeatLinkItem> items = new ArrayList<>();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.abc.module.te.feat.link;
|
||||
|
||||
import vboot.common.mvc.api.RestResult;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("te/feat/link")
|
||||
public class TeFeatLinkApi {
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name,String catid) {
|
||||
Sqler sqler = new Sqler("te_feat_link");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addEqual("t.catid", catid);
|
||||
sqler.addLeftJoin("c.name as catna", "te_prod_cate c", "c.id=t.catid");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
TeFeatLink main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody TeFeatLink main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody TeFeatLink main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private TeFeatLinkService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.abc.module.te.feat.link;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class TeFeatLinkItem {
|
||||
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
@GeneratedValue(generator = "jpa-uuid")
|
||||
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
|
||||
private String id;//ID
|
||||
|
||||
private Integer ornum;//排序号
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@JoinColumn(name = "iteid")
|
||||
@OrderBy("ornum ASC")
|
||||
private List<TeFeatLinkLeft> lefts = new ArrayList<>();
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@JoinColumn(name = "iteid")
|
||||
@OrderBy("ornum ASC")
|
||||
private List<TeFeatLinkRight> rights = new ArrayList<>();
|
||||
|
||||
private String notes;//备注
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.abc.module.te.feat.link;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class TeFeatLinkLeft {
|
||||
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
@GeneratedValue(generator = "jpa-uuid")
|
||||
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
|
||||
private String id;//ID
|
||||
|
||||
private Integer ornum;//排序号
|
||||
|
||||
@Column(length = 32)
|
||||
private String copar;
|
||||
|
||||
@Column(length = 32)
|
||||
private String coway;
|
||||
|
||||
@Column(length = 32)
|
||||
private String coval;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.abc.module.te.feat.link;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface TeFeatLinkRepo extends JpaRepository<TeFeatLink,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.abc.module.te.feat.link;
|
||||
|
||||
import com.abc.module.te.feat.param.TeFeatParamOption;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class TeFeatLinkRight {
|
||||
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
@GeneratedValue(generator = "jpa-uuid")
|
||||
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
|
||||
private String id;
|
||||
|
||||
private Integer ornum;
|
||||
|
||||
@Column(length = 32)
|
||||
private String efpar;
|
||||
|
||||
@Column(length = 32)
|
||||
private String efway;
|
||||
|
||||
@Column(length = 32)
|
||||
private String efval;
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(name = "te_feat_link_right_op", joinColumns = {@JoinColumn(name = "rid")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "oid")})
|
||||
private List<TeFeatParamOption> efops;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.abc.module.te.feat.link;
|
||||
|
||||
import vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Service
|
||||
public class TeFeatLinkService extends BaseMainService<TeFeatLink> {
|
||||
|
||||
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private TeFeatLinkRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.abc.module.te.feat.param;
|
||||
|
||||
import vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class TeFeatParam extends BaseMainEntity {
|
||||
|
||||
private Boolean drtag;//土建参数标记
|
||||
|
||||
private Boolean qutag;//询价参数标记
|
||||
|
||||
@Column(length = 32)
|
||||
private String shmod;//显示模式
|
||||
|
||||
@Column(length = 32)
|
||||
private String code;
|
||||
|
||||
private Integer ornum;
|
||||
|
||||
private String notes;
|
||||
|
||||
@Column(length = 32)
|
||||
private String scrid;
|
||||
|
||||
@Transient
|
||||
private String scrna;
|
||||
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@JoinColumn(name = "parid")
|
||||
@OrderBy("ornum ASC")
|
||||
private List<TeFeatParamOption> options = new ArrayList<>();
|
||||
|
||||
@Column(length = 2000)
|
||||
private String asfun;//关联函数
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.abc.module.te.feat.param;
|
||||
|
||||
import vboot.common.mvc.api.RestResult;
|
||||
import vboot.common.mvc.dao.JdbcDao;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import vboot.common.mvc.pojo.ZidName;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("te/feat/param")
|
||||
public class TeFeatParamApi {
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name,String scrid) {
|
||||
Sqler sqler = new Sqler("te_feat_param");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addEqual("t.scrid", scrid);
|
||||
sqler.addLeftJoin("s.name as scrna", "te_feat_screen s", "s.id=t.scrid");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
TeFeatParam main = service.findOne(id);
|
||||
String sql = "select name from te_feat_screen where id=?";
|
||||
String scrna = jdbcDao.findOneString(sql, main.getScrid());
|
||||
main.setScrna(scrna);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@GetMapping("options/{id}")
|
||||
public RestResult getOptions(@PathVariable String id) {
|
||||
String sql = "select id,name,code from te_feat_param_option where parid=?";
|
||||
List<Map<String, Object>> mapList = jdbcDao.findMapList(sql, id);
|
||||
return RestResult.ok(mapList);
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
public RestResult getListByCate(String catid) {
|
||||
String sql = "select t.id,t.name from te_feat_param t inner join te_feat_screen s on s.id=t.scrid " +
|
||||
"inner join te_prod_cate c on c.id=s.catid where s.catid=?";
|
||||
List<ZidName> idNameList = jdbcDao.findIdNameList(sql, catid);
|
||||
return RestResult.ok(idNameList);
|
||||
}
|
||||
|
||||
@GetMapping("mallot")
|
||||
public RestResult mallot(String id) {
|
||||
return RestResult.ok(service.findData(id));
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody TeFeatParam main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody TeFeatParam main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private TeFeatParamService service;
|
||||
|
||||
@Autowired
|
||||
private JdbcDao jdbcDao;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.abc.module.te.feat.param;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class TeFeatParamOption {
|
||||
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
@GeneratedValue(generator = "jpa-uuid")
|
||||
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
|
||||
private String id;//ID
|
||||
|
||||
@Column(length = 32)
|
||||
private String code;//选项代码
|
||||
|
||||
@Column(length = 100)
|
||||
private String name;//选项名称
|
||||
|
||||
private Integer ornum;//排序号
|
||||
|
||||
private String notes;//备注
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.abc.module.te.feat.param;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface TeFeatParamRepo extends JpaRepository<TeFeatParam,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.abc.module.te.feat.param;
|
||||
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import vboot.common.mvc.pojo.ZidName;
|
||||
import vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class TeFeatParamService extends BaseMainService<TeFeatParam> {
|
||||
|
||||
public List<ZidName> findData(String paramid){
|
||||
Sqler sqler1 = new Sqler("t.catid","te_feat_screen");
|
||||
sqler1.addInnerJoin("", "te_feat_param p", "p.scrid=t.id");
|
||||
sqler1.addEqual("p.id", paramid);
|
||||
String catid = jdbcDao.findOneString(sqler1);
|
||||
|
||||
Sqler sqler2=new Sqler("te_prod_model");
|
||||
sqler2.addEqual("t.catid", catid);
|
||||
sqler2.addOrder("t.ornum");
|
||||
List<ZidName> zmodels=jdbcDao.getTp().query(sqler2.getSql(),sqler2.getParams(), new BeanPropertyRowMapper<>(ZidName.class));
|
||||
return zmodels;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private TeFeatParamRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.abc.module.te.feat.screen;
|
||||
|
||||
import vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class TeFeatScreen extends BaseMainEntity {
|
||||
|
||||
@Column(length = 32)
|
||||
private String catid;//所属分类
|
||||
|
||||
private Integer ornum;
|
||||
|
||||
private String notes;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.abc.module.te.feat.screen;
|
||||
|
||||
import vboot.common.mvc.api.RestResult;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import vboot.common.mvc.pojo.Zinp;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("te/feat/screen")
|
||||
public class TeFeatScreenApi {
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name,String catid) {
|
||||
Sqler sqler = new Sqler("te_feat_screen");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addEqual("t.catid", catid);
|
||||
sqler.addLeftJoin("c.name as catna", "te_prod_cate c", "c.id=t.catid");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("tree")
|
||||
public RestResult getTree(String name) {
|
||||
List<Zinp> list = service.findTreeList(name);
|
||||
return RestResult.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
TeFeatScreen main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody TeFeatScreen main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody TeFeatScreen main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private TeFeatScreenService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.abc.module.te.feat.screen;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface TeFeatScreenRepo extends JpaRepository<TeFeatScreen,String> {
|
||||
|
||||
|
||||
}
|
||||
+25
-21
@@ -1,10 +1,9 @@
|
||||
package com.zsvg.vboot.ps.task.main;
|
||||
package com.abc.module.te.feat.screen;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.dao.Sqler;
|
||||
import com.zsvg.vboot.common.mvc.service.BaseMainService;
|
||||
import com.zsvg.vboot.ps.proj.cate.PsProjCate;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import vboot.common.mvc.pojo.Zinp;
|
||||
import vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
@@ -12,22 +11,33 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class PsTaskMainService extends BaseMainService<PsTaskMain> {
|
||||
public class TeFeatScreenService extends BaseMainService<TeFeatScreen> {
|
||||
|
||||
public List<Zinp> findTreeList(String name) {
|
||||
Sqler cateSqler = new Sqler("te_prod_cate");
|
||||
cateSqler.addSelect("null as pid");
|
||||
cateSqler.addOrder("t.ornum");
|
||||
List<Zinp> list = jdbcDao.findInpList(cateSqler);
|
||||
|
||||
Sqler mainSqler = new Sqler("te_feat_screen");
|
||||
mainSqler.addSelect("t.catid as pid");
|
||||
mainSqler.addLike("t.name", name);
|
||||
mainSqler.addOrder("t.ornum");
|
||||
List<Zinp> list2 = jdbcDao.findInpList(mainSqler);
|
||||
list.addAll(list2);
|
||||
|
||||
public List<PsTaskMain> findTree(Sqler sqler) {
|
||||
List<PsTaskMain> list = jdbcDao.getTp().query(sqler.getSql(), sqler.getParams(), new BeanPropertyRowMapper<>(PsTaskMain.class));
|
||||
return buildByRecursive(list);
|
||||
}
|
||||
|
||||
//使用递归方法建树
|
||||
private List<PsTaskMain> buildByRecursive(List<PsTaskMain> nodes) {
|
||||
List<PsTaskMain> list = new ArrayList<>();
|
||||
for (PsTaskMain node : nodes) {
|
||||
private List<Zinp> buildByRecursive(List<Zinp> nodes) {
|
||||
List<Zinp> list = new ArrayList<>();
|
||||
for (Zinp node : nodes) {
|
||||
if (node.getPid() == null) {
|
||||
list.add(findChildrenByTier(node, nodes));
|
||||
} else {
|
||||
boolean flag = false;
|
||||
for (PsTaskMain node2 : nodes) {
|
||||
for (Zinp node2 : nodes) {
|
||||
if (node.getPid().equals(node2.getId())) {
|
||||
flag = true;
|
||||
break;
|
||||
@@ -43,8 +53,8 @@ public class PsTaskMainService extends BaseMainService<PsTaskMain> {
|
||||
|
||||
|
||||
//递归查找子节点
|
||||
private PsTaskMain findChildrenByTier(PsTaskMain node, List<PsTaskMain> nodes) {
|
||||
for (PsTaskMain item : nodes) {
|
||||
private Zinp findChildrenByTier(Zinp node, List<Zinp> nodes) {
|
||||
for (Zinp item : nodes) {
|
||||
if (node.getId().equals(item.getPid())) {
|
||||
if (node.getChildren() == null) {
|
||||
node.setChildren(new ArrayList<>());
|
||||
@@ -56,13 +66,9 @@ public class PsTaskMainService extends BaseMainService<PsTaskMain> {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private PsTaskMainRepo repo;
|
||||
private TeFeatScreenRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
@@ -70,5 +76,3 @@ public class PsTaskMainService extends BaseMainService<PsTaskMain> {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.abc.module.te.prod.cate;
|
||||
|
||||
import vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class TeProdCate extends BaseMainEntity {
|
||||
|
||||
private Integer ornum;
|
||||
|
||||
private String notes;
|
||||
|
||||
}
|
||||
+23
-14
@@ -1,46 +1,55 @@
|
||||
package com.zsvg.vboot.ps.task.cate;
|
||||
package com.abc.module.te.prod.cate;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.api.RestResult;
|
||||
import com.zsvg.vboot.common.mvc.dao.Sqler;
|
||||
import vboot.common.mvc.api.RestResult;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("ps/task/cate")
|
||||
public class PsTaskCateApi {
|
||||
|
||||
private String table = "ps_task_cate";
|
||||
@RequestMapping("te/prod/cate")
|
||||
public class TeProdCateApi {
|
||||
|
||||
//分页特性分类
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
Sqler sqler = new Sqler("te_prod_cate");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.notes,t.ornum");
|
||||
sqler.addSelect("t.notes");
|
||||
sqler.addOrder("t.ornum");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
public RestResult getList() {
|
||||
return RestResult.ok(service.findAll());
|
||||
}
|
||||
|
||||
//查询单个分类
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
PsTaskCate cate = service.findOne(id);
|
||||
TeProdCate cate = service.findOne(id);
|
||||
return RestResult.ok(cate);
|
||||
}
|
||||
|
||||
//新增分类
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody PsTaskCate cate) {
|
||||
public RestResult post(@RequestBody TeProdCate cate) {
|
||||
return RestResult.ok(service.insert(cate));
|
||||
}
|
||||
|
||||
//修改分类
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody PsTaskCate cate) {
|
||||
public RestResult put(@RequestBody TeProdCate cate) {
|
||||
return RestResult.ok(service.update(cate));
|
||||
}
|
||||
|
||||
//删除分类
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private PsTaskCateService service;
|
||||
private TeProdCateService service;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.abc.module.te.prod.cate;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface TeProdCateRepo extends JpaRepository<TeProdCate,String> {
|
||||
|
||||
|
||||
}
|
||||
+5
-4
@@ -1,21 +1,22 @@
|
||||
package com.zsvg.vboot.ps.task.cate;
|
||||
package com.abc.module.te.prod.cate;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.service.BaseCateService;
|
||||
import vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Service
|
||||
public class PsTaskCateService extends BaseCateService<PsTaskCate> {
|
||||
public class TeProdCateService extends BaseMainService<TeProdCate> {
|
||||
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private PsTaskCateRepo repo;
|
||||
private TeProdCateRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.abc.module.te.prod.model;
|
||||
|
||||
import vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class TeProdModel extends BaseMainEntity {
|
||||
|
||||
private Integer ornum;
|
||||
|
||||
private String notes;
|
||||
|
||||
@Column(length = 32)
|
||||
private String catid;
|
||||
|
||||
@Column(length = 32)
|
||||
private String serid;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.abc.module.te.prod.model;
|
||||
|
||||
import vboot.common.mvc.api.RestResult;
|
||||
import vboot.common.mvc.dao.JdbcDao;
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import vboot.common.mvc.pojo.Zinp;
|
||||
import vboot.common.util.lang.XstringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("te/prod/model")
|
||||
public class TeProdModelApi {
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name,String catid) {
|
||||
Sqler sqler = new Sqler("te_prod_model");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addEqual("t.catid", catid);
|
||||
sqler.addLeftJoin("c.name as catna", "te_prod_cate c", "c.id=t.catid");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
TeProdModel main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
public RestResult getList(String serid,String catid) {
|
||||
if(XstringUtil.isNotBlank(catid)){
|
||||
String sql = "select m.id,m.name from te_prod_model m where m.catid=?";
|
||||
List<Map<String, Object>> mapList = jdbcDao.findMapList(sql, catid);
|
||||
return RestResult.ok(mapList);
|
||||
}else if(XstringUtil.isNotBlank(serid)){
|
||||
String sql = "select m.id,m.name from te_prod_model m where m.serid=?";
|
||||
List<Map<String, Object>> mapList = jdbcDao.findMapList(sql, serid);
|
||||
return RestResult.ok(mapList);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("zmodel/{id}")
|
||||
public RestResult getFeat(@PathVariable String id) {
|
||||
Zmodel zmodel = service.getZmodel(id);
|
||||
return RestResult.ok(zmodel);
|
||||
}
|
||||
|
||||
@GetMapping("tree")
|
||||
public RestResult getTree(String name) {
|
||||
List<Zinp> list = service.findTreeList(name);
|
||||
return RestResult.ok(list);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody TeProdModel main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody TeProdModel main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private TeProdModelService service;
|
||||
|
||||
@Autowired
|
||||
private JdbcDao jdbcDao;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.abc.module.te.prod.model;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface TeProdModelRepo extends JpaRepository<TeProdModel,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.abc.module.te.prod.model;
|
||||
|
||||
import vboot.common.mvc.dao.Sqler;
|
||||
import vboot.common.mvc.pojo.Zinp;
|
||||
import vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class TeProdModelService extends BaseMainService<TeProdModel> {
|
||||
|
||||
public Zmodel getZmodel(String modid){
|
||||
String sql = "select m.catid,m.id,m.name,v.coway,v.paway,v.patid from te_prod_model m inner join te_prod_version v on v.modid=m.id" +
|
||||
" and v.detag=1 where m.id=?";
|
||||
Map<String, Object> map = jdbcDao.findMap(sql, modid);
|
||||
Zmodel zmodel = new Zmodel();
|
||||
zmodel.setId(modid);
|
||||
zmodel.setName(""+map.get("name"));
|
||||
zmodel.setCatid(""+map.get("catid"));
|
||||
setScreens(zmodel);
|
||||
|
||||
return zmodel;
|
||||
}
|
||||
|
||||
private void setScreens(Zmodel zmodel){
|
||||
Sqler sqler2=new Sqler("te_feat_screen");
|
||||
sqler2.addEqual("t.catid", zmodel.getCatid());
|
||||
sqler2.addOrder("t.ornum");
|
||||
List<Zscreen> zscreens=jdbcDao.getTp().query(sqler2.getSql(),sqler2.getParams(), new BeanPropertyRowMapper<>(Zscreen.class));
|
||||
|
||||
List<Zparam> zparams = new ArrayList<>();
|
||||
String sql3 = "select id,name,shmod,code,scrid,ornum from te_feat_param where scrid in (";
|
||||
String ins = "";
|
||||
for (Zscreen zscreen : zscreens) {
|
||||
ins += "'" + zscreen.getId() + "',";
|
||||
}
|
||||
if (!"".equals(ins)) {
|
||||
ins = ins.substring(0, ins.length() - 1);
|
||||
sql3 += ins + ") order by scrid,ornum";
|
||||
zparams=jdbcDao.getTp().query(sql3, new BeanPropertyRowMapper<>(Zparam.class));
|
||||
}
|
||||
|
||||
for (Zscreen zscreen : zscreens) {
|
||||
for (Zparam zparam : zparams) {
|
||||
if(zparam.getScrid().equals(zscreen.getId())){
|
||||
zscreen.getParams().add(zparam);
|
||||
}
|
||||
}
|
||||
}
|
||||
zmodel.setScreens(zscreens);
|
||||
}
|
||||
|
||||
|
||||
public List<Zinp> findTreeList(String name) {
|
||||
Sqler cateSqler = new Sqler("te_prod_cate");
|
||||
cateSqler.addSelect("null as pid");
|
||||
cateSqler.addOrder("t.ornum");
|
||||
List<Zinp> list = jdbcDao.findInpList(cateSqler);
|
||||
|
||||
Sqler serieSqler = new Sqler("te_prod_serie");
|
||||
serieSqler.addSelect("t.catid as pid");
|
||||
serieSqler.addOrder("t.ornum");
|
||||
List<Zinp> list2 = jdbcDao.findInpList(serieSqler);
|
||||
list.addAll(list2);
|
||||
|
||||
Sqler modelSqler = new Sqler("te_prod_model");
|
||||
modelSqler.addSelect("t.serid as pid");
|
||||
modelSqler.addOrder("t.ornum");
|
||||
List<Zinp> list3 = jdbcDao.findInpList(modelSqler);
|
||||
list.addAll(list3);
|
||||
|
||||
return buildByRecursive(list);
|
||||
}
|
||||
|
||||
//使用递归方法建树
|
||||
private List<Zinp> buildByRecursive(List<Zinp> nodes) {
|
||||
List<Zinp> list = new ArrayList<>();
|
||||
for (Zinp node : nodes) {
|
||||
if (node.getPid() == null) {
|
||||
list.add(findChildrenByTier(node, nodes));
|
||||
} else {
|
||||
boolean flag = false;
|
||||
for (Zinp node2 : nodes) {
|
||||
if (node.getPid().equals(node2.getId())) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
list.add(findChildrenByTier(node, nodes));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
//递归查找子节点
|
||||
private Zinp findChildrenByTier(Zinp node, List<Zinp> nodes) {
|
||||
for (Zinp item : nodes) {
|
||||
if (node.getId().equals(item.getPid())) {
|
||||
if (node.getChildren() == null) {
|
||||
node.setChildren(new ArrayList<>());
|
||||
}
|
||||
node.getChildren().add(findChildrenByTier(item, nodes));
|
||||
}
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private TeProdModelRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user