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

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

parent eee54194
...@@ -5275,11 +5275,13 @@ msg|String|消息|- ...@@ -5275,11 +5275,13 @@ msg|String|消息|-
参数名称|类型|备注|必填|其它 参数名称|类型|备注|必填|其它
---|---|---|---|--- ---|---|---|---|---
id|Long|部门id|是|- idList|Arrays|部门ids|是|-
**请求样例:** **请求样例:**
``` ```
{"idList":[414]}
``` ```
**响应参数:** **响应参数:**
...@@ -5288,7 +5290,7 @@ id|Long|部门id|是|- ...@@ -5288,7 +5290,7 @@ id|Long|部门id|是|-
---|---|---|--- ---|---|---|---
code|Integer|结果码(-1.失败,1.成功)|- code|Integer|结果码(-1.失败,1.成功)|-
msg|String|消息|- msg|String|消息|-
data|array|结果集列表|数组 data|Object|结果集|
**响应消息样例:** **响应消息样例:**
......
...@@ -19,7 +19,10 @@ import java.util.List; ...@@ -19,7 +19,10 @@ import java.util.List;
public interface DeptDao extends ICRUDDao<DeptEntity,Long>{ public interface DeptDao extends ICRUDDao<DeptEntity,Long>{
String GET_DEPT_LIST_BY_BUSINESS = "getDeptListByBusiness"; String GET_DEPT_LIST_BY_BUSINESS = "getDeptListByBusiness";
String GET_BUSINESS_BY_DEPT = "getBusinessByDept";
List<DeptVo> getDeptListByBusiness(DeptQuery deptQuery); List<DeptVo> getDeptListByBusiness(DeptQuery deptQuery);
List<DeptVo> getBusinessByDept(DeptQuery deptQuery);
} }
...@@ -30,4 +30,15 @@ public class DeptDaoImpl extends BaseCRUDDaoMybatis<DeptEntity,Long> implements ...@@ -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); List list = this.getSqlSession().selectList(this.getSqlId(GET_DEPT_LIST_BY_BUSINESS), paramDto);
return list; 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 { ...@@ -28,13 +28,20 @@ public class DeptVo extends BaseEntityLong {
* 站点业务ID * 站点业务ID
*/ */
private Long siteBusinessId; private Long siteBusinessId;
private Long windowId;
private String windowName;
/** /**
* 业务名称 * 业务名称
*/ */
private String businessName; private String businessName;
/** 站点业务ID列表 */ /** 站点业务ID列表 */
private List <Long> siteBusinessIdList; 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> { ...@@ -39,11 +39,14 @@ public interface DeptService extends ICRUDCacheService<DeptEntity, Long> {
Rest<String> syncDeptBySiteId(SiteEntity siteEntity, Context context); 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); void deleteGovBySiteId(Long siteId, Context context);
Rest<Map<Long,List<DeptVo>>> getDeptListByBusiness(DeptQuery deptQuery, 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 ...@@ -131,8 +131,15 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
} }
@Override @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())); List<WindowEntity> windowEntities = windowService.find(new WindowQuery().deptId(deptQuery.getId()));
//查询窗口业务 //查询窗口业务
WindowBusinessQuery windowBusinessQuery = new WindowBusinessQuery(); WindowBusinessQuery windowBusinessQuery = new WindowBusinessQuery();
...@@ -156,8 +163,8 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE ...@@ -156,8 +163,8 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
return Rest.ok("业务查询结果为空", Collections.EMPTY_LIST); return Rest.ok("业务查询结果为空", Collections.EMPTY_LIST);
} }
businessQuery.setIdList(businessList); businessQuery.setIdList(businessList);
List<BusinessEntity> businessEntities = businessService.find(businessQuery); List<BusinessEntity> businessEntities = businessService.find(businessQuery);*/
return Rest.ok(businessEntities); //return Rest.ok(businessEntities);
} }
@Override @Override
...@@ -175,11 +182,8 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE ...@@ -175,11 +182,8 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
*/ */
@Override @Override
public Rest<Map<Long, List<DeptVo>>> getDeptListByBusiness(DeptQuery deptQuery, Context context) { public Rest<Map<Long, List<DeptVo>>> getDeptListByBusiness(DeptQuery deptQuery, Context context) {
List<DeptVo> deptListByBusiness = this.dao.getDeptListByBusiness(deptQuery); List<DeptVo> deptListByBusiness = this.dao.getDeptListByBusiness(deptQuery);
Map<Long, List<DeptVo>> collect = deptListByBusiness.parallelStream().collect(Collectors.groupingBy(x -> x.getSiteBusinessId())); Map<Long, List<DeptVo>> collect = deptListByBusiness.parallelStream().collect(Collectors.groupingBy(x -> x.getSiteBusinessId()));
return Rest.ok(collect); return Rest.ok(collect);
} }
......
...@@ -107,10 +107,10 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic ...@@ -107,10 +107,10 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
String busiDesc = "根据部门查询业务" + this.getModuleDesc(); String busiDesc = "根据部门查询业务" + this.getModuleDesc();
try { try {
if (ObjectUtils.isEmpty(deptQuery.getId())) { if (ObjectUtils.isEmpty(deptQuery.getIdList())) {
throw new AppException("参数部门id不能为空!"); 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 + " 【成功】"); recordSysLog(request, busiDesc + " 【成功】");
jsonObject.put(KEY_RESULT_DATA, rest.getData()); jsonObject.put(KEY_RESULT_DATA, rest.getData());
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS); jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
<id property="id" column="id"/> <id property="id" column="id"/>
<result property="name" column="name"/> <result property="name" column="name"/>
<result property="deptNumber" column="deptNumber"/> <result property="deptNumber" column="deptNumber"/>
<result property="windowId" column="windowId"/>
<result property="windowName" column="windowName"/>
<result property="siteBusinessId" column="siteBusinessId"/> <result property="siteBusinessId" column="siteBusinessId"/>
<result property="businessName" column="businessName"/> <result property="businessName" column="businessName"/>
</resultMap> </resultMap>
...@@ -15,7 +17,7 @@ ...@@ -15,7 +17,7 @@
<!-- 根据业务ids获取部门列表 --> <!-- 根据业务ids获取部门列表 -->
<select id="getDeptListByBusiness" parameterType="paramDto" resultMap="DeptVo-Map"> <select id="getDeptListByBusiness" parameterType="paramDto" resultMap="DeptVo-Map">
SELECT 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 FROM
mortals_sys_dept d mortals_sys_dept d
LEFT JOIN mortals_sys_window w ON d.id = w.deptId LEFT JOIN mortals_sys_window w ON d.id = w.deptId
...@@ -33,4 +35,29 @@ ...@@ -33,4 +35,29 @@
</trim> </trim>
</trim> </trim>
</select> </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> </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