积木报表厂区接口修改
正在显示
6 个修改的文件
包含
39 行增加
和
7 行删除
... | @@ -56,5 +56,7 @@ public interface CommonSqlMapper { | ... | @@ -56,5 +56,7 @@ public interface CommonSqlMapper { |
56 | 56 | ||
57 | String getChildFactorys(@Param(value="departId") String departId); | 57 | String getChildFactorys(@Param(value="departId") String departId); |
58 | 58 | ||
59 | String getChildDeparts(@Param(value="departId") String departId); | ||
60 | |||
59 | String getChildDepartByUserId(@Param(value="userId") String userId); | 61 | String getChildDepartByUserId(@Param(value="userId") String userId); |
60 | } | 62 | } | ... | ... |
... | @@ -94,6 +94,28 @@ | ... | @@ -94,6 +94,28 @@ |
94 | </foreach> | 94 | </foreach> |
95 | )) | 95 | )) |
96 | </select> | 96 | </select> |
97 | |||
98 | <select id="getChildDeparts" resultType="java.lang.String"> | ||
99 | SELECT | ||
100 | GROUP_CONCAT( id SEPARATOR ',' ) AS depart_ids | ||
101 | FROM | ||
102 | sys_depart | ||
103 | WHERE | ||
104 | parent_id IN | ||
105 | <foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")"> | ||
106 | '${item}' | ||
107 | </foreach> | ||
108 | OR id IN | ||
109 | <foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")"> | ||
110 | '${item}' | ||
111 | </foreach> | ||
112 | OR parent_id IN ( SELECT id FROM sys_depart WHERE parent_id IN | ||
113 | <foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")"> | ||
114 | '${item}' | ||
115 | </foreach> | ||
116 | ) | ||
117 | </select> | ||
118 | |||
97 | <select id="getChildDepartByUserId" resultType="java.lang.String"> | 119 | <select id="getChildDepartByUserId" resultType="java.lang.String"> |
98 | select CONCAT(dep_id,',',dep_ids) AS ids | 120 | select CONCAT(dep_id,',',dep_ids) AS ids |
99 | from sys_user_depart | 121 | from sys_user_depart | ... | ... |
... | @@ -100,17 +100,18 @@ public class ThreeDController { | ... | @@ -100,17 +100,18 @@ public class ThreeDController { |
100 | return result; | 100 | return result; |
101 | } | 101 | } |
102 | 102 | ||
103 | @CustomExceptionAnno(description = "三维-厂区在线状态") | 103 | @CustomExceptionAnno(description = "厂区在线状态") |
104 | @AutoLog(value = "三维-厂区在线状态") | 104 | @AutoLog(value = "厂区在线状态") |
105 | @ApiOperation(value = "三维-厂区在线状态", notes = "三维-厂区在线状态") | 105 | @ApiOperation(value = "厂区在线状态", notes = "厂区在线状态") |
106 | @GetMapping(value = "/factoryOnLine") | 106 | @GetMapping(value = "/factoryOnLine") |
107 | public Result<SysFactoryInfoVO> factoryOnLine(@RequestParam(name = "departId", defaultValue = "f2df9193c8bc4e7a9cef0e4b98dd9e95") String departId, @RequestParam(name = "departType", defaultValue = "1", required = false) String departType) { | 107 | public Result<SysFactoryInfoVO> factoryOnLine(@RequestParam(name = "departId", defaultValue = "f2df9193c8bc4e7a9cef0e4b98dd9e95") String departId, @RequestParam(name = "departType", defaultValue = "1", required = false) String departType) { |
108 | Result result = new Result<>(); | 108 | Result result = new Result<>(); |
109 | result.setSuccess(true); | ||
110 | result.setResult(new HashMap<>()); | ||
109 | QueryWrapper<SysDepart> sysDepartQueryWrapper = new QueryWrapper<>(); | 111 | QueryWrapper<SysDepart> sysDepartQueryWrapper = new QueryWrapper<>(); |
110 | sysDepartQueryWrapper.eq("depart_type", departType).eq("del_flag", 1); | 112 | sysDepartQueryWrapper.eq("depart_type", departType).eq("del_flag", 1); |
111 | List<Map<String, Object>> deviceList = sysDepartService.queryFactoryDevice(sysDepartQueryWrapper); | 113 | List<Map<String, Object>> deviceList = sysDepartService.queryFactoryDevice(sysDepartQueryWrapper); |
112 | JdbcTemplate pgDb = (JdbcTemplate) SpringContextUtils.getBean("pg-db"); | 114 | JdbcTemplate pgDb = (JdbcTemplate) SpringContextUtils.getBean("pg-db"); |
113 | |||
114 | int onlineCount = 0; | 115 | int onlineCount = 0; |
115 | if (!CollectionUtils.isEmpty(deviceList)) { | 116 | if (!CollectionUtils.isEmpty(deviceList)) { |
116 | List<Object> list = new ArrayList<>(); | 117 | List<Object> list = new ArrayList<>(); |
... | @@ -138,8 +139,6 @@ public class ThreeDController { | ... | @@ -138,8 +139,6 @@ public class ThreeDController { |
138 | resultMaps.put("offlineCount", deviceList.size() - onlineCount > 0 ? deviceList.size() - onlineCount : 0); | 139 | resultMaps.put("offlineCount", deviceList.size() - onlineCount > 0 ? deviceList.size() - onlineCount : 0); |
139 | result.setSuccess(true); | 140 | result.setSuccess(true); |
140 | result.setResult(resultMaps); | 141 | result.setResult(resultMaps); |
141 | } else { | ||
142 | result.error500("500"); | ||
143 | } | 142 | } |
144 | return result; | 143 | return result; |
145 | 144 | ... | ... |
... | @@ -159,7 +159,9 @@ public interface SysDepartMapper extends BaseMapper<SysDepart> { | ... | @@ -159,7 +159,9 @@ public interface SysDepartMapper extends BaseMapper<SysDepart> { |
159 | @Anonymous | 159 | @Anonymous |
160 | SysDepart getById(@Param("pid") String pid); | 160 | SysDepart getById(@Param("pid") String pid); |
161 | 161 | ||
162 | @Anonymous | ||
162 | List<SysDepart> getChildDepartList(@Param("departIds") String departIds); | 163 | List<SysDepart> getChildDepartList(@Param("departIds") String departIds); |
163 | 164 | ||
165 | @Anonymous | ||
164 | List<SysDepart> queryDepartsByIds(@Param("ids") String ids); | 166 | List<SysDepart> queryDepartsByIds(@Param("ids") String ids); |
165 | } | 167 | } | ... | ... |
... | @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ... | @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
4 | import com.baomidou.mybatisplus.core.metadata.IPage; | 4 | import com.baomidou.mybatisplus.core.metadata.IPage; |
5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
6 | import com.skua.modules.system.entity.SysUser; | 6 | import com.skua.modules.system.entity.SysUser; |
7 | import com.skua.tool.annotation.Anonymous; | ||
7 | import org.apache.ibatis.annotations.Param; | 8 | import org.apache.ibatis.annotations.Param; |
8 | 9 | ||
9 | import java.util.List; | 10 | import java.util.List; |
... | @@ -76,5 +77,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> { | ... | @@ -76,5 +77,6 @@ public interface SysUserMapper extends BaseMapper<SysUser> { |
76 | 77 | ||
77 | List<SysUser> operationUserList(@Param("departId") String departId); | 78 | List<SysUser> operationUserList(@Param("departId") String departId); |
78 | 79 | ||
80 | @Anonymous | ||
79 | String queryDepartIdsByUserId(@Param("userId") String userId); | 81 | String queryDepartIdsByUserId(@Param("userId") String userId); |
80 | } | 82 | } | ... | ... |
... | @@ -12,6 +12,7 @@ import com.skua.core.api.vo.SysUserCacheInfo; | ... | @@ -12,6 +12,7 @@ import com.skua.core.api.vo.SysUserCacheInfo; |
12 | import com.skua.core.constant.CommonConstant; | 12 | import com.skua.core.constant.CommonConstant; |
13 | import com.skua.core.context.BaseContextHandler; | 13 | import com.skua.core.context.BaseContextHandler; |
14 | import com.skua.core.util.ConvertUtils; | 14 | import com.skua.core.util.ConvertUtils; |
15 | import com.skua.modules.common.mapper.CommonSqlMapper; | ||
15 | import com.skua.modules.system.entity.*; | 16 | import com.skua.modules.system.entity.*; |
16 | import com.skua.modules.system.mapper.*; | 17 | import com.skua.modules.system.mapper.*; |
17 | import com.skua.modules.system.service.ISysUserDepartService; | 18 | import com.skua.modules.system.service.ISysUserDepartService; |
... | @@ -48,6 +49,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl | ... | @@ -48,6 +49,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl |
48 | private ISysBaseAPI sysBaseAPI; | 49 | private ISysBaseAPI sysBaseAPI; |
49 | @Autowired | 50 | @Autowired |
50 | private SysDepartMapper sysDepartMapper; | 51 | private SysDepartMapper sysDepartMapper; |
52 | @Resource | ||
53 | private CommonSqlMapper commonSqlMapper; | ||
51 | @Autowired | 54 | @Autowired |
52 | WebSocket webSocket; | 55 | WebSocket webSocket; |
53 | 56 | ||
... | @@ -173,7 +176,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl | ... | @@ -173,7 +176,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl |
173 | // 根据角色Id查询 | 176 | // 根据角色Id查询 |
174 | @Override | 177 | @Override |
175 | public IPage<SysUser> getUserByRoleId(Page<SysUser> page, String roleId, String username) { | 178 | public IPage<SysUser> getUserByRoleId(Page<SysUser> page, String roleId, String username) { |
176 | String departIds = userMapper.queryDepartIdsByUserId(BaseContextHandler.getUserId()); | 179 | // String departIds = userMapper.queryDepartIdsByUserId(BaseContextHandler.getUserId()); |
180 | String ids = commonSqlMapper.getChildDepartByUserId(BaseContextHandler.getUserId()); | ||
181 | String departIds = commonSqlMapper.getChildDeparts(ids); | ||
177 | return userMapper.getUserByRoleId(page, roleId, username, departIds); | 182 | return userMapper.getUserByRoleId(page, roleId, username, departIds); |
178 | } | 183 | } |
179 | 184 | ... | ... |
-
请 注册 或 登录 后发表评论