Commit e0491256 authored by 赵啸非's avatar 赵啸非

添加查询存在业务的部门

parent 0c8426df
package com.mortals.xhx.module.dept.dao; package com.mortals.xhx.module.dept.dao;
import com.mortals.framework.dao.ICRUDDao; import com.mortals.framework.dao.ICRUDDao;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
import com.mortals.xhx.module.dept.model.DeptEntity; import com.mortals.xhx.module.dept.model.DeptEntity;
...@@ -26,6 +27,6 @@ public interface DeptDao extends ICRUDDao<DeptEntity,Long>{ ...@@ -26,6 +27,6 @@ public interface DeptDao extends ICRUDDao<DeptEntity,Long>{
List<DeptVo> getBusinessByDept(DeptQuery deptQuery); List<DeptVo> getBusinessByDept(DeptQuery deptQuery);
List<DeptEntity> getDeptListByExistBusiness(); List<DeptEntity> getDeptListByExistBusiness(DeptQuery deptQuery);
} }
package com.mortals.xhx.module.dept.dao.ibatis; package com.mortals.xhx.module.dept.dao.ibatis;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.ParamDto; import com.mortals.framework.model.ParamDto;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
import com.mortals.xhx.module.dept.model.DeptQuery; import com.mortals.xhx.module.dept.model.DeptQuery;
...@@ -50,7 +51,8 @@ public class DeptDaoImpl extends BaseCRUDDaoMybatis<DeptEntity, Long> implements ...@@ -50,7 +51,8 @@ public class DeptDaoImpl extends BaseCRUDDaoMybatis<DeptEntity, Long> implements
* @return * @return
*/ */
@Override @Override
public List<DeptEntity> getDeptListByExistBusiness() { public List<DeptEntity> getDeptListByExistBusiness(DeptQuery deptQuery) {
return this.getSqlSession().selectList(this.getSqlId(GET_DEPTLIST_BY_EXISTBUSINESS)); ParamDto paramDto = this.getQueryParam(deptQuery);
return this.getSqlSession().selectList(this.getSqlId(GET_DEPTLIST_BY_EXISTBUSINESS),paramDto);
} }
} }
...@@ -49,6 +49,6 @@ public interface DeptService extends ICRUDCacheService<DeptEntity, Long> { ...@@ -49,6 +49,6 @@ public interface DeptService extends ICRUDCacheService<DeptEntity, Long> {
Rest<Map<String,List<DeptVo>>> getDeptListByBusiness(DeptQuery deptQuery, Context context); Rest<Map<String,List<DeptVo>>> getDeptListByBusiness(DeptQuery deptQuery, Context context);
List<DeptEntity> getDeptListByExistBusiness(); List<DeptEntity> getDeptListByExistBusiness(DeptQuery deptQuery, Context context);
} }
\ No newline at end of file
...@@ -217,8 +217,8 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE ...@@ -217,8 +217,8 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
* @return * @return
*/ */
@Override @Override
public List<DeptEntity> getDeptListByExistBusiness() { public List<DeptEntity> getDeptListByExistBusiness(DeptQuery deptQuery, Context context) {
return this.dao.getDeptListByExistBusiness(); return this.dao.getDeptListByExistBusiness(deptQuery);
} }
......
...@@ -147,16 +147,20 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic ...@@ -147,16 +147,20 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
*/ */
@GetMapping(value = "getDeptListByExistBusiness") @GetMapping(value = "getDeptListByExistBusiness")
@UnAuth @UnAuth
public String getDeptListByExistBusiness() { public String getDeptListByExistBusiness(@PathVariable("siteId") Long siteId) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
String busiDesc = "根据业务查询存在的部门列表" + this.getModuleDesc(); String busiDesc = "根据业务查询存在的部门列表" + this.getModuleDesc();
try { try {
if (ObjectUtils.isEmpty(siteId)) {
List<DeptEntity> deptList = this.service.getDeptListByExistBusiness(); throw new AppException("站点id不能为空!");
}
DeptQuery query = new DeptQuery();
query.setSiteId(siteId);
List<DeptEntity> deptList = this.service.getDeptListByExistBusiness(query, getContext());
if (!ObjectUtils.isEmpty(getContext()) && !ObjectUtils.isEmpty(getContext().getUser())) { if (!ObjectUtils.isEmpty(getContext()) && !ObjectUtils.isEmpty(getContext().getUser())) {
recordSysLog(request, busiDesc + " 【成功】"); recordSysLog(request, busiDesc + " 【成功】");
} }
jsonObject.put(KEY_RESULT_DATA,deptList); jsonObject.put(KEY_RESULT_DATA, deptList);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS); jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, busiDesc + "成功!"); jsonObject.put(KEY_RESULT_MSG, busiDesc + "成功!");
} catch (Exception e) { } catch (Exception e) {
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
<!-- 获取所有存在业务的部门列表 --> <!-- 获取所有存在业务的部门列表 -->
<select id="getDeptListByExistBusiness" resultMap="DeptEntity-Map"> <select id="getDeptListByExistBusiness" parameterType="paramDto" resultMap="DeptEntity-Map">
SELECT DISTINCT SELECT DISTINCT
<include refid="_columns"/> <include refid="_columns"/>
FROM FROM
...@@ -70,7 +70,12 @@ ...@@ -70,7 +70,12 @@
mortals_sys_window_business t2 mortals_sys_window_business t2
WHERE WHERE
a.id = t1.deptId a.id = t1.deptId
AND t1.id = t2.windowId; AND t1.id = t2.windowId and
<trim prefixOverrides="and" prefix="">
<if test="condition.siteId!=null">
a.siteId = #{condition.siteId}
</if>
</trim>
</select> </select>
......
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