123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- package com.willalp.system.service.impl;
- import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
- import com.willalp.system.domain.HsPostConfig;
- import com.willalp.system.domain.vo.PostTreeVo;
- import com.willalp.system.mapper.HsPostConfigMapper;
- import com.willalp.system.service.IHsPostConfigService;
- import org.springframework.stereotype.Service;
- import javax.annotation.Resource;
- import java.util.ArrayList;
- import java.util.List;
- /**
- * 岗位配置Service业务层处理
- *
- * @author willalp
- * @date 2022-09-21
- */
- @Service
- public class HsPostConfigServiceImpl extends ServiceImpl<HsPostConfigMapper, HsPostConfig> implements IHsPostConfigService {
- @Resource
- private HsPostConfigMapper hsPostConfigMapper;
- /**
- * 查询岗位配置列表
- *
- * @param hsPostConfig 岗位配置
- * @return 岗位配置
- */
- @Override
- public List<HsPostConfig> selectHsPostConfigList(HsPostConfig hsPostConfig) {
- return hsPostConfigMapper.selectHsPostConfigList(hsPostConfig);
- }
- @Override
- public List<PostTreeVo> getTreePost() {
- List<HsPostConfig> hsPostConfigs = selectHsPostConfigList(null);
- if (0 != hsPostConfigs.size()) {
- List<PostTreeVo> list = new ArrayList<>();
- String userBS = "AA";
- hsPostConfigs.forEach(item -> {
- PostTreeVo postTreeVo = new PostTreeVo();
- postTreeVo.setText(item.getPostName());
- postTreeVo.setValue(item.getId());
- String postUserG = item.getPostUserG();
- List<PostTreeVo> postTreeCcVos = new ArrayList<>();
- if (postUserG != null) {
- String[] split = postUserG.split(",");
- for (int i = 0; i < split.length; i++) {
- PostTreeVo postTreeCcVo = new PostTreeVo();
- String nick;
- String userId;
- int of = split[i].indexOf(userBS);
- if (of != -1) {
- nick = split[i].substring(0, of);
- userId = split[i].substring(of);
- } else {
- nick = "WILLALP";
- userId = "admin";
- }
- postTreeCcVo.setText(nick);
- postTreeCcVo.setValue(userId);
- postTreeCcVos.add(postTreeCcVo);
- }
- }
- if (postTreeCcVos.size() != 0) {
- postTreeVo.setChildren(postTreeCcVos);
- } else {
- postTreeVo.setChildren(null);
- }
- list.add(postTreeVo);
- });
- return list;
- }
- return null;
- }
- }
|