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

添加查询存在业务的部门

parent 0c8426df
package com.mortals.xhx.module.dept.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.xhx.module.dept.model.DeptEntity;
......@@ -26,6 +27,6 @@ public interface DeptDao extends ICRUDDao<DeptEntity,Long>{
List<DeptVo> getBusinessByDept(DeptQuery deptQuery);
List<DeptEntity> getDeptListByExistBusiness();
List<DeptEntity> getDeptListByExistBusiness(DeptQuery deptQuery);
}
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.Result;
import com.mortals.xhx.module.dept.model.DeptQuery;
......@@ -50,7 +51,8 @@ public class DeptDaoImpl extends BaseCRUDDaoMybatis<DeptEntity, Long> implements
* @return
*/
@Override
public List<DeptEntity> getDeptListByExistBusiness() {
return this.getSqlSession().selectList(this.getSqlId(GET_DEPTLIST_BY_EXISTBUSINESS));
public List<DeptEntity> getDeptListByExistBusiness(DeptQuery deptQuery) {
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> {
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
* @return
*/
@Override
public List<DeptEntity> getDeptListByExistBusiness() {
return this.dao.getDeptListByExistBusiness();
public List<DeptEntity> getDeptListByExistBusiness(DeptQuery deptQuery, Context context) {
return this.dao.getDeptListByExistBusiness(deptQuery);
}
......
......@@ -147,16 +147,20 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
*/
@GetMapping(value = "getDeptListByExistBusiness")
@UnAuth
public String getDeptListByExistBusiness() {
public String getDeptListByExistBusiness(@PathVariable("siteId") Long siteId) {
JSONObject jsonObject = new JSONObject();
String busiDesc = "根据业务查询存在的部门列表" + this.getModuleDesc();
try {
List<DeptEntity> deptList = this.service.getDeptListByExistBusiness();
if (ObjectUtils.isEmpty(siteId)) {
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())) {
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_MSG, busiDesc + "成功!");
} catch (Exception e) {
......
......@@ -61,7 +61,7 @@
<!-- 获取所有存在业务的部门列表 -->
<select id="getDeptListByExistBusiness" resultMap="DeptEntity-Map">
<select id="getDeptListByExistBusiness" parameterType="paramDto" resultMap="DeptEntity-Map">
SELECT DISTINCT
<include refid="_columns"/>
FROM
......@@ -70,7 +70,12 @@
mortals_sys_window_business t2
WHERE
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>
......
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