7290d1b5 张雷

积木报表权限修改

1 个父辈 4ea7e99a
......@@ -733,7 +733,7 @@ public class SysDepartController {
@ApiOperation("积木报表机构树")
@GetMapping(value = "/jimu/tree")
public List<DepartTree> jimuDepartTree(DepartTree departTree) {
List<DepartTree> list = sysDepartService.getJimuDepartTree(departTree.getPid());
List<DepartTree> list = sysDepartService.getJimuDepartTree(departTree);
return list;
}
}
......
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.skua.modules.system.entity.SysDepart;
import com.skua.modules.system.vo.DepartTree;
import com.skua.modules.system.vo.SysDeptUserVO;
import com.skua.tool.annotation.Anonymous;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
......@@ -137,11 +138,24 @@ public interface SysDepartMapper extends BaseMapper<SysDepart> {
String getDepartTreeByParentDepartId(@Param("parentDepartId")String parentDepartId);
List<DepartTree> getJimuDepartTree(@Param("pid") String pid);
String getChildDepartId(@Param("departIds") String departIds);
List<SysDeptUserVO> queryDeptAndUserTreeList(@Param("departId") String departId);
List<SysDeptUserVO> queryDeptAndSystemTreeList(@Param("departId") String departId);
@Anonymous
List<DepartTree> getJimuDepartTree(@Param("pid") String pid);
@Anonymous
List<DepartTree> getJimuDepartTreeFY(@Param("pid") String pid, @Param("departIds") String departIds);
@Anonymous
List<DepartTree> getJimuDepartTreeL(@Param("pid") String pid, @Param("departIds") String departIds);
@Anonymous
List<DepartTree> getJimuDepartTreeELSE(@Param("departIds") String departIds);
@Anonymous
SysDepart getById(@Param("pid") String pid);
}
......
......@@ -202,6 +202,40 @@
where parent_id = #{pid}
ORDER BY depart_order
</select>
<select id="getJimuDepartTreeFY" resultType="com.skua.modules.system.vo.DepartTree">
select id,parent_id AS pid,depart_name AS title,id AS value from sys_depart
where parent_id = #{pid}
and id in (select parent_id from sys_depart where id IN
<foreach item="item" index="index" collection="departIds.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>)
ORDER BY depart_order
</select>
<select id="getJimuDepartTreeL" resultType="com.skua.modules.system.vo.DepartTree">
select id,parent_id AS pid,depart_name AS title,id AS value from sys_depart
where parent_id = #{pid}
and id IN
<foreach item="item" index="index" collection="departIds.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
ORDER BY depart_order
</select>
<select id="getJimuDepartTreeELSE" resultType="com.skua.modules.system.vo.DepartTree">
select id,parent_id AS pid,depart_name AS title,id AS value from sys_depart
where id IN
<foreach item="item" index="index" collection="departIds.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
ORDER BY depart_order
</select>
<select id="getById" resultType="com.skua.modules.system.entity.SysDepart">
select * from sys_depart where id = #{pid}
</select>
<select id="getChildDepartId" resultType="java.lang.String">
SELECT
GROUP_CONCAT( id SEPARATOR ',' ) AS depart_ids
......
......@@ -175,7 +175,7 @@ public interface ISysDepartService extends IService<SysDepart>{
*/
String getDepartTreeByParentDepartId(String parentDepartId);
List<DepartTree> getJimuDepartTree(String pid);
List<DepartTree> getJimuDepartTree(DepartTree departTree);
String getChildDepartId(String departIds);
......
......@@ -8,9 +8,12 @@ import com.skua.core.constant.CommonConstant;
import com.skua.core.context.BaseContextHandler;
import com.skua.core.service.ISequenceService;
import com.skua.core.util.ConvertUtils;
import com.skua.core.util.JwtUtil;
import com.skua.core.util.YouBianCodeUtil;
import com.skua.modules.system.entity.SysDepart;
import com.skua.modules.system.entity.SysUser;
import com.skua.modules.system.mapper.SysDepartMapper;
import com.skua.modules.system.mapper.SysUserMapper;
import com.skua.modules.system.model.DepartIdModel;
import com.skua.modules.system.model.SysDepartTreeModel;
import com.skua.modules.system.service.ISysDepartService;
......@@ -36,6 +39,8 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
private SysDepartMapper sysDepartMapper;
@Autowired
private ISequenceService sequenceService;
@Autowired
private SysUserMapper sysUserMapper;
/***
* 查询子集所有的部门
......@@ -464,11 +469,29 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
}
@Override
public List<DepartTree> getJimuDepartTree(String pid) {
if(ConvertUtils.isEmpty(pid)){
pid = "";
public List<DepartTree> getJimuDepartTree(DepartTree departTree) {
List<DepartTree> list = new ArrayList<>();
String pid = "";
String departIds = "";
if(ConvertUtils.isNotEmpty(departTree.getPid())){
if(ConvertUtils.isNotEmpty(departTree.getToken())){
SysUser user = sysUserMapper.getUserByName(JwtUtil.getUsername(departTree.getToken()));
if(user!=null){
departIds = sysUserMapper.queryDepartIdsByUserId(user.getId());
}
}
pid = departTree.getPid();
SysDepart depart = sysDepartMapper.getById(pid);
if("-1".equals(depart.getDepartType())){
list = sysDepartMapper.getJimuDepartTreeFY(pid,departIds);
}else if("0".equals(depart.getDepartType())){
list = sysDepartMapper.getJimuDepartTreeL(pid,departIds);
}else {
list = new ArrayList<>();
}
}else{
list = sysDepartMapper.getJimuDepartTree(pid);
}
List<DepartTree> list = sysDepartMapper.getJimuDepartTree(pid);
return list;
}
......
......@@ -13,6 +13,7 @@ public class DepartTree{
private String value;//实际查询用到的值
/**下拉树显示的文本值*/
private String title;//下拉树显示的文本值
/**TOKEN*/
private String token;//TOKEN
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!