Commit 14ebe5cf authored by 赵啸非's avatar 赵啸非

修改根据业务查询部门逻辑

parent eee54194
......@@ -5275,11 +5275,13 @@ msg|String|消息|-
参数名称|类型|备注|必填|其它
---|---|---|---|---
id|Long|部门id|是|-
idList|Arrays|部门ids|是|-
**请求样例:**
```
{"idList":[414]}
```
**响应参数:**
......@@ -5288,7 +5290,7 @@ id|Long|部门id|是|-
---|---|---|---
code|Integer|结果码(-1.失败,1.成功)|-
msg|String|消息|-
data|array|结果集列表|数组
data|Object|结果集|
**响应消息样例:**
......
......@@ -19,7 +19,10 @@ import java.util.List;
public interface DeptDao extends ICRUDDao<DeptEntity,Long>{
String GET_DEPT_LIST_BY_BUSINESS = "getDeptListByBusiness";
String GET_BUSINESS_BY_DEPT = "getBusinessByDept";
List<DeptVo> getDeptListByBusiness(DeptQuery deptQuery);
List<DeptVo> getBusinessByDept(DeptQuery deptQuery);
}
......@@ -30,4 +30,15 @@ public class DeptDaoImpl extends BaseCRUDDaoMybatis<DeptEntity,Long> implements
List list = this.getSqlSession().selectList(this.getSqlId(GET_DEPT_LIST_BY_BUSINESS), paramDto);
return list;
}
/**
* @param deptQuery
* @return
*/
@Override
public List<DeptVo> getBusinessByDept(DeptQuery deptQuery) {
ParamDto paramDto = this.getQueryParam(deptQuery);
List list = this.getSqlSession().selectList(this.getSqlId(GET_BUSINESS_BY_DEPT), paramDto);
return list;
}
}
......@@ -28,13 +28,20 @@ public class DeptVo extends BaseEntityLong {
* 站点业务ID
*/
private Long siteBusinessId;
private Long windowId;
private String windowName;
/**
* 业务名称
*/
private String businessName;
/** 站点业务ID列表 */
private List <Long> siteBusinessIdList;
/** 部门ID列表 */
private List <Long> idList;
}
\ No newline at end of file
......@@ -39,11 +39,14 @@ public interface DeptService extends ICRUDCacheService<DeptEntity, Long> {
Rest<String> syncDeptBySiteId(SiteEntity siteEntity, Context context);
Rest<List<BusinessEntity>> getBusinessByDept(DeptQuery deptQuery, Context context);
Rest<Map<Long, List<DeptVo>>> getBusinessByDept(DeptQuery deptQuery, Context context);
void deleteGovBySiteId(Long siteId, Context context);
Rest<Map<Long,List<DeptVo>>> getDeptListByBusiness(DeptQuery deptQuery, Context context);
}
\ No newline at end of file
......@@ -131,8 +131,15 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
}
@Override
public Rest<List<BusinessEntity>> getBusinessByDept(DeptQuery deptQuery, Context context) {
//查询部门窗口
public Rest<Map<Long, List<DeptVo>>> getBusinessByDept(DeptQuery deptQuery, Context context) {
List<DeptVo> businessDeptList = this.dao.getBusinessByDept(deptQuery);
Map<Long, List<DeptVo>> collect = businessDeptList.parallelStream().collect(Collectors.groupingBy(x -> x.getId()));
return Rest.ok(collect);
/* //查询部门窗口
List<WindowEntity> windowEntities = windowService.find(new WindowQuery().deptId(deptQuery.getId()));
//查询窗口业务
WindowBusinessQuery windowBusinessQuery = new WindowBusinessQuery();
......@@ -156,8 +163,8 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
return Rest.ok("业务查询结果为空", Collections.EMPTY_LIST);
}
businessQuery.setIdList(businessList);
List<BusinessEntity> businessEntities = businessService.find(businessQuery);
return Rest.ok(businessEntities);
List<BusinessEntity> businessEntities = businessService.find(businessQuery);*/
//return Rest.ok(businessEntities);
}
@Override
......@@ -175,11 +182,8 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
*/
@Override
public Rest<Map<Long, List<DeptVo>>> getDeptListByBusiness(DeptQuery deptQuery, Context context) {
List<DeptVo> deptListByBusiness = this.dao.getDeptListByBusiness(deptQuery);
Map<Long, List<DeptVo>> collect = deptListByBusiness.parallelStream().collect(Collectors.groupingBy(x -> x.getSiteBusinessId()));
return Rest.ok(collect);
}
......
......@@ -107,10 +107,10 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
JSONObject jsonObject = new JSONObject();
String busiDesc = "根据部门查询业务" + this.getModuleDesc();
try {
if (ObjectUtils.isEmpty(deptQuery.getId())) {
throw new AppException("参数部门id不能为空!");
if (ObjectUtils.isEmpty(deptQuery.getIdList())) {
throw new AppException("参数部门ids不能为空!");
}
Rest<List<BusinessEntity>> rest = this.service.getBusinessByDept(deptQuery, getContext());
Rest<Map<Long, List<DeptVo>>> rest = this.service.getBusinessByDept(deptQuery, getContext());
recordSysLog(request, busiDesc + " 【成功】");
jsonObject.put(KEY_RESULT_DATA, rest.getData());
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
......
......@@ -8,6 +8,8 @@
<id property="id" column="id"/>
<result property="name" column="name"/>
<result property="deptNumber" column="deptNumber"/>
<result property="windowId" column="windowId"/>
<result property="windowName" column="windowName"/>
<result property="siteBusinessId" column="siteBusinessId"/>
<result property="businessName" column="businessName"/>
</resultMap>
......@@ -15,7 +17,7 @@
<!-- 根据业务ids获取部门列表 -->
<select id="getDeptListByBusiness" parameterType="paramDto" resultMap="DeptVo-Map">
SELECT
d.id,d.`name`,d.deptNumber,wb.siteBusinessId,wb.businessName
d.id,d.`name`,d.deptNumber,wb.siteBusinessId,wb.businessName,w.id as windowId,w.`name` as windowName
FROM
mortals_sys_dept d
LEFT JOIN mortals_sys_window w ON d.id = w.deptId
......@@ -33,4 +35,29 @@
</trim>
</trim>
</select>
<!-- 根据部门ids获取业务部门列表 -->
<select id="getBusinessByDept" parameterType="paramDto" resultMap="DeptVo-Map">
SELECT
d.id,d.`name`,d.deptNumber,wb.siteBusinessId,wb.businessName,w.id as windowId,w.`name` as windowName
FROM
mortals_sys_dept d
LEFT JOIN mortals_sys_window w ON d.id = w.deptId
LEFT JOIN mortals_sys_window_business wb ON w.id = wb.windowId
<trim suffixOverrides="where" suffix="">
where 1=1 and
<trim prefixOverrides="and" prefix="">
<if test="condition.containsKey('idList')">
id in
<foreach collection="condition.idList" open="(" close=")" index="index"
item="item" separator=",">
#{item}
</foreach>
</if>
</trim>
</trim>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment