forked from gitee/vben-java
增加项目与任务管理
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
### 🍟 概述
|
||||
* 基于JAVA实现的快速开发平台。模块化插件式开发,前后端分离,开箱即用。
|
||||
* 后台基于SpringBoot框架,数据库访问使用Jpa,自动生成数据库表结构。
|
||||
* 后台基于SpringBoot框架,数据库访问同时集成了Jpa与MyBatis-Plus,即可自动生成数据库表结构,又可灵活编写sql。
|
||||
* 前端基于Vben-Admin vxe-table框架。
|
||||
* 核心模块包括:部门、用户、岗位、群组、角色、菜单、字典、日志、文件管理、定时任务等功能。
|
||||
* .NET6实现的同功能项目地址[https://gitee.com/zsvg/vboot-net](https://gitee.com/zsvg/vboot-net) 两个项目会同步开发
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<module>vboot-application</module>
|
||||
<module>vboot-extend-bi</module>
|
||||
<module>vboot-extend-wf</module>
|
||||
<module>vboot-extend-ps</module>
|
||||
</modules>
|
||||
|
||||
<!--定义属性值-->
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
<artifactId>vboot-extend-bi</artifactId>
|
||||
<version>${vboot.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--集成流程管理-->
|
||||
<dependency>
|
||||
<groupId>com.zsvg</groupId>
|
||||
<artifactId>vboot-extend-wf</artifactId>
|
||||
@@ -29,6 +31,19 @@
|
||||
</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>
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.net.UnknownHostException;
|
||||
@EnableJpaRepositories({"com.zsvg","com.abc"})
|
||||
@Slf4j
|
||||
@EnableAsync
|
||||
//@MapperScan({"com.abc"})//mybatis-plus扫描mapper
|
||||
//@EnableSwagger2
|
||||
public class Application {
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.db.cate;
|
||||
package com.abc.it.db.cate;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.entity.BaseCateEntity;
|
||||
import lombok.Getter;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.db.cate;
|
||||
package com.abc.it.db.cate;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.api.RestResult;
|
||||
import com.zsvg.vboot.common.mvc.dao.Sqler;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.db.cate;
|
||||
package com.abc.it.db.cate;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.db.cate;
|
||||
package com.abc.it.db.cate;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.service.BaseCateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.db.main;
|
||||
package com.abc.it.db.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.db.main;
|
||||
package com.abc.it.db.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.api.RestResult;
|
||||
import com.zsvg.vboot.common.mvc.dao.Sqler;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.db.main;
|
||||
package com.abc.it.db.main;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.db.main;
|
||||
package com.abc.it.db.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.server.cate;
|
||||
package com.abc.it.server.cate;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.entity.BaseCateEntity;
|
||||
import lombok.Getter;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.server.cate;
|
||||
package com.abc.it.server.cate;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.api.RestResult;
|
||||
import com.zsvg.vboot.common.mvc.dao.Sqler;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.server.cate;
|
||||
package com.abc.it.server.cate;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.server.cate;
|
||||
package com.abc.it.server.cate;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.service.BaseCateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.server.main;
|
||||
package com.abc.it.server.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.server.main;
|
||||
package com.abc.it.server.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.api.RestResult;
|
||||
import com.zsvg.vboot.common.mvc.dao.Sqler;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.server.main;
|
||||
package com.abc.it.server.main;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.server.main;
|
||||
package com.abc.it.server.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -8,19 +8,25 @@ server.compression.min-response-size=40960000
|
||||
|
||||
#mysql
|
||||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/vboot-java?characterEncoding=utf-8&useSSL=false
|
||||
#spring.datasource.url=jdbc:mysql://127.0.0.1:3306/dw?characterEncoding=utf-8&useSSL=false
|
||||
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
#spring.datasource.url=jdbc:mysql://127.0.0.1:3306/vboot-java?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC&nullCatalogMeansCurrent=true
|
||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/vboot-java?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=UTC&nullCatalogMeansCurrent=true
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=123456
|
||||
|
||||
|
||||
#oracle
|
||||
#spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
|
||||
#spring.datasource.url=jdbc:oracle:thin:@127.0.0.1:1521:orcl
|
||||
#spring.datasource.username=vboot
|
||||
#spring.datasource.password=123456
|
||||
|
||||
app.db.type=MYSQL
|
||||
|
||||
#应用初始化类型
|
||||
#-- sa:组织架构只包含一个sa管理员与一个vben的演示账户
|
||||
#--demo:除了以上数据还包含了一些demo部门与demo用户
|
||||
app.init.type=sa
|
||||
app.db.type=mysql
|
||||
app.att.path=C:/vboot/att
|
||||
#1代表session,2待办jwt token
|
||||
app.authc.type=2
|
||||
|
||||
@@ -60,6 +60,13 @@
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc6</artifactId>
|
||||
<version>11.2.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${pom.basedir}/lib/ojdbc6.jar</systemPath>
|
||||
</dependency>
|
||||
<!--数据库相关结束-->
|
||||
|
||||
<!--可用DATA注解自动生成get set toString等,idea需要插件支持-->
|
||||
|
||||
@@ -31,9 +31,9 @@ public class JdbcDao {
|
||||
return new PageData(0, new ArrayList<>());
|
||||
}
|
||||
List<Map<String, Object>> list;
|
||||
if ("MYSQL".equals(DB_TYPE)) {
|
||||
if ("mysql".equals(DB_TYPE)) {
|
||||
list = jdbcTemplate.queryForList(sqler.getMysqlPagingSql(), sqler.getParams());
|
||||
}else if ("ORACLE".equals(DB_TYPE)) {
|
||||
}else if ("oracle".equals(DB_TYPE)) {
|
||||
list = jdbcTemplate.queryForList(sqler.getOraclePagingLowerCaseSql(), sqler.getParams());
|
||||
} else {
|
||||
System.err.println("目前只支持mysql与oracle");
|
||||
|
||||
@@ -168,7 +168,7 @@ public class Sqler
|
||||
|
||||
public Sqler addGtDate(String name, Object value, String dbType)
|
||||
{
|
||||
if("ORACLE".equals(dbType)){
|
||||
if("oracle".equals(dbType)){
|
||||
if (XstringUtil.isNotBlank(value + ""))
|
||||
{
|
||||
if (whereClause.length() == 0)
|
||||
@@ -180,7 +180,7 @@ public class Sqler
|
||||
}
|
||||
parameters.add(value);
|
||||
}
|
||||
}else if("MYSQL".equals(dbType)){
|
||||
}else if("mysql".equals(dbType)){
|
||||
if (XstringUtil.isNotBlank(value + ""))
|
||||
{
|
||||
if (whereClause.length() == 0)
|
||||
@@ -199,7 +199,7 @@ public class Sqler
|
||||
|
||||
public Sqler addLtDate(String name, Object value, String dbType)
|
||||
{
|
||||
if("ORACLE".equals(dbType)) {
|
||||
if("oracle".equals(dbType)) {
|
||||
if (XstringUtil.isNotBlank(value + "")) {
|
||||
if (whereClause.length() == 0) {
|
||||
whereClause = " WHERE " + name + "<to_date(?,'yyyy-MM-dd')+1";
|
||||
|
||||
@@ -55,15 +55,15 @@ public class Zconn {
|
||||
|
||||
public boolean isOracle()
|
||||
{
|
||||
return "ORACLE".equals(type);
|
||||
return "oracle".equals(type);
|
||||
}
|
||||
public boolean isMysql()
|
||||
{
|
||||
return "MYSQL".equals(type);
|
||||
return "mysql".equals(type);
|
||||
}
|
||||
public boolean isMysql8()
|
||||
{
|
||||
return "MYSQL8".equals(type);
|
||||
return "mysql8".equals(type);
|
||||
}
|
||||
public boolean isDB2()
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.zsvg.vboot.config.db.init;
|
||||
import com.zsvg.vboot.module.sys.org.user.SysOrgUserRepo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
@@ -15,6 +16,8 @@ import java.net.InetAddress;
|
||||
public class DbInitListener implements ApplicationListener<ContextRefreshedEvent> {
|
||||
|
||||
|
||||
@Value("${app.init.type}")
|
||||
private String INIT_TYPE;
|
||||
/**
|
||||
* 首次数据库生成后,初始化组织架构,菜单,权限角色等信息
|
||||
* 增加sa,admin管理员账号及相关测试账号
|
||||
@@ -25,15 +28,16 @@ public class DbInitListener implements ApplicationListener<ContextRefreshedEvent
|
||||
try {
|
||||
if (!userDao.existsById("sa")) {
|
||||
System.out.println("首次启动系统,正在进行数据库初始化,请耐心等待。");
|
||||
sysOrgInit.initCorp();
|
||||
System.out.println("1.1 初始化部门完毕");
|
||||
sysOrgInit.initUser();
|
||||
sysOrgInit.initZsf();
|
||||
if("demo".equals(INIT_TYPE)){
|
||||
sysOrgInit.initCorp();
|
||||
System.out.println("1.1 初始化部门完毕");
|
||||
sysOrgInit.initUser();
|
||||
sysOrgInit.initZsf();
|
||||
}
|
||||
sysOrgInit.initSa();
|
||||
System.out.println("1.2 初始化用户完毕");
|
||||
// sysOrgInit.initPost();
|
||||
// sysOrgInit.initGroup();
|
||||
|
||||
sysAuthInit.initMenu();
|
||||
System.out.println("2.1 初始化菜单完毕");
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class GenOrgReceService {
|
||||
sqler.addDescOrder("t.uptim");
|
||||
sqler.addEqual("t.userid", userid);
|
||||
List<GenOrgRece> list;
|
||||
if ("MYSQL".equals(jdbcDao.getDbType())) {
|
||||
if ("mysql".equals(jdbcDao.getDbType())) {
|
||||
list = jdbcDao.getTp().query(sqler.getMysqlPagingSql(), sqler.getParams(), new BeanPropertyRowMapper<>(GenOrgRece.class));
|
||||
} else {
|
||||
list = jdbcDao.getTp().query(sqler.getOraclePagingLowerCaseSql(), sqler.getParams(), new BeanPropertyRowMapper<>(GenOrgRece.class));
|
||||
|
||||
@@ -79,13 +79,6 @@
|
||||
<systemPath>${pom.basedir}/lib/jface-3.3.0-I20070606-0010.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc6</artifactId>
|
||||
<version>11.2.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${pom.basedir}/lib/ojdbc6.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.javassist</groupId>
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.zsvg.vboot.bi;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.api.RestResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("bi")
|
||||
public class BiTestApi {
|
||||
|
||||
@GetMapping("test")
|
||||
public RestResult get() {
|
||||
return RestResult.ok("这里可以放扩展模块1");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.zsvg.vboot.bi.conn.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class BiConnMain extends BaseMainEntity {
|
||||
|
||||
@Column(length = 64)
|
||||
private String comet;//注释
|
||||
|
||||
@Column(length = 64)
|
||||
private String notes;//备注
|
||||
|
||||
}
|
||||
+14
-12
@@ -1,38 +1,40 @@
|
||||
package com.zsvg.vboot.it.proj.cate;
|
||||
package com.zsvg.vboot.bi.conn.main;
|
||||
|
||||
import com.zsvg.vboot.bi.table.main.BiTableMain;
|
||||
import com.zsvg.vboot.bi.table.main.BiTableMainService;
|
||||
import com.zsvg.vboot.common.mvc.api.RestResult;
|
||||
import com.zsvg.vboot.common.mvc.dao.Sqler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("it/proj/cate")
|
||||
public class ItProjCateApi {
|
||||
@RequestMapping("bi/conn/main")
|
||||
public class BiConnMainApi {
|
||||
|
||||
private String table = "it_proj_cate";
|
||||
private String table = "bi_conn_main";
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.notes,t.ornum");
|
||||
sqler.addSelect("t.comet,t.notes");
|
||||
return RestResult.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
ItProjCate cate = service.findOne(id);
|
||||
return RestResult.ok(cate);
|
||||
BiTableMain main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody ItProjCate cate) {
|
||||
return RestResult.ok(service.insert(cate));
|
||||
public RestResult post(@RequestBody BiTableMain main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody ItProjCate cate) {
|
||||
return RestResult.ok(service.update(cate));
|
||||
public RestResult put(@RequestBody BiTableMain main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
@@ -41,6 +43,6 @@ public class ItProjCateApi {
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ItProjCateService service;
|
||||
private BiTableMainService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.zsvg.vboot.bi.conn.main;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface BiConnMainRepo extends JpaRepository<BiConnMain,String> {
|
||||
|
||||
|
||||
}
|
||||
+4
-5
@@ -1,18 +1,17 @@
|
||||
package com.zsvg.vboot.it.task.cate;
|
||||
package com.zsvg.vboot.bi.conn.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.service.BaseCateService;
|
||||
import com.zsvg.vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Service
|
||||
public class ItTaskCateService extends BaseCateService<ItTaskCate> {
|
||||
|
||||
public class BiConnMainService extends BaseMainService<BiConnMain> {
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private ItTaskCateRepo repo;
|
||||
private BiConnMainRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.zsvg.vboot.bi.demo.boy;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.service.BaseService;
|
||||
import com.zsvg.vboot.it.db.main.ItDbMainRepo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.zsvg.vboot.it.proj.cate;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.entity.BaseCateEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class ItProjCate extends BaseCateEntity {
|
||||
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.zsvg.vboot.it.proj.cate;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface ItProjCateRepo extends JpaRepository<ItProjCate,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.zsvg.vboot.it.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 ItProjMain extends BaseMainEntity {
|
||||
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.zsvg.vboot.it.proj.main;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface ItProjMainRepo extends JpaRepository<ItProjMain,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.zsvg.vboot.it.task.cate;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface ItTaskCateRepo extends JpaRepository<ItTaskCate,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.zsvg.vboot.it.task.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.entity.BaseMainEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class ItTaskMain extends BaseMainEntity {
|
||||
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.zsvg.vboot.it.task.main;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface ItTaskMainRepo extends JpaRepository<ItTaskMain,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>vboot</artifactId>
|
||||
<groupId>com.zsvg</groupId>
|
||||
<version>0.2</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>vboot-extend-ps</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.zsvg</groupId>
|
||||
<artifactId>vboot-core</artifactId>
|
||||
<version>${vboot.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.zsvg.vboot.ps.proj.cate;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.entity.BaseCateEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class PsProjCate extends BaseCateEntity {
|
||||
|
||||
@ManyToOne(fetch= FetchType.EAGER)
|
||||
@JoinColumn(name = "pid")
|
||||
private PsProjCate parent;
|
||||
|
||||
@Transient
|
||||
private List<PsProjCate> children = new ArrayList<>();
|
||||
|
||||
private String notes;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.zsvg.vboot.ps.proj.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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("ps/proj/cate")
|
||||
public class PsProjCateApi {
|
||||
|
||||
private String table = "ps_proj_cate";
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
sqler.addSelect("t.pid,t.crtim,t.uptim");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addOrder("t.ornum");
|
||||
return RestResult.ok(service.findTree(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
PsProjCate cate = service.findOne(id);
|
||||
return RestResult.ok(cate);
|
||||
}
|
||||
|
||||
@GetMapping("tree")
|
||||
public RestResult getTree(String name) {
|
||||
List<Ztree> list = service.findTreeList(table,name);
|
||||
return RestResult.ok(list);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody PsProjCate main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody PsProjCate main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private PsProjCateService service;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.zsvg.vboot.ps.proj.cate;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface PsProjCateRepo extends JpaRepository<PsProjCate,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.zsvg.vboot.ps.proj.cate;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.dao.Sqler;
|
||||
import com.zsvg.vboot.common.mvc.service.BaseCateService;
|
||||
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 PsProjCateService extends BaseCateService<PsProjCate> {
|
||||
|
||||
public List<PsProjCate> findTree(Sqler sqler) {
|
||||
List<PsProjCate> list = jdbcDao.getTp().query(sqler.getSql(), sqler.getParams(), new BeanPropertyRowMapper<>(PsProjCate.class));
|
||||
return buildByRecursive(list);
|
||||
}
|
||||
|
||||
//使用递归方法建树
|
||||
private List<PsProjCate> buildByRecursive(List<PsProjCate> nodes) {
|
||||
List<PsProjCate> list = new ArrayList<>();
|
||||
for (PsProjCate node : nodes) {
|
||||
if (node.getPid() == null) {
|
||||
list.add(findChildrenByTier(node, nodes));
|
||||
} else {
|
||||
boolean flag = false;
|
||||
for (PsProjCate node2 : nodes) {
|
||||
if (node.getPid().equals(node2.getId())) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
list.add(findChildrenByTier(node, nodes));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
//递归查找子节点
|
||||
private PsProjCate findChildrenByTier(PsProjCate node, List<PsProjCate> nodes) {
|
||||
for (PsProjCate 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 PsProjCateRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.zsvg.vboot.ps.proj.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.entity.BaseMainEntity;
|
||||
import com.zsvg.vboot.ps.proj.cate.PsProjCate;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class PsProjMain extends BaseMainEntity {
|
||||
|
||||
@Transient
|
||||
private String cid;
|
||||
|
||||
@ManyToOne(fetch= FetchType.EAGER)
|
||||
@JoinColumn(name = "cid")
|
||||
private PsProjCate cate;
|
||||
|
||||
private String notes;
|
||||
}
|
||||
+8
-8
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.proj.main;
|
||||
package com.zsvg.vboot.ps.proj.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.api.RestResult;
|
||||
import com.zsvg.vboot.common.mvc.dao.Sqler;
|
||||
@@ -6,10 +6,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("it/proj/main")
|
||||
public class ItProjMainApi {
|
||||
@RequestMapping("ps/proj/main")
|
||||
public class PsProjMainApi {
|
||||
|
||||
private String table = "it_proj_main";
|
||||
private String table = "ps_proj_main";
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
@@ -20,17 +20,17 @@ public class ItProjMainApi {
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
ItProjMain main = service.findOne(id);
|
||||
PsProjMain main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody ItProjMain main) {
|
||||
public RestResult post(@RequestBody PsProjMain main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody ItProjMain main) {
|
||||
public RestResult put(@RequestBody PsProjMain main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@@ -40,6 +40,6 @@ public class ItProjMainApi {
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ItProjMainService service;
|
||||
private PsProjMainService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.zsvg.vboot.ps.proj.main;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface PsProjMainRepo extends JpaRepository<PsProjMain,String> {
|
||||
|
||||
|
||||
}
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.task.main;
|
||||
package com.zsvg.vboot.ps.proj.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -7,11 +7,11 @@ import org.springframework.stereotype.Service;
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Service
|
||||
public class ItTaskMainService extends BaseMainService<ItTaskMain> {
|
||||
public class PsProjMainService extends BaseMainService<PsProjMain> {
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private ItTaskMainRepo repo;
|
||||
private PsProjMainRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.task.cate;
|
||||
package com.zsvg.vboot.ps.task.cate;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.entity.BaseCateEntity;
|
||||
import lombok.Getter;
|
||||
@@ -9,7 +9,7 @@ import javax.persistence.Entity;
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class ItTaskCate extends BaseCateEntity {
|
||||
public class PsTaskCate extends BaseCateEntity {
|
||||
|
||||
|
||||
}
|
||||
+8
-8
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.task.cate;
|
||||
package com.zsvg.vboot.ps.task.cate;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.api.RestResult;
|
||||
import com.zsvg.vboot.common.mvc.dao.Sqler;
|
||||
@@ -6,10 +6,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("it/task/cate")
|
||||
public class ItTaskCateApi {
|
||||
@RequestMapping("ps/task/cate")
|
||||
public class PsTaskCateApi {
|
||||
|
||||
private String table = "it_task_cate";
|
||||
private String table = "ps_task_cate";
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
@@ -21,17 +21,17 @@ public class ItTaskCateApi {
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
ItTaskCate cate = service.findOne(id);
|
||||
PsTaskCate cate = service.findOne(id);
|
||||
return RestResult.ok(cate);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody ItTaskCate cate) {
|
||||
public RestResult post(@RequestBody PsTaskCate cate) {
|
||||
return RestResult.ok(service.insert(cate));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody ItTaskCate cate) {
|
||||
public RestResult put(@RequestBody PsTaskCate cate) {
|
||||
return RestResult.ok(service.update(cate));
|
||||
}
|
||||
|
||||
@@ -41,6 +41,6 @@ public class ItTaskCateApi {
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ItTaskCateService service;
|
||||
private PsTaskCateService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.zsvg.vboot.ps.task.cate;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface PsTaskCateRepo extends JpaRepository<PsTaskCate,String> {
|
||||
|
||||
|
||||
}
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.proj.cate;
|
||||
package com.zsvg.vboot.ps.task.cate;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.service.BaseCateService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -7,12 +7,12 @@ import org.springframework.stereotype.Service;
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Service
|
||||
public class ItProjCateService extends BaseCateService<ItProjCate> {
|
||||
public class PsTaskCateService extends BaseCateService<PsTaskCate> {
|
||||
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private ItProjCateRepo repo;
|
||||
private PsTaskCateRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.zsvg.vboot.ps.task.list;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.entity.BaseMainEntity;
|
||||
import com.zsvg.vboot.ps.proj.cate.PsProjCate;
|
||||
import com.zsvg.vboot.ps.proj.main.PsProjMain;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class PsTaskList extends BaseMainEntity {
|
||||
|
||||
@Transient
|
||||
private String projid;
|
||||
|
||||
@ManyToOne(fetch= FetchType.EAGER)
|
||||
@JoinColumn(name = "projid")
|
||||
private PsProjMain proj;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.zsvg.vboot.ps.task.list;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.api.RestResult;
|
||||
import com.zsvg.vboot.common.mvc.dao.Sqler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("ps/task/list")
|
||||
public class PsTaskListApi {
|
||||
|
||||
private String table = "ps_task_list";
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
sqler.addLike("t.name", name);
|
||||
return RestResult.ok(service.findMapList(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
PsTaskList main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody PsTaskList main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody PsTaskList main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
public RestResult delete(@PathVariable String[] ids) {
|
||||
return RestResult.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private PsTaskListService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.zsvg.vboot.ps.task.list;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface PsTaskListRepo extends JpaRepository<PsTaskList,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.zsvg.vboot.ps.task.list;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Service
|
||||
public class PsTaskListService extends BaseMainService<PsTaskList> {
|
||||
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private PsTaskListRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.zsvg.vboot.ps.task.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.entity.BaseMainEntity;
|
||||
import com.zsvg.vboot.ps.proj.main.PsProjMain;
|
||||
import com.zsvg.vboot.ps.task.list.PsTaskList;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
public class PsTaskMain extends BaseMainEntity {
|
||||
|
||||
@Transient
|
||||
private String listid;
|
||||
|
||||
@ManyToOne(fetch= FetchType.EAGER)
|
||||
@JoinColumn(name = "listid")
|
||||
private PsTaskList list;
|
||||
|
||||
|
||||
}
|
||||
+8
-8
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.task.main;
|
||||
package com.zsvg.vboot.ps.task.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.api.RestResult;
|
||||
import com.zsvg.vboot.common.mvc.dao.Sqler;
|
||||
@@ -6,10 +6,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("it/task/main")
|
||||
public class ItTaskMainApi {
|
||||
@RequestMapping("ps/task/main")
|
||||
public class PsTaskMainApi {
|
||||
|
||||
private String table = "it_task_main";
|
||||
private String table = "ps_task_main";
|
||||
|
||||
@GetMapping
|
||||
public RestResult get(String name) {
|
||||
@@ -20,17 +20,17 @@ public class ItTaskMainApi {
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
public RestResult getOne(@PathVariable String id) {
|
||||
ItTaskMain main = service.findOne(id);
|
||||
PsTaskMain main = service.findOne(id);
|
||||
return RestResult.ok(main);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public RestResult post(@RequestBody ItTaskMain main) {
|
||||
public RestResult post(@RequestBody PsTaskMain main) {
|
||||
return RestResult.ok(service.insert(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
public RestResult put(@RequestBody ItTaskMain main) {
|
||||
public RestResult put(@RequestBody PsTaskMain main) {
|
||||
return RestResult.ok(service.update(main));
|
||||
}
|
||||
|
||||
@@ -40,6 +40,6 @@ public class ItTaskMainApi {
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private ItTaskMainService service;
|
||||
private PsTaskMainService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.zsvg.vboot.ps.task.main;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface PsTaskMainRepo extends JpaRepository<PsTaskMain,String> {
|
||||
|
||||
|
||||
}
|
||||
+4
-3
@@ -1,4 +1,4 @@
|
||||
package com.zsvg.vboot.it.proj.main;
|
||||
package com.zsvg.vboot.ps.task.main;
|
||||
|
||||
import com.zsvg.vboot.common.mvc.service.BaseMainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -7,16 +7,17 @@ import org.springframework.stereotype.Service;
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Service
|
||||
public class ItProjMainService extends BaseMainService<ItProjMain> {
|
||||
public class PsTaskMainService extends BaseMainService<PsTaskMain> {
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private ItProjMainRepo repo;
|
||||
private PsTaskMainRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user