forked from gitee/vben-java
~
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package vboot.core.common.mvc.dao;
|
||||
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import vboot.core.common.utils.db.DbType;
|
||||
import vboot.core.module.sys.org.root.SysOrg;
|
||||
import vboot.core.common.mvc.api.PageData;
|
||||
@@ -67,6 +68,10 @@ public class JdbcDao {
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
public List<Ztree> findTreeList(String sql, Object... args) {
|
||||
List<Ztree> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(Ztree.class));
|
||||
return XjsonUtil.buildTreeByRecursive(list);
|
||||
}
|
||||
|
||||
public List<Ztree> findTreeList(Sqler sqler) {
|
||||
List<Ztree> list = jdbcTemplate.query(sqler.getSql(), sqler.getParams(), (rs, rowNum) -> {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package vboot.core.common.mvc.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class IdOrnumPo {
|
||||
private String id;
|
||||
|
||||
private Integer ornum;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package vboot.core.common.mvc.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TreeMovePo {
|
||||
|
||||
private String draid;
|
||||
|
||||
private String droid;
|
||||
|
||||
private String type;
|
||||
|
||||
}
|
||||
@@ -100,7 +100,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
//配置security忽略的请求与资源
|
||||
@Override
|
||||
public void configure(WebSecurity web) {
|
||||
web.ignoring().antMatchers("/","/auth/**","/ws/**","/assets/**","/druid/**","/login", "/index.html","/vben.html","/vue.html","/favicon.ico","/resource/**","/_app.config.js");
|
||||
web.ignoring().antMatchers("/","/auth/**","/ws/**","/ass/oss/main/show","/assets/**","/druid/**","/login", "/index.html","/vben.html","/vue.html","/favicon.ico","/resource/**","/_app.config.js");
|
||||
//测试环境swagger放行
|
||||
web.ignoring().antMatchers("/doc.html","/swagger-ui.html","/webjars/**","/swagger-resources/**","/v2/**","/v3/**");
|
||||
// web.ignoring().antMatchers("/","/login","/getMenuList","/getUserInfo","/assets/**","/druid/**", "/index.html","/vben.html","/vue.html","/favicon.ico","/resource/**","/_app.config.js");
|
||||
|
||||
@@ -32,14 +32,7 @@ public class AuthcApi {
|
||||
@PostMapping("/login")
|
||||
public R login(@Valid @RequestBody LoginVo loginVo, HttpServletRequest request) {
|
||||
//1.登录验证
|
||||
UserDo userDo = null;
|
||||
try {
|
||||
userDo = jdbcDao.getTp().queryForObject(
|
||||
"select id,name,pacod,retag,tier from sys_org_user where usnam=? and avtag=1",
|
||||
new Object[]{loginVo.getUsername()}, new BeanPropertyRowMapper<>(UserDo.class));
|
||||
} catch (DataAccessException ignored) {
|
||||
|
||||
}
|
||||
UserDo userDo = authcService.getDbUserByUsername(loginVo.getUsername());;
|
||||
boolean passFlag = authcService.check(userDo, loginVo);
|
||||
if (!passFlag) {
|
||||
return R.build(402, "账号不存在或密码错误");
|
||||
@@ -103,8 +96,7 @@ public class AuthcApi {
|
||||
Zuser zuser = (Zuser) auth.getPrincipal();
|
||||
|
||||
if (XstrUtil.isBlank(porid)) {
|
||||
UserDo userDo = jdbcDao.getTp().queryForObject("select id,name,pacod,retag from sys_org_user where id=? and avtag=1",
|
||||
new Object[]{zuser.getId()}, new BeanPropertyRowMapper<>(UserDo.class));
|
||||
UserDo userDo= authcService.getDbUserById(zuser.getId());
|
||||
authcService.initZuser(zuser, userDo, backMap);
|
||||
} else {
|
||||
authcService.switchPortal(zuser, backMap, porid);
|
||||
@@ -124,9 +116,6 @@ public class AuthcApi {
|
||||
@Autowired
|
||||
private JwtHandler jwtHandler;
|
||||
|
||||
@Autowired
|
||||
private JdbcDao jdbcDao;
|
||||
|
||||
@Autowired
|
||||
private MonLogLoginService monLogLoginService;
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ package vboot.core.framework.security.authc;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
import vboot.core.common.mvc.dao.JdbcDao;
|
||||
import vboot.core.framework.security.pojo.UserDo;
|
||||
@@ -52,6 +54,23 @@ public class AuthcOrgHandler {
|
||||
return jdbcDao.findStringList(sql);
|
||||
}
|
||||
|
||||
public String findCoopConds(UserDo duser) {
|
||||
StringBuilder conds = new StringBuilder();
|
||||
//1. conds拼接父级id
|
||||
if (StrUtil.isNotBlank(duser.getTier())) {
|
||||
String[] pidArr = duser.getTier().split("x");
|
||||
for (int i = pidArr.length - 1; i >= 0; i--) {
|
||||
if (!"".equals(pidArr[i])) {
|
||||
conds.append("'").append(pidArr[i]).append("',");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
conds = new StringBuilder("'" + duser.getId() + "',");
|
||||
}
|
||||
conds = new StringBuilder(conds.substring(0, conds.length() - 1));//优化
|
||||
return conds.toString();
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private JdbcDao jdbcDao;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package vboot.core.framework.security.authc;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.util.DigestUtils;
|
||||
import vboot.core.common.mvc.dao.JdbcDao;
|
||||
@@ -21,8 +22,40 @@ import java.util.Map;
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class AuthcService {
|
||||
|
||||
public UserDo getDbUserByUsername(String username){
|
||||
UserDo userDo = null;
|
||||
try {
|
||||
userDo = jdbcDao.getTp().queryForObject(
|
||||
"select id,name,pacod,retag,tier,'org' type from sys_org_user where usnam=? and avtag=1",
|
||||
new Object[]{username}, new BeanPropertyRowMapper<>(UserDo.class));
|
||||
} catch (DataAccessException ignored) {
|
||||
try {
|
||||
userDo = jdbcDao.getTp().queryForObject(
|
||||
"select id,name,pacod,retag,tier,'coop' type from sys_coop_user where usnam=? and avtag=1",
|
||||
new Object[]{username}, new BeanPropertyRowMapper<>(UserDo.class));
|
||||
} catch (DataAccessException ignored2) {
|
||||
}
|
||||
}
|
||||
return userDo;
|
||||
}
|
||||
|
||||
public UserDo getDbUserById(String id){
|
||||
UserDo userDo=null;
|
||||
try {
|
||||
userDo = jdbcDao.getTp().queryForObject("select id,name,pacod,retag,'org' type from sys_org_user where id=? and avtag=1",
|
||||
new Object[]{id}, new BeanPropertyRowMapper<>(UserDo.class));
|
||||
}catch (DataAccessException ignored){
|
||||
try {
|
||||
userDo = jdbcDao.getTp().queryForObject("select id,name,pacod,retag,'coop' type from sys_coop_user where id=? and avtag=1",
|
||||
new Object[]{id}, new BeanPropertyRowMapper<>(UserDo.class));
|
||||
} catch (DataAccessException ignored2) {
|
||||
}
|
||||
}
|
||||
return userDo;
|
||||
}
|
||||
|
||||
//校验密码是否正确
|
||||
public boolean check(UserDo userDo,LoginVo loginVo){
|
||||
public boolean check(UserDo userDo, LoginVo loginVo) {
|
||||
|
||||
boolean passFlag = false;
|
||||
if (userDo != null) {
|
||||
@@ -46,8 +79,11 @@ public class AuthcService {
|
||||
//判断是否已经初始化过了,如已初始化,则可走缓存路线
|
||||
if (!userDo.getRetag()) {//数据库按步骤路线
|
||||
//1.获取用户所有的组织架构集:conds
|
||||
String conds = orgHandler.findConds(userDo);
|
||||
zuser.setConds(conds);
|
||||
if ("org".equals(userDo.getType())) {
|
||||
zuser.setConds(orgHandler.findConds(userDo));
|
||||
} else if ("coop".equals(userDo.getType())) {
|
||||
zuser.setConds(orgHandler.findCoopConds(userDo));
|
||||
}
|
||||
|
||||
//2.根据组织架构集conds查询前台菜单集:menus
|
||||
List<Zmenu> menuList;
|
||||
@@ -75,12 +111,23 @@ public class AuthcService {
|
||||
backMap.put("zuser", zuser);
|
||||
|
||||
//5.更新用户,序列化保存数据,使下次这些数据可直接从缓存表读取
|
||||
updateUserCache(zuser, portalList, menuList, btnList);
|
||||
if ("org".equals(userDo.getType())) {
|
||||
updateOrgUserCache(zuser, portalList, menuList, btnList);
|
||||
} else if ("coop".equals(userDo.getType())) {
|
||||
updateCoopUserCache(zuser, portalList, menuList, btnList);
|
||||
}
|
||||
//System.out.println("通过数据库");
|
||||
} else {//缓存路线,可扩展成redis方式
|
||||
String sql = "select conds,menus,btns,perms,portals from sys_org_user_cache where id=?";
|
||||
Map<String, Object> map = jdbcDao.findMap(sql, zuser.getId());
|
||||
zuser.setConds((String) map.get("conds"));
|
||||
Map<String, Object> map = null;
|
||||
if ("org".equals(userDo.getType())) {
|
||||
String sql = "select conds,menus,btns,perms,portals from sys_org_user_cache where id=?";
|
||||
map = jdbcDao.findMap(sql, zuser.getId());
|
||||
zuser.setConds((String) map.get("conds"));
|
||||
} else if ("coop".equals(userDo.getType())) {
|
||||
String sql = "select conds,menus,btns,perms,portals from sys_coop_user_cache where id=?";
|
||||
map = jdbcDao.findMap(sql, zuser.getId());
|
||||
zuser.setConds((String) map.get("conds"));
|
||||
}
|
||||
|
||||
List<Zmenu> menuList = JSON.parseArray((String) map.get("menus"), Zmenu.class);
|
||||
List<Zportal> portalList = JSON.parseArray((String) map.get("portals"), Zportal.class);
|
||||
@@ -168,7 +215,7 @@ public class AuthcService {
|
||||
}
|
||||
|
||||
//缓存用户门户、菜单、按钮到缓存表
|
||||
private void updateUserCache(Zuser zuser, List<Zportal> portalList, List<Zmenu> menuList, List<String> btnList) {
|
||||
private void updateOrgUserCache(Zuser zuser, List<Zportal> portalList, List<Zmenu> menuList, List<String> btnList) {
|
||||
|
||||
String menus = JSON.toJSONString(menuList);
|
||||
String portals = JSON.toJSONString(portalList);
|
||||
@@ -195,6 +242,33 @@ public class AuthcService {
|
||||
jdbcDao.update(retagSql, zuser.getId());
|
||||
}
|
||||
|
||||
private void updateCoopUserCache(Zuser zuser, List<Zportal> portalList, List<Zmenu> menuList, List<String> btnList) {
|
||||
|
||||
String menus = JSON.toJSONString(menuList);
|
||||
String portals = JSON.toJSONString(portalList);
|
||||
StringBuilder btns = new StringBuilder();
|
||||
for (String str : btnList) {
|
||||
btns.append(str).append(";");
|
||||
}
|
||||
|
||||
StringBuilder perms = new StringBuilder();
|
||||
for (long perm : zuser.getPermArr()) {
|
||||
perms.append(perm).append(";");
|
||||
}
|
||||
|
||||
String existSql = "select count(*) from sys_coop_user_cache where id=?";
|
||||
Integer integer = jdbcDao.getTp().queryForObject(existSql, new Object[]{zuser.getId()}, Integer.class);
|
||||
if (integer > 0) {
|
||||
String sql = "update sys_coop_user_cache set conds=?,menus=?,btns=?,perms=?,portals=? where id=?";
|
||||
jdbcDao.update(sql, zuser.getConds(), menus, btns.toString(), perms.toString(), portals, zuser.getId());
|
||||
} else {
|
||||
String sql = "insert into sys_coop_user_cache(id,conds,menus,btns,perms,portals) VALUES(?,?,?,?,?,?)";
|
||||
jdbcDao.update(sql, zuser.getId(), zuser.getConds(), menus, btns.toString(), perms.toString(), portals);
|
||||
}
|
||||
String retagSql = "update sys_coop_user set retag=1 where id=?";
|
||||
jdbcDao.update(retagSql, zuser.getId());
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private AuthcOrgHandler orgHandler;
|
||||
|
||||
|
||||
@@ -16,4 +16,8 @@ public class UserDo {
|
||||
|
||||
private String tier;
|
||||
|
||||
private String type;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -160,6 +160,8 @@ public class VelocityUtils
|
||||
}
|
||||
if("front".equals(table.getRotyp())){
|
||||
templates.add("vms/route/route.json.vm");
|
||||
}else if("back".equals(table.getRotyp())){
|
||||
templates.add("vms/route/route.sql.vm");
|
||||
}
|
||||
|
||||
|
||||
@@ -237,7 +239,11 @@ public class VelocityUtils
|
||||
genTable.getName().replace("_","/"));
|
||||
}else if (template.contains("route.json.vm"))
|
||||
{
|
||||
fileName = StringUtils.format("vue/{}/route.json",
|
||||
fileName = StringUtils.format("route/{}/route.json",
|
||||
genTable.getName().replace("_","/"));
|
||||
}else if (template.contains("route.sql.vm"))
|
||||
{
|
||||
fileName = StringUtils.format("route/{}/route.sql",
|
||||
genTable.getName().replace("_","/"));
|
||||
}
|
||||
// else if (template.contains("domain.java.vm"))
|
||||
|
||||
@@ -8,6 +8,10 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import vboot.core.common.mvc.api.R;
|
||||
import vboot.core.common.mvc.dao.JdbcDao;
|
||||
import vboot.core.common.mvc.dao.Sqler;
|
||||
import vboot.core.common.utils.lang.XstrUtil;
|
||||
import vboot.core.framework.cache.RedisHandler;
|
||||
import vboot.core.framework.security.authz.JwtHandler;
|
||||
import vboot.core.framework.security.pojo.Zuser;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -21,7 +25,7 @@ public class AssOssMainApi {
|
||||
@ApiOperation("查询存储分页")
|
||||
public R get(String name) {
|
||||
Sqler sqler = new Sqler("t.name,t.id,t.type,t.crtim", "ass_oss_main");
|
||||
sqler.addInnerJoin("f.size,f.service,f.path", "ass_oss_file f", "f.id=t.filid");
|
||||
sqler.addInnerJoin("f.zsize,f.service,f.path", "ass_oss_file f", "f.id=t.filid");
|
||||
sqler.addLeftJoin("u.name crman", "sys_org_user u", "u.id=t.crman");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addOrder("t.crtim desc");
|
||||
@@ -34,6 +38,19 @@ public class AssOssMainApi {
|
||||
service.downloadFile(request,response,table,id);
|
||||
}
|
||||
|
||||
@GetMapping("show")
|
||||
@ApiOperation("附件图片预览")
|
||||
public void show(String token, String id, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
if(XstrUtil.isBlank(token)){
|
||||
return;
|
||||
}
|
||||
String uuid = jwtHandler.getClaims(token.substring(7)).getId();
|
||||
Zuser zuser = (Zuser) redisHandler.get("online-key:"+uuid);
|
||||
if(zuser!=null){
|
||||
service.downloadFile(request,response,null,id);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(value="upload",produces = "text/html;charset=UTF-8")
|
||||
@ApiOperation("附件上传")
|
||||
public String upload(@RequestParam(value = "file", required = false) MultipartFile file) throws Exception {
|
||||
@@ -48,6 +65,12 @@ public class AssOssMainApi {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private JwtHandler jwtHandler;
|
||||
|
||||
@Autowired
|
||||
private RedisHandler redisHandler;
|
||||
|
||||
@Autowired
|
||||
private JdbcDao jdbcDao;
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package vboot.core.module.gen.coop;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import vboot.core.common.mvc.api.R;
|
||||
import vboot.core.common.mvc.dao.JdbcDao;
|
||||
import vboot.core.common.mvc.pojo.ZidName;
|
||||
import vboot.core.common.mvc.pojo.Ztree;
|
||||
import vboot.core.common.utils.lang.XstrUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("gen/coop")
|
||||
public class GenCoopApi {
|
||||
|
||||
@GetMapping("tree")
|
||||
public R getTree(String name) {
|
||||
String sql = "select id,pid,name from sys_coop_cate " +
|
||||
"union all select id,catid as pid,name from sys_coop_corp";
|
||||
List<Ztree> list = jdbcDao.findTreeList(sql);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
public R getList(String pid, Integer type) {
|
||||
if (XstrUtil.isBlank(pid) && (type & 1) != 0) {
|
||||
String sql = "select id,name from sys_coop_cate where pid is null order by ornum";
|
||||
return R.ok(jdbcDao.findIdNameList(sql));
|
||||
}
|
||||
List<ZidName> list=new ArrayList<>();
|
||||
if ((type & 1) != 0) {
|
||||
String sql = "select id,name from sys_coop_cate where pid=? order by ornum";
|
||||
list.addAll(jdbcDao.findIdNameList(sql, pid));
|
||||
}
|
||||
if ((type & 2) != 0) {
|
||||
String sql = "select id,name from sys_coop_corp where catid=?";
|
||||
list.addAll(jdbcDao.findIdNameList(sql, pid));
|
||||
}
|
||||
if ((type & 4) != 0) {
|
||||
String sql = "select id,name from sys_coop_user where corid=? order by ornum";
|
||||
list.addAll(jdbcDao.findIdNameList(sql, pid));
|
||||
}
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
private JdbcDao jdbcDao;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package vboot.core.module.gen.org;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import vboot.core.common.mvc.api.R;
|
||||
import vboot.core.common.mvc.dao.JdbcDao;
|
||||
import vboot.core.common.mvc.dao.Sqler;
|
||||
import vboot.core.common.mvc.pojo.ZidName;
|
||||
import vboot.core.common.mvc.pojo.Ztree;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("gen/org/group")
|
||||
public class GenOrgGroupApi {
|
||||
|
||||
@GetMapping("tree")
|
||||
public R getTree(String name) {
|
||||
String sql="select id,pid,name,'cate' type from sys_org_group_cate " +
|
||||
"union all select id,catid as pid,name,'group' type from sys_org_group";
|
||||
List<Ztree> list = jdbcDao.findTreeList(sql);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
public R getList(String pid,String type,String name) {
|
||||
if("cate".equals(type)){
|
||||
String sql="select id,name from sys_org_group where catid=? order by ornum";
|
||||
return R.ok(jdbcDao.findIdNameList(sql, pid));
|
||||
}else if("group".equals(type)){
|
||||
String sql="select t.id,t.name from sys_org t inner join sys_org_group_org o on o.oid=t.id where o.gid=?";
|
||||
return R.ok(jdbcDao.findIdNameList(sql, pid));
|
||||
}else{
|
||||
return R.ok(new ArrayList<ZidName>());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
private JdbcDao jdbcDao;
|
||||
|
||||
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class GenOrgRoleApi {
|
||||
//查询角色
|
||||
@GetMapping("list")
|
||||
public R getList(String treid,String name) {
|
||||
Sqler sqler = new Sqler("sys_org_role_main");
|
||||
Sqler sqler = new Sqler("sys_org_role");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addOrder("t.ornum");
|
||||
sqler.addEqual("t.treid",treid);
|
||||
|
||||
@@ -18,6 +18,17 @@ import java.util.List;
|
||||
@Api(tags = {"接口管理-接口信息"})
|
||||
public class SysApiMainApi {
|
||||
|
||||
@GetMapping("treer")
|
||||
@ApiOperation("查询接口树数据")
|
||||
public R getTreer(String id) {
|
||||
Sqler sqler = new Sqler("t.id,t.id as name,t.pid","sys_api_main");
|
||||
sqler.addLike("t.id", id);
|
||||
sqler.addWhere("t.avtag=1");
|
||||
sqler.addWhere("type is null");
|
||||
List<SysApiMain> list = service.findTree(sqler);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping("tree")
|
||||
@ApiOperation("查询接口树数据")
|
||||
public R getTree(String id) {
|
||||
@@ -30,9 +41,11 @@ public class SysApiMainApi {
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询接口分页")
|
||||
public R get(String id) {
|
||||
public R get(String id,String pid) {
|
||||
Sqler sqler = new Sqler("t.id,t.url,t.type", "sys_api_main");
|
||||
sqler.addLike("t.id", id);
|
||||
sqler.addEqual("t.pid", pid);
|
||||
sqler.addWhere("t.type is not null");
|
||||
sqler.addOrder("t.crtim");
|
||||
sqler.addSelect("t.notes,t.crtim");
|
||||
return R.ok(jdbcDao.findPageData(sqler));
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package vboot.core.module.sys.coop.cate;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import vboot.core.common.mvc.entity.BaseCateEntity;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@ApiModel("协同分类")
|
||||
public class SysCoopCate extends BaseCateEntity {
|
||||
|
||||
@ManyToOne(fetch= FetchType.EAGER)
|
||||
@JoinColumn(name = "pid")
|
||||
@ApiModelProperty("父类别")
|
||||
private SysCoopCate parent;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package vboot.core.module.sys.coop.cate;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import vboot.core.common.mvc.api.R;
|
||||
import vboot.core.common.mvc.dao.Sqler;
|
||||
import vboot.core.common.mvc.pojo.TreeMovePo;
|
||||
import vboot.core.common.mvc.pojo.Ztree;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("sys/coop/cate")
|
||||
public class SysCoopCateApi {
|
||||
|
||||
private String table = "sys_coop_cate";
|
||||
|
||||
@GetMapping("treez")
|
||||
@ApiOperation("查询分类除自身外的分类树")
|
||||
public R getTreez(String name, String id) {
|
||||
List<Ztree> list = service.tier2Choose(table, id, name);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping("treea")
|
||||
@ApiOperation("查询分类树")
|
||||
public R getTreea(String name) {
|
||||
List<Ztree> list = service.findTreeList(table, name);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping("tree")
|
||||
@ApiOperation("查询分类列表")
|
||||
public R getTree(String name) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addOrder("t.ornum");
|
||||
sqler.addWhere("t.avtag=1");
|
||||
sqler.addSelect("t.crtim,t.uptim,t.pid,t.notes");
|
||||
List<SysCoopCate> list = service.findTree(sqler);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询分类分页")
|
||||
public R get(String name) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.notes,t.ornum");
|
||||
return R.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
@ApiOperation("查询分类详情")
|
||||
public R getOne(@PathVariable String id) {
|
||||
SysCoopCate cate = service.findOne(id);
|
||||
return R.ok(cate);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("新增分类")
|
||||
public R post(@RequestBody SysCoopCate cate) {
|
||||
return R.ok(service.insertx(cate));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("更新分类")
|
||||
public R put(@RequestBody SysCoopCate cate) {
|
||||
return R.ok(service.updatex(cate));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
@ApiOperation("删除分类")
|
||||
public R delete(@PathVariable String[] ids) {
|
||||
return R.ok(service.deletex(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SysCoopCateService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package vboot.core.module.sys.coop.cate;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import vboot.core.module.sys.org.group.SysOrgGroupCate;
|
||||
|
||||
public interface SysCoopCateRepo extends JpaRepository<SysCoopCate,String> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package vboot.core.module.sys.coop.cate;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import vboot.core.common.mvc.dao.Sqler;
|
||||
import vboot.core.common.mvc.service.BaseCateService;
|
||||
import vboot.core.module.sys.org.root.SysOrg;
|
||||
import vboot.core.module.sys.org.root.SysOrgRepo;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SysCoopCateService extends BaseCateService<SysCoopCate> {
|
||||
|
||||
public String insertx(SysCoopCate cate){
|
||||
String id= insert(cate);
|
||||
SysOrg sysOrg=new SysOrg(id,cate.getName(),64);
|
||||
orgRepo.save(sysOrg);
|
||||
return id;
|
||||
}
|
||||
|
||||
public String updatex(SysCoopCate cate){
|
||||
updatex(cate);
|
||||
SysOrg sysOrg=new SysOrg(cate.getId(),cate.getName(),64);
|
||||
orgRepo.save(sysOrg);
|
||||
return cate.getId();
|
||||
}
|
||||
|
||||
public int deletex(String[] ids) {
|
||||
for (String id : ids) {
|
||||
repo.deleteById(id);
|
||||
orgRepo.deleteById(id);
|
||||
}
|
||||
return ids.length;
|
||||
}
|
||||
|
||||
|
||||
//获取分类treeTable数据
|
||||
public List<SysCoopCate> findTree(Sqler sqler) {
|
||||
List<SysCoopCate> list = jdbcDao.getTp().query(sqler.getSql(), sqler.getParams(),
|
||||
new BeanPropertyRowMapper<>(SysCoopCate.class));
|
||||
return buildByRecursive(list);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SysOrgRepo orgRepo;
|
||||
|
||||
@Autowired
|
||||
private SysCoopCateRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package vboot.core.module.sys.coop.corp;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import vboot.core.common.mvc.entity.BaseMainEntity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@ApiModel("外部公司")
|
||||
public class SysCoopCorp extends BaseMainEntity {
|
||||
|
||||
@ApiModelProperty("排序号")
|
||||
private Integer ornum;
|
||||
|
||||
@Column(length = 32)
|
||||
@ApiModelProperty("分类ID")
|
||||
private String catid;
|
||||
|
||||
@Column(length = 32)
|
||||
@ApiModelProperty("状态")
|
||||
private String state;
|
||||
|
||||
@Column(length = 32)
|
||||
@ApiModelProperty("流水号")
|
||||
private String senum;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package vboot.core.module.sys.coop.corp;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import vboot.core.common.mvc.api.R;
|
||||
import vboot.core.common.mvc.dao.Sqler;
|
||||
import vboot.core.common.mvc.pojo.Zinp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("sys/coop/corp")
|
||||
@Api(tags = {"外部协同-外部公司"})
|
||||
public class SysCoopCorpApi {
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询分页")
|
||||
public R get(String name,String catid) {
|
||||
Sqler sqler = new Sqler("sys_coop_corp");
|
||||
sqler.addLike("t.name" , name);
|
||||
sqler.addEqual("t.catid" , catid);
|
||||
sqler.addOrder("t.ornum");
|
||||
sqler.addSelect("t.notes");
|
||||
return R.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("tree")
|
||||
public R getTree(String name) {
|
||||
List<Zinp> list = service.findTreeList(name);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
@ApiOperation("查询列表")
|
||||
public R getList() {
|
||||
return R.ok(service.findAll());
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
@ApiOperation("查询详情")
|
||||
public R getOne(@PathVariable String id) {
|
||||
SysCoopCorp main = service.findOne(id);
|
||||
return R.ok(main);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("新增")
|
||||
public R post(@RequestBody SysCoopCorp main) {
|
||||
return R.ok(service.insertx(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("修改")
|
||||
public R put(@RequestBody SysCoopCorp main) {
|
||||
return R.ok(service.updatex(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
@ApiOperation("删除")
|
||||
public R delete(@PathVariable String[] ids) {
|
||||
return R.ok(service.deletex(ids));
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SysCoopCorpService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package vboot.core.module.sys.coop.corp;
|
||||
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface SysCoopCorpRepo extends JpaRepository<SysCoopCorp,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package vboot.core.module.sys.coop.corp;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import vboot.core.common.mvc.dao.Sqler;
|
||||
import vboot.core.common.mvc.pojo.Zinp;
|
||||
import vboot.core.common.mvc.service.BaseMainService;
|
||||
import vboot.core.common.utils.lang.XjsonUtil;
|
||||
import vboot.core.module.sys.coop.cate.SysCoopCate;
|
||||
import vboot.core.module.sys.org.root.SysOrg;
|
||||
import vboot.core.module.sys.org.root.SysOrgRepo;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SysCoopCorpService extends BaseMainService<SysCoopCorp> {
|
||||
|
||||
public String insertx(SysCoopCorp corp){
|
||||
String id= insert(corp);
|
||||
SysOrg sysOrg=new SysOrg(id,corp.getName(),128);
|
||||
orgRepo.save(sysOrg);
|
||||
return id;
|
||||
}
|
||||
|
||||
public String updatex(SysCoopCorp corp){
|
||||
updatex(corp);
|
||||
SysOrg sysOrg=new SysOrg(corp.getId(),corp.getName(),128);
|
||||
orgRepo.save(sysOrg);
|
||||
return corp.getId();
|
||||
}
|
||||
|
||||
public int deletex(String[] ids) {
|
||||
for (String id : ids) {
|
||||
repo.deleteById(id);
|
||||
orgRepo.deleteById(id);
|
||||
}
|
||||
return ids.length;
|
||||
}
|
||||
|
||||
public List<Zinp> findTreeList(String name) {
|
||||
Sqler cateSqler = new Sqler("sys_coop_cate");
|
||||
cateSqler.addSelect("pid");
|
||||
cateSqler.addOrder("t.ornum");
|
||||
List<Zinp> list = jdbcDao.findInpList(cateSqler);
|
||||
|
||||
Sqler mainSqler = new Sqler("sys_coop_corp");
|
||||
mainSqler.addSelect("t.catid as pid");
|
||||
mainSqler.addLike("t.name", name);
|
||||
mainSqler.addOrder("t.ornum");
|
||||
List<Zinp> list2 = jdbcDao.findInpList(mainSqler);
|
||||
list.addAll(list2);
|
||||
|
||||
return XjsonUtil.buildInpByRecursive(list);
|
||||
}
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private SysOrgRepo orgRepo;
|
||||
|
||||
@Autowired
|
||||
private SysCoopCorpRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package vboot.core.module.sys.coop.user;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import vboot.core.common.mvc.entity.BaseMainEntity;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@ApiModel("外部用户")
|
||||
public class SysCoopUser extends BaseMainEntity {
|
||||
|
||||
@ApiModelProperty("主账号标记")// 1启用,0禁用
|
||||
protected Boolean prtag = true;
|
||||
|
||||
@Column(length = 32)
|
||||
@ApiModelProperty("公司ID")
|
||||
private String corid;
|
||||
|
||||
@ApiModelProperty("排序号")
|
||||
private Integer ornum;
|
||||
|
||||
@Column(length = 32)
|
||||
@ApiModelProperty("昵称")
|
||||
private String ninam;
|
||||
|
||||
@Column(length = 32)
|
||||
@ApiModelProperty("登录名")
|
||||
private String usnam;
|
||||
|
||||
@Column(length = 64,updatable = false)
|
||||
@ApiModelProperty("密码")
|
||||
private String pacod;
|
||||
|
||||
@Column(length = 64)
|
||||
@ApiModelProperty("邮箱")
|
||||
private String email;
|
||||
|
||||
@Column(length = 32)
|
||||
@ApiModelProperty("手机号")
|
||||
private String monum;
|
||||
|
||||
@ApiModelProperty("提醒标记")
|
||||
private Boolean watag = false;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String notes;
|
||||
|
||||
@ApiModelProperty("准备标记")
|
||||
private Boolean retag = false;
|
||||
|
||||
@Column(length = 1000)
|
||||
@ApiModelProperty("层级")
|
||||
private String tier;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package vboot.core.module.sys.coop.user;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import vboot.core.common.mvc.api.R;
|
||||
import vboot.core.common.mvc.dao.Sqler;
|
||||
import vboot.core.module.sys.org.user.PacodPo;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("sys/coop/user")
|
||||
@Api(tags = {"外部协同-外部用户"})
|
||||
public class SysCoopUserApi {
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询分页")
|
||||
public R get(String name,String corid) {
|
||||
Sqler sqler = new Sqler("sys_coop_user");
|
||||
sqler.addLike("t.name" , name);
|
||||
sqler.addEqual("t.corid" , corid);
|
||||
sqler.addOrder("t.ornum");
|
||||
sqler.addSelect("t.notes");
|
||||
return R.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
@ApiOperation("查询列表")
|
||||
public R getList() {
|
||||
return R.ok(service.findAll());
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
@ApiOperation("查询详情")
|
||||
public R getOne(@PathVariable String id) {
|
||||
SysCoopUser main = service.findOne(id);
|
||||
return R.ok(main);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("新增")
|
||||
public R post(@RequestBody SysCoopUser main) {
|
||||
return R.ok(service.insertx(main));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("修改")
|
||||
public R put(@RequestBody SysCoopUser main) {
|
||||
return R.ok(service.updatex(main));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
@ApiOperation("删除")
|
||||
public R delete(@PathVariable String[] ids) {
|
||||
return R.ok(service.deletex(ids));
|
||||
}
|
||||
|
||||
@PostMapping("pacod")
|
||||
@ApiOperation("修改密码")
|
||||
public R pacod(@RequestBody PacodPo po) {
|
||||
service.pacod(po);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SysCoopUserService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package vboot.core.module.sys.coop.user;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Lob;
|
||||
|
||||
@Entity
|
||||
@Data
|
||||
public class SysCoopUserCache {
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
private String id;
|
||||
|
||||
@Column(length = 2000)
|
||||
private String conds;//组织架构集
|
||||
|
||||
@Column(length = 2000)
|
||||
private String portals;//前台门户缓存
|
||||
|
||||
@Column(length = 2000)
|
||||
private String perms;//后台所有权限集
|
||||
|
||||
@Lob
|
||||
private String menus;//前台菜单缓存
|
||||
|
||||
@Lob
|
||||
private String btns;//前台按钮缓存
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package vboot.core.module.sys.coop.user;
|
||||
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface SysCoopUserRepo extends JpaRepository<SysCoopUser,String> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package vboot.core.module.sys.coop.user;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.DigestUtils;
|
||||
import vboot.core.common.mvc.service.BaseMainService;
|
||||
import vboot.core.module.sys.org.root.SysOrg;
|
||||
import vboot.core.module.sys.org.root.SysOrgRepo;
|
||||
import vboot.core.module.sys.org.user.PacodPo;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@Service
|
||||
public class SysCoopUserService extends BaseMainService<SysCoopUser> {
|
||||
|
||||
public String insertx(SysCoopUser user){
|
||||
user.setPacod(DigestUtils.md5DigestAsHex(("abc" + user.getPacod() + "xyz").getBytes()));
|
||||
String id= insert(user);
|
||||
SysOrg sysOrg=new SysOrg(id,user.getName(),256);
|
||||
orgRepo.save(sysOrg);
|
||||
return id;
|
||||
}
|
||||
|
||||
public String updatex(SysCoopUser user){
|
||||
updatex(user);
|
||||
SysOrg sysOrg=new SysOrg(user.getId(),user.getName(),256);
|
||||
orgRepo.save(sysOrg);
|
||||
return user.getId();
|
||||
}
|
||||
|
||||
public int deletex(String[] ids) {
|
||||
for (String id : ids) {
|
||||
repo.deleteById(id);
|
||||
orgRepo.deleteById(id);
|
||||
}
|
||||
return ids.length;
|
||||
}
|
||||
|
||||
public void pacod(PacodPo po) {
|
||||
po.setPacod(DigestUtils.md5DigestAsHex(("abc" + po.getPacod() + "xyz").getBytes()));
|
||||
String sql="update sys_coop_user set pacod=? where id=?";
|
||||
jdbcDao.update(sql,po.getPacod(),po.getId());
|
||||
}
|
||||
|
||||
//----------bean注入------------
|
||||
@Autowired
|
||||
private SysOrgRepo orgRepo;
|
||||
|
||||
@Autowired
|
||||
private SysCoopUserRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
import vboot.core.common.mvc.api.R;
|
||||
import vboot.core.common.mvc.dao.JdbcDao;
|
||||
import vboot.core.common.mvc.dao.Sqler;
|
||||
import vboot.core.common.mvc.pojo.TreeMovePo;
|
||||
import vboot.core.common.mvc.pojo.Ztree;
|
||||
import vboot.core.common.utils.lang.XstrUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -91,6 +92,14 @@ public class SysOrgDeptApi {
|
||||
return R.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("move")
|
||||
@ApiOperation("移动部门")
|
||||
public R move(@RequestBody TreeMovePo po) throws Exception {
|
||||
service.move(po);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private JdbcDao jdbcDao;
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package vboot.core.module.sys.org.dept;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import vboot.core.common.mvc.pojo.IdOrnumPo;
|
||||
import vboot.core.common.mvc.pojo.TreeMovePo;
|
||||
import vboot.core.common.mvc.pojo.Ztree;
|
||||
import vboot.core.module.sys.org.root.SysOrg;
|
||||
import vboot.core.common.mvc.dao.JdbcDao;
|
||||
import vboot.core.common.mvc.dao.Sqler;
|
||||
@@ -47,6 +50,9 @@ public class SysOrgDeptService {
|
||||
}
|
||||
|
||||
public SysOrgDept insert(SysOrgDept main) {
|
||||
if(main.getOrnum()==null){
|
||||
main.setOrnum(getCount(main.getPid())+1);
|
||||
}
|
||||
if (main.getId() == null || "".equals(main.getId())) {
|
||||
main.setId(XstrUtil.getUUID());
|
||||
}
|
||||
@@ -65,6 +71,9 @@ public class SysOrgDeptService {
|
||||
|
||||
|
||||
public SysOrgDept update(SysOrgDept main) throws Exception {
|
||||
if(main.getOrnum()==null){
|
||||
main.setOrnum(0);
|
||||
}
|
||||
main.setUptim(new Date());
|
||||
if (main.getParent() == null || StrUtil.isBlank(main.getParent().getId())) {
|
||||
main.setTier("x" + main.getId() + "x");
|
||||
@@ -224,6 +233,121 @@ public class SysOrgDeptService {
|
||||
return node;
|
||||
}
|
||||
|
||||
private Integer getCount(String pid){
|
||||
if(XstrUtil.isNotBlank(pid)){
|
||||
String countSql="select count(1) from sys_org_dept where pid=?";
|
||||
Integer count = jdbcDao.getTp().queryForObject(countSql, new Object[]{pid}, Integer.class);
|
||||
if(count==null){
|
||||
count=0;
|
||||
}
|
||||
return count;
|
||||
}else{
|
||||
String countSql="select count(1) from sys_org_dept where pid is null";
|
||||
Integer count = jdbcDao.getTp().queryForObject(countSql, Integer.class);
|
||||
if(count==null){
|
||||
count=0;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
public void move(TreeMovePo po) throws Exception {
|
||||
SysOrgDept dragDept= deptRepo.findById(po.getDraid()).get();
|
||||
if(dragDept.getParent()!=null){
|
||||
dragDept.setPid(dragDept.getParent().getId());
|
||||
}
|
||||
List<IdOrnumPo> list2;
|
||||
if(XstrUtil.isNotBlank(dragDept.getPid())){
|
||||
String sql = "select id,ornum from sys_org_dept where ornum>? and pid=?";
|
||||
list2 = jdbcDao.getTp().query(sql,new Object[]{dragDept.getOrnum(),dragDept.getPid()},
|
||||
new BeanPropertyRowMapper<>(IdOrnumPo.class));
|
||||
}else{
|
||||
String sql = "select id,ornum from sys_org_dept where ornum>? and pid is null";
|
||||
list2 = jdbcDao.getTp().query(sql,new Object[]{dragDept.getOrnum()},
|
||||
new BeanPropertyRowMapper<>(IdOrnumPo.class));
|
||||
}
|
||||
String updateSql = "update sys_org_dept set ornum=? where id=?";
|
||||
List<Object[]> updateList = new ArrayList<>();
|
||||
for (IdOrnumPo idOrnumPo : list2) {
|
||||
Object[] arr=new Object[2];
|
||||
arr[0]=idOrnumPo.getOrnum()-1;
|
||||
arr[1]=idOrnumPo.getId();
|
||||
updateList.add(arr);
|
||||
}
|
||||
jdbcDao.batch(updateSql, updateList);
|
||||
|
||||
if ("inner".equals(po.getType()))
|
||||
{
|
||||
dragDept.setPid(po.getDroid());
|
||||
dragDept.setParent(new SysOrg(dragDept.getPid()));
|
||||
Integer count=getCount(po.getDroid());
|
||||
dragDept.setOrnum(count+1);
|
||||
}
|
||||
else if ("before".equals(po.getType()))
|
||||
{
|
||||
SysOrgDept dropDept= deptRepo.findById(po.getDroid()).get();
|
||||
if(dropDept.getParent()!=null){
|
||||
dropDept.setPid(dropDept.getParent().getId());
|
||||
dragDept.setPid(dropDept.getPid());;
|
||||
dragDept.setParent(dropDept.getParent());;
|
||||
}else{
|
||||
dragDept.setPid(null);
|
||||
dragDept.setParent(null);
|
||||
}
|
||||
dragDept.setOrnum(dropDept.getOrnum());
|
||||
|
||||
List<IdOrnumPo> list3;
|
||||
if(XstrUtil.isNotBlank(dropDept.getPid())){
|
||||
String sql3 = "select id,ornum from sys_org_dept where ornum>? and pid=?";
|
||||
list3 = jdbcDao.getTp().query(sql3,new Object[]{dropDept.getOrnum(),dropDept.getPid()},
|
||||
new BeanPropertyRowMapper<>(IdOrnumPo.class));
|
||||
}else{
|
||||
String sql3 = "select id,ornum from sys_org_dept where ornum>? and pid is null";
|
||||
list3 = jdbcDao.getTp().query(sql3,new Object[]{dropDept.getOrnum()},
|
||||
new BeanPropertyRowMapper<>(IdOrnumPo.class));
|
||||
}
|
||||
|
||||
String updateSql3 = "update sys_org_dept set ornum=? where id=?";
|
||||
List<Object[]> updateList3 = new ArrayList<>();
|
||||
for (IdOrnumPo idOrnumPo : list3) {
|
||||
Object[] arr=new Object[2];
|
||||
arr[0]=idOrnumPo.getOrnum()+1;
|
||||
arr[1]=idOrnumPo.getId();
|
||||
updateList3.add(arr);
|
||||
}
|
||||
jdbcDao.batch(updateSql3, updateList3);
|
||||
dropDept.setOrnum(dropDept.getOrnum()+1);
|
||||
String updateSql4 = "update sys_org_dept set ornum=? where id=?";
|
||||
jdbcDao.update(updateSql4, dropDept.getOrnum(), dropDept.getId());
|
||||
}
|
||||
else if ("after".equals(po.getType()))
|
||||
{
|
||||
SysOrgDept dropDept= deptRepo.findById(po.getDroid()).get();
|
||||
if(dropDept.getParent()!=null){
|
||||
dropDept.setPid(dropDept.getParent().getId());
|
||||
}
|
||||
Integer count = getCount(dropDept.getPid());
|
||||
if (dragDept.getPid()!=null&&dragDept.getPid().equals(dropDept.getPid()))
|
||||
{
|
||||
dragDept.setOrnum(count);
|
||||
}
|
||||
else
|
||||
{
|
||||
dragDept.setPid(dropDept.getPid());
|
||||
if (dragDept.getPid() == null)
|
||||
{
|
||||
dragDept.setParent(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
dragDept.setParent(new SysOrg(dragDept.getPid()));
|
||||
}
|
||||
dragDept.setOrnum(count+1);
|
||||
}
|
||||
}
|
||||
update(dragDept);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private JdbcDao jdbcDao;
|
||||
|
||||
|
||||
@@ -26,6 +26,10 @@ public class SysOrgGroup {
|
||||
@ApiModelProperty("备注")
|
||||
private String notes;
|
||||
|
||||
@ApiModelProperty("分类ID")
|
||||
@Column(length = 32)
|
||||
private String catid;
|
||||
|
||||
@ApiModelProperty("排序号")
|
||||
private Integer ornum;
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package vboot.core.module.sys.org.group;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import vboot.core.common.mvc.entity.BaseCateEntity;
|
||||
import vboot.core.module.sys.org.root.SysOrg;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Getter
|
||||
@Setter
|
||||
@ApiModel("群组分类")
|
||||
public class SysOrgGroupCate extends BaseCateEntity {
|
||||
|
||||
@ManyToOne(fetch= FetchType.EAGER)
|
||||
@JoinColumn(name = "pid")
|
||||
@ApiModelProperty("父类别")
|
||||
private SysOrgGroupCate parent;
|
||||
|
||||
|
||||
public SysOrgGroupCate() {
|
||||
|
||||
}
|
||||
|
||||
public SysOrgGroupCate(String id) {
|
||||
this.id=id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package vboot.core.module.sys.org.group;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import vboot.core.common.mvc.api.R;
|
||||
import vboot.core.common.mvc.dao.Sqler;
|
||||
import vboot.core.common.mvc.pojo.TreeMovePo;
|
||||
import vboot.core.common.mvc.pojo.Ztree;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("sys/org/group/cate")
|
||||
public class SysOrgGroupCateApi {
|
||||
|
||||
private String table = "sys_org_group_cate";
|
||||
|
||||
@GetMapping("treez")
|
||||
@ApiOperation("查询分类除自身外的分类树")
|
||||
public R getTreez(String name, String id) {
|
||||
List<Ztree> list = service.tier2Choose(table, id, name);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping("treea")
|
||||
@ApiOperation("查询分类树")
|
||||
public R getTreea(String name) {
|
||||
List<Ztree> list = service.findTreeList(table, name);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping("tree")
|
||||
@ApiOperation("查询分类列表")
|
||||
public R getTree(String name) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addOrder("t.ornum");
|
||||
sqler.addWhere("t.avtag=1");
|
||||
sqler.addSelect("t.crtim,t.uptim,t.pid,t.notes");
|
||||
List<SysOrgGroupCate> list = service.findTree(sqler);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询分类分页")
|
||||
public R get(String name) {
|
||||
Sqler sqler = new Sqler(table);
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addSelect("t.notes,t.ornum");
|
||||
return R.ok(service.findPageData(sqler));
|
||||
}
|
||||
|
||||
@GetMapping("one/{id}")
|
||||
@ApiOperation("查询分类详情")
|
||||
public R getOne(@PathVariable String id) {
|
||||
SysOrgGroupCate cate = service.findOne(id);
|
||||
return R.ok(cate);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("新增分类")
|
||||
public R post(@RequestBody SysOrgGroupCate cate) {
|
||||
cate.setOrnum(service.getCount(cate.getPid())+1);
|
||||
return R.ok(service.insert(cate));
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("更新分类")
|
||||
public R put(@RequestBody SysOrgGroupCate cate) {
|
||||
return R.ok(service.update(cate));
|
||||
}
|
||||
|
||||
@DeleteMapping("{ids}")
|
||||
@ApiOperation("删除分类")
|
||||
public R delete(@PathVariable String[] ids) {
|
||||
return R.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@PostMapping("move")
|
||||
@ApiOperation("移动部门")
|
||||
public R move(@RequestBody TreeMovePo po) throws Exception {
|
||||
service.move(po);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SysOrgGroupCateService service;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package vboot.core.module.sys.org.group;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysOrgGroupCateRepo extends JpaRepository<SysOrgGroupCate,String> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package vboot.core.module.sys.org.group;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import vboot.core.common.mvc.dao.Sqler;
|
||||
import vboot.core.common.mvc.pojo.IdOrnumPo;
|
||||
import vboot.core.common.mvc.pojo.TreeMovePo;
|
||||
import vboot.core.common.mvc.service.BaseCateService;
|
||||
import vboot.core.common.utils.lang.XstrUtil;
|
||||
import vboot.core.module.sys.org.dept.SysOrgDept;
|
||||
import vboot.core.module.sys.org.root.SysOrg;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SysOrgGroupCateService extends BaseCateService<SysOrgGroupCate> {
|
||||
|
||||
//获取分类treeTable数据
|
||||
public List<SysOrgGroupCate> findTree(Sqler sqler) {
|
||||
List<SysOrgGroupCate> list = jdbcDao.getTp().query(sqler.getSql(), sqler.getParams(),
|
||||
new BeanPropertyRowMapper<>(SysOrgGroupCate.class));
|
||||
return buildByRecursive(list);
|
||||
}
|
||||
|
||||
public Integer getCount(String pid){
|
||||
if(XstrUtil.isNotBlank(pid)){
|
||||
String countSql="select count(1) from sys_org_group_cate where pid=?";
|
||||
Integer count = jdbcDao.getTp().queryForObject(countSql, new Object[]{pid}, Integer.class);
|
||||
if(count==null){
|
||||
count=0;
|
||||
}
|
||||
return count;
|
||||
}else{
|
||||
String countSql="select count(1) from sys_org_group_cate where pid is null";
|
||||
Integer count = jdbcDao.getTp().queryForObject(countSql, Integer.class);
|
||||
if(count==null){
|
||||
count=0;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void move(TreeMovePo po) throws Exception {
|
||||
SysOrgGroupCate dragDept= repo.findById(po.getDraid()).get();
|
||||
if(dragDept.getParent()!=null){
|
||||
dragDept.setPid(dragDept.getParent().getId());
|
||||
}
|
||||
List<IdOrnumPo> list2;
|
||||
if(XstrUtil.isNotBlank(dragDept.getPid())){
|
||||
String sql = "select id,ornum from sys_org_group_cate where ornum>? and pid=?";
|
||||
list2 = jdbcDao.getTp().query(sql,new Object[]{dragDept.getOrnum(),dragDept.getPid()},
|
||||
new BeanPropertyRowMapper<>(IdOrnumPo.class));
|
||||
}else{
|
||||
String sql = "select id,ornum from sys_org_group_cate where ornum>? and pid is null";
|
||||
list2 = jdbcDao.getTp().query(sql,new Object[]{dragDept.getOrnum()},
|
||||
new BeanPropertyRowMapper<>(IdOrnumPo.class));
|
||||
}
|
||||
|
||||
String updateSql = "update sys_org_group_cate set ornum=? where id=?";
|
||||
List<Object[]> updateList = new ArrayList<>();
|
||||
for (IdOrnumPo idOrnumPo : list2) {
|
||||
Object[] arr=new Object[2];
|
||||
arr[0]=idOrnumPo.getOrnum()-1;
|
||||
arr[1]=idOrnumPo.getId();
|
||||
updateList.add(arr);
|
||||
}
|
||||
jdbcDao.batch(updateSql, updateList);
|
||||
|
||||
if ("inner".equals(po.getType()))
|
||||
{
|
||||
dragDept.setPid(po.getDroid());
|
||||
dragDept.setParent(new SysOrgGroupCate(dragDept.getPid()));
|
||||
Integer count=getCount(po.getDroid());
|
||||
dragDept.setOrnum(count+1);
|
||||
}
|
||||
else if ("before".equals(po.getType()))
|
||||
{
|
||||
SysOrgGroupCate dropDept= repo.findById(po.getDroid()).get();
|
||||
if(dropDept.getParent()!=null){
|
||||
dropDept.setPid(dropDept.getParent().getId());
|
||||
dragDept.setPid(dropDept.getPid());;
|
||||
dragDept.setParent(dropDept.getParent());;
|
||||
}else{
|
||||
dragDept.setPid(null);
|
||||
dragDept.setParent(null);
|
||||
}
|
||||
dragDept.setOrnum(dropDept.getOrnum());
|
||||
|
||||
List<IdOrnumPo> list3;
|
||||
if(XstrUtil.isNotBlank(dropDept.getPid())){
|
||||
String sql3 = "select id,ornum from sys_org_group_cate where ornum>? and pid=?";
|
||||
list3 = jdbcDao.getTp().query(sql3,new Object[]{dropDept.getOrnum(),dropDept.getPid()},
|
||||
new BeanPropertyRowMapper<>(IdOrnumPo.class));
|
||||
}else{
|
||||
String sql3 = "select id,ornum from sys_org_group_cate where ornum>? and pid is null";
|
||||
list3 = jdbcDao.getTp().query(sql3,new Object[]{dropDept.getOrnum()},
|
||||
new BeanPropertyRowMapper<>(IdOrnumPo.class));
|
||||
}
|
||||
String updateSql3 = "update sys_org_group_cate set ornum=? where id=?";
|
||||
List<Object[]> updateList3 = new ArrayList<>();
|
||||
for (IdOrnumPo idOrnumPo : list3) {
|
||||
Object[] arr=new Object[2];
|
||||
arr[0]=idOrnumPo.getOrnum()+1;
|
||||
arr[1]=idOrnumPo.getId();
|
||||
updateList3.add(arr);
|
||||
}
|
||||
jdbcDao.batch(updateSql3, updateList3);
|
||||
dropDept.setOrnum(dropDept.getOrnum()+1);
|
||||
String updateSql4 = "update sys_org_group_cate set ornum=? where id=?";
|
||||
jdbcDao.update(updateSql4, dropDept.getOrnum(), dropDept.getId());
|
||||
}
|
||||
else if ("after".equals(po.getType()))
|
||||
{
|
||||
SysOrgGroupCate dropDept= repo.findById(po.getDroid()).get();
|
||||
if(dropDept.getParent()!=null){
|
||||
dropDept.setPid(dropDept.getParent().getId());
|
||||
}
|
||||
Integer count = getCount(dropDept.getPid());
|
||||
if (dragDept.getPid()!=null&&dragDept.getPid().equals(dropDept.getPid()))
|
||||
{
|
||||
dragDept.setOrnum(count);
|
||||
}
|
||||
else
|
||||
{
|
||||
dragDept.setPid(dropDept.getPid());
|
||||
if (dragDept.getPid() == null)
|
||||
{
|
||||
dragDept.setParent(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
dragDept.setParent(new SysOrgGroupCate(dragDept.getPid()));
|
||||
}
|
||||
dragDept.setOrnum(count+1);
|
||||
}
|
||||
}
|
||||
update(dragDept);
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
private SysOrgGroupCateRepo repo;
|
||||
|
||||
@PostConstruct
|
||||
public void initDao() {
|
||||
super.setRepo(repo);
|
||||
}
|
||||
}
|
||||
+17
-1
@@ -9,7 +9,7 @@ import javax.persistence.Id;
|
||||
//层级角色
|
||||
@Data
|
||||
@Entity
|
||||
public class SysOrgRoleMain {
|
||||
public class SysOrgRole {
|
||||
@Id
|
||||
@Column(length = 36)
|
||||
private String id;//主键
|
||||
@@ -21,5 +21,21 @@ public class SysOrgRoleMain {
|
||||
|
||||
private String notes;//备注
|
||||
|
||||
public SysOrgRole() {
|
||||
}
|
||||
|
||||
public SysOrgRole(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public SysOrgRole(String id, String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public SysOrgRole(String id, String name, Integer ornum) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.ornum = ornum;
|
||||
}
|
||||
}
|
||||
@@ -51,4 +51,11 @@ public class SysOrgRoleNode {
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "memid")
|
||||
private SysOrg member;
|
||||
|
||||
public SysOrgRoleNode() {
|
||||
}
|
||||
|
||||
public SysOrgRoleNode(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,16 @@ package vboot.core.module.sys.org.role;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import vboot.core.common.mvc.api.PageData;
|
||||
import vboot.core.common.mvc.api.R;
|
||||
import vboot.core.common.mvc.dao.JdbcDao;
|
||||
import vboot.core.common.mvc.dao.Sqler;
|
||||
import vboot.core.common.mvc.pojo.TreeMovePo;
|
||||
import vboot.core.common.mvc.pojo.Ztree;
|
||||
import vboot.core.common.utils.lang.XstrUtil;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@@ -18,7 +21,10 @@ public class SysOrgRoleNodeApi {
|
||||
private String table = "sys_org_role_node";
|
||||
|
||||
@GetMapping
|
||||
public R get(String name, String pid, String notes) {
|
||||
public R get(String treid,String name, String pid, String notes) {
|
||||
if(XstrUtil.isBlank(treid)){
|
||||
return R.ok(new PageData(0, new ArrayList<>()));
|
||||
}
|
||||
Sqler sqler = new Sqler(table);
|
||||
if (XstrUtil.isNotBlank(name)) {
|
||||
sqler.addLike("t.name" , name);
|
||||
@@ -32,16 +38,30 @@ public class SysOrgRoleNodeApi {
|
||||
sqler.addLike("t.notes" , notes);
|
||||
sqler.addWhere("t.avtag=1");
|
||||
sqler.addOrder("t.ornum");
|
||||
sqler.addEqual("t.treid",treid);
|
||||
sqler.addSelect("t.ornum,t.notes,t.pid,t.crtim,t.uptim");
|
||||
return R.ok(jdbcDao.findPageData(sqler));
|
||||
}
|
||||
|
||||
//查询层级树
|
||||
@GetMapping("treea")
|
||||
public R getTreea(String treid) {
|
||||
Sqler sqler = new Sqler("sys_org_role_node");
|
||||
sqler.addSelect("t.pid");
|
||||
sqler.addEqual("t.treid", treid);
|
||||
sqler.addOrder("t.ornum");
|
||||
sqler.addWhere("t.avtag=1");
|
||||
List<Ztree> list = jdbcDao.findTreeList(sqler);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
//查询层级树
|
||||
@GetMapping("tree")
|
||||
public R getTree(String name) {
|
||||
public R getTree(String name,String treid) {
|
||||
Sqler sqler = new Sqler("sys_org_role_node");
|
||||
sqler.addSelect("t.pid");
|
||||
sqler.addLike("t.name", name);
|
||||
sqler.addEqual("t.treid", treid);
|
||||
sqler.addOrder("t.ornum");
|
||||
sqler.addWhere("t.avtag=1");
|
||||
List<Ztree> list = jdbcDao.findTreeList(sqler);
|
||||
@@ -65,11 +85,11 @@ public class SysOrgRoleNodeApi {
|
||||
return R.ok(main);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping
|
||||
public R post(@RequestBody SysOrgRoleNode main) {
|
||||
main.setOrnum(service.getCount(main.getPid(),main.getTreid())+1);
|
||||
service.insert(main);
|
||||
|
||||
return R.ok(main.getId());
|
||||
}
|
||||
|
||||
@@ -84,6 +104,13 @@ public class SysOrgRoleNodeApi {
|
||||
return R.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@PostMapping("move")
|
||||
public R move(@RequestBody TreeMovePo po) throws Exception {
|
||||
service.move(po);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
private JdbcDao jdbcDao;
|
||||
|
||||
|
||||
+127
-5
@@ -8,8 +8,11 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import vboot.core.common.mvc.api.PageData;
|
||||
import vboot.core.common.mvc.dao.JdbcDao;
|
||||
import vboot.core.common.mvc.dao.Sqler;
|
||||
import vboot.core.common.mvc.pojo.IdOrnumPo;
|
||||
import vboot.core.common.mvc.pojo.TreeMovePo;
|
||||
import vboot.core.common.mvc.pojo.ZidName;
|
||||
import vboot.core.common.utils.lang.XstrUtil;
|
||||
import vboot.core.module.sys.org.group.SysOrgGroupCate;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -21,7 +24,7 @@ public class SysOrgRoleNodeService {
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public SysOrgRoleNode findById(String id) {
|
||||
return nodeRepo.findById(id).get();
|
||||
return repo.findById(id).get();
|
||||
}
|
||||
|
||||
public SysOrgRoleNode insert(SysOrgRoleNode main) {
|
||||
@@ -34,7 +37,7 @@ public class SysOrgRoleNodeService {
|
||||
String tier = jdbcDao.findOneString("select tier from sys_org_role_node where id=?", main.getParent().getId());
|
||||
main.setTier(tier + main.getId() + "x");
|
||||
}
|
||||
return nodeRepo.save(main);
|
||||
return repo.save(main);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +55,7 @@ public class SysOrgRoleNodeService {
|
||||
}
|
||||
}
|
||||
}
|
||||
SysOrgRoleNode backTier = nodeRepo.save(main);
|
||||
SysOrgRoleNode backTier = repo.save(main);
|
||||
String oldTier = jdbcDao.findOneString("select tier from sys_org_role_node where id=?", main.getId());
|
||||
dealTier(oldTier, main.getTier(), main.getId());
|
||||
return backTier;
|
||||
@@ -60,7 +63,7 @@ public class SysOrgRoleNodeService {
|
||||
|
||||
public int delete(String[] ids) {
|
||||
for (String str : ids) {
|
||||
nodeRepo.deleteById(str);
|
||||
repo.deleteById(str);
|
||||
}
|
||||
return ids.length;
|
||||
}
|
||||
@@ -174,11 +177,130 @@ public class SysOrgRoleNodeService {
|
||||
// return node;
|
||||
// }
|
||||
|
||||
public Integer getCount(String pid,String treid){
|
||||
if(XstrUtil.isNotBlank(pid)){
|
||||
String countSql="select count(1) from sys_org_role_node where pid=?";
|
||||
Integer count = jdbcDao.getTp().queryForObject(countSql, new Object[]{pid}, Integer.class);
|
||||
if(count==null){
|
||||
count=0;
|
||||
}
|
||||
return count;
|
||||
}else{
|
||||
String countSql="select count(1) from sys_org_role_node where pid is null and treid=?";
|
||||
Integer count = jdbcDao.getTp().queryForObject(countSql,new Object[]{treid}, Integer.class);
|
||||
if(count==null){
|
||||
count=0;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void move(TreeMovePo po) throws Exception {
|
||||
SysOrgRoleNode dragDept= repo.findById(po.getDraid()).get();
|
||||
if(dragDept.getParent()!=null){
|
||||
dragDept.setPid(dragDept.getParent().getId());
|
||||
}
|
||||
|
||||
List<IdOrnumPo> list2;
|
||||
|
||||
if(XstrUtil.isNotBlank(dragDept.getPid())){
|
||||
String sql = "select id,ornum from sys_org_role_node where ornum>? and pid=?";
|
||||
list2 = jdbcDao.getTp().query(sql,new Object[]{dragDept.getOrnum(),dragDept.getPid()},
|
||||
new BeanPropertyRowMapper<>(IdOrnumPo.class));
|
||||
}else{
|
||||
String sql = "select id,ornum from sys_org_role_node where ornum>? and treid=? and pid is null";
|
||||
list2 = jdbcDao.getTp().query(sql,new Object[]{dragDept.getOrnum(),dragDept.getTreid()},
|
||||
new BeanPropertyRowMapper<>(IdOrnumPo.class));
|
||||
}
|
||||
|
||||
String updateSql = "update sys_org_role_node set ornum=? where id=?";
|
||||
List<Object[]> updateList = new ArrayList<>();
|
||||
for (IdOrnumPo idOrnumPo : list2) {
|
||||
Object[] arr=new Object[2];
|
||||
arr[0]=idOrnumPo.getOrnum()-1;
|
||||
arr[1]=idOrnumPo.getId();
|
||||
updateList.add(arr);
|
||||
}
|
||||
jdbcDao.batch(updateSql, updateList);
|
||||
|
||||
if ("inner".equals(po.getType()))
|
||||
{
|
||||
dragDept.setPid(po.getDroid());
|
||||
dragDept.setParent(new SysOrgRoleNode(dragDept.getPid()));
|
||||
Integer count=getCount(po.getDroid(),dragDept.getTreid());
|
||||
dragDept.setOrnum(count+1);
|
||||
}
|
||||
else if ("before".equals(po.getType()))
|
||||
{
|
||||
SysOrgRoleNode dropDept= repo.findById(po.getDroid()).get();
|
||||
if(dropDept.getParent()!=null){
|
||||
dropDept.setPid(dropDept.getParent().getId());
|
||||
dragDept.setPid(dropDept.getPid());;
|
||||
dragDept.setParent(dropDept.getParent());;
|
||||
}else{
|
||||
dragDept.setPid(null);
|
||||
dragDept.setParent(null);
|
||||
}
|
||||
dragDept.setOrnum(dropDept.getOrnum());
|
||||
|
||||
List<IdOrnumPo> list3;
|
||||
if(XstrUtil.isNotBlank(dropDept.getPid())){
|
||||
String sql3 = "select id,ornum from sys_org_role_node where ornum>? and pid=?";
|
||||
list3 = jdbcDao.getTp().query(sql3,new Object[]{dropDept.getOrnum(),dropDept.getPid()},
|
||||
new BeanPropertyRowMapper<>(IdOrnumPo.class));
|
||||
}else{
|
||||
String sql3 = "select id,ornum from sys_org_role_node where ornum>? and treid=? and pid is null";
|
||||
list3 = jdbcDao.getTp().query(sql3,new Object[]{dropDept.getOrnum(),dropDept.getTreid()},
|
||||
new BeanPropertyRowMapper<>(IdOrnumPo.class));
|
||||
}
|
||||
|
||||
String updateSql3 = "update sys_org_role_node set ornum=? where id=?";
|
||||
List<Object[]> updateList3 = new ArrayList<>();
|
||||
for (IdOrnumPo idOrnumPo : list3) {
|
||||
Object[] arr=new Object[2];
|
||||
arr[0]=idOrnumPo.getOrnum()+1;
|
||||
arr[1]=idOrnumPo.getId();
|
||||
updateList3.add(arr);
|
||||
}
|
||||
jdbcDao.batch(updateSql3, updateList3);
|
||||
dropDept.setOrnum(dropDept.getOrnum()+1);
|
||||
String updateSql4 = "update sys_org_role_node set ornum=? where id=?";
|
||||
jdbcDao.update(updateSql4, dropDept.getOrnum(), dropDept.getId());
|
||||
}
|
||||
else if ("after".equals(po.getType()))
|
||||
{
|
||||
SysOrgRoleNode dropDept= repo.findById(po.getDroid()).get();
|
||||
if(dropDept.getParent()!=null){
|
||||
dropDept.setPid(dropDept.getParent().getId());
|
||||
}
|
||||
Integer count = getCount(dropDept.getPid(),dropDept.getTreid());
|
||||
if (dragDept.getPid()!=null&&dragDept.getPid().equals(dropDept.getPid()))
|
||||
{
|
||||
dragDept.setOrnum(count);
|
||||
}
|
||||
else
|
||||
{
|
||||
dragDept.setPid(dropDept.getPid());
|
||||
if (dragDept.getPid() == null)
|
||||
{
|
||||
dragDept.setParent(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
dragDept.setParent(new SysOrgRoleNode(dragDept.getPid()));
|
||||
}
|
||||
dragDept.setOrnum(count+1);
|
||||
}
|
||||
}
|
||||
update(dragDept);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private JdbcDao jdbcDao;
|
||||
|
||||
@Autowired
|
||||
private SysOrgRoleNodeRepo nodeRepo;
|
||||
private SysOrgRoleNodeRepo repo;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class SysOrgRoleTree extends BaseMainEntity {
|
||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@JoinColumn(name = "treid")
|
||||
@OrderBy("ornum ASC")
|
||||
private List<SysOrgRoleMain> roles = new ArrayList<>();//层级角色
|
||||
private List<SysOrgRole> roles = new ArrayList<>();//层级角色
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class SysOrgRoleTreeApi {
|
||||
|
||||
@GetMapping("rlist")
|
||||
public R getRlist(String treid) {
|
||||
String sql = "select id,name from sys_org_role_main where treid=?";
|
||||
String sql = "select id,name from sys_org_role where treid=?";
|
||||
return R.ok(jdbcDao.findMapList(sql, treid));
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import vboot.core.common.mvc.service.BaseMainService;
|
||||
import vboot.core.framework.security.pojo.UserDo;
|
||||
import vboot.core.module.sys.org.root.SysOrg;
|
||||
import vboot.core.module.sys.org.root.SysOrgRepo;
|
||||
|
||||
@@ -19,7 +18,7 @@ public class SysOrgRoleTreeService extends BaseMainService<SysOrgRoleTree> {
|
||||
public String insertx(SysOrgRoleTree main) {
|
||||
String id = insert(main);
|
||||
List<SysOrg> list = new ArrayList<>();
|
||||
for (SysOrgRoleMain role : main.getRoles()) {
|
||||
for (SysOrgRole role : main.getRoles()) {
|
||||
SysOrg sysOrg = new SysOrg(role.getId(), role.getName(), 32);
|
||||
list.add(sysOrg);
|
||||
}
|
||||
@@ -30,7 +29,7 @@ public class SysOrgRoleTreeService extends BaseMainService<SysOrgRoleTree> {
|
||||
public String updatex(SysOrgRoleTree main) {
|
||||
String id = update(main);
|
||||
List<SysOrg> list = new ArrayList<>();
|
||||
for (SysOrgRoleMain role : main.getRoles()) {
|
||||
for (SysOrgRole role : main.getRoles()) {
|
||||
SysOrg sysOrg = new SysOrg(role.getId(), role.getName(), 32);
|
||||
list.add(sysOrg);
|
||||
}
|
||||
@@ -40,11 +39,11 @@ public class SysOrgRoleTreeService extends BaseMainService<SysOrgRoleTree> {
|
||||
|
||||
public SysOrg calc(String useid, String rolid) {
|
||||
String sql = "select t.tier \"tier\",m.ornum \"ornum\" from sys_org_role_node t " +
|
||||
"inner join sys_org_role_main m on m.treid=t.treid where t.memid=? and m.id=?";
|
||||
"inner join sys_org_role m on m.treid=t.treid where t.memid=? and m.id=?";
|
||||
Map<String, Object> map = jdbcDao.findMap(sql, useid, rolid);
|
||||
if (map == null) {
|
||||
sql = "select t.tier \"tier\",m.ornum \"ornum\" from sys_org_role_node t " +
|
||||
"inner join sys_org_role_main m on m.treid=t.treid " +
|
||||
"inner join sys_org_role m on m.treid=t.treid " +
|
||||
"inner join sys_org_user u on u.depid=t.memid where u.id=? and m.id=?";
|
||||
map = jdbcDao.findMap(sql, useid, rolid);
|
||||
if (map == null) {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package vboot.core.module.sys.org.user;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PacodPo {
|
||||
|
||||
public String id;
|
||||
|
||||
public String pacod;
|
||||
|
||||
}
|
||||
@@ -59,6 +59,12 @@ public class SysOrgUserApi {
|
||||
return R.ok(service.delete(ids));
|
||||
}
|
||||
|
||||
@PostMapping("pacod")
|
||||
@ApiOperation("修改密码")
|
||||
public R pacod(@RequestBody PacodPo po) {
|
||||
service.pacod(po);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SysOrgUserService service;
|
||||
|
||||
@@ -91,6 +91,12 @@ public class SysOrgUserService {
|
||||
return ids.length;
|
||||
}
|
||||
|
||||
public void pacod(PacodPo po) {
|
||||
po.setPacod(DigestUtils.md5DigestAsHex(("abc" + po.getPacod() + "xyz").getBytes()));
|
||||
String sql="update sys_org_user set pacod=? where id=?";
|
||||
jdbcDao.update(sql,po.getPacod(),po.getId());
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public SysOrgUser findById(String id) {
|
||||
return userRepo.findById(id).get();
|
||||
|
||||
@@ -4,7 +4,12 @@ import vboot.core.common.utils.lang.XstrUtil;
|
||||
import vboot.core.module.sys.org.dept.SysOrgDept;
|
||||
import vboot.core.module.sys.org.dept.SysOrgDeptService;
|
||||
import vboot.core.module.sys.org.group.SysOrgGroup;
|
||||
import vboot.core.module.sys.org.group.SysOrgGroupCate;
|
||||
import vboot.core.module.sys.org.group.SysOrgGroupCateService;
|
||||
import vboot.core.module.sys.org.group.SysOrgGroupService;
|
||||
import vboot.core.module.sys.org.post.SysOrgPost;
|
||||
import vboot.core.module.sys.org.post.SysOrgPostService;
|
||||
import vboot.core.module.sys.org.role.*;
|
||||
import vboot.core.module.sys.org.root.SysOrg;
|
||||
import vboot.core.module.sys.org.user.SysOrgUser;
|
||||
import vboot.core.module.sys.org.user.SysOrgUserService;
|
||||
@@ -633,8 +638,6 @@ public class SysOrgInit {
|
||||
u4.setTier("x"+rootId+"xdept1xl4x");
|
||||
userList.add(u4);
|
||||
|
||||
|
||||
|
||||
SysOrgUser u5 = new SysOrgUser();
|
||||
u5.setId("w5");
|
||||
u5.setUsnam("w5");
|
||||
@@ -681,21 +684,133 @@ public class SysOrgInit {
|
||||
|
||||
userService.insertAll(userList);
|
||||
|
||||
SysOrgGroup group=new SysOrgGroup();
|
||||
group.setId("z3l4");
|
||||
group.setName("张三李四组");
|
||||
group.setAvtag(true);
|
||||
List<SysOrg> list=new ArrayList<>();
|
||||
list.add(new SysOrg("l1"));
|
||||
list.add(new SysOrg("c2"));
|
||||
list.add(new SysOrg("z3"));
|
||||
list.add(new SysOrg("l4"));
|
||||
list.add(new SysOrg("w5"));
|
||||
list.add(new SysOrg("z6"));
|
||||
list.add(new SysOrg("s7"));
|
||||
list.add(new SysOrg("z8"));
|
||||
group.setMembers(list);
|
||||
groupService.insert(group);
|
||||
SysOrgPost p1 = new SysOrgPost();
|
||||
p1.setId("post1");
|
||||
p1.setName("一部负责人");
|
||||
p1.setOrnum(0);
|
||||
p1.setAvtag(true);
|
||||
p1.setDept(new SysOrg("dept1"));
|
||||
p1.setTier("x"+rootId+"xdept1xpost1x");
|
||||
p1.setUsers(new ArrayList<>());
|
||||
p1.getUsers().add(new SysOrg("l1","刘一",8));
|
||||
postService.insert(p1);
|
||||
|
||||
SysOrgPost p2 = new SysOrgPost();
|
||||
p2.setId("post2");
|
||||
p2.setName("二部负责人");
|
||||
p2.setOrnum(0);
|
||||
p2.setAvtag(true);
|
||||
p2.setDept(new SysOrg("dept2"));
|
||||
p2.setTier("x"+rootId+"xdept2xpost2x");
|
||||
p2.setUsers(new ArrayList<>());
|
||||
p2.getUsers().add(new SysOrg("w5","王五",8));
|
||||
p2.getUsers().add(new SysOrg("z6","赵六",8));
|
||||
postService.insert(p2);
|
||||
|
||||
SysOrgGroupCate gcate = new SysOrgGroupCate();
|
||||
gcate.setId("gcate");
|
||||
gcate.setName("测试群组分类");
|
||||
gcate.setAvtag(true);
|
||||
gcate.setOrnum(1);
|
||||
gcate.setCrman(new SysOrg("sa"));
|
||||
groupCateService.insert(gcate);
|
||||
|
||||
SysOrgGroup g1 = new SysOrgGroup();
|
||||
g1.setId("group1");
|
||||
g1.setName("张三李四组");
|
||||
g1.setOrnum(1);
|
||||
g1.setAvtag(true);
|
||||
g1.setCatid("gcate");
|
||||
g1.setMembers(new ArrayList<>());
|
||||
g1.getMembers().add(new SysOrg("z3","张三",8));
|
||||
g1.getMembers().add(new SysOrg("l4","李四",8));
|
||||
groupService.insert(g1);
|
||||
|
||||
SysOrgGroup g2 = new SysOrgGroup();
|
||||
g2.setId("group2");
|
||||
g2.setName("用户岗位部门混合组");
|
||||
g2.setOrnum(2);
|
||||
g2.setAvtag(true);
|
||||
g2.setCatid("gcate");
|
||||
g2.setMembers(new ArrayList<>());
|
||||
g2.getMembers().add(new SysOrg("c2","陈二",8));
|
||||
g2.getMembers().add(new SysOrg("post1","一部负责人",4));
|
||||
g2.getMembers().add(new SysOrg("dept2","测试二部",2));
|
||||
groupService.insert(g2);
|
||||
|
||||
SysOrgRoleTree rtree1 = new SysOrgRoleTree();
|
||||
rtree1.setId("rtree1");
|
||||
rtree1.setName("业务角色树");
|
||||
rtree1.setOrnum(1);
|
||||
rtree1.setAvtag(true);
|
||||
rtree1.setRoles(new ArrayList<>());
|
||||
rtree1.getRoles().add(new SysOrgRole("role1","分管领导",1));
|
||||
rtree1.getRoles().add(new SysOrgRole("role2","部门领导",2));
|
||||
roleTreeService.save(rtree1);
|
||||
|
||||
SysOrgRoleNode rnode1 = new SysOrgRoleNode();
|
||||
rnode1.setId("rnode1");
|
||||
rnode1.setName("一部分管领导");
|
||||
rnode1.setTreid("rtree1");
|
||||
rnode1.setOrnum(1);
|
||||
rnode1.setAvtag(true);
|
||||
rnode1.setMember(new SysOrg("post1"));
|
||||
rnode1.setTier("xrnode1x");
|
||||
roleNodeService.insert(rnode1);
|
||||
|
||||
SysOrgRoleNode rnode11 = new SysOrgRoleNode();
|
||||
rnode11.setId("rnode11");
|
||||
rnode11.setName("一部部门领导");
|
||||
rnode11.setTreid("rtree1");
|
||||
rnode11.setOrnum(1);
|
||||
rnode11.setAvtag(true);
|
||||
rnode11.setMember(new SysOrg("c2"));
|
||||
rnode11.setParent(new SysOrgRoleNode("rnode1"));
|
||||
rnode11.setTier("xrnode1xrnode11x");
|
||||
roleNodeService.insert(rnode11);
|
||||
|
||||
SysOrgRoleNode rnode111 = new SysOrgRoleNode();
|
||||
rnode111.setId("rnode111");
|
||||
rnode111.setName("一部人员");
|
||||
rnode111.setTreid("rtree1");
|
||||
rnode111.setOrnum(1);
|
||||
rnode111.setAvtag(true);
|
||||
rnode111.setMember(new SysOrg("dept1"));
|
||||
rnode111.setParent(new SysOrgRoleNode("rnode11"));
|
||||
rnode111.setTier("xrnode1xrnode11xrnode111x");
|
||||
roleNodeService.insert(rnode111);
|
||||
|
||||
SysOrgRoleNode rnode2 = new SysOrgRoleNode();
|
||||
rnode2.setId("rnode2");
|
||||
rnode2.setName("二部分管领导");
|
||||
rnode2.setTreid("rtree1");
|
||||
rnode2.setOrnum(2);
|
||||
rnode2.setAvtag(true);
|
||||
rnode2.setMember(new SysOrg("post2"));
|
||||
rnode2.setTier("xrnode2x");
|
||||
roleNodeService.insert(rnode2);
|
||||
|
||||
SysOrgRoleNode rnode21 = new SysOrgRoleNode();
|
||||
rnode21.setId("rnode21");
|
||||
rnode21.setName("二部部门领导");
|
||||
rnode21.setTreid("rtree1");
|
||||
rnode21.setOrnum(1);
|
||||
rnode21.setAvtag(true);
|
||||
rnode21.setMember(new SysOrg("z6"));
|
||||
rnode21.setParent(new SysOrgRoleNode("rnode2"));
|
||||
rnode21.setTier("xrnode2xrnode21x");
|
||||
roleNodeService.insert(rnode21);
|
||||
|
||||
SysOrgRoleNode rnode211 = new SysOrgRoleNode();
|
||||
rnode211.setId("rnode211");
|
||||
rnode211.setName("二部人员");
|
||||
rnode211.setTreid("rtree1");
|
||||
rnode211.setOrnum(1);
|
||||
rnode211.setAvtag(true);
|
||||
rnode211.setMember(new SysOrg("dept2"));
|
||||
rnode211.setParent(new SysOrgRoleNode("rnode21"));
|
||||
rnode211.setTier("xrnode2xrnode21xrnode211x");
|
||||
roleNodeService.insert(rnode211);
|
||||
|
||||
}
|
||||
|
||||
@@ -747,6 +862,15 @@ public class SysOrgInit {
|
||||
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private SysOrgRoleNodeService roleNodeService;
|
||||
|
||||
@Autowired
|
||||
private SysOrgRoleTreeService roleTreeService;
|
||||
|
||||
@Autowired
|
||||
private SysOrgGroupCateService groupCateService;
|
||||
|
||||
@Autowired
|
||||
private SysOrgGroupService groupService;
|
||||
|
||||
@@ -756,4 +880,7 @@ public class SysOrgInit {
|
||||
@Autowired
|
||||
private SysOrgUserService userService;
|
||||
|
||||
@Autowired
|
||||
private SysOrgPostService postService;
|
||||
|
||||
}
|
||||
|
||||
@@ -107,11 +107,11 @@ public class SysPortalVueInit {
|
||||
menuService.insert(menu111a);
|
||||
|
||||
SysPortalMenu menu111b = new SysPortalMenu();
|
||||
menu111b.setId("SysOrgDeptIndex2");
|
||||
menu111b.setName("部门编辑");
|
||||
menu111b.setCode("SysOrgDeptIndex2");
|
||||
menu111b.setPath("/sys/org/dept/index2");
|
||||
menu111b.setComp("/sys/org/dept/index2");
|
||||
menu111b.setId("SysOrgDeptTindex");
|
||||
menu111b.setName("部门管理");
|
||||
menu111b.setCode("SysOrgDeptTindex");
|
||||
menu111b.setPath("/sys/org/dept/tindex");
|
||||
menu111b.setComp("/sys/org/dept/tindex");
|
||||
menu111b.setOrnum(11);
|
||||
menu111b.setIcon("ele-Tickets");
|
||||
menu111b.setPid("SysOrg");
|
||||
@@ -266,15 +266,16 @@ public class SysPortalVueInit {
|
||||
menu115b.setPorid("sys");
|
||||
menuService.insert(menu115b);
|
||||
|
||||
|
||||
SysPortalMenu menu12 = new SysPortalMenu();
|
||||
menu12.setId("SysApi");
|
||||
menu12.setName("接口管理");
|
||||
menu12.setCode("SysApi");
|
||||
menu12.setId("SysCoop");
|
||||
menu12.setName("外部协同");
|
||||
menu12.setCode("SysCoop");
|
||||
menu12.setComp("LAYOUT");
|
||||
menu12.setPath("/sys/api");
|
||||
menu12.setRedirect("/sys/api/main");
|
||||
menu12.setPath("/sys/coop");
|
||||
menu12.setRedirect("/sys/coop/user");
|
||||
menu12.setOrnum(2);
|
||||
menu12.setIcon("ele-Lock");
|
||||
menu12.setIcon("ele-Magnet");
|
||||
menu12.setPid("Sys");
|
||||
menu12.setAvtag(true);
|
||||
menu12.setShtag(true);
|
||||
@@ -283,14 +284,14 @@ public class SysPortalVueInit {
|
||||
menuService.insert(menu12);
|
||||
|
||||
SysPortalMenu menu121 = new SysPortalMenu();
|
||||
menu121.setId("SysApiMain");
|
||||
menu121.setName("接口清单");
|
||||
menu121.setCode("SysApiMain");
|
||||
menu121.setPath("/sys/api/main");
|
||||
menu121.setComp("/sys/api/main/index");
|
||||
menu121.setId("SysCoopCate");
|
||||
menu121.setName("协同分类");
|
||||
menu121.setCode("SysCoopCate");
|
||||
menu121.setPath("/sys/coop/cate");
|
||||
menu121.setComp("/sys/coop/cate/index");
|
||||
menu121.setOrnum(10);
|
||||
menu121.setIcon("ele-Tickets");
|
||||
menu121.setPid("SysApi");
|
||||
menu121.setPid("SysCoop");
|
||||
menu121.setCatag(true);
|
||||
menu121.setAvtag(true);
|
||||
menu121.setShtag(true);
|
||||
@@ -298,34 +299,16 @@ public class SysPortalVueInit {
|
||||
menu121.setPorid("sys");
|
||||
menuService.insert(menu121);
|
||||
|
||||
SysPortalMenu menu121a = new SysPortalMenu();
|
||||
menu121a.setId("SysApiMainEdit");
|
||||
menu121a.setName("接口编辑");
|
||||
menu121a.setCode("SysApiMainEdit");
|
||||
menu121a.setPath("/sys/api/main/edit");
|
||||
menu121a.setComp("/sys/api/main/edit");
|
||||
menu121a.setOrnum(11);
|
||||
menu121a.setIcon("ele-Tickets");
|
||||
menu121a.setPid("SysApi");
|
||||
menu121a.setCatag(true);
|
||||
menu121a.setAvtag(true);
|
||||
menu121a.setShtag(false);
|
||||
menu121a.setType("M");
|
||||
menu121a.setPorid("sys");
|
||||
menuService.insert(menu121a);
|
||||
|
||||
SysPortalMenu menu122 = new SysPortalMenu();
|
||||
menu122.setId("SysApiMainDoc");
|
||||
menu122.setName("接口文档");
|
||||
menu122.setCode("SysApiMainDoc");
|
||||
menu122.setPath("/sys/api/role/doc");
|
||||
//menu122.setExtag(true);//外链
|
||||
menu122.setIftag(true);
|
||||
menu122.setComp("http://localhost:5000/doc.html");
|
||||
menu122.setId("SysCoopCorp");
|
||||
menu122.setName("外部公司");
|
||||
menu122.setCode("SysCoopCorp");
|
||||
menu122.setPath("/sys/coop/corp");
|
||||
menu122.setComp("/sys/coop/corp/index");
|
||||
menu122.setOrnum(12);
|
||||
menu122.setIcon("ele-Tickets");
|
||||
menu122.setPid("SysApi");
|
||||
menu122.setCatag(false);
|
||||
menu122.setPid("SysCoop");
|
||||
menu122.setCatag(true);
|
||||
menu122.setAvtag(true);
|
||||
menu122.setShtag(true);
|
||||
menu122.setType("M");
|
||||
@@ -333,14 +316,14 @@ public class SysPortalVueInit {
|
||||
menuService.insert(menu122);
|
||||
|
||||
SysPortalMenu menu123 = new SysPortalMenu();
|
||||
menu123.setId("SysApiRole");
|
||||
menu123.setName("接口角色");
|
||||
menu123.setCode("SysApiRole");
|
||||
menu123.setPath("/sys/api/role");
|
||||
menu123.setComp("/sys/api/role/index");
|
||||
menu123.setOrnum(20);
|
||||
menu123.setId("SysCoopUser");
|
||||
menu123.setName("外部用户");
|
||||
menu123.setCode("SysCoopUser");
|
||||
menu123.setPath("/sys/coop/user");
|
||||
menu123.setComp("/sys/coop/user/index");
|
||||
menu123.setOrnum(13);
|
||||
menu123.setIcon("ele-Tickets");
|
||||
menu123.setPid("SysApi");
|
||||
menu123.setPid("SysCoop");
|
||||
menu123.setCatag(true);
|
||||
menu123.setAvtag(true);
|
||||
menu123.setShtag(true);
|
||||
@@ -348,31 +331,15 @@ public class SysPortalVueInit {
|
||||
menu123.setPorid("sys");
|
||||
menuService.insert(menu123);
|
||||
|
||||
SysPortalMenu menu123a = new SysPortalMenu();
|
||||
menu123a.setId("SysApiRoleEdit");
|
||||
menu123a.setName("角色编辑");
|
||||
menu123a.setCode("SysApiRoleEdit");
|
||||
menu123a.setPath("/sys/api/role/edit");
|
||||
menu123a.setComp("/sys/api/role/edit");
|
||||
menu123a.setOrnum(21);
|
||||
menu123a.setIcon("ele-Tickets");
|
||||
menu123a.setPid("SysApi");
|
||||
menu123a.setCatag(true);
|
||||
menu123a.setAvtag(true);
|
||||
menu123a.setShtag(false);
|
||||
menu123a.setType("M");
|
||||
menu123a.setPorid("sys");
|
||||
menuService.insert(menu123a);
|
||||
|
||||
SysPortalMenu menu13 = new SysPortalMenu();
|
||||
menu13.setId("SysPortal");
|
||||
menu13.setName("门户管理");
|
||||
menu13.setCode("SysPortal");
|
||||
menu13.setId("SysApi");
|
||||
menu13.setName("接口管理");
|
||||
menu13.setCode("SysApi");
|
||||
menu13.setComp("LAYOUT");
|
||||
menu13.setPath("/sys/portal");
|
||||
menu13.setRedirect("/sys/portal/main");
|
||||
menu13.setPath("/sys/api");
|
||||
menu13.setRedirect("/sys/api/main");
|
||||
menu13.setOrnum(3);
|
||||
menu13.setIcon("ele-Notebook");
|
||||
menu13.setIcon("ele-Lock");
|
||||
menu13.setPid("Sys");
|
||||
menu13.setAvtag(true);
|
||||
menu13.setShtag(true);
|
||||
@@ -381,14 +348,14 @@ public class SysPortalVueInit {
|
||||
menuService.insert(menu13);
|
||||
|
||||
SysPortalMenu menu131 = new SysPortalMenu();
|
||||
menu131.setId("SysPortalMain");
|
||||
menu131.setName("门户清单");
|
||||
menu131.setCode("SysPortalMain");
|
||||
menu131.setPath("/sys/portal/main");
|
||||
menu131.setComp("/sys/portal/main/index");
|
||||
menu131.setId("SysApiMain");
|
||||
menu131.setName("接口清单");
|
||||
menu131.setCode("SysApiMain");
|
||||
menu131.setPath("/sys/api/main");
|
||||
menu131.setComp("/sys/api/main/index");
|
||||
menu131.setOrnum(10);
|
||||
menu131.setIcon("ele-Tickets");
|
||||
menu131.setPid("SysPortal");
|
||||
menu131.setPid("SysApi");
|
||||
menu131.setCatag(true);
|
||||
menu131.setAvtag(true);
|
||||
menu131.setShtag(true);
|
||||
@@ -396,63 +363,49 @@ public class SysPortalVueInit {
|
||||
menu131.setPorid("sys");
|
||||
menuService.insert(menu131);
|
||||
|
||||
SysPortalMenu menu131a = new SysPortalMenu();
|
||||
menu131a.setId("SysPortalMainEdit");
|
||||
menu131a.setName("门户编辑");
|
||||
menu131a.setCode("SysPortalMainEdit");
|
||||
menu131a.setPath("/sys/portal/main/edit");
|
||||
menu131a.setComp("/sys/portal/main/edit");
|
||||
menu131a.setOrnum(11);
|
||||
menu131a.setIcon("ele-Tickets");
|
||||
menu131a.setPid("SysPortal");
|
||||
menu131a.setCatag(true);
|
||||
menu131a.setAvtag(true);
|
||||
menu131a.setShtag(false);
|
||||
menu131a.setType("M");
|
||||
menu131a.setPorid("sys");
|
||||
menuService.insert(menu131a);
|
||||
// SysPortalMenu menu121a = new SysPortalMenu();
|
||||
// menu121a.setId("SysApiMainEdit");
|
||||
// menu121a.setName("接口编辑");
|
||||
// menu121a.setCode("SysApiMainEdit");
|
||||
// menu121a.setPath("/sys/api/main/edit");
|
||||
// menu121a.setComp("/sys/api/main/edit");
|
||||
// menu121a.setOrnum(11);
|
||||
// menu121a.setIcon("ele-Tickets");
|
||||
// menu121a.setPid("SysApi");
|
||||
// menu121a.setCatag(true);
|
||||
// menu121a.setAvtag(true);
|
||||
// menu121a.setShtag(false);
|
||||
// menu121a.setType("M");
|
||||
// menu121a.setPorid("sys");
|
||||
// menuService.insert(menu121a);
|
||||
|
||||
SysPortalMenu menu132 = new SysPortalMenu();
|
||||
menu132.setId("SysPortalMenu");
|
||||
menu132.setName("门户菜单");
|
||||
menu132.setCode("SysPortalMenu");
|
||||
menu132.setPath("/sys/portal/menu");
|
||||
menu132.setComp("/sys/portal/menu/index");
|
||||
menu132.setId("SysApiMainDoc");
|
||||
menu132.setName("接口文档");
|
||||
menu132.setCode("SysApiMainDoc");
|
||||
menu132.setPath("/sys/api/role/doc");
|
||||
//menu122.setExtag(true);//外链
|
||||
menu132.setIftag(true);
|
||||
menu132.setComp("http://localhost:5000/doc.html");
|
||||
menu132.setOrnum(12);
|
||||
menu132.setIcon("ele-Tickets");
|
||||
menu132.setPid("SysPortal");
|
||||
menu132.setCatag(true);
|
||||
menu132.setPid("SysApi");
|
||||
menu132.setCatag(false);
|
||||
menu132.setAvtag(true);
|
||||
menu132.setShtag(true);
|
||||
menu132.setType("M");
|
||||
menu132.setPorid("sys");
|
||||
menuService.insert(menu132);
|
||||
|
||||
SysPortalMenu menu132a = new SysPortalMenu();
|
||||
menu132a.setId("SysPortalMenuEdit");
|
||||
menu132a.setName("菜单编辑");
|
||||
menu132a.setCode("SysPortalMenuEdit");
|
||||
menu132a.setPath("/sys/portal/menu/edit");
|
||||
menu132a.setComp("/sys/portal/menu/edit");
|
||||
menu132a.setOrnum(13);
|
||||
menu132a.setIcon("ele-Tickets");
|
||||
menu132a.setPid("SysPortal");
|
||||
menu132a.setCatag(true);
|
||||
menu132a.setAvtag(true);
|
||||
menu132a.setShtag(false);
|
||||
menu132a.setType("M");
|
||||
menu132a.setPorid("sys");
|
||||
menuService.insert(menu132a);
|
||||
|
||||
SysPortalMenu menu133 = new SysPortalMenu();
|
||||
menu133.setId("SysPortalRole");
|
||||
menu133.setName("门户角色");
|
||||
menu133.setCode("SysPortalRole");
|
||||
menu133.setPath("/sys/portal/role");
|
||||
menu133.setComp("/sys/portal/role/index");
|
||||
menu133.setOrnum(14);
|
||||
menu133.setId("SysApiRole");
|
||||
menu133.setName("接口角色");
|
||||
menu133.setCode("SysApiRole");
|
||||
menu133.setPath("/sys/api/role");
|
||||
menu133.setComp("/sys/api/role/index");
|
||||
menu133.setOrnum(20);
|
||||
menu133.setIcon("ele-Tickets");
|
||||
menu133.setPid("SysPortal");
|
||||
menu133.setPid("SysApi");
|
||||
menu133.setCatag(true);
|
||||
menu133.setAvtag(true);
|
||||
menu133.setShtag(true);
|
||||
@@ -461,14 +414,14 @@ public class SysPortalVueInit {
|
||||
menuService.insert(menu133);
|
||||
|
||||
SysPortalMenu menu133a = new SysPortalMenu();
|
||||
menu133a.setId("SysPortalRoleEdit");
|
||||
menu133a.setId("SysApiRoleEdit");
|
||||
menu133a.setName("角色编辑");
|
||||
menu133a.setCode("SysPortalRoleEdit");
|
||||
menu133a.setPath("/sys/portal/role/edit");
|
||||
menu133a.setComp("/sys/portal/role/edit");
|
||||
menu133a.setOrnum(15);
|
||||
menu133a.setCode("SysApiRoleEdit");
|
||||
menu133a.setPath("/sys/api/role/edit");
|
||||
menu133a.setComp("/sys/api/role/edit");
|
||||
menu133a.setOrnum(21);
|
||||
menu133a.setIcon("ele-Tickets");
|
||||
menu133a.setPid("SysPortal");
|
||||
menu133a.setPid("SysApi");
|
||||
menu133a.setCatag(true);
|
||||
menu133a.setAvtag(true);
|
||||
menu133a.setShtag(false);
|
||||
@@ -476,6 +429,118 @@ public class SysPortalVueInit {
|
||||
menu133a.setPorid("sys");
|
||||
menuService.insert(menu133a);
|
||||
|
||||
SysPortalMenu menu14 = new SysPortalMenu();
|
||||
menu14.setId("SysPortal");
|
||||
menu14.setName("门户管理");
|
||||
menu14.setCode("SysPortal");
|
||||
menu14.setComp("LAYOUT");
|
||||
menu14.setPath("/sys/portal");
|
||||
menu14.setRedirect("/sys/portal/main");
|
||||
menu14.setOrnum(4);
|
||||
menu14.setIcon("ele-Notebook");
|
||||
menu14.setPid("Sys");
|
||||
menu14.setAvtag(true);
|
||||
menu14.setShtag(true);
|
||||
menu14.setType("D");
|
||||
menu14.setPorid("sys");
|
||||
menuService.insert(menu14);
|
||||
|
||||
SysPortalMenu menu141 = new SysPortalMenu();
|
||||
menu141.setId("SysPortalMain");
|
||||
menu141.setName("门户清单");
|
||||
menu141.setCode("SysPortalMain");
|
||||
menu141.setPath("/sys/portal/main");
|
||||
menu141.setComp("/sys/portal/main/index");
|
||||
menu141.setOrnum(10);
|
||||
menu141.setIcon("ele-Tickets");
|
||||
menu141.setPid("SysPortal");
|
||||
menu141.setCatag(true);
|
||||
menu141.setAvtag(true);
|
||||
menu141.setShtag(true);
|
||||
menu141.setType("M");
|
||||
menu141.setPorid("sys");
|
||||
menuService.insert(menu141);
|
||||
|
||||
SysPortalMenu menu141a = new SysPortalMenu();
|
||||
menu141a.setId("SysPortalMainEdit");
|
||||
menu141a.setName("门户编辑");
|
||||
menu141a.setCode("SysPortalMainEdit");
|
||||
menu141a.setPath("/sys/portal/main/edit");
|
||||
menu141a.setComp("/sys/portal/main/edit");
|
||||
menu141a.setOrnum(11);
|
||||
menu141a.setIcon("ele-Tickets");
|
||||
menu141a.setPid("SysPortal");
|
||||
menu141a.setCatag(true);
|
||||
menu141a.setAvtag(true);
|
||||
menu141a.setShtag(false);
|
||||
menu141a.setType("M");
|
||||
menu141a.setPorid("sys");
|
||||
menuService.insert(menu141a);
|
||||
|
||||
SysPortalMenu menu142 = new SysPortalMenu();
|
||||
menu142.setId("SysPortalMenu");
|
||||
menu142.setName("门户菜单");
|
||||
menu142.setCode("SysPortalMenu");
|
||||
menu142.setPath("/sys/portal/menu");
|
||||
menu142.setComp("/sys/portal/menu/index");
|
||||
menu142.setOrnum(12);
|
||||
menu142.setIcon("ele-Tickets");
|
||||
menu142.setPid("SysPortal");
|
||||
menu142.setCatag(true);
|
||||
menu142.setAvtag(true);
|
||||
menu142.setShtag(true);
|
||||
menu142.setType("M");
|
||||
menu142.setPorid("sys");
|
||||
menuService.insert(menu142);
|
||||
|
||||
SysPortalMenu menu142a = new SysPortalMenu();
|
||||
menu142a.setId("SysPortalMenuEdit");
|
||||
menu142a.setName("菜单编辑");
|
||||
menu142a.setCode("SysPortalMenuEdit");
|
||||
menu142a.setPath("/sys/portal/menu/edit");
|
||||
menu142a.setComp("/sys/portal/menu/edit");
|
||||
menu142a.setOrnum(13);
|
||||
menu142a.setIcon("ele-Tickets");
|
||||
menu142a.setPid("SysPortal");
|
||||
menu142a.setCatag(true);
|
||||
menu142a.setAvtag(true);
|
||||
menu142a.setShtag(false);
|
||||
menu142a.setType("M");
|
||||
menu142a.setPorid("sys");
|
||||
menuService.insert(menu142a);
|
||||
|
||||
SysPortalMenu menu143 = new SysPortalMenu();
|
||||
menu143.setId("SysPortalRole");
|
||||
menu143.setName("门户角色");
|
||||
menu143.setCode("SysPortalRole");
|
||||
menu143.setPath("/sys/portal/role");
|
||||
menu143.setComp("/sys/portal/role/index");
|
||||
menu143.setOrnum(14);
|
||||
menu143.setIcon("ele-Tickets");
|
||||
menu143.setPid("SysPortal");
|
||||
menu143.setCatag(true);
|
||||
menu143.setAvtag(true);
|
||||
menu143.setShtag(true);
|
||||
menu143.setType("M");
|
||||
menu143.setPorid("sys");
|
||||
menuService.insert(menu143);
|
||||
|
||||
SysPortalMenu menu143a = new SysPortalMenu();
|
||||
menu143a.setId("SysPortalRoleEdit");
|
||||
menu143a.setName("角色编辑");
|
||||
menu143a.setCode("SysPortalRoleEdit");
|
||||
menu143a.setPath("/sys/portal/role/edit");
|
||||
menu143a.setComp("/sys/portal/role/edit");
|
||||
menu143a.setOrnum(15);
|
||||
menu143a.setIcon("ele-Tickets");
|
||||
menu143a.setPid("SysPortal");
|
||||
menu143a.setCatag(true);
|
||||
menu143a.setAvtag(true);
|
||||
menu143a.setShtag(false);
|
||||
menu143a.setType("M");
|
||||
menu143a.setPorid("sys");
|
||||
menuService.insert(menu143a);
|
||||
|
||||
//-----------------监控中心--------------------
|
||||
SysPortalMenu menu2 = new SysPortalMenu();
|
||||
menu2.setId("Mon");
|
||||
@@ -974,38 +1039,6 @@ public class SysPortalVueInit {
|
||||
menu413b.setPorid("sys");
|
||||
menuService.insert(menu413b);
|
||||
|
||||
SysPortalMenu menu414 = new SysPortalMenu();
|
||||
menu414.setId("SysTodoMain");
|
||||
menu414.setName("流程待办");
|
||||
menu414.setCode("SysTodoMain");
|
||||
menu414.setPath("/sys/todo/main");
|
||||
menu414.setComp("/sys/todo/main/index");
|
||||
menu414.setOrnum(414);
|
||||
menu414.setIcon("ele-Tickets");
|
||||
menu414.setPid("OaFlow");
|
||||
menu414.setCatag(true);
|
||||
menu414.setAvtag(true);
|
||||
menu414.setShtag(true);
|
||||
menu414.setType("M");
|
||||
menu414.setPorid("sys");
|
||||
menuService.insert(menu414);
|
||||
|
||||
SysPortalMenu menu414a = new SysPortalMenu();
|
||||
menu414a.setId("SysTodoMainEdit");
|
||||
menu414a.setName("流程待办查看");
|
||||
menu414a.setCode("SysTodoMainEdit");
|
||||
menu414a.setPath("/sys/todo/main/edit");
|
||||
menu414a.setComp("/sys/todo/main/edit");
|
||||
menu414a.setOrnum(4141);
|
||||
menu414a.setIcon("ele-Tickets");
|
||||
menu414a.setPid("OaFlow");
|
||||
menu414a.setCatag(true);
|
||||
menu414a.setAvtag(true);
|
||||
menu414a.setShtag(false);
|
||||
menu414a.setType("M");
|
||||
menu414a.setPorid("sys");
|
||||
menuService.insert(menu414a);
|
||||
|
||||
//-----------------DEMO--------------------
|
||||
SysPortalMenu menu8 = new SysPortalMenu();
|
||||
menu8.setId("My");
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
insert into sys_portal_menu (id,ornum,pid,porid,type,code,icon,path,comp,extag,catag,shtag,iftag,name,crman,avtag)
|
||||
values ('${table.bunam}',999991,null,'sys','M','${table.bunam}','ele-Tickets','/${table.name.replace("_","/")}','/${table.name.replace("_","/")}/index',0,1,1,0,'${table.remark}清单','sa',1);
|
||||
|
||||
#if($table.edtyp=="tab")
|
||||
insert into sys_portal_menu (id,ornum,pid,porid,type,code,icon,path,comp,extag,catag,shtag,iftag,name,crman,avtag)
|
||||
values ('${table.bunam}Edit',999992,null,'sys','M','${table.bunam}Edit','ele-Tickets','/${table.name.replace("_","/")}/edit','/${table.name.replace("_","/")}/edit',0,1,0,0,'${table.remark}编辑','sa',1);
|
||||
#end
|
||||
Reference in New Issue
Block a user