forked from gitee/vben-java
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2bdf86eafb |
@@ -1,4 +1,4 @@
|
||||
### 🍿 项目简介
|
||||
### 🍿 项目简介
|
||||
|
||||
[](https://gitee.com/vben/vben-java)
|
||||
[]()
|
||||
@@ -144,7 +144,7 @@ RuoYi-Vue-Plus框架对分布式支持比较好,vben-java框架在支持分布
|
||||
<td align="center">数据权限</td>
|
||||
<td>采用 Mybatis-Plus 插件 自行分析拼接SQL 无感式过滤只需为Mapper设置好注解条件 支持多种自定义 不限于部门角色
|
||||
</td>
|
||||
<td align="center">√ 可采用此方式,另外组织架构模块增加了群组模块,可实现更灵活的数据权限控制</td>
|
||||
<td align="center">√ 可采用此方式,另外系统成员模块增加了群组模块,可实现更灵活的数据权限控制</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">数据脱敏</td>
|
||||
@@ -192,7 +192,7 @@ RuoYi-Vue-Plus框架对分布式支持比较好,vben-java框架在支持分布
|
||||
<td align="center">数据库主键</td>
|
||||
<td>采用 雪花ID 基于时间戳的 有序增长 唯一ID 再也不用为分库分表 数据合并主键冲突重复而发愁</td>
|
||||
<td align="center">√
|
||||
支持雪花ID,为了兼容性支持,特别是需要与其他业务系统关联的基础组织架构模块,采用的是32位字符串UUID方式
|
||||
支持雪花ID,为了兼容性支持,特别是需要与其他业务系统关联的基础系统成员模块,采用的是32位字符串UUID方式
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -326,6 +326,12 @@
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.zsvg</groupId>
|
||||
<artifactId>vben-im</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
||||
@@ -217,8 +217,7 @@ xss:
|
||||
# 排除链接
|
||||
excludeUrls:
|
||||
- /system/notice
|
||||
- /oa/flow/tmpl
|
||||
- /bpm/bus/tmpl
|
||||
- /bpm/bust
|
||||
|
||||
--- # 分布式锁 lock4j 全局配置
|
||||
lock4j:
|
||||
|
||||
+8
-8
@@ -18,7 +18,7 @@ import java.util.concurrent.TimeUnit;
|
||||
* 关联分类表案例
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("demo/link/cate")
|
||||
@RequestMapping("demo/linkc")
|
||||
@RequiredArgsConstructor
|
||||
public class DemoLinkCateController {
|
||||
|
||||
@@ -31,7 +31,7 @@ public class DemoLinkCateController {
|
||||
* @return 案例树状数据
|
||||
*/
|
||||
@GetMapping("tree")
|
||||
@SaCheckPermission("link:cate:query")
|
||||
@SaCheckPermission("demo:linkc:query")
|
||||
public R<List<Ltree>> getTree(String name, Long id) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
List<Ltree> list = service.findTreeList(sqler, name, id);
|
||||
@@ -44,7 +44,7 @@ public class DemoLinkCateController {
|
||||
* @return 案例列表数据
|
||||
*/
|
||||
@GetMapping("list")
|
||||
@SaCheckPermission("link:cate:query")
|
||||
@SaCheckPermission("demo:linkc:query")
|
||||
public R<List<DemoLinkCate>> getList(String name) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
sqler.addLike("t.name", name);
|
||||
@@ -59,7 +59,7 @@ public class DemoLinkCateController {
|
||||
* @return 案例对象
|
||||
*/
|
||||
@GetMapping("info/{id}")
|
||||
@SaCheckPermission("link:cate:query")
|
||||
@SaCheckPermission("demo:linkc:query")
|
||||
public R<DemoLinkCate> info(@PathVariable Long id) {
|
||||
DemoLinkCate cate = service.select(id);
|
||||
return R.ok(cate);
|
||||
@@ -71,7 +71,7 @@ public class DemoLinkCateController {
|
||||
* @return 案例ID
|
||||
*/
|
||||
@PostMapping
|
||||
@SaCheckPermission("link:cate:add")
|
||||
@SaCheckPermission("demo:linkc:add")
|
||||
@Log(title = "综合树表案例", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit(interval = 2, timeUnit = TimeUnit.SECONDS, message = "{repeat.submit.message}")
|
||||
public R<Long> post(@RequestBody DemoLinkCate cate) {
|
||||
@@ -85,7 +85,7 @@ public class DemoLinkCateController {
|
||||
*/
|
||||
@PutMapping
|
||||
@RepeatSubmit
|
||||
@SaCheckPermission("link:cate:edit")
|
||||
@SaCheckPermission("demo:linkc:edit")
|
||||
@Log(title = "关联分类表案例", businessType = BusinessType.UPDATE)
|
||||
public R<Long> put(@RequestBody DemoLinkCate cate) {
|
||||
return R.ok(null, service.update(cate, table));
|
||||
@@ -97,7 +97,7 @@ public class DemoLinkCateController {
|
||||
* @return 删除的案例数量
|
||||
*/
|
||||
@DeleteMapping("{ids}")
|
||||
@SaCheckPermission("link:cate:remove")
|
||||
@SaCheckPermission("demo:linkc:delete")
|
||||
@Log(title = "关联分类表案例", businessType = BusinessType.DELETE)
|
||||
public R<Integer> delete(@PathVariable Long[] ids) {
|
||||
return R.ok(service.delete(ids));
|
||||
@@ -108,7 +108,7 @@ public class DemoLinkCateController {
|
||||
* @param bo 移动对象
|
||||
*/
|
||||
@PostMapping("move")
|
||||
@SaCheckPermission("link:cate:edit")
|
||||
@SaCheckPermission("demo:linkc:edit")
|
||||
@Log(title = "关联分类表案例", businessType = BusinessType.OTHER)
|
||||
public R<Void> move(@RequestBody Lmove bo) {
|
||||
service.move(bo, table);
|
||||
|
||||
+5
-5
@@ -5,7 +5,7 @@ import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import vben.common.jpa.entity.BaseMainEntity;
|
||||
import vben.common.jpa.entity.SysOrg;
|
||||
import vben.common.jpa.entity.SysActor;
|
||||
import vben.jpa.demo.link.item.DemoLinkItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -19,7 +19,7 @@ import java.util.List;
|
||||
@Setter
|
||||
@Schema(description = "关联主表")
|
||||
@Table(indexes = {@Index(columnList = "cruid"), @Index(columnList = "upuid")})
|
||||
public class DemoLinkMain extends BaseMainEntity {
|
||||
public class DemoLink extends BaseMainEntity {
|
||||
|
||||
/**
|
||||
* 所属分类ID
|
||||
@@ -40,9 +40,9 @@ public class DemoLinkMain extends BaseMainEntity {
|
||||
* 成员列表(ManyToMany示例)
|
||||
*/
|
||||
@ManyToMany
|
||||
@JoinTable(name = "demo_link_main_org", joinColumns = {@JoinColumn(name = "mid")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "oid")})
|
||||
@JoinTable(name = "demo_link_actor", joinColumns = {@JoinColumn(name = "mid")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "aid")})
|
||||
@Schema(description = "成员信息")
|
||||
private List<SysOrg> orgs;
|
||||
private List<SysActor> actors;
|
||||
|
||||
}
|
||||
+13
-13
@@ -16,9 +16,9 @@ import java.util.concurrent.TimeUnit;
|
||||
* 关联主表案例
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("demo/link/main")
|
||||
@RequestMapping("demo/link")
|
||||
@RequiredArgsConstructor
|
||||
public class DemoLinkMainController {
|
||||
public class DemoLinkController {
|
||||
|
||||
/**
|
||||
* 关联主表-分页查询
|
||||
@@ -26,10 +26,10 @@ public class DemoLinkMainController {
|
||||
* @param catid 分类ID
|
||||
* @return XX分页数据
|
||||
*/
|
||||
@SaCheckPermission("link:main:query")
|
||||
@SaCheckPermission("demo:link:query")
|
||||
@GetMapping
|
||||
public R<PageData> get(String name,Long catid) {
|
||||
Sqler sqler = new Sqler("demo_link_main");
|
||||
Sqler sqler = new Sqler("demo_link");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.notes");
|
||||
sqler.addEqual("t.catid", catid);
|
||||
@@ -42,10 +42,10 @@ public class DemoLinkMainController {
|
||||
* @param id ID
|
||||
* @return XX对象
|
||||
*/
|
||||
@SaCheckPermission("link:main:query")
|
||||
@SaCheckPermission("demo:link:query")
|
||||
@GetMapping("info/{id}")
|
||||
public R<DemoLinkMain> info(@PathVariable Long id) {
|
||||
DemoLinkMain main = service.select(id);
|
||||
public R<DemoLink> info(@PathVariable Long id) {
|
||||
DemoLink main = service.select(id);
|
||||
return R.ok(main);
|
||||
}
|
||||
|
||||
@@ -54,11 +54,11 @@ public class DemoLinkMainController {
|
||||
* @param main XX对象
|
||||
* @return ID
|
||||
*/
|
||||
@SaCheckPermission("link:main:add")
|
||||
@SaCheckPermission("demo:link:add")
|
||||
@Log(title = "关联主表案例", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit(interval = 2, timeUnit = TimeUnit.SECONDS, message = "{repeat.submit.message}")
|
||||
@PostMapping
|
||||
public R<Long> post(@RequestBody DemoLinkMain main) {
|
||||
public R<Long> post(@RequestBody DemoLink main) {
|
||||
return R.ok(null,service.insert(main));
|
||||
}
|
||||
|
||||
@@ -67,11 +67,11 @@ public class DemoLinkMainController {
|
||||
* @param main XX对象
|
||||
* @return ID
|
||||
*/
|
||||
@SaCheckPermission("link:main:edit")
|
||||
@SaCheckPermission("demo:link:edit")
|
||||
@Log(title = "关联主表案例", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping
|
||||
public R<Long> put(@RequestBody DemoLinkMain main) {
|
||||
public R<Long> put(@RequestBody DemoLink main) {
|
||||
return R.ok(null,service.update(main));
|
||||
}
|
||||
|
||||
@@ -80,13 +80,13 @@ public class DemoLinkMainController {
|
||||
* @param ids ID串
|
||||
* @return 删除的XX数量
|
||||
*/
|
||||
@SaCheckPermission("link:main:remove")
|
||||
@SaCheckPermission("demo:link:delete")
|
||||
@Log(title = "关联主表案例", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("{ids}")
|
||||
public R<Integer> delete(@PathVariable Long[] ids) {
|
||||
return R.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
private final DemoLinkMainService service;
|
||||
private final DemoLinkService service;
|
||||
|
||||
}
|
||||
+1
-1
@@ -2,7 +2,7 @@ package vben.jpa.demo.link.main;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface DemoLinkMainRepo extends JpaRepository<DemoLinkMain,Long> {
|
||||
public interface DemoLinkRepo extends JpaRepository<DemoLink,Long> {
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -8,9 +8,9 @@ import vben.common.jpa.service.BaseMainService;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DemoLinkMainService extends BaseMainService<DemoLinkMain> {
|
||||
public class DemoLinkService extends BaseMainService<DemoLink> {
|
||||
|
||||
private final DemoLinkMainRepo repo;
|
||||
private final DemoLinkRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
@@ -0,0 +1,46 @@
|
||||
package vben.jpa.demo.perm.way1;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import vben.common.jpa.entity.BaseMainEntity;
|
||||
import vben.common.jpa.entity.SysActor;
|
||||
|
||||
/**
|
||||
* 数据权限案例1
|
||||
*/
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "数据权限案例1")
|
||||
public class DemoPerm1 extends BaseMainEntity {
|
||||
|
||||
// /**
|
||||
// * 归属用户ID
|
||||
// */
|
||||
// @Schema(description = "归属用户ID")
|
||||
// private String bluid;
|
||||
|
||||
/**
|
||||
* 归属用户ID
|
||||
*/
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "bluid")
|
||||
@Schema(description = "归属用户")
|
||||
private SysActor blman;
|
||||
|
||||
// /**
|
||||
// * 归属组织ID
|
||||
// */
|
||||
// @Schema(description = "归属组织ID")
|
||||
// private String bloid;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "bloid")
|
||||
@Schema(description = "归属组织")
|
||||
private SysActor blorg;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package vben.jpa.demo.perm.way1;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import vben.common.core.domain.R;
|
||||
import vben.common.idempotent.annotation.RepeatSubmit;
|
||||
import vben.common.jdbc.dto.PageData;
|
||||
import vben.common.jdbc.sqler.Sqler;
|
||||
import vben.common.log.annotation.Log;
|
||||
import vben.common.log.enums.BusinessType;
|
||||
|
||||
/**
|
||||
* 数据权限案例1
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("demo/perm1")
|
||||
@RequiredArgsConstructor
|
||||
public class DemoPerm1Controller {
|
||||
|
||||
/**
|
||||
* 数据权限案例1-分页查询
|
||||
* @param name XX名称
|
||||
* @return XX分页数据
|
||||
*/
|
||||
@GetMapping
|
||||
@SaCheckPermission("demo:perm1:query")
|
||||
public R<PageData> get(String name) {
|
||||
Sqler sqler = new Sqler("demo_perm1");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.notes");
|
||||
sqler.addLeftJoin("a1.name bluna", "sys_actor a1", "a1.id=t.bluid");
|
||||
sqler.addLeftJoin("a2.name blona", "sys_actor a2", "a2.id=t.bloid");
|
||||
return R.ok(service.findPageDataByPerm(sqler));
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据权限案例1-详情查询
|
||||
* @param id ID
|
||||
* @return XX对象
|
||||
*/
|
||||
@GetMapping("info/{id}")
|
||||
@SaCheckPermission("demo:perm1:query")
|
||||
public R<DemoPerm1> info(@PathVariable Long id) {
|
||||
DemoPerm1 main = service.select(id);
|
||||
service.checkPerm(main.getBlman().getId(), main.getBlorg().getId());
|
||||
return R.ok(main);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据权限案例1-新增
|
||||
* @param main XX对象
|
||||
* @return ID
|
||||
*/
|
||||
@PostMapping
|
||||
@SaCheckPermission("demo:perm1:add")
|
||||
@Log(title = "数据权限案例1", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit
|
||||
public R<Long> post(@RequestBody DemoPerm1 main) {
|
||||
return R.ok(null,service.insert(main));
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据权限案例1-修改
|
||||
* @param main XX对象
|
||||
* @return ID
|
||||
*/
|
||||
@PutMapping
|
||||
@RepeatSubmit
|
||||
@SaCheckPermission("demo:perm1:edit")
|
||||
@Log(title = "数据权限案例1", businessType = BusinessType.UPDATE)
|
||||
public R<Long> put(@RequestBody DemoPerm1 main) {
|
||||
DemoPerm1 dbMain = service.select(main.getId());
|
||||
service.checkPerm(dbMain.getBlman().getId(), dbMain.getBlorg().getId());
|
||||
return R.ok(null,service.update(main));
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据权限案例1-删除
|
||||
* @param ids ID串
|
||||
* @return 删除的XX数量
|
||||
*/
|
||||
@DeleteMapping("{ids}")
|
||||
@SaCheckPermission("demo:perm1:delete")
|
||||
@Log(title = "数据权限案例1", businessType = BusinessType.DELETE)
|
||||
public R<Integer> delete(@PathVariable Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
DemoPerm1 main = service.select(id);
|
||||
service.checkPerm(main.getBlman().getId(), main.getBlorg().getId());
|
||||
}
|
||||
return R.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
private final DemoPerm1Service service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package vben.jpa.demo.perm.way1;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface DemoPerm1Repo extends JpaRepository<DemoPerm1,Long> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package vben.jpa.demo.perm.way1;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import vben.common.jpa.service.BaseMainService;
|
||||
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DemoPerm1Service extends BaseMainService<DemoPerm1> {
|
||||
|
||||
private final DemoPerm1Repo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package vben.jpa.demo.perm.way2;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.JoinTable;
|
||||
import jakarta.persistence.ManyToMany;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import vben.common.jpa.entity.BaseMainEntity;
|
||||
import vben.common.jpa.entity.SysActor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据权限案例2
|
||||
*/
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "数据权限案例2")
|
||||
public class DemoPerm2 extends BaseMainEntity {
|
||||
|
||||
/**
|
||||
* 可查看者
|
||||
*/
|
||||
@ManyToMany
|
||||
@JoinTable(name = "demo_perm2vimen", joinColumns = {@JoinColumn(name = "mid")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "aid")})
|
||||
@Schema(description = "可查看者")
|
||||
private List<SysActor> vimen;
|
||||
|
||||
/**
|
||||
* 可编辑者
|
||||
*/
|
||||
@ManyToMany
|
||||
@JoinTable(name = "demo_perm2edmen", joinColumns = {@JoinColumn(name = "mid")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "aid")})
|
||||
@Schema(description = "可查看者")
|
||||
private List<SysActor> edmen;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package vben.jpa.demo.perm.way2;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import vben.common.core.domain.R;
|
||||
import vben.common.idempotent.annotation.RepeatSubmit;
|
||||
import vben.common.jdbc.dto.PageData;
|
||||
import vben.common.jdbc.sqler.Sqler;
|
||||
import vben.common.log.annotation.Log;
|
||||
import vben.common.log.enums.BusinessType;
|
||||
|
||||
/**
|
||||
* 数据权限案例2
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("demo/perm2")
|
||||
@RequiredArgsConstructor
|
||||
public class DemoPerm2Controller {
|
||||
|
||||
/**
|
||||
* 数据权限案例2-分页查询
|
||||
* @param name XX名称
|
||||
* @return XX分页数据
|
||||
*/
|
||||
@GetMapping
|
||||
@SaCheckPermission("demo:perm2:query")
|
||||
public R<PageData> get(String name) {
|
||||
Sqler sqler = new Sqler("demo_perm2");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.notes");
|
||||
return R.ok(service.findPageDataByViewPerm(sqler,"demo_perm2_vimen"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据权限案例2-详情查询
|
||||
* @param id ID
|
||||
* @return XX对象
|
||||
*/
|
||||
@GetMapping("info/{id}")
|
||||
@SaCheckPermission("demo:perm2:query")
|
||||
public R<DemoPerm2> info(@PathVariable Long id) {
|
||||
DemoPerm2 main = service.select(id);
|
||||
service.checkViewPerm(main.getId(),"demo_perm2_vimen");
|
||||
return R.ok(main);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据权限案例2-新增
|
||||
* @param main XX对象
|
||||
* @return ID
|
||||
*/
|
||||
@PostMapping
|
||||
@SaCheckPermission("demo:perm2:add")
|
||||
@Log(title = "数据权限案例2", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit
|
||||
public R<Long> post(@RequestBody DemoPerm2 main) {
|
||||
return R.ok(null,service.insert(main));
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据权限案例2-修改
|
||||
* @param main XX对象
|
||||
* @return ID
|
||||
*/
|
||||
@PutMapping
|
||||
@RepeatSubmit
|
||||
@SaCheckPermission("demo:perm2:edit")
|
||||
@Log(title = "数据权限案例2", businessType = BusinessType.UPDATE)
|
||||
public R<Long> put(@RequestBody DemoPerm2 main) {
|
||||
service.checkEditPerm(main.getId(),"demo_perm2_edmen");
|
||||
return R.ok(null,service.update(main));
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据权限案例2-删除
|
||||
* @param ids ID串
|
||||
* @return 删除的XX数量
|
||||
*/
|
||||
@DeleteMapping("{ids}")
|
||||
@SaCheckPermission("demo:perm2:delete")
|
||||
@Log(title = "数据权限案例2", businessType = BusinessType.DELETE)
|
||||
public R<Integer> delete(@PathVariable Long[] ids) {
|
||||
for (Long id : ids) {
|
||||
service.checkEditPerm(id,"demo_perm2_edmen");
|
||||
}
|
||||
return R.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
private final DemoPerm2Service service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package vben.jpa.demo.perm.way2;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface DemoPerm2Repo extends JpaRepository<DemoPerm2,Long> {
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package vben.jpa.demo.perm.way2;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import vben.common.jpa.service.BaseMainService;
|
||||
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DemoPerm2Service extends BaseMainService<DemoPerm2> {
|
||||
|
||||
private final DemoPerm2Repo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+7
-7
@@ -17,7 +17,7 @@ import java.util.concurrent.TimeUnit;
|
||||
* 单一树表案例
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("demo/single/cate")
|
||||
@RequestMapping("demo/singlec")
|
||||
@RequiredArgsConstructor
|
||||
public class DemoSingleCateController {
|
||||
|
||||
@@ -30,7 +30,7 @@ public class DemoSingleCateController {
|
||||
* @return XX树状数据
|
||||
*/
|
||||
@GetMapping("tree")
|
||||
@SaCheckPermission("single:cate:query")
|
||||
@SaCheckPermission("demo:singlec:query")
|
||||
public R<List<Ltree>> getTree(String name, Long id) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
List<Ltree> list = service.findTreeList(sqler, name, id);
|
||||
@@ -43,7 +43,7 @@ public class DemoSingleCateController {
|
||||
* @return XX列表数据
|
||||
*/
|
||||
@GetMapping("list")
|
||||
@SaCheckPermission("single:cate:query")
|
||||
@SaCheckPermission("demo:singlec:query")
|
||||
public R<List<DemoSingleCate>> getList(String name) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
sqler.addLike("t.name", name);
|
||||
@@ -57,7 +57,7 @@ public class DemoSingleCateController {
|
||||
* @param id ID
|
||||
* @return XX对象
|
||||
*/
|
||||
@SaCheckPermission("single:cate:query")
|
||||
@SaCheckPermission("demo:singlec:query")
|
||||
@GetMapping("info/{id}")
|
||||
public R<DemoSingleCate> info(@PathVariable Long id) {
|
||||
DemoSingleCate cate = service.select(id);
|
||||
@@ -70,7 +70,7 @@ public class DemoSingleCateController {
|
||||
* @return ID
|
||||
*/
|
||||
@PostMapping
|
||||
@SaCheckPermission("single:cate:add")
|
||||
@SaCheckPermission("demo:singlec:add")
|
||||
@Log(title = "单一树表案例", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit(interval = 2, timeUnit = TimeUnit.SECONDS, message = "{repeat.submit.message}")
|
||||
public R<Long> post(@RequestBody DemoSingleCate cate) {
|
||||
@@ -84,7 +84,7 @@ public class DemoSingleCateController {
|
||||
*/
|
||||
@PutMapping
|
||||
@RepeatSubmit
|
||||
@SaCheckPermission("single:cate:edit")
|
||||
@SaCheckPermission("demo:singlec:edit")
|
||||
@Log(title = "单一树表案例", businessType = BusinessType.UPDATE)
|
||||
public R<Long> put(@RequestBody DemoSingleCate cate) {
|
||||
return R.ok(null, service.update(cate, table));
|
||||
@@ -97,7 +97,7 @@ public class DemoSingleCateController {
|
||||
*/
|
||||
@DeleteMapping("{ids}")
|
||||
@RepeatSubmit
|
||||
@SaCheckPermission("single:cate:delete")
|
||||
@SaCheckPermission("demo:singlec:delete")
|
||||
@Log(title = "单一树表案例", businessType = BusinessType.DELETE)
|
||||
public R<Integer> delete(@PathVariable Long[] ids) {
|
||||
return R.ok(service.delete(ids));
|
||||
|
||||
+1
-1
@@ -13,6 +13,6 @@ import vben.common.jpa.entity.BaseMainEntity;
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "单一主表")
|
||||
public class DemoSingleMain extends BaseMainEntity {
|
||||
public class DemoSingle extends BaseMainEntity {
|
||||
|
||||
}
|
||||
+13
-13
@@ -14,9 +14,9 @@ import vben.common.log.enums.BusinessType;
|
||||
* 单一主表案例
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("demo/single/main")
|
||||
@RequestMapping("demo/single")
|
||||
@RequiredArgsConstructor
|
||||
public class DemoSingleMainController {
|
||||
public class DemoSingleController {
|
||||
|
||||
/**
|
||||
* 单一主表-分页查询
|
||||
@@ -24,9 +24,9 @@ public class DemoSingleMainController {
|
||||
* @return XX分页数据
|
||||
*/
|
||||
@GetMapping
|
||||
@SaCheckPermission("single:main:query")
|
||||
@SaCheckPermission("demo:single:query")
|
||||
public R<PageData> get(String name) {
|
||||
Sqler sqler = new Sqler("demo_single_main");
|
||||
Sqler sqler = new Sqler("demo_single");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.notes");
|
||||
return R.ok(service.findPageData(sqler));
|
||||
@@ -38,9 +38,9 @@ public class DemoSingleMainController {
|
||||
* @return XX对象
|
||||
*/
|
||||
@GetMapping("info/{id}")
|
||||
@SaCheckPermission("single:main:query")
|
||||
public R<DemoSingleMain> info(@PathVariable Long id) {
|
||||
DemoSingleMain main = service.select(id);
|
||||
@SaCheckPermission("demo:single:query")
|
||||
public R<DemoSingle> info(@PathVariable Long id) {
|
||||
DemoSingle main = service.select(id);
|
||||
return R.ok(main);
|
||||
}
|
||||
|
||||
@@ -50,11 +50,11 @@ public class DemoSingleMainController {
|
||||
* @return ID
|
||||
*/
|
||||
@PostMapping
|
||||
@SaCheckPermission("single:main:add")
|
||||
@SaCheckPermission("demo:single:add")
|
||||
@Log(title = "单一主表案例", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit
|
||||
// @RepeatSubmit(interval = 2, timeUnit = TimeUnit.SECONDS, message = "{repeat.submit.message}")
|
||||
public R<Long> post(@RequestBody DemoSingleMain main) {
|
||||
public R<Long> post(@RequestBody DemoSingle main) {
|
||||
return R.ok(null,service.insert(main));
|
||||
}
|
||||
|
||||
@@ -65,9 +65,9 @@ public class DemoSingleMainController {
|
||||
*/
|
||||
@PutMapping
|
||||
@RepeatSubmit
|
||||
@SaCheckPermission("single:main:edit")
|
||||
@SaCheckPermission("demo:single:edit")
|
||||
@Log(title = "单一主表案例", businessType = BusinessType.UPDATE)
|
||||
public R<Long> put(@RequestBody DemoSingleMain main) {
|
||||
public R<Long> put(@RequestBody DemoSingle main) {
|
||||
return R.ok(null,service.update(main));
|
||||
}
|
||||
|
||||
@@ -77,12 +77,12 @@ public class DemoSingleMainController {
|
||||
* @return 删除的XX数量
|
||||
*/
|
||||
@DeleteMapping("{ids}")
|
||||
@SaCheckPermission("single:main:remove")
|
||||
@SaCheckPermission("demo:single:delete")
|
||||
@Log(title = "单一主表案例", businessType = BusinessType.DELETE)
|
||||
public R<Integer> delete(@PathVariable Long[] ids) {
|
||||
return R.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
private final DemoSingleMainService service;
|
||||
private final DemoSingleService service;
|
||||
|
||||
}
|
||||
+1
-1
@@ -2,7 +2,7 @@ package vben.jpa.demo.single.main;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface DemoSingleMainRepo extends JpaRepository<DemoSingleMain,Long> {
|
||||
public interface DemoSingleRepo extends JpaRepository<DemoSingle,Long> {
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -8,9 +8,9 @@ import vben.common.jpa.service.BaseMainService;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DemoSingleMainService extends BaseMainService<DemoSingleMain> {
|
||||
public class DemoSingleService extends BaseMainService<DemoSingle> {
|
||||
|
||||
private final DemoSingleMainRepo repo;
|
||||
private final DemoSingleRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
@@ -217,8 +217,7 @@ xss:
|
||||
# 排除链接
|
||||
excludeUrls:
|
||||
- /system/notice
|
||||
- /oa/flow/tmpl
|
||||
- /bpm/bus/tmpl
|
||||
- /bpm/bust
|
||||
|
||||
--- # 分布式锁 lock4j 全局配置
|
||||
lock4j:
|
||||
|
||||
+8
-8
@@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit;
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("demo/link/cate")
|
||||
@RequestMapping("demo/linkc")
|
||||
public class DemoLinkCateController {
|
||||
|
||||
private final DemoLinkCateService service;
|
||||
@@ -38,7 +38,7 @@ public class DemoLinkCateController {
|
||||
* @param id 排除的案例ID
|
||||
* @return 案例树状数据
|
||||
*/
|
||||
@SaCheckPermission("link:cate:query")
|
||||
@SaCheckPermission("demp:linkc:query")
|
||||
@GetMapping("tree")
|
||||
public R<List<Ltree>> getTree(String name, Long id) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
@@ -51,7 +51,7 @@ public class DemoLinkCateController {
|
||||
* @param name 案例名称
|
||||
* @return 案例列表数据
|
||||
*/
|
||||
@SaCheckPermission("link:cate:query")
|
||||
@SaCheckPermission("demp:linkc:query")
|
||||
@GetMapping("list")
|
||||
public R<List<DemoLinkCate>> getList(String name) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
@@ -66,7 +66,7 @@ public class DemoLinkCateController {
|
||||
* @param name 案例名称
|
||||
* @return 案例分页数据
|
||||
*/
|
||||
@SaCheckPermission("link:cate:query")
|
||||
@SaCheckPermission("demp:linkc:query")
|
||||
@GetMapping
|
||||
public R<PageData> get(String name) {
|
||||
Sqler sqler = new Sqler("demo_easy_main");
|
||||
@@ -81,7 +81,7 @@ public class DemoLinkCateController {
|
||||
* @param id 案例ID
|
||||
* @return 案例对象
|
||||
*/
|
||||
@SaCheckPermission("link:cate:query")
|
||||
@SaCheckPermission("demp:linkc:query")
|
||||
@GetMapping("info/{id}")
|
||||
public R<DemoLinkCate> info(@PathVariable("id") Long id) {
|
||||
return R.ok(service.select(id));
|
||||
@@ -92,7 +92,7 @@ public class DemoLinkCateController {
|
||||
* @param cate 案例对象
|
||||
* @return 案例ID
|
||||
*/
|
||||
@SaCheckPermission("link:cate:add")
|
||||
@SaCheckPermission("demp:linkc:add")
|
||||
@Log(title = "综合树表案例", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit(interval = 2, timeUnit = TimeUnit.SECONDS, message = "{repeat.submit.message}")
|
||||
@PostMapping
|
||||
@@ -106,7 +106,7 @@ public class DemoLinkCateController {
|
||||
* @param cate 案例对象
|
||||
* @return 案例ID
|
||||
*/
|
||||
@SaCheckPermission("link:cate:edit")
|
||||
@SaCheckPermission("demp:linkc:edit")
|
||||
@Log(title = "关联分类表", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping
|
||||
@@ -119,7 +119,7 @@ public class DemoLinkCateController {
|
||||
* @param ids 案例ID串
|
||||
* @return 删除的案例数量
|
||||
*/
|
||||
@SaCheckPermission("link:cate:remove")
|
||||
@SaCheckPermission("demp:linkc:delete")
|
||||
@Log(title = "关联分类表", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("{ids}")
|
||||
public R<Integer> delete(@PathVariable Long[] ids) {
|
||||
|
||||
+4
-4
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import vben.common.mybatis.core.domain.BaseMainEntity;
|
||||
import vben.common.mybatis.core.domain.SysOrg;
|
||||
import vben.common.mybatis.core.domain.SysActor;
|
||||
import vben.mybatis.demo.link.item.DemoLinkItem;
|
||||
|
||||
import java.io.Serial;
|
||||
@@ -17,8 +17,8 @@ import java.util.List;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("demo_link_main")
|
||||
public class DemoLinkMain extends BaseMainEntity {
|
||||
@TableName("demo_link")
|
||||
public class DemoLink extends BaseMainEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -36,6 +36,6 @@ public class DemoLinkMain extends BaseMainEntity {
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<SysOrg> orgs;
|
||||
private List<SysActor> actors;
|
||||
|
||||
}
|
||||
+12
-12
@@ -23,10 +23,10 @@ import java.util.concurrent.TimeUnit;
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("demo/link/main")
|
||||
public class DemoLinkMainController {
|
||||
@RequestMapping("demo/link")
|
||||
public class DemoLinkController {
|
||||
|
||||
private final DemoLinkMainService service;
|
||||
private final DemoLinkService service;
|
||||
|
||||
/**
|
||||
* 关联主表-分页查询
|
||||
@@ -34,10 +34,10 @@ public class DemoLinkMainController {
|
||||
* @param catid 分类ID
|
||||
* @return XX分页数据
|
||||
*/
|
||||
@SaCheckPermission("link:main:query")
|
||||
@SaCheckPermission("demo:link:query")
|
||||
@GetMapping
|
||||
public R<PageData> get(String name,Long catid) {
|
||||
Sqler sqler = new Sqler("demo_link_main");
|
||||
Sqler sqler = new Sqler("demo_link");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.notes");
|
||||
sqler.addEqual("t.catid", catid);
|
||||
@@ -50,9 +50,9 @@ public class DemoLinkMainController {
|
||||
* @param id ID
|
||||
* @return XX对象
|
||||
*/
|
||||
@SaCheckPermission("link:main:query")
|
||||
@SaCheckPermission("demo:link:query")
|
||||
@GetMapping("info/{id}")
|
||||
public R<DemoLinkMain> info(@NotNull(message = "主键不能为空")
|
||||
public R<DemoLink> info(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return R.ok(service.selectx(id));
|
||||
}
|
||||
@@ -62,11 +62,11 @@ public class DemoLinkMainController {
|
||||
* @param main XX对象
|
||||
* @return ID
|
||||
*/
|
||||
@SaCheckPermission("link:main:add")
|
||||
@SaCheckPermission("demo:link:add")
|
||||
@Log(title = "关联主表", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit(interval = 2, timeUnit = TimeUnit.SECONDS, message = "{repeat.submit.message}")
|
||||
@PostMapping
|
||||
public R<Long> post(@RequestBody DemoLinkMain main) {
|
||||
public R<Long> post(@RequestBody DemoLink main) {
|
||||
return R.ok(null,service.insertx(main));
|
||||
}
|
||||
|
||||
@@ -75,11 +75,11 @@ public class DemoLinkMainController {
|
||||
* @param main XX对象
|
||||
* @return ID
|
||||
*/
|
||||
@SaCheckPermission("link:main:edit")
|
||||
@SaCheckPermission("demo:link:edit")
|
||||
@Log(title = "关联主表", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping
|
||||
public R<Long> put(@RequestBody DemoLinkMain main) {
|
||||
public R<Long> put(@RequestBody DemoLink main) {
|
||||
return R.ok(null,service.updatex(main));
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class DemoLinkMainController {
|
||||
* @param ids ID串
|
||||
* @return 删除的XX数量
|
||||
*/
|
||||
@SaCheckPermission("link:main:remove")
|
||||
@SaCheckPermission("demo:link:delete")
|
||||
@Log(title = "关联主表", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("{ids}")
|
||||
public R<Integer> delete(@PathVariable Long[] ids) {
|
||||
+1
-1
@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface DemoLinkMainMapper extends BaseMapper<DemoLinkMain> {
|
||||
public interface DemoLinkMapper extends BaseMapper<DemoLink> {
|
||||
|
||||
|
||||
}
|
||||
+21
-21
@@ -6,25 +6,25 @@ import jakarta.annotation.PostConstruct;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import vben.common.mybatis.core.domain.SysOrg;
|
||||
import vben.common.mybatis.core.domain.SysActor;
|
||||
import vben.common.mybatis.core.service.BaseMainService;
|
||||
import vben.mybatis.demo.link.item.DemoLinkItem;
|
||||
import vben.mybatis.demo.link.item.DemoLinkItemMapper;
|
||||
import vben.mybatis.demo.link.mid.DemoLinkMainOrg;
|
||||
import vben.mybatis.demo.link.mid.DemoLinkMainOrgMapper;
|
||||
import vben.mybatis.demo.link.mid.DemoLinkActor;
|
||||
import vben.mybatis.demo.link.mid.DemoLinkActorMapper;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DemoLinkMainService extends BaseMainService<DemoLinkMain> {
|
||||
public class DemoLinkService extends BaseMainService<DemoLink> {
|
||||
|
||||
private final DemoLinkMainMapper mapper;
|
||||
private final DemoLinkMapper mapper;
|
||||
|
||||
private final DemoLinkItemMapper itemMapper;
|
||||
|
||||
private final DemoLinkMainOrgMapper midMapper;
|
||||
private final DemoLinkActorMapper midMapper;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
@@ -32,43 +32,43 @@ public class DemoLinkMainService extends BaseMainService<DemoLinkMain> {
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public DemoLinkMain selectx(Long id) {
|
||||
DemoLinkMain main = select(id);
|
||||
public DemoLink selectx(Long id) {
|
||||
DemoLink main = select(id);
|
||||
//一对多关联查询
|
||||
main.setItems(itemMapper.selectList(new LambdaQueryWrapper<DemoLinkItem>().eq(DemoLinkItem::getMaiid, main.getId())));
|
||||
//多对多关联查询
|
||||
List<SysOrg> list = Joins.of(SysOrg.class)
|
||||
.leftJoin(DemoLinkMainOrg.class,DemoLinkMainOrg::getOid,SysOrg::getId)
|
||||
.eq(DemoLinkMainOrg::getMid,id).end()
|
||||
.joinList(SysOrg.class);
|
||||
main.setOrgs(list);
|
||||
List<SysActor> list = Joins.of(SysActor.class)
|
||||
.leftJoin(DemoLinkActor.class, DemoLinkActor::getAid, SysActor::getId)
|
||||
.eq(DemoLinkActor::getMid,id).end()
|
||||
.joinList(SysActor.class);
|
||||
main.setActors(list);
|
||||
return main;
|
||||
}
|
||||
|
||||
public Long insertx(DemoLinkMain main) {
|
||||
public Long insertx(DemoLink main) {
|
||||
insert(main);
|
||||
for (DemoLinkItem item : main.getItems()) {
|
||||
item.setMaiid(main.getId());
|
||||
itemMapper.insert(item);
|
||||
}
|
||||
for (SysOrg sysOrg : main.getOrgs()) {
|
||||
DemoLinkMainOrg mid = new DemoLinkMainOrg(main.getId(),sysOrg.getId());
|
||||
for (SysActor sysActor : main.getActors()) {
|
||||
DemoLinkActor mid = new DemoLinkActor(main.getId(), sysActor.getId());
|
||||
midMapper.insert(mid);
|
||||
}
|
||||
return main.getId();
|
||||
}
|
||||
|
||||
public Long updatex(DemoLinkMain main) {
|
||||
public Long updatex(DemoLink main) {
|
||||
//先删
|
||||
itemMapper.delete(new LambdaQueryWrapper<DemoLinkItem>().eq(DemoLinkItem::getMaiid, main.getId()));
|
||||
midMapper.delete(new LambdaQueryWrapper<DemoLinkMainOrg>().eq(DemoLinkMainOrg::getMid, main.getId()));
|
||||
midMapper.delete(new LambdaQueryWrapper<DemoLinkActor>().eq(DemoLinkActor::getMid, main.getId()));
|
||||
//后增
|
||||
update(main);
|
||||
for (DemoLinkItem item : main.getItems()) {
|
||||
itemMapper.insert(item);
|
||||
}
|
||||
for (SysOrg sysOrg : main.getOrgs()) {
|
||||
DemoLinkMainOrg mid = new DemoLinkMainOrg(main.getId(),sysOrg.getId());
|
||||
for (SysActor sysActor : main.getActors()) {
|
||||
DemoLinkActor mid = new DemoLinkActor(main.getId(), sysActor.getId());
|
||||
midMapper.insert(mid);
|
||||
}
|
||||
return main.getId();
|
||||
@@ -77,7 +77,7 @@ public class DemoLinkMainService extends BaseMainService<DemoLinkMain> {
|
||||
public Integer deletex(Long[] ids) {
|
||||
List<Long> list= Arrays.asList(ids);
|
||||
itemMapper.delete(new LambdaQueryWrapper<DemoLinkItem>().in(DemoLinkItem::getMaiid, list));
|
||||
midMapper.delete(new LambdaQueryWrapper<DemoLinkMainOrg>().in(DemoLinkMainOrg::getMid, list));
|
||||
midMapper.delete(new LambdaQueryWrapper<DemoLinkActor>().in(DemoLinkActor::getMid, list));
|
||||
return delete(ids);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -8,13 +8,13 @@ import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode
|
||||
@TableName("demo_link_main_org")
|
||||
@TableName("demo_link_actor")
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DemoLinkMainOrg {
|
||||
public class DemoLinkActor {
|
||||
|
||||
private Long mid;
|
||||
|
||||
private String oid;
|
||||
private String aid;
|
||||
|
||||
}
|
||||
+1
-1
@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface DemoLinkMainOrgMapper extends BaseMapper<DemoLinkMainOrg> {
|
||||
public interface DemoLinkActorMapper extends BaseMapper<DemoLinkActor> {
|
||||
|
||||
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class TestDemo extends BaseEntity {
|
||||
/**
|
||||
* 部门id
|
||||
*/
|
||||
private Long deptId;
|
||||
private Long orgid;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
|
||||
@@ -31,7 +31,7 @@ public class TestDemoBo extends BaseEntity {
|
||||
* 部门id
|
||||
*/
|
||||
@NotNull(message = "部门id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long deptId;
|
||||
private Long orgid;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
|
||||
+1
-1
@@ -132,7 +132,7 @@ public class TestDemoController extends BaseController {
|
||||
*
|
||||
* @param ids 测试ID串
|
||||
*/
|
||||
@SaCheckPermission("demo:demo:remove")
|
||||
@SaCheckPermission("demo:demo:delete")
|
||||
@Log(title = "测试单表", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
|
||||
@@ -19,7 +19,7 @@ public class TestDemoImportVo {
|
||||
*/
|
||||
@NotNull(message = "部门id不能为空")
|
||||
@ExcelProperty(value = "部门id")
|
||||
private Long deptId;
|
||||
private Long orgid;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
|
||||
+8
-8
@@ -28,7 +28,7 @@ import java.util.concurrent.TimeUnit;
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("demo/single/cate")
|
||||
@RequestMapping("demo/singlec")
|
||||
public class DemoSingleCateController {
|
||||
|
||||
private final DemoSingleCateService service;
|
||||
@@ -43,7 +43,7 @@ public class DemoSingleCateController {
|
||||
* @param id 排除的ID
|
||||
* @return XX树状数据
|
||||
*/
|
||||
@SaCheckPermission("single:cate:query")
|
||||
@SaCheckPermission("demo:singlec:query")
|
||||
@GetMapping("tree")
|
||||
public R<List<Ltree>> getTree(String name, Long id) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
@@ -56,7 +56,7 @@ public class DemoSingleCateController {
|
||||
* @param name XX名称
|
||||
* @return XX列表数据
|
||||
*/
|
||||
@SaCheckPermission("single:cate:query")
|
||||
@SaCheckPermission("demo:singlec:query")
|
||||
@GetMapping("list")
|
||||
public R<List<DemoSingleCate>> getList(String name) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
@@ -71,7 +71,7 @@ public class DemoSingleCateController {
|
||||
* @param name XX名称
|
||||
* @return XX分页数据
|
||||
*/
|
||||
@SaCheckPermission("single:cate:query")
|
||||
@SaCheckPermission("demo:singlec:query")
|
||||
@GetMapping
|
||||
public R<PageData> get(String name) {
|
||||
Sqler sqler = new Sqler("demo_single_main");
|
||||
@@ -86,7 +86,7 @@ public class DemoSingleCateController {
|
||||
* @param id ID
|
||||
* @return XX对象
|
||||
*/
|
||||
@SaCheckPermission("single:cate:query")
|
||||
@SaCheckPermission("demo:singlec:query")
|
||||
@GetMapping("info/{id}")
|
||||
public R<DemoSingleCate> info(@PathVariable("id") Long id) {
|
||||
return R.ok(service.select(id));
|
||||
@@ -97,7 +97,7 @@ public class DemoSingleCateController {
|
||||
* @param cate XX对象
|
||||
* @return ID
|
||||
*/
|
||||
@SaCheckPermission("single:cate:add")
|
||||
@SaCheckPermission("demo:singlec:add")
|
||||
@Log(title = "单一树表", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit(interval = 2, timeUnit = TimeUnit.SECONDS, message = "{repeat.submit.message}")
|
||||
@PostMapping
|
||||
@@ -111,7 +111,7 @@ public class DemoSingleCateController {
|
||||
* @param cate XX对象
|
||||
* @return ID
|
||||
*/
|
||||
@SaCheckPermission("single:cate:edit")
|
||||
@SaCheckPermission("demo:singlec:edit")
|
||||
@Log(title = "单一树表", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping
|
||||
@@ -124,7 +124,7 @@ public class DemoSingleCateController {
|
||||
* @param ids ID串
|
||||
* @return 删除的XX数量
|
||||
*/
|
||||
@SaCheckPermission("single:cate:remove")
|
||||
@SaCheckPermission("demo:singlec:delete")
|
||||
@Log(title = "单一树表", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("{ids}")
|
||||
public R<Integer> delete(@PathVariable Long[] ids) {
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@ import java.io.Serial;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("demo_single_main")
|
||||
public class DemoSingleMain extends BaseMainEntity {
|
||||
@TableName("demo_single")
|
||||
public class DemoSingle extends BaseMainEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
+12
-12
@@ -23,10 +23,10 @@ import java.util.concurrent.TimeUnit;
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("demo/single/main")
|
||||
public class DemoSingleMainController {
|
||||
@RequestMapping("demo/single")
|
||||
public class DemoSingleController {
|
||||
|
||||
private final DemoSingleMainService service;
|
||||
private final DemoSingleService service;
|
||||
|
||||
private final JdbcHelper jdbcHelper;
|
||||
|
||||
@@ -35,10 +35,10 @@ public class DemoSingleMainController {
|
||||
* @param name XX名称
|
||||
* @return XX分页数据
|
||||
*/
|
||||
@SaCheckPermission("single:main:query")
|
||||
@SaCheckPermission("demo:single:query")
|
||||
@GetMapping
|
||||
public R<PageData> get(String name) {
|
||||
Sqler sqler = new Sqler("demo_single_main");
|
||||
Sqler sqler = new Sqler("demo_single");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.notes");
|
||||
sqler.selectCUinfo();
|
||||
@@ -50,9 +50,9 @@ public class DemoSingleMainController {
|
||||
* @param id ID
|
||||
* @return XX对象
|
||||
*/
|
||||
@SaCheckPermission("single:main:query")
|
||||
@SaCheckPermission("demo:single:query")
|
||||
@GetMapping("info/{id}")
|
||||
public R<DemoSingleMain> info(@PathVariable("id") Long id) {
|
||||
public R<DemoSingle> info(@PathVariable("id") Long id) {
|
||||
return R.ok(service.select(id));
|
||||
}
|
||||
|
||||
@@ -61,11 +61,11 @@ public class DemoSingleMainController {
|
||||
* @param main XX对象
|
||||
* @return ID
|
||||
*/
|
||||
@SaCheckPermission("single:main:add")
|
||||
@SaCheckPermission("demo:single:add")
|
||||
@Log(title = "单一主表", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit(interval = 2, timeUnit = TimeUnit.SECONDS, message = "{repeat.submit.message}")
|
||||
@PostMapping
|
||||
public R<Long> post(@RequestBody DemoSingleMain main) {
|
||||
public R<Long> post(@RequestBody DemoSingle main) {
|
||||
return R.ok(null,service.insert(main));
|
||||
}
|
||||
|
||||
@@ -74,11 +74,11 @@ public class DemoSingleMainController {
|
||||
* @param main XX对象
|
||||
* @return ID
|
||||
*/
|
||||
@SaCheckPermission("single:main:edit")
|
||||
@SaCheckPermission("demo:single:edit")
|
||||
@Log(title = "单一主表", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping
|
||||
public R<Long> put(@RequestBody DemoSingleMain main) {
|
||||
public R<Long> put(@RequestBody DemoSingle main) {
|
||||
return R.ok(null,service.update(main));
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class DemoSingleMainController {
|
||||
* @param ids ID串
|
||||
* @return 删除的XX数量
|
||||
*/
|
||||
@SaCheckPermission("single:main:remove")
|
||||
@SaCheckPermission("demo:single:delete")
|
||||
@Log(title = "单一主表", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("{ids}")
|
||||
public R<Integer> delete(@PathVariable Long[] ids) {
|
||||
+1
-1
@@ -4,6 +4,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface DemoSingleMainMapper extends BaseMapper<DemoSingleMain> {
|
||||
public interface DemoSingleMapper extends BaseMapper<DemoSingle> {
|
||||
|
||||
}
|
||||
+2
-2
@@ -7,9 +7,9 @@ import vben.common.mybatis.core.service.BaseMainService;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DemoSingleMainService extends BaseMainService<DemoSingleMain> {
|
||||
public class DemoSingleService extends BaseMainService<DemoSingle> {
|
||||
|
||||
private final DemoSingleMainMapper mapper;
|
||||
private final DemoSingleMapper mapper;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
@@ -217,8 +217,7 @@ xss:
|
||||
# 排除链接
|
||||
excludeUrls:
|
||||
- /system/notice
|
||||
- /oa/flow/tmpl
|
||||
- /bpm/bus/tmpl
|
||||
- /bpm/bust
|
||||
|
||||
--- # 分布式锁 lock4j 全局配置
|
||||
lock4j:
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@ import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "bpm_bus_main")
|
||||
public class BpmBusMainEntity {
|
||||
@Table(name = "bpm_bus")
|
||||
public class BpmBusEntity {
|
||||
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
@@ -1,4 +0,0 @@
|
||||
package vben.setup.bpm.org;
|
||||
|
||||
public class BpmOrgInitService {
|
||||
}
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
package vben.setup.bpm.org;
|
||||
package vben.setup.bpm.role;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
@@ -8,12 +8,12 @@ import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 群组分类
|
||||
* 流程角色分类
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "bpm_org_tree_cate")
|
||||
public class BpmOrgTreeCateEntity {
|
||||
@Table(name = "bpm_role_cate")
|
||||
public class BpmRoleCateEntity {
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
+8
-8
@@ -1,14 +1,14 @@
|
||||
package vben.setup.bpm.org;
|
||||
package vben.setup.bpm.role;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
//层级角色
|
||||
//流程角色
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "bpm_org_role")
|
||||
public class BpmOrgRoleEntity {
|
||||
@Table(name = "bpm_role")
|
||||
public class BpmRoleEntity {
|
||||
@Id
|
||||
@Column(length = 36)
|
||||
private String id;//主键
|
||||
@@ -22,19 +22,19 @@ public class BpmOrgRoleEntity {
|
||||
|
||||
private String treid;//角色树ID
|
||||
|
||||
public BpmOrgRoleEntity() {
|
||||
public BpmRoleEntity() {
|
||||
}
|
||||
|
||||
public BpmOrgRoleEntity(String id) {
|
||||
public BpmRoleEntity(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public BpmOrgRoleEntity(String id, String name) {
|
||||
public BpmRoleEntity(String id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public BpmOrgRoleEntity(String id, String name, Integer ornum) {
|
||||
public BpmRoleEntity(String id, String name, Integer ornum) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.ornum = ornum;
|
||||
@@ -0,0 +1,4 @@
|
||||
package vben.setup.bpm.role;
|
||||
|
||||
public class BpmRoleInitService {
|
||||
}
|
||||
+4
-3
@@ -1,4 +1,4 @@
|
||||
package vben.setup.bpm.org;
|
||||
package vben.setup.bpm.role;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.persistence.Column;
|
||||
@@ -9,10 +9,11 @@ import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
//流程角色节点
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name = "bpm_org_node")
|
||||
public class BpmOrgNodeEntity {
|
||||
@Table(name = "bpm_role_node")
|
||||
public class BpmRoleNodeEntity {
|
||||
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
+4
-3
@@ -1,4 +1,4 @@
|
||||
package vben.setup.bpm.org;
|
||||
package vben.setup.bpm.role;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
@@ -8,10 +8,11 @@ import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
//流程角色树
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "bpm_org_tree")
|
||||
public class BpmOrgTreeEntity {
|
||||
@Table(name = "bpm_role_tree")
|
||||
public class BpmRoleTreeEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
+3
-3
@@ -12,9 +12,9 @@ import java.util.Date;
|
||||
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name = "bpm_todo_main")
|
||||
@Table(name = "bpm_todo")
|
||||
@Schema(description = "流程待办")
|
||||
public class BpmTodoMainEntity {
|
||||
public class BpmTodoEntity {
|
||||
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
@@ -59,6 +59,6 @@ public class BpmTodoMainEntity {
|
||||
// @ManyToMany
|
||||
// @JoinTable(name = "bpm_todo_user", joinColumns = {@JoinColumn(name = "tid")},
|
||||
// inverseJoinColumns = {@JoinColumn(name = "uid")})
|
||||
// private List<SysOrg> tamen;
|
||||
// private List<SysActor> tamen;
|
||||
|
||||
}
|
||||
@@ -56,6 +56,6 @@ public class BpmTodoHistEntity {
|
||||
// @ManyToMany
|
||||
// @JoinTable(name = "bpm_todo_user", joinColumns = {@JoinColumn(name = "tid")},
|
||||
// inverseJoinColumns = {@JoinColumn(name = "uid")})
|
||||
// private List<SysOrg> tamen;
|
||||
// private List<SysActor> tamen;
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -15,8 +15,8 @@ import vben.common.jpa.entity.BaseCateEntity;
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "关联分类表")
|
||||
@Table(indexes = {@Index(columnList = "cruid"), @Index(columnList = "upuid")})
|
||||
public class DemoLinkCate extends BaseCateEntity {
|
||||
@Table(name="demo_link_cate", indexes = {@Index(columnList = "cruid"), @Index(columnList = "upuid")})
|
||||
public class DemoLinkCateEntity extends BaseCateEntity {
|
||||
|
||||
|
||||
}
|
||||
+7
-7
@@ -5,7 +5,7 @@ import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import vben.common.jpa.entity.BaseMainEntity;
|
||||
import vben.common.jpa.entity.SysOrg;
|
||||
import vben.common.jpa.entity.SysActor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -17,8 +17,8 @@ import java.util.List;
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "关联主表")
|
||||
@Table(indexes = {@Index(columnList = "cruid"), @Index(columnList = "upuid")})
|
||||
public class DemoLinkMain extends BaseMainEntity {
|
||||
@Table(name="demo_link", indexes = {@Index(columnList = "cruid"), @Index(columnList = "upuid")})
|
||||
public class DemoLinkEntity extends BaseMainEntity {
|
||||
|
||||
/**
|
||||
* 所属分类ID
|
||||
@@ -33,15 +33,15 @@ public class DemoLinkMain extends BaseMainEntity {
|
||||
@JoinColumn(name = "maiid")
|
||||
@OrderBy("ornum ASC")
|
||||
@Schema(description = "子项目列表")
|
||||
private List<DemoLinkItem> items = new ArrayList<>();
|
||||
private List<DemoLinkItemEntity> items = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 成员列表(ManyToMany示例)
|
||||
*/
|
||||
@ManyToMany
|
||||
@JoinTable(name = "demo_link_main_org", joinColumns = {@JoinColumn(name = "mid")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "oid")})
|
||||
@JoinTable(name = "demo_link_actor", joinColumns = {@JoinColumn(name = "mid")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "aid")})
|
||||
@Schema(description = "成员信息")
|
||||
private List<SysOrg> orgs;
|
||||
private List<SysActor> actors;
|
||||
|
||||
}
|
||||
+3
-4
@@ -1,9 +1,7 @@
|
||||
package vben.setup.demo.link;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -12,7 +10,8 @@ import lombok.Data;
|
||||
@Data
|
||||
@Entity
|
||||
@Schema(description = "关联子表")
|
||||
public class DemoLinkItem {
|
||||
@Table(name="demo_link_item")
|
||||
public class DemoLinkItemEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
@@ -42,7 +42,7 @@ public class DemoInitService {
|
||||
m8010.setIcon("pajamas:work-item-requirement");
|
||||
m8010.setName("单一主表案例");
|
||||
m8010.setOrnum(8010);
|
||||
m8010.setPath("single/main");
|
||||
m8010.setPath("single");
|
||||
m8010.setPid(8000L);
|
||||
menuList.add(m8010);
|
||||
|
||||
@@ -52,7 +52,7 @@ public class DemoInitService {
|
||||
m8020.setIcon("pajamas:work-item-requirement");
|
||||
m8020.setName("单一树表案例");
|
||||
m8020.setOrnum(8020);
|
||||
m8020.setPath("single/cate");
|
||||
m8020.setPath("singlec");
|
||||
m8020.setPid(8000L);
|
||||
menuList.add(m8020);
|
||||
|
||||
@@ -66,6 +66,26 @@ public class DemoInitService {
|
||||
m8030.setPid(8000L);
|
||||
menuList.add(m8030);
|
||||
|
||||
SysMenuEntity m8040 = new SysMenuEntity();
|
||||
m8040.setId(8040L);
|
||||
m8040.setComp("demo/perm/way1/index");
|
||||
m8040.setIcon("pajamas:work-item-requirement");
|
||||
m8040.setName("数据权限案例1");
|
||||
m8040.setOrnum(8040);
|
||||
m8040.setPath("perm1");
|
||||
m8040.setPid(8000L);
|
||||
menuList.add(m8040);
|
||||
|
||||
SysMenuEntity m8050 = new SysMenuEntity();
|
||||
m8050.setId(8050L);
|
||||
m8050.setComp("demo/perm/way2/index");
|
||||
m8050.setIcon("pajamas:work-item-requirement");
|
||||
m8050.setName("数据权限案例2");
|
||||
m8050.setOrnum(8050);
|
||||
m8050.setPath("perm2");
|
||||
m8050.setPid(8000L);
|
||||
menuList.add(m8050);
|
||||
|
||||
insertMenus(menuList);
|
||||
|
||||
List<SysApiEntity> apiList = new ArrayList<>();
|
||||
@@ -75,7 +95,7 @@ public class DemoInitService {
|
||||
a801001.setOrnum(801001);
|
||||
a801001.setName("单一主表-查询");
|
||||
a801001.setMenid(8010L);
|
||||
a801001.setPerm("single:main:query");
|
||||
a801001.setPerm("demo:single:query");
|
||||
apiList.add(a801001);
|
||||
|
||||
SysApiEntity a801002 = new SysApiEntity();
|
||||
@@ -83,7 +103,7 @@ public class DemoInitService {
|
||||
a801002.setOrnum(801002);
|
||||
a801002.setName("单一主表-新增");
|
||||
a801002.setMenid(8010L);
|
||||
a801002.setPerm("single:main:add");
|
||||
a801002.setPerm("demo:single:add");
|
||||
apiList.add(a801002);
|
||||
|
||||
SysApiEntity a801003 = new SysApiEntity();
|
||||
@@ -91,7 +111,7 @@ public class DemoInitService {
|
||||
a801003.setOrnum(801003);
|
||||
a801003.setName("单一主表-修改");
|
||||
a801003.setMenid(8010L);
|
||||
a801003.setPerm("single:main:edit");
|
||||
a801003.setPerm("demo:single:edit");
|
||||
apiList.add(a801003);
|
||||
|
||||
SysApiEntity a801004 = new SysApiEntity();
|
||||
@@ -99,7 +119,7 @@ public class DemoInitService {
|
||||
a801004.setOrnum(801004);
|
||||
a801004.setName("单一主表-删除");
|
||||
a801004.setMenid(8010L);
|
||||
a801004.setPerm("single:main:remove");
|
||||
a801004.setPerm("demo:single:delete");
|
||||
apiList.add(a801004);
|
||||
|
||||
SysApiEntity a802001 = new SysApiEntity();
|
||||
@@ -107,7 +127,7 @@ public class DemoInitService {
|
||||
a802001.setOrnum(802001);
|
||||
a802001.setName("单一树表-查询");
|
||||
a802001.setMenid(8020L);
|
||||
a802001.setPerm("single:cate:query");
|
||||
a802001.setPerm("demo:singlec:query");
|
||||
apiList.add(a802001);
|
||||
|
||||
SysApiEntity a802002 = new SysApiEntity();
|
||||
@@ -115,7 +135,7 @@ public class DemoInitService {
|
||||
a802002.setOrnum(802002);
|
||||
a802002.setName("单一树表-新增");
|
||||
a802002.setMenid(8020L);
|
||||
a802002.setPerm("single:cate:add");
|
||||
a802002.setPerm("demo:singlec:add");
|
||||
apiList.add(a802002);
|
||||
|
||||
SysApiEntity a802003 = new SysApiEntity();
|
||||
@@ -123,7 +143,7 @@ public class DemoInitService {
|
||||
a802003.setOrnum(802003);
|
||||
a802003.setName("单一树表-修改");
|
||||
a802003.setMenid(8020L);
|
||||
a802003.setPerm("single:cate:edit");
|
||||
a802003.setPerm("demo:singlec:edit");
|
||||
apiList.add(a802003);
|
||||
|
||||
SysApiEntity a802004 = new SysApiEntity();
|
||||
@@ -131,7 +151,7 @@ public class DemoInitService {
|
||||
a802004.setOrnum(802004);
|
||||
a802004.setName("单一树表-删除");
|
||||
a802004.setMenid(8020L);
|
||||
a802004.setPerm("single:cate:remove");
|
||||
a802004.setPerm("demo:singlec:delete");
|
||||
apiList.add(a802004);
|
||||
|
||||
SysApiEntity a803001 = new SysApiEntity();
|
||||
@@ -139,7 +159,7 @@ public class DemoInitService {
|
||||
a803001.setOrnum(803001);
|
||||
a803001.setName("关联主表-查询");
|
||||
a803001.setMenid(8030L);
|
||||
a803001.setPerm("link:main:query");
|
||||
a803001.setPerm("demo:link:query");
|
||||
apiList.add(a803001);
|
||||
|
||||
SysApiEntity a803002 = new SysApiEntity();
|
||||
@@ -147,7 +167,7 @@ public class DemoInitService {
|
||||
a803002.setOrnum(803002);
|
||||
a803002.setName("关联主表-新增");
|
||||
a803002.setMenid(8030L);
|
||||
a803002.setPerm("link:main:add");
|
||||
a803002.setPerm("demo:link:add");
|
||||
apiList.add(a803002);
|
||||
|
||||
SysApiEntity a803003 = new SysApiEntity();
|
||||
@@ -155,7 +175,7 @@ public class DemoInitService {
|
||||
a803003.setOrnum(803003);
|
||||
a803003.setName("关联主表-修改");
|
||||
a803003.setMenid(8030L);
|
||||
a803003.setPerm("link:main:edit");
|
||||
a803003.setPerm("demo:link:edit");
|
||||
apiList.add(a803003);
|
||||
|
||||
SysApiEntity a803004 = new SysApiEntity();
|
||||
@@ -163,7 +183,7 @@ public class DemoInitService {
|
||||
a803004.setOrnum(803004);
|
||||
a803004.setName("关联主表-删除");
|
||||
a803004.setMenid(8030L);
|
||||
a803004.setPerm("link:main:remove");
|
||||
a803004.setPerm("demo:link:delete");
|
||||
apiList.add(a803004);
|
||||
|
||||
SysApiEntity a803011 = new SysApiEntity();
|
||||
@@ -171,7 +191,7 @@ public class DemoInitService {
|
||||
a803011.setOrnum(803011);
|
||||
a803011.setName("关联树表-查询");
|
||||
a803011.setMenid(8030L);
|
||||
a803011.setPerm("link:cate:query");
|
||||
a803011.setPerm("demo:linkc:query");
|
||||
apiList.add(a803011);
|
||||
|
||||
SysApiEntity a803012 = new SysApiEntity();
|
||||
@@ -179,7 +199,7 @@ public class DemoInitService {
|
||||
a803012.setOrnum(803012);
|
||||
a803012.setName("关联树表-新增");
|
||||
a803012.setMenid(8030L);
|
||||
a803012.setPerm("link:cate:add");
|
||||
a803012.setPerm("demo:linkc:add");
|
||||
apiList.add(a803012);
|
||||
|
||||
SysApiEntity a803013 = new SysApiEntity();
|
||||
@@ -187,17 +207,81 @@ public class DemoInitService {
|
||||
a803013.setOrnum(803013);
|
||||
a803013.setName("关联树表-修改");
|
||||
a803013.setMenid(8030L);
|
||||
a803013.setPerm("link:cate:edit");
|
||||
a803013.setPerm("demo:linkc:edit");
|
||||
apiList.add(a803013);
|
||||
|
||||
SysApiEntity a803014 = new SysApiEntity();
|
||||
a803014.setId(803014L);
|
||||
a803014.setOrnum(803014);
|
||||
a803014.setName("关联树表-删除");
|
||||
a803014.setName("数据权限案例-删除");
|
||||
a803014.setMenid(8030L);
|
||||
a803014.setPerm("link:cate:remove");
|
||||
a803014.setPerm("demo:linkc:delete");
|
||||
apiList.add(a803014);
|
||||
|
||||
SysApiEntity a804001 = new SysApiEntity();
|
||||
a804001.setId(804001L);
|
||||
a804001.setOrnum(804001);
|
||||
a804001.setName("数据权限案例1-查询");
|
||||
a804001.setMenid(8040L);
|
||||
a804001.setPerm("demo:perm1:query");
|
||||
apiList.add(a804001);
|
||||
|
||||
SysApiEntity a804002 = new SysApiEntity();
|
||||
a804002.setId(804002L);
|
||||
a804002.setOrnum(804002);
|
||||
a804002.setName("数据权限案例1-新增");
|
||||
a804002.setMenid(8040L);
|
||||
a804002.setPerm("demo:perm1:add");
|
||||
apiList.add(a804002);
|
||||
|
||||
SysApiEntity a804003 = new SysApiEntity();
|
||||
a804003.setId(804003L);
|
||||
a804003.setOrnum(804003);
|
||||
a804003.setName("数据权限案例1-修改");
|
||||
a804003.setMenid(8040L);
|
||||
a804003.setPerm("demo:perm1:edit");
|
||||
apiList.add(a804003);
|
||||
|
||||
SysApiEntity a804004 = new SysApiEntity();
|
||||
a804004.setId(804004L);
|
||||
a804004.setOrnum(804004);
|
||||
a804004.setName("数据权限案例1-删除");
|
||||
a804004.setMenid(8040L);
|
||||
a804004.setPerm("demo:perm1:delete");
|
||||
apiList.add(a804004);
|
||||
|
||||
SysApiEntity a805001 = new SysApiEntity();
|
||||
a805001.setId(805001L);
|
||||
a805001.setOrnum(805001);
|
||||
a805001.setName("数据权限案例2-查询");
|
||||
a805001.setMenid(8050L);
|
||||
a805001.setPerm("demo:perm2:query");
|
||||
apiList.add(a805001);
|
||||
|
||||
SysApiEntity a805002 = new SysApiEntity();
|
||||
a805002.setId(805002L);
|
||||
a805002.setOrnum(805002);
|
||||
a805002.setName("数据权限案例2-新增");
|
||||
a805002.setMenid(8050L);
|
||||
a805002.setPerm("demo:perm2:add");
|
||||
apiList.add(a805002);
|
||||
|
||||
SysApiEntity a805003 = new SysApiEntity();
|
||||
a805003.setId(805003L);
|
||||
a805003.setOrnum(805003);
|
||||
a805003.setName("数据权限案例2-修改");
|
||||
a805003.setMenid(8050L);
|
||||
a805003.setPerm("demo:perm2:edit");
|
||||
apiList.add(a805003);
|
||||
|
||||
SysApiEntity a805004 = new SysApiEntity();
|
||||
a805004.setId(805004L);
|
||||
a805004.setOrnum(805004);
|
||||
a805004.setName("数据权限案例2-删除");
|
||||
a805004.setMenid(8050L);
|
||||
a805004.setPerm("demo:perm2:delete");
|
||||
apiList.add(a805004);
|
||||
|
||||
insertApis(apiList);
|
||||
|
||||
}
|
||||
|
||||
+3
-1
@@ -2,6 +2,7 @@ package vben.setup.demo.single;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Table;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import vben.common.jpa.entity.BaseCateEntity;
|
||||
@@ -13,7 +14,8 @@ import vben.common.jpa.entity.BaseCateEntity;
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "单一树表")
|
||||
public class DemoSingleCate extends BaseCateEntity {
|
||||
@Table(name="demo_single_cate")
|
||||
public class DemoSingleCateEntity extends BaseCateEntity {
|
||||
|
||||
|
||||
}
|
||||
+3
-1
@@ -2,6 +2,7 @@ package vben.setup.demo.single;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Table;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import vben.common.jpa.entity.BaseMainEntity;
|
||||
@@ -13,7 +14,8 @@ import vben.common.jpa.entity.BaseMainEntity;
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "单一主表")
|
||||
public class DemoSingleMain extends BaseMainEntity {
|
||||
@Table(name="demo_single")
|
||||
public class DemoSingleEntity extends BaseMainEntity {
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@ import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "mon_job_main")
|
||||
public class MonJobMainEntity
|
||||
@Table(name = "mon_job")
|
||||
public class MonJobEntity
|
||||
{
|
||||
/**
|
||||
*主键ID
|
||||
@@ -88,7 +88,7 @@ public class MonLoginLogEntity {
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
@Schema(description = "操作系统")
|
||||
@Schema(description = "提示消息")
|
||||
private String himsg;
|
||||
|
||||
|
||||
|
||||
@@ -70,10 +70,10 @@ public class MonOperLogEntity {
|
||||
private String opuna;
|
||||
|
||||
/**
|
||||
* 部门名称
|
||||
* 组织名称
|
||||
*/
|
||||
@Column(length = 64)
|
||||
@Schema(description = "操作人员")
|
||||
@Schema(description = "组织名称")
|
||||
private String opdna;
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,7 @@ import vben.setup.bpm.bus.BpmBusInitService;
|
||||
import vben.setup.demo.root.DemoInitService;
|
||||
import vben.setup.sys.config.SysConfigInitService;
|
||||
import vben.setup.sys.notice.SysNoticeInitService;
|
||||
import vben.setup.sys.dept.SysDeptInitService;
|
||||
import vben.setup.sys.org.SysOrgInitService;
|
||||
import vben.setup.sys.group.SysGroupInitService;
|
||||
import vben.setup.sys.post.SysPostInitService;
|
||||
import vben.setup.sys.user.SysUserInitService;
|
||||
@@ -25,13 +25,12 @@ import vben.setup.tool.num.ToolNumInitService;
|
||||
public class DataInitService {
|
||||
|
||||
public void init() {
|
||||
String sql="select count(1) from sys_org where id='u1'";
|
||||
String sql="select count(1) from sys_actor where id='u1'";
|
||||
Integer count = jdbcHelper.getTp().queryForObject(sql, Integer.class);
|
||||
if(count!=null&&count!=0){
|
||||
return;
|
||||
}
|
||||
//1为机构,2为部门,4为岗位,8为用户,16为常用群组,32为流程组织角色
|
||||
deptInitService.init();
|
||||
orgInitService.init();
|
||||
userInitService.init();
|
||||
postInitService.init();
|
||||
groupInitService.init();
|
||||
@@ -40,7 +39,7 @@ public class DataInitService {
|
||||
menuInitService.initBpm();
|
||||
apiInitService.initBase();
|
||||
apiInitService.initBpm();
|
||||
roleInitService.init();
|
||||
|
||||
|
||||
configInitService.init();
|
||||
noticeInitService.init();
|
||||
@@ -51,11 +50,14 @@ public class DataInitService {
|
||||
//流程相关数据
|
||||
bpmBusInitService.init();
|
||||
demoInitService.init();
|
||||
|
||||
//最后创建角色,admin角色拥有所有权限
|
||||
roleInitService.init();
|
||||
}
|
||||
|
||||
private final JdbcHelper jdbcHelper;
|
||||
|
||||
private final SysDeptInitService deptInitService;
|
||||
private final SysOrgInitService orgInitService;
|
||||
|
||||
private final SysUserInitService userInitService;
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package vben.setup.sys.actor;
|
||||
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import vben.common.jpa.entity.SysActor;
|
||||
|
||||
public interface SysActorRepo extends JpaRepository<SysActor,String> {
|
||||
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门初始化
|
||||
* 接口初始化
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -21,25 +21,25 @@ public class SysApiInitService {
|
||||
SysApiEntity a101001 = new SysApiEntity();
|
||||
a101001.setId(101001L);
|
||||
a101001.setOrnum(101001);
|
||||
a101001.setName("部门查询");
|
||||
a101001.setName("组织查询");
|
||||
a101001.setMenid(1010L);
|
||||
a101001.setPerm("sys:dept:query");
|
||||
a101001.setPerm("sys:org:query");
|
||||
list.add(a101001);
|
||||
|
||||
SysApiEntity a101002 = new SysApiEntity();
|
||||
a101002.setId(101002L);
|
||||
a101002.setOrnum(101002);
|
||||
a101002.setName("部门编辑");
|
||||
a101002.setName("组织编辑");
|
||||
a101002.setMenid(1010L);
|
||||
a101002.setPerm("sys:dept:edit");
|
||||
a101002.setPerm("sys:org:edit");
|
||||
list.add(a101002);
|
||||
|
||||
SysApiEntity a101003 = new SysApiEntity();
|
||||
a101003.setId(101003L);
|
||||
a101003.setOrnum(101003);
|
||||
a101003.setName("部门删除");
|
||||
a101003.setName("组织删除");
|
||||
a101003.setMenid(1010L);
|
||||
a101003.setPerm("sys:dept:delete");
|
||||
a101003.setPerm("sys:org:delete");
|
||||
list.add(a101003);
|
||||
|
||||
SysApiEntity a102001 = new SysApiEntity();
|
||||
@@ -343,7 +343,7 @@ public class SysApiInitService {
|
||||
a206001.setOrnum(206001);
|
||||
a206001.setName("定时任务查询");
|
||||
a206001.setMenid(2060L);
|
||||
a206001.setPerm("monjob:main:query");
|
||||
a206001.setPerm("mon:job:query");
|
||||
list.add(a206001);
|
||||
|
||||
SysApiEntity a206002 = new SysApiEntity();
|
||||
@@ -351,7 +351,7 @@ public class SysApiInitService {
|
||||
a206002.setOrnum(206002);
|
||||
a206002.setName("定时任务修改");
|
||||
a206002.setMenid(2060L);
|
||||
a206002.setPerm("monjob:main:edit");
|
||||
a206002.setPerm("mon:job:edit");
|
||||
list.add(a206002);
|
||||
|
||||
SysApiEntity a206003 = new SysApiEntity();
|
||||
@@ -359,7 +359,7 @@ public class SysApiInitService {
|
||||
a206003.setOrnum(206003);
|
||||
a206003.setName("定时任务执行");
|
||||
a206003.setMenid(2060L);
|
||||
a206003.setPerm("monjob:main:run");
|
||||
a206003.setPerm("mon:job:run");
|
||||
list.add(a206003);
|
||||
|
||||
SysApiEntity a206101 = new SysApiEntity();
|
||||
@@ -367,7 +367,7 @@ public class SysApiInitService {
|
||||
a206101.setOrnum(206101);
|
||||
a206101.setName("定时任务日志查询");
|
||||
a206101.setMenid(2061L);
|
||||
a206101.setPerm("monjob:log:query");
|
||||
a206101.setPerm("mon:jobl:query");
|
||||
list.add(a206101);
|
||||
|
||||
SysApiEntity a206102 = new SysApiEntity();
|
||||
@@ -375,7 +375,7 @@ public class SysApiInitService {
|
||||
a206102.setOrnum(206102);
|
||||
a206102.setName("定时任务日志删除");
|
||||
a206102.setMenid(2061L);
|
||||
a206102.setPerm("monjob:log:delete");
|
||||
a206102.setPerm("mon:jobl:delete");
|
||||
list.add(a206102);
|
||||
|
||||
SysApiEntity a301001 = new SysApiEntity();
|
||||
@@ -383,7 +383,7 @@ public class SysApiInitService {
|
||||
a301001.setOrnum(301001);
|
||||
a301001.setName("字典查询");
|
||||
a301001.setMenid(3010L);
|
||||
a301001.setPerm("tooldict:main:query");
|
||||
a301001.setPerm("tool:dict:query");
|
||||
list.add(a301001);
|
||||
|
||||
SysApiEntity a301002 = new SysApiEntity();
|
||||
@@ -391,7 +391,7 @@ public class SysApiInitService {
|
||||
a301002.setOrnum(301002);
|
||||
a301002.setName("字典修改");
|
||||
a301002.setMenid(3010L);
|
||||
a301002.setPerm("tooldict:main:edit");
|
||||
a301002.setPerm("tool:dict:edit");
|
||||
list.add(a301002);
|
||||
|
||||
SysApiEntity a301003 = new SysApiEntity();
|
||||
@@ -399,7 +399,7 @@ public class SysApiInitService {
|
||||
a301003.setOrnum(301003);
|
||||
a301003.setName("字典删除");
|
||||
a301003.setMenid(3010L);
|
||||
a301003.setPerm("tooldict:main:delete");
|
||||
a301003.setPerm("tool:dict:delete");
|
||||
list.add(a301003);
|
||||
|
||||
SysApiEntity a301004 = new SysApiEntity();
|
||||
@@ -407,7 +407,7 @@ public class SysApiInitService {
|
||||
a301004.setOrnum(301004);
|
||||
a301004.setName("字典数据查询");
|
||||
a301004.setMenid(3010L);
|
||||
a301004.setPerm("tooldict:data:query");
|
||||
a301004.setPerm("tool:dictd:query");
|
||||
list.add(a301004);
|
||||
|
||||
SysApiEntity a301005 = new SysApiEntity();
|
||||
@@ -415,7 +415,7 @@ public class SysApiInitService {
|
||||
a301005.setOrnum(301005);
|
||||
a301005.setName("字典数据编辑");
|
||||
a301005.setMenid(3010L);
|
||||
a301005.setPerm("tooldict:data:edit");
|
||||
a301005.setPerm("tool:dictd:edit");
|
||||
list.add(a301005);
|
||||
|
||||
SysApiEntity a301006 = new SysApiEntity();
|
||||
@@ -423,7 +423,7 @@ public class SysApiInitService {
|
||||
a301006.setOrnum(301006);
|
||||
a301006.setName("字典数据删除");
|
||||
a301006.setMenid(3010L);
|
||||
a301006.setPerm("tooldict:data:delete");
|
||||
a301006.setPerm("tool:dictd:delete");
|
||||
list.add(a301006);
|
||||
|
||||
SysApiEntity a302001 = new SysApiEntity();
|
||||
@@ -461,7 +461,7 @@ public class SysApiInitService {
|
||||
a603001.setOrnum(603001);
|
||||
a603001.setName("流程查询");
|
||||
a603001.setMenid(6030L);
|
||||
a603001.setPerm("bpmbus:main:query");
|
||||
a603001.setPerm("bpm:bus:query");
|
||||
list.add(a603001);
|
||||
|
||||
SysApiEntity a603002 = new SysApiEntity();
|
||||
@@ -469,7 +469,7 @@ public class SysApiInitService {
|
||||
a603002.setOrnum(603002);
|
||||
a603002.setName("流程新增");
|
||||
a603002.setMenid(6030L);
|
||||
a603002.setPerm("bpmbus:main:add");
|
||||
a603002.setPerm("bpm:bus:add");
|
||||
list.add(a603002);
|
||||
|
||||
SysApiEntity a603003 = new SysApiEntity();
|
||||
@@ -477,7 +477,7 @@ public class SysApiInitService {
|
||||
a603003.setOrnum(603003);
|
||||
a603003.setName("流程编辑");
|
||||
a603003.setMenid(6030L);
|
||||
a603003.setPerm("bpmbus:main:edit");
|
||||
a603003.setPerm("bpm:bus:edit");
|
||||
list.add(a603003);
|
||||
|
||||
insert(list);
|
||||
|
||||
@@ -3,8 +3,13 @@ package vben.setup.sys.api;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysApiRepo extends JpaRepository<SysApiEntity,String> {
|
||||
|
||||
SysApiEntity findByPerm(String perm);
|
||||
|
||||
|
||||
List<SysApiEntity> findByIdGreaterThan(Long id);
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门初始化
|
||||
* 系统配置初始化
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
package vben.setup.sys.corp;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 公司分类
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "sys_corp_cate")
|
||||
@Schema(description = "公司分类")
|
||||
public class SysCorpCateEntity {
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
@Schema(description = "主键ID")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 父ID
|
||||
*/
|
||||
@Column(length = 32)
|
||||
@Schema(description = "父ID")
|
||||
private String pid;
|
||||
|
||||
/**
|
||||
* 排序号
|
||||
*/
|
||||
@Schema(description = "排序号")
|
||||
private Integer ornum;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,172 +0,0 @@
|
||||
package vben.setup.sys.dept;
|
||||
|
||||
import jakarta.transaction.Transactional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import vben.common.jpa.entity.SysOrg;
|
||||
import vben.setup.sys.org.SysOrgRepo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门初始化
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional
|
||||
public class SysDeptInitService {
|
||||
|
||||
public void init() {
|
||||
List<SysDeptEntity> list=new ArrayList<>();
|
||||
|
||||
SysDeptEntity dept = new SysDeptEntity();
|
||||
dept.setId("d1000");
|
||||
dept.setName("XX科技");
|
||||
dept.setType(1);
|
||||
dept.setTier("_d1000_");
|
||||
list.add(dept);
|
||||
|
||||
SysDeptEntity dept1100 = new SysDeptEntity();
|
||||
dept1100.setId("d1100");
|
||||
dept1100.setName("北京分公司");
|
||||
dept1100.setType(2);
|
||||
dept1100.setPid("d1000");
|
||||
dept1100.setTier("_d1000_d1100_");
|
||||
list.add(dept1100);
|
||||
|
||||
SysDeptEntity dept1110 = new SysDeptEntity();
|
||||
dept1110.setId("d1110");
|
||||
dept1110.setName("北京分公司销售部");
|
||||
dept1110.setType(8);
|
||||
dept1110.setPid("d1100");
|
||||
dept1110.setTier("_d1000_d1100_d1110_");
|
||||
list.add(dept1110);
|
||||
|
||||
SysDeptEntity dept1111 = new SysDeptEntity();
|
||||
dept1111.setId("d1111");
|
||||
dept1111.setName("北京分公司销售部一组");
|
||||
dept1111.setType(8);
|
||||
dept1111.setPid("d1110");
|
||||
dept1111.setTier("_d1000_d1100_d1110_d1111_");
|
||||
list.add(dept1111);
|
||||
|
||||
SysDeptEntity dept1112 = new SysDeptEntity();
|
||||
dept1112.setId("d1112");
|
||||
dept1112.setName("北京分公司销售部二组");
|
||||
dept1112.setType(8);
|
||||
dept1112.setPid("d1110");
|
||||
dept1112.setTier("_d1000_d1100_d1110_d1112_");
|
||||
list.add(dept1112);
|
||||
|
||||
SysDeptEntity dept1120 = new SysDeptEntity();
|
||||
dept1120.setId("d1120");
|
||||
dept1120.setName("北京分公司人事部");
|
||||
dept1120.setType(8);
|
||||
dept1120.setPid("d1100");
|
||||
dept1120.setTier("_d1000_d1100_d1120_");
|
||||
list.add(dept1120);
|
||||
|
||||
SysDeptEntity dept1130 = new SysDeptEntity();
|
||||
dept1130.setId("d1130");
|
||||
dept1130.setName("北京分公司财务部");
|
||||
dept1130.setType(8);
|
||||
dept1130.setPid("d1100");
|
||||
dept1130.setTier("_d1000_d1100_d1130_");
|
||||
list.add(dept1130);
|
||||
|
||||
SysDeptEntity dept1140 = new SysDeptEntity();
|
||||
dept1140.setId("d1140");
|
||||
dept1140.setName("北京分公司综合部");
|
||||
dept1140.setType(8);
|
||||
dept1140.setPid("d1100");
|
||||
dept1140.setTier("_d1000_d1100_d1410_");
|
||||
list.add(dept1140);
|
||||
|
||||
SysDeptEntity dept1200 = new SysDeptEntity();
|
||||
dept1200.setId("d1200");
|
||||
dept1200.setName("上海分公司");
|
||||
dept1200.setType(2);
|
||||
dept1200.setPid("d1000");
|
||||
dept1200.setTier("_d1000_d1200_");
|
||||
list.add(dept1200);
|
||||
|
||||
SysDeptEntity dept1210 = new SysDeptEntity();
|
||||
dept1210.setId("d1210");
|
||||
dept1210.setName("上海分公司销售部");
|
||||
dept1210.setType(8);
|
||||
dept1210.setPid("d1200");
|
||||
dept1210.setTier("_d1000_d1200_d1210_");
|
||||
list.add(dept1210);
|
||||
|
||||
SysDeptEntity dept1220 = new SysDeptEntity();
|
||||
dept1220.setId("d1220");
|
||||
dept1220.setName("上海分公司人事部");
|
||||
dept1220.setType(8);
|
||||
dept1220.setPid("d1200");
|
||||
dept1220.setTier("_d1000_d1200_d1220_");
|
||||
list.add(dept1220);
|
||||
|
||||
SysDeptEntity dept1230 = new SysDeptEntity();
|
||||
dept1230.setId("d1230");
|
||||
dept1230.setName("上海分公司财务部");
|
||||
dept1230.setType(8);
|
||||
dept1230.setPid("d1200");
|
||||
dept1230.setTier("_d1000_d1200_d1230_");
|
||||
list.add(dept1230);
|
||||
|
||||
SysDeptEntity dept1300 = new SysDeptEntity();
|
||||
dept1300.setId("d1300");
|
||||
dept1300.setName("广州分公司");
|
||||
dept1300.setType(2);
|
||||
dept1300.setPid("d1000");
|
||||
dept1300.setTier("_d1000_d1300_");
|
||||
list.add(dept1300);
|
||||
|
||||
SysDeptEntity dept1310 = new SysDeptEntity();
|
||||
dept1310.setId("d1310");
|
||||
dept1310.setName("广州分公司综合部");
|
||||
dept1310.setType(8);
|
||||
dept1310.setPid("d1300");
|
||||
dept1310.setTier("_d1000_d1300_d1310_");
|
||||
list.add(dept1310);
|
||||
|
||||
SysDeptEntity dept1320 = new SysDeptEntity();
|
||||
dept1320.setId("d1320");
|
||||
dept1320.setName("广州分公司销售部");
|
||||
dept1320.setType(8);
|
||||
dept1320.setPid("d1300");
|
||||
dept1320.setTier("_d1000_d1300_d1320_");
|
||||
list.add(dept1320);
|
||||
|
||||
SysDeptEntity dept1330 = new SysDeptEntity();
|
||||
dept1330.setId("d1330");
|
||||
dept1330.setName("广州分公司人事部");
|
||||
dept1330.setType(8);
|
||||
dept1330.setPid("d1300");
|
||||
dept1330.setTier("_d1000_d1300_d1330_");
|
||||
list.add(dept1330);
|
||||
|
||||
insert(list);
|
||||
}
|
||||
|
||||
private final SysDeptRepo deptRepo;
|
||||
|
||||
private final SysOrgRepo orgRepo;
|
||||
|
||||
private void insert(List<SysDeptEntity> list) {
|
||||
List<SysOrg> list2 = new ArrayList<>();
|
||||
for (SysDeptEntity dept : list) {
|
||||
dept.setAvtag(true);
|
||||
dept.setOrnum(Integer.parseInt(dept.getId().substring(1)));
|
||||
SysOrg org = new SysOrg();
|
||||
org.setId(dept.getId());
|
||||
org.setName(dept.getName());
|
||||
org.setType(1);
|
||||
list2.add(org);
|
||||
}
|
||||
deptRepo.saveAll(list);
|
||||
orgRepo.saveAll(list2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package vben.setup.sys.dept;
|
||||
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface SysDeptRepo extends JpaRepository<SysDeptEntity,String> {
|
||||
|
||||
}
|
||||
@@ -9,12 +9,12 @@ import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 群组分类
|
||||
* 系统群组分类
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "sys_group_cate")
|
||||
@Schema(description = "组织架构-群组分类")
|
||||
@Schema(description = "系统群组分类")
|
||||
public class SysGroupCateEntity {
|
||||
/**
|
||||
* 主键ID
|
||||
|
||||
@@ -3,18 +3,18 @@ package vben.setup.sys.group;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
import vben.common.jpa.entity.SysOrg;
|
||||
import vben.common.jpa.entity.SysActor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 组织架构群组
|
||||
* 系统群组
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "sys_group")
|
||||
@Schema(description = "组织架构-群组")
|
||||
@Schema(description = "系统群组")
|
||||
public class SysGroupEntity {
|
||||
|
||||
/**
|
||||
@@ -94,9 +94,9 @@ public class SysGroupEntity {
|
||||
* 成员列表
|
||||
*/
|
||||
@ManyToMany
|
||||
@JoinTable(name = "sys_group_org", joinColumns = {@JoinColumn(name = "gid")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "oid")})
|
||||
@JoinTable(name = "sys_group_actor", joinColumns = {@JoinColumn(name = "gid")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "aid")})
|
||||
@Schema(description = "成员信息")
|
||||
private List<SysOrg> members;
|
||||
private List<SysActor> members;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ package vben.setup.sys.group;
|
||||
import jakarta.transaction.Transactional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import vben.common.jpa.entity.SysOrg;
|
||||
import vben.setup.sys.org.SysOrgRepo;
|
||||
import vben.common.jpa.entity.SysActor;
|
||||
import vben.setup.sys.actor.SysActorRepo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -20,29 +20,29 @@ public class SysGroupInitService {
|
||||
SysGroupEntity group= new SysGroupEntity();
|
||||
group.setId("g3001");
|
||||
group.setName("北京分公司管理组");
|
||||
group.setMembers(List.of(new SysOrg("u4"),new SysOrg("u5"),new SysOrg("p2004"),new SysOrg("d1140")));
|
||||
group.setMembers(List.of(new SysActor("u4"),new SysActor("u5"),new SysActor("p2004"),new SysActor("o1140")));
|
||||
insert(group);
|
||||
|
||||
SysGroupEntity group2= new SysGroupEntity();
|
||||
group2.setId("g3002");
|
||||
group2.setName("北京分公司销售员");
|
||||
group2.setMembers(List.of(new SysOrg("u8"),new SysOrg("u9")));
|
||||
group2.setMembers(List.of(new SysActor("u8"),new SysActor("u9")));
|
||||
insert(group2);
|
||||
}
|
||||
|
||||
private final SysGroupRepo groupRepo;
|
||||
|
||||
private final SysOrgRepo orgRepo;
|
||||
private final SysActorRepo actorRepo;
|
||||
|
||||
private void insert(SysGroupEntity group) {
|
||||
group.setAvtag(true);
|
||||
group.setOrnum(Integer.parseInt(group.getId().substring(1)));
|
||||
groupRepo.save(group);
|
||||
SysOrg org = new SysOrg();
|
||||
SysActor org = new SysActor();
|
||||
org.setId(group.getId());
|
||||
org.setName(group.getName());
|
||||
org.setType(8);
|
||||
orgRepo.save(org);
|
||||
actorRepo.save(org);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门初始化
|
||||
* 菜单初始化
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -30,11 +30,11 @@ public class SysMenuInitService {
|
||||
|
||||
SysMenuEntity m1010 = new SysMenuEntity();
|
||||
m1010.setId(1010L);
|
||||
m1010.setComp("sys/dept/index");
|
||||
m1010.setComp("sys/org/index");
|
||||
m1010.setIcon("mingcute:department-line");
|
||||
m1010.setName("部门管理");
|
||||
m1010.setName("组织管理");
|
||||
m1010.setOrnum(1010);
|
||||
m1010.setPath("dept");
|
||||
m1010.setPath("org");
|
||||
m1010.setPid(1000L);
|
||||
list.add(m1010);
|
||||
|
||||
@@ -169,7 +169,7 @@ public class SysMenuInitService {
|
||||
m2010.setIcon("oui:online");
|
||||
m2010.setName("在线用户");
|
||||
m2010.setOrnum(2010);
|
||||
m2010.setPath("online/user");
|
||||
m2010.setPath("online");
|
||||
m2010.setPid(2000L);
|
||||
list.add(m2010);
|
||||
|
||||
@@ -179,7 +179,7 @@ public class SysMenuInitService {
|
||||
m2020.setIcon("uiw:login");
|
||||
m2020.setName("登录日志");
|
||||
m2020.setOrnum(2020);
|
||||
m2020.setPath("login/log");
|
||||
m2020.setPath("login");
|
||||
m2020.setPid(2000L);
|
||||
list.add(m2020);
|
||||
|
||||
@@ -189,7 +189,7 @@ public class SysMenuInitService {
|
||||
m2030.setIcon("icon-park-outline:reverse-operation-in");
|
||||
m2030.setName("操作日志");
|
||||
m2030.setOrnum(2030);
|
||||
m2030.setPath("oper/log");
|
||||
m2030.setPath("oper");
|
||||
m2030.setPid(2000L);
|
||||
list.add(m2030);
|
||||
|
||||
@@ -219,7 +219,7 @@ public class SysMenuInitService {
|
||||
m2060.setIcon("streamline:task-list");
|
||||
m2060.setName("定时任务");
|
||||
m2060.setOrnum(2060);
|
||||
m2060.setPath("job/main");
|
||||
m2060.setPath("job");
|
||||
m2060.setPid(2000L);
|
||||
list.add(m2060);
|
||||
|
||||
@@ -229,7 +229,7 @@ public class SysMenuInitService {
|
||||
m2061.setIcon("ix:log");
|
||||
m2061.setName("任务日志");
|
||||
m2061.setOrnum(2061);
|
||||
m2061.setPath("job/log");
|
||||
m2061.setPath("jobl");
|
||||
m2061.setPid(2000L);
|
||||
m2061.setShtag(false);
|
||||
list.add(m2061);
|
||||
@@ -340,7 +340,7 @@ public class SysMenuInitService {
|
||||
m6010.setIcon("tabler:category-plus");
|
||||
m6010.setName("流程分类");
|
||||
m6010.setOrnum(6010);
|
||||
m6010.setPath("bus/cate");
|
||||
m6010.setPath("busc");
|
||||
m6010.setPid(6000L);
|
||||
list.add(m6010);
|
||||
|
||||
@@ -350,7 +350,7 @@ public class SysMenuInitService {
|
||||
m6020.setIcon("carbon:prompt-template");
|
||||
m6020.setName("流程模板");
|
||||
m6020.setOrnum(6020);
|
||||
m6020.setPath("bus/tmpl");
|
||||
m6020.setPath("bust");
|
||||
m6020.setPid(6000L);
|
||||
list.add(m6020);
|
||||
|
||||
@@ -360,7 +360,7 @@ public class SysMenuInitService {
|
||||
m6021.setIcon("carbon:prompt-template");
|
||||
m6021.setName("流程模板编辑");
|
||||
m6021.setOrnum(6021);
|
||||
m6021.setPath("bus/tmpl/edit");
|
||||
m6021.setPath("bust/edit");
|
||||
m6021.setCatag(true);
|
||||
m6021.setShtag(false);
|
||||
m6021.setPid(6000L);
|
||||
@@ -372,7 +372,7 @@ public class SysMenuInitService {
|
||||
m6030.setIcon("ri:instance-line");
|
||||
m6030.setName("流程清单");
|
||||
m6030.setOrnum(6030);
|
||||
m6030.setPath("bus/main");
|
||||
m6030.setPath("bus");
|
||||
m6030.setPid(6000L);
|
||||
list.add(m6030);
|
||||
|
||||
@@ -382,7 +382,7 @@ public class SysMenuInitService {
|
||||
m6031.setIcon("ri:instance-line");
|
||||
m6031.setName("流程编辑");
|
||||
m6031.setOrnum(6031);
|
||||
m6031.setPath("bus/main/edit");
|
||||
m6031.setPath("bus/edit");
|
||||
m6031.setCatag(true);
|
||||
m6031.setShtag(false);
|
||||
m6031.setPid(6000L);
|
||||
@@ -394,7 +394,7 @@ public class SysMenuInitService {
|
||||
m6032.setIcon("ri:instance-line");
|
||||
m6032.setName("流程查看");
|
||||
m6032.setOrnum(6032);
|
||||
m6032.setPath("bus/main/view");
|
||||
m6032.setPath("bus/view");
|
||||
m6032.setCatag(true);
|
||||
m6032.setShtag(false);
|
||||
m6032.setPid(6000L);
|
||||
@@ -412,21 +412,21 @@ public class SysMenuInitService {
|
||||
|
||||
SysMenuEntity m6050 = new SysMenuEntity();
|
||||
m6050.setId(6050L);
|
||||
m6050.setComp("bpm/org/tree/index");
|
||||
m6050.setComp("bpm/role/tree/index");
|
||||
m6050.setIcon("mdi:workflow-outline");
|
||||
m6050.setName("流程组织");
|
||||
m6050.setName("流程角色");
|
||||
m6050.setOrnum(6050);
|
||||
m6050.setPath("org/tree");
|
||||
m6050.setPath("role");
|
||||
m6050.setPid(6000L);
|
||||
list.add(m6050);
|
||||
|
||||
SysMenuEntity m6051 = new SysMenuEntity();
|
||||
m6051.setId(6051L);
|
||||
m6051.setComp("bpm/org/node/index");
|
||||
m6051.setComp("bpm/role/node/index");
|
||||
m6051.setIcon("mdi:workflow-outline");
|
||||
m6051.setName("流程组织节点");
|
||||
m6051.setName("流程角色节点");
|
||||
m6051.setOrnum(6051);
|
||||
m6051.setPath("org/node");
|
||||
m6051.setPath("role/node");
|
||||
m6051.setShtag(false);
|
||||
m6051.setPid(6000L);
|
||||
list.add(m6051);
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.List;
|
||||
|
||||
public interface SysMenuRepo extends JpaRepository<SysMenuEntity,String> {
|
||||
|
||||
List<SysMenuEntity> findByNameContaining(String path);
|
||||
List<SysMenuEntity> findByNameContaining(String name);
|
||||
|
||||
List<SysMenuEntity> findByIdGreaterThan(Long id);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门初始化
|
||||
* 系统通知初始化
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
|
||||
+8
-8
@@ -1,4 +1,4 @@
|
||||
package vben.setup.sys.dept;
|
||||
package vben.setup.sys.org;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.persistence.Column;
|
||||
@@ -10,13 +10,13 @@ import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 组织架构部门
|
||||
* 系统组织(公司,机构,部门)
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "sys_dept")
|
||||
@Schema(description = "组织架构-部门")
|
||||
public class SysDeptEntity {
|
||||
@Table(name = "sys_org")
|
||||
@Schema(description = "系统组织(公司,机构,部门)")
|
||||
public class SysOrgEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
@@ -43,10 +43,10 @@ public class SysDeptEntity {
|
||||
|
||||
|
||||
/**
|
||||
* 部门类型
|
||||
* 部门在整个组织架构sys_org表中类别为1,这个字段是进行部门细分的,比如分为集团、企业、机构、部门等
|
||||
* 组织类型
|
||||
* 系统组织(公司,机构,部门)在系统参与者sys_actor表中类别为1,这个字段是进行组织细分的,比如分为集团、企业、机构、部门等
|
||||
*/
|
||||
@Schema(description = "部门类型")
|
||||
@Schema(description = "组织类型")
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
@@ -0,0 +1,172 @@
|
||||
package vben.setup.sys.org;
|
||||
|
||||
import jakarta.transaction.Transactional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import vben.common.jpa.entity.SysActor;
|
||||
import vben.setup.sys.actor.SysActorRepo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 组织初始化
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional
|
||||
public class SysOrgInitService {
|
||||
|
||||
public void init() {
|
||||
List<SysOrgEntity> list=new ArrayList<>();
|
||||
|
||||
SysOrgEntity org = new SysOrgEntity();
|
||||
org.setId("o1000");
|
||||
org.setName("XX科技");
|
||||
org.setType(1);
|
||||
org.setTier("_o1000_");
|
||||
list.add(org);
|
||||
|
||||
SysOrgEntity org1100 = new SysOrgEntity();
|
||||
org1100.setId("o1100");
|
||||
org1100.setName("北京分公司");
|
||||
org1100.setType(2);
|
||||
org1100.setPid("o1000");
|
||||
org1100.setTier("_o1000_o1100_");
|
||||
list.add(org1100);
|
||||
|
||||
SysOrgEntity org1110 = new SysOrgEntity();
|
||||
org1110.setId("o1110");
|
||||
org1110.setName("北京分公司销售部");
|
||||
org1110.setType(8);
|
||||
org1110.setPid("o1100");
|
||||
org1110.setTier("_o1000_o1100_o1110_");
|
||||
list.add(org1110);
|
||||
|
||||
SysOrgEntity org1111 = new SysOrgEntity();
|
||||
org1111.setId("o1111");
|
||||
org1111.setName("北京分公司销售部一组");
|
||||
org1111.setType(8);
|
||||
org1111.setPid("o1110");
|
||||
org1111.setTier("_o1000_o1100_o1110_o1111_");
|
||||
list.add(org1111);
|
||||
|
||||
SysOrgEntity org1112 = new SysOrgEntity();
|
||||
org1112.setId("o1112");
|
||||
org1112.setName("北京分公司销售部二组");
|
||||
org1112.setType(8);
|
||||
org1112.setPid("o1110");
|
||||
org1112.setTier("_o1000_o1100_o1110_o1112_");
|
||||
list.add(org1112);
|
||||
|
||||
SysOrgEntity org1120 = new SysOrgEntity();
|
||||
org1120.setId("o1120");
|
||||
org1120.setName("北京分公司人事部");
|
||||
org1120.setType(8);
|
||||
org1120.setPid("o1100");
|
||||
org1120.setTier("_o1000_o1100_o1120_");
|
||||
list.add(org1120);
|
||||
|
||||
SysOrgEntity org1130 = new SysOrgEntity();
|
||||
org1130.setId("o1130");
|
||||
org1130.setName("北京分公司财务部");
|
||||
org1130.setType(8);
|
||||
org1130.setPid("o1100");
|
||||
org1130.setTier("_o1000_o1100_o1130_");
|
||||
list.add(org1130);
|
||||
|
||||
SysOrgEntity org1140 = new SysOrgEntity();
|
||||
org1140.setId("o1140");
|
||||
org1140.setName("北京分公司综合部");
|
||||
org1140.setType(8);
|
||||
org1140.setPid("o1100");
|
||||
org1140.setTier("_o1000_o1100_o1410_");
|
||||
list.add(org1140);
|
||||
|
||||
SysOrgEntity org1200 = new SysOrgEntity();
|
||||
org1200.setId("o1200");
|
||||
org1200.setName("上海分公司");
|
||||
org1200.setType(2);
|
||||
org1200.setPid("o1000");
|
||||
org1200.setTier("_o1000_o1200_");
|
||||
list.add(org1200);
|
||||
|
||||
SysOrgEntity org1210 = new SysOrgEntity();
|
||||
org1210.setId("o1210");
|
||||
org1210.setName("上海分公司销售部");
|
||||
org1210.setType(8);
|
||||
org1210.setPid("o1200");
|
||||
org1210.setTier("_o1000_o1200_o1210_");
|
||||
list.add(org1210);
|
||||
|
||||
SysOrgEntity org1220 = new SysOrgEntity();
|
||||
org1220.setId("o1220");
|
||||
org1220.setName("上海分公司人事部");
|
||||
org1220.setType(8);
|
||||
org1220.setPid("o1200");
|
||||
org1220.setTier("_o1000_o1200_o1220_");
|
||||
list.add(org1220);
|
||||
|
||||
SysOrgEntity org1230 = new SysOrgEntity();
|
||||
org1230.setId("o1230");
|
||||
org1230.setName("上海分公司财务部");
|
||||
org1230.setType(8);
|
||||
org1230.setPid("o1200");
|
||||
org1230.setTier("_o1000_o1200_o1230_");
|
||||
list.add(org1230);
|
||||
|
||||
SysOrgEntity org1300 = new SysOrgEntity();
|
||||
org1300.setId("o1300");
|
||||
org1300.setName("广州分公司");
|
||||
org1300.setType(2);
|
||||
org1300.setPid("o1000");
|
||||
org1300.setTier("_o1000_o1300_");
|
||||
list.add(org1300);
|
||||
|
||||
SysOrgEntity org1310 = new SysOrgEntity();
|
||||
org1310.setId("o1310");
|
||||
org1310.setName("广州分公司综合部");
|
||||
org1310.setType(8);
|
||||
org1310.setPid("o1300");
|
||||
org1310.setTier("_o1000_o1300_o1310_");
|
||||
list.add(org1310);
|
||||
|
||||
SysOrgEntity org1320 = new SysOrgEntity();
|
||||
org1320.setId("o1320");
|
||||
org1320.setName("广州分公司销售部");
|
||||
org1320.setType(8);
|
||||
org1320.setPid("o1300");
|
||||
org1320.setTier("_o1000_o1300_o1320_");
|
||||
list.add(org1320);
|
||||
|
||||
SysOrgEntity org1330 = new SysOrgEntity();
|
||||
org1330.setId("o1330");
|
||||
org1330.setName("广州分公司人事部");
|
||||
org1330.setType(8);
|
||||
org1330.setPid("o1300");
|
||||
org1330.setTier("_o1000_o1300_o1330_");
|
||||
list.add(org1330);
|
||||
|
||||
insert(list);
|
||||
}
|
||||
|
||||
private final SysOrgRepo orgRepo;
|
||||
|
||||
private final SysActorRepo actorRepo;
|
||||
|
||||
private void insert(List<SysOrgEntity> list) {
|
||||
List<SysActor> list2 = new ArrayList<>();
|
||||
for (SysOrgEntity org : list) {
|
||||
org.setAvtag(true);
|
||||
org.setOrnum(Integer.parseInt(org.getId().substring(1)));
|
||||
SysActor actor = new SysActor();
|
||||
actor.setId(org.getId());
|
||||
actor.setName(org.getName());
|
||||
actor.setType(1);
|
||||
list2.add(actor);
|
||||
}
|
||||
orgRepo.saveAll(list);
|
||||
actorRepo.saveAll(list2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,8 +2,7 @@ package vben.setup.sys.org;
|
||||
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import vben.common.jpa.entity.SysOrg;
|
||||
|
||||
public interface SysOrgRepo extends JpaRepository<SysOrg,String> {
|
||||
public interface SysOrgRepo extends JpaRepository<SysOrgEntity,String> {
|
||||
|
||||
}
|
||||
|
||||
@@ -3,18 +3,18 @@ package vben.setup.sys.post;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
import vben.common.jpa.entity.SysOrg;
|
||||
import vben.common.jpa.entity.SysActor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 组织架构岗位
|
||||
* 系统岗位
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "sys_post")
|
||||
@Schema(description = "组织架构-岗位")
|
||||
@Schema(description = "系统岗位")
|
||||
public class SysPostEntity {
|
||||
|
||||
/**
|
||||
@@ -33,11 +33,11 @@ public class SysPostEntity {
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
* 组织ID
|
||||
*/
|
||||
@Column(length = 36)
|
||||
@Schema(description = "部门ID")
|
||||
private String depid;
|
||||
@Schema(description = "组织ID")
|
||||
private String orgid;
|
||||
|
||||
/**
|
||||
* 层级,以“_”隔开
|
||||
@@ -101,9 +101,9 @@ public class SysPostEntity {
|
||||
* 包含成员
|
||||
*/
|
||||
@ManyToMany
|
||||
@JoinTable(name = "sys_post_org", joinColumns = {@JoinColumn(name = "pid")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "oid")})
|
||||
@JoinTable(name = "sys_post_actor", joinColumns = {@JoinColumn(name = "pid")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "aid")})
|
||||
@Schema(description = "员工列表")
|
||||
private List<SysOrg> users;
|
||||
private List<SysActor> users;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ package vben.setup.sys.post;
|
||||
import jakarta.transaction.Transactional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import vben.common.jpa.entity.SysOrg;
|
||||
import vben.setup.sys.org.SysOrgRepo;
|
||||
import vben.common.jpa.entity.SysActor;
|
||||
import vben.setup.sys.actor.SysActorRepo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -21,33 +21,33 @@ public class SysPostInitService {
|
||||
SysPostEntity post1 = new SysPostEntity();
|
||||
post1.setId("p2001");
|
||||
post1.setName("董事长");
|
||||
post1.setUsers(List.of(new SysOrg("u3")));
|
||||
post1.setDepid("d1000");
|
||||
post1.setTier("_d1000_p2001_");
|
||||
post1.setUsers(List.of(new SysActor("u3")));
|
||||
post1.setOrgid("o1000");
|
||||
post1.setTier("_o1000_p2001_");
|
||||
insert(post1);
|
||||
|
||||
SysPostEntity post2 = new SysPostEntity();
|
||||
post2.setId("p2002");
|
||||
post2.setName("北京分公司总经理");
|
||||
post2.setUsers(List.of(new SysOrg("u4")));
|
||||
post2.setDepid("d1100");
|
||||
post2.setTier("_d1000_d1100_p2002_");
|
||||
post2.setUsers(List.of(new SysActor("u4")));
|
||||
post2.setOrgid("o1100");
|
||||
post2.setTier("_o1000_o1100_p2002_");
|
||||
insert(post2);
|
||||
|
||||
SysPostEntity post3 = new SysPostEntity();
|
||||
post3.setId("p2003");
|
||||
post3.setName("北京分公司销售部长");
|
||||
post3.setUsers(List.of(new SysOrg("u5")));
|
||||
post3.setDepid("d1110");
|
||||
post3.setTier("_d1000_d1100_d1110_p2003_");
|
||||
post3.setUsers(List.of(new SysActor("u5")));
|
||||
post3.setOrgid("o1110");
|
||||
post3.setTier("_o1000_o1100_o1110_p2003_");
|
||||
insert(post3);
|
||||
|
||||
SysPostEntity post4 = new SysPostEntity();
|
||||
post4.setId("p2004");
|
||||
post4.setName("北京分公司销售经理");
|
||||
post4.setUsers(List.of(new SysOrg("u6"),new SysOrg("u7")));
|
||||
post4.setDepid("d1111");
|
||||
post4.setTier("_d1000_d1100_d1110_d1111_p2004_");
|
||||
post4.setUsers(List.of(new SysActor("u6"),new SysActor("u7")));
|
||||
post4.setOrgid("o1111");
|
||||
post4.setTier("_o1000_o1100_o1110_o1111_p2004_");
|
||||
insert(post4);
|
||||
|
||||
}
|
||||
@@ -55,17 +55,17 @@ public class SysPostInitService {
|
||||
|
||||
private final SysPostRepo postRepo;
|
||||
|
||||
private final SysOrgRepo orgRepo;
|
||||
private final SysActorRepo actorRepo;
|
||||
|
||||
private void insert(SysPostEntity post) {
|
||||
post.setAvtag(true);
|
||||
post.setOrnum(Integer.parseInt(post.getId().substring(1)));
|
||||
postRepo.save(post);
|
||||
SysOrg org = new SysOrg();
|
||||
SysActor org = new SysActor();
|
||||
org.setId(post.getId());
|
||||
org.setName(post.getName());
|
||||
org.setType(4);
|
||||
orgRepo.save(org);
|
||||
actorRepo.save(org);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,12 +10,12 @@ import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 组织架构最近访问记录
|
||||
* 系统参与者最近访问记录
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "sys_rece")
|
||||
@Schema(description = "组织架构-最近访问记录")
|
||||
@Schema(description = "系统参与者-最近访问记录")
|
||||
public class SysReceEntity {
|
||||
|
||||
/**
|
||||
@@ -34,15 +34,15 @@ public class SysReceEntity {
|
||||
private String useid;
|
||||
|
||||
/**
|
||||
* 最近使用的组织架构ID
|
||||
* 最近使用的系统参与者ID
|
||||
*/
|
||||
@Column(length = 36)
|
||||
@Schema(description = "最近使用的组织架构ID")
|
||||
private String oid;
|
||||
@Schema(description = "最近使用的系统参与者ID")
|
||||
private String aid;
|
||||
|
||||
/**
|
||||
* 最近使用时间
|
||||
*/
|
||||
@Schema(description = "最近使用的组织架构ID")
|
||||
@Schema(description = "最近使用时间")
|
||||
private Date uptim = new Date();
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package vben.setup.sys.role;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
import vben.common.jpa.entity.SysOrg;
|
||||
import vben.common.jpa.entity.SysActor;
|
||||
import vben.setup.sys.api.SysApiEntity;
|
||||
import vben.setup.sys.menu.SysMenuEntity;
|
||||
|
||||
@@ -30,6 +30,13 @@ public class SysRoleEntity {
|
||||
@Schema(description = "角色名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 角色标识
|
||||
*/
|
||||
@Column(length = 32)
|
||||
@Schema(description = "角色标识")
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 角色类型
|
||||
*/
|
||||
@@ -100,9 +107,15 @@ public class SysRoleEntity {
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(name = "sys_role_org", joinColumns = {@JoinColumn(name = "rid")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "oid")})
|
||||
inverseJoinColumns = {@JoinColumn(name = "aid")})
|
||||
@Schema(description = "自定义数据权限")
|
||||
private List<SysActor> orgs;
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(name = "sys_role_actor", joinColumns = {@JoinColumn(name = "rid")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "aid")})
|
||||
@Schema(description = "成员列表")
|
||||
private List<SysOrg> orgs;
|
||||
private List<SysActor> actors;
|
||||
|
||||
@ManyToMany
|
||||
@JoinTable(name = "sys_role_menu", joinColumns = {@JoinColumn(name = "rid")},
|
||||
|
||||
@@ -3,7 +3,7 @@ package vben.setup.sys.role;
|
||||
import jakarta.transaction.Transactional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import vben.common.jpa.entity.SysOrg;
|
||||
import vben.common.jpa.entity.SysActor;
|
||||
import vben.setup.sys.api.SysApiEntity;
|
||||
import vben.setup.sys.api.SysApiRepo;
|
||||
import vben.setup.sys.menu.SysMenuRepo;
|
||||
@@ -12,7 +12,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门初始化
|
||||
* 系统角色初始化
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -26,7 +26,10 @@ public class SysRoleInitService {
|
||||
role.setName("管理员");
|
||||
role.setNotes("拥有所有权限");
|
||||
role.setOrnum(1);
|
||||
role.setOrgs(List.of(new SysOrg("u2"),new SysOrg("u3"),new SysOrg("u4"),new SysOrg("u5")));
|
||||
role.setLabel("admin");
|
||||
role.setScope(32);
|
||||
role.setType(1);
|
||||
role.setActors(List.of(new SysActor("u2"),new SysActor("u3"),new SysActor("u4"),new SysActor("u5")));
|
||||
role.setMenus(menuRepo.findAll());
|
||||
role.setApis(apiRepo.findAll());
|
||||
list.add(role);
|
||||
@@ -36,14 +39,18 @@ public class SysRoleInitService {
|
||||
role2.setName("普通用户");
|
||||
role2.setNotes("只包含流程使用权限");
|
||||
role2.setOrnum(2);
|
||||
role2.setOrgs(List.of(new SysOrg("u6"),new SysOrg("u7"),new SysOrg("u8"),new SysOrg("u9")));
|
||||
role2.setLabel("test");
|
||||
role2.setScope(1);
|
||||
role2.setType(1);
|
||||
role2.setActors(List.of(new SysActor("u6"),new SysActor("u7"),new SysActor("u8"),new SysActor("u9")));
|
||||
role2.setMenus(menuRepo.findByNameContaining("流程"));
|
||||
role2.getMenus().addAll(menuRepo.findByIdGreaterThan(7999L));
|
||||
List<SysApiEntity> apiList = new ArrayList<>();
|
||||
apiList.add(apiRepo.findByPerm("bpmbus:main:query"));
|
||||
apiList.add(apiRepo.findByPerm("bpmbus:main:add"));
|
||||
apiList.add(apiRepo.findByPerm("bpmbus:main:edit"));
|
||||
// apiList.add(apiRepo.findByPerm("bpmbus:main:appv"));
|
||||
apiList.add(apiRepo.findByPerm("bpm:bus:query"));
|
||||
apiList.add(apiRepo.findByPerm("bpm:bus:add"));
|
||||
apiList.add(apiRepo.findByPerm("bpm:bus:edit"));
|
||||
role2.setApis(apiList);
|
||||
role2.getApis().addAll(apiRepo.findByIdGreaterThan(800000L));
|
||||
list.add(role2);
|
||||
insert(list);
|
||||
}
|
||||
@@ -58,6 +65,8 @@ public class SysRoleInitService {
|
||||
for (SysRoleEntity role : list) {
|
||||
role.setAvtag(true);
|
||||
role.setUptim(role.getCrtim());
|
||||
role.setCruid("u1");
|
||||
role.setUpuid("u1");
|
||||
}
|
||||
roleRepo.saveAll(list);
|
||||
}
|
||||
|
||||
@@ -20,9 +20,9 @@ import java.util.Date;
|
||||
public class SysSocialEntity {
|
||||
|
||||
/**
|
||||
* 创建部门
|
||||
* 创建组织
|
||||
*/
|
||||
private String createDept;
|
||||
private String createOrg;
|
||||
|
||||
/**
|
||||
* 创建者
|
||||
|
||||
+13
-46
@@ -1,4 +1,4 @@
|
||||
package vben.setup.sys.corp;
|
||||
package vben.setup.sys.tenant;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.persistence.Column;
|
||||
@@ -9,49 +9,25 @@ import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 公司
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "sys_corp")
|
||||
@Schema(description = "公司")
|
||||
public class SysCorpEntity {
|
||||
@Table(name = "sys_tenant")
|
||||
@Schema(description = "系统租户")
|
||||
public class SysTenantEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@Id
|
||||
@Column(length = 36)
|
||||
@Schema(description = "主键ID")
|
||||
private String id;
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Column(length = 64)
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 分类ID
|
||||
*/
|
||||
@Column(length = 36)
|
||||
@Schema(description = "分类ID")
|
||||
private String catid;
|
||||
|
||||
/**
|
||||
* 公司类型
|
||||
*/
|
||||
@Schema(description = "公司类型")
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 标签
|
||||
* 租户名称
|
||||
*/
|
||||
@Column(length = 32)
|
||||
@Schema(description = "标签")
|
||||
private String label;
|
||||
@Schema(description = "租户名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
@@ -59,30 +35,21 @@ public class SysCorpEntity {
|
||||
@Schema(description = "备注")
|
||||
private String notes;
|
||||
|
||||
/**
|
||||
* 排序号
|
||||
*/
|
||||
@Schema(description = "排序号")
|
||||
private Integer ornum;
|
||||
|
||||
/**
|
||||
* 可用标记
|
||||
*/
|
||||
@Schema(description = "可用标记")
|
||||
private Boolean avtag;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间")
|
||||
private Date crtim = new Date();
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description = "更新时间")
|
||||
private Date uptim;
|
||||
|
||||
/**
|
||||
* 可用标记
|
||||
*/
|
||||
private Boolean avtag;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
@@ -77,11 +77,11 @@ public class SysUserEntity {
|
||||
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
* 组织ID
|
||||
*/
|
||||
@Column(length = 36)
|
||||
@Schema(description = "部门ID")
|
||||
private String depid;
|
||||
@Schema(description = "组织ID")
|
||||
private String orgid;
|
||||
|
||||
/**
|
||||
* 层级,建议不超过10级
|
||||
|
||||
@@ -3,8 +3,8 @@ package vben.setup.sys.user;
|
||||
import jakarta.transaction.Transactional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import vben.common.jpa.entity.SysOrg;
|
||||
import vben.setup.sys.org.SysOrgRepo;
|
||||
import vben.common.jpa.entity.SysActor;
|
||||
import vben.setup.sys.actor.SysActorRepo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -25,8 +25,8 @@ public class SysUserInitService {
|
||||
user.setId("u1");
|
||||
user.setName("管理员");
|
||||
user.setUsername("admin");
|
||||
user.setDepid("d1000");
|
||||
user.setTier("_d1000_u1_");
|
||||
user.setOrgid("o1000");
|
||||
user.setTier("_o1000_u1_");
|
||||
user.setMonum("13812345678");
|
||||
user.setEmail("admin@qq.com");
|
||||
user.setGender("1");
|
||||
@@ -37,8 +37,8 @@ public class SysUserInitService {
|
||||
user2.setId("u2");
|
||||
user2.setName("小狐狸");
|
||||
user2.setUsername("vben");
|
||||
user2.setDepid("d1000");
|
||||
user2.setTier("_d1000_u2_");
|
||||
user2.setOrgid("o1000");
|
||||
user2.setTier("_o1000_u2_");
|
||||
user2.setMonum("13912345678");
|
||||
user.setEmail("vben@qq.com");
|
||||
user2.setGender("2");
|
||||
@@ -48,56 +48,56 @@ public class SysUserInitService {
|
||||
user3.setId("u3");
|
||||
user3.setName("张三");
|
||||
user3.setUsername("zs");
|
||||
user3.setDepid("d1000");
|
||||
user3.setTier("_d1000_u3_");
|
||||
user3.setOrgid("o1000");
|
||||
user3.setTier("_o1000_u3_");
|
||||
list.add(user3);
|
||||
|
||||
SysUserEntity user4 = new SysUserEntity();
|
||||
user4.setId("u4");
|
||||
user4.setName("李四");
|
||||
user4.setUsername("ls");
|
||||
user4.setDepid("d1100");
|
||||
user4.setTier("_d1000_d1100_u4_");
|
||||
user4.setOrgid("o1100");
|
||||
user4.setTier("_o1000_o1100_u4_");
|
||||
list.add(user4);
|
||||
|
||||
SysUserEntity user5 = new SysUserEntity();
|
||||
user5.setId("u5");
|
||||
user5.setName("王五");
|
||||
user5.setUsername("ww");
|
||||
user5.setDepid("d1110");
|
||||
user5.setTier("_d1000_d1100_d1110_u5_");
|
||||
user5.setOrgid("o1110");
|
||||
user5.setTier("_o1000_o1100_o1110_u5_");
|
||||
list.add(user5);
|
||||
|
||||
SysUserEntity user6 = new SysUserEntity();
|
||||
user6.setId("u6");
|
||||
user6.setName("赵六");
|
||||
user6.setUsername("zl");
|
||||
user6.setDepid("d1111");
|
||||
user6.setTier("_d1000_d1100_d1110_d1111_u6_");
|
||||
user6.setOrgid("o1111");
|
||||
user6.setTier("_o1000_o1100_o1110_o1111_u6_");
|
||||
list.add(user6);
|
||||
|
||||
SysUserEntity user7 = new SysUserEntity();
|
||||
user7.setId("u7");
|
||||
user7.setName("孙七");
|
||||
user7.setUsername("sq");
|
||||
user7.setDepid("d1111");
|
||||
user7.setTier("_d1000_d1100_d1110_d1111_u7_");
|
||||
user7.setOrgid("o1111");
|
||||
user7.setTier("_o1000_o1100_o1110_o1111_u7_");
|
||||
list.add(user7);
|
||||
|
||||
SysUserEntity user8 = new SysUserEntity();
|
||||
user8.setId("u8");
|
||||
user8.setName("周八");
|
||||
user8.setUsername("zb");
|
||||
user8.setDepid("d1111");
|
||||
user8.setTier("_d1000_d1100_d1110_d1111_u8_");
|
||||
user8.setOrgid("o1111");
|
||||
user8.setTier("_o1000_o1100_o1110_o1111_u8_");
|
||||
list.add(user8);
|
||||
|
||||
SysUserEntity user9 = new SysUserEntity();
|
||||
user9.setId("u9");
|
||||
user9.setName("吴九");
|
||||
user9.setUsername("wj");
|
||||
user9.setDepid("d1111");
|
||||
user9.setTier("_d1000_d1100_d1110_d1111_u9_");
|
||||
user9.setOrgid("o1111");
|
||||
user9.setTier("_o1000_o1100_o1110_o1111_u9_");
|
||||
list.add(user9);
|
||||
|
||||
insert(list);
|
||||
@@ -105,22 +105,22 @@ public class SysUserInitService {
|
||||
|
||||
private final SysUserRepo userRepo;
|
||||
|
||||
private final SysOrgRepo orgRepo;
|
||||
private final SysActorRepo actorRepo;
|
||||
|
||||
private void insert(List<SysUserEntity> list) {
|
||||
List<SysOrg> list2=new ArrayList<>();
|
||||
List<SysActor> list2=new ArrayList<>();
|
||||
for (SysUserEntity user : list) {
|
||||
user.setAvtag(true);
|
||||
user.setPassword("$2a$10$09f8rxsX4tbj1CZla2MSOuiwHwp5QAPUzbp5whnoZEFK4/xplNwZq");
|
||||
user.setOrnum(Integer.parseInt(user.getId().substring(1)));
|
||||
SysOrg org = new SysOrg();
|
||||
SysActor org = new SysActor();
|
||||
org.setId(user.getId());
|
||||
org.setName(user.getName());
|
||||
org.setType(2);
|
||||
list2.add(org);
|
||||
}
|
||||
userRepo.saveAll(list);
|
||||
orgRepo.saveAll(list2);
|
||||
actorRepo.saveAll(list2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -11,9 +11,9 @@ import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "tool_dict_main")
|
||||
@Table(name = "tool_dict")
|
||||
@Schema(description = "字典信息")
|
||||
public class ToolDictMainEntity {
|
||||
public class ToolDictEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
@@ -9,7 +9,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门初始化
|
||||
* 字典工具初始化
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@@ -17,11 +17,11 @@ import java.util.List;
|
||||
public class ToolDictInitService {
|
||||
|
||||
public void init() {
|
||||
List<ToolDictMainEntity> list1 = new ArrayList<>();
|
||||
List<ToolDictEntity> list1 = new ArrayList<>();
|
||||
List<ToolDictDataEntity> list2 = new ArrayList<>();
|
||||
|
||||
|
||||
ToolDictMainEntity m1 = new ToolDictMainEntity();
|
||||
ToolDictEntity m1 = new ToolDictEntity();
|
||||
m1.setName("操作类型");
|
||||
m1.setCode("sys_oper_type");
|
||||
m1.setId(1L);
|
||||
@@ -118,7 +118,7 @@ public class ToolDictInitService {
|
||||
d199.setShsty("warning");
|
||||
list2.add(d199);
|
||||
|
||||
ToolDictMainEntity m2 = new ToolDictMainEntity();
|
||||
ToolDictEntity m2 = new ToolDictEntity();
|
||||
m2.setName("授权类型");
|
||||
m2.setCode("sys_grant_type");
|
||||
m2.setId(2L);
|
||||
@@ -170,7 +170,7 @@ public class ToolDictInitService {
|
||||
d205.setShsty("default");
|
||||
list2.add(d205);
|
||||
|
||||
ToolDictMainEntity m3 = new ToolDictMainEntity();
|
||||
ToolDictEntity m3 = new ToolDictEntity();
|
||||
m3.setName("设备类型");
|
||||
m3.setCode("sys_device_type");
|
||||
m3.setId(3L);
|
||||
@@ -220,9 +220,9 @@ public class ToolDictInitService {
|
||||
|
||||
private final ToolDictDataRepo dataRepo;
|
||||
|
||||
private final ToolDictMainRepo mainRepo;
|
||||
private final ToolDictRepo mainRepo;
|
||||
|
||||
private void insert(List<ToolDictMainEntity> list1,List<ToolDictDataEntity> list2) {
|
||||
private void insert(List<ToolDictEntity> list1, List<ToolDictDataEntity> list2) {
|
||||
for (ToolDictDataEntity data : list2) {
|
||||
data.setCrtim(new Date());
|
||||
data.setUptim(data.getCrtim());
|
||||
|
||||
+1
-1
@@ -3,6 +3,6 @@ package vben.setup.tool.dict;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface ToolDictMainRepo extends JpaRepository<ToolDictMainEntity,String> {
|
||||
public interface ToolDictRepo extends JpaRepository<ToolDictEntity,String> {
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 部门初始化
|
||||
* 编号工具初始化
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
|
||||
+4
-4
@@ -3,15 +3,15 @@ package vben.setup.tool.oss;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
import vben.common.jpa.entity.SysOrg;
|
||||
import vben.common.jpa.entity.SysActor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Entity
|
||||
@Data
|
||||
@Schema(description = "OSS存储引用")
|
||||
@Table(name = "tool_oss_main")
|
||||
public class ToolOssMainEntity {
|
||||
@Table(name = "tool_oss")
|
||||
public class ToolOssEntity {
|
||||
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
@@ -40,6 +40,6 @@ public class ToolOssMainEntity {
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "cruid", updatable = false)
|
||||
@Schema(description = "创建人")
|
||||
protected SysOrg crman;
|
||||
protected SysActor crman;
|
||||
|
||||
}
|
||||
@@ -209,8 +209,7 @@ xss:
|
||||
# 排除链接
|
||||
excludeUrls:
|
||||
- /system/notice
|
||||
- /oa/flow/tmpl
|
||||
- /bpm/bus/tmpl
|
||||
- /bpm/bust
|
||||
|
||||
--- # 分布式锁 lock4j 全局配置
|
||||
lock4j:
|
||||
|
||||
+11
-6
@@ -33,19 +33,19 @@ public class LoginUser implements Serializable {
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
* 组织ID
|
||||
*/
|
||||
private String deptId;
|
||||
private String orgid;
|
||||
|
||||
/**
|
||||
* 部门类别编码
|
||||
* 组织类别编码
|
||||
*/
|
||||
private String deptCategory;
|
||||
private String orgty;
|
||||
|
||||
/**
|
||||
* 部门名
|
||||
* 组织名
|
||||
*/
|
||||
private String deptName;
|
||||
private String orgna;
|
||||
|
||||
/**
|
||||
* 用户唯一标识
|
||||
@@ -97,6 +97,11 @@ public class LoginUser implements Serializable {
|
||||
*/
|
||||
private Set<String> rolePermission;
|
||||
|
||||
/**
|
||||
* 数据范围
|
||||
*/
|
||||
private Integer dataScope;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
|
||||
@@ -280,14 +280,14 @@ public class Sqler
|
||||
}
|
||||
|
||||
public Sqler selectCinfo(){
|
||||
addLeftJoin("oo1.name as cruna,t.crtim", "sys_org oo1", "oo1.id=t.cruid");
|
||||
addLeftJoin("aa1.name as cruna,t.crtim", "sys_actor aa1", "aa1.id=t.cruid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Sqler selectCUinfo(){
|
||||
addLeftJoin("oo1.name as cruna,t.crtim", "sys_org oo1", "oo1.id=t.cruid");
|
||||
addLeftJoin("oo2.name as upuna,t.uptim", "sys_org oo2", "oo2.id=t.upuid");
|
||||
addLeftJoin("aa1.name as cruna,t.crtim", "sys_actor aa1", "aa1.id=t.cruid");
|
||||
addLeftJoin("aa2.name as upuna,t.uptim", "sys_actor aa2", "aa2.id=t.upuid");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -54,7 +54,7 @@ public class BaseStrCateEntity {
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "cruid", updatable = false)
|
||||
@Schema(description = "创建人")
|
||||
protected SysOrg crman;
|
||||
protected SysActor crman;
|
||||
|
||||
@Transient
|
||||
protected String cruna;
|
||||
@@ -69,7 +69,7 @@ public class BaseStrCateEntity {
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "upuid")
|
||||
@Schema(description = "更新人")
|
||||
protected SysOrg upman;
|
||||
protected SysActor upman;
|
||||
|
||||
@Transient
|
||||
protected String upuna;
|
||||
|
||||
+4
-4
@@ -22,12 +22,12 @@ public class BaseStrMainEntity {
|
||||
// @ManyToMany
|
||||
// @JoinTable(name = "xxx_viewer", joinColumns = {@JoinColumn(name = "id")},
|
||||
// inverseJoinColumns = {@JoinColumn(name = "org")})
|
||||
// private List<SysOrg> viewers;//记录可查看者
|
||||
// private List<SysActor> viewers;//记录可查看者
|
||||
//
|
||||
// @ManyToMany
|
||||
// @JoinTable(name = "xxx_editor", joinColumns = {@JoinColumn(name = "id")},
|
||||
// inverseJoinColumns = {@JoinColumn(name = "org")})
|
||||
// private List<SysOrg> editors;//记录可编辑者
|
||||
// private List<SysActor> editors;//记录可编辑者
|
||||
|
||||
|
||||
//----------------------norm标准属性-----------------------
|
||||
@@ -41,7 +41,7 @@ public class BaseStrMainEntity {
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "cruid", updatable = false)
|
||||
@Schema(description = "创建人ID")
|
||||
protected SysOrg crman;
|
||||
protected SysActor crman;
|
||||
|
||||
@Column(updatable = false)
|
||||
@Schema(description = "创建时间")
|
||||
@@ -50,7 +50,7 @@ public class BaseStrMainEntity {
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "upuid")
|
||||
@Schema(description = "更新人")
|
||||
protected SysOrg upman;
|
||||
protected SysActor upman;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
protected Date uptim;
|
||||
|
||||
+6
-7
@@ -8,8 +8,8 @@ import lombok.Data;
|
||||
|
||||
@Entity
|
||||
@Data
|
||||
@Schema(description = "组织架构投影")
|
||||
public class SysOrg {
|
||||
@Schema(description = "系统参与者")
|
||||
public class SysActor {
|
||||
|
||||
@Id
|
||||
@Column(length = 36)
|
||||
@@ -20,26 +20,25 @@ public class SysOrg {
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
//1为机构,2为部门,4为岗位,8为用户,16为群组,32为角色
|
||||
@Schema(description = "类型")
|
||||
private Integer type;
|
||||
|
||||
public SysOrg(String id){
|
||||
public SysActor(String id){
|
||||
this.id=id;
|
||||
}
|
||||
|
||||
public SysOrg(String id, String name) {
|
||||
public SysActor(String id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public SysOrg(String id, String name, Integer type) {
|
||||
public SysActor(String id, String name, Integer type) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public SysOrg() {
|
||||
public SysActor() {
|
||||
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -70,7 +70,7 @@ public abstract class BaseCateService<T extends BaseCateEntity> {
|
||||
public T select(Long id) {
|
||||
T main=repo.findById(id).get();
|
||||
//下面的可优化,从缓存读取
|
||||
String sql = "select name from sys_org where id = ?";
|
||||
String sql = "select name from sys_actor where id = ?";
|
||||
if(main.getCruid()!=null){
|
||||
main.setCruna(jdbcHelper.findString(sql, main.getCruid()));
|
||||
}
|
||||
|
||||
+152
-6
@@ -5,6 +5,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import vben.common.core.domain.model.LoginUser;
|
||||
import vben.common.core.exception.ServiceException;
|
||||
import vben.common.core.utils.IdUtils;
|
||||
import vben.common.jdbc.dto.LidName;
|
||||
import vben.common.jdbc.dto.PageData;
|
||||
@@ -32,6 +34,146 @@ public abstract class BaseMainService<T extends BaseMainEntity> {
|
||||
return jdbcHelper.findPageData(sqler);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public PageData findPageDataByPerm(Sqler sqler) {
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
String userId = loginUser.getUserId();
|
||||
Integer dataScope = loginUser.getDataScope();
|
||||
if (!LoginHelper.isSuperAdmin(loginUser.getUserId())) {
|
||||
switch (dataScope) {
|
||||
case 1: //仅本人数据权限
|
||||
sqler.addEqual("t.bluid", userId);
|
||||
break;
|
||||
case 2: //本组织数据权限
|
||||
sqler.addEqual("t.bloid", loginUser.getOrgid());
|
||||
break;
|
||||
case 4: //本组织及以下数据权限
|
||||
sqler.addWhere("t.bloid in (select id from sys_org where tier like ?)",
|
||||
"%" + loginUser.getOrgid() + "%");
|
||||
break;
|
||||
case 8: //本组织及以下或本人数据权限
|
||||
sqler.addWhere("(t.bluid=? or t.bloid in (select id from sys_org where tier like ?))",
|
||||
loginUser.getUserId(), "%" + loginUser.getOrgid() + "%");
|
||||
break;
|
||||
case 16: //自定义数据权限
|
||||
String aids = cacheHandler.getAids(userId);
|
||||
sqler.addWhere("(t.bluid=? or t.bloid in " +
|
||||
"(select o.aid from sys_role_org o inner join sys_role r on r.id=o.rid inner join sys_role_actor a on a.rid=r.id " +
|
||||
"where r.scope=16 and a.aid in (" + aids + ")))", loginUser.getUserId());
|
||||
break;
|
||||
case 32: //全部数据权限
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sqler.getAutoType() == 1) {
|
||||
sqler.selectCUinfo();
|
||||
sqler.addOrder("t.crtim desc");
|
||||
}
|
||||
System.out.println(sqler.getSql());
|
||||
return jdbcHelper.findPageData(sqler);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public void checkPerm(String bluid, String bloid) {
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
if (LoginHelper.isSuperAdmin(loginUser.getUserId())) {
|
||||
return;
|
||||
}
|
||||
String userId = loginUser.getUserId();
|
||||
Integer dataScope = loginUser.getDataScope();
|
||||
switch (dataScope) {
|
||||
case 1: //仅本人数据权限
|
||||
if (userId.equals(bluid)) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 2: //本组织数据权限
|
||||
if (loginUser.getOrgid().equals(bloid)) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 4: //本组织及以下数据权限
|
||||
String sql = "select id from sys_org where tier like ?";
|
||||
List<String> slist = jdbcHelper.findSlist(sql, "%" + loginUser.getOrgid() + "%");
|
||||
if (!slist.isEmpty() && slist.contains(bloid)) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 8: //本组织及以下或本人数据权限
|
||||
if (loginUser.getUserId().equals(bluid)) {
|
||||
return;
|
||||
}
|
||||
String sql2 = "select id from sys_org where tier like ?";
|
||||
List<String> slist2 = jdbcHelper.findSlist(sql2, "%" + loginUser.getOrgid() + "%");
|
||||
if (!slist2.isEmpty() && slist2.contains(bloid)) {
|
||||
return;
|
||||
}
|
||||
case 16: //自定义数据权限
|
||||
if (userId.equals(bluid)) {
|
||||
return;
|
||||
}
|
||||
String aids = cacheHandler.getAids(userId);
|
||||
String sql3 = "select o.aid from sys_role_org o inner join sys_role r on r.id=o.rid inner join sys_role_actor a on a.rid=r.id " +
|
||||
"where r.scope=16 and a.aid in (" + aids + ")";
|
||||
List<String> slist3 = jdbcHelper.findSlist(sql3);
|
||||
if (!slist3.isEmpty() && slist3.contains(bloid)) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 32: //全部数据权限
|
||||
return;
|
||||
}
|
||||
throw new ServiceException("没有此数据权限");
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public PageData findPageDataByViewPerm(Sqler sqler,String table) {
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
String userId = loginUser.getUserId();
|
||||
if (!LoginHelper.isSuperAdmin(loginUser.getUserId())) {
|
||||
String aids = cacheHandler.getAids(userId);
|
||||
sqler.addWhere("EXISTS (SELECT 1 FROM "+table+" v WHERE v.mid = t.id AND v.aid in (" + aids + "))");
|
||||
}
|
||||
if (sqler.getAutoType() == 1) {
|
||||
sqler.selectCUinfo();
|
||||
sqler.addOrder("t.crtim desc");
|
||||
}
|
||||
System.out.println(sqler.getSql());
|
||||
return jdbcHelper.findPageData(sqler);
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public void checkViewPerm(Long id,String table) {
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
if (LoginHelper.isSuperAdmin(loginUser.getUserId())) {
|
||||
return;
|
||||
}
|
||||
String userId = loginUser.getUserId();
|
||||
String aids = cacheHandler.getAids(userId);
|
||||
String sql = "SELECT count(1) FROM "+table+" v WHERE v.mid = ? AND v.aid in (" + aids + ")";
|
||||
Integer count = jdbcHelper.findInteger(sql, id);
|
||||
if (count != null && count >= 1) {
|
||||
return;
|
||||
}
|
||||
throw new ServiceException("没有此数据查看权限");
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public void checkEditPerm(Long id,String table) {
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
if (LoginHelper.isSuperAdmin(loginUser.getUserId())) {
|
||||
return;
|
||||
}
|
||||
String userId = loginUser.getUserId();
|
||||
String aids = cacheHandler.getAids(userId);
|
||||
String sql = "SELECT count(1) FROM "+table+" e WHERE e.mid = ? AND e.aid in (" + aids + ")";
|
||||
Integer count = jdbcHelper.findInteger(sql, id);
|
||||
if (count != null && count >= 1) {
|
||||
return;
|
||||
}
|
||||
throw new ServiceException("没有此数据编辑权限");
|
||||
}
|
||||
|
||||
//查询MapList数据
|
||||
@Transactional(readOnly = true)
|
||||
public List<Map<String, Object>> findMapList(Sqler sqler) {
|
||||
@@ -47,18 +189,19 @@ public abstract class BaseMainService<T extends BaseMainEntity> {
|
||||
//查询单个实体详细信息
|
||||
@Transactional(readOnly = true)
|
||||
public T select(Long id) {
|
||||
T main=repo.findById(id).get();
|
||||
T main = repo.findById(id).get();
|
||||
//下面的可优化,从缓存读取
|
||||
String sql = "select name from sys_org where id = ?";
|
||||
if(main.getCruid()!=null){
|
||||
String sql = "select name from sys_actor where id = ?";
|
||||
if (main.getCruid() != null) {
|
||||
main.setCruna(jdbcHelper.findString(sql, main.getCruid()));
|
||||
}
|
||||
if(main.getUpuid()!=null){
|
||||
if (main.getUpuid() != null) {
|
||||
main.setUpuna(jdbcHelper.findString(sql, main.getUpuid()));
|
||||
}
|
||||
return main;
|
||||
}
|
||||
|
||||
|
||||
//查询所有记录
|
||||
@Transactional(readOnly = true)
|
||||
public List<T> findAll() {
|
||||
@@ -68,7 +211,7 @@ public abstract class BaseMainService<T extends BaseMainEntity> {
|
||||
//查询所有记录
|
||||
@Transactional(readOnly = true)
|
||||
public List<LidName> findIdNameList(Sqler sqler) {
|
||||
return jdbcHelper.getTp().query(sqler.getSql(), new BeanPropertyRowMapper<>(LidName.class),sqler.getParams());
|
||||
return jdbcHelper.getTp().query(sqler.getSql(), new BeanPropertyRowMapper<>(LidName.class), sqler.getParams());
|
||||
}
|
||||
|
||||
//---------------------------------------增删改-------------------------------------
|
||||
@@ -81,7 +224,7 @@ public abstract class BaseMainService<T extends BaseMainEntity> {
|
||||
main.setUptim(main.getCrtim());
|
||||
|
||||
if (main.getCruid() == null) {
|
||||
String UserId=LoginHelper.getUserId();
|
||||
String UserId = LoginHelper.getUserId();
|
||||
main.setCruid(UserId);
|
||||
main.setUpuid(UserId);
|
||||
}
|
||||
@@ -112,6 +255,9 @@ public abstract class BaseMainService<T extends BaseMainEntity> {
|
||||
|
||||
|
||||
//---------------------------------------bean注入-------------------------------------
|
||||
@Autowired
|
||||
protected CacheHandler cacheHandler;
|
||||
|
||||
@Autowired
|
||||
protected JdbcHelper jdbcHelper;
|
||||
|
||||
|
||||
+36
-36
@@ -12,7 +12,7 @@ import vben.common.jdbc.sqler.JdbcHelper;
|
||||
import vben.common.jdbc.sqler.Sqler;
|
||||
import vben.common.core.utils.IdUtils;
|
||||
import vben.common.jpa.entity.BaseStrCateEntity;
|
||||
import vben.common.jpa.entity.SysOrg;
|
||||
import vben.common.jpa.entity.SysActor;
|
||||
import vben.common.satoken.utils.LoginHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -139,8 +139,8 @@ public abstract class BaseStrCateService<T extends BaseStrCateEntity> {
|
||||
cate.setId(IdUtils.getSnowflakeNextIdStr());
|
||||
}
|
||||
if(cate.getCrman()==null){
|
||||
cate.setCrman(new SysOrg(LoginHelper.getUserId()));
|
||||
cate.setUpman(new SysOrg(LoginHelper.getUserId()));
|
||||
cate.setCrman(new SysActor(LoginHelper.getUserId()));
|
||||
cate.setUpman(new SysActor(LoginHelper.getUserId()));
|
||||
}
|
||||
if (cate.getPid() != null) {
|
||||
T parent = repo.findById(cate.getPid()).get();
|
||||
@@ -156,7 +156,7 @@ public abstract class BaseStrCateService<T extends BaseStrCateEntity> {
|
||||
//更新
|
||||
public String update(T cate){
|
||||
cate.setUptim(new Date());
|
||||
cate.setUpman(new SysOrg(LoginHelper.getUserId()));
|
||||
cate.setUpman(new SysActor(LoginHelper.getUserId()));
|
||||
repo.save(cate);
|
||||
return cate.getId();
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public abstract class BaseStrCateService<T extends BaseStrCateEntity> {
|
||||
public String update(T cate,String table,boolean tierChange){
|
||||
cate.setUptim(new Date());
|
||||
if(cate.getUpman()==null){
|
||||
cate.setUpman(new SysOrg(LoginHelper.getUserId()));
|
||||
cate.setUpman(new SysActor(LoginHelper.getUserId()));
|
||||
}
|
||||
String newPid = "";
|
||||
if(cate.getPid()!=null){
|
||||
@@ -273,14 +273,14 @@ public abstract class BaseStrCateService<T extends BaseStrCateEntity> {
|
||||
}
|
||||
|
||||
public void move(Smove bo, String table) throws Exception {
|
||||
T dragDept= repo.findById(bo.getDraid()).get();
|
||||
T dragOrg= repo.findById(bo.getDraid()).get();
|
||||
List<SidOrnum> list2;
|
||||
if(StrUtils.isNotBlank(dragDept.getPid())){
|
||||
if(StrUtils.isNotBlank(dragOrg.getPid())){
|
||||
String sql = "select id,ornum from "+table+" where ornum>? and pid=?";
|
||||
list2 = jdbcHelper.getTp().query(sql,new BeanPropertyRowMapper<>(SidOrnum.class),dragDept.getOrnum(),dragDept.getPid());
|
||||
list2 = jdbcHelper.getTp().query(sql,new BeanPropertyRowMapper<>(SidOrnum.class),dragOrg.getOrnum(),dragOrg.getPid());
|
||||
}else{
|
||||
String sql = "select id,ornum from "+table+" where ornum>? and pid is null";
|
||||
list2 = jdbcHelper.getTp().query(sql,new BeanPropertyRowMapper<>(SidOrnum.class),dragDept.getOrnum());
|
||||
list2 = jdbcHelper.getTp().query(sql,new BeanPropertyRowMapper<>(SidOrnum.class),dragOrg.getOrnum());
|
||||
}
|
||||
|
||||
String updateSql = "update "+table+" set ornum=? where id=?";
|
||||
@@ -296,37 +296,37 @@ public abstract class BaseStrCateService<T extends BaseStrCateEntity> {
|
||||
boolean tierChange=true;
|
||||
if ("inner".equals(bo.getType()))
|
||||
{
|
||||
if(bo.getDroid().equals(dragDept.getPid())){
|
||||
if(bo.getDroid().equals(dragOrg.getPid())){
|
||||
tierChange=false;
|
||||
}
|
||||
dragDept.setPid(bo.getDroid());
|
||||
dragOrg.setPid(bo.getDroid());
|
||||
Integer count=getCount(bo.getDroid(),table);
|
||||
dragDept.setOrnum(count+1);
|
||||
dragOrg.setOrnum(count+1);
|
||||
}
|
||||
else if ("before".equals(bo.getType()))
|
||||
{
|
||||
T dropDept= repo.findById(bo.getDroid()).get();
|
||||
if(dropDept.getPid()!=null){
|
||||
if(dropDept.getPid().equals(dragDept.getPid())){
|
||||
T dropOrg= repo.findById(bo.getDroid()).get();
|
||||
if(dropOrg.getPid()!=null){
|
||||
if(dropOrg.getPid().equals(dragOrg.getPid())){
|
||||
tierChange=false;
|
||||
}
|
||||
dropDept.setPid(dropDept.getPid());
|
||||
dragDept.setPid(dropDept.getPid());;
|
||||
dropOrg.setPid(dropOrg.getPid());
|
||||
dragOrg.setPid(dropOrg.getPid());;
|
||||
}else{
|
||||
if(dragDept.getPid()==null){
|
||||
if(dragOrg.getPid()==null){
|
||||
tierChange=false;
|
||||
}
|
||||
dragDept.setPid(null);
|
||||
dragOrg.setPid(null);
|
||||
}
|
||||
dragDept.setOrnum(dropDept.getOrnum());
|
||||
dragOrg.setOrnum(dropOrg.getOrnum());
|
||||
|
||||
List<SidOrnum> list3;
|
||||
if(StrUtils.isNotBlank(dropDept.getPid())){
|
||||
if(StrUtils.isNotBlank(dropOrg.getPid())){
|
||||
String sql3 = "select id,ornum from "+table+" where ornum>? and pid=?";
|
||||
list3 = jdbcHelper.getTp().query(sql3,new BeanPropertyRowMapper<>(SidOrnum.class),dropDept.getOrnum(),dropDept.getPid());
|
||||
list3 = jdbcHelper.getTp().query(sql3,new BeanPropertyRowMapper<>(SidOrnum.class),dropOrg.getOrnum(),dropOrg.getPid());
|
||||
}else{
|
||||
String sql3 = "select id,ornum from "+table+" where ornum>? and pid is null";
|
||||
list3 = jdbcHelper.getTp().query(sql3,new BeanPropertyRowMapper<>(SidOrnum.class),dropDept.getOrnum());
|
||||
list3 = jdbcHelper.getTp().query(sql3,new BeanPropertyRowMapper<>(SidOrnum.class),dropOrg.getOrnum());
|
||||
}
|
||||
String updateSql3 = "update "+table+" set ornum=? where id=?";
|
||||
List<Object[]> updateList3 = new ArrayList<>();
|
||||
@@ -337,35 +337,35 @@ public abstract class BaseStrCateService<T extends BaseStrCateEntity> {
|
||||
updateList3.add(arr);
|
||||
}
|
||||
jdbcHelper.batch(updateSql3, updateList3);
|
||||
dropDept.setOrnum(dropDept.getOrnum()+1);
|
||||
dropOrg.setOrnum(dropOrg.getOrnum()+1);
|
||||
String updateSql4 = "update "+table+" set ornum=? where id=?";
|
||||
jdbcHelper.update(updateSql4, dropDept.getOrnum(), dropDept.getId());
|
||||
jdbcHelper.update(updateSql4, dropOrg.getOrnum(), dropOrg.getId());
|
||||
}
|
||||
else if ("after".equals(bo.getType()))
|
||||
{
|
||||
T dropDept= repo.findById(bo.getDroid()).get();
|
||||
if(dropDept.getPid()!=null){
|
||||
if(dropDept.getPid().equals(dragDept.getPid())){
|
||||
T dropOrg= repo.findById(bo.getDroid()).get();
|
||||
if(dropOrg.getPid()!=null){
|
||||
if(dropOrg.getPid().equals(dragOrg.getPid())){
|
||||
tierChange=false;
|
||||
}
|
||||
dropDept.setPid(dropDept.getPid());
|
||||
dropOrg.setPid(dropOrg.getPid());
|
||||
}else{
|
||||
if(dragDept.getPid()==null){
|
||||
if(dragOrg.getPid()==null){
|
||||
tierChange=false;
|
||||
}
|
||||
}
|
||||
Integer count = getCount(dropDept.getPid(),table);
|
||||
if (dragDept.getPid()!=null&&dragDept.getPid().equals(dropDept.getPid()))
|
||||
Integer count = getCount(dropOrg.getPid(),table);
|
||||
if (dragOrg.getPid()!=null&&dragOrg.getPid().equals(dropOrg.getPid()))
|
||||
{
|
||||
dragDept.setOrnum(count);
|
||||
dragOrg.setOrnum(count);
|
||||
}
|
||||
else
|
||||
{
|
||||
dragDept.setPid(dropDept.getPid());
|
||||
dragDept.setOrnum(count+1);
|
||||
dragOrg.setPid(dropOrg.getPid());
|
||||
dragOrg.setOrnum(count+1);
|
||||
}
|
||||
}
|
||||
update(dragDept,table,tierChange);
|
||||
update(dragOrg,table,tierChange);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+3
-3
@@ -9,7 +9,7 @@ import vben.common.core.utils.IdUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import vben.common.jpa.entity.SysOrg;
|
||||
import vben.common.jpa.entity.SysActor;
|
||||
import vben.common.satoken.utils.LoginHelper;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -64,7 +64,7 @@ public abstract class BaseStrMainService<T extends BaseStrMainEntity> {
|
||||
// main.setCrtim(new Date());
|
||||
main.setUptim(main.getCrtim());
|
||||
if (main.getCrman() == null) {
|
||||
main.setCrman(new SysOrg(LoginHelper.getUserId()));
|
||||
main.setCrman(new SysActor(LoginHelper.getUserId()));
|
||||
}
|
||||
repo.save(main);
|
||||
return main.getId();
|
||||
@@ -73,7 +73,7 @@ public abstract class BaseStrMainService<T extends BaseStrMainEntity> {
|
||||
//修改
|
||||
public String update(T main) {
|
||||
main.setUptim(new Date());
|
||||
main.setUpman(new SysOrg(LoginHelper.getUserId()));
|
||||
main.setUpman(new SysActor(LoginHelper.getUserId()));
|
||||
repo.save(main);
|
||||
return main.getId();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package vben.common.jpa.service;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import vben.common.core.utils.StrUtils;
|
||||
import vben.common.jdbc.sqler.JdbcHelper;
|
||||
import vben.common.redis.utils.RedisUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class CacheHandler {
|
||||
|
||||
private final JdbcHelper jdbcHelper;
|
||||
|
||||
public String getAids(String userId) {
|
||||
String aids = RedisUtils.getCacheObject("aids:" + userId);
|
||||
if(aids == null){
|
||||
aids = findAids(userId+"");
|
||||
RedisUtils.setCacheObject("aids:" + userId, aids);
|
||||
}
|
||||
return aids;
|
||||
}
|
||||
|
||||
//获取系统参与者ID可用集
|
||||
public String findAids(String id) {
|
||||
String tierSql = "select tier from sys_user where id = ?";
|
||||
String tier = jdbcHelper.findString(tierSql, id);
|
||||
|
||||
StringBuilder aids = new StringBuilder();
|
||||
//1. conds拼接父级id
|
||||
if (StrUtils.isNotBlank(tier)) {
|
||||
String[] pidArr = tier.split("_");
|
||||
for (int i = pidArr.length - 1; i >= 0; i--) {
|
||||
if (!"".equals(pidArr[i])) {
|
||||
aids.append("'").append(pidArr[i]).append("',");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
aids = new StringBuilder("'" + id + "',");
|
||||
}
|
||||
//2. conds拼接岗位id
|
||||
List<String> postList = findPostList(id);
|
||||
for (String str : postList) {
|
||||
aids.append("'").append(str).append("',");
|
||||
}
|
||||
aids = new StringBuilder(aids.substring(0, aids.length() - 1));//优化
|
||||
//3. conds拼接群组id
|
||||
List<String> groupList = findGroupList(aids.toString());
|
||||
for (String str : groupList) {
|
||||
aids.append(",'").append(str).append("'");
|
||||
}
|
||||
return aids.toString();
|
||||
}
|
||||
|
||||
//获取岗位id集合
|
||||
private List<String> findPostList(String uid) {
|
||||
String sql = "select pid as id from sys_post_actor where aid=?";
|
||||
return jdbcHelper.findSlist(sql, uid);
|
||||
}
|
||||
|
||||
//获取群组id集合
|
||||
private List<String> findGroupList(String aids) {
|
||||
String sql = "select DISTINCT gid as id from sys_group_actor where aid in (" + aids + ")";
|
||||
return jdbcHelper.findSlist(sql);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public class LogAspect {
|
||||
operLog.setOperUrl(StrUtils.sub(ServletUtils.getRequest().getRequestURI(), 0, 255));
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
operLog.setOperName(loginUser.getUsername());
|
||||
operLog.setDeptName(loginUser.getDeptName());
|
||||
operLog.setOrgna(loginUser.getOrgna());
|
||||
|
||||
if (e != null) {
|
||||
operLog.setStatus(BusinessStatus.FAIL.ordinal());
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user