152 changed files with 14752 additions and 3 deletions
@ -0,0 +1,45 @@ |
|||||
|
package com.yxt.user.apiadmin; |
||||
|
|
||||
|
import com.yxt.user.biz.sms.SmsDto; |
||||
|
import com.yxt.user.biz.sms.SmsFeign; |
||||
|
import com.yxt.user.utils.MsgWs; |
||||
|
import com.yxt.common.base.utils.StringUtils; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.user.biz.sms.SmsDto; |
||||
|
import com.yxt.user.utils.MsgWs; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysFunctionFeignFallback.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.biz.sysfunction.SysFunctionRest <br/> |
||||
|
* Description: 功能. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Api(tags = "短信") |
||||
|
@RestController |
||||
|
@RequestMapping("v1/sms") |
||||
|
public class SmsRest { |
||||
|
|
||||
|
|
||||
|
public ResultBean SendWaitWorkMsg(SmsDto dto) { |
||||
|
String mobile = dto.getMobile(); |
||||
|
String msg = dto.getMsg(); |
||||
|
if (StringUtils.isBlank(mobile)){ |
||||
|
return ResultBean.fireFail().setMsg("手机号不能为空!"); |
||||
|
} |
||||
|
if (StringUtils.isBlank(msg)){ |
||||
|
return ResultBean.fireFail().setMsg("信息不能为空!"); |
||||
|
} |
||||
|
String result = MsgWs.SendWaitWorkMsg(mobile, msg); |
||||
|
return ResultBean.fireSuccess(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,218 @@ |
|||||
|
package com.yxt.user.apiadmin; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import com.yxt.user.biz.sysfunction.*; |
||||
|
import com.yxt.user.biz.syssource.SysSource; |
||||
|
import com.yxt.user.biz.syssource.SysSourceVo; |
||||
|
//import com.yxt.user.biz.syssourcefunction.SysSourceFunction;
|
||||
|
import com.yxt.user.biz.syssource.SysSourceService; |
||||
|
//import com.yxt.user.biz.syssourcefunction.SysSourceFunctionService;
|
||||
|
import com.yxt.common.base.utils.StringUtils; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysFunctionFeignFallback.java <br/> |
||||
|
* Class: com.yxt.user.biz.sysfunction.SysFunctionRest <br/> |
||||
|
* Description: 功能. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Api(tags = "功能") |
||||
|
@RestController |
||||
|
@RequestMapping("v1/sysfunction") |
||||
|
public class SysFunctionRest { |
||||
|
|
||||
|
@Autowired |
||||
|
private SysFunctionService sysFunctionService; |
||||
|
@Autowired |
||||
|
private SysSourceService sysSourceService; |
||||
|
// @Autowired
|
||||
|
// private SysSourceFunctionService sysSourceFunctionService;
|
||||
|
|
||||
|
|
||||
|
public ResultBean<PagerVo<SysFunctionVo>> listPage(@RequestBody PagerQuery<SysFunctionQuery> pq) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
PagerVo<SysFunctionVo> pv = sysFunctionService.listPageVo(pq); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysFunctionVo>> listAll(@RequestBody SysFunctionQuery query) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysFunctionVo> list = sysFunctionService.listAllVo(query); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysFunctionVo>> listAllByRoleSid(SysFunctionQuery query) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysFunctionVo> list = sysFunctionService.listAllByRoleSid(query); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysFunctionTreeVo>> listAllVoForSource(@RequestBody SysFunctionQuery query) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysFunctionTreeVo> list = sysFunctionService.listAllVoForSource(query); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysFunctionVo>> list() { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysFunctionVo> list = sysFunctionService.listVo(); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean save(SysFunctionDto dto) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
String sourceSid = dto.getSourceSid(); |
||||
|
if (StringUtils.isBlank(sourceSid)) { |
||||
|
return ResultBean.fireFail().setMessage("资源不能为空"); |
||||
|
} else { |
||||
|
SysSourceVo sysSourceVo = sysSourceService.fetchBySidVo(sourceSid); |
||||
|
if (sysSourceVo.getSid() == null) { |
||||
|
return ResultBean.fireFail().setMessage("资源不存在"); |
||||
|
} |
||||
|
} |
||||
|
String pSid = dto.getParentSid(); |
||||
|
if (StringUtils.isBlank(pSid)) { |
||||
|
return ResultBean.fireFail().setMessage("菜单父级sid不能为空"); |
||||
|
} else { |
||||
|
if (!"0".equals(pSid)) { |
||||
|
SysFunction sysFunction = sysFunctionService.fetchBySid(pSid); |
||||
|
if (StringUtils.isBlank(sysFunction.getSid())) { |
||||
|
return ResultBean.fireFail().setMessage("菜单父级不存在!"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
sysFunctionService.saveOrUpdateDto(dto); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean update(SysFunctionDto dto, String sid) { |
||||
|
SysFunction sysFunction = sysFunctionService.fetchBySid(sid); |
||||
|
if (sysFunction.getSid() == null) { |
||||
|
return ResultBean.fireFail().setMessage("功能不存在!"); |
||||
|
} |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysFunctionService.updateBySid(dto.toMap(), sid); |
||||
|
// SysSourceFunction sysSourceFunction1 = sysSourceFunctionService.fetchByFunctionSid(sid);
|
||||
|
// sysSourceFunctionService.delByFunctionSid(sid);
|
||||
|
// SysSourceFunction sysSourceFunction = new SysSourceFunction();
|
||||
|
// sysSourceFunction.setFunctionRootSid(sysSourceFunction1.getFunctionRootSid());
|
||||
|
// sysSourceFunction.setFunctionSid(sid);
|
||||
|
// sysSourceFunction.setSourceSid(dto.getSourceSid());
|
||||
|
// sysSourceFunctionService.insert(sysSourceFunction);
|
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean updateIsEnable(String sid, Integer isEnable) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysFunction sysFunction = sysFunctionService.fetchBySid(sid); |
||||
|
if (sysFunction == null) { |
||||
|
//查询资源是否存在
|
||||
|
SysSource sysSource = sysSourceService.fetchBySid(sid); |
||||
|
if (sysSource == null) { |
||||
|
return ResultBean.fireFail().setMessage("功能不存在!"); |
||||
|
} else { |
||||
|
//将该资源下的所有功能关闭
|
||||
|
// List<String> sids = sysSourceFunctionService.selectBySourceSid(sid);
|
||||
|
// if (sids.size() != 0) {
|
||||
|
// sysFunctionService.updateBySourceSid(isEnable, sids);
|
||||
|
// }
|
||||
|
|
||||
|
} |
||||
|
} else { |
||||
|
sysFunction.setIsEnable(isEnable); |
||||
|
sysFunctionService.updateById(sysFunction); |
||||
|
} |
||||
|
|
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean del(String ids) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysFunctionService.delByIds(ids); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean delBySids(String sids) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
String[] sidsArr = sids.split(","); |
||||
|
// for (String functionSid : sidsArr) {
|
||||
|
// sysSourceFunctionService.delByFunctionSid(functionSid);
|
||||
|
// }
|
||||
|
sysFunctionService.delBySids(sidsArr); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysFunctionVo> fetch(String id) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysFunctionVo vo = sysFunctionService.fetchByIdVo(id); |
||||
|
return rb.success().setData(vo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysFunctionVo> fetchBySid(String sid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysFunction entity = sysFunctionService.fetchBySid(sid); |
||||
|
SysFunctionVo vo = new SysFunctionVo(); |
||||
|
BeanUtil.copyProperties(entity, vo); |
||||
|
// SysSourceFunction sysSourceFunction = sysSourceFunctionService.fetchByFunctionSid(sid);
|
||||
|
// vo.setSourceSid(sysSourceFunction.getSourceSid());
|
||||
|
if ("0".equals(entity.getParentSid())) { |
||||
|
vo.setParentSid("0"); |
||||
|
vo.setParentName("顶级功能"); |
||||
|
} else { |
||||
|
SysFunction sysFunction = sysFunctionService.fetchBySid(entity.getParentSid()); |
||||
|
vo.setParentSid(sysFunction.getSid()); |
||||
|
vo.setParentName(sysFunction.getName()); |
||||
|
} |
||||
|
return rb.success().setData(vo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<Map<String,Object>>> getFunctionAuthorization(String roleSid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<Map<String,Object>> list=sysFunctionService.getFunctionAuthorization(roleSid); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<Map<String, Object>>> getFunctionAuthorizationApp(String roleSid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<Map<String,Object>> list=sysFunctionService.getFunctionAuthorizationApp(roleSid); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<ButtonPermissionVo>> getButtonPermissions(ButtonPermissionQuery query) { |
||||
|
ResultBean<List<ButtonPermissionVo>> rb = ResultBean.fireFail(); |
||||
|
return rb.success().setData(sysFunctionService.getButtonPermissions(query)); |
||||
|
} |
||||
|
//getFunctionAuthorization(){
|
||||
|
// }
|
||||
|
} |
@ -0,0 +1,265 @@ |
|||||
|
package com.yxt.user.apiadmin; |
||||
|
|
||||
|
import com.yxt.user.biz.sysmenu.*; |
||||
|
//import com.yxt.user.biz.sysmenurole.SysMenuRoleQuery;
|
||||
|
import com.yxt.user.biz.sysrole.SysRole; |
||||
|
import com.yxt.user.biz.syssource.SysSource; |
||||
|
import com.yxt.user.biz.syssource.SysSourceVo; |
||||
|
//import com.yxt.user.biz.syssourcemenu.SysSourceMenu;
|
||||
|
//import com.yxt.user.biz.syssourcemenu.SysSourceMenuVo;
|
||||
|
import com.yxt.user.biz.sysuserrole.SysUserRoleVo; |
||||
|
//import com.yxt.user.biz.sysmenurole.SysMenuRoleService;
|
||||
|
import com.yxt.user.biz.sysrole.SysRoleService; |
||||
|
import com.yxt.user.biz.syssource.SysSourceService; |
||||
|
//import com.yxt.user.biz.syssourcemenu.SysSourceMenuService;
|
||||
|
import com.yxt.user.biz.sysuser.SysUserService; |
||||
|
import com.yxt.user.biz.sysuserrole.SysUserRoleService; |
||||
|
import com.yxt.common.base.utils.StringUtils; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import com.yxt.user.biz.sysmenu.*; |
||||
|
import com.yxt.user.biz.syssource.SysSourceService; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysMenuFeignFallback.java <br/> |
||||
|
* Class: com.yxt.user.biz.sysmenu.SysMenuRest <br/> |
||||
|
* Description: 菜单表. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Api(tags = "菜单表") |
||||
|
@RestController |
||||
|
@RequestMapping("v1/sysmenu") |
||||
|
public class SysMenuRest { |
||||
|
// @Autowired
|
||||
|
// private SysSourceMenuService sysSourceMenuService;
|
||||
|
@Autowired |
||||
|
private SysMenuService sysMenuService; |
||||
|
@Autowired |
||||
|
private SysSourceService sysSourceService; |
||||
|
@Autowired |
||||
|
private SysUserRoleService sysUserRoleService; |
||||
|
// @Autowired
|
||||
|
// private SysMenuRoleService sysMenuRoleService;
|
||||
|
@Autowired |
||||
|
private SysUserService sysUserService; |
||||
|
@Autowired |
||||
|
private SysRoleService sysRoleService; |
||||
|
|
||||
|
|
||||
|
public ResultBean<PagerVo<SysMenuVo>> listPage(@RequestBody PagerQuery<SysMenuQuery> pq) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
PagerVo<SysMenuVo> pv = sysMenuService.listPageVo(pq); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
|
||||
|
/* @Override |
||||
|
public ResultBean<List<SysMenuVo>> listAll(@RequestBody SysMenuQuery query) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysMenuVo> list = sysMenuService.listAllVo(query); |
||||
|
return rb.success().setData(list); |
||||
|
}*/ |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysMenuTreeVo>> listAllVoForSource(@RequestBody SysMenuQuery query) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysMenuTreeVo> list = sysMenuService.listAllVoForSource(query); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<Map<String, String>>> getMenusForFunction(@RequestBody SysMenuFunctionQuery sysMenuFunctionQuery) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysMenuQuery smq= new SysMenuQuery(); |
||||
|
smq.setSourceSid(sysMenuFunctionQuery.getSourceSid()); |
||||
|
List<SysMenuTreeVo> list = sysMenuService.listAllVoForSource(smq); |
||||
|
List<Map<String,String>> l=new ArrayList<>(); |
||||
|
list.forEach(f->{ |
||||
|
if(sysMenuFunctionQuery.getSourceSid().equals(f.getSourceSid())){ |
||||
|
makeMenuListForChildren(f,l); |
||||
|
} |
||||
|
}); |
||||
|
return rb.success().setData(l); |
||||
|
} |
||||
|
private void makeMenuListForChildren(SysMenuTreeVo s, List<Map<String,String>> l){ |
||||
|
List<SysMenuTreeVo> children = s.getChildren(); |
||||
|
int size = children.size(); |
||||
|
for (int i=0;i<size;i++){ |
||||
|
makeMenuListForChildren( children.get(i), l) ; |
||||
|
} |
||||
|
String menuUrl = s.getMenuUrl(); |
||||
|
if(StringUtils.isNotBlank(menuUrl)){ |
||||
|
Map<String,String> m=new HashMap<>(); |
||||
|
m.put("name",s.getName()); |
||||
|
m.put("url",s.getMenuUrl()); |
||||
|
m.put("sid",s.getSid()); |
||||
|
l.add(m); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public ResultBean<List<Map<String, Object>>> sourcemenutree(SysMenuQuery query) { |
||||
|
ResultBean<List<Map<String, Object>>> rb = ResultBean.fireFail(); |
||||
|
// SysMenuRoleQuery orgRoleMenuQuery = new SysMenuRoleQuery();
|
||||
|
List<Map<String, Object>> list = new ArrayList<>(); |
||||
|
if (null == query) |
||||
|
return rb.setData(list); |
||||
|
|
||||
|
//if业务角色存在,则查询业务角色的菜单列表,否则查询平台角色的菜单列表
|
||||
|
List<SysUserRoleVo> userRole = sysUserRoleService.selectByUserSid(query.getUserSid()); |
||||
|
List<String> roleSids = userRole.stream().map(s -> s.getRoleSid()).collect(Collectors.toList()); |
||||
|
for (String roleSid : roleSids) { |
||||
|
SysRole sysRole = sysRoleService.fetchBySid(roleSid); |
||||
|
if(sysRole == null){ |
||||
|
continue; |
||||
|
} |
||||
|
Integer type = sysRoleService.fetchBySid(roleSid).getType(); |
||||
|
if (type == 1){ |
||||
|
// orgRoleMenuQuery.setIsAdmin("1");
|
||||
|
}else { |
||||
|
// orgRoleMenuQuery.setIsAdmin("0");
|
||||
|
} |
||||
|
} |
||||
|
// orgRoleMenuQuery.setRoleSids(roleSids);
|
||||
|
// orgRoleMenuQuery.setSourceSid(query.getSourceSid());
|
||||
|
// list = sysMenuRoleService.getSourceMenuTreeOfRoles(orgRoleMenuQuery, null);
|
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysMenuVo>> listAllByRoleSid(SysMenuQuery query) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
String roleSid = query.getRoleSid(); |
||||
|
if (StringUtils.isBlank(roleSid)) { |
||||
|
ResultBean<List<SysMenuVo>> resultBean = new ResultBean<List<SysMenuVo>>(); |
||||
|
return resultBean.fail().setMessage("角色sid不能为空!"); |
||||
|
} |
||||
|
List<SysSourceVo> sysSourceVos = sysSourceService.listVo(); |
||||
|
List<SysMenuVo> list = new ArrayList<>(); |
||||
|
for (SysSourceVo s : sysSourceVos) { |
||||
|
SysMenuVo sysMenuVo = new SysMenuVo(); |
||||
|
sysMenuVo.setName(s.getSourceName()); |
||||
|
sysMenuVo.setSid(s.getSid()); |
||||
|
sysMenuVo.setChecked("1"); |
||||
|
query.setSourceSid(s.getSid()); |
||||
|
sysMenuVo.setChildren(sysMenuService.listAllByRoleSid(query)); |
||||
|
list.add(sysMenuVo); |
||||
|
} |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysMenuVo>> list() { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysMenuVo> list = sysMenuService.listVo(); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean save(SysMenuDto dto) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
String sourceSid = dto.getSourceSid(); |
||||
|
SysSource sysSource = sysSourceService.fetchBySid(sourceSid); |
||||
|
if (sysSource == null) { |
||||
|
return rb.setMsg("资源不存在"); |
||||
|
} |
||||
|
sysMenuService.saveMenu(dto); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean update(SysMenuDto dto, String sid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
//查询菜单是否存在
|
||||
|
SysMenu sysMenu = sysMenuService.fetchBySid(sid); |
||||
|
if (sysMenu == null) { |
||||
|
return rb.setMsg("菜单不存在"); |
||||
|
} |
||||
|
String sourceSid = dto.getSourceSid(); |
||||
|
// SysSourceMenuVo vo = sysSourceMenuService.fetchByMenuSid(sid);
|
||||
|
// if (!sourceSid.equals(vo.getSourceSid())) {
|
||||
|
// sysSourceMenuService.delByMenuSid(sid);
|
||||
|
// SysSourceMenu sysSourceMenu = new SysSourceMenu();
|
||||
|
// sysSourceMenu.setMenuSid(sid);
|
||||
|
// sysSourceMenu.setSourceSid(dto.getSourceSid());
|
||||
|
// sysSourceMenu.setMenuRootSid(vo.getMenuRootSid());
|
||||
|
// sysSourceMenuService.save(sysSourceMenu);
|
||||
|
// }
|
||||
|
sysMenuService.updateBySid(dto, sid); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean updateIsEnable(String sid, Integer isEnable) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysMenu sysMenu = sysMenuService.fetchBySid(sid); |
||||
|
if (sysMenu == null) { |
||||
|
//查询资源是否存在
|
||||
|
SysSource sysSource = sysSourceService.fetchBySid(sid); |
||||
|
if (sysSource == null) { |
||||
|
return ResultBean.fireFail().setMessage("菜单不存在!"); |
||||
|
} else { |
||||
|
//将该资源下的所有菜单关闭
|
||||
|
sysMenuService.updateBySourceSid(sid, isEnable); |
||||
|
} |
||||
|
} else { |
||||
|
sysMenu.setIsEnable(isEnable); |
||||
|
sysMenuService.updateById(sysMenu); |
||||
|
} |
||||
|
|
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
/* @Override |
||||
|
public ResultBean del(String ids) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysMenuService.delByIds(ids); |
||||
|
return rb.success(); |
||||
|
}*/ |
||||
|
|
||||
|
|
||||
|
public ResultBean delBySids(String sid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysMenu sysMenu = sysMenuService.fetchBySid(sid); |
||||
|
if (sysMenu == null) { |
||||
|
return rb.setMsg("该菜单不存在"); |
||||
|
} |
||||
|
// sysSourceMenuService.delByMenuSid(sid);
|
||||
|
sysMenuService.deleteBySid(sid); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
/* @Override |
||||
|
public ResultBean<SysMenuVo> fetch(String id) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysMenuVo vo = sysMenuService.fetchByIdVo(id); |
||||
|
return rb.success().setData(vo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysMenuVo> fetchBySid(String sid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysMenu sysMenu = sysMenuService.fetchBySid(sid); |
||||
|
SysMenuVo vo = new SysMenuVo(); |
||||
|
BeanUtil.copyProperties(sysMenu, vo); |
||||
|
return rb.success().setData(vo); |
||||
|
}*/ |
||||
|
} |
@ -0,0 +1,415 @@ |
|||||
|
package com.yxt.user.apiadmin; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import com.yxt.common.base.config.RedisUtil; |
||||
|
import com.yxt.common.base.config.component.FileUploadComponent; |
||||
|
import com.yxt.common.base.utils.QRCodeUtil; |
||||
|
import com.yxt.common.base.utils.StringUtils; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import com.yxt.user.biz.sysstaffinfo.SysStaffinfoService; |
||||
|
import com.yxt.user.biz.sysstafforg.SysStaffOrgService; |
||||
|
import com.yxt.user.biz.sysstafforg.SysStaffOrgVo; |
||||
|
import com.yxt.user.biz.sysuser.SysUserService; |
||||
|
import com.yxt.user.biz.sysorganization.*; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.io.File; |
||||
|
import java.util.*; |
||||
|
|
||||
|
import static java.util.stream.Collectors.toList; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysOrganizationFeignFallback.java <br/> |
||||
|
* Class: SysOrganizationRest <br/> |
||||
|
* Description: 组织机构表. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Api(tags = "组织机构表") |
||||
|
@RestController |
||||
|
@RequestMapping("v1/sysorganization") |
||||
|
public class SysOrganizationRest{ |
||||
|
|
||||
|
@Autowired |
||||
|
private SysOrganizationService sysOrganizationService; |
||||
|
@Autowired |
||||
|
private SysStaffOrgService sysStaffOrgService; |
||||
|
@Autowired |
||||
|
private SysStaffinfoService sysStaffinfoService; |
||||
|
@Autowired |
||||
|
private FileUploadComponent fileUploadComponent; |
||||
|
@Autowired |
||||
|
private SysUserService sysUserService; |
||||
|
@Autowired |
||||
|
private RedisUtil redisUtil; |
||||
|
|
||||
|
@PostMapping("/saveSysOrg") |
||||
|
public ResultBean saveOrg(@RequestBody SysOrganizationDto dto){ |
||||
|
return sysOrganizationService.saveOrg(dto); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<PagerVo<SysOrganizationVo>> listPage(@RequestBody PagerQuery<SysOrganizationQuery> pq) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
String psid = pq.getParams().getPsid(); |
||||
|
if (StringUtils.isBlank(psid)) { |
||||
|
ResultBean<PagerVo<SysOrganizationVo>> r = new ResultBean<>(); |
||||
|
return r.setMessage("父级sid不能为空!"); |
||||
|
} |
||||
|
PagerVo<SysOrganizationVo> pv = sysOrganizationService.listPageVo(pq); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysOrganizationVo>> listAll(@RequestBody SysOrganizationQuery query) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysOrganizationVo> list = sysOrganizationService.listAllVo(query); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysOrganizationVo>> list() { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysOrganizationVo> list = sysOrganizationService.listVo(); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean save(SysOrganizationDto dto) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysOrganizationService.saveOrUpdateDto(dto); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysOrganizationVo>> selectFirstOrgList() { |
||||
|
return new ResultBean<List<SysOrganizationVo>>().success().setData(sysOrganizationService.selectFirstOrgList()); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysOrganizationVo>> selectChildrenListBySid(String sid) { |
||||
|
return new ResultBean<List<SysOrganizationVo>>().success().setData(sysOrganizationService.selectChildrenListBySid(sid)); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public ResultBean update(SysOrganizationDto dto, String sid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
//查询该机构下的所有分管人员
|
||||
|
List<String> stringList = sysStaffOrgService.selectByOrgSid(sid); |
||||
|
//根据组织sid查询组织信息
|
||||
|
SysOrganization sysOrganization = sysOrganizationService.fetchBySid(sid); |
||||
|
if (sysOrganization == null) { |
||||
|
return rb.setMsg("该组织机构不存在"); |
||||
|
} |
||||
|
BeanUtil.copyProperties(dto, sysOrganization, "sid"); |
||||
|
//主管人员的sid
|
||||
|
String zgStaffSid = dto.getZgStaffSid(); |
||||
|
//分管人员的sid
|
||||
|
String fgStaffSid = dto.getFgStaffSid(); |
||||
|
//查询分管人员中是否包含主管人员
|
||||
|
if (StringUtils.isNotBlank(fgStaffSid)) { |
||||
|
if (StringUtils.isNotBlank(zgStaffSid)) { |
||||
|
if (fgStaffSid.contains(zgStaffSid)) { |
||||
|
return rb.setMsg("同一个组织机构中主管分管的人员不能重复"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
//删除关联关系中的所有主管与分管的人员关系
|
||||
|
sysStaffOrgService.delZGAndFGByOrgSid(sid); |
||||
|
/*if (StringUtils.isNotBlank(zgStaffSid)) { |
||||
|
ResultBean resultBean = sysOrganizationService.addSysStaffOrg(zgStaffSid, "1", sysOrganization); |
||||
|
if (!resultBean.getSuccess()) { |
||||
|
return rb.setMsg(resultBean.getMsg()); |
||||
|
} |
||||
|
}*/ |
||||
|
if (StringUtils.isNotBlank(fgStaffSid)) { |
||||
|
ResultBean resultBean = sysOrganizationService.addSysStaffOrg(fgStaffSid, "2", sysOrganization); |
||||
|
if (!resultBean.getSuccess()) { |
||||
|
return rb.setMsg(resultBean.getMsg()); |
||||
|
} |
||||
|
} |
||||
|
sysOrganizationService.updateBySid(dto.toMap(), sid); |
||||
|
//修改金蝶组织信息
|
||||
|
//==========================添加清空变化的用户的token
|
||||
|
//查询分管人员
|
||||
|
List<String> stringList1 = new ArrayList<>(); |
||||
|
List<String> reduce1 = new ArrayList<>(); |
||||
|
if(StringUtils.isNotBlank(fgStaffSid)){ |
||||
|
stringList1 = Arrays.asList(fgStaffSid.split(",")); |
||||
|
reduce1 = stringList1.stream().filter(item -> !stringList.contains(item)).collect(toList()); |
||||
|
}else{ |
||||
|
reduce1 = stringList; |
||||
|
} |
||||
|
String orgSid1 = sysStaffOrgService.getOrgByOrgSid(sid); |
||||
|
if(reduce1.size()>0){ |
||||
|
for (String s : reduce1){ |
||||
|
//查询该人员的组织机构list
|
||||
|
List<SysStaffOrgVo> sysStaffOrgVos = sysStaffOrgService.selectByStaffS(s); |
||||
|
List<String> orgList = new ArrayList<>(); |
||||
|
if (sysStaffOrgVos.size() > 0) { |
||||
|
for (SysStaffOrgVo vv : sysStaffOrgVos) { |
||||
|
String orgSid = sysStaffOrgService.getOrgByOrgSid(vv.getOrgSid()); |
||||
|
SysOrganization ss = sysOrganizationService.fetchBySid(orgSid); |
||||
|
if (ss != null) { |
||||
|
orgList.add(orgSid); |
||||
|
} else { |
||||
|
continue; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
if(!orgList.contains(orgSid1)){ |
||||
|
//根据staffSid查询token
|
||||
|
String token = sysUserService.selectByStaffsid(s).getToken(); |
||||
|
if(StringUtils.isNotBlank(token)){ |
||||
|
//清空该token
|
||||
|
redisUtil.remove(token); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean del(String ids) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysOrganizationService.delByIds(ids); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean delBySid(String sid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
if (StringUtils.isBlank(sid)) { |
||||
|
return ResultBean.fireFail().setMessage("sid不能为空!"); |
||||
|
} |
||||
|
String[] sidArr = sid.split(","); |
||||
|
sysOrganizationService.delBySids(sidArr); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysOrganizationVo> fetch(String id) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysOrganizationVo vo = sysOrganizationService.fetchByIdVo(id); |
||||
|
return rb.success().setData(vo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysOrganizationVo> fetchBySid(String sid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysOrganization entity = sysOrganizationService.fetchBySid(sid); |
||||
|
List<SysStaffOrgVo> list = sysStaffOrgService.fetchByOrgSid(sid); |
||||
|
String fgNames = ""; |
||||
|
String fgSids = ""; |
||||
|
String zgNames = ""; |
||||
|
String zgSids = ""; |
||||
|
for (SysStaffOrgVo s : list) { |
||||
|
if ("1".equals(s.getManageType())) { |
||||
|
zgNames = zgNames + "," + s.getStaffName(); |
||||
|
zgSids = zgSids + "," + s.getStaffSid(); |
||||
|
} |
||||
|
if ("2".equals(s.getManageType())) { |
||||
|
fgNames = fgNames + "," + s.getStaffName(); |
||||
|
fgSids = fgSids + "," + s.getStaffSid(); |
||||
|
} |
||||
|
} |
||||
|
if (fgNames.length() > 1) { |
||||
|
fgNames = fgNames.substring(1, fgNames.length()); |
||||
|
fgSids = fgSids.substring(1, fgSids.length()); |
||||
|
} |
||||
|
if (zgNames.length() > 1) { |
||||
|
zgNames = zgNames.substring(1, zgNames.length()); |
||||
|
zgSids = zgSids.substring(1, zgSids.length()); |
||||
|
} |
||||
|
SysOrganizationVo vo = new SysOrganizationVo(); |
||||
|
BeanUtil.copyProperties(entity, vo); |
||||
|
vo.setFgNames(fgNames); |
||||
|
vo.setFgStaffSid(fgSids); |
||||
|
vo.setZgNames(zgNames); |
||||
|
vo.setZgStaffSid(zgSids); |
||||
|
return rb.success().setData(vo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<Map<String, Object>> selectAppOrganization(String sid) { |
||||
|
Map<String, Object> map = new HashMap<>(); |
||||
|
List<Map<String, Object>> nameList = sysOrganizationService.selectOrgNameList(sid); |
||||
|
List<AppContactSysOrganizationVo> staffList = new ArrayList<>(); |
||||
|
List<AppContactSysOrganizationVo> list = null; |
||||
|
if (StringUtils.isBlank(sid)) { // 组织架构
|
||||
|
list = sysOrganizationService.selectAppOrganization(); |
||||
|
} else { // 组织架构子集
|
||||
|
list = sysOrganizationService.selectAppOrganizationSub(sid); |
||||
|
staffList = sysStaffinfoService.selectContactsByOrgsid(sid); |
||||
|
list.addAll(staffList); |
||||
|
} |
||||
|
map.put("nameList", nameList); |
||||
|
map.put("list", list); |
||||
|
// map.put("staffList", staffList);
|
||||
|
return new ResultBean<Map<String, Object>>().success().setData(map); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysOrgVo>> selectListOrg() { |
||||
|
ResultBean<List<SysOrgVo>> rb = ResultBean.fireFail(); |
||||
|
List<SysOrgVo> menuTree2VoList = sysOrganizationService.treeList(); |
||||
|
return rb.success().setData(menuTree2VoList); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysOrgVo>> getListOrg() { |
||||
|
ResultBean<List<SysOrgVo>> rb = ResultBean.fireFail(); |
||||
|
List<SysOrgVo> menuTree2VoList = sysOrganizationService.getListOrg(); |
||||
|
return rb.success().setData(menuTree2VoList); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysOrgVo>> getListOrgByBrand(String orgSid) { |
||||
|
return null;//sysOrganizationService.getListOrgByBrand(orgSid);
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysOrgVo>> getListOrgByBrandSid(String orgSid, String brandSid) { |
||||
|
return null;//sysOrganizationService.getListOrgByBrandSid(orgSid,brandSid);
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysOrgVo>> getListOrgByBrandSidNo(String orgSid, String brandSid) { |
||||
|
return null;//sysOrganizationService.getListOrgByBrandSidNo(orgSid,brandSid);
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysOrgVo>> getListDeptByOrgSid(String orgSid) { |
||||
|
return sysOrganizationService.getListDeptByOrgSid(orgSid); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysOrganizationVo> getUseOrgByUserSid(String userSid) { |
||||
|
ResultBean<SysOrganizationVo> rb = ResultBean.fireFail(); |
||||
|
SysOrganizationVo vo = sysOrganizationService.getUseOrgByUserSid(userSid); |
||||
|
return rb.success().setData(vo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysOrganization> selectBySid(String sid) { |
||||
|
SysOrganization sysOrganization = sysOrganizationService.fetchBySid(sid); |
||||
|
if (sysOrganization == null) { |
||||
|
return new ResultBean<SysOrganization>().fail().setData(new SysOrganization()); |
||||
|
} |
||||
|
return new ResultBean<SysOrganization>().success().setData(sysOrganization); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<Map<String, String>>> selectUseOrgSidBySid(String sid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<Map<String, String>> maps = sysOrganizationService.selectUseOrgSidBySid(sid); |
||||
|
return rb.success().setData(maps); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询公司所有的部门 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
|
||||
|
public ResultBean<List<SysOrgListVo>> selectListOne() { |
||||
|
ResultBean<List<SysOrgListVo>> rb = ResultBean.fireFail(); |
||||
|
List<SysOrgListVo> sysOrgListVo = sysOrganizationService.selectTreeList(); |
||||
|
if (sysOrgListVo.size() == 0) { |
||||
|
List<SysOrgListVo> list = new ArrayList(); |
||||
|
list.add(new SysOrgListVo()); |
||||
|
return rb.setData(list); |
||||
|
} |
||||
|
return rb.success().setData(sysOrgListVo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<QrCodeVo> getQrCode(String sid) { |
||||
|
SysOrganization sysOrganization = sysOrganizationService.fetchBySid(sid); |
||||
|
if (sysOrganization == null) { |
||||
|
return new ResultBean<QrCodeVo>().fail().setMsg("部门不存在"); |
||||
|
} |
||||
|
if (StringUtils.isBlank(sysOrganization.getQrText())) { |
||||
|
File file = new File(fileUploadComponent.getUploadPath() + "qrCode"); |
||||
|
QRCodeUtil.createCodeToFile(sysOrganization.getSid() + "#" + sysOrganization.getId() + "#" + "q", file, sysOrganization.getName() + sysOrganization.getId() + ".png"); |
||||
|
//将该二维码地址放进部门表中的二维码图片地址中
|
||||
|
String path = fileUploadComponent.getUrlPrefix() + "qrCode/" + sysOrganization.getName() + sysOrganization.getId() + ".png"; |
||||
|
sysOrganizationService.updateQrCodePath(sid, path); |
||||
|
} |
||||
|
QrCodeVo qrCodeVo = sysOrganizationService.getQrCodeVo(sid); |
||||
|
String orgSidPath = sysOrganization.getOrgSidPath(); |
||||
|
String[] split = orgSidPath.split("/"); |
||||
|
for (String s : split) { |
||||
|
SysOrganization sysOrganization1 = sysOrganizationService.fetchBySid(s); |
||||
|
Integer isDept = sysOrganization1.getIsDept(); |
||||
|
String psid = sysOrganization1.getPsid(); |
||||
|
if (isDept != null) { |
||||
|
if (isDept == 0 && !psid.equals(0)) { |
||||
|
qrCodeVo.setOrganizationName(sysOrganization1.getName()); |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
return new ResultBean<QrCodeVo>().success().setData(qrCodeVo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<String> getOrgSid(String sid) { |
||||
|
ResultBean<String> rb = ResultBean.fireFail(); |
||||
|
SysOrganization sysOrganization = sysOrganizationService.fetchBySid(sid); |
||||
|
if (sysOrganization == null) { |
||||
|
return rb.setMsg("该组织不存在"); |
||||
|
} |
||||
|
String orgSid = sysOrganizationService.getOrgSid(sid); |
||||
|
return rb.success().setData(orgSid); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysOrganizationListVo>> selectOrgList(SysOrganizationListQuery query) { |
||||
|
return sysOrganizationService.selectOrgList(query); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysOrganizationListsVo>> selectOrgLists(SysOrganizationListQuery query) { |
||||
|
return sysOrganizationService.selectOrgLists(query); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysOrganizationVo> selectByPSid(String sid, String name) { |
||||
|
return sysOrganizationService.selectByPSid(sid,name); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysOrganizationVo>> selectOrgSidList() { |
||||
|
ResultBean<List<SysOrganizationVo>> rb = ResultBean.fireFail(); |
||||
|
List<SysOrganizationVo> stringList = sysOrganizationService.selectOrgSidList(); |
||||
|
return rb.success().setData(stringList); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysOrganizationVo>> selectOrgByPSid(String psid) { |
||||
|
return sysOrganizationService.selectOrgByPSid(psid); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysOrganizationVo> selectByOrgSidPath(String orgSidPath) { |
||||
|
return sysOrganizationService.selectByOrgSidPath(orgSidPath); |
||||
|
} |
||||
|
} |
@ -0,0 +1,153 @@ |
|||||
|
package com.yxt.user.apiadmin; |
||||
|
|
||||
|
import com.yxt.common.base.utils.StringUtils; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import com.yxt.user.biz.sysrole.*; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysRoleFeignFallback.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.biz.sysrole.SysRoleRest <br/> |
||||
|
* Description: 角色. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Api(tags = "角色") |
||||
|
@RestController |
||||
|
@RequestMapping("v1/sysrole") |
||||
|
public class SysRoleRest { |
||||
|
|
||||
|
@Autowired |
||||
|
private SysRoleService sysRoleService; |
||||
|
|
||||
|
|
||||
|
public ResultBean<PagerVo<SysRoleVo>> listPage(@RequestBody PagerQuery<SysRoleQuery> pq){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
PagerVo<SysRoleVo> pv = sysRoleService.listPageVo(pq); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysRoleVo>> listAll(@RequestBody SysRoleQuery query){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysRoleVo> list = sysRoleService.listAllVo(query); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysRoleVo>> listAllByUserSid(String userSid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysRoleVo> list = sysRoleService.listAllByUserSid(userSid); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysRoleVo>> fetchByUserSid(String userSid) { |
||||
|
if(StringUtils.isBlank(userSid)){ |
||||
|
return new ResultBean<List<SysRoleVo>>().fail().setMsg("userSid不能为空"); |
||||
|
} |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysRoleVo> list = sysRoleService.fetchByUserSid(userSid); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysRoleVo>> list(){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysRoleVo> list = sysRoleService.listVo(); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean save(SysRoleDto dto){ |
||||
|
String name = dto.getName(); |
||||
|
if(StringUtils.isBlank(name)){ |
||||
|
return new ResultBean<List<SysRoleVo>>().fail().setMsg("角色名称不能为空!"); |
||||
|
}else{ |
||||
|
SysRoleVo sysRoleVo = sysRoleService.fetchByName(name); |
||||
|
if(sysRoleVo.getName()!=null){ |
||||
|
return new ResultBean<List<SysRoleVo>>().fail().setMsg("角色名称不能重复!"); |
||||
|
} |
||||
|
} |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysRoleService.saveOrUpdateDto(dto); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean update(SysRoleDto dto,String sid){ |
||||
|
String roleName = dto.getName(); |
||||
|
if(StringUtils.isBlank(sid)){ |
||||
|
return new ResultBean<List<SysRoleVo>>().fail().setMsg("角色sid不能为空!"); |
||||
|
} |
||||
|
if(StringUtils.isBlank(roleName)){ |
||||
|
return new ResultBean<List<SysRoleVo>>().fail().setMsg("角色名称不能为空!"); |
||||
|
}else{ |
||||
|
SysRoleVo sysRoleVo = sysRoleService.fetchByName(roleName); |
||||
|
if(sysRoleVo.getName()!=null&&!sid.equals(sysRoleVo.getSid())){ |
||||
|
return new ResultBean<List<SysRoleVo>>().fail().setMsg("角色名称不能重复!"); |
||||
|
} |
||||
|
} |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysRoleService.updateBySid(dto.toMap(),sid); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean del(String ids){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysRoleService.delByIds(ids); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean delBySids(String sids) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysRoleService.delBySids(sids); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysRoleVo> fetch(String id){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysRoleVo vo = sysRoleService.fetchByIdVo(id); |
||||
|
return rb.success().setData(vo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysRoleVo> fetchBySid(String sid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysRoleVo vo = sysRoleService.fetchBySidVo(sid); |
||||
|
if (StringUtils.isBlank(vo.getSid())) { |
||||
|
return rb.success().setData(null); |
||||
|
} |
||||
|
return rb.success().setData(vo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean setIsEnable(String sid, String isEnable) { |
||||
|
SysRole role = sysRoleService.fetchBySid(sid); |
||||
|
if (role == null) { |
||||
|
return ResultBean.fireFail().setMsg("此角色已不存在"); |
||||
|
} |
||||
|
int i = sysRoleService.updateIsEnable(sid, isEnable); |
||||
|
if (i == 0) { |
||||
|
return ResultBean.fireFail().setMsg("设置失败"); |
||||
|
} |
||||
|
return ResultBean.fireSuccess().setMsg("设置成功"); |
||||
|
} |
||||
|
} |
@ -0,0 +1,131 @@ |
|||||
|
package com.yxt.user.apiadmin; |
||||
|
|
||||
|
//import com.yxt.user.biz.systemlog.SystemLog;
|
||||
|
import com.yxt.user.biz.sysuser.SysUser; |
||||
|
//import com.yxt.user.biz.systemlog.SystemLogService;
|
||||
|
import com.yxt.user.biz.sysuser.SysUserService; |
||||
|
import com.yxt.common.base.config.RedisUtil; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import com.yxt.user.biz.syssource.*; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysSourceFeignFallback.java <br/> |
||||
|
* Class: com.yxt.user.biz.syssource.SysSourceRest <br/> |
||||
|
* Description: 资源表. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Api(tags = "资源表") |
||||
|
@RestController |
||||
|
@RequestMapping("v1/syssource") |
||||
|
public class SysSourceRest { |
||||
|
// @Autowired
|
||||
|
// private SystemLogService systemLogService;
|
||||
|
@Autowired |
||||
|
private SysUserService sysUserService; |
||||
|
@Autowired(required = false) |
||||
|
private HttpServletRequest httpServletRequest; |
||||
|
@Autowired |
||||
|
private SysSourceService sysSourceService; |
||||
|
@Autowired |
||||
|
private RedisUtil redisUtil; |
||||
|
|
||||
|
public ResultBean<PagerVo<SysSourceVo>> listPage(@RequestBody PagerQuery<SysSourceQuery> pq){ |
||||
|
String token = httpServletRequest.getHeader("token"); |
||||
|
String s = redisUtil.get(token); |
||||
|
SysUser sysUser = sysUserService.fetchByUserName(s); |
||||
|
// SystemLog systemLog = new SystemLog();
|
||||
|
// systemLog.setUserSid(sysUser.getSid());
|
||||
|
// systemLog.setCreateTime(new Date());
|
||||
|
// systemLog.setEventName("人员岗位保存");
|
||||
|
// systemLog.setEventContent("");
|
||||
|
// systemLog.setEventUrl("/portal/v1/sysstaffpost/save");
|
||||
|
// systemLog.setUserIp("0.0.0.0");
|
||||
|
// systemLog.setUserName(sysUser.getUserName());
|
||||
|
// systemLogService.save(systemLog);
|
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
PagerVo<SysSourceVo> pv = sysSourceService.listPageVo(pq); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysSourceVo>> listAll(@RequestBody SysSourceQuery query){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysSourceVo> list = sysSourceService.listAllVo(query); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysSourceVo>> listAllByRoleSid(SysSourceQuery query) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysSourceVo> list = sysSourceService.listAllByRoleSid(query); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysSourceVo>> list(){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysSourceVo> list = sysSourceService.listVo(); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean save(SysSourceDto dto){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysSourceService.saveOrUpdateDto(dto); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean update(SysSourceDto dto,String sid){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysSourceService.updateBySid(dto.toMap(),sid); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean del(String ids){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysSourceService.delByIds(ids); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean delBySids(String sids) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
String[] sidArr = sids.split(","); |
||||
|
sysSourceService.delBySids(sidArr); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysSourceVo> fetch(String id){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysSourceVo vo = sysSourceService.fetchByIdVo(id); |
||||
|
return rb.success().setData(vo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysSourceVo> fetchBySid(String sid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysSourceVo vo = sysSourceService.fetchBySidVo(sid); |
||||
|
return rb.success().setData(vo); |
||||
|
} |
||||
|
} |
@ -0,0 +1,162 @@ |
|||||
|
package com.yxt.user.apiadmin; |
||||
|
|
||||
|
import com.yxt.user.biz.sysstafforg.*; |
||||
|
import com.yxt.common.base.utils.StringUtils; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysStaffOrgFeignFallback.java <br/> |
||||
|
* Class: com.yxt.user.biz.sysstafforg.SysStaffOrgRest <br/> |
||||
|
* Description: 员工部门关联表. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Api(tags = "员工部门关联表") |
||||
|
@RestController |
||||
|
@RequestMapping("v1/sysstafforg") |
||||
|
public class SysStaffOrgRest { |
||||
|
|
||||
|
@Autowired |
||||
|
private SysStaffOrgService sysStaffOrgService; |
||||
|
|
||||
|
|
||||
|
|
||||
|
public ResultBean<PagerVo<SysStaffOrgVo>> listPage(@RequestBody PagerQuery<SysStaffOrgQuery> pq) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
PagerVo<SysStaffOrgVo> pv = sysStaffOrgService.listPageVo(pq); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysStaffOrgVo>> listAll(@RequestBody SysStaffOrgQuery query) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysStaffOrgVo> list = sysStaffOrgService.listAllVo(query); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysStaffOrgVo>> list() { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysStaffOrgVo> list = sysStaffOrgService.listVo(); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysStaffOrgVo>> staffinfoList(@RequestBody SysStaffOrgQuery query) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysStaffOrgVo> list = sysStaffOrgService.staffinfoList(query); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean save(SysStaffOrgDto dto) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysStaffOrgService.saveOrUpdateDto(dto); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean update(SysStaffOrgDto dto, String sid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysStaffOrgService.updateBySid(dto.toMap(), sid); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean del(String ids) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysStaffOrgService.delByIds(ids); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysStaffOrgVo> fetch(String id) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysStaffOrgVo vo = sysStaffOrgService.fetchByIdVo(id); |
||||
|
return rb.success().setData(vo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysStaffOrgVo>> getSysStaffOrgListByStaffSid(String staffSid) { |
||||
|
List<SysStaffOrgVo> list = sysStaffOrgService.getSysStaffOrgListByStaffSid(staffSid); |
||||
|
if (list.size() > 0) { |
||||
|
return new ResultBean<List<SysStaffOrgVo>>().success().setData(list); |
||||
|
} else { |
||||
|
return new ResultBean().fail().setMsg("该员工无部门").setData(list); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<String> getSysStaffOrgSidListByStaffSid(String staffSid) { |
||||
|
String orgSids = sysStaffOrgService.getSysStaffOrgSidListByStaffSid(staffSid); |
||||
|
if (StringUtils.isNotBlank(orgSids)) { |
||||
|
return new ResultBean<String>().success().setData(orgSids); |
||||
|
} else { |
||||
|
return new ResultBean().fail().setMsg("该员工无部门").setData(""); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<String> selectSidPathByStaffSid(String applySid) { |
||||
|
return sysStaffOrgService.selectSidPathByStaffSid(applySid); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<String> getOrgSidBySid(String orgSid) { |
||||
|
ResultBean<String> rb = ResultBean.fireFail(); |
||||
|
String orgPathSid = sysStaffOrgService.getOrgByOrgSid(orgSid); |
||||
|
return rb.success().setData(orgPathSid); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysStaffOrg> getOrgByStaffSid(String staffSid) { |
||||
|
ResultBean<SysStaffOrg> rb = ResultBean.fireFail(); |
||||
|
SysStaffOrg sysStaffOrg = sysStaffOrgService.getOrgByStaffSid(staffSid); |
||||
|
return rb.success().setData(sysStaffOrg); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<String> getOrgSidByPath(String orgPath) { |
||||
|
return sysStaffOrgService.getOrgSidByPath(orgPath); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<String> getOrgSidByPath2(String orgPath) { |
||||
|
return sysStaffOrgService.getOrgSidByPath2(orgPath); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysStaffOrgByUserVo>> selAllByOrgPath(String orgSidPath,String roleSid) { |
||||
|
return sysStaffOrgService.selAllByOrgPath(orgSidPath,roleSid); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysStaffOrgByUserVo>> selAllByOrgSidPath(String orgSidPath) { |
||||
|
return sysStaffOrgService.selAllByOrgSidPath(orgSidPath); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysStaffOrg> selectAllByStaffSid(String staffSid) { |
||||
|
return sysStaffOrgService.selectAllByStaffSid(staffSid); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<String> getPathSidByUserSid(String applySid) { |
||||
|
return sysStaffOrgService.getPathSidByUserSid(applySid); |
||||
|
} |
||||
|
} |
@ -0,0 +1,124 @@ |
|||||
|
package com.yxt.user.apiadmin; |
||||
|
|
||||
|
import com.yxt.user.biz.sysstaffpost.SysStaffPostDto; |
||||
|
import com.yxt.user.biz.sysstaffpost.SysStaffPostQuery; |
||||
|
import com.yxt.user.biz.sysstaffpost.SysStaffPostVo; |
||||
|
//import com.yxt.user.biz.systemlog.SystemLog;
|
||||
|
import com.yxt.user.biz.sysuser.SysUser; |
||||
|
//import com.yxt.user.biz.systemlog.SystemLogService;
|
||||
|
import com.yxt.user.biz.sysuser.SysUserService; |
||||
|
import com.yxt.common.base.config.RedisUtil; |
||||
|
import com.yxt.common.base.utils.StringUtils; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import com.yxt.user.biz.sysstaffpost.SysStaffPostService; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysStaffPostFeignFallback.java <br/> |
||||
|
* Class: com.yxt.user.biz.sysstaffpost.SysStaffPostRest <br/> |
||||
|
* Description: 员工岗位关联表. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:30 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Api(tags = "员工岗位关联表") |
||||
|
@RestController |
||||
|
@RequestMapping("v1/sysstaffpost") |
||||
|
public class SysStaffPostRest { |
||||
|
@Autowired |
||||
|
private RedisUtil redisUtil; |
||||
|
@Autowired |
||||
|
private SysStaffPostService sysStaffPostService; |
||||
|
// @Autowired
|
||||
|
// private SystemLogService systemLogService;
|
||||
|
@Autowired |
||||
|
private SysUserService sysUserService; |
||||
|
@Autowired(required = false) |
||||
|
private HttpServletRequest httpServletRequest; |
||||
|
|
||||
|
|
||||
|
public ResultBean<PagerVo<SysStaffPostVo>> listPage(@RequestBody PagerQuery<SysStaffPostQuery> pq) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
PagerVo<SysStaffPostVo> pv = sysStaffPostService.listPageVo(pq); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysStaffPostVo>> listAll(@RequestBody SysStaffPostQuery query) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysStaffPostVo> list = sysStaffPostService.listAllVo(query); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysStaffPostVo>> list() { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysStaffPostVo> list = sysStaffPostService.listVo(); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean save(SysStaffPostDto dto) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysStaffPostService.saveOrUpdateDto(dto); |
||||
|
String token = httpServletRequest.getHeader("token"); |
||||
|
String s = redisUtil.get(token); |
||||
|
SysUser sysUser = sysUserService.fetchByUserName(s); |
||||
|
// SystemLog systemLog = new SystemLog();
|
||||
|
// systemLog.setUserSid(sysUser.getSid());
|
||||
|
// systemLog.setCreateTime(new Date());
|
||||
|
// systemLog.setEventName("人员岗位保存");
|
||||
|
// systemLog.setEventContent("");
|
||||
|
// systemLog.setEventUrl("/portal/v1/sysstaffpost/save");
|
||||
|
// systemLog.setUserIp("0.0.0.0");
|
||||
|
// systemLog.setUserName(sysUser.getUserName());
|
||||
|
// systemLogService.save(systemLog);
|
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean update(SysStaffPostDto dto, String sid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysStaffPostService.updateBySid(dto.toMap(), sid); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean del(String ids) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysStaffPostService.delByIds(ids); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysStaffPostVo> fetch(String id) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysStaffPostVo vo = sysStaffPostService.fetchByIdVo(id); |
||||
|
return rb.success().setData(vo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<String> selectPost(String sid) { |
||||
|
ResultBean<String> rb = ResultBean.fireFail(); |
||||
|
String s = sysStaffPostService.selecctPost(sid); |
||||
|
if(StringUtils.isBlank(s)){ |
||||
|
return rb.setMsg("操作失败"); |
||||
|
} |
||||
|
return rb.success().setData(s); |
||||
|
} |
||||
|
} |
@ -0,0 +1,235 @@ |
|||||
|
package com.yxt.user.apiadmin; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.yxt.user.biz.sysstaffinfo.*; |
||||
|
import com.yxt.user.biz.sysstaffinfo.app.AppSysStaffQuery; |
||||
|
import com.yxt.user.biz.sysstaffinfo.app.AppSysStaffVo; |
||||
|
import com.yxt.user.biz.sysuser.SysUserService; |
||||
|
import com.yxt.common.base.config.component.FileUploadComponent; |
||||
|
import com.yxt.common.base.utils.PagerUtil; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import com.yxt.user.biz.sysstaffinfo.SysStaffinfoService; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.util.Collections; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysStaffinfoFeignFallback.java <br/> |
||||
|
* Class: com.yxt.user.biz.sysstaffinfo.SysStaffinfoRest <br/> |
||||
|
* Description: 人员基础信息表. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:30 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Api(tags = "人员基础信息表") |
||||
|
@RestController |
||||
|
@RequestMapping("v1/sysstaffinfo") |
||||
|
public class SysStaffinfoRest{ |
||||
|
|
||||
|
private final Long PAGECURRENT = 2L; |
||||
|
private final Long PAGESIZE = 2L; |
||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
||||
|
|
||||
|
@Autowired |
||||
|
private SysStaffinfoService sysStaffinfoService; |
||||
|
|
||||
|
@Autowired |
||||
|
private SysUserService sysUserService; |
||||
|
@Autowired |
||||
|
private FileUploadComponent fileUploadComponent; |
||||
|
|
||||
|
/** |
||||
|
* 员工管理的分页列表 |
||||
|
* |
||||
|
* @param pq 查询条件 |
||||
|
* @return |
||||
|
*/ |
||||
|
|
||||
|
public ResultBean<PagerVo<SysStaffinfoVo>> listPage(@RequestBody PagerQuery<SysStaffinfoQuery> pq) { |
||||
|
ResultBean<PagerVo<SysStaffinfoVo>> rb = ResultBean.fireFail(); |
||||
|
IPage<SysStaffinfoVo> page = sysStaffinfoService.pagerList(pq); |
||||
|
PagerVo<SysStaffinfoVo> pv = new PagerVo<>(); |
||||
|
PagerVo<SysStaffinfoVo> pv1 = PagerUtil.pageToVo(page, pv); |
||||
|
return rb.success().setData(pv1); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 员工信息的新增保存 |
||||
|
* |
||||
|
* @param dto 数据传输对象 |
||||
|
* @return |
||||
|
*/ |
||||
|
|
||||
|
public ResultBean save(SysStaffinfoDto dto) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
ResultBean resultBean = sysStaffinfoService.saveStaffInfo(dto); |
||||
|
if (!resultBean.getSuccess()) { |
||||
|
return rb.setMsg(resultBean.getMsg()); |
||||
|
} |
||||
|
return rb.success().setMsg(resultBean.getMsg()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 员工信息的修改保存 |
||||
|
* |
||||
|
* @param dto 数据传输对象 |
||||
|
* @param sid 员工信息sid |
||||
|
* @return |
||||
|
*/ |
||||
|
|
||||
|
public ResultBean update(SysStaffinfoDto dto, String sid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
ResultBean resultBean = sysStaffinfoService.updateStaffInfo(dto, sid); |
||||
|
if (!resultBean.getSuccess()) { |
||||
|
return rb.setMsg(resultBean.getMsg()); |
||||
|
} |
||||
|
return rb.success().setMsg(resultBean.getMsg()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 进行删除操作,即设置员工类型为离职类型02的操作。 |
||||
|
* |
||||
|
* @param sysStaffQuery 数据传输对象 |
||||
|
* @return |
||||
|
*/ |
||||
|
|
||||
|
public ResultBean del(SysStaffQuery sysStaffQuery) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
//查询员工是否是离职
|
||||
|
SysStaffinfo sysStaffinfo = sysStaffinfoService.fetchBySid(sysStaffQuery.getSid()); |
||||
|
if (sysStaffinfo == null) { |
||||
|
return rb.setMsg("员工不存在"); |
||||
|
} |
||||
|
if ("01".equals(sysStaffinfo.getPersonTypeKey())) { |
||||
|
return rb.setMsg("此员工已是离职人员"); |
||||
|
|
||||
|
} |
||||
|
int i = sysStaffinfoService.del(sysStaffQuery); |
||||
|
if (i == 0) { |
||||
|
return rb.setMsg("失败"); |
||||
|
} |
||||
|
return rb.success().setMsg("成功"); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysStaffinfoDetailsVo> fetchBySid(String sid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysStaffinfoDetailsVo sysStaffinfo = sysStaffinfoService.selectDetailsBySid(sid); |
||||
|
if (sysStaffinfo == null) { |
||||
|
return rb.setData(new SysStaffinfoDetailsVo()); |
||||
|
} |
||||
|
return rb.success().setData(sysStaffinfo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<Map<String, String>>> getStaffName(String staffName, String deptSid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<Map<String, String>> staffNameList = sysStaffinfoService.getStaffName(staffName, deptSid); |
||||
|
return rb.success().setData(staffNameList); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<Map<String, String>>> getStaffNameByDeptSid(String staffName, String deptSid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<Map<String, String>> staffNameList = sysStaffinfoService.getStaffNameByDeptSid(staffName, deptSid); |
||||
|
return rb.success().setData(staffNameList); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysStaffinfoAppContactsVo>> selectAppContactsList(String names) { |
||||
|
return new ResultBean<List<SysStaffinfoAppContactsVo>>().success().setData(sysStaffinfoService.selectAppContactsList()); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<AppContactsDetailsVo> selectAppContactsVO(String staffSid) { |
||||
|
if (StringUtils.isBlank(staffSid)) { |
||||
|
return new ResultBean<AppContactsDetailsVo>().fail().setMsg("staffSid不能为空"); |
||||
|
} |
||||
|
AppContactsDetailsVo appContactsDetailsVo = sysStaffinfoService.selectAppContactsVO(staffSid); |
||||
|
if (appContactsDetailsVo == null) { |
||||
|
return new ResultBean<AppContactsDetailsVo>().fail().setMsg("查无此人信息"); |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(appContactsDetailsVo.getHeadImage())) { |
||||
|
appContactsDetailsVo.setHeadImage(fileUploadComponent.getUrlPrefix() + appContactsDetailsVo.getHeadImage()); |
||||
|
} |
||||
|
List<String> stringList = sysUserService.getPost(staffSid); |
||||
|
stringList.removeAll(Collections.singleton(null)); |
||||
|
if (!stringList.isEmpty()) { |
||||
|
appContactsDetailsVo.setPosition(String.join("|", stringList)); |
||||
|
} |
||||
|
return new ResultBean<AppContactsDetailsVo>().success().setData(appContactsDetailsVo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<PagerVo<SysStaffinfoAppContactsSearchVo>> searchAppContactsList(PagerQuery<SysStaffinfoQuery> pq) { |
||||
|
String names = pq.getParams().getName(); |
||||
|
if (StringUtils.isBlank(names)) |
||||
|
return new ResultBean<PagerVo<SysStaffinfoAppContactsSearchVo>>().fail().setMsg("搜索内容不能为空"); |
||||
|
PagerVo<SysStaffinfoAppContactsSearchVo> page1 = new PagerVo<>(); |
||||
|
IPage<SysStaffinfoAppContactsSearchVo> iPage = sysStaffinfoService.searchAppContactsList(pq, names); |
||||
|
//把Ipage转换为PageVo
|
||||
|
PagerVo<SysStaffinfoAppContactsSearchVo> pv_result = PagerUtil.pageToVo(iPage, page1); |
||||
|
pv_result.setMsg("找到 " + pv_result.getTotal() + " 个联系人 "); |
||||
|
return new ResultBean<PagerVo<SysStaffinfoAppContactsSearchVo>>().success().setData(pv_result); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<PagerVo<SysStaffinfoAppContactsSearchVo>> searchAppContactsList2(PagerQuery<SysStaffinfoQuery> pq) { |
||||
|
PagerVo<SysStaffinfoAppContactsSearchVo> page1 = new PagerVo<>(); |
||||
|
IPage<SysStaffinfoAppContactsSearchVo> iPage = sysStaffinfoService.searchAppContactsList2(pq); |
||||
|
//把Ipage转换为PageVo
|
||||
|
PagerVo<SysStaffinfoAppContactsSearchVo> pv_result = PagerUtil.pageToVo(iPage, page1); |
||||
|
pv_result.setMsg("找到 " + pv_result.getTotal() + " 个联系人 "); |
||||
|
return new ResultBean<PagerVo<SysStaffinfoAppContactsSearchVo>>().success().setData(pv_result); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<PcSysStaffVo>> selectStaffList(PcSysStaffQuery pcSysStaffQuery) { |
||||
|
return sysStaffinfoService.selectStaffList(pcSysStaffQuery); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<PagerVo<AppSysStaffVo>> getUserList(PagerQuery<AppSysStaffQuery> pagerQuery) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
PagerVo<AppSysStaffVo> pv = sysStaffinfoService.getUserList(pagerQuery); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<AppSysStaffVo>> getGressionUserList(String userSid) { |
||||
|
return sysStaffinfoService.getGressionUserList(userSid, ""); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<AppSysStaffVo>> getGressionUserList(String userSid, String orgPath) { |
||||
|
return sysStaffinfoService.getGressionUserList(userSid, orgPath); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<PcSysStaffVo>> selectStaffLists() { |
||||
|
return sysStaffinfoService.selectStaffLists(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<PcSysStaffVo>> selectStaffListss() { |
||||
|
return sysStaffinfoService.selectStaffListss(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,34 @@ |
|||||
|
package com.yxt.user.apiadmin; |
||||
|
|
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.user.biz.sysuserdefaultorg.SysUserDefaultOrgDto; |
||||
|
import com.yxt.user.biz.sysuserdefaultorg.SysUserDefaultOrgService; |
||||
|
import com.yxt.user.biz.sysuserdefaultorg.SysUserDefaultOrgVo; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2023/1/11 11:26 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Api(tags = "用户默认的组织机构") |
||||
|
@RestController |
||||
|
@RequestMapping("v1/sysuserdefaultorg") |
||||
|
public class SysUserDefaultOrgRest { |
||||
|
|
||||
|
@Autowired |
||||
|
private SysUserDefaultOrgService sysUserDefaultOrgService; |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysUserDefaultOrgVo> getList(String userSid) { |
||||
|
return sysUserDefaultOrgService.getList(userSid); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean saveOrUpdate(SysUserDefaultOrgDto dto) { |
||||
|
return sysUserDefaultOrgService.saveDefaultOrg(dto); |
||||
|
} |
||||
|
} |
@ -0,0 +1,619 @@ |
|||||
|
package com.yxt.user.apiadmin; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
|
import com.yxt.common.base.config.RedisUtil; |
||||
|
import com.yxt.common.base.utils.*; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import com.yxt.user.biz.sysorganization.SysOrganization; |
||||
|
import com.yxt.user.biz.sysorganization.SysOrganizationService; |
||||
|
import com.yxt.user.biz.syspost.SysPost; |
||||
|
import com.yxt.user.biz.syspost.SysPostService; |
||||
|
import com.yxt.user.biz.sysstaffinfo.SysStaffinfo; |
||||
|
import com.yxt.user.biz.sysstaffinfo.SysStaffinfoService; |
||||
|
import com.yxt.user.biz.sysstaffinfo.SysStaffinfoVo; |
||||
|
import com.yxt.user.biz.sysstafforg.SysStaffOrg; |
||||
|
import com.yxt.user.biz.sysstafforg.SysStaffOrgService; |
||||
|
import com.yxt.user.biz.sysstaffpost.SysStaffPost; |
||||
|
import com.yxt.user.biz.sysstaffpost.SysStaffPostService; |
||||
|
import com.yxt.user.biz.sysuser.*; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
import java.util.*; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysUserFeignFallback.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.biz.sysuser.SysUserRest <br/> |
||||
|
* Description: 用户表. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:30 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Api(tags = "用户表") |
||||
|
@RestController |
||||
|
@RequestMapping("v1/sysuser") |
||||
|
public class SysUserRest { |
||||
|
@Autowired |
||||
|
private RedisUtil redisUtil; |
||||
|
@Autowired |
||||
|
private SysUserService sysUserService; |
||||
|
@Autowired |
||||
|
private SysStaffinfoService sysStaffinfoService; |
||||
|
@Autowired |
||||
|
private SysStaffOrgService sysStaffOrgService; |
||||
|
@Autowired |
||||
|
private SysStaffPostService sysStaffPostService; |
||||
|
@Autowired |
||||
|
private SysOrganizationService sysOrganizationService; |
||||
|
@Autowired |
||||
|
private SysPostService sysPostService; |
||||
|
@Autowired |
||||
|
private HttpServletRequest httpServletRequest; |
||||
|
// @Autowired
|
||||
|
// private SystemLogService systemLogService;
|
||||
|
// 定义点选文字图片验证码允许的误差值
|
||||
|
private static final int ERROR_AMOUNT = 50;// 定义允许的误差值,单位是px
|
||||
|
|
||||
|
|
||||
|
public ResultBean<PagerVo<SysUserVo>> listPage(@RequestBody PagerQuery<SysUserQuery> pq) { |
||||
|
ResultBean rb = ResultBean.fireFail();//roleSid
|
||||
|
PagerVo<SysUserVo> pv = sysUserService.listPageVo(pq); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysUserVo>> listAll(@RequestBody SysUserQuery query) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysUserVo> list = sysUserService.listAllVo(query); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysUserVo>> list() { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysUserVo> list = sysUserService.listVo(); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean save(SysUserDto dto) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
//手机号
|
||||
|
String mobile = dto.getMobile(); |
||||
|
//姓名
|
||||
|
String name = dto.getName(); |
||||
|
//用户类型
|
||||
|
int userType = dto.getUserType(); |
||||
|
//部门sid
|
||||
|
String deptSid = dto.getDeptSid(); |
||||
|
//岗位sid
|
||||
|
String postSid = dto.getPostSid(); |
||||
|
//验证码
|
||||
|
String verificationCode = dto.getVerificationCode(); |
||||
|
|
||||
|
if (StringUtils.isBlank(mobile)) { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("手机号不能为空"); |
||||
|
} else { |
||||
|
SysUser one = sysUserService.fetchByUserName(mobile); |
||||
|
if (null != one) { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("手机号重复!`"); |
||||
|
} |
||||
|
} |
||||
|
if (StringUtils.isBlank(name)) { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("姓名不能为空"); |
||||
|
} |
||||
|
if (userType == 0) { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("用户类型不能为空"); |
||||
|
} |
||||
|
if (StringUtils.isBlank(verificationCode)) { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("验证码不能为空"); |
||||
|
} else { |
||||
|
Map<String, Object> stringObjectMap = sysUserService.mobileValidateRegister(mobile, verificationCode); |
||||
|
String code = stringObjectMap.get("code").toString(); |
||||
|
String details = stringObjectMap.get("details").toString(); |
||||
|
if (Tools.CODE_FAIL.equals(code)) { |
||||
|
return ResultBean.fireFail().setMessage(details).setMsg(details); |
||||
|
} |
||||
|
} |
||||
|
//"15097329653";
|
||||
|
String password = mobile.substring(5, 11); |
||||
|
String md5 = Encodes.md5(password); |
||||
|
SysStaffinfo ssi = new SysStaffinfo(); |
||||
|
SysUser su = new SysUser(); |
||||
|
dto.fillEntity(su); |
||||
|
su.setStaffSid(ssi.getSid()); |
||||
|
su.setUserName(mobile); |
||||
|
su.setPassword(md5); |
||||
|
su.setIsAdmin("1"); |
||||
|
sysUserService.save(su); |
||||
|
ssi.setName(name); |
||||
|
ssi.setMobile(mobile); |
||||
|
ssi.setPinYinName(PinYinUtils.getPinYinName(name)); |
||||
|
ssi.setFirstPinYinLabel(PinYinUtils.getCharDuoPinYinChar(name)); |
||||
|
sysStaffinfoService.save(ssi); |
||||
|
if (StringUtils.isNotBlank(deptSid)) { |
||||
|
SysOrganization sysOrganization = sysOrganizationService.fetchBySid(deptSid); |
||||
|
SysStaffOrg sso = new SysStaffOrg(); |
||||
|
sso.setOrgName(sysOrganization.getName()); |
||||
|
sso.setOrgSid(sysOrganization.getSid()); |
||||
|
sso.setStaffSid(ssi.getSid()); |
||||
|
sso.setOrgSidPath(sysOrganization.getOrgSidPath()); |
||||
|
sso.setOrgNamePath(sysOrganization.getName()); |
||||
|
sso.setManageType("3"); |
||||
|
sysStaffOrgService.save(sso); |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(postSid)) { |
||||
|
SysPost sysPost = sysPostService.fetchBySid(postSid); |
||||
|
SysStaffPost ssp = new SysStaffPost(); |
||||
|
ssp.setStaffSid(ssi.getSid()); |
||||
|
ssp.setOrgSid(deptSid); |
||||
|
ssp.setPostSid(postSid); |
||||
|
ssp.setStartDate(new Date()); |
||||
|
ssp.setIsDepetHead(0); |
||||
|
sysStaffPostService.save(ssp); |
||||
|
} |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean delSysUserByMobile(String mobile) { |
||||
|
int i = sysUserService.delSysUserByMobile(mobile); |
||||
|
if (i == 0) { |
||||
|
return new ResultBean().fail().setMsg("删除失败"); |
||||
|
} |
||||
|
return new ResultBean().success().setMsg("删除成功"); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysStaffinfoVo> getSysUserByMobile(String staffSid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysStaffinfoVo user = sysUserService.getSysUserByMobile(staffSid); |
||||
|
return rb.success().setData(user); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean update(SysUserDto dto, String sid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysUserService.updateBySid(dto.toMap(), sid); |
||||
|
//部门sid
|
||||
|
String deptSid = dto.getDeptSid(); |
||||
|
//岗位sid
|
||||
|
String postSid = dto.getPostSid(); |
||||
|
SysUser sysUser = sysUserService.fetchBySid(sid); |
||||
|
SysStaffinfo ssi = sysStaffinfoService.fetchBySid(sysUser.getStaffSid()); |
||||
|
ssi.setMobile(dto.getMobile()); |
||||
|
ssi.setName(dto.getName()); |
||||
|
sysStaffinfoService.updateById(ssi); |
||||
|
if (StringUtils.isNotBlank(deptSid)) { |
||||
|
SysOrganization sysOrganization = sysOrganizationService.fetchBySid(deptSid); |
||||
|
sysStaffOrgService.deleteByStaffSid(sysUser.getStaffSid()); |
||||
|
SysStaffOrg sso = new SysStaffOrg(); |
||||
|
sso.setOrgName(sysOrganization.getName()); |
||||
|
sso.setOrgSid(sysOrganization.getSid()); |
||||
|
sso.setStaffSid(ssi.getSid()); |
||||
|
sso.setOrgSidPath(sysOrganization.getOrgSidPath()); |
||||
|
sso.setOrgNamePath(sysOrganization.getName()); |
||||
|
sso.setManageType("3"); |
||||
|
sysStaffOrgService.save(sso); |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(postSid)) { |
||||
|
SysPost sysPost = sysPostService.fetchBySid(postSid); |
||||
|
sysStaffPostService.deleteByStaffSid(sysUser.getStaffSid()); |
||||
|
SysStaffPost ssp = new SysStaffPost(); |
||||
|
ssp.setStaffSid(ssi.getSid()); |
||||
|
ssp.setOrgSid(deptSid); |
||||
|
ssp.setPostSid(postSid); |
||||
|
ssp.setStartDate(new Date()); |
||||
|
ssp.setIsDepetHead(0); |
||||
|
sysStaffPostService.save(ssp); |
||||
|
} |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改密码(★) |
||||
|
* |
||||
|
* @param original 原始密码 |
||||
|
* @param password 密码 |
||||
|
* @param confirmPassword 确认密码 |
||||
|
* @return |
||||
|
*/ |
||||
|
|
||||
|
public ResultBean updatePassword(String original, String password, String confirmPassword, String userSid, HttpServletRequest httpServletRequest) { |
||||
|
String token = httpServletRequest.getHeader("token"); |
||||
|
// 根据redisToken查询用户信息
|
||||
|
SysUser user = sysUserService.fetchBySid(userSid); |
||||
|
if (user == null) { |
||||
|
return ResultBean.fireFail().setMsg("抱歉,用户不存在"); |
||||
|
} |
||||
|
if (!password |
||||
|
.matches("^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])[a-zA-Z0-9]{8,16}$")) { |
||||
|
return ResultBean.fireFail().setMsg("密码格式错误,必须为8至16位大小写字母和数字的组合"); |
||||
|
} |
||||
|
String newPassword = Encodes.md5(original); |
||||
|
if (!newPassword.equals(user.getPassword())) { |
||||
|
return ResultBean.fireFail().setMsg("原始密码输入错误"); |
||||
|
} |
||||
|
if (!password.equals(confirmPassword)) { |
||||
|
return ResultBean.fireFail().setMsg("密码和确认密码不一致"); |
||||
|
} |
||||
|
int i = sysUserService.updatePassword(user.getSid(), Encodes.md5(password)); |
||||
|
if (i == 0) { |
||||
|
return ResultBean.fireFail().setMsg("修改失败"); |
||||
|
} |
||||
|
redisUtil.remove(token); |
||||
|
return ResultBean.fireSuccess().setMsg("修改成功"); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean del(String ids) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysUserService.delByIds(ids); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean delBySid(String sid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysUserService.delBySid(sid); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysUserVo> selectByUserName(String mobile) { |
||||
|
SysUser user = sysUserService.selectByUserName(mobile); |
||||
|
SysUserVo sysUserVo = new SysUserVo(); |
||||
|
BeanUtil.copyProperties(user, sysUserVo); |
||||
|
return new ResultBean().success().setData(sysUserVo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysUserVo> fetch(String id) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysUserVo vo = sysUserService.fetchByIdVo(id); |
||||
|
return rb.success().setData(vo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysUserVo> fetchBySid(String sid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysUserVo vo = sysUserService.fetchBySidVo(sid); |
||||
|
return rb.success().setData(vo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysUserVo>> fetchBySids(String sids) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysUserVo> vo = sysUserService.fetchBySidSVo(sids); |
||||
|
return rb.success().setData(vo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean reGetPwd(String userName, String userPhone) { |
||||
|
return sysUserService.reGetPwd(userName, userPhone); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean initPwd(String sid) { |
||||
|
if (!sysUserService.initPwd(sid)) { |
||||
|
return ResultBean.fireFail().setMsg("初始化密码失败"); |
||||
|
} |
||||
|
return ResultBean.fireSuccess().setMsg("初始化密码成功"); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/login") |
||||
|
@ResponseBody |
||||
|
@ApiOperation(value = "3、登录") |
||||
|
@ApiOperationSupport(order = 30) |
||||
|
public ResultBean<SysUserVo> login(SysUserQuery userQuery) { |
||||
|
String userName = userQuery.getUserName(); |
||||
|
String password = userQuery.getPassword(); |
||||
|
String verifyCode = userQuery.getVerifyCode(); |
||||
|
String type =userQuery.getType(); |
||||
|
SysUser user = null; |
||||
|
//密码登录
|
||||
|
if(type.equals("1")){ |
||||
|
if (StringUtils.isBlank(userName)) { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("用户名不能为空"); |
||||
|
} |
||||
|
if (StringUtils.isBlank(password)) { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("密码不能为空"); |
||||
|
} |
||||
|
|
||||
|
// 验证通过之后删除redis上的验证过的该条uuid
|
||||
|
user = sysUserService.selectByUserName(userName); |
||||
|
String md5 = Encodes.md5(password); |
||||
|
if (user == null) { |
||||
|
//根据手机号查询用户是否存在
|
||||
|
user = sysUserService.selectByMobile(userName); |
||||
|
if (user == null) { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("用户名或密码错误"); |
||||
|
} else { |
||||
|
if (!md5.equals(user.getPassword())) { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("用户名或密码错误"); |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
if (!(md5.equals(user.getPassword()))) { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("用户名或密码错误"); |
||||
|
} |
||||
|
} |
||||
|
}else{ |
||||
|
//验证码登录
|
||||
|
if (StringUtils.isBlank(verifyCode)) return new ResultBean<SysUserVo>().fail().setMsg("验证码不能为空"); |
||||
|
String codeFromRedis = redisUtil.get("loginCode" + userName); |
||||
|
if (StringUtils.isBlank(codeFromRedis)) |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("短信验证码已失效,请重新发送"); |
||||
|
if (verifyCode.equals(codeFromRedis.substring(0, 4))) { |
||||
|
user = sysUserService.selectByUserName(userName); |
||||
|
if(user==null){ |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("用户名不存在"); |
||||
|
} |
||||
|
redisUtil.remove("loginCode" + userName); |
||||
|
} else { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("短信验证码错误或已失效,请重新获取"); |
||||
|
} |
||||
|
} |
||||
|
// 根据用户信息查询用户的角色信息
|
||||
|
SysUserVo userInfoOneVo = sysUserService.setUserRedisSessionToken(user); |
||||
|
if (userInfoOneVo == null) { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("该用户不是公司员工"); |
||||
|
} |
||||
|
return new ResultBean<SysUserVo>().success().setData(userInfoOneVo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysUserVo> loginByNoVeriCode(SysUserQuery userQuery) { |
||||
|
|
||||
|
String userName = userQuery.getUserName(); |
||||
|
String password = userQuery.getPassword(); |
||||
|
if (StringUtils.isBlank(userName)) { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("用户名不能为空"); |
||||
|
} |
||||
|
if (StringUtils.isBlank(password)) { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("密码不能为空"); |
||||
|
} |
||||
|
SysUser user = null; |
||||
|
// 验证通过之后删除redis上的验证过的该条uuid
|
||||
|
user = sysUserService.selectByUserName(userName); |
||||
|
String md5 = Encodes.md5(password); |
||||
|
if (user == null) { |
||||
|
//根据手机号查询用户是否存在
|
||||
|
user = sysUserService.selectByMobile(userName); |
||||
|
if (user == null) { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("用户名或密码错误"); |
||||
|
} else { |
||||
|
if (!md5.equals(user.getPassword())) { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("用户名或密码错误"); |
||||
|
} |
||||
|
} |
||||
|
} else { |
||||
|
if (!(md5.equals(user.getPassword()))) { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("用户名或密码错误"); |
||||
|
} |
||||
|
} |
||||
|
// 根据用户信息查询用户的角色信息
|
||||
|
SysUserVo userInfoOneVo = sysUserService.setUserRedisSessionToken(user); |
||||
|
if (userInfoOneVo == null) { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("该用户不是公司员工"); |
||||
|
} |
||||
|
// SystemLog systemLog = new SystemLog();
|
||||
|
// systemLog.setUserName(user.getUserName());
|
||||
|
// String ip = WebUtil.getIpAddr(httpServletRequest);
|
||||
|
// systemLog.setUserIp(ip);
|
||||
|
// systemLog.setEventUrl("portal/v1/sysuser/login");
|
||||
|
// systemLog.setEventContent("用户登录");
|
||||
|
// systemLog.setEventName("用户登录");
|
||||
|
// systemLogService.save(systemLog);
|
||||
|
return new ResultBean<SysUserVo>().success().setData(userInfoOneVo); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean signOut(HttpServletRequest httpServletRequest) { |
||||
|
String token = httpServletRequest.getHeader("token"); |
||||
|
String redisToken = redisUtil.get(token); |
||||
|
if (StringUtils.isBlank(redisToken)) { |
||||
|
return ResultBean.fireSuccess().setMsg("您已退出,请刷新"); |
||||
|
} |
||||
|
redisUtil.remove(token); |
||||
|
return ResultBean.fireSuccess().setMsg("退出成功"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取验证码(注册)(★) |
||||
|
* |
||||
|
* @param mobile 手机号 |
||||
|
* @return ResultBean |
||||
|
*/ |
||||
|
|
||||
|
public ResultBean sendMessageCode(String mobile) { |
||||
|
if (StringUtils.isBlank(mobile) || !RegexUtil.isMobile(mobile)) { |
||||
|
return new ResultBean().fail().setMsg("请输入正确的手机号"); |
||||
|
} |
||||
|
String verificationCode = ""; |
||||
|
return sysUserService.getVerificationCode(mobile, verificationCode); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysUserVo> selectByStaffsid(String staffsid) { |
||||
|
SysUserVo user = sysUserService.selectByStaffsid(staffsid); |
||||
|
if (user != null) { |
||||
|
return new ResultBean<SysUserVo>().success().setData(user); |
||||
|
} else { |
||||
|
return new ResultBean<SysUserVo>().fail().setData(new SysUserVo()).setMsg("查无此用户"); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysUser> selectBySid(String sid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysUser vo = sysUserService.fetchBySid(sid); |
||||
|
if (vo == null) { |
||||
|
vo = new SysUser(); |
||||
|
return rb.fail().setData(vo).setMsg("用户不存在"); |
||||
|
} |
||||
|
return rb.success().setData(vo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysUserVo> loginDetails(HttpServletRequest httpServletRequest) { |
||||
|
String token = httpServletRequest.getHeader("token"); |
||||
|
if (StringUtils.isBlank(token)) { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("请重新登录"); |
||||
|
} |
||||
|
String userName = redisUtil.get(token); |
||||
|
if (StringUtils.isBlank(userName)) { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("请重新登录"); |
||||
|
} |
||||
|
SysUser user = sysUserService.selectByUserName(userName); |
||||
|
user.setToken(token); |
||||
|
SysUserVo userInfoOneVo = sysUserService.selectUserOne(user); |
||||
|
if (userInfoOneVo == null) { |
||||
|
return new ResultBean<SysUserVo>().fail().setMsg("该用户不是公司员工"); |
||||
|
} |
||||
|
return new ResultBean<SysUserVo>().success().setData(userInfoOneVo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// public ResultBean<AppUserOrgInfoVo> getUserOrgInfoByUserSid(String userSid) {
|
||||
|
// AppUserOrgInfoVo vo = sysUserService.getUserOrgInfoByUserSid(userSid);
|
||||
|
// if (vo == null) {
|
||||
|
// return new ResultBean().fail().setMsg("查询失败");
|
||||
|
// }
|
||||
|
// return new ResultBean().success().setData(vo);
|
||||
|
// }
|
||||
|
|
||||
|
/** |
||||
|
* 根据用户的sid查询该用户的组织信息 |
||||
|
* |
||||
|
* @param userSid 用户sid |
||||
|
* @return |
||||
|
*/ |
||||
|
|
||||
|
public ResultBean<SysUserInfoVo> selectUserInfoByUserSid(String userSid) { |
||||
|
ResultBean<SysUserInfoVo> rb = ResultBean.fireFail(); |
||||
|
SysUserInfoVo sysUserInfoVo = sysUserService.selectUserInfoByUserSid(userSid); |
||||
|
if (sysUserInfoVo == null) { |
||||
|
return rb.setData(new SysUserInfoVo()).setMsg("该用户未设置所属部门"); |
||||
|
} |
||||
|
return rb.success().setData(sysUserInfoVo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysUserInfoVo> selectUserInfoByUserSid(String userSid, String orgSid) { |
||||
|
ResultBean<SysUserInfoVo> rb = ResultBean.fireFail(); |
||||
|
SysUserInfoVo sysUserInfoVo = sysUserService.selectUserInfoByUserSid(userSid, orgSid); |
||||
|
if (sysUserInfoVo == null) { |
||||
|
return rb.setData(new SysUserInfoVo()).setMsg("该用户未设置所属部门"); |
||||
|
} |
||||
|
return rb.success().setData(sysUserInfoVo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean setIsEnable(String sid, String isEnable) { |
||||
|
SysUser sysUser = sysUserService.fetchBySid(sid); |
||||
|
if (sysUser == null) { |
||||
|
return ResultBean.fireFail().setMsg("此角色已不存在"); |
||||
|
} |
||||
|
int i = sysUserService.updateIsEnable(sid, isEnable); |
||||
|
if (i == 0) { |
||||
|
return ResultBean.fireFail().setMsg("设置失败"); |
||||
|
} |
||||
|
return ResultBean.fireSuccess().setMsg("设置成功"); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean getUsersByRoleSid(String roleSid) { |
||||
|
return sysUserService.getUsersByRoleSid(roleSid); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysUserVo>> getUserByRole(UserQuery query) { |
||||
|
return sysUserService.getUserByRole(query); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<String>> getUserSidByRole(UserQuery query) { |
||||
|
return sysUserService.getUserSidByRole(query); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysUserVo>> getUsersByRoles(UserssQuery usersQuery) { |
||||
|
return sysUserService.getUsersByRoles(usersQuery); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysUserVo>> getUserByOrgRole(UserRoleQuery query) { |
||||
|
return sysUserService.getUserByOrgRole(query); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysUserVo>> getOtherOrgRoleUser(UserRoleQuery query) { |
||||
|
return sysUserService.getOtherOrgRoleUser(query); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<Map<String, String>>> getUserByOrgSid(String orgSid, String userSid) { |
||||
|
return sysUserService.getUserByOrgSid(orgSid, userSid); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<String> selectIdBySid(List<String> stringList) { |
||||
|
return sysUserService.selectIdBySid(stringList); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysUserListVo>> selectSysUserList(String userSid, String orgPath) { |
||||
|
return sysUserService.selectSysUserList(userSid, orgPath); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<Boolean> selectPasswordByUserSid(String userSid) { |
||||
|
return sysUserService.selectPasswordByUserSid(userSid); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean selectHaveMessage(SysHaveMessageQuery sysHaveMessageQuery) { |
||||
|
return sysUserService.selectHaveMessage(sysHaveMessageQuery); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// public ResultBean<List<OrgList>> getOrgListByUserSid(String userSid) {
|
||||
|
// return sysUserService.getOrgListByUserSid(userSid);
|
||||
|
// }
|
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysUserVo>> getUserByRoles(UserByRolesAndOrgQuery userQuery) { |
||||
|
return sysUserService.getUserByRoles(userQuery); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<String>> shareSelectUser(ShareUserQuery shareUserQuery) { |
||||
|
return sysUserService.shareSelectUser(shareUserQuery); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<String> selectPrivilegeLevel(PrivilegeQuery query) { |
||||
|
return sysUserService.selectPrivilegeLevel(query); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean removeRedis() { |
||||
|
return sysUserService.removeRedis(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,118 @@ |
|||||
|
package com.yxt.user.apiadmin; |
||||
|
|
||||
|
import com.yxt.common.base.utils.StringUtils; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import com.yxt.user.biz.sysuserrole.*; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysUserRoleFeignFallback.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.biz.sysuserrole.SysUserRoleRest <br/> |
||||
|
* Description: 用户与角色关联表. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:30 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Api(tags = "用户与角色关联表") |
||||
|
@RestController |
||||
|
@RequestMapping("v1/sysuserrole") |
||||
|
public class SysUserRoleRest { |
||||
|
|
||||
|
@Autowired |
||||
|
private SysUserRoleService sysUserRoleService; |
||||
|
|
||||
|
|
||||
|
public ResultBean<PagerVo<SysUserRoleVo>> listPage(@RequestBody PagerQuery<SysUserRoleQuery> pq){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
PagerVo<SysUserRoleVo> pv = sysUserRoleService.listPageVo(pq); |
||||
|
return rb.success().setData(pv); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysUserRoleVo>> listAll(@RequestBody SysUserRoleQuery query){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysUserRoleVo> list = sysUserRoleService.listAllVo(query); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<SysUserRoleVo>> list(){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysUserRoleVo> list = sysUserRoleService.listVo(); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean save(SysUserRoleDto dto){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysUserRoleService.saveOrUpdateDto(dto); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean update(SysUserRoleDto dto){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysUserRoleService.deleteByUserSid(dto.getUserSid()); |
||||
|
String roleSid = dto.getRoleSid(); |
||||
|
if(StringUtils.isBlank(roleSid)){ |
||||
|
return rb.success(); |
||||
|
} |
||||
|
String[] roleSids = roleSid.split(","); |
||||
|
for(String sid:roleSids){ |
||||
|
SysUserRole sysUserRole=new SysUserRole(); |
||||
|
sysUserRole.setRoleSid(sid); |
||||
|
sysUserRole.setUserSid(dto.getUserSid()); |
||||
|
sysUserRoleService.saveOrUpdate(sysUserRole); |
||||
|
} |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean del(String ids){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysUserRoleService.delByIds(ids); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean delByUserSidAndRoleSid(String userSid, String roleSid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
sysUserRoleService.delByUserSidAndRoleSid(userSid,roleSid); |
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<SysUserRoleVo> fetch(String id){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysUserRoleVo vo = sysUserRoleService.fetchByIdVo(id); |
||||
|
return rb.success().setData(vo); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<String>> getUserRoleSidByUserSid(String userSid) { |
||||
|
return sysUserRoleService.getUserRoleSidByUserSid(userSid); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<String>> getUserIdListByRoleSid(List<String> roleList) { |
||||
|
return sysUserRoleService.getUserIdListByRoleSid(roleList); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public ResultBean<List<String>> selectByUserSid(String userSid) { |
||||
|
return sysUserRoleService.selectByUserSids(userSid); |
||||
|
} |
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
package com.yxt.user.biz.sms; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysFunctionDto.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysfunction.SysFunctionDto <br/> |
||||
|
* Description: 短信 数据传输对象. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "短信 数据传输对象", description = "短信 数据传输对象") |
||||
|
@Data |
||||
|
public class SmsDto { |
||||
|
|
||||
|
@ApiModelProperty("手机号码") |
||||
|
private String mobile; |
||||
|
|
||||
|
@ApiModelProperty("消息") |
||||
|
private String msg; |
||||
|
} |
@ -0,0 +1,47 @@ |
|||||
|
package com.yxt.user.biz.sms; |
||||
|
|
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
|
||||
|
/** |
||||
|
* @author dimengzhe |
||||
|
* @date 2020/9/11 16:52 |
||||
|
* @description |
||||
|
*/ |
||||
|
@Api(tags = "短信验证码") |
||||
|
@FeignClient( |
||||
|
contextId = "anrui-portal-SmsApi", |
||||
|
name = "anrui-portal", |
||||
|
path = "v1/sms", |
||||
|
fallback = SmsFeignFallback.class) |
||||
|
public interface SmsFeign { |
||||
|
static String msgSign="【安瑞集团】"; |
||||
|
// private static String msgtitle="河北省计量业务应用平台提醒:";
|
||||
|
static String MSG_NEWPWD="用户,您好!您的新密码为:"; |
||||
|
static String MSG_VERIFY = "用户,您好!您注册的单位已审核通过,管理员的密码为:"; |
||||
|
static String MSG_VERIFY_NO = "用户,您好!您注册的单位未审核通过,未通过原因:"; |
||||
|
static String MSG_VERIFY_ONE = "用户,您好!您所填写的基本信息未通过。请及时登录系统修改。"; |
||||
|
|
||||
|
static String MSG_USER_VERIFY = "用户,您好!您注册的个人信息已审核通过"; |
||||
|
static String MSG_USER_VERIFY_NO = "用户,您好!您注册的个人信息未审核通过,未通过原因:"; |
||||
|
static String MSG_ORG_STAFF = "尊敬的用户,您好!您绑定的单位已审核通过,可登陆系统进行查看"; |
||||
|
static String MSG_USING = "尊敬的用户,您好!有待确认的单位信息需确认,请及时确认信息"; |
||||
|
|
||||
|
static String MSG_OA_FILE_SEND = "用户,您好!协同办公中您收到一份文件,请查阅:"; |
||||
|
/** |
||||
|
* 发送短信验证码 |
||||
|
* |
||||
|
* @param dto 服务器响应 |
||||
|
* @return |
||||
|
* @throws Exception |
||||
|
*/ |
||||
|
@GetMapping("/sendWaitWorkMsg") |
||||
|
@ResponseBody |
||||
|
@ApiOperation(value = "发送短信验证码") |
||||
|
public ResultBean SendWaitWorkMsg(@RequestBody SmsDto dto) ; |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
package com.yxt.user.biz.sms; |
||||
|
|
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
@Component |
||||
|
public class SmsFeignFallback implements SmsFeign{ |
||||
|
@Override |
||||
|
public ResultBean SendWaitWorkMsg(SmsDto dto) { |
||||
|
return null; |
||||
|
} |
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
package com.yxt.user.biz.sysfunction; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* 查询按钮的权限的表单参数 |
||||
|
*/ |
||||
|
@ApiModel(value = "查询按钮的权限的表单参数", description = "查询按钮的权限的表单参数") |
||||
|
@Data |
||||
|
public class ButtonPermissionQuery { |
||||
|
@ApiModelProperty("userSid") |
||||
|
private String userSid; |
||||
|
@ApiModelProperty("url") |
||||
|
private String url; |
||||
|
@ApiModelProperty("type") |
||||
|
private String type; |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
package com.yxt.user.biz.sysfunction; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
@ApiModel(value = "返回查询的按钮权限集合", description = "返回查询的按钮权限集合") |
||||
|
@Data |
||||
|
public class ButtonPermissionVo { |
||||
|
@ApiModelProperty("buttonId") |
||||
|
private String buttonId; |
||||
|
} |
@ -0,0 +1,54 @@ |
|||||
|
package com.yxt.user.biz.sysfunction; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
|
import com.yxt.common.core.domain.BaseEntity; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysFunction.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysfunction.SysFunction <br/> |
||||
|
* Description: 功能. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "功能", description = "功能") |
||||
|
@TableName("sys_function") |
||||
|
@Data |
||||
|
public class SysFunction extends BaseEntity { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("功能名称") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("层级") |
||||
|
private Integer level; |
||||
|
|
||||
|
@ApiModelProperty("父级sid") |
||||
|
private String parentSid; |
||||
|
|
||||
|
@ApiModelProperty("接口地址") |
||||
|
private String actionUrl; |
||||
|
|
||||
|
@ApiModelProperty("模块名称") |
||||
|
private String controllerName; |
||||
|
|
||||
|
@ApiModelProperty("移动端按钮id") |
||||
|
private String funId; |
||||
|
|
||||
|
@ApiModelProperty("前端控制按钮的id") |
||||
|
@JsonProperty("cId") |
||||
|
private String cId; |
||||
|
|
||||
|
@ApiModelProperty("是否手机端权限0否,1是") |
||||
|
private String phoneFunction; |
||||
|
} |
@ -0,0 +1,54 @@ |
|||||
|
package com.yxt.user.biz.sysfunction; |
||||
|
|
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
|
import com.yxt.common.core.dto.Dto; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysFunctionDto.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysfunction.SysFunctionDto <br/> |
||||
|
* Description: 功能 数据传输对象. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "功能 数据传输对象", description = "功能 数据传输对象") |
||||
|
@Data |
||||
|
public class SysFunctionDto implements Dto { |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("功能名称") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("层级") |
||||
|
private Integer level; |
||||
|
|
||||
|
@ApiModelProperty("父级sid") |
||||
|
private String parentSid; |
||||
|
|
||||
|
@ApiModelProperty("接口地址") |
||||
|
private String actionUrl; |
||||
|
|
||||
|
@ApiModelProperty("模块名称") |
||||
|
private String controllerName; |
||||
|
@ApiModelProperty("模块sid") |
||||
|
private String sourceSid; |
||||
|
|
||||
|
@ApiModelProperty("移动端按钮id") |
||||
|
private String funId; |
||||
|
@ApiModelProperty("前端控制按钮的id") |
||||
|
@JsonProperty("cId") |
||||
|
private String cId; |
||||
|
@ApiModelProperty("是否手机端权限0否,1是") |
||||
|
private String phoneFunction; |
||||
|
@ApiModelProperty("备注") |
||||
|
private String remarks ; |
||||
|
} |
@ -0,0 +1,74 @@ |
|||||
|
package com.yxt.user.biz.sysfunction; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.apache.ibatis.annotations.Select; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysFunctionMapper.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.biz.sysfunction.SysFunctionMapper <br/> |
||||
|
* Description: 功能. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface SysFunctionMapper extends BaseMapper<SysFunction> { |
||||
|
|
||||
|
//@Update("update sys_function set name=#{msg} where id=#{id}")
|
||||
|
//IPage<SysFunctionVo> voPage(IPage<SysFunction> page, @Param(Constants.WRAPPER) QueryWrapper<SysFunction> qw);
|
||||
|
|
||||
|
IPage<SysFunctionVo> selectPageVo(IPage<SysFunction> page, @Param(Constants.WRAPPER) Wrapper<SysFunction> qw); |
||||
|
|
||||
|
List<SysFunctionVo> selectListAllVo(@Param(Constants.WRAPPER) Wrapper<SysFunction> qw); |
||||
|
|
||||
|
@Select("select * from sys_function") |
||||
|
List<SysFunctionVo> selectListVo(); |
||||
|
|
||||
|
List<SysFunctionVo> listAllParentByRoleSid(String roleSid, String sid); |
||||
|
|
||||
|
List<SysFunctionTreeVo> getChildrensForFunctionTree(@Param(Constants.WRAPPER) QueryWrapper<SysFunctionTreeVo> qw); |
||||
|
|
||||
|
List<SysFunctionTreeVo> selectChildernList(String sid); |
||||
|
|
||||
|
int updateBySourceSid(@Param("isEnable") Integer isEnable, @Param("list") List<String> list); |
||||
|
|
||||
|
/** |
||||
|
* 该资源下的功能是否可用 状态为1的功能 |
||||
|
* |
||||
|
* @param isEnable 是否可用,1可用,0不可用 |
||||
|
* @param sourceSid 资源sid |
||||
|
* @return |
||||
|
*/ |
||||
|
int selectBySourceSid(@Param("isEnable") int isEnable, @Param("sourceSid") String sourceSid); |
||||
|
|
||||
|
List<ButtonPermissionVo> getButtonPermissions(@Param("query") ButtonPermissionQuery query); |
||||
|
|
||||
|
List<Map<String, Object>> getSourceAuthorization(@Param("roleSid") String roleSid); |
||||
|
|
||||
|
@Select("SELECT sm.name,sm.sid,sm.pageUrl FROM sys_menu sm LEFT JOIN sys_source_menu ssm ON sm.sid=ssm.menuSid where ssm.sourceSid=#{sourceSid}") |
||||
|
List<Map<String, Object>> getMenuAuthorization(@Param("sourceSid") String sourceSid); |
||||
|
|
||||
|
@Select("SELECT sf.name,sf.sid FROM sys_function sf WHERE sf.actionUrl= #{pageUrl}") |
||||
|
List<Map<String, Object>> getFunctionAuthorization(@Param("pageUrl") String pageUrl); |
||||
|
|
||||
|
@Select("SELECT sf.name,sf.sid,IF(IFNULL(srf.id,0)<=0,1,0) checked FROM sys_function sf " + |
||||
|
" LEFT JOIN sys_role_function srf ON srf.functionSid=sf.sid " + |
||||
|
" WHERE sf.actionUrl= #{pageUrl} AND srf.roleSid = #{roleSid} ") |
||||
|
List<Map<String, Object>> getFunctionByRoleSid(@Param("pageUrl") String pageUrl, @Param("roleSid") String roleSid); |
||||
|
|
||||
|
List<Map<String, Object>> getSourceAuthorizationApp(@Param("roleSid") String roleSid); |
||||
|
} |
@ -0,0 +1,103 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.yxt.user.biz.sysfunction.SysFunctionMapper"> |
||||
|
<!-- <where> ${ew.sqlSegment} </where>--> |
||||
|
<!-- ${ew.customSqlSegment} --> |
||||
|
<select id="selectPageVo" resultType="com.yxt.user.biz.sysfunction.SysFunctionVo"> |
||||
|
SELECT * |
||||
|
FROM sys_function |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectListAllVo" resultType="com.yxt.user.biz.sysfunction.SysFunctionVo"> |
||||
|
SELECT func.*, source.sourceName as sourceName |
||||
|
FROM sys_function func |
||||
|
left join sys_source_function sourceF on sourceF.functionSid = func.sid |
||||
|
left join sys_source source on source.sid = sourceF.sourceSid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="listAllParentByRoleSid" resultType="com.yxt.user.biz.sysfunction.SysFunctionVo"> |
||||
|
SELECT DISTINCT func.*, ISNULL(roleFunction.sid) AS checked |
||||
|
FROM sys_function func |
||||
|
left join sys_role_function roleFunction |
||||
|
on func.sid = roleFunction.functionSid and roleFunction.roleSid = #{param1} |
||||
|
where func.parentSid = #{param2} |
||||
|
</select> |
||||
|
<select id="getChildrensForFunctionTree" resultType="com.yxt.user.biz.sysfunction.SysFunctionTreeVo"> |
||||
|
SELECT func.*, source.sourceName, sourceFunction.functionRootSid as functionRootSid |
||||
|
FROM sys_function func |
||||
|
left join sys_source_function sourceFunction on sourceFunction.functionSid = func.sid |
||||
|
left join sys_source source on source.sid = sourceFunction.sourceSid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectChildernList" resultType="com.yxt.user.biz.sysfunction.SysFunctionTreeVo"> |
||||
|
SELECT func.*, source.sourceName, sourceFunction.functionRootSid as functionRootSid |
||||
|
FROM sys_function func |
||||
|
left join sys_source_function sourceFunction on sourceFunction.functionSid = func.sid |
||||
|
left join sys_source source on source.sid = sourceFunction.sourceSid |
||||
|
where func.parentSid = #{sid} |
||||
|
</select> |
||||
|
|
||||
|
<update id="updateBySourceSid"> |
||||
|
UPDATE sys_function |
||||
|
SET isEnable = #{isEnable} WHERE sid IN |
||||
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")"> |
||||
|
#{item} |
||||
|
</foreach> |
||||
|
</update> |
||||
|
|
||||
|
<select id="selectBySourceSid" resultType="int"> |
||||
|
select count(*) |
||||
|
from sys_function sf |
||||
|
left join sys_source_function ssf on sf.sid = ssf.functionSid |
||||
|
where sf.isEnable = #{isEnable} |
||||
|
and ssf.sourceSid = #{sourceSid} |
||||
|
</select> |
||||
|
<select id="getButtonPermissions" resultType="com.yxt.user.biz.sysfunction.ButtonPermissionVo"> |
||||
|
SELECT sf.cId AS buttonId |
||||
|
FROM sys_function sf |
||||
|
WHERE actionUrl = #{query.url} |
||||
|
AND phoneFunction = #{query.type} |
||||
|
AND sid NOT IN |
||||
|
(SELECT IFNULL(srf.functionSid, "") functionSid |
||||
|
FROM sys_user_role sur |
||||
|
LEFT JOIN sys_role_function srf |
||||
|
ON sur.roleSid = srf.rolesid |
||||
|
WHERE sur.userSid = #{query.userSid}) |
||||
|
</select> |
||||
|
|
||||
|
<select id="getSourceAuthorization" resultType="java.util.Map"> |
||||
|
SELECT DISTINCT ss.sourceName, |
||||
|
ss.sid |
||||
|
FROM sys_source ss |
||||
|
LEFT JOIN sys_source_role ssr |
||||
|
ON ss.sid = ssr.sorceSid |
||||
|
LEFT JOIN sys_source_function ssf |
||||
|
ON ssr.`sorceSid` = ssf.`sourceSid` |
||||
|
LEFT JOIN sys_function sf |
||||
|
ON ssf.`functionSid` = sf.sid |
||||
|
WHERE ssr.rolesid = #{roleSid} |
||||
|
AND sf.phoneFunction = '0' |
||||
|
</select> |
||||
|
|
||||
|
<select id="getSourceAuthorizationApp" resultType="java.util.Map"> |
||||
|
SELECT DISTINCT ss.sourceName, |
||||
|
ss.sid |
||||
|
FROM sys_source ss |
||||
|
LEFT JOIN sys_source_role ssr |
||||
|
ON ss.sid = ssr.sorceSid |
||||
|
LEFT JOIN sys_source_function ssf |
||||
|
ON ssr.`sorceSid` = ssf.`sourceSid` |
||||
|
LEFT JOIN sys_function sf |
||||
|
ON ssf.`functionSid` = sf.sid |
||||
|
WHERE ssr.rolesid = #{roleSid} |
||||
|
AND sf.phoneFunction = '1' |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,53 @@ |
|||||
|
package com.yxt.user.biz.sysfunction; |
||||
|
|
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysFunctionQuery.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysfunction.SysFunctionQuery <br/> |
||||
|
* Description: 功能 查询条件. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "功能 查询条件", description = "功能 查询条件") |
||||
|
@Data |
||||
|
public class SysFunctionQuery implements Query { |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("功能名称") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("层级") |
||||
|
private Integer level; |
||||
|
|
||||
|
@ApiModelProperty("父级sid") |
||||
|
private String parentSid; |
||||
|
@ApiModelProperty("角色sid") |
||||
|
private String roleSid; |
||||
|
|
||||
|
@ApiModelProperty("接口地址") |
||||
|
private String actionUrl; |
||||
|
|
||||
|
@ApiModelProperty("模块名称") |
||||
|
private String controllerName; |
||||
|
|
||||
|
@ApiModelProperty("移动端按钮id") |
||||
|
private String funId; |
||||
|
@ApiModelProperty("前端控制按钮的id") |
||||
|
@JsonProperty("cId") |
||||
|
private String cId; |
||||
|
|
||||
|
@ApiModelProperty("是否手机端权限0否,1是") |
||||
|
private String phoneFunction; |
||||
|
} |
@ -0,0 +1,344 @@ |
|||||
|
package com.yxt.user.biz.sysfunction; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.yxt.user.biz.syssource.SysSourceService; |
||||
|
import com.yxt.common.base.service.MybatisBaseService; |
||||
|
import com.yxt.common.base.utils.PagerUtil; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysFunctionService.java <br/> |
||||
|
* Class: com.yxt.user.biz.sysfunction.SysFunctionService <br/> |
||||
|
* Description: 功能 业务逻辑. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class SysFunctionService extends MybatisBaseService<SysFunctionMapper, SysFunction> { |
||||
|
@Autowired |
||||
|
private SysSourceService sysSourceService; |
||||
|
@Autowired |
||||
|
// private SysSourceFunctionService sysSourceFunctionService;
|
||||
|
|
||||
|
public PagerVo<SysFunction> listPage(PagerQuery<SysFunctionQuery> pq) { |
||||
|
SysFunctionQuery query = pq.getParams(); |
||||
|
QueryWrapper<SysFunction> qw = createQueryWrapper(query); |
||||
|
IPage<SysFunction> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<SysFunction> pagging = baseMapper.selectPage(page, qw); |
||||
|
PagerVo<SysFunction> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
|
||||
|
public List<SysFunction> listAll(SysFunctionQuery query) { |
||||
|
QueryWrapper<SysFunction> qw = createQueryWrapper(query); |
||||
|
return baseMapper.selectList(qw); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<SysFunction> createQueryWrapper(SysFunctionQuery query) { |
||||
|
// todo: 这里根据具体业务调整查询条件
|
||||
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
||||
|
QueryWrapper<SysFunction> qw = new QueryWrapper<>(); |
||||
|
|
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getName())) { |
||||
|
qw.eq("name", query.getName()); |
||||
|
} |
||||
|
|
||||
|
if (query.getLevel() != null) { |
||||
|
qw.eq("level", query.getLevel()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getParentSid())) { |
||||
|
qw.eq("parentSid", query.getParentSid()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getActionUrl())) { |
||||
|
qw.eq("actionUrl", query.getActionUrl()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getControllerName())) { |
||||
|
qw.eq("controllerName", query.getControllerName()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getFunId())) { |
||||
|
qw.eq("funId", query.getFunId()); |
||||
|
} |
||||
|
|
||||
|
if (query.getPhoneFunction() != null) { |
||||
|
qw.eq("phoneFunction", query.getPhoneFunction()); |
||||
|
} |
||||
|
return qw; |
||||
|
} |
||||
|
|
||||
|
public PagerVo<SysFunctionVo> listPageVo(PagerQuery<SysFunctionQuery> pq) { |
||||
|
SysFunctionQuery query = pq.getParams(); |
||||
|
QueryWrapper<SysFunction> qw = createQueryWrapper(query); |
||||
|
IPage<SysFunction> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<SysFunctionVo> pagging = baseMapper.selectPageVo(page, qw); |
||||
|
PagerVo<SysFunctionVo> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
|
||||
|
public List<SysFunctionVo> listAllVo(SysFunctionQuery query) { |
||||
|
QueryWrapper<SysFunction> qw = new QueryWrapper<>(); |
||||
|
qw.eq("func.parentSid", "0"); |
||||
|
List<SysFunctionVo> sysFunctionVos = baseMapper.selectListAllVo(qw); |
||||
|
for (SysFunctionVo s : sysFunctionVos) { |
||||
|
getChildrens(s); |
||||
|
} |
||||
|
return sysFunctionVos; |
||||
|
} |
||||
|
|
||||
|
private void getChildrens(SysFunctionVo s) { |
||||
|
String sid = s.getSid(); |
||||
|
QueryWrapper<SysFunction> qw = new QueryWrapper<>(); |
||||
|
if (StringUtils.isNotBlank(sid)) { |
||||
|
qw.eq("func.parentSid", sid); |
||||
|
} |
||||
|
List<SysFunctionVo> sysFunctionVos = baseMapper.selectListAllVo(qw); |
||||
|
if (!sysFunctionVos.isEmpty()) { |
||||
|
for (SysFunctionVo sfv : sysFunctionVos) { |
||||
|
getChildrens(sfv); |
||||
|
} |
||||
|
} |
||||
|
s.setChildren(sysFunctionVos); |
||||
|
} |
||||
|
|
||||
|
public List<SysFunctionVo> listVo() { |
||||
|
return baseMapper.selectListVo(); |
||||
|
} |
||||
|
|
||||
|
public void saveOrUpdateDto(SysFunctionDto dto) { |
||||
|
SysFunction entity = new SysFunction(); |
||||
|
dto.fillEntity(entity); |
||||
|
// SysSourceFunction sysSourceFunction = new SysSourceFunction();
|
||||
|
// sysSourceFunction.setFunctionSid(entity.getSid());
|
||||
|
// sysSourceFunction.setSourceSid(dto.getSourceSid());
|
||||
|
// setRootSid(entity, sysSourceFunction);
|
||||
|
// sysSourceFunctionService.save(sysSourceFunction);
|
||||
|
this.saveOrUpdate(entity); |
||||
|
} |
||||
|
|
||||
|
// private void setRootSid(SysFunction entity, SysSourceFunction sysSourceFunction) {
|
||||
|
// String pSid = entity.getParentSid();
|
||||
|
// if ("0".equals(pSid)) {
|
||||
|
// sysSourceFunction.setFunctionRootSid(entity.getSid());
|
||||
|
// } else {
|
||||
|
// SysFunction sysFunction = this.fetchBySid(pSid);
|
||||
|
// String pSid1 = sysFunction.getParentSid();
|
||||
|
// if ("0".equals(pSid1)) {
|
||||
|
// sysSourceFunction.setFunctionRootSid(sysFunction.getSid());
|
||||
|
// }
|
||||
|
// setRootSid(sysFunction, sysSourceFunction);
|
||||
|
// }
|
||||
|
// }
|
||||
|
|
||||
|
public SysFunctionVo fetchByIdVo(String id) { |
||||
|
SysFunction entity = this.fetchById(id); |
||||
|
SysFunctionVo vo = new SysFunctionVo(); |
||||
|
BeanUtil.copyProperties(entity, vo); |
||||
|
return vo; |
||||
|
} |
||||
|
|
||||
|
public List<SysFunctionVo> listAllByRoleSid(SysFunctionQuery query) { |
||||
|
List<SysFunctionVo> sysFunctionVos = baseMapper.listAllParentByRoleSid(query.getRoleSid(), "0"); |
||||
|
for (SysFunctionVo s : sysFunctionVos) { |
||||
|
getChildrensByRoleSid(s, query.getRoleSid()); |
||||
|
} |
||||
|
return sysFunctionVos; |
||||
|
} |
||||
|
|
||||
|
private void getChildrensByRoleSid(SysFunctionVo s, String roleSid) { |
||||
|
List<SysFunctionVo> sysFunctionVos = baseMapper.listAllParentByRoleSid(roleSid, s.getSid()); |
||||
|
if (!sysFunctionVos.isEmpty()) { |
||||
|
for (SysFunctionVo sfv : sysFunctionVos) { |
||||
|
getChildrensByRoleSid(sfv, roleSid); |
||||
|
} |
||||
|
} |
||||
|
s.setChildren(sysFunctionVos); |
||||
|
} |
||||
|
|
||||
|
public List<SysFunctionTreeVo> listAllVoForSource(SysFunctionQuery query) { |
||||
|
String name = query.getName(); |
||||
|
List<SysFunctionTreeVo> sysSourceVos = sysSourceService.listFunctionTreeVo(name); |
||||
|
for (SysFunctionTreeVo s : sysSourceVos) { |
||||
|
// List<SysFunctionTreeVo> sysFunctionVoList = sysSourceFunctionService.fetchRootFunctionBySourceSid(s.getSourceSid());
|
||||
|
// for (SysFunctionTreeVo sysFunctionTreeVo : sysFunctionVoList) {
|
||||
|
// if (StringUtils.isNotBlank(sysFunctionTreeVo.getRemarks())){
|
||||
|
// sysFunctionTreeVo.setName(sysFunctionTreeVo.getName() + "(" + sysFunctionTreeVo.getRemarks() + ")");
|
||||
|
// }
|
||||
|
// }
|
||||
|
// s.setChildren(sysFunctionVoList);
|
||||
|
s.setIsSource("1"); |
||||
|
//判断该资源下的功能是否有可用的状态
|
||||
|
int isEnable = 1; |
||||
|
int count = baseMapper.selectBySourceSid(isEnable, s.getSourceSid()); |
||||
|
if (count == 0) { |
||||
|
s.setIsEnable("0"); |
||||
|
} else { |
||||
|
s.setIsEnable("1"); |
||||
|
} |
||||
|
// if (!sysFunctionVoList.isEmpty()) {
|
||||
|
//// sysFunctionVoList = getChildrensForFunctionTree(sysFunctionVoList);
|
||||
|
// getChildList(sysFunctionVoList);
|
||||
|
// }
|
||||
|
} |
||||
|
return sysSourceVos; |
||||
|
} |
||||
|
|
||||
|
public void getChildList(List<SysFunctionTreeVo> list) { |
||||
|
list.forEach(str -> { |
||||
|
String sid = str.getSid(); |
||||
|
List<SysFunctionTreeVo> listChildren = baseMapper.selectChildernList(sid); |
||||
|
str.setChildren(listChildren); |
||||
|
getChildList(listChildren); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
private List<SysFunctionTreeVo> getChildrensForFunctionTree(List<SysFunctionTreeVo> sysFunctionVoList) { |
||||
|
List<SysFunctionTreeVo> list = new ArrayList<>(); |
||||
|
for (SysFunctionTreeVo s : sysFunctionVoList) { |
||||
|
SysFunction sysFunction = fetchBySid(s.getFunctionRootSid()); |
||||
|
SysFunctionTreeVo sysFunctionTreeVo = new SysFunctionTreeVo(); |
||||
|
BeanUtil.copyProperties(sysFunction, sysFunctionTreeVo); |
||||
|
/*sysFunctionTreeVo.setParentName("顶级功能");*/ |
||||
|
list.add(sysFunctionTreeVo); |
||||
|
} |
||||
|
for (SysFunctionTreeVo s : list) { |
||||
|
getChildrensForFunctionTree(s, s.getSid()); |
||||
|
} |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
private void getChildrensForFunctionTree(SysFunctionTreeVo s, String sid) { |
||||
|
QueryWrapper<SysFunctionTreeVo> qw = new QueryWrapper<>(); |
||||
|
if (StringUtils.isNotBlank(sid)) { |
||||
|
qw.eq("func.parentSid", sid); |
||||
|
} |
||||
|
List<SysFunctionTreeVo> sysMenuVos = baseMapper.getChildrensForFunctionTree(qw); |
||||
|
if (!sysMenuVos.isEmpty()) { |
||||
|
for (SysFunctionTreeVo smv : sysMenuVos) { |
||||
|
/*SysFunction sysFunction = fetchBySid(sid); |
||||
|
smv.setParentName(sysFunction.getName());*/ |
||||
|
getChildrensForFunctionTree(smv, smv.getSid()); |
||||
|
} |
||||
|
} |
||||
|
s.setChildren(sysMenuVos); |
||||
|
} |
||||
|
|
||||
|
public int updateBySourceSid(Integer isEnable, List<String> sids) { |
||||
|
return baseMapper.updateBySourceSid(isEnable, sids); |
||||
|
} |
||||
|
|
||||
|
public List<ButtonPermissionVo> getButtonPermissions(ButtonPermissionQuery query) { |
||||
|
List<ButtonPermissionVo> buttonPermissions = baseMapper.getButtonPermissions(query); |
||||
|
return buttonPermissions; |
||||
|
} |
||||
|
|
||||
|
public List<Map<String, Object>> getFunctionAuthorization(String roleSid) { |
||||
|
List<Map<String, Object>> list = new ArrayList<>(); |
||||
|
List<Map<String, Object>> lsources = baseMapper.getSourceAuthorization(roleSid); |
||||
|
lsources.forEach(f -> { |
||||
|
Map<String, Object> map = new HashMap<>(); |
||||
|
map.put("name", f.get("sourceName").toString()); |
||||
|
map.put("sid", f.get("sid").toString()); |
||||
|
map.put("checked", "1"); |
||||
|
list.add(map); |
||||
|
}); |
||||
|
|
||||
|
list.forEach(f -> { |
||||
|
List<Map<String, Object>> list2 = new ArrayList<>(); |
||||
|
String sid = f.get("sid").toString(); |
||||
|
List<Map<String, Object>> lmenus = baseMapper.getMenuAuthorization(sid); |
||||
|
lmenus.forEach(ff -> { |
||||
|
Map<String, Object> map = new HashMap<>(); |
||||
|
if (ff.get("pageUrl") != null && com.yxt.common.base.utils.StringUtils.isNotBlank(ff.get("pageUrl").toString())) { |
||||
|
String pageUrl = ff.get("pageUrl").toString(); |
||||
|
List<Map<String, Object>> lfuncs = baseMapper.getFunctionAuthorization(pageUrl); |
||||
|
List<Map<String, Object>> functionByRoleSid = baseMapper.getFunctionByRoleSid(pageUrl, roleSid); |
||||
|
if (lfuncs.size() > 0){ |
||||
|
map.put("name", ff.get("name")); |
||||
|
String sids = ff.get("sid").toString(); |
||||
|
map.put("sid", sids); |
||||
|
map.put("checked", "1"); |
||||
|
map.put("children", new ArrayList<>()); |
||||
|
for (Map<String, Object> lfunc : lfuncs) { |
||||
|
for (Map<String, Object> funByRole : functionByRoleSid) { |
||||
|
if (lfunc.get("sid").equals(funByRole.get("sid"))) { |
||||
|
lfunc.put("checked", "0"); |
||||
|
} |
||||
|
} |
||||
|
lfunc.put("children", new ArrayList<>()); |
||||
|
} |
||||
|
map.put("children", lfuncs); |
||||
|
list2.add(map); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
f.put("children", list2); |
||||
|
}); |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
public List<Map<String, Object>> getFunctionAuthorizationApp(String roleSid) { |
||||
|
List<Map<String, Object>> list = new ArrayList<>(); |
||||
|
List<Map<String, Object>> lsources = baseMapper.getSourceAuthorizationApp(roleSid); |
||||
|
lsources.forEach(f -> { |
||||
|
Map<String, Object> map = new HashMap<>(); |
||||
|
map.put("name", f.get("sourceName").toString()); |
||||
|
map.put("sid", f.get("sid").toString()); |
||||
|
map.put("checked", "1"); |
||||
|
list.add(map); |
||||
|
}); |
||||
|
|
||||
|
list.forEach(f -> { |
||||
|
List<Map<String, Object>> list2 = new ArrayList<>(); |
||||
|
String sid = f.get("sid").toString(); |
||||
|
List<Map<String, Object>> lmenus = baseMapper.getMenuAuthorization(sid); |
||||
|
lmenus.forEach(ff -> { |
||||
|
Map<String, Object> map = new HashMap<>(); |
||||
|
if (ff.get("pageUrl") != null && com.yxt.common.base.utils.StringUtils.isNotBlank(ff.get("pageUrl").toString())) { |
||||
|
String pageUrl = ff.get("pageUrl").toString(); |
||||
|
List<Map<String, Object>> lfuncs = baseMapper.getFunctionAuthorization(pageUrl); |
||||
|
List<Map<String, Object>> functionByRoleSid = baseMapper.getFunctionByRoleSid(pageUrl, roleSid); |
||||
|
if (lfuncs.size() > 0){ |
||||
|
map.put("name", ff.get("name")); |
||||
|
String sids = ff.get("sid").toString(); |
||||
|
map.put("sid", sids); |
||||
|
map.put("checked", "1"); |
||||
|
map.put("children", new ArrayList<>()); |
||||
|
for (Map<String, Object> lfunc : lfuncs) { |
||||
|
for (Map<String, Object> funByRole : functionByRoleSid) { |
||||
|
if (lfunc.get("sid").equals(funByRole.get("sid"))) { |
||||
|
lfunc.put("checked", "0"); |
||||
|
} |
||||
|
} |
||||
|
lfunc.put("children", new ArrayList<>()); |
||||
|
} |
||||
|
map.put("children", lfuncs); |
||||
|
list2.add(map); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
f.put("children", list2); |
||||
|
}); |
||||
|
return list; |
||||
|
} |
||||
|
} |
@ -0,0 +1,50 @@ |
|||||
|
package com.yxt.user.biz.sysfunction; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysFunctionTreeVo.java <br/> |
||||
|
* Description: 功能表 视图数据对象. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "功能表 视图数据对象", description = "功能表 视图数据对象") |
||||
|
@Data |
||||
|
public class SysFunctionTreeVo implements Vo { |
||||
|
@ApiModelProperty("功能名称") |
||||
|
private String name; |
||||
|
@ApiModelProperty("资源sid") |
||||
|
private String sourceSid; |
||||
|
@ApiModelProperty("上级sid") |
||||
|
private String parentSid; |
||||
|
@ApiModelProperty("sid") |
||||
|
private String sid; |
||||
|
@ApiModelProperty("资源名称") |
||||
|
private String sourceName; |
||||
|
@ApiModelProperty("url地址") |
||||
|
private String actionUrl; |
||||
|
@ApiModelProperty("功能根路径sid") |
||||
|
private String functionRootSid; |
||||
|
@ApiModelProperty("子功能") |
||||
|
private List<SysFunctionTreeVo> children; |
||||
|
@ApiModelProperty("是否可用") |
||||
|
private String isEnable; |
||||
|
@ApiModelProperty("功能列表用,是否是资源层级1是,0不是") |
||||
|
private String isSource = "0"; |
||||
|
@ApiModelProperty("父级名称") |
||||
|
private String parentName; |
||||
|
@ApiModelProperty("说明") |
||||
|
private String remarks; |
||||
|
} |
@ -0,0 +1,59 @@ |
|||||
|
package com.yxt.user.biz.sysfunction; |
||||
|
|
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonProperty; |
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysFunctionVo.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysfunction.SysFunctionVo <br/> |
||||
|
* Description: 功能 视图数据对象. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "功能 视图数据对象", description = "功能 视图数据对象") |
||||
|
@Data |
||||
|
public class SysFunctionVo implements Vo { |
||||
|
@ApiModelProperty("功能名称") |
||||
|
private String name; |
||||
|
@ApiModelProperty("父级sid") |
||||
|
private String parentSid; |
||||
|
@ApiModelProperty("父级名称") |
||||
|
private String parentName; |
||||
|
@ApiModelProperty("接口地址") |
||||
|
private String actionUrl; |
||||
|
@ApiModelProperty("模块名称") |
||||
|
private String controllerName; |
||||
|
@ApiModelProperty("是否手机端权限0否,1是") |
||||
|
private String phoneFunction; |
||||
|
@ApiModelProperty("sid") |
||||
|
private String sid; |
||||
|
@ApiModelProperty("子集数据") |
||||
|
private List<SysFunctionVo> children; |
||||
|
@ApiModelProperty("是否选中 1未选中,0选中") |
||||
|
private String checked; |
||||
|
@ApiModelProperty("资源名称") |
||||
|
private String sourceName; |
||||
|
@ApiModelProperty("资源SId") |
||||
|
private String sourceSid; |
||||
|
@ApiModelProperty("是否可用") |
||||
|
private Integer isEnable; |
||||
|
@ApiModelProperty("移动端按钮id") |
||||
|
private String funId; |
||||
|
@ApiModelProperty("前端控制按钮的id") |
||||
|
@JsonProperty("cId") |
||||
|
private String cId; |
||||
|
@ApiModelProperty("说明") |
||||
|
private String remarks; |
||||
|
} |
@ -0,0 +1,64 @@ |
|||||
|
package com.yxt.user.biz.sysmenu; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.yxt.common.core.domain.BaseEntity; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysMenu.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysmenu.SysMenu <br/> |
||||
|
* Description: 菜单表. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "菜单表", description = "菜单表") |
||||
|
@TableName("sys_menu") |
||||
|
@Data |
||||
|
public class SysMenu extends BaseEntity { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("菜单名称") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("菜单路由路径(VUE)") |
||||
|
private String menuUrl; |
||||
|
|
||||
|
@ApiModelProperty("菜单对应的前端页面路径") |
||||
|
private String pageUrl; |
||||
|
|
||||
|
@ApiModelProperty("菜单图标地址") |
||||
|
private String iconUrl; |
||||
|
|
||||
|
@ApiModelProperty("资源sid") |
||||
|
private String sourceSid; |
||||
|
|
||||
|
@ApiModelProperty("是否显示,默认为1显示,0为不显示") |
||||
|
private String isShow; |
||||
|
|
||||
|
@ApiModelProperty("排序号") |
||||
|
private Integer sortNo; |
||||
|
|
||||
|
@ApiModelProperty("上级sid") |
||||
|
private String pSid; |
||||
|
|
||||
|
@ApiModelProperty("前端页面路径重定向") |
||||
|
private Integer pageUrlRedirect; |
||||
|
|
||||
|
@ApiModelProperty("前端页面名称(vue组件名)") |
||||
|
private String pageName; |
||||
|
|
||||
|
@ApiModelProperty("前端页面别名") |
||||
|
private String pageAliasName; |
||||
|
|
||||
|
@ApiModelProperty("菜单类型(0左侧当行菜单,1页面中功能)") |
||||
|
private String menuType; |
||||
|
} |
@ -0,0 +1,72 @@ |
|||||
|
package com.yxt.user.biz.sysmenu; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.dto.Dto; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysMenuDto.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysmenu.SysMenuDto <br/> |
||||
|
* Description: 菜单表 数据传输对象. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "菜单表 数据传输对象", description = "菜单表 数据传输对象") |
||||
|
@Data |
||||
|
public class SysMenuDto implements Dto { |
||||
|
|
||||
|
|
||||
|
private static final long serialVersionUID = -8143707488992909267L; |
||||
|
@ApiModelProperty(value = "菜单名称", required = true) |
||||
|
@NotBlank(message = "菜单名称不能为空") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("菜单路由路径(VUE)") |
||||
|
private String menuUrl; |
||||
|
|
||||
|
@ApiModelProperty("菜单对应的前端页面路径") |
||||
|
private String pageUrl; |
||||
|
|
||||
|
@ApiModelProperty("菜单图标地址") |
||||
|
private String iconUrl; |
||||
|
|
||||
|
@ApiModelProperty(value = "资源sid", required = true) |
||||
|
@NotBlank(message = "资源不能为空") |
||||
|
private String sourceSid; |
||||
|
|
||||
|
@ApiModelProperty(value = "是否显示,默认为1显示,0为不显示", required = true) |
||||
|
@NotBlank(message = "是否显示不能为空") |
||||
|
private String isShow; |
||||
|
|
||||
|
@ApiModelProperty("排序号") |
||||
|
private Integer sortNo; |
||||
|
|
||||
|
@ApiModelProperty(value = "上级sid", example = "0", required = true) |
||||
|
@NotBlank(message = "上级菜单不能为空") |
||||
|
private String pSid; |
||||
|
|
||||
|
@ApiModelProperty(value = "前端页面路径重定向", required = false) |
||||
|
private Integer pageUrlRedirect; |
||||
|
|
||||
|
@ApiModelProperty("前端页面名称(vue组件名)") |
||||
|
private String pageName; |
||||
|
|
||||
|
@ApiModelProperty(value = "前端页面别名", required = false) |
||||
|
private String pageAliasName; |
||||
|
|
||||
|
@ApiModelProperty("菜单类型(0左侧当行菜单,1页面中功能)") |
||||
|
private String menuType; |
||||
|
|
||||
|
@ApiModelProperty(value = "备注") |
||||
|
private String remarks; |
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
package com.yxt.user.biz.sysmenu; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysMenuQuery.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysmenu.SysMenuQuery <br/> |
||||
|
* Description: 菜单表 查询条件. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "菜单表 查询条件 功能菜单设置查询用", description = "菜单表 查询条件 功能菜单设置查询用") |
||||
|
@Data |
||||
|
public class SysMenuFunctionQuery implements Query { |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("资源sid") |
||||
|
private String sourceSid; |
||||
|
|
||||
|
} |
@ -0,0 +1,82 @@ |
|||||
|
package com.yxt.user.biz.sysmenu; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.apache.ibatis.annotations.Select; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysMenuMapper.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.biz.sysmenu.SysMenuMapper <br/> |
||||
|
* Description: 菜单表. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface SysMenuMapper extends BaseMapper<SysMenu> { |
||||
|
|
||||
|
//@Update("update sys_menu set name=#{msg} where id=#{id}")
|
||||
|
//IPage<SysMenuVo> voPage(IPage<SysMenu> page, @Param(Constants.WRAPPER) QueryWrapper<SysMenu> qw);
|
||||
|
|
||||
|
IPage<SysMenuVo> selectPageVo(IPage<SysMenu> page, @Param(Constants.WRAPPER) Wrapper<SysMenu> qw); |
||||
|
|
||||
|
List<SysMenuVo> selectListAllVo(@Param(Constants.WRAPPER) Wrapper<SysMenu> qw); |
||||
|
|
||||
|
@Select("select * from sys_menu") |
||||
|
List<SysMenuVo> selectListVo(); |
||||
|
|
||||
|
List<SysMenuVo> listAllParentByRoleSid(String roleSid, String sid, @Param("sourceSid") String sourceSid); |
||||
|
|
||||
|
@Select("SELECT menu.*,sourceMenu.`sourceSid` FROM sys_menu menu " + |
||||
|
"LEFT JOIN sys_source_menu sourceMenu ON menu.sid=sourceMenu.menuSid where menu.sid=#{sid}") |
||||
|
SysMenu fetchBySid(@Param("sid") String sid); |
||||
|
|
||||
|
List<SysMenuTreeVo> getChildrensForMenuTree(@Param(Constants.WRAPPER) QueryWrapper<SysMenuTreeVo> qw); |
||||
|
|
||||
|
/** |
||||
|
* 将该资源下的所有菜单设置是否可用 |
||||
|
* |
||||
|
* @param sid 资源sid |
||||
|
* @param isEnable 是否可用:1可用,0不可用 |
||||
|
* @return |
||||
|
*/ |
||||
|
int updateBySourceSid(@Param("sid") String sid, @Param("isEnable") Integer isEnable); |
||||
|
|
||||
|
/** |
||||
|
* 根据上级sid查询菜单的子集菜单 |
||||
|
* |
||||
|
* @param sid 菜单sid |
||||
|
* @return |
||||
|
*/ |
||||
|
List<SysMenuTreeVo> selectChildernList(String sid); |
||||
|
|
||||
|
/** |
||||
|
* 查询该资源下是否有可用的菜单 |
||||
|
* |
||||
|
* @param isEnable |
||||
|
* @return |
||||
|
*/ |
||||
|
int selectBySourceSid(@Param("isEnable") int isEnable, @Param("sourceSid") String sourceSid); |
||||
|
|
||||
|
List<SysMenu> selectByMenuUrl(String menuUrl); |
||||
|
|
||||
|
/** |
||||
|
* 查询该资源下一级菜单列表 |
||||
|
* |
||||
|
* @param sourceSid 资源sid |
||||
|
* @return |
||||
|
*/ |
||||
|
List<SysMenuTreeVo> fetchRootMenuBySourceSid(@Param("sourceSid") String sourceSid); |
||||
|
} |
@ -0,0 +1,88 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.yxt.user.biz.sysmenu.SysMenuMapper"> |
||||
|
<!-- <where> ${ew.sqlSegment} </where>--> |
||||
|
<!-- ${ew.customSqlSegment} --> |
||||
|
<select id="selectPageVo" resultType="com.yxt.user.biz.sysmenu.SysMenuVo"> |
||||
|
SELECT * |
||||
|
FROM sys_menu |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="selectListAllVo" resultType="com.yxt.user.biz.sysmenu.SysMenuVo"> |
||||
|
SELECT menu.*, source.sourceName, pmenu.name as pName |
||||
|
FROM sys_menu menu |
||||
|
left join sys_menu pmenu on pmenu.sid = menu.psid |
||||
|
left join sys_source_menu sourceMenu on sourceMenu.menuSid = menu.sid |
||||
|
left join sys_source source on source.sid = sourceMenu.sourceSid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="listAllParentByRoleSid" resultType="com.yxt.user.biz.sysmenu.SysMenuVo"> |
||||
|
SELECT menu.*, ISNULL(menuRole.sid) as checked |
||||
|
FROM sys_menu menu |
||||
|
left join sys_menu_role menuRole on menu.sid = menuRole.menuSid AND menuRole.roleSid = #{param1} |
||||
|
where menu.pSid = #{param2} |
||||
|
<if test="sourceSid != null"> |
||||
|
and menu.sourceSid = #{sourceSid} |
||||
|
</if> |
||||
|
</select> |
||||
|
<select id="getChildrensForMenuTree" resultType="com.yxt.user.biz.sysmenu.SysMenuTreeVo"> |
||||
|
SELECT menu.*, source.sourceName, sourceMenu.menuRootSid as menuRootSid |
||||
|
FROM sys_menu menu |
||||
|
left join sys_source_menu sourceMenu on sourceMenu.menuSid = menu.sid |
||||
|
left join sys_source source on source.sid = sourceMenu.sourceSid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<!--将该资源下的所有菜单设置为是否可用--> |
||||
|
<update id="updateBySourceSid"> |
||||
|
update sys_menu |
||||
|
set isEnable = #{isEnable} |
||||
|
where sourceSid = #{sid} |
||||
|
</update> |
||||
|
|
||||
|
<select id="selectChildernList" resultType="com.yxt.user.biz.sysmenu.SysMenuTreeVo"> |
||||
|
SELECT menu.*, source.sourceName, menu.pSid as menuRootSid |
||||
|
FROM sys_menu menu |
||||
|
left join sys_source source on source.sid = menu.sourceSid |
||||
|
where menu.pSid = #{sid} |
||||
|
ORDER BY menu.sortNo ASC |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectBySourceSid" resultType="int"> |
||||
|
select count(*) |
||||
|
from sys_menu |
||||
|
where isEnable = #{isEnable} |
||||
|
and sourceSid = #{sourceSid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectByMenuUrl" resultType="com.yxt.user.biz.sysmenu.SysMenu"> |
||||
|
select * from sys_menu where menuUrl = #{menuUrl} |
||||
|
</select> |
||||
|
<!--将该资源下的所有一级菜单列表--> |
||||
|
<select id="fetchRootMenuBySourceSid" resultType="com.yxt.user.biz.sysmenu.SysMenuTreeVo"> |
||||
|
SELECT menu.NAME AS NAME, |
||||
|
menu.sid AS sid, |
||||
|
menu.sid AS sid, |
||||
|
source.sid AS sourceSid, |
||||
|
menu.sortNo AS sortNo, |
||||
|
menu.pSid AS pSid, |
||||
|
source.sourceName AS sourceName, |
||||
|
menu.sid AS menuRootSid, |
||||
|
menu.menuUrl AS menuUrl, |
||||
|
menu.iconUrl AS iconUrl, |
||||
|
menu.pageName AS pageName, |
||||
|
menu.pageUrlRedirect AS pageUrlRedirect, |
||||
|
menu.pageUrl AS pageUrl, |
||||
|
menu.remarks, |
||||
|
menu.isEnable |
||||
|
FROM sys_menu menu |
||||
|
LEFT JOIN sys_source source ON menu.sourceSid = source.sid |
||||
|
WHERE source.sid = #{sourceSid} AND menu.psid='0' and menu.isDelete!=1 |
||||
|
ORDER BY menu.sortNo ASC |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,66 @@ |
|||||
|
package com.yxt.user.biz.sysmenu; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysMenuQuery.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysmenu.SysMenuQuery <br/> |
||||
|
* Description: 菜单表 查询条件. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "菜单表 查询条件", description = "菜单表 查询条件") |
||||
|
@Data |
||||
|
public class SysMenuQuery implements Query { |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("菜单名称") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("菜单路由路径(VUE)") |
||||
|
private String menuUrl; |
||||
|
|
||||
|
@ApiModelProperty("菜单对应的前端页面路径") |
||||
|
private String pageUrl; |
||||
|
|
||||
|
@ApiModelProperty("菜单图标地址") |
||||
|
private String iconUrl; |
||||
|
|
||||
|
@ApiModelProperty("资源sid") |
||||
|
private String sourceSid; |
||||
|
@ApiModelProperty("用户sid") |
||||
|
private String userSid; |
||||
|
@ApiModelProperty("角色sid") |
||||
|
private String roleSid; |
||||
|
|
||||
|
@ApiModelProperty("是否显示,默认为1显示,0为不显示") |
||||
|
private String isShow; |
||||
|
|
||||
|
@ApiModelProperty("排序号") |
||||
|
private Integer sortNo; |
||||
|
|
||||
|
@ApiModelProperty("上级sid") |
||||
|
private String pSid; |
||||
|
|
||||
|
@ApiModelProperty("前端页面路径重定向") |
||||
|
private Integer pageUrlRedirect; |
||||
|
|
||||
|
@ApiModelProperty("前端页面名称(vue组件名)") |
||||
|
private String pageName; |
||||
|
|
||||
|
@ApiModelProperty("前端页面别名") |
||||
|
private String pageAliasName; |
||||
|
|
||||
|
@ApiModelProperty("菜单类型(0左侧当行菜单,1页面中功能)") |
||||
|
private String menuType; |
||||
|
} |
@ -0,0 +1,424 @@ |
|||||
|
package com.yxt.user.biz.sysmenu; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.yxt.user.biz.sysmenu.*; |
||||
|
import com.yxt.user.biz.syssource.SysSourceService; |
||||
|
import com.yxt.common.base.service.MybatisBaseService; |
||||
|
import com.yxt.common.base.utils.PagerUtil; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.HashMap; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysMenuService.java <br/> |
||||
|
* Class: com.yxt.user.biz.sysmenu.SysMenuService <br/> |
||||
|
* Description: 菜单表 业务逻辑. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class SysMenuService extends MybatisBaseService<SysMenuMapper, SysMenu> { |
||||
|
// @Autowired
|
||||
|
// private SysSourceMenuService sysSourceMenuService;
|
||||
|
@Autowired |
||||
|
private SysMenuService sysMenuService; |
||||
|
@Autowired |
||||
|
private SysSourceService sysSourceService; |
||||
|
|
||||
|
public PagerVo<SysMenu> listPage(PagerQuery<SysMenuQuery> pq) { |
||||
|
SysMenuQuery query = pq.getParams(); |
||||
|
QueryWrapper<SysMenu> qw = createQueryWrapper(query); |
||||
|
IPage<SysMenu> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<SysMenu> pagging = baseMapper.selectPage(page, qw); |
||||
|
PagerVo<SysMenu> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public SysMenu fetchBySid(String sid) { |
||||
|
return baseMapper.fetchBySid(sid); |
||||
|
} |
||||
|
|
||||
|
public List<SysMenu> listAll(SysMenuQuery query) { |
||||
|
QueryWrapper<SysMenu> qw = createQueryWrapper(query); |
||||
|
return baseMapper.selectList(qw); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<SysMenu> createQueryWrapper(SysMenuQuery query) { |
||||
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
||||
|
QueryWrapper<SysMenu> qw = new QueryWrapper<>(); |
||||
|
if (StringUtils.isNotBlank(query.getName())) { |
||||
|
qw.eq("name", query.getName()); |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(query.getMenuUrl())) { |
||||
|
qw.eq("menuUrl", query.getMenuUrl()); |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(query.getPageUrl())) { |
||||
|
qw.eq("pageUrl", query.getPageUrl()); |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(query.getIconUrl())) { |
||||
|
qw.eq("iconUrl", query.getIconUrl()); |
||||
|
} |
||||
|
if (query.getSourceSid() != null) { |
||||
|
qw.eq("sourceSid", query.getSourceSid()); |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(query.getIsShow())) { |
||||
|
qw.eq("isShow", query.getIsShow()); |
||||
|
} |
||||
|
|
||||
|
if (query.getSortNo() != null) { |
||||
|
qw.eq("sortNo", query.getSortNo()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getPSid())) { |
||||
|
qw.eq("pSid", query.getPSid()); |
||||
|
} |
||||
|
|
||||
|
if (query.getPageUrlRedirect() != null) { |
||||
|
qw.eq("pageUrlRedirect", query.getPageUrlRedirect()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getPageName())) { |
||||
|
qw.eq("pageName", query.getPageName()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getPageAliasName())) { |
||||
|
qw.eq("pageAliasName", query.getPageAliasName()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getMenuType())) { |
||||
|
qw.eq("menuType", query.getMenuType()); |
||||
|
} |
||||
|
return qw; |
||||
|
} |
||||
|
|
||||
|
public PagerVo<SysMenuVo> listPageVo(PagerQuery<SysMenuQuery> pq) { |
||||
|
SysMenuQuery query = pq.getParams(); |
||||
|
QueryWrapper<SysMenu> qw = createQueryWrapper(query); |
||||
|
IPage<SysMenu> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<SysMenuVo> pagging = baseMapper.selectPageVo(page, qw); |
||||
|
PagerVo<SysMenuVo> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
|
||||
|
/* public List<SysMenuVo> listAllVo(SysMenuQuery query) { |
||||
|
QueryWrapper<SysMenu> qw = new QueryWrapper<>(); |
||||
|
qw.eq("menu.pSid", "0"); |
||||
|
List<SysMenuVo> sysMenuVos = baseMapper.selectListAllVo(qw); |
||||
|
for(SysMenuVo s:sysMenuVos){ |
||||
|
getChildrens(s); |
||||
|
} |
||||
|
return sysMenuVos; |
||||
|
}*/ |
||||
|
public List<SysMenuTreeVo> listAllVoForSource(SysMenuQuery query) { |
||||
|
//查询所有的资源列表
|
||||
|
List<SysMenuTreeVo> sysSourceVos = sysSourceService.listMenuTreeVo(); |
||||
|
for (SysMenuTreeVo s : sysSourceVos) { |
||||
|
//根据资源sid查询该资源下的所有一级菜单
|
||||
|
//List<SysMenuTreeVo> sysMenuVoList = sysSourceMenuService.fetchRootMenuBySourceSid(s.getSourceSid());
|
||||
|
List<SysMenuTreeVo> sysMenuVoList = sysMenuService.fetchRootMenuBySourceSid(s.getSourceSid()); |
||||
|
s.setChildren(sysMenuVoList); |
||||
|
s.setIsSource("1"); |
||||
|
//判断该资源下的菜单是否有可用的状态
|
||||
|
int isEnable = 1; |
||||
|
int count = baseMapper.selectBySourceSid(isEnable, s.getSourceSid()); |
||||
|
if (count == 0) { |
||||
|
s.setIsEnable("0"); |
||||
|
} else { |
||||
|
s.setIsEnable("1"); |
||||
|
} |
||||
|
if (!sysMenuVoList.isEmpty()) { |
||||
|
// sysMenuVoList = getChildrensForMenuTree(sysMenuVoList);
|
||||
|
getChildList(sysMenuVoList); |
||||
|
} |
||||
|
} |
||||
|
return sysSourceVos; |
||||
|
} |
||||
|
|
||||
|
public void getChildList(List<SysMenuTreeVo> list) { |
||||
|
list.forEach(str -> { |
||||
|
String sid = str.getSid(); |
||||
|
List<SysMenuTreeVo> listChildren = baseMapper.selectChildernList(sid); |
||||
|
str.setChildren(listChildren); |
||||
|
getChildList(listChildren); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/*暂时废弃*/ |
||||
|
/*private List<SysMenuTreeVo> getChildrensForMenuTree(List<SysMenuTreeVo> sysMenuVoList) { |
||||
|
List<SysMenuTreeVo> list = new ArrayList<>(); |
||||
|
for (SysMenuTreeVo s : sysMenuVoList) { |
||||
|
SysMenu sysMenu = sysMenuService.fetchBySid(s.getMenuRootSid()); |
||||
|
SysMenuTreeVo sysMenuTreeVo = new SysMenuTreeVo(); |
||||
|
BeanUtil.copyProperties(sysMenu, sysMenuTreeVo); |
||||
|
list.add(sysMenuTreeVo); |
||||
|
} |
||||
|
for (SysMenuTreeVo s : list) { |
||||
|
getChildrensForMenuTree(s, s.getSid()); |
||||
|
} |
||||
|
return list; |
||||
|
} |
||||
|
private void getChildrensForMenuTree(SysMenuTreeVo s,String sid){ |
||||
|
QueryWrapper<SysMenuTreeVo> qw = new QueryWrapper<>(); |
||||
|
if (StringUtils.isNotBlank(sid)) { |
||||
|
qw.eq("menu.pSid", sid); |
||||
|
} |
||||
|
List<SysMenuTreeVo> sysMenuVos = baseMapper.getChildrensForMenuTree(qw); |
||||
|
if(!sysMenuVos.isEmpty()){ |
||||
|
for(SysMenuTreeVo smv:sysMenuVos){ |
||||
|
getChildrensForMenuTree(smv,smv.getSid()); |
||||
|
} |
||||
|
} |
||||
|
s.setChildren(sysMenuVos); |
||||
|
} |
||||
|
private void getChildrens(SysMenuVo s){ |
||||
|
String sid = s.getSid(); |
||||
|
QueryWrapper<SysMenu> qw = new QueryWrapper<>(); |
||||
|
if (StringUtils.isNotBlank(sid)) { |
||||
|
qw.eq("menu.pSid", sid); |
||||
|
} |
||||
|
List<SysMenuVo> sysMenuVos = baseMapper.selectListAllVo(qw); |
||||
|
if(!sysMenuVos.isEmpty()){ |
||||
|
for(SysMenuVo smv:sysMenuVos){ |
||||
|
getChildrens(smv); |
||||
|
} |
||||
|
} |
||||
|
s.setChildren(sysMenuVos); |
||||
|
}*/ |
||||
|
public List<SysMenuVo> listVo() { |
||||
|
return baseMapper.selectListVo(); |
||||
|
} |
||||
|
|
||||
|
/* public void saveOrUpdateDto(SysMenuDto dto) { |
||||
|
SysMenu entity = new SysMenu(); |
||||
|
dto.fillEntity(entity); |
||||
|
SysSourceMenu sysSourceMenu = new SysSourceMenu(); |
||||
|
sysSourceMenu.setMenuSid(entity.getSid()); |
||||
|
sysSourceMenu.setSourceSid(dto.getSourceSid()); |
||||
|
setRootSid(entity, sysSourceMenu); |
||||
|
sysSourceMenuService.save(sysSourceMenu); |
||||
|
this.saveOrUpdate(entity); |
||||
|
}*/ |
||||
|
|
||||
|
// private void setRootSid(SysMenu entity, SysSourceMenu sysSourceMenu) {
|
||||
|
// String pSid = entity.getPSid();
|
||||
|
// if ("0".equals(pSid)) {
|
||||
|
// sysSourceMenu.setMenuRootSid(entity.getSid());
|
||||
|
// } else {
|
||||
|
// SysMenu sysMenu = sysMenuService.fetchBySid(pSid);
|
||||
|
// String pSid1 = sysMenu.getPSid();
|
||||
|
// if ("0".equals(pSid1)) {
|
||||
|
// sysSourceMenu.setMenuRootSid(sysMenu.getSid());
|
||||
|
// }
|
||||
|
// setRootSid(sysMenu, sysSourceMenu);
|
||||
|
// }
|
||||
|
// }
|
||||
|
|
||||
|
public SysMenuVo fetchByIdVo(String id) { |
||||
|
SysMenu entity = this.fetchById(id); |
||||
|
SysMenuVo vo = new SysMenuVo(); |
||||
|
BeanUtil.copyProperties(entity, vo); |
||||
|
return vo; |
||||
|
} |
||||
|
|
||||
|
public List<SysMenuVo> listAllByRoleSid(SysMenuQuery query) { |
||||
|
|
||||
|
List<SysMenuVo> sysMenuVos = baseMapper.listAllParentByRoleSid(query.getRoleSid(), "0", query.getSourceSid()); |
||||
|
for (SysMenuVo s : sysMenuVos) { |
||||
|
getChildrensByRoleSid(s, query.getRoleSid(), query.getSourceSid()); |
||||
|
} |
||||
|
return sysMenuVos; |
||||
|
} |
||||
|
|
||||
|
private void getChildrensByRoleSid(SysMenuVo s, String roleSid, String sourceSid) { |
||||
|
String sid = s.getSid(); |
||||
|
List<SysMenuVo> sysMenuVos = baseMapper.listAllParentByRoleSid(roleSid, sid, sourceSid); |
||||
|
if (!sysMenuVos.isEmpty()) { |
||||
|
for (SysMenuVo smv : sysMenuVos) { |
||||
|
getChildrensByRoleSid(smv, roleSid, sourceSid); |
||||
|
} |
||||
|
} |
||||
|
s.setChildren(sysMenuVos); |
||||
|
} |
||||
|
|
||||
|
/*public List<SysMenuTreeVo> listAllVoBySourceSId(SysMenuQuery query) { |
||||
|
SysSource sysSource = sysSourceService.fetchBySid(query.getSourceSid()); |
||||
|
List<SysMenuTreeVo> sysSourceVos = new ArrayList<>();//sysSourceService.listAllVoBySourceSId(query.getSourceSid());
|
||||
|
SysMenuTreeVo smtv=new SysMenuTreeVo(); |
||||
|
smtv.setName(sysSource.getSourceName()); |
||||
|
smtv.setSid(sysSource.getSid()); |
||||
|
smtv.setSourceSid(sysSource.getSid()); |
||||
|
sysSourceVos.add(smtv); |
||||
|
for(SysMenuTreeVo s:sysSourceVos){ |
||||
|
List<SysMenuTreeVo> sysMenuVoList=sysSourceMenuService.fetchRootMenuBySourceSid(s.getSourceSid()); |
||||
|
if(!sysMenuVoList.isEmpty()){ |
||||
|
sysMenuVoList = getChildrensForMenuTree(sysMenuVoList); |
||||
|
} |
||||
|
s.setChildren(sysMenuVoList); |
||||
|
} |
||||
|
return sysSourceVos; |
||||
|
}*/ |
||||
|
|
||||
|
/** |
||||
|
* 资源菜单树形列表 |
||||
|
* |
||||
|
* @return 资源菜单树形列表(第一级一级菜单 第二级二级菜单) |
||||
|
*/ |
||||
|
// public List<Map<String, Object>> getSourceMenuTree(List<SysMenuRoleVo> list_menu, Map<String, Object> map_selectMenus) {
|
||||
|
//
|
||||
|
// //获取当前资源的菜单列表
|
||||
|
// List<Map<String, Object>> list_menus_map = new ArrayList<Map<String, Object>>();
|
||||
|
//
|
||||
|
//
|
||||
|
// //获取资源第一级菜单列表
|
||||
|
// List<SysMenuRoleVo> list_firstLevel_menu = list_menu.stream().filter(s -> s.getPSid().equals("0")).collect(Collectors.toList());
|
||||
|
//
|
||||
|
// //遍历资源的第一级菜单
|
||||
|
// for (int i = 0; i < list_firstLevel_menu.size(); i++) {
|
||||
|
// Map<String, Object> map_firstLevel_menu = getMenuTreeFromStream(list_firstLevel_menu.get(i).getSid(), list_menu, map_selectMenus);
|
||||
|
// //把该菜单挂在当前菜单列表中
|
||||
|
// if (null != map_firstLevel_menu)
|
||||
|
// list_menus_map.add(map_firstLevel_menu);
|
||||
|
// }
|
||||
|
// return list_menus_map;
|
||||
|
//
|
||||
|
// }
|
||||
|
|
||||
|
/** |
||||
|
* 递归把list转换成菜单树形列表 |
||||
|
* |
||||
|
* @param psid |
||||
|
* @param list_menu |
||||
|
* @return |
||||
|
*/ |
||||
|
// private Map<String, Object> getMenuTreeFromStream(String psid, List<SysMenuRoleVo> list_menu, Map<String, Object> map_selectMenus) {
|
||||
|
// //获取当前菜单
|
||||
|
// List<SysMenuRoleVo> list_current_menu = list_menu.stream().filter(s -> s.getSid().equals(psid)).collect(Collectors.toList());
|
||||
|
// if (null == list_current_menu || 0 == list_current_menu.size())
|
||||
|
// return null;
|
||||
|
//
|
||||
|
// Map<String, Object> map_menu = getMenuMap(list_current_menu.get(0), map_selectMenus);
|
||||
|
//
|
||||
|
// //2.获取菜单的子菜单列表
|
||||
|
// //存储最终子菜单列表结果
|
||||
|
// List<Map<String, Object>> list_child = new ArrayList<Map<String, Object>>();
|
||||
|
//
|
||||
|
// //获取子菜单列表
|
||||
|
// List<SysMenuRoleVo> list_child_menu = list_menu.stream().filter(s -> s.getPSid().equals(psid)).collect(Collectors.toList());
|
||||
|
// for (int i = 0; i < list_child_menu.size(); i++) {
|
||||
|
// //获取该菜单子菜单列表
|
||||
|
// Map<String, Object> map_child_menu = getMenuTreeFromStream(list_child_menu.get(i).getSid(), list_menu, map_selectMenus);
|
||||
|
// //把该菜单挂在当前菜单列表中
|
||||
|
// if (null != map_child_menu)
|
||||
|
// list_child.add(map_child_menu);
|
||||
|
// }
|
||||
|
// //把该菜单列表放到父菜单的childMenus中
|
||||
|
// map_menu.put("children", list_child);
|
||||
|
//
|
||||
|
// return map_menu;
|
||||
|
//
|
||||
|
// }
|
||||
|
|
||||
|
/** |
||||
|
* 构造菜单的结果map |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
// private Map<String, Object> getMenuMap(SysMenuRoleVo menuVo, Map<String, Object> map_selectMenus) {
|
||||
|
// Map<String, Object> map_menu = new HashMap<String, Object>();
|
||||
|
//
|
||||
|
// if (null != map_selectMenus) {
|
||||
|
// //角色授权时,菜单列表
|
||||
|
// map_menu.put("sid", menuVo.getSid());
|
||||
|
// map_menu.put("menuName", menuVo.getMenuName() + (StringUtils.isNotBlank(menuVo.getRemarks()) ? "(" + menuVo.getRemarks() + ")" : ""));
|
||||
|
// map_menu.put("menuUrl", menuVo.getMenuUrl());
|
||||
|
// map_menu.put("pageUrl", menuVo.getPageUrl());
|
||||
|
// map_menu.put("iconUrl", menuVo.getIconUrl());
|
||||
|
// map_menu.put("isShow", menuVo.getIsShow());
|
||||
|
// if (menuVo.getAlwaysShow() == 0) {
|
||||
|
// map_menu.put("alwaysShow", false);
|
||||
|
// } else if (menuVo.getAlwaysShow() == 1) {
|
||||
|
// map_menu.put("alwaysShow", true);
|
||||
|
// }
|
||||
|
//
|
||||
|
// //如果角色已有的菜单,则设置选中,并移除map中的项;否则设置不选中
|
||||
|
// if (map_selectMenus.containsKey(menuVo.getSid())) {
|
||||
|
// map_menu.put("isCheck", 1);
|
||||
|
// map_selectMenus.remove(menuVo.getSid());
|
||||
|
// } else {
|
||||
|
// map_menu.put("isCheck", 0);
|
||||
|
// }
|
||||
|
// } else {
|
||||
|
// //左侧菜单列表
|
||||
|
// Map<String, Object> map_meta = new HashMap<String, Object>();
|
||||
|
// map_meta.put("title", menuVo.getMenuName());
|
||||
|
// map_meta.put("icon", menuVo.getIconUrl());
|
||||
|
// map_menu.put("meta", map_meta);
|
||||
|
//
|
||||
|
// map_menu.put("redirect", menuVo.getPageUrlRedirect());
|
||||
|
// //路径
|
||||
|
// map_menu.put("path", menuVo.getPageUrl() != null && !menuVo.getPageUrl().equals("") ? menuVo.getPageUrl() : "/" + menuVo.getPageName());
|
||||
|
// map_menu.put("name", menuVo.getPageAliasName() != null && !menuVo.getPageAliasName().equals("") ? menuVo.getPageAliasName() : menuVo.getPageUrl());
|
||||
|
// //组件名
|
||||
|
// map_menu.put("component", menuVo.getPageName());
|
||||
|
// if (menuVo.getAlwaysShow() == 0) {
|
||||
|
// map_menu.put("alwaysShow", false);
|
||||
|
// } else if (menuVo.getAlwaysShow() == 1) {
|
||||
|
// map_menu.put("alwaysShow", true);
|
||||
|
// }
|
||||
|
// }
|
||||
|
// return map_menu;
|
||||
|
// }
|
||||
|
|
||||
|
/** |
||||
|
* 将该资源下的所有菜单设置为是否可用 |
||||
|
* |
||||
|
* @param sid 资源sid |
||||
|
* @param isEnable 是否可用:1可用,0不可用 |
||||
|
* @return |
||||
|
*/ |
||||
|
public int updateBySourceSid(String sid, Integer isEnable) { |
||||
|
return baseMapper.updateBySourceSid(sid, isEnable); |
||||
|
} |
||||
|
|
||||
|
public void saveMenu(SysMenuDto dto) { |
||||
|
SysMenu entity = new SysMenu(); |
||||
|
dto.fillEntity(entity); |
||||
|
// SysSourceMenu sysSourceMenu = new SysSourceMenu();
|
||||
|
// sysSourceMenu.setMenuSid(entity.getSid());
|
||||
|
// sysSourceMenu.setSourceSid(dto.getSourceSid());
|
||||
|
// setRootSid(entity, sysSourceMenu);
|
||||
|
// sysSourceMenuService.save(sysSourceMenu);
|
||||
|
save(entity); |
||||
|
} |
||||
|
|
||||
|
public List<SysMenu> selectByMenuUrl(String menuUrl) { |
||||
|
return baseMapper.selectByMenuUrl(menuUrl); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据资源sid查询该资源下的一级菜单列表(yxt_mtl 2024-01-31) |
||||
|
* |
||||
|
* @param sid 资源sid |
||||
|
* @return |
||||
|
*/ |
||||
|
public List<SysMenuTreeVo> fetchRootMenuBySourceSid(String sid) { |
||||
|
return baseMapper.fetchRootMenuBySourceSid(sid); |
||||
|
} |
||||
|
} |
@ -0,0 +1,59 @@ |
|||||
|
package com.yxt.user.biz.sysmenu; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysMenuVo.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysmenu.SysMenuVo <br/> |
||||
|
* Description: 菜单表 视图数据对象. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "菜单表 视图数据对象", description = "菜单表 视图数据对象") |
||||
|
@Data |
||||
|
public class SysMenuTreeVo implements Vo { |
||||
|
@ApiModelProperty("菜单名称") |
||||
|
private String name; |
||||
|
@ApiModelProperty("资源sid") |
||||
|
private String sourceSid; |
||||
|
@ApiModelProperty("排序号") |
||||
|
private Integer sortNo; |
||||
|
@ApiModelProperty("上级sid") |
||||
|
private String pSid; |
||||
|
@ApiModelProperty("上级菜单名称") |
||||
|
private String pName; |
||||
|
@ApiModelProperty("sid") |
||||
|
private String sid; |
||||
|
@ApiModelProperty("资源名称") |
||||
|
private String sourceName; |
||||
|
@ApiModelProperty("菜单根路径sid") |
||||
|
private String menuRootSid; |
||||
|
@ApiModelProperty("pageUrl") |
||||
|
private String pageUrl; |
||||
|
@ApiModelProperty("menuUrl") |
||||
|
private String menuUrl; |
||||
|
@ApiModelProperty("menuUrl") |
||||
|
private String pageName; |
||||
|
@ApiModelProperty("iconUrl") |
||||
|
private String iconUrl; |
||||
|
@ApiModelProperty("菜单列表用,是否是资源层级1是,0不是") |
||||
|
private String isSource = "0"; |
||||
|
@ApiModelProperty("是否可用") |
||||
|
private String isEnable; |
||||
|
@ApiModelProperty(value = "备注") |
||||
|
private String remarks; |
||||
|
@ApiModelProperty("子菜单") |
||||
|
private List<SysMenuTreeVo> children; |
||||
|
} |
@ -0,0 +1,74 @@ |
|||||
|
package com.yxt.user.biz.sysmenu; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysMenuVo.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysmenu.SysMenuVo <br/> |
||||
|
* Description: 菜单表 视图数据对象. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "菜单表 视图数据对象", description = "菜单表 视图数据对象") |
||||
|
@Data |
||||
|
public class SysMenuVo implements Vo { |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("菜单名称") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("菜单路由路径(VUE)") |
||||
|
private String menuUrl; |
||||
|
|
||||
|
@ApiModelProperty("菜单对应的前端页面路径") |
||||
|
private String pageUrl; |
||||
|
|
||||
|
@ApiModelProperty("菜单图标地址") |
||||
|
private String iconUrl; |
||||
|
|
||||
|
@ApiModelProperty("资源sid") |
||||
|
private String sourceSid; |
||||
|
|
||||
|
@ApiModelProperty("是否显示,默认为1显示,0为不显示") |
||||
|
private String isShow; |
||||
|
|
||||
|
@ApiModelProperty("排序号") |
||||
|
private Integer sortNo; |
||||
|
|
||||
|
@ApiModelProperty("上级sid") |
||||
|
private String pSid; |
||||
|
@ApiModelProperty("上级名称") |
||||
|
private String pName; |
||||
|
@ApiModelProperty("sid") |
||||
|
private String sid; |
||||
|
|
||||
|
@ApiModelProperty("前端页面路径重定向") |
||||
|
private Integer pageUrlRedirect; |
||||
|
|
||||
|
@ApiModelProperty("前端页面名称(vue组件名)") |
||||
|
private String pageName; |
||||
|
|
||||
|
@ApiModelProperty("前端页面别名") |
||||
|
private String pageAliasName; |
||||
|
|
||||
|
@ApiModelProperty("菜单类型(0左侧当行菜单,1页面中功能)") |
||||
|
private String menuType; |
||||
|
@ApiModelProperty("子菜单") |
||||
|
private List<SysMenuVo> children; |
||||
|
@ApiModelProperty("是否选中,1:未选中,0:选中") |
||||
|
private String checked; |
||||
|
@ApiModelProperty("资源名称") |
||||
|
private String sourceName; |
||||
|
} |
@ -0,0 +1,40 @@ |
|||||
|
package com.yxt.user.biz.sysorganization; |
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author liuguohui |
||||
|
* @Date 2021/9/24 |
||||
|
*/ |
||||
|
@ApiModel(value = "App通讯录组织架构") |
||||
|
@Data |
||||
|
public class AppContactSysOrganizationVo implements Vo { |
||||
|
|
||||
|
@ApiModelProperty("部门/组织sid") |
||||
|
private String sid; |
||||
|
|
||||
|
@ApiModelProperty("部门/组织名称|员工姓名") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("员工数量") |
||||
|
private int staffNum; |
||||
|
|
||||
|
@ApiModelProperty("跳转类型:1、部门2、员工列表") |
||||
|
private Integer type; |
||||
|
|
||||
|
@ApiModelProperty("员工电话") |
||||
|
private String mobile; |
||||
|
|
||||
|
@ApiModelProperty("员工头像") |
||||
|
private String headImage; |
||||
|
|
||||
|
@ApiModelProperty("员工所在部门名称(路径)") |
||||
|
private String orgNamePath; |
||||
|
|
||||
|
@ApiModelProperty("员工职位") |
||||
|
private String position; |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
package com.yxt.user.biz.sysorganization; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author dimengzhe |
||||
|
* @date 2020/11/3 16:19 |
||||
|
* @description |
||||
|
*/ |
||||
|
@Data |
||||
|
public class QrCodeVo { |
||||
|
@ApiModelProperty("部门名称") |
||||
|
private String departmentName; |
||||
|
@ApiModelProperty("单位名称") |
||||
|
private String organizationName; |
||||
|
@ApiModelProperty("部门地址") |
||||
|
private String address; |
||||
|
@ApiModelProperty("二维码图片地址") |
||||
|
private String qrFilePath; |
||||
|
@ApiModelProperty(value = "部门sid") |
||||
|
private String sid; |
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
package com.yxt.user.biz.sysorganization; |
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/2/14 11:45 |
||||
|
* @Description 员工所在部门下拉列表 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class SysOrgListVo implements Vo { |
||||
|
private static final long serialVersionUID = -3558876605554852892L; |
||||
|
|
||||
|
@ApiModelProperty(value = "组织名称") |
||||
|
private String name; |
||||
|
@ApiModelProperty(value = "部门编码") |
||||
|
private String orgCode; |
||||
|
@ApiModelProperty(value = "sid") |
||||
|
private String sid; |
||||
|
@ApiModelProperty(value = "上级sid") |
||||
|
private String psid; |
||||
|
@ApiModelProperty(value = "orgSidPath") |
||||
|
private String orgSidPath; |
||||
|
private List<SysOrgVo> children; |
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
package com.yxt.user.biz.sysorganization; |
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/9/26 11:48 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Data |
||||
|
public class SysOrgStaffVo implements Vo { |
||||
|
private static final long serialVersionUID = -4311553944345419092L; |
||||
|
|
||||
|
private String staffName; |
||||
|
private String staffSid; |
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
package com.yxt.user.biz.sysorganization; |
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author dimengzhe |
||||
|
* @date 2021/10/12 20:55 |
||||
|
* @description |
||||
|
*/ |
||||
|
@Data |
||||
|
public class SysOrgVo implements Vo { |
||||
|
private static final long serialVersionUID = 2983637708030419942L; |
||||
|
@ApiModelProperty(value = "组织名称") |
||||
|
private String name; |
||||
|
@ApiModelProperty(value = "sid") |
||||
|
private String sid; |
||||
|
@ApiModelProperty(value = "psid") |
||||
|
private String psid; |
||||
|
@ApiModelProperty(value = "id") |
||||
|
private String id; |
||||
|
@ApiModelProperty(value = "orgSidPath") |
||||
|
private String orgSidPath; |
||||
|
@ApiModelProperty(value = "部门编码") |
||||
|
private String orgCode; |
||||
|
|
||||
|
private List<SysOrgVo> children; |
||||
|
} |
@ -0,0 +1,87 @@ |
|||||
|
package com.yxt.user.biz.sysorganization; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.yxt.common.core.domain.BaseEntity; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysOrganization.java <br/> |
||||
|
* Class: SysOrganization <br/> |
||||
|
* Description: 组织机构表. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "组织机构表", description = "组织机构表") |
||||
|
@TableName("sys_organization") |
||||
|
@Data |
||||
|
public class SysOrganization extends BaseEntity { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("部门/组织名称") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("父(部门/组织) sid") |
||||
|
private String psid; |
||||
|
|
||||
|
@ApiModelProperty("联系电话") |
||||
|
private String linkPhone; |
||||
|
@ApiModelProperty("联系人") |
||||
|
private String linkPerson; |
||||
|
|
||||
|
@ApiModelProperty("部门sid全路径") |
||||
|
private String orgSidPath; |
||||
|
|
||||
|
@ApiModelProperty("排序") |
||||
|
private Integer sort; |
||||
|
|
||||
|
@ApiModelProperty("地址") |
||||
|
private String addrs; |
||||
|
|
||||
|
@ApiModelProperty("地理位置经纬度") |
||||
|
private String jwd; |
||||
|
|
||||
|
@ApiModelProperty("二维码") |
||||
|
private String qrText; |
||||
|
|
||||
|
@ApiModelProperty("限制本部门成员查看通讯录:限制开启后,本部门成员只能看到限定范围内的通讯录不能看到所有通讯录,仅可见自己") |
||||
|
private Integer limitOrgMember; |
||||
|
|
||||
|
@ApiModelProperty("部门编码") |
||||
|
private String orgCode; |
||||
|
|
||||
|
@ApiModelProperty("部门简称(地区简称+门店名称首字母(遇到首字母重复时用2个字母))") |
||||
|
private String orgShortName; |
||||
|
|
||||
|
@ApiModelProperty("销售区域划分(本店终端销售:0,门店对应业务区域划分销售:1至9,具体编号划分各门店报备确定)") |
||||
|
private String regionDivision; |
||||
|
|
||||
|
@ApiModelProperty("是否是部门(0否,1是)") |
||||
|
private Integer isDept; |
||||
|
|
||||
|
@ApiModelProperty("组织简称") |
||||
|
private String orgAbbre; |
||||
|
|
||||
|
@ApiModelProperty("组织属性key") |
||||
|
private String orgAttributeKey; |
||||
|
|
||||
|
@ApiModelProperty("组织属性value") |
||||
|
private String orgAttributeValue; |
||||
|
|
||||
|
@ApiModelProperty("管理层级key") |
||||
|
private String orgLevelKey; |
||||
|
|
||||
|
@ApiModelProperty("管理层级value") |
||||
|
private String orgLevelValue; |
||||
|
|
||||
|
@ApiModelProperty("其他编码") |
||||
|
private String otherCode; |
||||
|
} |
@ -0,0 +1,91 @@ |
|||||
|
package com.yxt.user.biz.sysorganization; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.dto.Dto; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysOrganizationDto.java <br/> |
||||
|
* Class: SysOrganizationDto <br/> |
||||
|
* Description: 组织机构表 数据传输对象. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "组织机构表 数据传输对象", description = "组织机构表 数据传输对象") |
||||
|
@Data |
||||
|
public class SysOrganizationDto implements Dto { |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("部门/组织名称") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("父(部门/组织) sid") |
||||
|
private String psid; |
||||
|
|
||||
|
@ApiModelProperty("联系电话") |
||||
|
private String linkPhone; |
||||
|
@ApiModelProperty("联系人") |
||||
|
private String linkPerson; |
||||
|
|
||||
|
@ApiModelProperty("部门sid全路径") |
||||
|
private String orgSidPath; |
||||
|
|
||||
|
@ApiModelProperty("排序") |
||||
|
private Integer sort; |
||||
|
|
||||
|
@ApiModelProperty("地址") |
||||
|
private String addrs; |
||||
|
|
||||
|
@ApiModelProperty("地理位置经纬度") |
||||
|
private String jwd; |
||||
|
|
||||
|
@ApiModelProperty("二维码") |
||||
|
private String qrText; |
||||
|
|
||||
|
@ApiModelProperty("限制本部门成员查看通讯录:限制开启后,本部门成员只能看到限定范围内的通讯录不能看到所有通讯录,仅可见自己") |
||||
|
private Integer limitOrgMember; |
||||
|
|
||||
|
@ApiModelProperty("部门编码") |
||||
|
private String orgCode; |
||||
|
|
||||
|
@ApiModelProperty("部门简称(地区简称+门店名称首字母(遇到首字母重复时用2个字母))") |
||||
|
private String orgShortName; |
||||
|
|
||||
|
@ApiModelProperty("销售区域划分(本店终端销售:0,门店对应业务区域划分销售:1至9,具体编号划分各门店报备确定)") |
||||
|
private String regionDivision; |
||||
|
|
||||
|
@ApiModelProperty("主管人员sid") |
||||
|
private String zgStaffSid; |
||||
|
|
||||
|
@ApiModelProperty("分管人员sid") |
||||
|
private String fgStaffSid; |
||||
|
|
||||
|
@ApiModelProperty("组织简称") |
||||
|
private String orgAbbre; |
||||
|
|
||||
|
@ApiModelProperty("是否是部门(0否,1是)") |
||||
|
private Integer isDept; |
||||
|
|
||||
|
@ApiModelProperty("组织属性key") |
||||
|
private String orgAttributeKey; |
||||
|
|
||||
|
@ApiModelProperty("组织属性value") |
||||
|
private String orgAttributeValue; |
||||
|
|
||||
|
@ApiModelProperty("管理层级key") |
||||
|
private String orgLevelKey; |
||||
|
|
||||
|
@ApiModelProperty("管理层级value") |
||||
|
private String orgLevelValue; |
||||
|
|
||||
|
@ApiModelProperty("其他编码") |
||||
|
private String otherCode; |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
package com.yxt.user.biz.sysorganization; |
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/9/26 11:49 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Data |
||||
|
public class SysOrganizationListQuery implements Query { |
||||
|
private static final long serialVersionUID = 8657016527420117948L; |
||||
|
|
||||
|
private String userSid; |
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
package com.yxt.user.biz.sysorganization; |
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/9/26 11:42 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Data |
||||
|
public class SysOrganizationListVo implements Vo { |
||||
|
private static final long serialVersionUID = -3709239161608411765L; |
||||
|
|
||||
|
private String orgDeptSid; |
||||
|
private String orgDeptName; |
||||
|
|
||||
|
private List<SysOrgStaffVo> staffinfoVoList; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
package com.yxt.user.biz.sysorganization; |
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/9/30 11:28 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Data |
||||
|
public class SysOrganizationListsVo implements Vo { |
||||
|
private static final long serialVersionUID = -7021974833444298712L; |
||||
|
|
||||
|
private String orgDeptSid; |
||||
|
private String orgDeptName; |
||||
|
} |
@ -0,0 +1,122 @@ |
|||||
|
package com.yxt.user.biz.sysorganization; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
|
import com.yxt.user.biz.sysstafforg.SysStaffOrgVo; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.apache.ibatis.annotations.Select; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysOrganizationMapper.java <br/> |
||||
|
* Class: SysOrganizationMapper <br/> |
||||
|
* Description: 组织机构表. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface SysOrganizationMapper extends BaseMapper<SysOrganization> { |
||||
|
|
||||
|
//@Update("update sys_organization set name=#{msg} where id=#{id}")
|
||||
|
//IPage<SysOrganizationVo> voPage(IPage<SysOrganization> page, @Param(Constants.WRAPPER) QueryWrapper<SysOrganization> qw);
|
||||
|
|
||||
|
IPage<SysOrganizationVo> selectPageVo(IPage<SysOrganization> page, @Param(Constants.WRAPPER) Wrapper<SysOrganization> qw); |
||||
|
|
||||
|
List<SysOrganizationVo> selectListAllVo(@Param(Constants.WRAPPER) Wrapper<SysOrganization> qw); |
||||
|
|
||||
|
List<SysOrganizationVo> selectFirstOrgList(); |
||||
|
|
||||
|
List<SysOrganizationVo> selectChildrenListByPsid(@Param("psid") String psid); |
||||
|
|
||||
|
@Select("SELECT * FROM sys_organization") |
||||
|
List<SysOrganizationVo> selectListVo(); |
||||
|
|
||||
|
@Select("SELECT name FROM sys_organization WHERE sid=#{sid}") |
||||
|
String selectOrgnameBySid(@Param("sid") String sid); |
||||
|
|
||||
|
String selectOrgSidPath(@Param("sid") String sid); |
||||
|
|
||||
|
List<AppContactSysOrganizationVo> selectAppOrganization(); |
||||
|
|
||||
|
List<AppContactSysOrganizationVo> selectAppOrganizationByPsid(@Param("psid") String psid); |
||||
|
|
||||
|
List<SysOrgVo> treeList(String psid); |
||||
|
|
||||
|
SysOrganization selectOrgCode(); |
||||
|
|
||||
|
List<SysOrgVo> getListOrg(); |
||||
|
|
||||
|
SysOrganization selectOrgCodeByPsid(); |
||||
|
|
||||
|
/** |
||||
|
* 根据上级sid查询组织的部门 |
||||
|
* |
||||
|
* @param psid 上级sid |
||||
|
* @return |
||||
|
*/ |
||||
|
List<SysOrgListVo> selectTreeList(String psid); |
||||
|
|
||||
|
/** |
||||
|
* 根据部门编码查询部门信息 |
||||
|
* |
||||
|
* @param substring 部门编码 |
||||
|
* @return |
||||
|
*/ |
||||
|
SysOrganization selectByOrgCode(String substring); |
||||
|
|
||||
|
List<SysOrganizationVo> selectChildernList(String sid); |
||||
|
|
||||
|
/** |
||||
|
* 根据业务员sid获取到分公司 |
||||
|
* |
||||
|
* @param staffSid 业务员sid |
||||
|
* @return |
||||
|
*/ |
||||
|
SysStaffOrgVo getUseOrgByUserSid(@Param("staffSid") String staffSid); |
||||
|
|
||||
|
/** |
||||
|
* 根据sid判断是否是分公司并获取公司名称 |
||||
|
* |
||||
|
* @param sid |
||||
|
* @return |
||||
|
*/ |
||||
|
SysOrganizationVo getUseOrgBySid(@Param("sid")String sid); |
||||
|
|
||||
|
int updateQrCodePath(@Param("sid") String sid, @Param("path") String path); |
||||
|
|
||||
|
QrCodeVo getQrCodeVo(@Param("sid") String sid); |
||||
|
|
||||
|
@Select("select * from sys_organization WHERE staffSid=#{sid}") |
||||
|
SysOrganizationVo getUseOrgByStaffSid(String sid); |
||||
|
|
||||
|
List<Map<String, String>> selectUseOrgSidBySid(String psid); |
||||
|
|
||||
|
SysOrgVo getListOrgByBrand(String sid); |
||||
|
|
||||
|
List<SysOrganizationListVo> selectOrgList(String orgSid); |
||||
|
List<SysOrganizationListsVo> selectOrgLists(String orgSid); |
||||
|
|
||||
|
List<SysOrgStaffVo> selectByOrgDeptSid(String orgDeptSid); |
||||
|
|
||||
|
SysOrganizationVo selectByPSid(@Param("sid") String sid, @Param("name") String name); |
||||
|
|
||||
|
List<SysOrganizationVo> selectOrgSidList(); |
||||
|
|
||||
|
@Select("select * from sys_organization where orgSidPath = #{orgSidPath}") |
||||
|
SysOrganizationVo selectByOrgSidPath(String orgSidPath); |
||||
|
|
||||
|
List<SysOrgVo> getListDeptByOrgSid(String orgSid); |
||||
|
|
||||
|
List<SysOrganizationVo> selectOrgByPSid(String psid); |
||||
|
} |
@ -0,0 +1,220 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.yxt.user.biz.sysorganization.SysOrganizationMapper"> |
||||
|
<!-- <where> ${ew.sqlSegment} </where>--> |
||||
|
<!-- ${ew.customSqlSegment} --> |
||||
|
<select id="selectPageVo" resultType="com.yxt.user.biz.sysorganization.SysOrganizationVo"> |
||||
|
SELECT so.*, |
||||
|
(SELECT GROUP_CONCAT(ss.name) |
||||
|
FROM `sys_staff_org` sso |
||||
|
LEFT JOIN `sys_staffinfo` ss ON sso.`staffSid` = ss.`sid` |
||||
|
WHERE so.`sid` = sso.`orgSid` |
||||
|
AND sso.manageType = '1') zgNames, |
||||
|
(SELECT GROUP_CONCAT(ss.sid) |
||||
|
FROM `sys_staff_org` sso |
||||
|
LEFT JOIN `sys_staffinfo` ss ON sso.`staffSid` = ss.`sid` |
||||
|
WHERE so.`sid` = sso.`orgSid` |
||||
|
AND sso.manageType = '1') zgSids, |
||||
|
(SELECT GROUP_CONCAT(ss.name) |
||||
|
FROM `sys_staff_org` sso |
||||
|
LEFT JOIN `sys_staffinfo` ss ON sso.`staffSid` = ss.`sid` |
||||
|
WHERE so.`sid` = sso.`orgSid` |
||||
|
AND sso.manageType = '2') fgNames, |
||||
|
(SELECT GROUP_CONCAT(ss.sid) |
||||
|
FROM `sys_staff_org` sso |
||||
|
LEFT JOIN `sys_staffinfo` ss ON sso.`staffSid` = ss.`sid` |
||||
|
WHERE so.`sid` = sso.`orgSid` |
||||
|
AND sso.manageType = '2') fgSids |
||||
|
FROM sys_organization so |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
GROUP BY so.`name` |
||||
|
ORDER BY so.sort |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectListAllVo" resultType="com.yxt.user.biz.sysorganization.SysOrganizationVo"> |
||||
|
SELECT * |
||||
|
FROM sys_organization |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectFirstOrgList" resultType="com.yxt.user.biz.sysorganization.SysOrganizationVo"> |
||||
|
SELECT sid, name, psid, orgCode |
||||
|
FROM sys_organization |
||||
|
WHERE psid = '0' |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectChildrenListByPsid" resultType="com.yxt.user.biz.sysorganization.SysOrganizationVo"> |
||||
|
SELECT sid, name, psid, orgCode |
||||
|
FROM sys_organization |
||||
|
WHERE psid = #{psid} |
||||
|
ORDER BY sort ASC |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectOrgSidPath" resultType="java.lang.String"> |
||||
|
SELECT orgSidPath |
||||
|
FROM sys_organization WHERE 1 = 1 |
||||
|
<choose> |
||||
|
<when test="sid != null and sid != ''"> |
||||
|
AND sid = #{sid,jdbcType=VARCHAR} |
||||
|
</when> |
||||
|
<otherwise> |
||||
|
AND psid = '0' |
||||
|
</otherwise> |
||||
|
</choose> |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectAppOrganization" |
||||
|
resultType="com.yxt.user.biz.sysorganization.AppContactSysOrganizationVo"> |
||||
|
SELECT sid, |
||||
|
name, |
||||
|
(SELECT count(1) FROM sys_staff_org WHERE orgSid = org.sid) staffNum, |
||||
|
IF((SELECT count(1) FROM sys_organization WHERE psid = org.sid) = 0, '2', '1') type |
||||
|
FROM sys_organization org |
||||
|
WHERE org.psid = (SELECT sid FROM sys_organization WHERE psid = '0') |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectAppOrganizationByPsid" |
||||
|
resultType="com.yxt.user.biz.sysorganization.AppContactSysOrganizationVo"> |
||||
|
SELECT org.sid, |
||||
|
org.name, |
||||
|
(SELECT count(1) FROM sys_staff_org WHERE orgSid = org.sid) staffNum, |
||||
|
IF((SELECT count(1) FROM sys_organization WHERE psid = org.sid) = 0, '2', '1') type |
||||
|
FROM sys_organization org |
||||
|
WHERE org.psid = #{psid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="treeList" resultType="com.yxt.user.biz.sysorganization.SysOrgVo"> |
||||
|
SELECT so.name, so.psid, so.id, so.sid, so.orgSidPath, so.orgCode |
||||
|
FROM sys_organization so |
||||
|
WHERE psid = #{psid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectOrgCode" resultType="com.yxt.user.biz.sysorganization.SysOrganization"> |
||||
|
SELECT * |
||||
|
FROM sys_organization |
||||
|
WHERE psid = '0' |
||||
|
</select> |
||||
|
|
||||
|
<select id="getListOrg" resultType="com.yxt.user.biz.sysorganization.SysOrgVo"> |
||||
|
SELECT so.name, so.psid, so.id, so.sid, so.orgSidPath |
||||
|
FROM sys_organization so |
||||
|
WHERE isDept = 0 |
||||
|
ORDER BY psid |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectOrgCodeByPsid" resultType="com.yxt.user.biz.sysorganization.SysOrganization"> |
||||
|
SELECT * |
||||
|
FROM sys_organization |
||||
|
LIMIT 0,1 |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectTreeList" resultType="com.yxt.user.biz.sysorganization.SysOrgListVo"> |
||||
|
SELECT so.name, so.psid, so.sid, so.orgSidPath, so.orgCode |
||||
|
FROM sys_organization so |
||||
|
WHERE psid = #{psid} |
||||
|
</select> |
||||
|
<!--根据部门编码查询部门信息--> |
||||
|
<select id="selectByOrgCode" resultType="com.yxt.user.biz.sysorganization.SysOrganization"> |
||||
|
select * |
||||
|
from sys_organization |
||||
|
where orgCode = #{substring} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectChildernList" resultType="com.yxt.user.biz.sysorganization.SysOrganizationVo"> |
||||
|
SELECT so.name, so.psid, so.sid, so.orgSidPath, so.orgCode |
||||
|
FROM sys_organization so |
||||
|
WHERE psid = #{psid} |
||||
|
ORDER BY so.sort ASC |
||||
|
</select> |
||||
|
|
||||
|
<select id="getUseOrgByUserSid" resultType="com.yxt.user.biz.sysstafforg.SysStaffOrgVo"> |
||||
|
select orgSidPath |
||||
|
from sys_staff_org |
||||
|
where staffSid = #{staffSid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="getUseOrgBySid" resultType="com.yxt.user.biz.sysorganization.SysOrganizationVo"> |
||||
|
SELECT so.name, so.psid, so.sid, so.orgSidPath, so.orgCode |
||||
|
FROM sys_organization so |
||||
|
WHERE sid = #{sid} |
||||
|
And isDept = 0 |
||||
|
</select> |
||||
|
|
||||
|
<update id="updateQrCodePath"> |
||||
|
UPDATE sys_organization |
||||
|
SET qrText = #{path} |
||||
|
WHERE sid = #{sid} |
||||
|
</update> |
||||
|
|
||||
|
<select id="getQrCodeVo" resultType="com.yxt.user.biz.sysorganization.QrCodeVo"> |
||||
|
SELECT so.name departmentName, so.qrText qrFilePath, so.addrs address, so.sid |
||||
|
FROM sys_organization so |
||||
|
WHERE so.sid = #{sid} |
||||
|
ORDER BY so.sort ASC |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectUseOrgSidBySid" resultType="java.util.Map"> |
||||
|
SELECT sid, |
||||
|
name |
||||
|
FROM sys_organization |
||||
|
WHERE psid = #{psid} |
||||
|
AND isDelete = 0 |
||||
|
AND isDept = 0 |
||||
|
</select> |
||||
|
|
||||
|
<select id="getListOrgByBrand" resultType="com.yxt.user.biz.sysorganization.SysOrgVo"> |
||||
|
SELECT so.name, so.psid, so.id, so.sid, so.orgSidPath |
||||
|
FROM sys_organization so |
||||
|
WHERE isDept = 0 |
||||
|
AND so.sid = #{sid} |
||||
|
ORDER BY psid |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectOrgList" resultType="com.yxt.user.biz.sysorganization.SysOrganizationListVo"> |
||||
|
select so.name orgDeptName, so.sid orgDeptSid |
||||
|
from sys_organization so |
||||
|
where so.psid = #{orgSid} |
||||
|
and orgAttributeKey = 'DP03_SYS' |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectOrgLists" resultType="com.yxt.user.biz.sysorganization.SysOrganizationListsVo"> |
||||
|
select so.name orgDeptName, so.sid orgDeptSid |
||||
|
from sys_organization so |
||||
|
where so.psid = #{orgSid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectByOrgDeptSid" resultType="com.yxt.user.biz.sysorganization.SysOrgStaffVo"> |
||||
|
select distinct si.name staffName, si.sid staffSid |
||||
|
from sys_staff_org so |
||||
|
left join sys_staffinfo si on so.staffSid = si.sid |
||||
|
where so.orgSid = #{orgDeptSid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectByPSid" resultType="com.yxt.user.biz.sysorganization.SysOrganizationVo"> |
||||
|
select * |
||||
|
from sys_organization |
||||
|
where psid = #{sid} |
||||
|
and name = #{name} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectOrgSidList" resultType="com.yxt.user.biz.sysorganization.SysOrganizationVo"> |
||||
|
select sid,name,orgCode from sys_organization so where so.isDept = 0 |
||||
|
</select> |
||||
|
|
||||
|
<select id="getListDeptByOrgSid" resultType="com.yxt.user.biz.sysorganization.SysOrgVo"> |
||||
|
SELECT so.name, so.psid, so.id, so.sid, so.orgSidPath |
||||
|
FROM sys_organization so |
||||
|
WHERE isDept = 1 |
||||
|
AND so.psid = #{orgSid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectOrgByPSid" resultType="com.yxt.user.biz.sysorganization.SysOrganizationVo"> |
||||
|
SELECT so.name, so.psid, so.id, so.sid, so.orgSidPath |
||||
|
FROM sys_organization so |
||||
|
WHERE isDept = 0 AND so.psid = #{psid} |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,58 @@ |
|||||
|
package com.yxt.user.biz.sysorganization; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysOrganizationQuery.java <br/> |
||||
|
* Class: SysOrganizationQuery <br/> |
||||
|
* Description: 组织机构表 查询条件. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "组织机构表 查询条件", description = "组织机构表 查询条件") |
||||
|
@Data |
||||
|
public class SysOrganizationQuery implements Query { |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("部门/组织名称") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("父(部门/组织) sid") |
||||
|
private String psid; |
||||
|
|
||||
|
@ApiModelProperty("联系电话") |
||||
|
private String linkPhone; |
||||
|
@ApiModelProperty("联系人") |
||||
|
private String linkPerson; |
||||
|
|
||||
|
@ApiModelProperty("部门sid全路径") |
||||
|
private String orgSidPath; |
||||
|
|
||||
|
@ApiModelProperty("排序") |
||||
|
private Integer sort; |
||||
|
|
||||
|
@ApiModelProperty("地址") |
||||
|
private String addrs; |
||||
|
|
||||
|
@ApiModelProperty("地理位置经纬度") |
||||
|
private String jwd; |
||||
|
|
||||
|
@ApiModelProperty("二维码") |
||||
|
private String qrText; |
||||
|
|
||||
|
@ApiModelProperty("限制本部门成员查看通讯录:限制开启后,本部门成员只能看到限定范围内的通讯录不能看到所有通讯录,仅可见自己") |
||||
|
private Integer limitOrgMember; |
||||
|
|
||||
|
@ApiModelProperty("部门编码") |
||||
|
private String orgCode; |
||||
|
} |
@ -0,0 +1,521 @@ |
|||||
|
package com.yxt.user.biz.sysorganization; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.yxt.common.base.config.RedisUtil; |
||||
|
import com.yxt.common.base.config.component.FileUploadComponent; |
||||
|
import com.yxt.common.base.service.MybatisBaseService; |
||||
|
import com.yxt.common.base.utils.PagerUtil; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import com.yxt.user.biz.sysstaffinfo.SysStaffinfo; |
||||
|
import com.yxt.user.biz.sysstaffinfo.SysStaffinfoService; |
||||
|
import com.yxt.user.biz.sysstafforg.SysStaffOrg; |
||||
|
import com.yxt.user.biz.sysstafforg.SysStaffOrgService; |
||||
|
import com.yxt.user.biz.sysstafforg.SysStaffOrgVo; |
||||
|
import com.yxt.user.biz.sysuser.SysUserService; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.*; |
||||
|
|
||||
|
import static java.util.stream.Collectors.toList; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysOrganizationService.java <br/> |
||||
|
* Class: SysOrganizationService <br/> |
||||
|
* Description: 组织机构表 业务逻辑. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class SysOrganizationService extends MybatisBaseService<SysOrganizationMapper, SysOrganization> { |
||||
|
@Autowired |
||||
|
private SysStaffOrgService sysStaffOrgService; |
||||
|
@Autowired |
||||
|
private SysUserService sysUserService; |
||||
|
@Autowired |
||||
|
private FileUploadComponent fileUploadComponent; |
||||
|
@Autowired |
||||
|
private SysStaffinfoService sysStaffInfoService; |
||||
|
@Autowired |
||||
|
private RedisUtil redisUtil; |
||||
|
|
||||
|
public ResultBean saveOrg(SysOrganizationDto dto){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysOrganization entity = new SysOrganization(); |
||||
|
dto.fillEntity(entity); |
||||
|
String psid = dto.getPsid(); |
||||
|
if (psid.equals("0")){ |
||||
|
entity.setOrgSidPath(entity.getSid()); |
||||
|
entity.setSort(1); |
||||
|
}else { |
||||
|
SysOrganization sysOrganization = fetchBySid(psid); |
||||
|
entity.setOrgSidPath(sysOrganization.getOrgSidPath()+"/"+entity.getSid()); |
||||
|
String[] split = sysOrganization.getOrgSidPath().split("/"); |
||||
|
entity.setSort(split.length+1); |
||||
|
} |
||||
|
this.saveOrUpdate(entity); |
||||
|
return rb.success().setMsg("添加成功"); |
||||
|
} |
||||
|
|
||||
|
public PagerVo<SysOrganization> listPage(PagerQuery<SysOrganizationQuery> pq) { |
||||
|
SysOrganizationQuery query = pq.getParams(); |
||||
|
QueryWrapper<SysOrganization> qw = createQueryWrapper(query); |
||||
|
IPage<SysOrganization> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<SysOrganization> pagging = baseMapper.selectPage(page, qw); |
||||
|
PagerVo<SysOrganization> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
|
||||
|
public List<SysOrganization> listAll(SysOrganizationQuery query) { |
||||
|
QueryWrapper<SysOrganization> qw = createQueryWrapper(query); |
||||
|
return baseMapper.selectList(qw); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<SysOrganization> createQueryWrapper(SysOrganizationQuery query) { |
||||
|
// todo: 这里根据具体业务调整查询条件
|
||||
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
||||
|
QueryWrapper<SysOrganization> qw = new QueryWrapper<>(); |
||||
|
|
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getName())) { |
||||
|
qw.eq("name", query.getName()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getPsid())) { |
||||
|
qw.eq("psid", query.getPsid()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getLinkPhone())) { |
||||
|
qw.eq("linkPhone", query.getLinkPhone()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getOrgSidPath())) { |
||||
|
qw.eq("orgSidPath", query.getOrgSidPath()); |
||||
|
} |
||||
|
|
||||
|
if (query.getSort() != null) { |
||||
|
qw.eq("sort", query.getSort()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getAddrs())) { |
||||
|
qw.eq("addrs", query.getAddrs()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getJwd())) { |
||||
|
qw.eq("jwd", query.getJwd()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getQrText())) { |
||||
|
qw.eq("qrText", query.getQrText()); |
||||
|
} |
||||
|
|
||||
|
if (query.getLimitOrgMember() != null) { |
||||
|
qw.eq("limitOrgMember", query.getLimitOrgMember()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getOrgCode())) { |
||||
|
qw.eq("orgCode", query.getOrgCode()); |
||||
|
} |
||||
|
return qw; |
||||
|
} |
||||
|
|
||||
|
public PagerVo<SysOrganizationVo> listPageVo(PagerQuery<SysOrganizationQuery> pq) { |
||||
|
SysOrganizationQuery query = pq.getParams(); |
||||
|
QueryWrapper<SysOrganization> qw = createQueryWrapper(query); |
||||
|
IPage<SysOrganization> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<SysOrganizationVo> pagging = baseMapper.selectPageVo(page, qw); |
||||
|
PagerVo<SysOrganizationVo> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
|
||||
|
public List<SysOrganizationVo> listAllVo(SysOrganizationQuery query) { |
||||
|
QueryWrapper<SysOrganization> qw = createQueryWrapper(query); |
||||
|
return baseMapper.selectListAllVo(qw); |
||||
|
} |
||||
|
|
||||
|
public List<SysOrganizationVo> listVo() { |
||||
|
List<SysOrganizationVo> sysOrganizations = baseMapper.selectFirstOrgList(); |
||||
|
getChildList(sysOrganizations); |
||||
|
return sysOrganizations; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public void getChildList(List<SysOrganizationVo> list) { |
||||
|
list.forEach(str -> { |
||||
|
String sid = str.getSid(); |
||||
|
List<SysOrganizationVo> listChildren = baseMapper.selectChildernList(sid); |
||||
|
str.setChildren(listChildren); |
||||
|
getChildList(listChildren); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public List<SysOrganizationVo> selectFirstOrgList() { |
||||
|
return baseMapper.selectFirstOrgList(); |
||||
|
} |
||||
|
|
||||
|
public List<SysOrganizationVo> selectChildrenListBySid(String sid) { |
||||
|
return baseMapper.selectChildrenListByPsid(sid); |
||||
|
} |
||||
|
|
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public ResultBean addSysStaffOrg(String sids, String manageType, SysOrganization entity) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
String[] sidArr = sids.split(","); |
||||
|
String name = ""; |
||||
|
for (String sid : sidArr) { |
||||
|
//查询组织关系中是否已经包含分管的人员
|
||||
|
if ("1".equals(manageType)) { |
||||
|
//查询是否有员工信息,如果有的话,删除关联关系
|
||||
|
sysStaffOrgService.deleteByStaffSidAndType(entity.getOrgSidPath(), sid, "3"); |
||||
|
} else { |
||||
|
int count = sysStaffOrgService.selectByStaffAndOrg(entity.getOrgSidPath(), sid, "3"); |
||||
|
SysStaffinfo sysStaffinfo = sysStaffInfoService.fetchBySid(sid); |
||||
|
if (count > 0) { |
||||
|
return rb.setMsg(sysStaffinfo.getName() + "已在本部门,不能设置分管"); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
//查询该人员的组织机构list
|
||||
|
List<SysStaffOrgVo> sysStaffOrgVos = sysStaffOrgService.selectByStaffS(sid); |
||||
|
List<String> orgList = new ArrayList<>(); |
||||
|
if (sysStaffOrgVos.size() > 0) { |
||||
|
for (SysStaffOrgVo vv : sysStaffOrgVos) { |
||||
|
String orgSid = sysStaffOrgService.getOrgByOrgSid(vv.getOrgSid()); |
||||
|
SysOrganization sysOrganization = fetchBySid(orgSid); |
||||
|
if (sysOrganization != null) { |
||||
|
orgList.add(orgSid); |
||||
|
} else { |
||||
|
continue; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
//添加员工与组织的关联关系
|
||||
|
SysStaffOrg sysStaffOrg = new SysStaffOrg(); |
||||
|
sysStaffOrg.setManageType(manageType); |
||||
|
sysStaffOrg.setOrgSid(entity.getSid()); |
||||
|
sysStaffOrg.setOrgName(entity.getName()); |
||||
|
sysStaffOrg.setStaffSid(sid); |
||||
|
String orgSidPath = entity.getOrgSidPath(); |
||||
|
if (StringUtils.isNotBlank(orgSidPath)) { |
||||
|
sysStaffOrg.setOrgSidPath(orgSidPath); |
||||
|
} else { |
||||
|
sysStaffOrg.setOrgSidPath(entity.getSid()); |
||||
|
} |
||||
|
String psid = entity.getPsid(); |
||||
|
if (StringUtils.isNotBlank(psid)) { |
||||
|
SysOrganization sysOrganization = this.fetchBySid(psid); |
||||
|
if (sysOrganization != null) { |
||||
|
sysStaffOrg.setOrgNamePath(sysOrganization.getName() + "/" + entity.getName()); |
||||
|
} else { |
||||
|
sysStaffOrg.setOrgNamePath(entity.getName()); |
||||
|
} |
||||
|
} |
||||
|
sysStaffOrgService.save(sysStaffOrg); |
||||
|
//==========================添加清空变化的用户的token
|
||||
|
List<SysStaffOrgVo> sysStaffOrgVos1 = sysStaffOrgService.selectByStaffS(sid); |
||||
|
List<String> orgList1 = new ArrayList<>(); |
||||
|
if (sysStaffOrgVos1.size() > 0) { |
||||
|
for (SysStaffOrgVo vv : sysStaffOrgVos1) { |
||||
|
String orgSid = sysStaffOrgService.getOrgByOrgSid(vv.getOrgSid()); |
||||
|
SysOrganization sysOrganization = fetchBySid(orgSid); |
||||
|
if (sysOrganization != null) { |
||||
|
orgList1.add(orgSid); |
||||
|
} else { |
||||
|
continue; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
List<String> reduce1 = orgList1.stream().filter(item -> !orgList.contains(item)).collect(toList()); |
||||
|
if (reduce1.size() > 0) { |
||||
|
//根据staffSid查询token
|
||||
|
String token = sysUserService.selectByStaffsid(sid).getToken(); |
||||
|
if (StringUtils.isNotBlank(token)) { |
||||
|
//清空该token
|
||||
|
redisUtil.remove(token); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
return rb.success(); |
||||
|
} |
||||
|
|
||||
|
public void saveOrUpdateDto(SysOrganizationDto dto) { |
||||
|
SysOrganization entity = new SysOrganization(); |
||||
|
dto.fillEntity(entity); |
||||
|
//主管人员sid
|
||||
|
String zgStaffSid = dto.getZgStaffSid(); |
||||
|
//分管人员sid
|
||||
|
String fgStaffSid = dto.getFgStaffSid(); |
||||
|
String psid = dto.getPsid(); |
||||
|
SysOrganization sysOrganization = this.fetchBySid(psid); |
||||
|
|
||||
|
if (StringUtils.isNotBlank(zgStaffSid)) { |
||||
|
this.addSysStaffOrg(zgStaffSid, "1", entity); |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(fgStaffSid)) { |
||||
|
this.addSysStaffOrg(fgStaffSid, "2", entity); |
||||
|
} |
||||
|
entity.setOrgSidPath(sysOrganization.getOrgSidPath() + "/" + entity.getSid()); |
||||
|
this.saveOrUpdate(entity); |
||||
|
} |
||||
|
|
||||
|
public SysOrganizationVo fetchByIdVo(String id) { |
||||
|
SysOrganization entity = this.fetchById(id); |
||||
|
SysOrganizationVo vo = new SysOrganizationVo(); |
||||
|
BeanUtil.copyProperties(entity, vo); |
||||
|
return vo; |
||||
|
} |
||||
|
|
||||
|
public String selectOrgnameBySid(String sid) { |
||||
|
return baseMapper.selectOrgnameBySid(sid); |
||||
|
} |
||||
|
|
||||
|
public List<Map<String, Object>> selectOrgNameList(String sid) { |
||||
|
String orgSidPath = baseMapper.selectOrgSidPath(sid); |
||||
|
String[] orgSidPathArr = orgSidPath.split("/"); |
||||
|
List<Map<String, Object>> nameList = new ArrayList<>(); |
||||
|
for (int i = 0; i < orgSidPathArr.length; i++) { |
||||
|
Map<String, Object> m = new HashMap<>(); |
||||
|
m.put("sid", orgSidPathArr[i]); |
||||
|
m.put("name", selectOrgnameBySid(orgSidPathArr[i])); |
||||
|
nameList.add(m); |
||||
|
} |
||||
|
return nameList; |
||||
|
} |
||||
|
|
||||
|
public List<AppContactSysOrganizationVo> selectAppOrganization() { |
||||
|
List<AppContactSysOrganizationVo> list = baseMapper.selectAppOrganization(); |
||||
|
list.stream().forEach(vo -> { |
||||
|
if (StringUtils.isNotBlank(vo.getHeadImage())) { |
||||
|
vo.setHeadImage(fileUploadComponent.getUrlPrefix() + vo.getHeadImage()); |
||||
|
} |
||||
|
}); |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
public List<AppContactSysOrganizationVo> selectAppOrganizationSub(String psid) { |
||||
|
List<AppContactSysOrganizationVo> list = baseMapper.selectAppOrganizationByPsid(psid); |
||||
|
list.stream().forEach(vo -> { |
||||
|
if (StringUtils.isNotBlank(vo.getHeadImage())) { |
||||
|
vo.setHeadImage(fileUploadComponent.getUrlPrefix() + vo.getHeadImage()); |
||||
|
} |
||||
|
}); |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param |
||||
|
* @description: 获取组织架构即使用组织下拉框 |
||||
|
* @return: |
||||
|
* @Author: dimengzhe |
||||
|
* @Date: 2021/10/12 21:47 |
||||
|
*/ |
||||
|
public List<SysOrgVo> treeList() { |
||||
|
String psid = "0"; |
||||
|
List<SysOrgVo> list = baseMapper.treeList(psid); |
||||
|
getChildOrgList(list); |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
public void getChildOrgList(List<SysOrgVo> list) { |
||||
|
list.forEach(menuTree -> { |
||||
|
String sid = menuTree.getSid(); |
||||
|
List<SysOrgVo> listChildren = baseMapper.treeList(sid); |
||||
|
menuTree.setChildren(listChildren); |
||||
|
if (Arrays.asList(menuTree.getOrgSidPath().split("/")).size() <= 2) { |
||||
|
getChildOrgList(listChildren); |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param |
||||
|
* @description: 查询部门编码 |
||||
|
* @return: |
||||
|
* @Author: dimengzhe |
||||
|
* @Date: 2021/10/18 15:49 |
||||
|
*/ |
||||
|
public SysOrganization selectOrgCode() { |
||||
|
return baseMapper.selectOrgCode(); |
||||
|
} |
||||
|
|
||||
|
public List<SysOrgVo> getListOrg() { |
||||
|
List<SysOrgVo> list = baseMapper.getListOrg(); |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
public SysOrganization selectOrgCodeByPsid() { |
||||
|
return baseMapper.selectOrgCodeByPsid(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询所有部门列表 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
public List<SysOrgListVo> selectTreeList() { |
||||
|
String psid = "0"; |
||||
|
List<SysOrgListVo> list = baseMapper.selectTreeList(psid); |
||||
|
getChildOrgListOne(list); |
||||
|
return list; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询组织子集 |
||||
|
* |
||||
|
* @param list |
||||
|
*/ |
||||
|
public void getChildOrgListOne(List<SysOrgListVo> list) { |
||||
|
list.forEach(menuTree -> { |
||||
|
String sid = menuTree.getSid(); |
||||
|
List<SysOrgVo> listChildren = baseMapper.treeList(sid); |
||||
|
menuTree.setChildren(listChildren); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据部门编码查询部门信息 |
||||
|
* |
||||
|
* @param substring 部门编码 |
||||
|
* @return |
||||
|
*/ |
||||
|
public SysOrganization selectByOrgCode(String substring) { |
||||
|
return baseMapper.selectByOrgCode(substring); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据业务员sid获取到分公司 |
||||
|
* |
||||
|
* @param userSid 业务员sid |
||||
|
* @return |
||||
|
*/ |
||||
|
public SysOrganizationVo getUseOrgByUserSid(String userSid) { |
||||
|
// String staffSid = sysUserService.getUserOrgInfoByUserSid(userSid).getStaffSid();
|
||||
|
// SysStaffOrgVo sysOrgVo = baseMapper.getUseOrgByUserSid(staffSid);
|
||||
|
// String orgSidPath = sysOrgVo.getOrgSidPath();
|
||||
|
// SysOrganizationVo vo = getUseOrgBySid(orgSidPath);
|
||||
|
return new SysOrganizationVo(); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据sid判断是否是分公司并获取公司名称 |
||||
|
* |
||||
|
* @param orgSidPath |
||||
|
* @return |
||||
|
*/ |
||||
|
public SysOrganizationVo getUseOrgBySid(String orgSidPath) { |
||||
|
String[] split = orgSidPath.split("/"); |
||||
|
for (int i = 0; i < split.length; i++) { |
||||
|
SysOrganizationVo sysOrganizationVo = baseMapper.getUseOrgBySid(split[i]); |
||||
|
if (sysOrganizationVo != null) { |
||||
|
return sysOrganizationVo; |
||||
|
} |
||||
|
} |
||||
|
SysOrganization sysOrganization = fetchBySid(split[0]);// 总公司为所在公司
|
||||
|
SysOrganizationVo sysOrganizationVo = new SysOrganizationVo(); |
||||
|
BeanUtil.copyProperties(sysOrganization, sysOrganizationVo); |
||||
|
return sysOrganizationVo; |
||||
|
} |
||||
|
|
||||
|
public int updateQrCodePath(String sid, String path) { |
||||
|
return baseMapper.updateQrCodePath(sid, path); |
||||
|
} |
||||
|
|
||||
|
public QrCodeVo getQrCodeVo(String sid) { |
||||
|
return baseMapper.getQrCodeVo(sid); |
||||
|
} |
||||
|
|
||||
|
public List<Map<String, String>> selectUseOrgSidBySid(String sid) { |
||||
|
SysOrganization sysOrganization = fetchBySid(sid); |
||||
|
String psid = sysOrganization.getPsid(); |
||||
|
return baseMapper.selectUseOrgSidBySid(psid); |
||||
|
} |
||||
|
|
||||
|
public String getOrgSid(String sid) { |
||||
|
SysOrganization sysOrganization = fetchBySid(sid); |
||||
|
String orgSid = ""; |
||||
|
if ("0".equals(sysOrganization.getPsid())) {//总公司
|
||||
|
orgSid = sysOrganization.getSid(); |
||||
|
return orgSid; |
||||
|
} |
||||
|
if (sysOrganization.getIsDept() == 0) {//是独立法人的
|
||||
|
return sysOrganization.getSid(); |
||||
|
} |
||||
|
sid = sysOrganization.getPsid(); |
||||
|
return getOrgSid(sid); |
||||
|
} |
||||
|
|
||||
|
public ResultBean<List<SysOrganizationListVo>> selectOrgList(SysOrganizationListQuery query) { |
||||
|
ResultBean<List<SysOrganizationListVo>> rb = ResultBean.fireFail(); |
||||
|
//根据用户sid查询分公司sid
|
||||
|
String orgDeptSid = sysStaffOrgService.selectByUserSid(query.getUserSid()); |
||||
|
String orgSid = getOrgSid(orgDeptSid); |
||||
|
//根据分公司名称查询销售部门的部门
|
||||
|
List<SysOrganizationListVo> sysOrganizationListVos = baseMapper.selectOrgList(orgSid); |
||||
|
sysOrganizationListVos.removeAll(Collections.singleton(null)); |
||||
|
if (!sysOrganizationListVos.isEmpty()) { |
||||
|
for (SysOrganizationListVo vo : sysOrganizationListVos) { |
||||
|
orgDeptSid = vo.getOrgDeptSid(); |
||||
|
List<SysOrgStaffVo> sysOrgStaffVoList = baseMapper.selectByOrgDeptSid(orgDeptSid); |
||||
|
vo.setStaffinfoVoList(sysOrgStaffVoList); |
||||
|
} |
||||
|
} |
||||
|
return rb.success().setData(sysOrganizationListVos); |
||||
|
} |
||||
|
|
||||
|
public ResultBean<List<SysOrganizationListsVo>> selectOrgLists(SysOrganizationListQuery query) { |
||||
|
ResultBean<List<SysOrganizationListsVo>> rb = ResultBean.fireFail(); |
||||
|
//根据用户sid查询分公司sid
|
||||
|
String orgDeptSid = sysStaffOrgService.selectByUserSid(query.getUserSid()); |
||||
|
String orgSid = getOrgSid(orgDeptSid); |
||||
|
//根据分公司名称查询销售部门的部门
|
||||
|
List<SysOrganizationListsVo> sysOrganizationListVos = baseMapper.selectOrgLists(orgSid); |
||||
|
sysOrganizationListVos.removeAll(Collections.singleton(null)); |
||||
|
return rb.success().setData(sysOrganizationListVos); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public ResultBean<SysOrganizationVo> selectByPSid(String sid, String name) { |
||||
|
ResultBean<SysOrganizationVo> rb = ResultBean.fireFail(); |
||||
|
SysOrganizationVo vo = baseMapper.selectByPSid(sid, name); |
||||
|
return rb.success().setData(vo); |
||||
|
} |
||||
|
|
||||
|
public List<SysOrganizationVo> selectOrgSidList() { |
||||
|
return baseMapper.selectOrgSidList(); |
||||
|
} |
||||
|
|
||||
|
public ResultBean<SysOrganizationVo> selectByOrgSidPath(String orgSidPath) { |
||||
|
ResultBean<SysOrganizationVo> rb = ResultBean.fireFail(); |
||||
|
SysOrganizationVo sysOrganizationVo = baseMapper.selectByOrgSidPath(orgSidPath); |
||||
|
return rb.success().setData(sysOrganizationVo); |
||||
|
} |
||||
|
|
||||
|
public ResultBean<List<SysOrgVo>> getListDeptByOrgSid(String orgSid) { |
||||
|
ResultBean<List<SysOrgVo>> rb = ResultBean.fireFail(); |
||||
|
List<SysOrgVo> sysOrgVos = baseMapper.getListDeptByOrgSid(orgSid); |
||||
|
return rb.success().setData(sysOrgVos); |
||||
|
} |
||||
|
|
||||
|
public ResultBean<List<SysOrganizationVo>> selectOrgByPSid(String psid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysOrganizationVo> sysOrganizationVos = baseMapper.selectOrgByPSid(psid); |
||||
|
return rb.success().setData(sysOrganizationVos); |
||||
|
} |
||||
|
} |
@ -0,0 +1,86 @@ |
|||||
|
package com.yxt.user.biz.sysorganization; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysOrganizationVo.java <br/> |
||||
|
* Class: SysOrganizationVo <br/> |
||||
|
* Description: 组织机构表 视图数据对象. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "组织机构表 视图数据对象", description = "组织机构表 视图数据对象") |
||||
|
@Data |
||||
|
public class SysOrganizationVo implements Vo { |
||||
|
@ApiModelProperty("部门/组织名称") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("父(部门/组织) sid") |
||||
|
private String psid; |
||||
|
|
||||
|
@ApiModelProperty("联系电话") |
||||
|
private String linkPhone; |
||||
|
|
||||
|
@ApiModelProperty("联系人") |
||||
|
private String linkPerson; |
||||
|
|
||||
|
@ApiModelProperty("部门sid全路径") |
||||
|
private String orgSidPath; |
||||
|
|
||||
|
@ApiModelProperty("排序") |
||||
|
private Integer sort; |
||||
|
|
||||
|
@ApiModelProperty("地址") |
||||
|
private String addrs; |
||||
|
|
||||
|
@ApiModelProperty("地理位置经纬度") |
||||
|
private String jwd; |
||||
|
|
||||
|
@ApiModelProperty("二维码") |
||||
|
private String qrText; |
||||
|
|
||||
|
@ApiModelProperty("限制本部门成员查看通讯录:限制开启后,本部门成员只能看到限定范围内的通讯录不能看到所有通讯录,仅可见自己") |
||||
|
private Integer limitOrgMember; |
||||
|
|
||||
|
@ApiModelProperty("部门编码") |
||||
|
private String orgCode; |
||||
|
@ApiModelProperty("sid") |
||||
|
private String sid; |
||||
|
@ApiModelProperty("子集") |
||||
|
private List<SysOrganizationVo> children = new ArrayList<>(); |
||||
|
@ApiModelProperty("主管人员名称") |
||||
|
private String zgNames; |
||||
|
@ApiModelProperty("分管人员名称") |
||||
|
private String fgNames; |
||||
|
@ApiModelProperty("主管人员sid") |
||||
|
private String zgStaffSid; |
||||
|
@ApiModelProperty("分管人员sid") |
||||
|
private String fgStaffSid; |
||||
|
@ApiModelProperty("组织简称") |
||||
|
private String orgAbbre; |
||||
|
@ApiModelProperty("是否是部门(0否,1是)") |
||||
|
private Integer isDept; |
||||
|
@ApiModelProperty("组织属性key") |
||||
|
private String orgAttributeKey; |
||||
|
@ApiModelProperty("组织属性value") |
||||
|
private String orgAttributeValue; |
||||
|
@ApiModelProperty("管理层级key") |
||||
|
private String orgLevelKey; |
||||
|
@ApiModelProperty("管理层级value") |
||||
|
private String orgLevelValue; |
||||
|
@ApiModelProperty("其他编码") |
||||
|
private String otherCode; |
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
package com.yxt.user.biz.syspost; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.yxt.common.core.domain.BaseEntity; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysPost.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.syspost.SysPost <br/> |
||||
|
* Description: 岗位. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "岗位", description = "岗位") |
||||
|
@TableName("sys_post") |
||||
|
@Data |
||||
|
public class SysPost extends BaseEntity { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("岗位名称") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("职级key") |
||||
|
private String postLevelKey; |
||||
|
|
||||
|
@ApiModelProperty("职级") |
||||
|
private String postLevel; |
||||
|
|
||||
|
@ApiModelProperty("岗位编码") |
||||
|
private String postCode; |
||||
|
|
||||
|
@ApiModelProperty("所属部门sid") |
||||
|
private String orgSid; |
||||
|
|
||||
|
@ApiModelProperty(value = "父级sid") |
||||
|
private String parentSid; |
||||
|
} |
@ -0,0 +1,44 @@ |
|||||
|
package com.yxt.user.biz.syspost; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.dto.Dto; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysPostDto.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.syspost.SysPostDto <br/> |
||||
|
* Description: 岗位 数据传输对象. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "岗位 数据传输对象", description = "岗位 数据传输对象") |
||||
|
@Data |
||||
|
public class SysPostDto implements Dto { |
||||
|
|
||||
|
private static final long serialVersionUID = 863876947510030464L; |
||||
|
@ApiModelProperty("岗位名称") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("职级key") |
||||
|
private String postLevelKey; |
||||
|
|
||||
|
@ApiModelProperty("职级") |
||||
|
private String postLevel; |
||||
|
|
||||
|
@ApiModelProperty("岗位编码") |
||||
|
private String postCode; |
||||
|
|
||||
|
@ApiModelProperty("所属部门sid") |
||||
|
private String orgSid; |
||||
|
|
||||
|
@ApiModelProperty(value = "父级sid", example = "0") |
||||
|
private String parentSid; |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
package com.yxt.user.biz.syspost; |
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/2/14 13:49 |
||||
|
* @Description 部门下的岗位信息 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class SysPostListVo implements Vo { |
||||
|
private static final long serialVersionUID = -8060032905868283959L; |
||||
|
|
||||
|
@ApiModelProperty("岗位名称") |
||||
|
private String name; |
||||
|
@ApiModelProperty("岗位编码") |
||||
|
private String postCode; |
||||
|
@ApiModelProperty("岗位sid") |
||||
|
private String sid; |
||||
|
} |
@ -0,0 +1,68 @@ |
|||||
|
package com.yxt.user.biz.syspost; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
|
import com.yxt.user.biz.syspost.SysPost; |
||||
|
import com.yxt.user.biz.syspost.SysPostListVo; |
||||
|
import com.yxt.user.biz.syspost.SysPostVo; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.apache.ibatis.annotations.Select; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysPostMapper.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.biz.syspost.SysPostMapper <br/> |
||||
|
* Description: 岗位. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface SysPostMapper extends BaseMapper<SysPost> { |
||||
|
|
||||
|
//@Update("update sys_post set name=#{msg} where id=#{id}")
|
||||
|
//IPage<SysPostVo> voPage(IPage<SysPost> page, @Param(Constants.WRAPPER) QueryWrapper<SysPost> qw);
|
||||
|
|
||||
|
IPage<SysPostVo> selectPageVo(IPage<SysPost> page, @Param(Constants.WRAPPER) Wrapper<SysPost> qw); |
||||
|
|
||||
|
List<SysPostVo> selectListAllVo(@Param(Constants.WRAPPER) Wrapper<SysPost> qw); |
||||
|
|
||||
|
@Select("select * from sys_post") |
||||
|
List<SysPostVo> selectListVo(); |
||||
|
|
||||
|
@Select("select * from sys_post where sid=#{sid} ") |
||||
|
SysPost fetchBySid(@Param("sid") String sid); |
||||
|
|
||||
|
@Select("select * from sys_post where orgSid=#{orgSid} ") |
||||
|
List<SysPostVo> fetchByOrgSid(@Param("orgSid") String orgSid); |
||||
|
|
||||
|
@Select("select postCode,`name` from sys_post") |
||||
|
List<SysPostVo> fetchByOrgSidPostCode(); |
||||
|
|
||||
|
/** |
||||
|
* 查询所有岗位列表 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
List<SysPostListVo> selectListOne(); |
||||
|
|
||||
|
/** |
||||
|
* 根据岗位编码查询岗位信息 |
||||
|
* |
||||
|
* @param substring 岗位编码 |
||||
|
* @return |
||||
|
*/ |
||||
|
SysPost selectByPostCode(String substring); |
||||
|
|
||||
|
@Select("select * from sys_post where staffSid = #{sid}") |
||||
|
SysPost getPostByStaffSid(String sid); |
||||
|
} |
@ -0,0 +1,44 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.yxt.user.biz.syspost.SysPostMapper"> |
||||
|
<!-- <where> ${ew.sqlSegment} </where>--> |
||||
|
<!-- ${ew.customSqlSegment} --> |
||||
|
<select id="selectPageVo" resultType="com.yxt.user.biz.syspost.SysPostVo"> |
||||
|
SELECT post.sid sid, |
||||
|
post.name name, |
||||
|
post.orgSid, |
||||
|
post.postCode, |
||||
|
post.postLevelKey, |
||||
|
post.postLevel, |
||||
|
post.orgSid, |
||||
|
IF(org.psid = '0', org.name, |
||||
|
CONCAT((select name from sys_organization where sid = org.psid), "/", org.name)) orgName, |
||||
|
post.parentSid, |
||||
|
sp.name parentName |
||||
|
FROM sys_post post |
||||
|
left join sys_organization org on org.sid = post.orgSid |
||||
|
left join sys_post sp on post.parentSid = sp.sid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectListAllVo" resultType="com.yxt.user.biz.syspost.SysPostVo"> |
||||
|
SELECT * |
||||
|
FROM sys_post |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<!--根据部门sid查询该部门下的所有岗位列表--> |
||||
|
<select id="selectListOne" resultType="com.yxt.user.biz.syspost.SysPostListVo"> |
||||
|
select name, postCode, sid |
||||
|
from sys_post |
||||
|
</select> |
||||
|
<!--根据岗位编码查询岗位信息--> |
||||
|
<select id="selectByPostCode" resultType="com.yxt.user.biz.syspost.SysPost"> |
||||
|
select * |
||||
|
from sys_post |
||||
|
where postCode = #{substring} |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,41 @@ |
|||||
|
package com.yxt.user.biz.syspost; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysPostQuery.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.syspost.SysPostQuery <br/> |
||||
|
* Description: 岗位 查询条件. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "岗位 查询条件", description = "岗位 查询条件") |
||||
|
@Data |
||||
|
public class SysPostQuery implements Query { |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("岗位名称") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("职级key") |
||||
|
private String postLevelKey; |
||||
|
|
||||
|
@ApiModelProperty("职级") |
||||
|
private String postLevel; |
||||
|
|
||||
|
@ApiModelProperty("岗位编码") |
||||
|
private String postCode; |
||||
|
|
||||
|
@ApiModelProperty("所属部门sid") |
||||
|
private String orgSid; |
||||
|
} |
@ -0,0 +1,52 @@ |
|||||
|
package com.yxt.user.biz.syspost; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysPostVo.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.syspost.SysPostVo <br/> |
||||
|
* Description: 岗位 视图数据对象. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:28 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "岗位 视图数据对象", description = "岗位 视图数据对象") |
||||
|
@Data |
||||
|
public class SysPostVo implements Vo { |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("岗位名称") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("职级key") |
||||
|
private String postLevelKey; |
||||
|
|
||||
|
@ApiModelProperty("职级") |
||||
|
private String postLevel; |
||||
|
|
||||
|
@ApiModelProperty("岗位编码") |
||||
|
private String postCode; |
||||
|
|
||||
|
@ApiModelProperty("所属部门sid") |
||||
|
private String orgSid; |
||||
|
|
||||
|
@ApiModelProperty("所属部门名称") |
||||
|
private String orgName; |
||||
|
|
||||
|
@ApiModelProperty("岗位sid") |
||||
|
private String sid; |
||||
|
|
||||
|
@ApiModelProperty(value = "上级岗位名称") |
||||
|
private String parentName; |
||||
|
@ApiModelProperty(value = "上级岗位sid") |
||||
|
private String parentSid; |
||||
|
} |
@ -0,0 +1,48 @@ |
|||||
|
package com.yxt.user.biz.sysrole; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.yxt.common.core.domain.BaseEntity; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysRole.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysrole.SysRole <br/> |
||||
|
* Description: 角色. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "角色", description = "角色") |
||||
|
@TableName("sys_role") |
||||
|
@Data |
||||
|
public class SysRole extends BaseEntity { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("角色名称") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("排序") |
||||
|
private Integer sort; |
||||
|
|
||||
|
@ApiModelProperty("编码") |
||||
|
private String code; |
||||
|
|
||||
|
@ApiModelProperty("1、系统管理员、2、普通角色") |
||||
|
private Integer type; |
||||
|
|
||||
|
@ApiModelProperty("岗位sid") |
||||
|
private String postSid; |
||||
|
|
||||
|
@ApiModelProperty(value = "角色组织层级key") |
||||
|
private String roleType; |
||||
|
@ApiModelProperty(value = "角色组织层级value") |
||||
|
private String roleTypeValue; |
||||
|
} |
@ -0,0 +1,51 @@ |
|||||
|
package com.yxt.user.biz.sysrole; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.dto.Dto; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysRoleDto.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysrole.SysRoleDto <br/> |
||||
|
* Description: 角色 数据传输对象. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "角色 数据传输对象", description = "角色 数据传输对象") |
||||
|
@Data |
||||
|
public class SysRoleDto implements Dto { |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("角色名称") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("排序") |
||||
|
private Integer sort; |
||||
|
|
||||
|
@ApiModelProperty("编码") |
||||
|
private String code; |
||||
|
@ApiModelProperty("备注") |
||||
|
private String remarks; |
||||
|
|
||||
|
@ApiModelProperty("1、系统管理员、2、普通角色") |
||||
|
private Integer type; |
||||
|
|
||||
|
@ApiModelProperty("岗位sid") |
||||
|
private String postSid; |
||||
|
|
||||
|
@ApiModelProperty("岗位名称") |
||||
|
private String postName; |
||||
|
|
||||
|
@ApiModelProperty(value = "角色组织层级key") |
||||
|
private String roleType; |
||||
|
@ApiModelProperty(value = "角色组织层级value") |
||||
|
private String roleTypeValue; |
||||
|
} |
@ -0,0 +1,69 @@ |
|||||
|
package com.yxt.user.biz.sysrole; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
|
import com.yxt.user.biz.sysuser.SysMenuRoleVoList; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.apache.ibatis.annotations.Select; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysRoleMapper.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.biz.sysrole.SysRoleMapper <br/> |
||||
|
* Description: 角色. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface SysRoleMapper extends BaseMapper<SysRole> { |
||||
|
|
||||
|
//@Update("update sys_role set name=#{msg} where id=#{id}")
|
||||
|
//IPage<SysRoleVo> voPage(IPage<SysRole> page, @Param(Constants.WRAPPER) QueryWrapper<SysRole> qw);
|
||||
|
|
||||
|
IPage<SysRoleVo> selectPageVo(IPage<SysRole> page, @Param(Constants.WRAPPER) Wrapper<SysRole> qw); |
||||
|
|
||||
|
List<SysRoleVo> selectListAllVo(@Param(Constants.WRAPPER) Wrapper<SysRole> qw); |
||||
|
|
||||
|
@Select("select * from sys_role") |
||||
|
List<SysRoleVo> selectListVo(); |
||||
|
|
||||
|
List<SysRoleVo> fetchByUserSid(String userSid); |
||||
|
|
||||
|
List<SysRoleVo> listAllByUserSid(String userSid); |
||||
|
|
||||
|
SysRole fetchByName(String name); |
||||
|
|
||||
|
int deleteBatchSids(List<String> list); |
||||
|
|
||||
|
int deleteBySid(String valueOf); |
||||
|
|
||||
|
SysRoleVo fetchBySid(String sid); |
||||
|
|
||||
|
int updateIsEnable(@Param("sid") String sid, @Param("isEnable") String isEnable); |
||||
|
|
||||
|
String getLevelType(String roleSid); |
||||
|
|
||||
|
String selectRoleSid(String userRoleSid); |
||||
|
|
||||
|
String selectByUserSid(String sid); |
||||
|
|
||||
|
List<String> selectByUser(String userSid); |
||||
|
|
||||
|
List<SysMenuRoleVoList> selectRoleList(String menuSid); |
||||
|
|
||||
|
List<SysMenuRoleVoList> selectMobileRoleList(String menuSid); |
||||
|
|
||||
|
List<String> selectByRole(@Param("list") List<String> roleSidList, @Param("menuSid") String menuSid,@Param("userSid") String userSid); |
||||
|
|
||||
|
List<String> selectByMobileRole(@Param("list") List<String> roleSidList, @Param("menuSid") String menuSid,@Param("userSid") String userSid); |
||||
|
} |
@ -0,0 +1,134 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.yxt.user.biz.sysrole.SysRoleMapper"> |
||||
|
<!-- <where> ${ew.sqlSegment} </where>--> |
||||
|
<!-- ${ew.customSqlSegment} --> |
||||
|
<select id="selectPageVo" resultType="com.yxt.user.biz.sysrole.SysRoleVo"> |
||||
|
SELECT sr.*, sp.sid as postSid, sp.name as postName |
||||
|
FROM sys_role sr |
||||
|
LEFT JOIN sys_post sp ON sr.postSid = sp.sid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
ORDER BY sr.sort |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectListAllVo" resultType="com.yxt.user.biz.sysrole.SysRoleVo"> |
||||
|
SELECT * |
||||
|
FROM sys_role |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="listAllByUserSid" resultType="com.yxt.user.biz.sysrole.SysRoleVo"> |
||||
|
SELECT role.name, role.sid, ISNULL(userRole.sid) AS checked |
||||
|
FROM sys_role role |
||||
|
LEFT JOIN sys_user_role userRole ON role.sid = userRole.`roleSid` |
||||
|
AND userRole.userSid = #{param1} |
||||
|
</select> |
||||
|
|
||||
|
<select id="fetchByUserSid" resultType="com.yxt.user.biz.sysrole.SysRoleVo"> |
||||
|
SELECT role.name, role.remarks, role.sid |
||||
|
FROM sys_role role |
||||
|
left join sys_user_role userrole on userrole.roleSid = role.sid |
||||
|
where userrole.userSid = #{param1} |
||||
|
</select> |
||||
|
<select id="fetchByName" resultType="com.yxt.user.biz.sysrole.SysRole"> |
||||
|
SELECT * |
||||
|
FROM sys_role role |
||||
|
where role.name = #{param1} |
||||
|
</select> |
||||
|
<select id="fetchBySid" resultType="com.yxt.user.biz.sysrole.SysRoleVo"> |
||||
|
SELECT role.*, post.sid as postSid, post.name as postName |
||||
|
FROM sys_role role |
||||
|
LEFT JOIN sys_post post ON role.postSid = post.sid |
||||
|
WHERE role.sid = #{param1} |
||||
|
</select> |
||||
|
<delete id="deleteBatchSids" parameterType="String"> |
||||
|
DELETE |
||||
|
FROM sys_role WHERE sid IN |
||||
|
<foreach collection="list" item="sid" open="(" separator="," close=")"> |
||||
|
#{sid} |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
<delete id="deleteBySid"> |
||||
|
DELETE |
||||
|
FROM sys_role |
||||
|
WHERE sid = #{sid} |
||||
|
</delete> |
||||
|
|
||||
|
<update id="updateIsEnable"> |
||||
|
UPDATE sys_role |
||||
|
SET isEnable = #{isEnable} |
||||
|
WHERE sid = #{sid} |
||||
|
</update> |
||||
|
|
||||
|
<select id="getLevelType" resultType="java.lang.String"> |
||||
|
select roleType |
||||
|
from sys_role |
||||
|
where sid = #{roleSid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectRoleSid" resultType="java.lang.String"> |
||||
|
SELECT ssr.sid |
||||
|
FROM sys_role sr |
||||
|
LEFT JOIN sys_post sp ON sp.sid = sr.postSid |
||||
|
left join sys_post ssp on sp.parentSid = ssp.sid |
||||
|
left join sys_role ssr on ssp.sid = ssr.postSid |
||||
|
where sr.sid = #{sid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectByUserSid" resultType="java.lang.String"> |
||||
|
select GROUP_CONCAT(sr.name SEPARATOR '|') as roleName |
||||
|
from sys_user_role sur |
||||
|
left join sys_role sr on sur.roleSid = sr.sid |
||||
|
where sur.userSid = #{sid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectByUser" resultType="java.lang.String"> |
||||
|
select roleSid |
||||
|
from sys_user_role |
||||
|
where userSid = #{userSid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectRoleList" resultType="com.yxt.user.biz.sysuser.SysMenuRoleVoList"> |
||||
|
select sr.sid roleSid, sr.name roleName, sr.roleType, sr.roleTypeValue,smr.dataRuleId |
||||
|
from sys_role sr |
||||
|
left join sys_menu_role smr on sr.sid = smr.roleSid |
||||
|
where smr.menuSid = #{menuSid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectMobileRoleList" resultType="com.yxt.user.biz.sysuser.SysMenuRoleVoList"> |
||||
|
select sr.sid roleSid, sr.name roleName, sr.roleType, sr.roleTypeValue |
||||
|
from sys_role sr |
||||
|
left join sys_mobile_menu_role smr on sr.sid = smr.roleSid |
||||
|
where smr.menuSid = #{menuSid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectByRole" resultType="java.lang.String"> |
||||
|
select smr.dataRuleId from sys_menu_role smr |
||||
|
left join sys_menu sm on sm.sid = smr.menuSid |
||||
|
left join sys_role sr on sr.sid = smr.roleSid |
||||
|
left join sys_user_role sur on sur.roleSid = smr.roleSid |
||||
|
where smr.menuSid = #{menuSid} and sur.userSid = #{userSid} and sr.sid in |
||||
|
<foreach collection="list" item="item" index="index" open="(" separator="," close=")"> |
||||
|
#{item} |
||||
|
</foreach> |
||||
|
and length(smr.dataRuleId)>0 |
||||
|
order by dataRuleId asc |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectByMobileRole" resultType="java.lang.String"> |
||||
|
select smr.dataRuleId from sys_mobile_menu_role smr |
||||
|
left join sys_mobile_menu sm on sm.sid = smr.menuSid |
||||
|
left join sys_role sr on sr.sid = smr.roleSid |
||||
|
left join sys_user_role sur on sur.roleSid = smr.roleSid |
||||
|
where smr.menuSid = #{menuSid} and sur.userSid = #{userSid} |
||||
|
and sr.sid in |
||||
|
<foreach collection="list" item="item" index="index" open="(" separator="," close=")"> |
||||
|
#{item} |
||||
|
</foreach> |
||||
|
and length(smr.dataRuleId)>0 |
||||
|
order by dataRuleId asc |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,38 @@ |
|||||
|
package com.yxt.user.biz.sysrole; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysRoleQuery.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysrole.SysRoleQuery <br/> |
||||
|
* Description: 角色 查询条件. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "角色 查询条件", description = "角色 查询条件") |
||||
|
@Data |
||||
|
public class SysRoleQuery implements Query { |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("角色名称") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("排序") |
||||
|
private Integer sort; |
||||
|
|
||||
|
@ApiModelProperty("编码") |
||||
|
private String code; |
||||
|
|
||||
|
@ApiModelProperty("1、系统管理员、2、普通角色") |
||||
|
private Integer type; |
||||
|
} |
@ -0,0 +1,184 @@ |
|||||
|
package com.yxt.user.biz.sysrole; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.yxt.user.biz.sysuser.SysMenuRoleVoList; |
||||
|
import com.yxt.user.biz.sysuserrole.SysUserRoleService; |
||||
|
import com.yxt.common.base.service.MybatisBaseService; |
||||
|
import com.yxt.common.base.utils.PagerUtil; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysRoleService.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.biz.sysrole.SysRoleService <br/> |
||||
|
* Description: 角色 业务逻辑. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class SysRoleService extends MybatisBaseService<SysRoleMapper, SysRole> { |
||||
|
@Autowired |
||||
|
private SysUserRoleService sysUserRoleService; |
||||
|
public PagerVo<SysRole> listPage(PagerQuery<SysRoleQuery> pq) { |
||||
|
SysRoleQuery query = pq.getParams(); |
||||
|
QueryWrapper<SysRole> qw = createQueryWrapper(query); |
||||
|
IPage<SysRole> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<SysRole> pagging = baseMapper.selectPage(page, qw); |
||||
|
PagerVo<SysRole> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
|
||||
|
public List<SysRole> listAll(SysRoleQuery query) { |
||||
|
QueryWrapper<SysRole> qw = createQueryWrapper(query); |
||||
|
return baseMapper.selectList(qw); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<SysRole> createQueryWrapper(SysRoleQuery query) { |
||||
|
// todo: 这里根据具体业务调整查询条件
|
||||
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
||||
|
QueryWrapper<SysRole> qw = new QueryWrapper<>(); |
||||
|
|
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getName())) { |
||||
|
qw.like("sr.name", query.getName()); |
||||
|
} |
||||
|
|
||||
|
if (query.getSort() != null) { |
||||
|
qw.eq("sr.sort", query.getSort()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getCode())) { |
||||
|
qw.eq("sr.code", query.getCode()); |
||||
|
} |
||||
|
|
||||
|
if (query.getType() != null) { |
||||
|
qw.eq("sr.type", query.getType()); |
||||
|
} |
||||
|
return qw; |
||||
|
} |
||||
|
|
||||
|
public PagerVo<SysRoleVo> listPageVo(PagerQuery<SysRoleQuery> pq) { |
||||
|
SysRoleQuery query = pq.getParams(); |
||||
|
QueryWrapper<SysRole> qw = createQueryWrapper(query); |
||||
|
IPage<SysRole> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<SysRoleVo> pagging = baseMapper.selectPageVo(page, qw); |
||||
|
PagerVo<SysRoleVo> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
|
||||
|
public List<SysRoleVo> listAllVo(SysRoleQuery query) { |
||||
|
QueryWrapper<SysRole> qw = createQueryWrapper(query); |
||||
|
return baseMapper.selectListAllVo(qw); |
||||
|
} |
||||
|
|
||||
|
public List<SysRoleVo> listVo() { |
||||
|
return baseMapper.selectListVo(); |
||||
|
} |
||||
|
|
||||
|
public void saveOrUpdateDto(SysRoleDto dto) { |
||||
|
SysRole entity = new SysRole(); |
||||
|
dto.fillEntity(entity); |
||||
|
this.saveOrUpdate(entity); |
||||
|
} |
||||
|
|
||||
|
public SysRoleVo fetchByIdVo(String id) { |
||||
|
SysRole entity = this.fetchById(id); |
||||
|
SysRoleVo vo = new SysRoleVo(); |
||||
|
BeanUtil.copyProperties(entity, vo); |
||||
|
return vo; |
||||
|
} |
||||
|
|
||||
|
public List<SysRoleVo> fetchByUserSid(String userSid) { |
||||
|
return baseMapper.fetchByUserSid(userSid); |
||||
|
} |
||||
|
|
||||
|
public List<SysRoleVo> listAllByUserSid(String userSid) { |
||||
|
return baseMapper.listAllByUserSid(userSid); |
||||
|
} |
||||
|
|
||||
|
public SysRoleVo fetchByName(String name) { |
||||
|
SysRole entity = baseMapper.fetchByName(name); |
||||
|
SysRoleVo vo = new SysRoleVo(); |
||||
|
BeanUtil.copyProperties(entity, vo); |
||||
|
return vo; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 描述 : <描述函数实现的功能>. <br/> |
||||
|
* <p> |
||||
|
* |
||||
|
* @param sids |
||||
|
* @return |
||||
|
*/ |
||||
|
public int delBySids(String sids) { |
||||
|
String[] split = sids.split(","); |
||||
|
if (split.length < 1) { |
||||
|
return 0; |
||||
|
} else if (split.length == 1) { |
||||
|
//删除该角色下的用户关联
|
||||
|
sysUserRoleService.deleteByRoleSid(sids); |
||||
|
return baseMapper.deleteBySid(sids); |
||||
|
} else { |
||||
|
List<String> list = new ArrayList<>(); |
||||
|
for (String sid : split) { |
||||
|
list.add(sid); |
||||
|
} |
||||
|
return baseMapper.deleteBatchSids(list); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public SysRoleVo fetchBySidVo(String sid) { |
||||
|
SysRoleVo vo = baseMapper.fetchBySid(sid); |
||||
|
return vo; |
||||
|
} |
||||
|
|
||||
|
public int updateIsEnable(String sid, String isEnable) { |
||||
|
return baseMapper.updateIsEnable(sid, isEnable); |
||||
|
} |
||||
|
|
||||
|
public String getLevelType(String roleSid) { |
||||
|
return baseMapper.getLevelType(roleSid); |
||||
|
} |
||||
|
|
||||
|
public String selectRoleSid(String userRoleSid) { |
||||
|
return baseMapper.selectRoleSid(userRoleSid); |
||||
|
} |
||||
|
|
||||
|
public String selectByUserSid(String sid) { |
||||
|
return baseMapper.selectByUserSid(sid); |
||||
|
} |
||||
|
|
||||
|
public List<String> selectByUser(String userSid) { |
||||
|
return baseMapper.selectByUser(userSid); |
||||
|
} |
||||
|
|
||||
|
public List<SysMenuRoleVoList> selectRoleList(String menuSid) { |
||||
|
return baseMapper.selectRoleList(menuSid); |
||||
|
} |
||||
|
|
||||
|
public List<SysMenuRoleVoList> selectMobileRoleList(String menuSid) { |
||||
|
return baseMapper.selectMobileRoleList(menuSid); |
||||
|
} |
||||
|
|
||||
|
public List<String> selectByRole(List<String> roleSidList, String menuSid,String userSid) { |
||||
|
return baseMapper.selectByRole(roleSidList,menuSid,userSid); |
||||
|
} |
||||
|
|
||||
|
public List<String> selectByMobileRole(List<String> roleSidList, String menuSid, String userSid) { |
||||
|
return baseMapper.selectByMobileRole(roleSidList,menuSid,userSid); |
||||
|
} |
||||
|
} |
@ -0,0 +1,47 @@ |
|||||
|
package com.yxt.user.biz.sysrole; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysRoleVo.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysrole.SysRoleVo <br/> |
||||
|
* Description: 角色 视图数据对象. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "角色 视图数据对象", description = "角色 视图数据对象") |
||||
|
@Data |
||||
|
public class SysRoleVo implements Vo { |
||||
|
@ApiModelProperty("角色名称") |
||||
|
private String name; |
||||
|
@ApiModelProperty("排序") |
||||
|
private Integer sort; |
||||
|
@ApiModelProperty("编码") |
||||
|
private String code; |
||||
|
@ApiModelProperty("1、系统管理员、2、普通角色") |
||||
|
private Integer type; |
||||
|
@ApiModelProperty("角色sid") |
||||
|
private String sid; |
||||
|
@ApiModelProperty("说明") |
||||
|
private String remarks; |
||||
|
@ApiModelProperty("是否选中,1:未选中,0:选中") |
||||
|
private String checked; |
||||
|
@ApiModelProperty("是否可用") |
||||
|
private String isEnable; |
||||
|
@ApiModelProperty("岗位sid") |
||||
|
private String postSid; |
||||
|
@ApiModelProperty("岗位名称") |
||||
|
private String postName; |
||||
|
@ApiModelProperty(value = "组织层级") |
||||
|
private String roleTypeValue; |
||||
|
} |
@ -0,0 +1,76 @@ |
|||||
|
package com.yxt.user.biz.syssource; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.yxt.common.core.domain.BaseEntity; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysSource.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.syssource.SysSource <br/> |
||||
|
* Description: 资源表. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "资源表", description = "资源表") |
||||
|
@TableName("sys_source") |
||||
|
@Data |
||||
|
public class SysSource extends BaseEntity { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("父资源sid") |
||||
|
private String pSid; |
||||
|
|
||||
|
@ApiModelProperty("资源ID(对应微服务的名称)") |
||||
|
private String sourceId; |
||||
|
|
||||
|
@ApiModelProperty("资源名称(业务模块名称)") |
||||
|
private String sourceName; |
||||
|
|
||||
|
@ApiModelProperty("web页面的url(平台中业务模块跳转地址)") |
||||
|
private String pageUrl; |
||||
|
|
||||
|
@ApiModelProperty("菜单图标地址") |
||||
|
private String iconUrl; |
||||
|
|
||||
|
@ApiModelProperty("资源图标背景颜色") |
||||
|
private String iconBgColor; |
||||
|
|
||||
|
@ApiModelProperty("资源url标识") |
||||
|
private String urlSign; |
||||
|
|
||||
|
@ApiModelProperty("排序号") |
||||
|
private Integer sortNo; |
||||
|
|
||||
|
@ApiModelProperty("资源类别(0.内置Activity 1.内置WebView 2.RePlugin插件 3.原生apk 4.We页面)") |
||||
|
private Integer sourceType; |
||||
|
|
||||
|
@ApiModelProperty("模块的版本(type = 2,3有),移动端专用") |
||||
|
private String ver; |
||||
|
|
||||
|
@ApiModelProperty("apk下载地址(type = 2,3有),移动端专用") |
||||
|
private String sourceUrl; |
||||
|
|
||||
|
@ApiModelProperty("模块的包名,移动端专用") |
||||
|
private String sourcePackage; |
||||
|
|
||||
|
@ApiModelProperty("启动模块的动作(0.启动Activity的包名+类名 1.html地址 2.启动Activity的包名+类名 3.intent-action ),移动端专用") |
||||
|
private String sourceAction; |
||||
|
|
||||
|
@ApiModelProperty("需要用到的json拼接(由目标模块 自行解析),其他参数") |
||||
|
private String sourceExtra; |
||||
|
|
||||
|
@ApiModelProperty("提示数量(没有返回0即可)") |
||||
|
private String noticeNum; |
||||
|
|
||||
|
@ApiModelProperty("RePlugin插件名称(type = 2有),移动端专用") |
||||
|
private String modulePluginName; |
||||
|
} |
@ -0,0 +1,76 @@ |
|||||
|
package com.yxt.user.biz.syssource; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.dto.Dto; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysSourceDto.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.syssource.SysSourceDto <br/> |
||||
|
* Description: 资源表 数据传输对象. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "资源表 数据传输对象", description = "资源表 数据传输对象") |
||||
|
@Data |
||||
|
public class SysSourceDto implements Dto { |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("父资源sid") |
||||
|
private String pSid; |
||||
|
|
||||
|
@ApiModelProperty("资源ID(对应微服务的名称)") |
||||
|
private String sourceId; |
||||
|
|
||||
|
@ApiModelProperty("资源名称(业务模块名称)") |
||||
|
private String sourceName; |
||||
|
|
||||
|
@ApiModelProperty("web页面的url(平台中业务模块跳转地址)") |
||||
|
private String pageUrl; |
||||
|
|
||||
|
@ApiModelProperty("菜单图标地址") |
||||
|
private String iconUrl; |
||||
|
|
||||
|
@ApiModelProperty("资源图标背景颜色") |
||||
|
private String iconBgColor; |
||||
|
|
||||
|
@ApiModelProperty("资源url标识") |
||||
|
private String urlSign; |
||||
|
|
||||
|
@ApiModelProperty("排序号") |
||||
|
private Integer sortNo; |
||||
|
|
||||
|
@ApiModelProperty("资源类别(0.内置Activity 1.内置WebView 2.RePlugin插件 3.原生apk 4.We页面)") |
||||
|
private Integer sourceType; |
||||
|
|
||||
|
@ApiModelProperty("模块的版本(type = 2,3有),移动端专用") |
||||
|
private String ver; |
||||
|
|
||||
|
@ApiModelProperty("apk下载地址(type = 2,3有),移动端专用") |
||||
|
private String sourceUrl; |
||||
|
|
||||
|
@ApiModelProperty("模块的包名,移动端专用") |
||||
|
private String sourcePackage; |
||||
|
|
||||
|
@ApiModelProperty("启动模块的动作(0.启动Activity的包名+类名 1.html地址 2.启动Activity的包名+类名 3.intent-action ),移动端专用") |
||||
|
private String sourceAction; |
||||
|
|
||||
|
@ApiModelProperty("需要用到的json拼接(由目标模块 自行解析),其他参数") |
||||
|
private String sourceExtra; |
||||
|
|
||||
|
@ApiModelProperty("提示数量(没有返回0即可)") |
||||
|
private String noticeNum; |
||||
|
@ApiModelProperty("RePlugin插件名称(type = 2有),移动端专用") |
||||
|
private String modulePluginName; |
||||
|
@ApiModelProperty("描述") |
||||
|
private String remarks; |
||||
|
|
||||
|
} |
@ -0,0 +1,73 @@ |
|||||
|
package com.yxt.user.biz.syssource; |
||||
|
|
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysSourceFeign.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.syssource.SysSourceFeign <br/> |
||||
|
* Description: 资源表. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Api(tags = "资源表") |
||||
|
@FeignClient( |
||||
|
contextId = "anrui-portal-SysSource", |
||||
|
name = "anrui-portal", |
||||
|
path = "v1/syssource", |
||||
|
fallback = SysSourceFeignFallback.class) |
||||
|
public interface SysSourceFeign { |
||||
|
|
||||
|
@ApiOperation("根据条件分页查询数据的列表") |
||||
|
@PostMapping("/listPage") |
||||
|
public ResultBean<PagerVo<SysSourceVo>> listPage(@RequestBody PagerQuery<SysSourceQuery> pq); |
||||
|
|
||||
|
@ApiOperation("根据条件查询所有数据列表") |
||||
|
@PostMapping("/listAll") |
||||
|
public ResultBean<List<SysSourceVo>> listAll(@RequestBody SysSourceQuery query); |
||||
|
@ApiOperation("根据角色sid条件查询所有数据列表") |
||||
|
@PostMapping("/listAllByRoleSid") |
||||
|
public ResultBean<List<SysSourceVo>> listAllByRoleSid(@RequestBody SysSourceQuery query); |
||||
|
|
||||
|
@ApiOperation("所有数据列表") |
||||
|
@GetMapping("/list") |
||||
|
public ResultBean<List<SysSourceVo>> list(); |
||||
|
|
||||
|
@ApiOperation("新增保存") |
||||
|
@PostMapping("/save") |
||||
|
public ResultBean save(@RequestBody SysSourceDto dto); |
||||
|
|
||||
|
@ApiOperation("修改保存") |
||||
|
@PostMapping("/update/{sid}") |
||||
|
public ResultBean update(@RequestBody SysSourceDto dto,@PathVariable("sid") String sid); |
||||
|
|
||||
|
@ApiOperation("删除记录") |
||||
|
@GetMapping("/del/{ids}") |
||||
|
public ResultBean del(@PathVariable("ids") String ids); |
||||
|
@ApiOperation("删除记录 根据sid") |
||||
|
@GetMapping("/delBySids/{sids}") |
||||
|
public ResultBean delBySids(@PathVariable("sids") String sids); |
||||
|
|
||||
|
@ApiOperation("获取一条记录") |
||||
|
@GetMapping("/fetch/{id}") |
||||
|
public ResultBean<SysSourceVo> fetch(@PathVariable("id") String id); |
||||
|
@ApiOperation("获取一条记录 根据sid") |
||||
|
@GetMapping("/fetchBySid/{sid}") |
||||
|
public ResultBean<SysSourceVo> fetchBySid(@PathVariable("sid") String sid); |
||||
|
} |
@ -0,0 +1,81 @@ |
|||||
|
package com.yxt.user.biz.syssource; |
||||
|
|
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysSourceFeignFallback.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.syssource.SysSourceFeignFallback <br/> |
||||
|
* Description: 资源表. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class SysSourceFeignFallback implements SysSourceFeign { |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean<PagerVo<SysSourceVo>> listPage(PagerQuery<SysSourceQuery> pq){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
return rb.setMsg("接口anrui_portal/syssource/listPage无法访问"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean<List<SysSourceVo>> listAll(SysSourceQuery query){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
return rb.setMsg("接口anrui_portal/syssource/listAll无法访问"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean<List<SysSourceVo>> listAllByRoleSid(SysSourceQuery query) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
return rb.setMsg("接口anrui_portal/syssource/listAllByRoleSid无法访问"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean<List<SysSourceVo>> list(){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
return rb.setMsg("接口anrui_portal/syssource/list无法访问"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean save(SysSourceDto dto){ |
||||
|
return ResultBean.fireFail().setMsg("接口anrui_portal/syssource/save无法访问"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean update(SysSourceDto dto,String sid){ |
||||
|
return ResultBean.fireFail().setMsg("接口anrui_portal/syssource/update无法访问"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean del(String ids){ |
||||
|
return ResultBean.fireFail().setMsg("接口anrui_portal/syssource/del无法访问"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean delBySids(String sids) { |
||||
|
return ResultBean.fireFail().setMsg("接口anrui_portal/syssource/delBySids无法访问"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean<SysSourceVo> fetch(String id){ |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
return rb.setMsg("接口anrui_portal/syssource/fetch无法访问"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public ResultBean<SysSourceVo> fetchBySid(String sid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
return rb.setMsg("接口anrui_portal/syssource/fetchBySid无法访问"); |
||||
|
} |
||||
|
} |
@ -0,0 +1,54 @@ |
|||||
|
package com.yxt.user.biz.syssource; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
|
import com.yxt.user.biz.sysfunction.SysFunctionTreeVo; |
||||
|
import com.yxt.user.biz.sysmenu.SysMenuTreeVo; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.apache.ibatis.annotations.Select; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysSourceMapper.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.biz.syssource.SysSourceMapper <br/> |
||||
|
* Description: 资源表. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface SysSourceMapper extends BaseMapper<SysSource> { |
||||
|
|
||||
|
//@Update("update sys_source set name=#{msg} where id=#{id}")
|
||||
|
//IPage<SysSourceVo> voPage(IPage<SysSource> page, @Param(Constants.WRAPPER) QueryWrapper<SysSource> qw);
|
||||
|
|
||||
|
IPage<SysSourceVo> selectPageVo(IPage<SysSource> page, @Param(Constants.WRAPPER) Wrapper<SysSource> qw); |
||||
|
|
||||
|
List<SysSourceVo> selectListAllVo(@Param(Constants.WRAPPER) Wrapper<SysSource> qw); |
||||
|
|
||||
|
@Select("select * from sys_source") |
||||
|
List<SysSourceVo> selectListVo(); |
||||
|
|
||||
|
@Select("select * from sys_source where sid=#{sid}") |
||||
|
SysSource fetchBySidVo(@Param("sid") String sid); |
||||
|
|
||||
|
List<SysSourceVo> listAllByRoleSid(String roleSid); |
||||
|
|
||||
|
/** |
||||
|
* 查询所有的资源列表 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
List<SysMenuTreeVo> listMenuTreeVo(); |
||||
|
|
||||
|
List<SysFunctionTreeVo> listFunctionTreeVo(String name); |
||||
|
} |
@ -0,0 +1,45 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.yxt.user.biz.syssource.SysSourceMapper"> |
||||
|
<!-- <where> ${ew.sqlSegment} </where>--> |
||||
|
<!-- ${ew.customSqlSegment} --> |
||||
|
<select id="selectPageVo" resultType="com.yxt.user.biz.syssource.SysSourceVo"> |
||||
|
SELECT * |
||||
|
FROM sys_source |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectListAllVo" resultType="com.yxt.user.biz.syssource.SysSourceVo"> |
||||
|
SELECT * |
||||
|
FROM sys_source |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="listAllByRoleSid" resultType="com.yxt.user.biz.syssource.SysSourceVo"> |
||||
|
SELECT source.*, ISNULL(sourceRole.sid) as checked |
||||
|
FROM sys_source source |
||||
|
left join sys_source_role sourceRole |
||||
|
on source.sid = sourceRole.sorceSid and sourceRole.roleSid = #{param1} |
||||
|
</select> |
||||
|
<select id="listFunctionTreeVo" resultType="com.yxt.user.biz.sysfunction.SysFunctionTreeVo"> |
||||
|
select sourceName as name, sourceName as sourceName, sid as sourceSid, sid as sid |
||||
|
from sys_source |
||||
|
where sourceName like '${name}%' |
||||
|
</select> |
||||
|
<!--查询所有的资源列表--> |
||||
|
<select id="listMenuTreeVo" resultType="com.yxt.user.biz.sysmenu.SysMenuTreeVo"> |
||||
|
select |
||||
|
<!--菜单名称--> |
||||
|
sourceName as name, |
||||
|
<!--资源名称--> |
||||
|
sourceName as sourceName, |
||||
|
<!--资源sid--> |
||||
|
sid as sourceSid, |
||||
|
<!--菜单sid--> |
||||
|
sid as sid |
||||
|
from sys_source |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,78 @@ |
|||||
|
package com.yxt.user.biz.syssource; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysSourceQuery.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.syssource.SysSourceQuery <br/> |
||||
|
* Description: 资源表 查询条件. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "资源表 查询条件", description = "资源表 查询条件") |
||||
|
@Data |
||||
|
public class SysSourceQuery implements Query { |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("父资源sid") |
||||
|
private String pSid; |
||||
|
|
||||
|
@ApiModelProperty("资源ID(对应微服务的名称)") |
||||
|
private String sourceId; |
||||
|
|
||||
|
@ApiModelProperty("角色sid") |
||||
|
private String roleSid; |
||||
|
|
||||
|
@ApiModelProperty("资源名称(业务模块名称)") |
||||
|
private String sourceName; |
||||
|
|
||||
|
@ApiModelProperty("web页面的url(平台中业务模块跳转地址)") |
||||
|
private String pageUrl; |
||||
|
|
||||
|
@ApiModelProperty("菜单图标地址") |
||||
|
private String iconUrl; |
||||
|
|
||||
|
@ApiModelProperty("资源图标背景颜色") |
||||
|
private String iconBgColor; |
||||
|
|
||||
|
@ApiModelProperty("资源url标识") |
||||
|
private String urlSign; |
||||
|
|
||||
|
@ApiModelProperty("排序号") |
||||
|
private Integer sortNo; |
||||
|
|
||||
|
@ApiModelProperty("资源类别(0.内置Activity 1.内置WebView 2.RePlugin插件 3.原生apk 4.We页面)") |
||||
|
private Integer sourceType; |
||||
|
|
||||
|
@ApiModelProperty("模块的版本(type = 2,3有),移动端专用") |
||||
|
private String ver; |
||||
|
|
||||
|
@ApiModelProperty("apk下载地址(type = 2,3有),移动端专用") |
||||
|
private String sourceUrl; |
||||
|
|
||||
|
@ApiModelProperty("模块的包名,移动端专用") |
||||
|
private String sourcePackage; |
||||
|
|
||||
|
@ApiModelProperty("启动模块的动作(0.启动Activity的包名+类名 1.html地址 2.启动Activity的包名+类名 3.intent-action ),移动端专用") |
||||
|
private String sourceAction; |
||||
|
|
||||
|
@ApiModelProperty("需要用到的json拼接(由目标模块 自行解析),其他参数") |
||||
|
private String sourceExtra; |
||||
|
|
||||
|
@ApiModelProperty("提示数量(没有返回0即可)") |
||||
|
private String noticeNum; |
||||
|
|
||||
|
@ApiModelProperty("RePlugin插件名称(type = 2有),移动端专用") |
||||
|
private String modulePluginName; |
||||
|
|
||||
|
} |
@ -0,0 +1,172 @@ |
|||||
|
package com.yxt.user.biz.syssource; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.yxt.user.biz.sysfunction.SysFunctionTreeVo; |
||||
|
import com.yxt.user.biz.sysmenu.SysMenuTreeVo; |
||||
|
import com.yxt.common.base.service.MybatisBaseService; |
||||
|
import com.yxt.common.base.utils.PagerUtil; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysSourceService.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.biz.syssource.SysSourceService <br/> |
||||
|
* Description: 资源表 业务逻辑. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class SysSourceService extends MybatisBaseService<SysSourceMapper, SysSource> { |
||||
|
public PagerVo<SysSource> listPage(PagerQuery<SysSourceQuery> pq) { |
||||
|
SysSourceQuery query = pq.getParams(); |
||||
|
QueryWrapper<SysSource> qw = createQueryWrapper(query); |
||||
|
IPage<SysSource> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<SysSource> pagging = baseMapper.selectPage(page, qw); |
||||
|
PagerVo<SysSource> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
public List<SysSource> listAll(SysSourceQuery query) { |
||||
|
QueryWrapper<SysSource> qw = createQueryWrapper(query); |
||||
|
return baseMapper.selectList(qw); |
||||
|
} |
||||
|
private QueryWrapper<SysSource> createQueryWrapper(SysSourceQuery query) { |
||||
|
// todo: 这里根据具体业务调整查询条件
|
||||
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
||||
|
QueryWrapper<SysSource> qw = new QueryWrapper<>(); |
||||
|
|
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getPSid())) { |
||||
|
qw.eq("pSid", query.getPSid()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getSourceId())) { |
||||
|
qw.eq("sourceId", query.getSourceId()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getSourceName())) { |
||||
|
qw.like("sourceName", query.getSourceName()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getPageUrl())) { |
||||
|
qw.eq("pageUrl", query.getPageUrl()); |
||||
|
} |
||||
|
|
||||
|
if (query.getIconUrl() != null) { |
||||
|
qw.eq("iconUrl", query.getIconUrl()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getIconBgColor())) { |
||||
|
qw.eq("iconBgColor", query.getIconBgColor()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getUrlSign())) { |
||||
|
qw.eq("urlSign", query.getUrlSign()); |
||||
|
} |
||||
|
|
||||
|
if (query.getSortNo() != null) { |
||||
|
qw.eq("sortNo", query.getSortNo()); |
||||
|
} |
||||
|
|
||||
|
if (query.getSourceType() != null) { |
||||
|
qw.eq("sourceType", query.getSourceType()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getVer())) { |
||||
|
qw.eq("ver", query.getVer()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getSourceUrl())) { |
||||
|
qw.eq("sourceUrl", query.getSourceUrl()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getSourcePackage())) { |
||||
|
qw.eq("sourcePackage", query.getSourcePackage()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getSourceAction())) { |
||||
|
qw.eq("sourceAction", query.getSourceAction()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getSourceExtra())) { |
||||
|
qw.eq("sourceExtra", query.getSourceExtra()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getNoticeNum())) { |
||||
|
qw.eq("noticeNum", query.getNoticeNum()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getModulePluginName())) { |
||||
|
qw.eq("modulePluginName", query.getModulePluginName()); |
||||
|
} |
||||
|
return qw; |
||||
|
} |
||||
|
|
||||
|
public PagerVo<SysSourceVo> listPageVo(PagerQuery<SysSourceQuery> pq) { |
||||
|
SysSourceQuery query = pq.getParams(); |
||||
|
QueryWrapper<SysSource> qw = createQueryWrapper(query); |
||||
|
IPage<SysSource> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<SysSourceVo> pagging = baseMapper.selectPageVo(page, qw); |
||||
|
PagerVo<SysSourceVo> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
|
||||
|
public List<SysSourceVo> listAllVo(SysSourceQuery query) { |
||||
|
QueryWrapper<SysSource> qw = createQueryWrapper(query); |
||||
|
return baseMapper.selectListAllVo(qw); |
||||
|
} |
||||
|
|
||||
|
public List<SysSourceVo> listVo() { |
||||
|
return baseMapper.selectListVo(); |
||||
|
} |
||||
|
|
||||
|
public void saveOrUpdateDto(SysSourceDto dto){ |
||||
|
SysSource entity = new SysSource(); |
||||
|
dto.fillEntity(entity); |
||||
|
this.saveOrUpdate(entity); |
||||
|
} |
||||
|
|
||||
|
public SysSourceVo fetchByIdVo(String id){ |
||||
|
SysSource entity = this.fetchById(id); |
||||
|
SysSourceVo vo = new SysSourceVo(); |
||||
|
BeanUtil.copyProperties(entity, vo); |
||||
|
return vo; |
||||
|
} |
||||
|
|
||||
|
public SysSourceVo fetchBySidVo(String sid) { |
||||
|
SysSource entity = baseMapper.fetchBySidVo(sid); |
||||
|
SysSourceVo vo = new SysSourceVo(); |
||||
|
BeanUtil.copyProperties(entity, vo); |
||||
|
return vo; |
||||
|
} |
||||
|
|
||||
|
public List<SysSourceVo> listAllByRoleSid(SysSourceQuery query) { |
||||
|
return baseMapper.listAllByRoleSid(query.getRoleSid()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询所有的资源列表 |
||||
|
* |
||||
|
* @return |
||||
|
*/ |
||||
|
public List<SysMenuTreeVo> listMenuTreeVo() { |
||||
|
return baseMapper.listMenuTreeVo(); |
||||
|
} |
||||
|
|
||||
|
public List<SysFunctionTreeVo> listFunctionTreeVo(String name) { |
||||
|
return baseMapper.listFunctionTreeVo(name); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,85 @@ |
|||||
|
package com.yxt.user.biz.syssource; |
||||
|
|
||||
|
|
||||
|
import com.yxt.user.biz.sysmenu.SysMenuVo; |
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysSourceVo.java <br/> |
||||
|
* Class: com.yxt.user.biz.syssource.SysSourceVo <br/> |
||||
|
* Description: 资源表 视图数据对象. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "资源表 视图数据对象", description = "资源表 视图数据对象") |
||||
|
@Data |
||||
|
public class SysSourceVo implements Vo { |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("父资源sid") |
||||
|
private String pSid; |
||||
|
|
||||
|
@ApiModelProperty("资源ID(对应微服务的名称)") |
||||
|
private String sourceId; |
||||
|
|
||||
|
@ApiModelProperty("资源名称(业务模块名称)") |
||||
|
private String sourceName; |
||||
|
|
||||
|
@ApiModelProperty("web页面的url(平台中业务模块跳转地址)") |
||||
|
private String pageUrl; |
||||
|
|
||||
|
@ApiModelProperty("菜单图标地址") |
||||
|
private String iconUrl; |
||||
|
|
||||
|
@ApiModelProperty("资源图标背景颜色") |
||||
|
private String iconBgColor; |
||||
|
|
||||
|
@ApiModelProperty("资源url标识") |
||||
|
private String urlSign; |
||||
|
|
||||
|
@ApiModelProperty("排序号") |
||||
|
private Integer sortNo; |
||||
|
|
||||
|
@ApiModelProperty("资源类别(0.内置Activity 1.内置WebView 2.RePlugin插件 3.原生apk 4.We页面)") |
||||
|
private Integer sourceType; |
||||
|
|
||||
|
@ApiModelProperty("模块的版本(type = 2,3有),移动端专用") |
||||
|
private String ver; |
||||
|
|
||||
|
@ApiModelProperty("apk下载地址(type = 2,3有),移动端专用") |
||||
|
private String sourceUrl; |
||||
|
|
||||
|
@ApiModelProperty("模块的包名,移动端专用") |
||||
|
private String sourcePackage; |
||||
|
|
||||
|
@ApiModelProperty("启动模块的动作(0.启动Activity的包名+类名 1.html地址 2.启动Activity的包名+类名 3.intent-action ),移动端专用") |
||||
|
private String sourceAction; |
||||
|
|
||||
|
@ApiModelProperty("需要用到的json拼接(由目标模块 自行解析),其他参数") |
||||
|
private String sourceExtra; |
||||
|
|
||||
|
@ApiModelProperty("提示数量(没有返回0即可)") |
||||
|
private String noticeNum; |
||||
|
|
||||
|
@ApiModelProperty("RePlugin插件名称(type = 2有),移动端专用") |
||||
|
private String modulePluginName; |
||||
|
@ApiModelProperty("sid") |
||||
|
private String sid; |
||||
|
@ApiModelProperty("是否选中 1没有选中,0选中") |
||||
|
private String checked; |
||||
|
@ApiModelProperty("描述") |
||||
|
private String remarks; |
||||
|
@ApiModelProperty("菜单集合") |
||||
|
private List<SysMenuVo> children; |
||||
|
} |
@ -0,0 +1,34 @@ |
|||||
|
package com.yxt.user.biz.sysstaffinfo; |
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author liuguohui |
||||
|
* @Date 2021/9/17 |
||||
|
*/ |
||||
|
@ApiModel(value = "App通讯录查看详情") |
||||
|
@Data |
||||
|
public class AppContactsDetailsVo implements Vo { |
||||
|
|
||||
|
// @ApiModelProperty("人员sid")
|
||||
|
// private String sid;
|
||||
|
|
||||
|
@ApiModelProperty("姓名") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("手机号") |
||||
|
private String mobile; |
||||
|
|
||||
|
@ApiModelProperty("头像") |
||||
|
private String headImage; |
||||
|
|
||||
|
@ApiModelProperty("部门名称(路径)") |
||||
|
private String orgNamePath; |
||||
|
|
||||
|
@ApiModelProperty("职位") |
||||
|
private String position; |
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
package com.yxt.user.biz.sysstaffinfo; |
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/5/20 15:47 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Data |
||||
|
public class PcSysStaffQuery implements Query { |
||||
|
private static final long serialVersionUID = 1858291601540877140L; |
||||
|
@ApiModelProperty(value = "业务员sid",required = false) |
||||
|
private String staffSid; |
||||
|
|
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
package com.yxt.user.biz.sysstaffinfo; |
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/5/20 15:44 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Data |
||||
|
public class PcSysStaffVo implements Vo { |
||||
|
private static final long serialVersionUID = -9042032921079833819L; |
||||
|
@ApiModelProperty("用户sid") |
||||
|
private String userSid; |
||||
|
@ApiModelProperty("人员") |
||||
|
private String staffName; |
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
package com.yxt.user.biz.sysstaffinfo; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import javax.validation.constraints.NotNull; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/2/15 15:22 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Data |
||||
|
public class SysStaffQuery implements Query { |
||||
|
private static final long serialVersionUID = -7345786610678948794L; |
||||
|
|
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@ApiModelProperty(value = "离职日期") |
||||
|
@NotNull(message = "离职日期不能为空") |
||||
|
private Date quitDate; |
||||
|
@ApiModelProperty(value = "离职原因") |
||||
|
@NotBlank(message = "离职原因不能为空") |
||||
|
private String quitReason; |
||||
|
@ApiModelProperty(value = "员工sid") |
||||
|
private String sid; |
||||
|
} |
@ -0,0 +1,173 @@ |
|||||
|
package com.yxt.user.biz.sysstaffinfo; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.yxt.common.core.domain.BaseEntity; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysStaffinfo.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysstaffinfo.SysStaffinfo <br/> |
||||
|
* Description: 人员基础信息表. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:30 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "人员基础信息表", description = "人员基础信息表") |
||||
|
@TableName("sys_staffinfo") |
||||
|
@Data |
||||
|
public class SysStaffinfo extends BaseEntity { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
@ApiModelProperty("工号") |
||||
|
private String jobNumber; |
||||
|
@ApiModelProperty("姓名") |
||||
|
private String name; |
||||
|
@ApiModelProperty("性别key:1男,2女") |
||||
|
private Integer genderKey; |
||||
|
@ApiModelProperty(value = "性别") |
||||
|
private String gender; |
||||
|
@ApiModelProperty("身份证号") |
||||
|
private String idNo; |
||||
|
@ApiModelProperty("证件有效期") |
||||
|
private String idTerm; |
||||
|
@ApiModelProperty("生日") |
||||
|
private Date birthday; |
||||
|
@ApiModelProperty("民族") |
||||
|
private String national; |
||||
|
@ApiModelProperty(value = "民族key") |
||||
|
private String nationalKey; |
||||
|
@ApiModelProperty("籍贯") |
||||
|
private String nativePlace; |
||||
|
@ApiModelProperty(value = "省") |
||||
|
private String province; |
||||
|
@ApiModelProperty(value = "市") |
||||
|
private String city; |
||||
|
@ApiModelProperty(value = "县区") |
||||
|
private String county; |
||||
|
@ApiModelProperty(value = "省code") |
||||
|
private String provinceCode; |
||||
|
@ApiModelProperty(value = "市code") |
||||
|
private String cityCode; |
||||
|
@ApiModelProperty(value = "县区code") |
||||
|
private String countyCode; |
||||
|
@ApiModelProperty("住址") |
||||
|
private String address; |
||||
|
@ApiModelProperty("手机号") |
||||
|
private String mobile; |
||||
|
@ApiModelProperty("邮箱") |
||||
|
private String email; |
||||
|
@ApiModelProperty(value = "紧急联系人") |
||||
|
private String emergencyContact; |
||||
|
@ApiModelProperty(value = "紧急联系电话") |
||||
|
private String emergencyMobile; |
||||
|
@ApiModelProperty("政治面貌") |
||||
|
private String poliCode; |
||||
|
@ApiModelProperty(value = "政治面貌key") |
||||
|
private String poliCodeKey; |
||||
|
@ApiModelProperty("婚姻状况") |
||||
|
private String maritalStatus; |
||||
|
@ApiModelProperty("婚姻状况key") |
||||
|
private String maritalStatusKey; |
||||
|
@ApiModelProperty("员工类型(无类型、全职、兼职、实习、劳务派遣、退休返聘、劳务外包)") |
||||
|
private String personType; |
||||
|
@ApiModelProperty("员工类型key") |
||||
|
private String personTypeKey; |
||||
|
@ApiModelProperty("入职时间") |
||||
|
private Date joinCompnyDate; |
||||
|
@ApiModelProperty("试用期(无试用期、1个月、2个月、3个月、其他)") |
||||
|
private String probPeriod; |
||||
|
@ApiModelProperty("试用期key") |
||||
|
private String probPeriodKey; |
||||
|
@ApiModelProperty("计划转正日期") |
||||
|
private Date plannedConfirmDate; |
||||
|
@ApiModelProperty("实际转正日期") |
||||
|
private Date confirmationDate; |
||||
|
@ApiModelProperty("银行卡号") |
||||
|
private String bankCardNo; |
||||
|
@ApiModelProperty("开户行") |
||||
|
private String openBank; |
||||
|
@ApiModelProperty("身份证(人像面)") |
||||
|
private String idCardA; |
||||
|
@ApiModelProperty("身份证(国徽面)") |
||||
|
private String idCardB; |
||||
|
@ApiModelProperty("学历证书") |
||||
|
private String diploma; |
||||
|
@ApiModelProperty("学位证书") |
||||
|
private String degreeCertificate; |
||||
|
@ApiModelProperty("前公司离职证明") |
||||
|
private String leaveCertificate; |
||||
|
@ApiModelProperty("员工照片") |
||||
|
private String photo; |
||||
|
@ApiModelProperty("姓名的拼音(全)") |
||||
|
private String pinYinName; |
||||
|
@ApiModelProperty("姓名拼音的首字母(特殊的#表示)") |
||||
|
private String firstPinYinLabel; |
||||
|
@ApiModelProperty(value = "毕业院校") |
||||
|
private String graduate; |
||||
|
@ApiModelProperty(value = "学历/专业") |
||||
|
private String education; |
||||
|
private String educationKey; |
||||
|
@ApiModelProperty(value = "职称") |
||||
|
private String title; |
||||
|
@ApiModelProperty(value = "资格认证") |
||||
|
private String qualification; |
||||
|
@ApiModelProperty(value = "驾照类型") |
||||
|
private String licenseType; |
||||
|
@ApiModelProperty(value = "驾照类型key") |
||||
|
private String licenseTypeKey; |
||||
|
@ApiModelProperty(value = "意外险参保:1是,0否") |
||||
|
private Integer isHaveInsurance; |
||||
|
@ApiModelProperty(value = "意外险参保时间") |
||||
|
private Date insuranceStartDate; |
||||
|
@ApiModelProperty(value = "意外险参保终止日期") |
||||
|
private Date insuranceEndDate; |
||||
|
@ApiModelProperty(value = "意外险参保地") |
||||
|
private String insuranceAddr; |
||||
|
|
||||
|
@ApiModelProperty(value = "养老:1是,0否") |
||||
|
private Integer isHaveAged; |
||||
|
@ApiModelProperty(value = "医疗:1是,0否") |
||||
|
private Integer isHaveMedical; |
||||
|
@ApiModelProperty(value = "工伤:1是,0否") |
||||
|
private Integer isHaveInjury; |
||||
|
@ApiModelProperty(value = "失业:1是,0否") |
||||
|
private Integer isHaveUnemploy; |
||||
|
@ApiModelProperty(value = "社保参保地") |
||||
|
private String insuredPlace; |
||||
|
@ApiModelProperty(value = "纸质档案保管地") |
||||
|
private String paperPlace; |
||||
|
|
||||
|
@ApiModelProperty(value = "合同起止日期") |
||||
|
private Date contractStartDate; |
||||
|
@ApiModelProperty(value = "合同结束日期") |
||||
|
private Date contractEndDate; |
||||
|
@ApiModelProperty(value = "离职日期") |
||||
|
private Date quitDate; |
||||
|
@ApiModelProperty(value = "离职原因") |
||||
|
private String quitReason; |
||||
|
|
||||
|
//=====================================================================//
|
||||
|
@ApiModelProperty("首次参加工作时间") |
||||
|
private Date jobDateStart; |
||||
|
@ApiModelProperty("户籍类型") |
||||
|
private String residenceType; |
||||
|
@ApiModelProperty("个人社保账号") |
||||
|
private String socialAccount; |
||||
|
@ApiModelProperty("个人公积金账号") |
||||
|
private String fundAccount; |
||||
|
@ApiModelProperty("职位") |
||||
|
private String position; |
||||
|
@ApiModelProperty("岗位职级") |
||||
|
private String postRank; |
||||
|
@ApiModelProperty("身份证地址") |
||||
|
private String idAddrs; |
||||
|
} |
@ -0,0 +1,34 @@ |
|||||
|
package com.yxt.user.biz.sysstaffinfo; |
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author liuguohui |
||||
|
* @Date 2021/9/24 |
||||
|
*/ |
||||
|
@ApiModel(value = "App通讯录(搜索)") |
||||
|
@Data |
||||
|
public class SysStaffinfoAppContactsSearchVo implements Vo { |
||||
|
|
||||
|
@ApiModelProperty("人员sid") |
||||
|
private String sid; |
||||
|
|
||||
|
@ApiModelProperty("用户头像") |
||||
|
private String headImage; |
||||
|
|
||||
|
@ApiModelProperty("姓名") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("手机号") |
||||
|
private String mobile; |
||||
|
|
||||
|
@ApiModelProperty("职位") |
||||
|
private String position; |
||||
|
|
||||
|
@ApiModelProperty("部门名称") |
||||
|
private String orgName; |
||||
|
} |
@ -0,0 +1,34 @@ |
|||||
|
package com.yxt.user.biz.sysstaffinfo; |
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @Author liuguohui |
||||
|
* @Date 2021/9/16 |
||||
|
*/ |
||||
|
@ApiModel(value = "App通讯录") |
||||
|
@Data |
||||
|
public class SysStaffinfoAppContactsVo implements Vo { |
||||
|
|
||||
|
@ApiModelProperty("人员sid") |
||||
|
private String sid; |
||||
|
|
||||
|
@ApiModelProperty("姓名") |
||||
|
private String name; |
||||
|
|
||||
|
@ApiModelProperty("手机号") |
||||
|
private String mobile; |
||||
|
|
||||
|
@ApiModelProperty("用户头像") |
||||
|
private String headImage; |
||||
|
|
||||
|
@ApiModelProperty("姓名的拼音(全)") |
||||
|
private String pinYinName; |
||||
|
|
||||
|
@ApiModelProperty("姓名拼音的首字母(特殊的#表示)") |
||||
|
private String firstPinYinLabel; |
||||
|
} |
@ -0,0 +1,155 @@ |
|||||
|
package com.yxt.user.biz.sysstaffinfo; |
||||
|
|
||||
|
import com.yxt.user.biz.sysstafforg.SysStaffOrgDetailsVo; |
||||
|
import com.yxt.user.biz.sysstaffpost.SysStaffPostDetailsVo; |
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/2/11 16:12 |
||||
|
* @Description 员工信息的编辑初始化和详情返回数据 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class SysStaffinfoDetailsVo implements Vo { |
||||
|
private static final long serialVersionUID = 1232171677690215067L; |
||||
|
|
||||
|
@ApiModelProperty(value = "工号") |
||||
|
private String jobNumber; |
||||
|
|
||||
|
@ApiModelProperty(value = "姓名") |
||||
|
private String name; |
||||
|
@ApiModelProperty(value = "性别key") |
||||
|
private Integer genderKey; |
||||
|
@ApiModelProperty(value = "性别") |
||||
|
private String gender; |
||||
|
@ApiModelProperty(value = "身份证号") |
||||
|
private String idNo; |
||||
|
@ApiModelProperty(value = "证件有效期") |
||||
|
private String idTerm; |
||||
|
@ApiModelProperty("生日") |
||||
|
private String birthday; |
||||
|
@ApiModelProperty(value = "民族") |
||||
|
private String national; |
||||
|
@ApiModelProperty(value = "民族key") |
||||
|
private String nationalKey; |
||||
|
@ApiModelProperty("籍贯") |
||||
|
private String nativePlace; |
||||
|
@ApiModelProperty(value = "省") |
||||
|
private String province; |
||||
|
@ApiModelProperty(value = "市") |
||||
|
private String city; |
||||
|
@ApiModelProperty(value = "县区") |
||||
|
private String county; |
||||
|
@ApiModelProperty(value = "省code") |
||||
|
private String provinceCode; |
||||
|
@ApiModelProperty(value = "市code") |
||||
|
private String cityCode; |
||||
|
@ApiModelProperty(value = "县区code") |
||||
|
private String countyCode; |
||||
|
@ApiModelProperty("住址") |
||||
|
private String address; |
||||
|
@ApiModelProperty(value = "手机号") |
||||
|
private String mobile; |
||||
|
@ApiModelProperty("邮箱") |
||||
|
private String email; |
||||
|
@ApiModelProperty(value = "紧急联系人") |
||||
|
private String emergencyContact; |
||||
|
@ApiModelProperty(value = "紧急联系电话") |
||||
|
private String emergencyMobile; |
||||
|
@ApiModelProperty("政治面貌") |
||||
|
private String poliCode; |
||||
|
@ApiModelProperty(value = "政治面貌key") |
||||
|
private String poliCodeKey; |
||||
|
@ApiModelProperty("婚姻状况") |
||||
|
private String maritalStatus; |
||||
|
@ApiModelProperty("婚姻状况key") |
||||
|
private String maritalStatusKey; |
||||
|
@ApiModelProperty("员工类型(无类型、全职、兼职、实习、劳务派遣、退休返聘、劳务外包)") |
||||
|
private String personType; |
||||
|
@ApiModelProperty("员工类型key") |
||||
|
private String personTypeKey; |
||||
|
@ApiModelProperty("入职时间") |
||||
|
private String joinCompnyDate; |
||||
|
@ApiModelProperty("试用期(无试用期、1个月、2个月、3个月、其他)") |
||||
|
private String probPeriod; |
||||
|
@ApiModelProperty("试用期key") |
||||
|
private String probPeriodKey; |
||||
|
@ApiModelProperty("计划转正日期") |
||||
|
private String plannedConfirmDate; |
||||
|
@ApiModelProperty("实际转正日期") |
||||
|
private String confirmationDate; |
||||
|
@ApiModelProperty("银行卡号") |
||||
|
private String bankCardNo; |
||||
|
@ApiModelProperty("开户行") |
||||
|
private String openBank; |
||||
|
@ApiModelProperty("身份证(人像面)") |
||||
|
private String idCardA; |
||||
|
@ApiModelProperty("身份证(国徽面)") |
||||
|
private String idCardB; |
||||
|
@ApiModelProperty("学历证书") |
||||
|
private String diploma; |
||||
|
@ApiModelProperty("学位证书") |
||||
|
private String degreeCertificate; |
||||
|
@ApiModelProperty("前公司离职证明") |
||||
|
private String leaveCertificate; |
||||
|
@ApiModelProperty("员工照片") |
||||
|
private String photo; |
||||
|
@ApiModelProperty(value = "员工部门信息") |
||||
|
private SysStaffOrgDetailsVo sysStaffOrg; |
||||
|
@ApiModelProperty(value = "员工岗位信息") |
||||
|
private SysStaffPostDetailsVo sysStaffPost; |
||||
|
|
||||
|
//===========================================//
|
||||
|
@ApiModelProperty(value = "毕业院校") |
||||
|
private String graduate; |
||||
|
@ApiModelProperty(value = "学历/专业") |
||||
|
private String education; |
||||
|
@ApiModelProperty(value = "职称") |
||||
|
private String title; |
||||
|
@ApiModelProperty(value = "资格认证") |
||||
|
private String qualification; |
||||
|
@ApiModelProperty(value = "驾照类型") |
||||
|
private String licenseType; |
||||
|
@ApiModelProperty(value = "驾照类型key") |
||||
|
private String licenseTypeKey; |
||||
|
@ApiModelProperty(value = "意外险参保:1是,0否") |
||||
|
private Integer isHaveInsurance; |
||||
|
@ApiModelProperty(value = "意外险参保:1是,0否") |
||||
|
private String isHaveInsuranceValue; |
||||
|
@ApiModelProperty(value = "意外险参保时间") |
||||
|
private String insuranceStartDate; |
||||
|
@ApiModelProperty(value = "意外险参保终止日期") |
||||
|
private String insuranceEndDate; |
||||
|
@ApiModelProperty(value = "意外险参保地") |
||||
|
private String insuranceAddr; |
||||
|
@ApiModelProperty(value = "养老:1是,0否") |
||||
|
private Integer isHaveAged; |
||||
|
@ApiModelProperty(value = "养老:1是,0否") |
||||
|
private String isHaveAgedValue; |
||||
|
@ApiModelProperty(value = "医疗:1是,0否") |
||||
|
private Integer isHaveMedical; |
||||
|
@ApiModelProperty(value = "医疗:1是,0否") |
||||
|
private String isHaveMedicalValue; |
||||
|
@ApiModelProperty(value = "工伤:1是,0否") |
||||
|
private Integer isHaveInjury; |
||||
|
@ApiModelProperty(value = "工伤:1是,0否") |
||||
|
private String isHaveInjuryValue; |
||||
|
@ApiModelProperty(value = "失业:1是,0否") |
||||
|
private Integer isHaveUnemploy; |
||||
|
@ApiModelProperty(value = "失业:1是,0否") |
||||
|
private String isHaveUnemployValue; |
||||
|
@ApiModelProperty(value = "社保参保地") |
||||
|
private String insuredPlace; |
||||
|
@ApiModelProperty(value = "纸质档案保管地") |
||||
|
private String paperPlace; |
||||
|
@ApiModelProperty(value = "合同起止日期") |
||||
|
private String contractStartDate; |
||||
|
@ApiModelProperty(value = "合同结束日期") |
||||
|
private String contractEndDate; |
||||
|
@ApiModelProperty(value = "离职日期") |
||||
|
private String quitDate; |
||||
|
@ApiModelProperty(value = "离职原因") |
||||
|
private String quitReason; |
||||
|
} |
@ -0,0 +1,186 @@ |
|||||
|
package com.yxt.user.biz.sysstaffinfo; |
||||
|
|
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.yxt.user.biz.sysstafforg.SysStaffOrgDto; |
||||
|
import com.yxt.user.biz.sysstaffpost.SysStaffPostDto; |
||||
|
import com.yxt.common.core.dto.Dto; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import javax.validation.constraints.Pattern; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysStaffinfoDto.java <br/> |
||||
|
* Class: com.yxt.user.biz.sysstaffinfo.SysStaffinfoDto <br/> |
||||
|
* Description: 人员基础信息表 数据传输对象. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:30 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "人员基础信息表 数据传输对象", description = "人员基础信息表 数据传输对象") |
||||
|
@Data |
||||
|
public class SysStaffinfoDto implements Dto { |
||||
|
|
||||
|
private static final long serialVersionUID = 8637516813924395044L; |
||||
|
@ApiModelProperty(value = "姓名", required = true) |
||||
|
@NotBlank(message = "姓名不能为空") |
||||
|
private String name; |
||||
|
@ApiModelProperty(value = "性别key", required = true) |
||||
|
@NotBlank(message = "性别不能为空") |
||||
|
private String genderKey; |
||||
|
@ApiModelProperty(value = "性别", required = true) |
||||
|
@NotBlank(message = "性别不能为空") |
||||
|
private String gender; |
||||
|
@ApiModelProperty(value = "员工编号") |
||||
|
private String jobNumber; |
||||
|
@ApiModelProperty(value = "身份证号", required = true) |
||||
|
@Pattern(regexp = "^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$", message = "请输入正确的身份证号") |
||||
|
@NotBlank(message = "身份证号不能为空") |
||||
|
private String idNo; |
||||
|
@ApiModelProperty(value = "证件有效期", required = true) |
||||
|
@NotBlank(message = "证件有效期不能为空") |
||||
|
private String idTerm; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@ApiModelProperty("生日") |
||||
|
private Date birthday; |
||||
|
@ApiModelProperty(value = "民族", required = true) |
||||
|
@NotBlank(message = "民族不能为空") |
||||
|
private String national; |
||||
|
@ApiModelProperty(value = "民族key", required = true) |
||||
|
@NotBlank(message = "民族不能为空") |
||||
|
private String nationalKey; |
||||
|
@ApiModelProperty(value = "籍贯", required = false) |
||||
|
private String nativePlace; |
||||
|
@ApiModelProperty(value = "省", required = false) |
||||
|
private String province; |
||||
|
@ApiModelProperty(value = "市", required = false) |
||||
|
private String city; |
||||
|
@ApiModelProperty(value = "县区", required = false) |
||||
|
private String county; |
||||
|
@ApiModelProperty(value = "省code", required = false) |
||||
|
private String provinceCode; |
||||
|
@ApiModelProperty(value = "市code", required = false) |
||||
|
private String cityCode; |
||||
|
@ApiModelProperty(value = "县区code", required = false) |
||||
|
private String countyCode; |
||||
|
@ApiModelProperty(value = "住址", required = false) |
||||
|
private String address; |
||||
|
@ApiModelProperty(value = "手机号", required = true) |
||||
|
// @Pattern(regexp = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|(19[1,3,5-9])|166|(147))\\d{8}$", message = "手机号码格式不正确")
|
||||
|
@Pattern(regexp = "^[0-9]{11}$", message = "手机号码格式不正确") |
||||
|
@NotBlank(message = "手机号不能为空") |
||||
|
private String mobile; |
||||
|
@ApiModelProperty(value = "邮箱", required = false) |
||||
|
//@Pattern(regexp = "[a-zA-Z0-9]+@[a-zA-Z0-9]+\\.[a-zA-Z0-9]+", message = "邮箱格式不正确")
|
||||
|
private String email; |
||||
|
@ApiModelProperty(value = "紧急联系人", required = false) |
||||
|
private String emergencyContact; |
||||
|
@ApiModelProperty(value = "紧急联系电话", required = false) |
||||
|
private String emergencyMobile; |
||||
|
@ApiModelProperty(value = "政治面貌", required = false) |
||||
|
private String poliCode; |
||||
|
@ApiModelProperty(value = "政治面貌key", required = false) |
||||
|
private String poliCodeKey; |
||||
|
@ApiModelProperty(value = "婚姻状况", required = false) |
||||
|
private String maritalStatus; |
||||
|
@ApiModelProperty(value = "婚姻状况key", required = false) |
||||
|
private String maritalStatusKey; |
||||
|
@ApiModelProperty(value = "员工类型", required = true) |
||||
|
@NotBlank(message = "员工类型不能为空") |
||||
|
private String personType; |
||||
|
@ApiModelProperty(value = "员工类型key", required = true) |
||||
|
@NotBlank(message = "员工类型不能为空") |
||||
|
private String personTypeKey; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@ApiModelProperty("入职时间") |
||||
|
private Date joinCompnyDate; |
||||
|
@ApiModelProperty("试用期(无试用期、1个月、2个月、3个月、其他)") |
||||
|
private String probPeriod; |
||||
|
@ApiModelProperty("试用期key") |
||||
|
private String probPeriodKey; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@ApiModelProperty("计划转正日期") |
||||
|
private Date plannedConfirmDate; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@ApiModelProperty("实际转正日期") |
||||
|
private Date confirmationDate; |
||||
|
@ApiModelProperty("银行卡号") |
||||
|
private String bankCardNo; |
||||
|
@ApiModelProperty("开户行") |
||||
|
private String openBank; |
||||
|
@ApiModelProperty("身份证(人像面)") |
||||
|
private String idCardA; |
||||
|
@ApiModelProperty("身份证(国徽面)") |
||||
|
private String idCardB; |
||||
|
@ApiModelProperty("学历证书") |
||||
|
private String diploma; |
||||
|
@ApiModelProperty("学位证书") |
||||
|
private String degreeCertificate; |
||||
|
@ApiModelProperty("前公司离职证明") |
||||
|
private String leaveCertificate; |
||||
|
@ApiModelProperty("员工照片") |
||||
|
private String photo; |
||||
|
@ApiModelProperty(value = "员工部门信息") |
||||
|
private SysStaffOrgDto sysStaffOrg; |
||||
|
@ApiModelProperty(value = "员工岗位信息") |
||||
|
private SysStaffPostDto sysStaffPost; |
||||
|
|
||||
|
//========================================//
|
||||
|
@ApiModelProperty(value = "毕业院校") |
||||
|
private String graduate; |
||||
|
@ApiModelProperty(value = "学历/专业") |
||||
|
private String education; |
||||
|
private String educationKey; |
||||
|
@ApiModelProperty(value = "职称") |
||||
|
private String title; |
||||
|
@ApiModelProperty(value = "资格认证") |
||||
|
private String qualification; |
||||
|
@ApiModelProperty(value = "驾照类型") |
||||
|
private String licenseType; |
||||
|
@ApiModelProperty(value = "驾照类型key") |
||||
|
private String licenseTypeKey; |
||||
|
@ApiModelProperty(value = "意外险参保:1是,0否") |
||||
|
private Integer isHaveInsurance; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@ApiModelProperty(value = "意外险参保时间") |
||||
|
private Date insuranceStartDate; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@ApiModelProperty(value = "意外险参保终止日期") |
||||
|
private Date insuranceEndDate; |
||||
|
@ApiModelProperty(value = "意外险参保地") |
||||
|
private String insuranceAddr; |
||||
|
|
||||
|
@ApiModelProperty(value = "养老:1是,0否") |
||||
|
private Integer isHaveAged; |
||||
|
@ApiModelProperty(value = "医疗:1是,0否") |
||||
|
private Integer isHaveMedical; |
||||
|
@ApiModelProperty(value = "工伤:1是,0否") |
||||
|
private Integer isHaveInjury; |
||||
|
@ApiModelProperty(value = "失业:1是,0否") |
||||
|
private Integer isHaveUnemploy; |
||||
|
@ApiModelProperty(value = "社保参保地") |
||||
|
private String insuredPlace; |
||||
|
@ApiModelProperty(value = "纸质档案保管地") |
||||
|
private String paperPlace; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@ApiModelProperty(value = "合同起止日期") |
||||
|
private Date contractStartDate; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@ApiModelProperty(value = "合同结束日期") |
||||
|
private Date contractEndDate; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
@ApiModelProperty(value = "离职日期") |
||||
|
private Date quitDate; |
||||
|
@ApiModelProperty(value = "离职原因") |
||||
|
private String quitReason; |
||||
|
|
||||
|
} |
@ -0,0 +1,128 @@ |
|||||
|
package com.yxt.user.biz.sysstaffinfo; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
|
import com.yxt.user.biz.sysorganization.AppContactSysOrganizationVo; |
||||
|
import com.yxt.user.biz.sysstaffinfo.*; |
||||
|
import com.yxt.user.biz.sysstaffinfo.app.AppSysStaffVo; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysStaffinfoMapper.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.biz.sysstaffinfo.SysStaffinfoMapper <br/> |
||||
|
* Description: 人员基础信息表. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:30 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface SysStaffinfoMapper extends BaseMapper<SysStaffinfo> { |
||||
|
|
||||
|
//@Update("update sys_staffinfo set name=#{msg} where id=#{id}")
|
||||
|
//IPage<SysStaffinfoVo> voPage(IPage<SysStaffinfo> page, @Param(Constants.WRAPPER) QueryWrapper<SysStaffinfo> qw);
|
||||
|
|
||||
|
List<SysStaffinfoAppContactsVo> selectAppContactsList(); |
||||
|
|
||||
|
IPage<SysStaffinfoAppContactsSearchVo> searchAppContactsPageList(IPage<SysStaffinfoQuery> page, @Param("list") List<String> list, |
||||
|
@Param("chnStr") String chnStr, @Param("mobileStr") String mobileStr); |
||||
|
|
||||
|
AppContactsDetailsVo selectAppContactsVO(String staffSid); |
||||
|
|
||||
|
List<AppContactSysOrganizationVo> selectContactsByOrgsid(@Param("sid") String sid); |
||||
|
|
||||
|
SysStaffinfo selectJobNumber(); |
||||
|
|
||||
|
/** |
||||
|
* 查询员工的手机号是否重复 |
||||
|
* |
||||
|
* @param mobile 手机号 |
||||
|
* @return |
||||
|
*/ |
||||
|
SysStaffinfo selectByMobile(String mobile); |
||||
|
|
||||
|
/** |
||||
|
* 查询是否存在该身份证号的员工 |
||||
|
* |
||||
|
* @param idNo 身份证号 |
||||
|
* @return |
||||
|
*/ |
||||
|
SysStaffinfo selectByIdNo(String idNo); |
||||
|
|
||||
|
/** |
||||
|
* 员工管理分页列表 |
||||
|
* |
||||
|
* @param page 分页 |
||||
|
* @param qw 查询条件 |
||||
|
* @return |
||||
|
*/ |
||||
|
IPage<SysStaffinfoVo> pagerList(IPage<SysStaffinfoQuery> page, @Param(Constants.WRAPPER) Wrapper<SysStaffinfoVo> qw); |
||||
|
|
||||
|
/** |
||||
|
* 根据员工sid和员工手机号码查询员工信息是否已存在 |
||||
|
* |
||||
|
* @param mobile 手机号 |
||||
|
* @param sid 员工sid |
||||
|
* @return |
||||
|
*/ |
||||
|
SysStaffinfo selectByMobileAndSid(@Param("mobile") String mobile, @Param("sid") String sid); |
||||
|
|
||||
|
/** |
||||
|
* 根据员工sid和身份证号查询员工信息是否已存在 |
||||
|
* |
||||
|
* @param idNo 身份证号 |
||||
|
* @param sid 员工sid |
||||
|
* @return |
||||
|
*/ |
||||
|
SysStaffinfo selectByIdNoAndSid(@Param("idNo") String idNo, @Param("sid") String sid); |
||||
|
|
||||
|
/** |
||||
|
* 根据员工sid查询员工信息 |
||||
|
* |
||||
|
* @param sid 员工sid |
||||
|
* @return |
||||
|
*/ |
||||
|
SysStaffinfoDetailsVo selectDetailsBySid(@Param("sid") String sid, @Param("path") String path); |
||||
|
|
||||
|
/** |
||||
|
* 根据员工sid更新信息 |
||||
|
* |
||||
|
* @param personType 员工类型 |
||||
|
* @param personTypeKey 员工类型key |
||||
|
* @param sid 员工sid |
||||
|
* @return |
||||
|
*/ |
||||
|
int updateBySid(@Param("personType") String personType, @Param("personTypeKey") String personTypeKey, |
||||
|
@Param("sid") String sid, @Param("date") Date date, @Param("reason") String reason); |
||||
|
|
||||
|
/** |
||||
|
* 查询当前分公司下的员工信息 |
||||
|
* |
||||
|
* @param orgSid 分公司sid |
||||
|
* @return |
||||
|
*/ |
||||
|
List<PcSysStaffVo> selectStaffList(String orgSid); |
||||
|
|
||||
|
List<Map<String, String>> getStaffName(@Param(Constants.WRAPPER) Wrapper<Map<String, Object>> qw); |
||||
|
|
||||
|
List<Map<String, String>> getStaffNameByDeptSid(@Param(Constants.WRAPPER) Wrapper<Map<String, Object>> qw); |
||||
|
|
||||
|
IPage<AppSysStaffVo> getUserList(IPage<SysStaffinfo> page, @Param(Constants.WRAPPER) QueryWrapper<AppSysStaffVo> qw, @Param("orgSid") String orgSid); |
||||
|
|
||||
|
List<AppSysStaffVo> getGressionUserList(@Param("userOrgSid")String userOrgSid); |
||||
|
|
||||
|
List<PcSysStaffVo> selectStaffLists(); |
||||
|
List<PcSysStaffVo> selectStaffListss(); |
||||
|
} |
@ -0,0 +1,398 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.yxt.user.biz.sysstaffinfo.SysStaffinfoMapper"> |
||||
|
<!-- <where> ${ew.sqlSegment} </where>--> |
||||
|
<!-- ${ew.customSqlSegment} --> |
||||
|
|
||||
|
<select id="selectAppContactsList" parameterType="List" |
||||
|
resultType="com.yxt.user.biz.sysstaffinfo.SysStaffinfoAppContactsVo"> |
||||
|
SELECT staff.sid, staff.name, staff.mobile, staff.pinYinName, staff.firstPinYinLabel, user.headImage |
||||
|
FROM sys_staffinfo staff |
||||
|
LEFT JOIN sys_user user |
||||
|
ON staff.sid = user.staffSid |
||||
|
where staff.personTypeKey != '01' |
||||
|
ORDER BY staff.firstPinYinLabel = '#', staff.firstPinYinLabel ASC, staff.pinYinName |
||||
|
</select> |
||||
|
|
||||
|
<select id="searchAppContactsPageList" |
||||
|
resultType="com.yxt.user.biz.sysstaffinfo.SysStaffinfoAppContactsSearchVo"> |
||||
|
SELECT staff.sid, |
||||
|
staff.name, |
||||
|
staff.mobile, |
||||
|
staff.position, |
||||
|
user.headImage, |
||||
|
GROUP_CONCAT(org.orgName SEPARATOR '/') orgName |
||||
|
FROM sys_staffinfo staff |
||||
|
LEFT JOIN sys_staff_org org ON org.staffSid = staff.sid |
||||
|
LEFT JOIN sys_user user ON staff.sid = user.staffSid |
||||
|
WHERE 1 = 1 and staff.personTypeKey != '01' |
||||
|
<if test="mobileStr != null and mobileStr != ''"> |
||||
|
AND staff.mobile LIKE concat('%', #{mobileStr}, '%') |
||||
|
</if> |
||||
|
<if test="list.size > 0"> |
||||
|
<foreach collection="list" index="index" item="item" separator=" "> |
||||
|
AND staff.pinYinName LIKE concat('%', #{item}, '%') |
||||
|
</foreach> |
||||
|
</if> |
||||
|
<if test="chnStr != '' and chnStr != null"> |
||||
|
OR staff.position LIKE concat('%', #{chnStr,jdbcType=VARCHAR}, '%') |
||||
|
OR org.orgName LIKE concat('%', #{chnStr,jdbcType=VARCHAR}, '%') |
||||
|
</if> |
||||
|
GROUP BY staff.sid |
||||
|
ORDER BY staff.firstPinYinLabel = '#', staff.firstPinYinLabel ASC, staff.pinYinName |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectAppContactsVO" resultType="com.yxt.user.biz.sysstaffinfo.AppContactsDetailsVo"> |
||||
|
SELECT staff.name, |
||||
|
staff.mobile, |
||||
|
user.headImage, |
||||
|
staff.position, |
||||
|
GROUP_CONCAT(org.orgNamePath SEPARATOR '/') orgNamePath |
||||
|
FROM sys_staffinfo staff |
||||
|
LEFT JOIN sys_user user |
||||
|
ON staff.sid = user.staffSid |
||||
|
LEFT JOIN sys_staff_org org ON staff.sid = org.staffSid |
||||
|
WHERE staff.sid = #{staffSid} |
||||
|
GROUP BY staff.sid |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectContactsByOrgsid" |
||||
|
resultType="com.yxt.user.biz.sysorganization.AppContactSysOrganizationVo"> |
||||
|
SELECT staff.sid, |
||||
|
staff.name, |
||||
|
staff.mobile, |
||||
|
user.headImage, |
||||
|
org.orgNamePath, |
||||
|
staff.position, |
||||
|
IFNULL(NULL, '3') AS type, |
||||
|
IFNULL(NULL, 0) AS staffNum |
||||
|
FROM sys_staff_org org |
||||
|
INNER JOIN sys_staffinfo staff ON org.staffSid = staff.sid |
||||
|
LEFT JOIN sys_user user |
||||
|
ON staff.sid = user.staffSid |
||||
|
WHERE org.orgSid = #{sid} |
||||
|
and staff.personTypeKey != '01' |
||||
|
</select> |
||||
|
<!--根据员工类型key查询员工工号的最大号--> |
||||
|
<select id="selectJobNumber" resultType="com.yxt.user.biz.sysstaffinfo.SysStaffinfo"> |
||||
|
select * |
||||
|
from sys_staffinfo |
||||
|
order by jobNumber desc |
||||
|
limit 1 |
||||
|
</select> |
||||
|
<!--根据手机号查询员工是否重复--> |
||||
|
<select id="selectByMobile" resultType="com.yxt.user.biz.sysstaffinfo.SysStaffinfo"> |
||||
|
select * |
||||
|
from sys_staffinfo |
||||
|
where mobile = #{mobile} |
||||
|
</select> |
||||
|
<!--查询是否存在该身份证号的员工--> |
||||
|
<select id="selectByIdNo" resultType="com.yxt.user.biz.sysstaffinfo.SysStaffinfo"> |
||||
|
select * |
||||
|
from sys_staffinfo |
||||
|
where idNo = #{idNo} |
||||
|
</select> |
||||
|
<!--员工管理分页列表--> |
||||
|
<select id="pagerList" resultType="com.yxt.user.biz.sysstaffinfo.SysStaffinfoVo"> |
||||
|
select DISTINCT si.sid, |
||||
|
<!--员工编号--> |
||||
|
si.jobNumber, |
||||
|
<!--员工姓名--> |
||||
|
si.name, |
||||
|
<!--员工类型--> |
||||
|
si.personType, |
||||
|
<!--手机号--> |
||||
|
si.mobile, |
||||
|
<!--入职日期--> |
||||
|
DATE_FORMAT(si.joinCompnyDate, '%Y-%m-%d') AS joinCompnyDate, |
||||
|
<!--所在部门--> |
||||
|
(select GROUP_CONCAT(orgName SEPARATOR ',') orgName from sys_staff_org so where so.staffSid = si.sid) as |
||||
|
orgName, |
||||
|
<!--所在部门sid--> |
||||
|
(select GROUP_CONCAT(orgSid SEPARATOR ',') orgSid from sys_staff_org so where so.staffSid = si.sid) as |
||||
|
orgSid, |
||||
|
<!--岗位--> |
||||
|
(select GROUP_CONCAT(sp.name SEPARATOR ',') postName |
||||
|
from sys_staff_post ssp |
||||
|
left join sys_post sp on |
||||
|
sp.sid = |
||||
|
ssp.postSid |
||||
|
where ssp.staffSid = si.sid |
||||
|
group by ssp.id) as postName |
||||
|
from sys_staffinfo si |
||||
|
LEFT JOIN sys_staff_org so |
||||
|
ON so.staffSid = si.sid |
||||
|
LEFT JOIN sys_staff_post ssp |
||||
|
ON ssp.staffSid = si.sid |
||||
|
${ew.customSqlSegment} |
||||
|
</select> |
||||
|
<!--根据员工手机号和sid查询员工信息是否已存在--> |
||||
|
<select id="selectByMobileAndSid" resultType="com.yxt.user.biz.sysstaffinfo.SysStaffinfo"> |
||||
|
select * |
||||
|
from sys_staffinfo |
||||
|
where mobile = #{mobile} |
||||
|
and sid <> #{sid} |
||||
|
</select> |
||||
|
<!--根据员工sid和身份证号查询员工信息是否已存在--> |
||||
|
<select id="selectByIdNoAndSid" resultType="com.yxt.user.biz.sysstaffinfo.SysStaffinfo"> |
||||
|
select * |
||||
|
from sys_staffinfo |
||||
|
where idNo = #{idNo} |
||||
|
and sid <> #{sid} |
||||
|
</select> |
||||
|
<!--根据员工sid查询员工信息--> |
||||
|
<select id="selectDetailsBySid" resultType="com.yxt.user.biz.sysstaffinfo.SysStaffinfoDetailsVo"> |
||||
|
select |
||||
|
<!--工号--> |
||||
|
jobNumber, |
||||
|
<!--姓名--> |
||||
|
name, |
||||
|
<!--性别key--> |
||||
|
genderKey, |
||||
|
<!--性别--> |
||||
|
gender, |
||||
|
<!--身份证号--> |
||||
|
idNo, |
||||
|
<!--证件有效期--> |
||||
|
idTerm, |
||||
|
<!--生日--> |
||||
|
DATE_FORMAT(birthday, '%Y-%m-%d') as birthday, |
||||
|
<!--民族--> |
||||
|
national, |
||||
|
<!--民族key--> |
||||
|
nationalKey, |
||||
|
<!--籍贯--> |
||||
|
nativePlace, |
||||
|
<!--省--> |
||||
|
province, |
||||
|
<!--市--> |
||||
|
city, |
||||
|
<!--县区--> |
||||
|
county, |
||||
|
<!--省code--> |
||||
|
provinceCode, |
||||
|
<!--市code--> |
||||
|
cityCode, |
||||
|
<!--县区code--> |
||||
|
countyCode, |
||||
|
<!--住址--> |
||||
|
address, |
||||
|
<!--手机号--> |
||||
|
mobile, |
||||
|
<!--邮箱--> |
||||
|
email, |
||||
|
<!--紧急联系人--> |
||||
|
emergencyContact, |
||||
|
<!--紧急联系电话--> |
||||
|
emergencyMobile, |
||||
|
<!--政治面貌--> |
||||
|
poliCode, |
||||
|
<!--政治面貌key--> |
||||
|
poliCodeKey, |
||||
|
<!--婚姻状况--> |
||||
|
maritalStatus, |
||||
|
<!--婚姻状况key--> |
||||
|
maritalStatusKey, |
||||
|
<!--员工类型--> |
||||
|
personType, |
||||
|
<!--员工类型key--> |
||||
|
personTypeKey, |
||||
|
<!--入职时间--> |
||||
|
DATE_FORMAT(joinCompnyDate, '%Y-%m-%d') as joinCompnyDate, |
||||
|
<!--试用期--> |
||||
|
probPeriod, |
||||
|
<!--试用期key--> |
||||
|
probPeriodKey, |
||||
|
<!--计划转正日期--> |
||||
|
DATE_FORMAT(plannedConfirmDate, '%Y-%m-%d') as plannedConfirmDate, |
||||
|
<!--实际转正日期--> |
||||
|
DATE_FORMAT(confirmationDate, '%Y-%m-%d') as confirmationDate, |
||||
|
<!--银行卡号--> |
||||
|
bankCardNo, |
||||
|
<!--开户行--> |
||||
|
openBank, |
||||
|
<!--身份证(人像面)--> |
||||
|
IF(idCardA = "", idCardA, CONCAT(#{path}, idCardA)) AS idCardA, |
||||
|
<!--NULLIF(idCardA,CONCAT(#{path}, idCardA) as idCardA),--> |
||||
|
<!--when idCardA is null then idCardA else concat(#{path}, idCardA) as idCardA end,--> |
||||
|
<!--身份证(国徽面)--> |
||||
|
IF(idCardB = "", idCardB, CONCAT(#{path}, idCardB)) AS idCardB, |
||||
|
<!--NULLIF(idCardB,concat(#{path}, idCardB) as idCardB),--> |
||||
|
<!--when idCardB is null then idCardB else concat(#{path}, idCardB) as idCardB end,--> |
||||
|
<!--学历证书--> |
||||
|
IF(diploma = "", diploma, CONCAT(#{path}, diploma)) AS diploma, |
||||
|
<!--NULLIF(CONCAT(#{path}, diploma) as diploma,diploma),--> |
||||
|
<!--when diploma is null then diploma else concat(#{path}, diploma) as diploma end,--> |
||||
|
<!--学位证书--> |
||||
|
IF(degreeCertificate = "", degreeCertificate, CONCAT(#{path}, degreeCertificate)) AS degreeCertificate, |
||||
|
<!--NULLIF(CONCAT(#{path}, degreeCertificate) as degreeCertificate,degreeCertificate),--> |
||||
|
<!--when degreeCertificate is null then degreeCertificate else concat(#{path}, degreeCertificate) as degreeCertificate end,--> |
||||
|
<!--前公司离职证明--> |
||||
|
IF(leaveCertificate = "", leaveCertificate, CONCAT(#{path}, leaveCertificate)) AS leaveCertificate, |
||||
|
<!--NULLIF(CONCAT(#{path}, leaveCertificate) as leaveCertificate,leaveCertificate),--> |
||||
|
<!--when leaveCertificate is null then leaveCertificate else concat(#{path}, leaveCertificate) as leaveCertificate end,--> |
||||
|
<!--员工照片--> |
||||
|
IF(photo = "", photo, CONCAT(#{path}, photo)) AS photo, |
||||
|
<!--NULLIF(CONCAT(#{path}, photo) as photo,photo),--> |
||||
|
<!--when photo is null then photo else concat(#{path}, photo) as photo end,--> |
||||
|
<!--毕业院校--> |
||||
|
graduate, |
||||
|
<!--学历/专业--> |
||||
|
education, |
||||
|
educationKey, |
||||
|
<!--职称--> |
||||
|
title, |
||||
|
<!--资格认证--> |
||||
|
qualification, |
||||
|
<!--驾照类型--> |
||||
|
licenseType, |
||||
|
<!--驾照类型key--> |
||||
|
licenseTypeKey, |
||||
|
<!--意外险参保:1是,0否--> |
||||
|
isHaveInsurance, |
||||
|
<!--意外险参保:1是,0否--> |
||||
|
case isHaveInsurance |
||||
|
when 1 then '是' |
||||
|
when 0 then '否' end as isHaveInsuranceValue, |
||||
|
<!--意外险参保时间--> |
||||
|
DATE_FORMAT(insuranceStartDate, '%Y-%m-%d') as insuranceStartDate, |
||||
|
<!--意外险参保终止日期--> |
||||
|
DATE_FORMAT(insuranceEndDate, '%Y-%m-%d') as insuranceEndDate, |
||||
|
<!--意外险参保地--> |
||||
|
insuranceAddr, |
||||
|
<!--养老:1是,0否--> |
||||
|
isHaveAged, |
||||
|
<!--养老:1是,0否--> |
||||
|
case isHaveAged |
||||
|
when 1 then '是' |
||||
|
when 0 then '否' end as isHaveAgedValue, |
||||
|
<!--医疗:1是,0否--> |
||||
|
isHaveMedical, |
||||
|
<!--医疗:1是,0否--> |
||||
|
case isHaveMedical |
||||
|
when 1 then '是' |
||||
|
when 0 then '否' end as isHaveMedicalValue, |
||||
|
<!--工伤:1是,0否--> |
||||
|
isHaveInjury, |
||||
|
<!--工伤:1是,0否--> |
||||
|
case isHaveInjury |
||||
|
when 1 then '是' |
||||
|
when 0 then '否' end as isHaveInjuryValue, |
||||
|
<!--失业:1是,0否--> |
||||
|
isHaveUnemploy, |
||||
|
<!--失业:1是,0否--> |
||||
|
case isHaveUnemploy |
||||
|
when 1 then '是' |
||||
|
when 0 then '否' end as isHaveUnemployValue, |
||||
|
<!--社保参保地--> |
||||
|
insuredPlace, |
||||
|
<!--纸质档案保管地--> |
||||
|
paperPlace, |
||||
|
<!--合同起止日期--> |
||||
|
DATE_FORMAT(contractStartDate, '%Y-%m-%d') as contractStartDate, |
||||
|
<!--合同结束日期--> |
||||
|
DATE_FORMAT(contractEndDate, '%Y-%m-%d') as contractEndDate, |
||||
|
<!--离职日期--> |
||||
|
DATE_FORMAT(quitDate, '%Y-%m-%d') as quitDate, |
||||
|
<!--离职原因--> |
||||
|
quitReason |
||||
|
from sys_staffinfo |
||||
|
where sid = #{sid} |
||||
|
</select> |
||||
|
|
||||
|
<update id="updateBySid"> |
||||
|
update sys_staffinfo |
||||
|
set personType = #{personType}, |
||||
|
personTypeKey = #{personTypeKey}, |
||||
|
quitDate = #{date}, |
||||
|
quitReason = #{reason} |
||||
|
where sid = #{sid} |
||||
|
</update> |
||||
|
<!--查询当前分公司下的员工信息--> |
||||
|
<select id="selectStaffList" resultType="com.yxt.user.biz.sysstaffinfo.PcSysStaffVo"> |
||||
|
select su.sid userSid, si.name staffName |
||||
|
from sys_staff_org sso |
||||
|
left join sys_staffinfo si on sso.staffSid = si.sid |
||||
|
left join sys_user su on su.staffSid = si.sid |
||||
|
where find_in_set(#{orgSid}, replace(sso.orgSidPath, '/', ',')) |
||||
|
</select> |
||||
|
|
||||
|
<select id="getStaffName" resultType="java.util.Map"> |
||||
|
SELECT DISTINCT ss.sid, ss.name |
||||
|
FROM sys_staffinfo ss |
||||
|
LEFT JOIN sys_staff_org sso |
||||
|
ON ss.`sid` = sso.`staffSid` |
||||
|
${ew.customSqlSegment} |
||||
|
</select> |
||||
|
|
||||
|
<select id="getStaffNameByDeptSid" resultType="java.util.Map"> |
||||
|
SELECT DISTINCT ss.sid, |
||||
|
ss.name |
||||
|
FROM sys_staffinfo ss |
||||
|
LEFT JOIN sys_staff_org sso |
||||
|
ON ss.`sid` = sso.`staffSid` |
||||
|
${ew.customSqlSegment} |
||||
|
</select> |
||||
|
|
||||
|
<select id="getUserList" resultType="com.yxt.user.biz.sysstaffinfo.app.AppSysStaffVo"> |
||||
|
select su.sid userSid, |
||||
|
si.name userName, |
||||
|
su.headImage, |
||||
|
si.mobile userMobile, |
||||
|
sso.orgName as department, |
||||
|
sp.name |
||||
|
from sys_staff_org sso |
||||
|
left join sys_staffinfo si on sso.staffSid = si.sid |
||||
|
left join sys_user su on si.sid = su.staffSid |
||||
|
left join sys_staff_post ssp on si.sid = ssp.staffSid |
||||
|
left join sys_post sp on sp.sid = ssp.postSid |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
and su.isAdmin is NULL |
||||
|
<if test="orgSid != null and orgSid != ''"> |
||||
|
and find_in_set(#{orgSid} |
||||
|
, replace (sso.orgSidPath |
||||
|
, '/' |
||||
|
, ',')) |
||||
|
</if> |
||||
|
</where> |
||||
|
group by su.sid |
||||
|
</select> |
||||
|
|
||||
|
<select id="getGressionUserList" resultType="com.yxt.user.biz.sysstaffinfo.app.AppSysStaffVo"> |
||||
|
select su.sid as userSid, |
||||
|
si.name as userName, |
||||
|
su.headImage, |
||||
|
si.mobile as userMobile, |
||||
|
sso.orgName as department, |
||||
|
sp.name |
||||
|
from sys_staff_org sso |
||||
|
left join sys_staffinfo si on sso.staffSid = si.sid |
||||
|
left join sys_user su on si.sid = su.staffSid |
||||
|
left join sys_staff_post ssp on si.sid = ssp.staffSid |
||||
|
left join sys_post sp on sp.sid = ssp.postSid |
||||
|
<where> |
||||
|
1=1 |
||||
|
<if test="userOrgSid != null and userOrgSid != ''"> |
||||
|
and find_in_set(#{userOrgSid} |
||||
|
, replace(sso.orgSidPath |
||||
|
, '/' |
||||
|
, ',')) |
||||
|
</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectStaffLists" resultType="com.yxt.user.biz.sysstaffinfo.PcSysStaffVo"> |
||||
|
select su.sid userSid, |
||||
|
si.name staffName |
||||
|
from sys_user su |
||||
|
left join sys_staffinfo si on su.staffSid = si.sid where su.isAdmin is NULL |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectStaffListss" resultType="com.yxt.user.biz.sysstaffinfo.PcSysStaffVo"> |
||||
|
select su.sid userSid, |
||||
|
si.name staffName |
||||
|
from sys_user su |
||||
|
left join sys_staffinfo si on su.staffSid = si.sid where su.isAdmin is NULL and si.personTypeKey != '01' |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,42 @@ |
|||||
|
package com.yxt.user.biz.sysstaffinfo; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysStaffinfoQuery.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysstaffinfo.SysStaffinfoQuery <br/> |
||||
|
* Description: 人员基础信息表 查询条件. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:30 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "人员基础信息表 查询条件", description = "人员基础信息表 查询条件") |
||||
|
@Data |
||||
|
public class SysStaffinfoQuery implements Query { |
||||
|
|
||||
|
|
||||
|
private static final long serialVersionUID = 7101232842735165406L; |
||||
|
@ApiModelProperty("姓名") |
||||
|
private String name; |
||||
|
@ApiModelProperty("员工类型key") |
||||
|
private String personTypeKey; |
||||
|
@ApiModelProperty("手机号") |
||||
|
private String mobile; |
||||
|
@ApiModelProperty("入职开始日期") |
||||
|
private String joinCompnyDateStart; |
||||
|
@ApiModelProperty("入职结束日期") |
||||
|
private String joinCompnyDateEnd; |
||||
|
@ApiModelProperty(value = "所在部门sid") |
||||
|
private String orgSid; |
||||
|
@ApiModelProperty(value = "所在岗位sid") |
||||
|
private String postSid; |
||||
|
} |
@ -0,0 +1,819 @@ |
|||||
|
package com.yxt.user.biz.sysstaffinfo; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.yxt.user.biz.sysorganization.AppContactSysOrganizationVo; |
||||
|
import com.yxt.user.biz.sysorganization.SysOrganization; |
||||
|
import com.yxt.user.biz.sysrole.SysRoleVo; |
||||
|
import com.yxt.user.biz.sysstaffinfo.*; |
||||
|
import com.yxt.user.biz.sysstaffinfo.app.AppSysStaffQuery; |
||||
|
import com.yxt.user.biz.sysstaffinfo.app.AppSysStaffVo; |
||||
|
import com.yxt.user.biz.sysstafforg.SysStaffOrg; |
||||
|
import com.yxt.user.biz.sysstafforg.SysStaffOrgDetailsVo; |
||||
|
import com.yxt.user.biz.sysstafforg.SysStaffOrgDto; |
||||
|
import com.yxt.user.biz.sysstafforg.SysStaffOrgVo; |
||||
|
import com.yxt.user.biz.sysstaffpost.SysStaffPost; |
||||
|
import com.yxt.user.biz.sysstaffpost.SysStaffPostDetailsVo; |
||||
|
import com.yxt.user.biz.sysstaffpost.SysStaffPostDto; |
||||
|
import com.yxt.user.biz.sysuser.SysUser; |
||||
|
import com.yxt.user.biz.sysuserrole.SysUserRole; |
||||
|
import com.yxt.user.biz.sysorganization.SysOrganizationService; |
||||
|
import com.yxt.user.biz.syspost.SysPostService; |
||||
|
import com.yxt.user.biz.sysrole.SysRoleService; |
||||
|
import com.yxt.user.biz.sysstafforg.SysStaffOrgService; |
||||
|
import com.yxt.user.biz.sysstaffpost.SysStaffPostService; |
||||
|
import com.yxt.user.biz.sysuser.SysUserService; |
||||
|
import com.yxt.user.biz.sysuserrole.SysUserRoleService; |
||||
|
import com.yxt.common.base.config.RedisUtil; |
||||
|
import com.yxt.common.base.config.component.FileUploadComponent; |
||||
|
import com.yxt.common.base.service.MybatisBaseService; |
||||
|
import com.yxt.common.base.utils.Encodes; |
||||
|
import com.yxt.common.base.utils.PagerUtil; |
||||
|
import com.yxt.common.base.utils.PinYinUtils; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import com.yxt.user.biz.sysorganization.AppContactSysOrganizationVo; |
||||
|
import com.yxt.user.biz.sysstaffinfo.app.AppSysStaffVo; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.text.SimpleDateFormat; |
||||
|
import java.util.*; |
||||
|
|
||||
|
import static java.util.stream.Collectors.toList; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysStaffinfoService.java <br/> |
||||
|
* Class: com.yxt.user.biz.sysstaffinfo.SysStaffinfoService <br/> |
||||
|
* Description: 人员基础信息表 业务逻辑. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:30 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class SysStaffinfoService extends MybatisBaseService<SysStaffinfoMapper, SysStaffinfo> { |
||||
|
|
||||
|
@Autowired |
||||
|
private FileUploadComponent fileUploadComponent; |
||||
|
@Autowired |
||||
|
private SysUserService sysUserService; |
||||
|
@Autowired |
||||
|
private SysStaffOrgService sysStaffOrgService; |
||||
|
@Autowired |
||||
|
private SysStaffPostService sysStaffPostService; |
||||
|
@Autowired |
||||
|
private SysPostService sysPostService; |
||||
|
@Autowired |
||||
|
private SysOrganizationService sysOrganizationService; |
||||
|
@Autowired |
||||
|
private SysUserRoleService sysUserRoleService; |
||||
|
@Autowired |
||||
|
private SysRoleService sysRoleService; |
||||
|
@Autowired |
||||
|
private RedisUtil redisUtil; |
||||
|
|
||||
|
public List<SysStaffinfoAppContactsVo> selectAppContactsList() { |
||||
|
List<SysStaffinfoAppContactsVo> list = baseMapper.selectAppContactsList(); |
||||
|
list.stream().forEach(vo -> { |
||||
|
if (StringUtils.isNotBlank(vo.getHeadImage())) { |
||||
|
vo.setHeadImage(fileUploadComponent.getUrlPrefix() + vo.getHeadImage()); |
||||
|
} |
||||
|
}); |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
public IPage<SysStaffinfoAppContactsSearchVo> searchAppContactsList(PagerQuery<SysStaffinfoQuery> pagerQuery, String names) { |
||||
|
Map<String, Object> map = new HashMap<>(); |
||||
|
List<String> paramList = new ArrayList<>(); |
||||
|
String chnStr = ""; // 中文查询字符串
|
||||
|
String mobileStr = ""; // 中文查询字符串
|
||||
|
if (StringUtils.isNotBlank(names)) { |
||||
|
if (names.matches("^\\d*$")) { // 数字
|
||||
|
mobileStr = names; |
||||
|
} else { |
||||
|
String[] namesArray = names.split(""); |
||||
|
for (int i = 0; i < namesArray.length; i++) { |
||||
|
if (StringUtils.isNotBlank(namesArray[i])) { |
||||
|
if (namesArray[i].matches("^[\u4e00-\u9fa5]+$")) { // 中文
|
||||
|
chnStr = chnStr + namesArray[i]; |
||||
|
} |
||||
|
String pinYinName = PinYinUtils.getPinYinName(namesArray[i]); |
||||
|
if (pinYinName.equals("_") || pinYinName.equals("%")) { |
||||
|
pinYinName = "\\" + pinYinName; |
||||
|
} |
||||
|
paramList.add(pinYinName); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
IPage<SysStaffinfoQuery> page = PagerUtil.queryToPage(pagerQuery); |
||||
|
IPage<SysStaffinfoAppContactsSearchVo> iPage = baseMapper.searchAppContactsPageList(page, paramList, chnStr, mobileStr); |
||||
|
List<SysStaffinfoAppContactsSearchVo> list = iPage.getRecords(); |
||||
|
list.stream().forEach(vo -> { |
||||
|
if (StringUtils.isNotBlank(vo.getHeadImage())) { |
||||
|
vo.setHeadImage(fileUploadComponent.getUrlPrefix() + vo.getHeadImage()); |
||||
|
} |
||||
|
List<String> stringList = sysUserService.getPost(vo.getSid()); |
||||
|
stringList.removeAll(Collections.singleton(null)); |
||||
|
if (!stringList.isEmpty()) { |
||||
|
vo.setPosition(String.join("|", stringList)); |
||||
|
} |
||||
|
}); |
||||
|
map.put("list", list); |
||||
|
map.put("info", "找到 " + iPage.getRecords().size() + " 个联系人 "); |
||||
|
return iPage; |
||||
|
} |
||||
|
|
||||
|
public IPage<SysStaffinfoAppContactsSearchVo> searchAppContactsList2(PagerQuery<SysStaffinfoQuery> pagerQuery) { |
||||
|
String names = pagerQuery.getParams().getName(); |
||||
|
Map<String, Object> map = new HashMap<>(); |
||||
|
List<String> paramList = new ArrayList<>(); |
||||
|
String chnStr = ""; // 中文查询字符串
|
||||
|
String mobileStr = ""; // 中文查询字符串
|
||||
|
if (StringUtils.isNotBlank(names)) { |
||||
|
if (names.matches("^\\d*$")) { // 数字
|
||||
|
mobileStr = names; |
||||
|
} else { |
||||
|
String[] namesArray = names.split(""); |
||||
|
for (int i = 0; i < namesArray.length; i++) { |
||||
|
if (StringUtils.isNotBlank(namesArray[i])) { |
||||
|
if (namesArray[i].matches("^[\u4e00-\u9fa5]+$")) { // 中文
|
||||
|
chnStr = chnStr + namesArray[i]; |
||||
|
} |
||||
|
String pinYinName = PinYinUtils.getPinYinName(namesArray[i]); |
||||
|
if (pinYinName.equals("_") || pinYinName.equals("%")) { |
||||
|
pinYinName = "\\" + pinYinName; |
||||
|
} |
||||
|
paramList.add(pinYinName); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
IPage<SysStaffinfoQuery> page = PagerUtil.queryToPage(pagerQuery); |
||||
|
IPage<SysStaffinfoAppContactsSearchVo> iPage = baseMapper.searchAppContactsPageList(page, paramList, chnStr, mobileStr); |
||||
|
List<SysStaffinfoAppContactsSearchVo> list = iPage.getRecords(); |
||||
|
list.stream().forEach(vo -> { |
||||
|
if (StringUtils.isNotBlank(vo.getHeadImage())) { |
||||
|
vo.setHeadImage(fileUploadComponent.getUrlPrefix() + vo.getHeadImage()); |
||||
|
} |
||||
|
List<String> stringList = sysUserService.getPost(vo.getSid()); |
||||
|
stringList.removeAll(Collections.singleton(null)); |
||||
|
if (!stringList.isEmpty()) { |
||||
|
vo.setPosition(String.join("|", stringList)); |
||||
|
} |
||||
|
}); |
||||
|
map.put("list", list); |
||||
|
map.put("info", "找到 " + iPage.getRecords().size() + " 个联系人 "); |
||||
|
return iPage; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public AppContactsDetailsVo selectAppContactsVO(String staffSid) { |
||||
|
return baseMapper.selectAppContactsVO(staffSid); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* pc端员工管理分页列表查询条件封装 |
||||
|
* |
||||
|
* @param query 查询条件 |
||||
|
* @return |
||||
|
*/ |
||||
|
private QueryWrapper<SysStaffinfoVo> createQueryWrapper(SysStaffinfoQuery query) { |
||||
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
||||
|
QueryWrapper<SysStaffinfoVo> qw = new QueryWrapper<>(); |
||||
|
if (StringUtils.isNotBlank(query.getName())) {//姓名
|
||||
|
qw.like("si.name", query.getName()); |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(query.getOrgSid())) { |
||||
|
qw.eq("so.orgSid", query.getOrgSid()); |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(query.getPostSid())) { |
||||
|
qw.eq("ssp.postSid", query.getPostSid()); |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(query.getMobile())) { |
||||
|
qw.like("si.mobile", query.getMobile()); |
||||
|
} |
||||
|
String joinCompnyDateStart = query.getJoinCompnyDateStart(); |
||||
|
String joinCompnyDateEnd = query.getJoinCompnyDateEnd(); |
||||
|
qw.apply(StringUtils.isNotEmpty(joinCompnyDateStart), "date_format (joinCompnyDate,'%Y-%m-%d') >= date_format('" + joinCompnyDateStart + "','%Y-%m-%d')"). |
||||
|
apply(StringUtils.isNotEmpty(joinCompnyDateEnd), "date_format (joinCompnyDate,'%Y-%m-%d') <= date_format('" + joinCompnyDateEnd + "','%Y-%m-%d')" |
||||
|
); |
||||
|
//员工类型key
|
||||
|
if (StringUtils.isNotBlank(query.getPersonTypeKey())) { |
||||
|
qw.eq("si.personTypeKey", query.getPersonTypeKey()); |
||||
|
} |
||||
|
qw.orderByDesc("si.id"); |
||||
|
return qw; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 员工管理分页列表 |
||||
|
* |
||||
|
* @param pagerQuery 查询条件 |
||||
|
* @return |
||||
|
*/ |
||||
|
public IPage<SysStaffinfoVo> pagerList(PagerQuery<SysStaffinfoQuery> pagerQuery) { |
||||
|
// mybits所用的分页对对象
|
||||
|
IPage<SysStaffinfoQuery> page = PagerUtil.queryToPage(pagerQuery); |
||||
|
// mybits所用的查询条件封装类
|
||||
|
QueryWrapper<SysStaffinfoVo> qw = createQueryWrapper(pagerQuery.getParams()); |
||||
|
IPage<SysStaffinfoVo> sysStaffinfoVoIPage = baseMapper.pagerList(page, qw); |
||||
|
List<SysStaffinfoVo> records = sysStaffinfoVoIPage.getRecords(); |
||||
|
for (SysStaffinfoVo record : records) { |
||||
|
String orgSid = record.getOrgSid(); |
||||
|
String orgName = ""; |
||||
|
if (StringUtils.isNotBlank(orgSid)) { |
||||
|
String[] split = orgSid.split(","); |
||||
|
for (String s : split) { |
||||
|
//获取本级sid获取本级部门信息
|
||||
|
SysOrganization sysOrganization = sysOrganizationService.fetchBySid(s); |
||||
|
if(sysOrganization == null){ |
||||
|
sysStaffOrgService.delByOrgSid(s); |
||||
|
}else{ |
||||
|
//从本级部门信息中获取上级sid
|
||||
|
String psid = sysOrganization.getPsid(); |
||||
|
//从本级部门信息中获取本级部门名称
|
||||
|
String bjName = sysOrganization.getName(); |
||||
|
//获取上级sid获取上级部门信息
|
||||
|
SysOrganization sysOrganization1 = sysOrganizationService.fetchBySid(psid); |
||||
|
//从上级部门信息中获取上级部门名称
|
||||
|
String sjName = sysOrganization1.getName(); |
||||
|
orgName += sjName + "-" + bjName + ","; |
||||
|
} |
||||
|
} |
||||
|
orgName = orgName.substring(0, orgName.length() - 1); |
||||
|
record.setOrgName(orgName); |
||||
|
} |
||||
|
} |
||||
|
return sysStaffinfoVoIPage; |
||||
|
} |
||||
|
|
||||
|
public List<AppContactSysOrganizationVo> selectContactsByOrgsid(String sid) { |
||||
|
List<AppContactSysOrganizationVo> list = baseMapper.selectContactsByOrgsid(sid); |
||||
|
list.stream().forEach(vo -> { |
||||
|
if (StringUtils.isNotBlank(vo.getHeadImage())) { |
||||
|
vo.setHeadImage(fileUploadComponent.getUrlPrefix() + vo.getHeadImage()); |
||||
|
} |
||||
|
}); |
||||
|
return list; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 员工信息的新增保存 |
||||
|
* |
||||
|
* @param dto 数据传输对象 |
||||
|
* @return |
||||
|
*/ |
||||
|
public ResultBean saveStaffInfo(SysStaffinfoDto dto) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysRoleVo sysRoleVo = sysRoleService.fetchByName("试用期员工"); |
||||
|
if (sysRoleVo == null) { |
||||
|
return rb.setMsg("缺少默认试用期员工角色"); |
||||
|
} |
||||
|
//员工类型
|
||||
|
//String personTypeKey = dto.getPersonTypeKey();
|
||||
|
String jobNumber = ""; |
||||
|
SysStaffinfo sysStaffinfo = baseMapper.selectJobNumber(); |
||||
|
if (sysStaffinfo == null) { |
||||
|
//无此员工类型的员工
|
||||
|
jobNumber = addOne("0000"); |
||||
|
} else { |
||||
|
jobNumber = sysStaffinfo.getJobNumber(); |
||||
|
jobNumber = addOne(jobNumber); |
||||
|
} |
||||
|
//查询员工的手机号是否重复
|
||||
|
SysStaffinfo sysStaffinfo1 = baseMapper.selectByMobile(dto.getMobile()); |
||||
|
SysUser sysUser1 = sysUserService.selectByMobile(dto.getMobile()); |
||||
|
if (sysStaffinfo1 != null || sysUser1 != null) { |
||||
|
return rb.setMsg("已存在手机号为" + dto.getMobile() + "的员工"); |
||||
|
} |
||||
|
//查询是否存在该身份证号的员工
|
||||
|
SysStaffinfo sysStaffinfo2 = baseMapper.selectByIdNo(dto.getIdNo()); |
||||
|
if (sysStaffinfo2 != null) { |
||||
|
return rb.setMsg("已存在身份证号为" + dto.getIdNo() + "的员工"); |
||||
|
} |
||||
|
//判断身份证号出生日期和填写的出生日期是否相同
|
||||
|
String idNo = dto.getIdNo(); |
||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd"); |
||||
|
String birthday = simpleDateFormat.format(dto.getBirthday()); |
||||
|
String substring = idNo.substring(6, 14); |
||||
|
if (!birthday.equals(substring)) { |
||||
|
return rb.setMsg("选择的出生日期和身份证出生日期不符,请重新选择"); |
||||
|
} |
||||
|
//查询部门和岗位是否为空
|
||||
|
if (dto.getSysStaffOrg() == null) { |
||||
|
return rb.setMsg("员工部门信息不能为空"); |
||||
|
} |
||||
|
if (dto.getSysStaffPost() == null) { |
||||
|
return rb.setMsg("员工岗位信息不能为空"); |
||||
|
} |
||||
|
Date joinCompnyDate = dto.getJoinCompnyDate(); |
||||
|
if (joinCompnyDate == null) { |
||||
|
return rb.setMsg("员工入职日期不能为空"); |
||||
|
} |
||||
|
//添加员工基础信息
|
||||
|
SysStaffinfo sysStaffinfo3 = new SysStaffinfo(); |
||||
|
dto.fillEntity(sysStaffinfo3); |
||||
|
sysStaffinfo3.setJobNumber(jobNumber); |
||||
|
sysStaffinfo3.setPinYinName(PinYinUtils.getPinYinName(dto.getName())); |
||||
|
sysStaffinfo3.setFirstPinYinLabel(PinYinUtils.getCharDuoPinYinChar(dto.getName())); |
||||
|
//是否意外险参保
|
||||
|
if (dto.getIsHaveInsurance() != null) { |
||||
|
//意外险参保:是
|
||||
|
if (dto.getIsHaveInsurance() == 1) { |
||||
|
//意外险参保地以及意外险参保开始时间和结束时间不能为空
|
||||
|
if (dto.getInsuranceStartDate() == null) { |
||||
|
return rb.setMsg("意外险参保时间不能为空"); |
||||
|
} |
||||
|
if (dto.getInsuranceEndDate() == null) { |
||||
|
return rb.setMsg("意外险终止时间不能为空"); |
||||
|
} |
||||
|
if (StringUtils.isBlank(dto.getInsuranceAddr())) { |
||||
|
return rb.setMsg("意外险参保地不能为空"); |
||||
|
} |
||||
|
} else { |
||||
|
sysStaffinfo3.setIsHaveInsurance(0); |
||||
|
sysStaffinfo3.setInsuranceStartDate(null); |
||||
|
sysStaffinfo3.setInsuranceEndDate(null); |
||||
|
sysStaffinfo3.setInsuranceAddr(null); |
||||
|
} |
||||
|
} |
||||
|
if ("01".equals(dto.getPersonTypeKey())) { |
||||
|
if (dto.getQuitDate() == null) { |
||||
|
return rb.setMsg("离职日期不能为空"); |
||||
|
} |
||||
|
if (StringUtils.isBlank(dto.getQuitReason())) { |
||||
|
return rb.setMsg("离职原因不能为空"); |
||||
|
} |
||||
|
} |
||||
|
//身份证(人像面)
|
||||
|
if (StringUtils.isNotBlank(sysStaffinfo3.getIdCardA())) { |
||||
|
if (sysStaffinfo3.getIdCardA().contains(fileUploadComponent.getUrlPrefix())) { |
||||
|
sysStaffinfo3.setIdCardA(sysStaffinfo3.getIdCardA().replace(fileUploadComponent.getUrlPrefix(), "")); |
||||
|
} |
||||
|
} |
||||
|
//身份证(国徽面)
|
||||
|
if (StringUtils.isNotBlank(sysStaffinfo3.getIdCardB())) { |
||||
|
if (sysStaffinfo3.getIdCardB().contains(fileUploadComponent.getUrlPrefix())) { |
||||
|
sysStaffinfo3.setIdCardB(sysStaffinfo3.getIdCardB().replace(fileUploadComponent.getUrlPrefix(), "")); |
||||
|
} |
||||
|
} |
||||
|
//学历证书diploma
|
||||
|
if (StringUtils.isNotBlank(sysStaffinfo3.getDiploma())) { |
||||
|
if (sysStaffinfo3.getDiploma().contains(fileUploadComponent.getUrlPrefix())) { |
||||
|
sysStaffinfo3.setDiploma(sysStaffinfo3.getDiploma().replace(fileUploadComponent.getUrlPrefix(), "")); |
||||
|
} |
||||
|
} |
||||
|
//学位证书degreeCertificate
|
||||
|
if (StringUtils.isNotBlank(sysStaffinfo3.getDegreeCertificate())) { |
||||
|
if (sysStaffinfo3.getDegreeCertificate().contains(fileUploadComponent.getUrlPrefix())) { |
||||
|
sysStaffinfo3.setDegreeCertificate(sysStaffinfo3.getDegreeCertificate().replace(fileUploadComponent.getUrlPrefix(), "")); |
||||
|
} |
||||
|
} |
||||
|
//前公司离职证明leaveCertificate
|
||||
|
if (StringUtils.isNotBlank(sysStaffinfo3.getLeaveCertificate())) { |
||||
|
if (sysStaffinfo3.getLeaveCertificate().contains(fileUploadComponent.getUrlPrefix())) { |
||||
|
sysStaffinfo3.setLeaveCertificate(sysStaffinfo3.getLeaveCertificate().replace(fileUploadComponent.getUrlPrefix(), "")); |
||||
|
} |
||||
|
} |
||||
|
//员工照片
|
||||
|
if (StringUtils.isNotBlank(sysStaffinfo3.getPhoto())) { |
||||
|
if (sysStaffinfo3.getPhoto().contains(fileUploadComponent.getUrlPrefix())) { |
||||
|
sysStaffinfo3.setPhoto(sysStaffinfo3.getPhoto().replace(fileUploadComponent.getUrlPrefix(), "")); |
||||
|
} |
||||
|
} |
||||
|
//增加员工的关联的部门信息
|
||||
|
SysStaffOrg sysStaffOrg = new SysStaffOrg(); |
||||
|
SysStaffOrgDto sysStaffOrgDto = dto.getSysStaffOrg(); |
||||
|
if (StringUtils.isBlank(sysStaffOrgDto.getOrgName())) { |
||||
|
return rb.setMsg("所在部门不能为空"); |
||||
|
} |
||||
|
sysStaffOrgDto.fillEntity(sysStaffOrg); |
||||
|
sysStaffOrg.setStaffSid(sysStaffinfo3.getSid()); |
||||
|
sysStaffOrg.setManageType("3"); |
||||
|
sysStaffOrgService.save(sysStaffOrg); |
||||
|
//增加员工的关联的岗位信息
|
||||
|
SysStaffPost sysStaffPost = new SysStaffPost(); |
||||
|
SysStaffPostDto sysStaffPostDto = dto.getSysStaffPost(); |
||||
|
if (StringUtils.isBlank(sysStaffPostDto.getPostSid())) { |
||||
|
return rb.setMsg("岗位不能为空"); |
||||
|
} |
||||
|
|
||||
|
save(sysStaffinfo3); |
||||
|
//添加用户信息
|
||||
|
SysUser sysUser = new SysUser(); |
||||
|
sysUser.setStaffSid(sysStaffinfo3.getSid()); |
||||
|
sysUser.setUserName(jobNumber); |
||||
|
sysUser.setMobile(sysStaffinfo3.getMobile()); |
||||
|
sysUser.setUserType(1); |
||||
|
String password = sysStaffinfo3.getMobile().substring(5, 11); |
||||
|
String md5 = Encodes.md5(password); |
||||
|
sysUser.setPassword(md5); |
||||
|
boolean isSave = sysUserService.save(sysUser); |
||||
|
sysStaffPostDto.fillEntity(sysStaffPost); |
||||
|
sysStaffPost.setStaffSid(sysStaffinfo3.getSid()); |
||||
|
sysStaffPost.setStartDate(new Date()); |
||||
|
sysStaffPostService.save(sysStaffPost); |
||||
|
if (!isSave) { |
||||
|
return rb.setMsg("添加员工信息失败"); |
||||
|
} |
||||
|
SysUserRole sysUserRole = new SysUserRole(); |
||||
|
sysUserRole.setUserSid(sysUser.getSid()); |
||||
|
sysUserRole.setRoleSid(sysRoleVo.getSid()); |
||||
|
sysUserRoleService.save(sysUserRole); |
||||
|
return rb.success().setMsg("添加员工信息成功"); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 字符串+1方法,该方法将其结尾的整数+1,适用于任何以整数结尾的字符串,不限格式,不限分隔符。 |
||||
|
* |
||||
|
* @param testStr 要+1的字符串 |
||||
|
* @return +1后的字符串 |
||||
|
* @throws NumberFormatException |
||||
|
*/ |
||||
|
public static String addOne(String testStr) { |
||||
|
//根据不是数字的字符拆分字符串
|
||||
|
String[] strs = testStr.split("[^0-9]"); |
||||
|
//取出最后一组数字
|
||||
|
String numStr = strs[strs.length - 1]; |
||||
|
//如果最后一组没有数字(也就是不以数字结尾),抛NumberFormatException异常
|
||||
|
if (numStr != null && numStr.length() > 0) { |
||||
|
//取出字符串的长度
|
||||
|
int n = numStr.length(); |
||||
|
//将该数字加一
|
||||
|
int num = Integer.parseInt(numStr) + 1; |
||||
|
String added = String.valueOf(num); |
||||
|
n = Math.min(n, added.length()); |
||||
|
//拼接字符串
|
||||
|
return testStr.subSequence(0, testStr.length() - n) + added; |
||||
|
} else { |
||||
|
throw new NumberFormatException(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 员工信息修改保存 |
||||
|
* |
||||
|
* @param dto 数据传输对象 |
||||
|
* @param sid 员工信息sid |
||||
|
* @return |
||||
|
*/ |
||||
|
public ResultBean updateStaffInfo(SysStaffinfoDto dto, String sid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
//查询该人员的组织机构list
|
||||
|
List<SysStaffOrgVo> sysStaffOrgVos = sysStaffOrgService.selectByStaffS(sid); |
||||
|
List<String> orgList = new ArrayList<>(); |
||||
|
if (sysStaffOrgVos.size() > 0) { |
||||
|
for (SysStaffOrgVo vv : sysStaffOrgVos) { |
||||
|
// String orgSid = sysStaffOrgService.getOrgByOrgSid(vv.getOrgSid());
|
||||
|
String orgSid = vv.getOrgSid(); |
||||
|
SysOrganization sysOrganization = sysOrganizationService.fetchBySid(orgSid); |
||||
|
if (sysOrganization != null) { |
||||
|
orgList.add(orgSid); |
||||
|
} else { |
||||
|
continue; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
//根据员工sid查询员工的信息
|
||||
|
SysStaffinfo sysStaffinfo = fetchBySid(sid); |
||||
|
if (sysStaffinfo == null) { |
||||
|
return rb.setMsg("此员工信息不存在"); |
||||
|
} |
||||
|
//查询员工的手机号是否重复
|
||||
|
SysStaffinfo sysStaffinfo2 = baseMapper.selectByMobileAndSid(dto.getMobile(), sid); |
||||
|
if (sysStaffinfo2 != null) { |
||||
|
return rb.setMsg("已存在手机号为" + dto.getMobile() + "的员工"); |
||||
|
} |
||||
|
//查询是否存在该身份证号的员工
|
||||
|
SysStaffinfo sysStaffinfo3 = baseMapper.selectByIdNoAndSid(dto.getIdNo(), sid); |
||||
|
if (sysStaffinfo3 != null) { |
||||
|
return rb.setMsg("已存在身份证号为" + dto.getIdNo() + "的员工"); |
||||
|
} |
||||
|
//更新员工基础信息
|
||||
|
BeanUtil.copyProperties(dto, sysStaffinfo); |
||||
|
sysStaffinfo.setJobNumber(dto.getJobNumber()); |
||||
|
sysStaffinfo.setPinYinName(PinYinUtils.getPinYinName(dto.getName())); |
||||
|
sysStaffinfo.setFirstPinYinLabel(PinYinUtils.getCharDuoPinYinChar(dto.getName())); |
||||
|
//是否意外险参保
|
||||
|
if (dto.getIsHaveInsurance() != null) { |
||||
|
//意外险参保:是
|
||||
|
if (dto.getIsHaveInsurance() == 1) { |
||||
|
//意外险参保地以及意外险参保开始时间和结束时间不能为空
|
||||
|
if (dto.getInsuranceStartDate() == null) { |
||||
|
return rb.setMsg("意外险参保时间不能为空"); |
||||
|
} |
||||
|
if (dto.getInsuranceEndDate() == null) { |
||||
|
return rb.setMsg("意外险终止时间不能为空"); |
||||
|
} |
||||
|
if (StringUtils.isBlank(dto.getInsuranceAddr())) { |
||||
|
return rb.setMsg("意外险参保地不能为空"); |
||||
|
} |
||||
|
} else { |
||||
|
sysStaffinfo.setIsHaveInsurance(0); |
||||
|
sysStaffinfo.setInsuranceStartDate(null); |
||||
|
sysStaffinfo.setInsuranceEndDate(null); |
||||
|
sysStaffinfo.setInsuranceAddr(null); |
||||
|
} |
||||
|
} |
||||
|
if ("01".equals(dto.getPersonTypeKey())) { |
||||
|
if (dto.getQuitDate() == null) { |
||||
|
return rb.setMsg("离职日期不能为空"); |
||||
|
} |
||||
|
if (StringUtils.isBlank(dto.getQuitReason())) { |
||||
|
return rb.setMsg("离职原因不能为空"); |
||||
|
} |
||||
|
} |
||||
|
//身份证(人像面)
|
||||
|
if (StringUtils.isNotBlank(sysStaffinfo.getIdCardA())) { |
||||
|
if (sysStaffinfo.getIdCardA().contains(fileUploadComponent.getUrlPrefix())) { |
||||
|
sysStaffinfo.setIdCardA(sysStaffinfo.getIdCardA().replace(fileUploadComponent.getUrlPrefix(), "")); |
||||
|
} |
||||
|
} |
||||
|
//身份证(国徽面)
|
||||
|
if (StringUtils.isNotBlank(sysStaffinfo.getIdCardB())) { |
||||
|
if (sysStaffinfo.getIdCardB().contains(fileUploadComponent.getUrlPrefix())) { |
||||
|
sysStaffinfo.setIdCardB(sysStaffinfo.getIdCardB().replace(fileUploadComponent.getUrlPrefix(), "")); |
||||
|
} |
||||
|
} |
||||
|
//学历证书diploma
|
||||
|
if (StringUtils.isNotBlank(sysStaffinfo.getDiploma())) { |
||||
|
if (sysStaffinfo.getDiploma().contains(fileUploadComponent.getUrlPrefix())) { |
||||
|
sysStaffinfo.setDiploma(sysStaffinfo.getDiploma().replace(fileUploadComponent.getUrlPrefix(), "")); |
||||
|
} |
||||
|
} |
||||
|
//学位证书degreeCertificate
|
||||
|
if (StringUtils.isNotBlank(sysStaffinfo.getDegreeCertificate())) { |
||||
|
if (sysStaffinfo.getDegreeCertificate().contains(fileUploadComponent.getUrlPrefix())) { |
||||
|
sysStaffinfo.setDegreeCertificate(sysStaffinfo.getDegreeCertificate().replace(fileUploadComponent.getUrlPrefix(), "")); |
||||
|
} |
||||
|
} |
||||
|
//前公司离职证明leaveCertificate
|
||||
|
if (StringUtils.isNotBlank(sysStaffinfo.getLeaveCertificate())) { |
||||
|
if (sysStaffinfo.getLeaveCertificate().contains(fileUploadComponent.getUrlPrefix())) { |
||||
|
sysStaffinfo.setLeaveCertificate(sysStaffinfo.getLeaveCertificate().replace(fileUploadComponent.getUrlPrefix(), "")); |
||||
|
} |
||||
|
} |
||||
|
//员工照片
|
||||
|
if (StringUtils.isNotBlank(sysStaffinfo.getPhoto())) { |
||||
|
if (sysStaffinfo.getPhoto().contains(fileUploadComponent.getUrlPrefix())) { |
||||
|
sysStaffinfo.setPhoto(sysStaffinfo.getPhoto().replace(fileUploadComponent.getUrlPrefix(), "")); |
||||
|
} |
||||
|
} |
||||
|
//更新用户信息
|
||||
|
sysUserService.updateByStaffSid(dto.getJobNumber(), sysStaffinfo.getMobile(), sid); |
||||
|
//更新员工的关联的部门信息
|
||||
|
SysStaffOrgDto sysStaffOrgDto = dto.getSysStaffOrg(); |
||||
|
int count = sysStaffOrgService.selectByStaffAndOrg(sysStaffOrgDto.getOrgSidPath(), sid, "2"); |
||||
|
if (count > 0) { |
||||
|
sysStaffOrgService.deleteByStaffSidAndType(sysStaffOrgDto.getOrgSidPath(), sid, "2"); |
||||
|
} |
||||
|
SysStaffOrg sysStaffOrg = sysStaffOrgService.getOrgByStaffSidAndPath(sid,sysStaffOrgDto.getOrgSidPath()); |
||||
|
if(sysStaffOrg == null){ |
||||
|
ResultBean<SysStaffOrg> staffOrgResultBean = sysStaffOrgService.selectAllByStaffSid(sid); |
||||
|
sysStaffOrg = staffOrgResultBean.getData(); |
||||
|
if(sysStaffOrg == null){ |
||||
|
sysStaffOrg = new SysStaffOrg(); |
||||
|
sysStaffOrg.setStaffSid(sid); |
||||
|
BeanUtil.copyProperties(sysStaffOrgDto,sysStaffOrg); |
||||
|
sysStaffOrg.setManageType("3"); |
||||
|
sysStaffOrgService.insert(sysStaffOrg); |
||||
|
}else{ |
||||
|
BeanUtil.copyProperties(sysStaffOrgDto,sysStaffOrg); |
||||
|
sysStaffOrg.setManageType("3"); |
||||
|
sysStaffOrgService.updateById(sysStaffOrg); |
||||
|
} |
||||
|
}else{ |
||||
|
BeanUtil.copyProperties(sysStaffOrgDto,sysStaffOrg); |
||||
|
sysStaffOrg.setManageType("3"); |
||||
|
sysStaffOrgService.updateById(sysStaffOrg); |
||||
|
} |
||||
|
|
||||
|
//更新员工的关联的岗位信息
|
||||
|
SysStaffPostDetailsVo staffPostDetailsVo = sysStaffPostService.getPostByStaffSid(sid); |
||||
|
SysStaffPost sysStaffPost = sysStaffPostService.selectByStaffSid(sid, staffPostDetailsVo.getPostSid()); |
||||
|
SysStaffPostDto sysStaffPostDto = dto.getSysStaffPost(); |
||||
|
sysStaffPostService.updateBySid(sysStaffPostDto, sysStaffPost.getSid()); |
||||
|
boolean isUpdate = updateById(sysStaffinfo); |
||||
|
if (!isUpdate) { |
||||
|
return rb.setMsg("更新员工信息失败"); |
||||
|
} |
||||
|
List<SysStaffOrgVo> sysStaffOrgVos1 = sysStaffOrgService.selectByStaffS(sid); |
||||
|
List<String> orgList1 = new ArrayList<>(); |
||||
|
if (sysStaffOrgVos1.size() > 0) { |
||||
|
for (SysStaffOrgVo vv : sysStaffOrgVos1) { |
||||
|
// String orgSid = sysStaffOrgService.getOrgByOrgSid(vv.getOrgSid());
|
||||
|
String orgSid = vv.getOrgSid(); |
||||
|
SysOrganization sysOrganization = sysOrganizationService.fetchBySid(orgSid); |
||||
|
if (sysOrganization != null) { |
||||
|
orgList1.add(orgSid); |
||||
|
} else { |
||||
|
continue; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
List<String> reduce1 = orgList.stream().filter(item -> !orgList1.contains(item)).collect(toList()); |
||||
|
if (reduce1.size() > 0) { |
||||
|
//根据staffSid查询token
|
||||
|
String token = sysUserService.selectByStaffsid(sid).getToken(); |
||||
|
//清空该token
|
||||
|
redisUtil.remove(token); |
||||
|
} |
||||
|
return rb.success().setMsg("更新员工信息成功"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据员工sid查询员工信息 |
||||
|
* |
||||
|
* @param sid 员工sid |
||||
|
* @return |
||||
|
*/ |
||||
|
public SysStaffinfoDetailsVo selectDetailsBySid(String sid) { |
||||
|
String path = fileUploadComponent.getUrlPrefix(); |
||||
|
SysStaffinfoDetailsVo sysStaffinfoDetailsVo = baseMapper.selectDetailsBySid(sid, path); |
||||
|
if (sysStaffinfoDetailsVo != null) { |
||||
|
List<SysStaffOrg> sysStaffOrgList = sysStaffOrgService.getOrgByStaffSidList(sid); |
||||
|
String orgSid = ""; |
||||
|
String type = ""; |
||||
|
for (SysStaffOrg s : sysStaffOrgList) { |
||||
|
if ("3".equals(s.getManageType())) { |
||||
|
orgSid = s.getOrgSid(); |
||||
|
type = s.getManageType(); |
||||
|
break; |
||||
|
} else if ("1".equals(s.getManageType())) { |
||||
|
orgSid = s.getOrgSid(); |
||||
|
type = s.getManageType(); |
||||
|
break; |
||||
|
} else { |
||||
|
orgSid = s.getOrgSid(); |
||||
|
type = s.getManageType(); |
||||
|
} |
||||
|
} |
||||
|
SysStaffPostDetailsVo staffPostDetailsVo = sysStaffPostService.getPostByStaffSid(sid); |
||||
|
SysStaffOrgDetailsVo sysStaffOrgDetailsVo = sysStaffOrgService.selectByStaffByType(sid, orgSid, type); |
||||
|
SysStaffPostDetailsVo sysStaffPostDetailsVo = sysStaffPostService.selectByStaff(sid, staffPostDetailsVo.getPostSid()); |
||||
|
if(sysStaffOrgDetailsVo != null){ |
||||
|
sysStaffinfoDetailsVo.setSysStaffOrg(sysStaffOrgDetailsVo); |
||||
|
}else{ |
||||
|
sysStaffinfoDetailsVo.setSysStaffOrg(new SysStaffOrgDetailsVo()); |
||||
|
} |
||||
|
if(sysStaffPostDetailsVo != null){ |
||||
|
sysStaffinfoDetailsVo.setSysStaffPost(sysStaffPostDetailsVo); |
||||
|
}else{ |
||||
|
sysStaffinfoDetailsVo.setSysStaffPost(new SysStaffPostDetailsVo()); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
return sysStaffinfoDetailsVo; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 员工信息的删除操作,即设置员工类型为离职状态。 |
||||
|
* |
||||
|
* @param sysStaffQuery 员工sid |
||||
|
* @return |
||||
|
*/ |
||||
|
public int del(SysStaffQuery sysStaffQuery) { |
||||
|
int count = 0; |
||||
|
//员工类型离职状态
|
||||
|
String personTypeKey = "01"; |
||||
|
String personType = "离职"; |
||||
|
//String jobNumber = "";
|
||||
|
//SysStaffinfo sysStaffinfo = baseMapper.selectJobNumber(personTypeKey);
|
||||
|
/* if (sysStaffinfo == null) { |
||||
|
//无此员工类型的员工
|
||||
|
jobNumber = addOne("9000"); |
||||
|
} else { |
||||
|
jobNumber = sysStaffinfo.getJobNumber(); |
||||
|
jobNumber = addOne(jobNumber); |
||||
|
} |
||||
|
jobNumber = sysStaffinfo.getJobNumber();*/ |
||||
|
//更新员工的员工状态以及员工工号
|
||||
|
int j = baseMapper.updateBySid(personType, personTypeKey, sysStaffQuery.getSid(), sysStaffQuery.getQuitDate(), sysStaffQuery.getQuitReason()); |
||||
|
//根据staffSid查询token
|
||||
|
String token = sysUserService.selectByStaffsid(sysStaffQuery.getSid()).getToken(); |
||||
|
if(StringUtils.isNotBlank(token)){ |
||||
|
//清空该token
|
||||
|
redisUtil.remove(token); |
||||
|
} |
||||
|
//更新用户表中该员工的员工工号
|
||||
|
//sysUserService.updateByStaSid(jobNumber, sysStaffQuery.getSid());
|
||||
|
if (j > 0) { |
||||
|
count++; |
||||
|
} |
||||
|
return count; |
||||
|
} |
||||
|
|
||||
|
public ResultBean<List<PcSysStaffVo>> selectStaffList(PcSysStaffQuery pcSysStaffQuery) { |
||||
|
ResultBean<List<PcSysStaffVo>> rb = ResultBean.fireFail(); |
||||
|
//根据当前staffSid查询分公司sid
|
||||
|
String orgSid = ""; |
||||
|
List<PcSysStaffVo> list = new ArrayList<>(); |
||||
|
ResultBean<String> stringResultBean = sysStaffOrgService.selectSidPathByStaffSid(pcSysStaffQuery.getStaffSid()); |
||||
|
if (stringResultBean.getSuccess()) { |
||||
|
orgSid = stringResultBean.getData(); |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(orgSid)) { |
||||
|
list = baseMapper.selectStaffList(orgSid); |
||||
|
} |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
public List<Map<String, String>> getStaffName(String staffName,String deptSid) { |
||||
|
QueryWrapper<Map<String, Object>> qw = new QueryWrapper<>(); |
||||
|
if (StringUtils.isNotBlank(staffName)) { |
||||
|
qw.like("ss.name", staffName); |
||||
|
} |
||||
|
qw.eq("ss.isDelete", 0); |
||||
|
qw.ne("sso.orgSid", deptSid); |
||||
|
qw.ne("ss.personTypeKey","01"); |
||||
|
return baseMapper.getStaffName(qw); |
||||
|
} |
||||
|
|
||||
|
public List<Map<String, String>> getStaffNameByDeptSid(String staffName, String deptSid) { |
||||
|
QueryWrapper<Map<String, Object>> qw = new QueryWrapper<>(); |
||||
|
if (StringUtils.isNotBlank(staffName)) { |
||||
|
qw.like("ss.name", staffName); |
||||
|
} |
||||
|
qw.eq("sso.orgSid", deptSid); |
||||
|
qw.eq("ss.isDelete", 0); |
||||
|
qw.ne("ss.personTypeKey","01"); |
||||
|
return baseMapper.getStaffNameByDeptSid(qw); |
||||
|
} |
||||
|
|
||||
|
public PagerVo<AppSysStaffVo> getUserList(PagerQuery<AppSysStaffQuery> pagerQuery) { |
||||
|
IPage<SysStaffinfo> page = PagerUtil.queryToPage(pagerQuery); |
||||
|
AppSysStaffQuery params = pagerQuery.getParams(); |
||||
|
QueryWrapper<AppSysStaffVo> qw = new QueryWrapper<>(); |
||||
|
String orgSid = ""; |
||||
|
if (params != null) { |
||||
|
if(StringUtils.isNotBlank(params.getOrgPath())){ |
||||
|
String orgPath = params.getOrgPath(); |
||||
|
orgSid = sysStaffOrgService.getOrgSidByPath(orgPath).getData(); |
||||
|
} |
||||
|
if (StringUtils.isNotBlank(params.getName())) { |
||||
|
qw.like("si.name", params.getName()); |
||||
|
} |
||||
|
if (params.getSelectSid() != null && params.getSelectSid().size() > 0){ |
||||
|
qw.notIn("su.sid",params.getSelectSid()); |
||||
|
} |
||||
|
if(params.getState() == 0){ |
||||
|
qw.eq("si.personTypeKey","02"); |
||||
|
} |
||||
|
} |
||||
|
IPage<AppSysStaffVo> pagging = baseMapper.getUserList(page, qw, orgSid); |
||||
|
List<AppSysStaffVo> list = pagging.getRecords(); |
||||
|
list.removeAll(Collections.singleton(null)); |
||||
|
if (!list.isEmpty()) { |
||||
|
for (AppSysStaffVo vo : list) { |
||||
|
String headImage = vo.getHeadImage(); |
||||
|
if (StringUtils.isNotBlank(headImage)) { |
||||
|
if (!headImage.contains(fileUploadComponent.getUrlPrefix())) { |
||||
|
headImage = fileUploadComponent.getUrlPrefix() + headImage; |
||||
|
} |
||||
|
vo.setUserImage(headImage); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
PagerVo<AppSysStaffVo> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
|
||||
|
public ResultBean<List<AppSysStaffVo>> getGressionUserList(String userSid, String orgPath) { |
||||
|
ResultBean<List<AppSysStaffVo>> rb = ResultBean.fireFail(); |
||||
|
String useOrgSid = ""; |
||||
|
if(StringUtils.isNotBlank(orgPath)){ |
||||
|
useOrgSid = sysStaffOrgService.getOrgSidByPath(orgPath).getData(); |
||||
|
}else{ |
||||
|
useOrgSid = sysStaffOrgService.getPathSidByUserSid(userSid).getData(); |
||||
|
} |
||||
|
List<AppSysStaffVo> list = baseMapper.getGressionUserList(useOrgSid); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
public ResultBean<List<PcSysStaffVo>> selectStaffLists() { |
||||
|
ResultBean<List<PcSysStaffVo>> rb = ResultBean.fireFail(); |
||||
|
List<PcSysStaffVo> list = baseMapper.selectStaffLists(); |
||||
|
list.removeAll(Collections.singleton(null)); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
|
||||
|
public ResultBean<List<PcSysStaffVo>> selectStaffListss() { |
||||
|
ResultBean<List<PcSysStaffVo>> rb = ResultBean.fireFail(); |
||||
|
List<PcSysStaffVo> list = baseMapper.selectStaffListss(); |
||||
|
list.removeAll(Collections.singleton(null)); |
||||
|
return rb.success().setData(list); |
||||
|
} |
||||
|
} |
@ -0,0 +1,47 @@ |
|||||
|
package com.yxt.user.biz.sysstaffinfo; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysStaffinfoVo.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysstaffinfo.SysStaffinfoVo <br/> |
||||
|
* Description: 人员基础信息表 视图数据对象. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:30 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "人员基础信息表 视图数据对象", description = "人员基础信息表 视图数据对象") |
||||
|
@Data |
||||
|
public class SysStaffinfoVo implements Vo { |
||||
|
|
||||
|
private static final long serialVersionUID = -1250862291306247261L; |
||||
|
@ApiModelProperty(value = "员工sid") |
||||
|
private String sid; |
||||
|
@ApiModelProperty(value = "员工编号") |
||||
|
private String jobNumber; |
||||
|
@ApiModelProperty("姓名") |
||||
|
private String name; |
||||
|
@ApiModelProperty("员工类型") |
||||
|
private String personType; |
||||
|
@ApiModelProperty("手机号") |
||||
|
private String mobile; |
||||
|
@ApiModelProperty(value = "入职日期") |
||||
|
private String joinCompnyDate; |
||||
|
@ApiModelProperty(value = "部门") |
||||
|
private String orgName; |
||||
|
@ApiModelProperty(value = "岗位") |
||||
|
private String postName; |
||||
|
@ApiModelProperty(value = "部门sid") |
||||
|
private String orgSid; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
package com.yxt.user.biz.sysstaffinfo; |
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author dimengzhe |
||||
|
* @date 2021/10/6 16:58 |
||||
|
* @description |
||||
|
*/ |
||||
|
@Data |
||||
|
public class WxBase64Query implements Query { |
||||
|
private static final long serialVersionUID = 4307651151043379231L; |
||||
|
// @ApiModelProperty(value = "base64")
|
||||
|
// private String base64File;
|
||||
|
|
||||
|
@ApiModelProperty(value = "图片全路径") |
||||
|
private String imageUrl; |
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
package com.yxt.user.biz.sysstaffinfo; |
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
|
||||
|
/** |
||||
|
* @author dimengzhe |
||||
|
* @date 2021/10/6 12:08 |
||||
|
* @description 客户端上传身份证 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class WxSysInfoQuery implements Query { |
||||
|
private static final long serialVersionUID = 7273642052588903116L; |
||||
|
@ApiModelProperty(value = "用户sid", required = true) |
||||
|
@NotBlank(message = "用户sid不能为空") |
||||
|
private String userSid; |
||||
|
@ApiModelProperty(value = "身份证(人像面)", required = true) |
||||
|
@NotBlank(message = "身份证(人像面)不能为空") |
||||
|
private String idCardA; |
||||
|
@ApiModelProperty(value = "身份证(国徽面)", required = true) |
||||
|
@NotBlank(message = "身份证(国徽面)不能为空") |
||||
|
private String idCardB; |
||||
|
|
||||
|
@ApiModelProperty(value = "身份证地址", required = true) |
||||
|
@NotBlank(message = "身份证地址不能为空") |
||||
|
private String idAddrs; |
||||
|
@ApiModelProperty(value = "证件有效期", required = true) |
||||
|
@NotBlank(message = "证件有效期不能为空") |
||||
|
private String idTerm; |
||||
|
@ApiModelProperty(value = "生日") |
||||
|
private String birth; |
||||
|
@ApiModelProperty(value = "民族") |
||||
|
private String national; |
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
package com.yxt.user.biz.sysstaffinfo.app; |
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/6/11 9:44 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Data |
||||
|
public class AppSysStaffQuery implements Query { |
||||
|
private static final long serialVersionUID = 4724669786231817593L; |
||||
|
@ApiModelProperty(value = "用户名称") |
||||
|
private String name; |
||||
|
@ApiModelProperty(value = "用户sid") |
||||
|
private String userSid; |
||||
|
|
||||
|
@ApiModelProperty("组织机构sid") |
||||
|
private String orgPath; |
||||
|
|
||||
|
@ApiModelProperty("已选人员sid") |
||||
|
private List<String> selectSid; |
||||
|
|
||||
|
@ApiModelProperty("state:1是所有,0是本分公司") |
||||
|
private int state; |
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
package com.yxt.user.biz.sysstaffinfo.app; |
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/6/11 9:29 |
||||
|
* @Description |
||||
|
*/ |
||||
|
@Data |
||||
|
public class AppSysStaffVo implements Vo { |
||||
|
private static final long serialVersionUID = -4051562700421770402L; |
||||
|
@ApiModelProperty(value = "用户sid") |
||||
|
private String userSid; |
||||
|
@ApiModelProperty(value = "用户名称") |
||||
|
private String userName; |
||||
|
@ApiModelProperty(value = "头像") |
||||
|
private String userImage; |
||||
|
@ApiModelProperty(value = "电话") |
||||
|
private String userMobile; |
||||
|
@ApiModelProperty(value = "部门") |
||||
|
private String department; |
||||
|
@ApiModelProperty(value = "岗位") |
||||
|
private String position; |
||||
|
|
||||
|
@ApiModelProperty(value = "头像:后端内部使用") |
||||
|
private String headImage; |
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
package com.yxt.user.biz.sysstafforg; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.yxt.common.core.domain.BaseEntity; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysStaffOrg.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysstafforg.SysStaffOrg <br/> |
||||
|
* Description: 员工部门关联表. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "员工部门关联表", description = "员工部门关联表") |
||||
|
@TableName("sys_staff_org") |
||||
|
@Data |
||||
|
public class SysStaffOrg extends BaseEntity { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("部门sid") |
||||
|
private String orgSid; |
||||
|
|
||||
|
@ApiModelProperty("部门名称") |
||||
|
private String orgName; |
||||
|
|
||||
|
@ApiModelProperty("人员sid") |
||||
|
private String staffSid; |
||||
|
|
||||
|
@ApiModelProperty("部门路径") |
||||
|
private String orgSidPath; |
||||
|
|
||||
|
@ApiModelProperty("部门名称路径") |
||||
|
private String orgNamePath; |
||||
|
|
||||
|
@ApiModelProperty("管理类型:1、主管。2、分管。3、员工") |
||||
|
private String manageType; |
||||
|
} |
@ -0,0 +1,30 @@ |
|||||
|
package com.yxt.user.biz.sysstafforg; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysStaffOrgVo.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgVo <br/> |
||||
|
* Description: 员工部门关联表 视图数据对象. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "员工部门关联表 视图数据对象", description = "员工部门关联表 视图数据对象") |
||||
|
@Data |
||||
|
public class SysStaffOrgByUserVo implements Vo { |
||||
|
|
||||
|
@ApiModelProperty("sid") |
||||
|
private String sid; |
||||
|
@ApiModelProperty("员工姓名") |
||||
|
private String name; |
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
package com.yxt.user.biz.sysstafforg; |
||||
|
|
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @Author dimengzhe |
||||
|
* @Date 2022/2/11 16:15 |
||||
|
* @Description 员工部门详情信息 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class SysStaffOrgDetailsVo implements Vo { |
||||
|
private static final long serialVersionUID = 5354841525724609428L; |
||||
|
|
||||
|
@ApiModelProperty("部门sid") |
||||
|
private String orgSid; |
||||
|
@ApiModelProperty("部门名称") |
||||
|
private String orgName; |
||||
|
@ApiModelProperty("部门路径") |
||||
|
private String orgSidPath; |
||||
|
@ApiModelProperty("部门名称路径") |
||||
|
private String orgNamePath; |
||||
|
@ApiModelProperty(value = "部门编码") |
||||
|
private String orgCode; |
||||
|
@ApiModelProperty("管理类型:1、主管。2、分管。3、员工") |
||||
|
private String manageType; |
||||
|
} |
@ -0,0 +1,42 @@ |
|||||
|
package com.yxt.user.biz.sysstafforg; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.dto.Dto; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysStaffOrgDto.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgDto <br/> |
||||
|
* Description: 员工部门关联表 数据传输对象. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "员工部门关联表 数据传输对象", description = "员工部门关联表 数据传输对象") |
||||
|
@Data |
||||
|
public class SysStaffOrgDto implements Dto { |
||||
|
|
||||
|
private static final long serialVersionUID = 1403491378761015027L; |
||||
|
@ApiModelProperty("部门sid") |
||||
|
private String orgSid; |
||||
|
@ApiModelProperty("部门名称") |
||||
|
@NotBlank(message = "部门名称不能为空") |
||||
|
private String orgName; |
||||
|
@ApiModelProperty("部门路径") |
||||
|
private String orgSidPath; |
||||
|
@ApiModelProperty("部门名称路径") |
||||
|
private String orgNamePath; |
||||
|
@ApiModelProperty(value = "部门编码") |
||||
|
private String orgCode; |
||||
|
@ApiModelProperty(value = "管理类型:1、主管。2、分管。3、员工", example = "3") |
||||
|
private String manageType; |
||||
|
} |
@ -0,0 +1,117 @@ |
|||||
|
package com.yxt.user.biz.sysstafforg; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
|
import com.yxt.user.biz.sysuserdefaultorg.SysOrgPathList; |
||||
|
import org.apache.ibatis.annotations.Delete; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.apache.ibatis.annotations.Select; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysStaffOrgMapper.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.biz.sysstafforg.SysStaffOrgMapper <br/> |
||||
|
* Description: 员工部门关联表. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface SysStaffOrgMapper extends BaseMapper<SysStaffOrg> { |
||||
|
|
||||
|
IPage<SysStaffOrgVo> selectPageVo(IPage<SysStaffOrg> page, @Param(Constants.WRAPPER) Wrapper<SysStaffOrg> qw); |
||||
|
|
||||
|
List<SysStaffOrgVo> selectListAllVo(@Param(Constants.WRAPPER) Wrapper<SysStaffOrg> qw); |
||||
|
|
||||
|
@Select("select * from sys_staff_org") |
||||
|
List<SysStaffOrgVo> selectListVo(); |
||||
|
|
||||
|
@Delete("delete from sys_staff_org where orgSid=#{orgSid} ") |
||||
|
void delByOrgSid(@Param("orgSid") String sid); |
||||
|
|
||||
|
@Select("select staffOrg.manageType as manageType,staffOrg.orgSid as orgSid,staffinfo.name as staffName,staffinfo.sid as staffSid " + |
||||
|
"from sys_staff_org staffOrg left join sys_staffinfo staffinfo on staffinfo.sid=staffOrg.staffSid " + |
||||
|
"where staffOrg.orgSid=#{orgSid} ") |
||||
|
List<SysStaffOrgVo> fetchByOrgSid(@Param("orgSid") String orgSid); |
||||
|
|
||||
|
@Delete("delete from sys_staff_org where staffSid=#{staffSid} ") |
||||
|
void deleteByStaffSid(String staffSid); |
||||
|
|
||||
|
List<SysStaffOrgVo> staffinfoList(@Param(Constants.WRAPPER) QueryWrapper<SysStaffOrg> queryWrapper); |
||||
|
|
||||
|
@Select("select * from sys_staff_org where staffSid=#{staffSid}") |
||||
|
List<SysStaffOrgVo> getSysStaffOrgListByStaffSid(@Param("staffSid") String staffSid); |
||||
|
|
||||
|
@Select("select * from sys_staff_org where staffSid=#{staffSid} and manageType = '3'") |
||||
|
List<SysStaffOrgVo> getSysStaffOrgListByStaff(@Param("staffSid") String staffSid); |
||||
|
|
||||
|
/** |
||||
|
* 根据员工sid更新员工信息 |
||||
|
* |
||||
|
* @param sid 员工sid |
||||
|
* @return |
||||
|
*/ |
||||
|
SysStaffOrg selectByStaffSid(@Param("sid") String sid, @Param("orgSid") String orgSid); |
||||
|
|
||||
|
/** |
||||
|
* 员工部门信息详情 |
||||
|
* |
||||
|
* @param sid 员工sid |
||||
|
* @return |
||||
|
*/ |
||||
|
SysStaffOrgDetailsVo selectByStaff(@Param("sid") String sid, @Param("orgSid") String orgSid); |
||||
|
|
||||
|
SysStaffOrgDetailsVo selectByStaffByType(@Param("sid") String sid, @Param("orgSid") String orgSid, @Param("type") String type); |
||||
|
|
||||
|
@Select("SELECT GROUP_CONCAT(DISTINCT(orgSid)) FROM sys_staff_org WHERE staffSid=#{staffSid}") |
||||
|
String getSysStaffOrgSidListByStaffSid(@Param("staffSid") String staffSid); |
||||
|
|
||||
|
String selectBySidPathByStaffSid(String applySid); |
||||
|
|
||||
|
@Select("select * from sys_staff_org where staffSid=#{staffSid} AND manageType != 2") |
||||
|
SysStaffOrg selectAllByStaffSid(String staffSid); |
||||
|
|
||||
|
@Select("select * from sys_staff_org where staffSid=#{sid} and manageType = '3' order by id limit 1") |
||||
|
SysStaffOrg getOrgByStaffSid(String sid); |
||||
|
|
||||
|
@Select("select * from sys_staff_org where staffSid=#{sid} and orgSidPath = #{path} ") |
||||
|
SysStaffOrg getOrgByStaffSidAndPath(@Param("sid") String sid, @Param("path") String path); |
||||
|
|
||||
|
@Select("select * from sys_staff_org where staffSid=#{sid}") |
||||
|
List<SysStaffOrg> getOrgByStaffSidList(String sid); |
||||
|
|
||||
|
@Delete("delete from sys_staff_org where orgSid=#{sid} and (manageType = 1 or manageType = 2)") |
||||
|
void delZGAndFGByOrgSid(String sid); |
||||
|
|
||||
|
int selectByStaffAndOrg(@Param("sid") String sid, @Param("staffSid") String zgStaffSid, @Param("type") String type); |
||||
|
|
||||
|
int deleteByStaffSidAndType(@Param("sid") String sid, @Param("staffSid") String zgStaffSid, @Param("type") String type); |
||||
|
|
||||
|
List<SysStaffOrgVo> selectByStaffS(String staffSid); |
||||
|
|
||||
|
List<String> selectByOrgSid(String sid); |
||||
|
|
||||
|
String selectByUserSid(String userSid); |
||||
|
|
||||
|
List<SysStaffOrg> selectOrgBySid(@Param("orgPath") String orgPath, @Param("staffSid") String staffSid); |
||||
|
|
||||
|
List<SysOrgPathList> getList(String staffSid); |
||||
|
|
||||
|
List<SysStaffOrg> selectStaffByOrgSid(@Param("orgSid") String sid, @Param("type") String type); |
||||
|
|
||||
|
List<String> selectStaffByOrg(String orgSid); |
||||
|
|
||||
|
List<SysStaffOrgByUserVo> selAllByOrgPath(@Param(Constants.WRAPPER) QueryWrapper qw); |
||||
|
|
||||
|
List<SysStaffOrgByUserVo> selAllByOrgSidPath(String orgSidPath); |
||||
|
} |
@ -0,0 +1,161 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.yxt.user.biz.sysstafforg.SysStaffOrgMapper"> |
||||
|
<!-- <where> ${ew.sqlSegment} </where>--> |
||||
|
<!-- ${ew.customSqlSegment} --> |
||||
|
<select id="selectPageVo" resultType="com.yxt.user.biz.sysstafforg.SysStaffOrgVo"> |
||||
|
SELECT * |
||||
|
FROM sys_staff_org |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectListAllVo" resultType="com.yxt.user.biz.sysstafforg.SysStaffOrgVo"> |
||||
|
SELECT * |
||||
|
FROM sys_staff_org |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<select id="staffinfoList" resultType="com.yxt.user.biz.sysstafforg.SysStaffOrgVo"> |
||||
|
SELECT DISTINCT ss.`name` staffName, ss.`mobile`, ss.sid staffSid |
||||
|
FROM `sys_staff_org` sso |
||||
|
LEFT JOIN `sys_staffinfo` ss ON sso.`staffSid` = ss.`sid` |
||||
|
LEFT JOIN `sys_organization` so ON so.`sid` = sso.`orgSid` |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
<!--根据员工sid更新员工的部门信息--> |
||||
|
<select id="selectByStaffSid" resultType="com.yxt.user.biz.sysstafforg.SysStaffOrg"> |
||||
|
select * |
||||
|
from sys_staff_org |
||||
|
where staffSid = #{sid} |
||||
|
and orgSid = #{orgSid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectByStaff" resultType="com.yxt.user.biz.sysstafforg.SysStaffOrgDetailsVo"> |
||||
|
select sso.orgSid, sso.orgName, sso.orgNamePath, sso.orgNamePath, sso.manageType, so.orgCode |
||||
|
from sys_staff_org sso |
||||
|
left join sys_organization so on sso.orgSid = so.sid |
||||
|
where sso.staffSid = #{sid} |
||||
|
and sso.orgSid = #{orgSid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectByStaffByType" resultType="com.yxt.user.biz.sysstafforg.SysStaffOrgDetailsVo"> |
||||
|
select sso.orgSid, sso.orgName, sso.orgNamePath, sso.manageType, so.orgCode, sso.orgSidPath |
||||
|
from sys_staff_org sso |
||||
|
left join sys_organization so on sso.orgSid = so.sid |
||||
|
where sso.staffSid = #{sid} |
||||
|
and sso.orgSid = #{orgSid} |
||||
|
and sso.manageType = #{type} |
||||
|
</select> |
||||
|
|
||||
|
<!-- <select id="selectBySidPathByStaffSid" resultType="java.lang.String"> |
||||
|
select orgSidPath |
||||
|
from anrui_portal.sys_staff_org |
||||
|
where staffSid = #{applySid} |
||||
|
order by id desc |
||||
|
limit 1 |
||||
|
</select>--> |
||||
|
<select id="selectBySidPathByStaffSid" resultType="java.lang.String"> |
||||
|
select orgSid |
||||
|
from anrui_portal.sys_staff_org |
||||
|
where staffSid = #{applySid} |
||||
|
and manageType = '3' |
||||
|
order by id desc limit 1 |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectByStaffAndOrg" resultType="int"> |
||||
|
select count(*) |
||||
|
from sys_staff_org sso |
||||
|
where sso.staffSid = #{staffSid} |
||||
|
and sso.manageType = #{type} |
||||
|
and orgSidPath = #{sid} |
||||
|
</select> |
||||
|
|
||||
|
<delete id="deleteByStaffSidAndType"> |
||||
|
delete |
||||
|
from sys_staff_org |
||||
|
where staffSid = #{staffSid} |
||||
|
and manageType = #{type} |
||||
|
and orgSidPath = #{sid} |
||||
|
</delete> |
||||
|
|
||||
|
<select id="selectByStaffS" resultType="com.yxt.user.biz.sysstafforg.SysStaffOrgVo"> |
||||
|
select * |
||||
|
from sys_staff_org |
||||
|
where staffSid = #{staffSid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectByOrgSid" resultType="java.lang.String"> |
||||
|
select staffSid |
||||
|
from sys_staff_org |
||||
|
where orgSid = #{sid} |
||||
|
and manageType = 2 |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectByUserSid" resultType="java.lang.String"> |
||||
|
select orgSid |
||||
|
from sys_staff_org so |
||||
|
left join sys_user su on su.staffSid = so.staffSid |
||||
|
left join sys_staffinfo si on si.sid = su.staffSid |
||||
|
where so.manageType = '3' |
||||
|
and su.sid = #{userSid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectOrgBySid" resultType="com.yxt.user.biz.sysstafforg.SysStaffOrg"> |
||||
|
select * |
||||
|
from sys_staff_org sso |
||||
|
where sso.orgSidPath = #{orgPath} |
||||
|
and sso.staffSid = #{staffSid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="getList" resultType="com.yxt.user.biz.sysuserdefaultorg.SysOrgPathList"> |
||||
|
select sid as staffOrgSid, orgSidPath, orgNamePath |
||||
|
from sys_staff_org |
||||
|
where staffSid = #{staffSid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectStaffByOrgSid" resultType="com.yxt.user.biz.sysstafforg.SysStaffOrg"> |
||||
|
select * |
||||
|
from sys_staff_org |
||||
|
where orgSid = #{orgSid} |
||||
|
and manageType = #{type} |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectStaffByOrg" resultType="java.lang.String"> |
||||
|
select staffSid |
||||
|
from sys_staff_org |
||||
|
where orgSidPath like concat('%', #{orgSid}, '%') |
||||
|
</select> |
||||
|
|
||||
|
<select id="selAllByOrgPath" resultType="com.yxt.user.biz.sysstafforg.SysStaffOrgByUserVo"> |
||||
|
SELECT |
||||
|
su.`sid`, |
||||
|
ss.`name` |
||||
|
FROM |
||||
|
sys_staff_org sso |
||||
|
LEFT JOIN sys_user su |
||||
|
ON sso.`staffSid` = su.`staffSid` |
||||
|
LEFT JOIN sys_user_role sur |
||||
|
ON su.`sid` = sur.`userSid` |
||||
|
LEFT JOIN sys_staffinfo ss |
||||
|
ON sso.`staffSid` = ss.`sid` |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<select id="selAllByOrgSidPath" resultType="com.yxt.user.biz.sysstafforg.SysStaffOrgByUserVo"> |
||||
|
SELECT su.sid, |
||||
|
ss.`name` |
||||
|
FROM sys_staff_org so |
||||
|
LEFT JOIN sys_user su |
||||
|
ON so.`staffSid` = su.`staffSid` |
||||
|
LEFT JOIN sys_staffinfo ss |
||||
|
ON so.`staffSid` = ss.`sid` |
||||
|
WHERE so.`orgSidPath` = #{orgSidPath} |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,44 @@ |
|||||
|
package com.yxt.user.biz.sysstafforg; |
||||
|
|
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysStaffOrgQuery.java <br/> |
||||
|
* Class: com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgQuery <br/> |
||||
|
* Description: 员工部门关联表 查询条件. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@ApiModel(value = "员工部门关联表 查询条件", description = "员工部门关联表 查询条件") |
||||
|
@Data |
||||
|
public class SysStaffOrgQuery implements Query { |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty("部门sid") |
||||
|
private String orgSid; |
||||
|
|
||||
|
@ApiModelProperty("部门名称") |
||||
|
private String orgName; |
||||
|
|
||||
|
@ApiModelProperty("人员sid") |
||||
|
private String staffSid; |
||||
|
|
||||
|
@ApiModelProperty("部门路径") |
||||
|
private String orgSidPath; |
||||
|
|
||||
|
@ApiModelProperty("部门名称路径") |
||||
|
private Integer orgNamePath; |
||||
|
|
||||
|
@ApiModelProperty("管理类型:1、主管。2、分管。3、员工") |
||||
|
private String manageType; |
||||
|
} |
@ -0,0 +1,343 @@ |
|||||
|
package com.yxt.user.biz.sysstafforg; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.yxt.user.biz.sysorganization.SysOrganization; |
||||
|
import com.yxt.user.biz.sysstafforg.*; |
||||
|
import com.yxt.user.biz.sysuser.SysUserInfoVo; |
||||
|
import com.yxt.user.biz.sysuserdefaultorg.SysOrgPathList; |
||||
|
import com.yxt.user.biz.sysorganization.SysOrganizationService; |
||||
|
import com.yxt.user.biz.sysuser.SysUserService; |
||||
|
import com.yxt.common.base.service.MybatisBaseService; |
||||
|
import com.yxt.common.base.utils.PagerUtil; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* Project: anrui_portal(门户建设) <br/> |
||||
|
* File: SysStaffOrgService.java <br/> |
||||
|
* Class: com.yxt.user.biz.sysstafforg.SysStaffOrgService <br/> |
||||
|
* Description: 员工部门关联表 业务逻辑. <br/> |
||||
|
* Copyright: Copyright (c) 2011 <br/> |
||||
|
* Company: https://gitee.com/liuzp315 <br/>
|
||||
|
* Makedate: 2021-08-03 00:24:29 <br/> |
||||
|
* |
||||
|
* @author liupopo |
||||
|
* @version 1.0 |
||||
|
* @since 1.0 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class SysStaffOrgService extends MybatisBaseService<SysStaffOrgMapper, SysStaffOrg> { |
||||
|
|
||||
|
@Autowired |
||||
|
private SysOrganizationService sysOrganizationService; |
||||
|
@Autowired |
||||
|
private SysUserService sysUserService; |
||||
|
|
||||
|
public PagerVo<SysStaffOrg> listPage(PagerQuery<SysStaffOrgQuery> pq) { |
||||
|
SysStaffOrgQuery query = pq.getParams(); |
||||
|
QueryWrapper<SysStaffOrg> qw = createQueryWrapper(query); |
||||
|
IPage<SysStaffOrg> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<SysStaffOrg> pagging = baseMapper.selectPage(page, qw); |
||||
|
PagerVo<SysStaffOrg> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
|
||||
|
public List<SysStaffOrg> listAll(SysStaffOrgQuery query) { |
||||
|
QueryWrapper<SysStaffOrg> qw = createQueryWrapper(query); |
||||
|
return baseMapper.selectList(qw); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<SysStaffOrg> createQueryWrapper(SysStaffOrgQuery query) { |
||||
|
// todo: 这里根据具体业务调整查询条件
|
||||
|
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
|
||||
|
QueryWrapper<SysStaffOrg> qw = new QueryWrapper<>(); |
||||
|
|
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getOrgSid())) { |
||||
|
qw.eq("orgSid", query.getOrgSid()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getOrgName())) { |
||||
|
qw.eq("orgName", query.getOrgName()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getStaffSid())) { |
||||
|
qw.eq("staffSid", query.getStaffSid()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getOrgSidPath())) { |
||||
|
qw.eq("orgSidPath", query.getOrgSidPath()); |
||||
|
} |
||||
|
|
||||
|
if (query.getOrgNamePath() != null) { |
||||
|
qw.eq("orgNamePath", query.getOrgNamePath()); |
||||
|
} |
||||
|
|
||||
|
if (StringUtils.isNotBlank(query.getManageType())) { |
||||
|
qw.eq("manageType", query.getManageType()); |
||||
|
} |
||||
|
return qw; |
||||
|
} |
||||
|
|
||||
|
public PagerVo<SysStaffOrgVo> listPageVo(PagerQuery<SysStaffOrgQuery> pq) { |
||||
|
SysStaffOrgQuery query = pq.getParams(); |
||||
|
QueryWrapper<SysStaffOrg> qw = createQueryWrapper(query); |
||||
|
IPage<SysStaffOrg> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<SysStaffOrgVo> pagging = baseMapper.selectPageVo(page, qw); |
||||
|
PagerVo<SysStaffOrgVo> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return p; |
||||
|
} |
||||
|
|
||||
|
public List<SysStaffOrgVo> listAllVo(SysStaffOrgQuery query) { |
||||
|
QueryWrapper<SysStaffOrg> qw = createQueryWrapper(query); |
||||
|
return baseMapper.selectListAllVo(qw); |
||||
|
} |
||||
|
|
||||
|
public List<SysStaffOrgVo> listVo() { |
||||
|
return baseMapper.selectListVo(); |
||||
|
} |
||||
|
|
||||
|
public void saveOrUpdateDto(SysStaffOrgDto dto) { |
||||
|
SysStaffOrg entity = new SysStaffOrg(); |
||||
|
dto.fillEntity(entity); |
||||
|
this.saveOrUpdate(entity); |
||||
|
} |
||||
|
|
||||
|
public SysStaffOrgVo fetchByIdVo(String id) { |
||||
|
SysStaffOrg entity = this.fetchById(id); |
||||
|
SysStaffOrgVo vo = new SysStaffOrgVo(); |
||||
|
BeanUtil.copyProperties(entity, vo); |
||||
|
return vo; |
||||
|
} |
||||
|
|
||||
|
public void delByOrgSid(String sid) { |
||||
|
baseMapper.delByOrgSid(sid); |
||||
|
} |
||||
|
|
||||
|
public List<SysStaffOrgVo> fetchByOrgSid(String orgSid) { |
||||
|
List<SysStaffOrgVo> list = baseMapper.fetchByOrgSid(orgSid); |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
public void deleteByStaffSid(String staffSid) { |
||||
|
baseMapper.deleteByStaffSid(staffSid); |
||||
|
} |
||||
|
|
||||
|
public List<SysStaffOrgVo> staffinfoList(SysStaffOrgQuery query) { |
||||
|
QueryWrapper<SysStaffOrg> queryWrapper = createQueryWrapper(query); |
||||
|
List<SysStaffOrgVo> list = baseMapper.staffinfoList(queryWrapper); |
||||
|
return list; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据员工sid部门信息 |
||||
|
* |
||||
|
* @param sid 员工sid |
||||
|
* @return |
||||
|
*/ |
||||
|
public SysStaffOrg selectByStaffSid(String sid, String orgSid) { |
||||
|
return baseMapper.selectByStaffSid(sid, orgSid); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 员工部门信息详情 |
||||
|
* |
||||
|
* @param sid 员工sid |
||||
|
* @return |
||||
|
*/ |
||||
|
public SysStaffOrgDetailsVo selectByStaff(String sid, String orgSid) { |
||||
|
return baseMapper.selectByStaff(sid, orgSid); |
||||
|
} |
||||
|
|
||||
|
public SysStaffOrgDetailsVo selectByStaffByType(String sid, String orgSid, String type) { |
||||
|
return baseMapper.selectByStaffByType(sid, orgSid, type); |
||||
|
} |
||||
|
|
||||
|
public List<SysStaffOrgVo> getSysStaffOrgListByStaffSid(String staffSid) { |
||||
|
return baseMapper.getSysStaffOrgListByStaffSid(staffSid); |
||||
|
} |
||||
|
|
||||
|
public List<SysStaffOrgVo> getSysStaffOrgListByStaff(String staffSid) { |
||||
|
return baseMapper.getSysStaffOrgListByStaff(staffSid); |
||||
|
} |
||||
|
|
||||
|
public String getSysStaffOrgSidListByStaffSid(String staffSid) { |
||||
|
return baseMapper.getSysStaffOrgSidListByStaffSid(staffSid); |
||||
|
} |
||||
|
|
||||
|
/*public ResultBean<String> selectSidPathByStaffSid(String applySid) { |
||||
|
ResultBean<String> rb = ResultBean.fireFail(); |
||||
|
String orgSidPath = baseMapper.selectBySidPathByStaffSid(applySid); |
||||
|
//根据部门路径循环遍历查询分公司的sid
|
||||
|
List<String> list = Arrays.asList(orgSidPath.split("/")); |
||||
|
String sid = ""; |
||||
|
for (int i = 0; i < list.size(); i++) { |
||||
|
SysOrganization sysOrganization = sysOrganizationService.fetchBySid(list.get(i)); |
||||
|
if (sysOrganization != null) { |
||||
|
if (sysOrganization.getIsDept() != null) { |
||||
|
if (sysOrganization.getIsDept() == 0 && !"0".equals(sysOrganization.getPsid())) { |
||||
|
sid = list.get(i); |
||||
|
break; |
||||
|
} |
||||
|
} else { |
||||
|
if ("0".equals(sysOrganization.getPsid())) { |
||||
|
sid = list.get(i); |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
if (StringUtils.isBlank(sid)) { |
||||
|
return rb; |
||||
|
} |
||||
|
return rb.success().setData(sid); |
||||
|
}*/ |
||||
|
public ResultBean<String> selectSidPathByStaffSid(String applySid) { |
||||
|
ResultBean<String> rb = ResultBean.fireFail(); |
||||
|
String orgSid = baseMapper.selectBySidPathByStaffSid(applySid); |
||||
|
String orgPathSid = ""; |
||||
|
if (StringUtils.isNotBlank(orgSid)) { |
||||
|
orgPathSid = getOrgByOrgSid(orgSid); |
||||
|
} |
||||
|
return rb.success().setData(orgPathSid); |
||||
|
} |
||||
|
|
||||
|
public ResultBean<SysStaffOrg> selectAllByStaffSid(String staffSid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
SysStaffOrg sysStaffOrg = baseMapper.selectAllByStaffSid(staffSid); |
||||
|
return rb.success().setData(sysStaffOrg); |
||||
|
} |
||||
|
|
||||
|
public SysStaffOrg getOrgByStaffSid(String sid) { |
||||
|
return baseMapper.getOrgByStaffSid(sid); |
||||
|
} |
||||
|
|
||||
|
public SysStaffOrg getOrgByStaffSidAndPath(String sid, String path) { |
||||
|
return baseMapper.getOrgByStaffSidAndPath(sid, path); |
||||
|
} |
||||
|
|
||||
|
public List<SysStaffOrg> getOrgByStaffSidList(String sid) { |
||||
|
return baseMapper.getOrgByStaffSidList(sid); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据用户sid获取分公司sid |
||||
|
* |
||||
|
* @param applySid 用户sid |
||||
|
* @return |
||||
|
*/ |
||||
|
public ResultBean<String> getPathSidByUserSid(String applySid) { |
||||
|
ResultBean<String> rb = ResultBean.fireFail(); |
||||
|
SysUserInfoVo sysUserInfoVo = sysUserService.selectUserInfoByUserSid(applySid); |
||||
|
if (sysUserInfoVo == null) { |
||||
|
return rb; |
||||
|
} |
||||
|
ResultBean<String> resultBean = selectSidPathByStaffSid(sysUserInfoVo.getStaffSid()); |
||||
|
return resultBean; |
||||
|
} |
||||
|
|
||||
|
public String getOrgByOrgSid(String orgSid) { |
||||
|
SysOrganization sysOrganization = sysOrganizationService.fetchBySid(orgSid); |
||||
|
if(sysOrganization == null){ |
||||
|
return "0"; |
||||
|
} |
||||
|
if ("0".equals(sysOrganization.getPsid())) { |
||||
|
return "0"; |
||||
|
} |
||||
|
if (sysOrganization.getIsDept() == 0) { |
||||
|
return sysOrganization.getSid(); |
||||
|
} |
||||
|
return getOrgByOrgSid(sysOrganization.getPsid()); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void delZGAndFGByOrgSid(String sid) { |
||||
|
baseMapper.delZGAndFGByOrgSid(sid); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询该组织中是否存在该人员的该种类型关系 |
||||
|
* |
||||
|
* @param sid 组织机构sid |
||||
|
* @param zgStaffSid 人员sid |
||||
|
* @param type 主管、分管、员工 |
||||
|
* @return |
||||
|
*/ |
||||
|
public int selectByStaffAndOrg(String sid, String zgStaffSid, String type) { |
||||
|
return baseMapper.selectByStaffAndOrg(sid, zgStaffSid, type); |
||||
|
} |
||||
|
|
||||
|
public int deleteByStaffSidAndType(String orgSid, String zgStaffSid, String type) { |
||||
|
return baseMapper.deleteByStaffSidAndType(orgSid, zgStaffSid, type); |
||||
|
} |
||||
|
|
||||
|
public List<SysStaffOrgVo> selectByStaffS(String staffSid) { |
||||
|
return baseMapper.selectByStaffS(staffSid); |
||||
|
} |
||||
|
|
||||
|
public List<String> selectByOrgSid(String sid) { |
||||
|
return baseMapper.selectByOrgSid(sid); |
||||
|
} |
||||
|
|
||||
|
public String selectByUserSid(String userSid) { |
||||
|
return baseMapper.selectByUserSid(userSid); |
||||
|
} |
||||
|
|
||||
|
public List<SysStaffOrg> selectOrgBySid(String orgPath, String staffSid) { |
||||
|
return baseMapper.selectOrgBySid(orgPath, staffSid); |
||||
|
} |
||||
|
|
||||
|
public ResultBean<String> getOrgSidByPath(String orgPath) { |
||||
|
ResultBean<String> rb = ResultBean.fireFail(); |
||||
|
//根据用户全路径获取分公司sid
|
||||
|
List<String> stringList = Arrays.asList(orgPath.split("/")); |
||||
|
String orgSid = stringList.get(stringList.size() - 1); |
||||
|
orgPath = sysOrganizationService.getOrgSid(orgSid); |
||||
|
return rb.success().setData(orgPath); |
||||
|
} |
||||
|
|
||||
|
public List<SysOrgPathList> getList(String staffSid) { |
||||
|
return baseMapper.getList(staffSid); |
||||
|
} |
||||
|
|
||||
|
public List<SysStaffOrg> selectStaffByOrgSid(String sid, String type) { |
||||
|
return baseMapper.selectStaffByOrgSid(sid,type); |
||||
|
} |
||||
|
|
||||
|
public List<String> selectStaffByOrg(String orgSid) { |
||||
|
return baseMapper.selectStaffByOrg(orgSid); |
||||
|
} |
||||
|
|
||||
|
public ResultBean<List<SysStaffOrgByUserVo>> selAllByOrgPath(String orgSidPath,String roleSid) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
QueryWrapper qw = new QueryWrapper<>(); |
||||
|
qw.eq("sur.roleSid",roleSid); |
||||
|
qw.like("sso.orgSidPath",orgSidPath); |
||||
|
List<SysStaffOrgByUserVo> sysStaffOrgByUserVos = baseMapper.selAllByOrgPath(qw); |
||||
|
return rb.success().setData(sysStaffOrgByUserVos); |
||||
|
} |
||||
|
|
||||
|
public ResultBean<String> getOrgSidByPath2(String orgPath) { |
||||
|
ResultBean<String> rb = ResultBean.fireFail(); |
||||
|
//根据用户全路径获取分公司sid
|
||||
|
List<String> stringList = Arrays.asList(orgPath.split("/")); |
||||
|
String orgSid = stringList.get(stringList.size() - 2); |
||||
|
orgPath = sysOrganizationService.getOrgSid(orgSid); |
||||
|
return rb.success().setData(orgPath); |
||||
|
} |
||||
|
|
||||
|
public ResultBean<List<SysStaffOrgByUserVo>> selAllByOrgSidPath(String orgSidPath) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
List<SysStaffOrgByUserVo> sysStaffOrgByUserVoList = baseMapper.selAllByOrgSidPath(orgSidPath); |
||||
|
return rb.success().setData(sysStaffOrgByUserVoList); |
||||
|
} |
||||
|
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue