新增部门资源接口

新增部门类型
This commit is contained in:
WenG 2021-06-25 00:41:53 +08:00
parent 581e8b098a
commit b7e6d988c3
12 changed files with 104 additions and 2 deletions

View File

@ -3,7 +3,9 @@ package com.cm.serviceusercenter.controller.resources.system.department;
import com.cm.common.constants.ISystemConstant;
import com.cm.common.exception.ParamsException;
import com.cm.common.exception.SearchException;
import com.cm.common.plugin.pojo.bos.department.DepartmentResourceBO;
import com.cm.common.pojo.dtos.ZTreeDTO;
import com.cm.common.pojo.dtos.department.DepartmentSortDTO;
import com.cm.common.result.ErrorResult;
import com.cm.common.utils.RegexUtil;
import com.cm.serviceusercenter.controller.BaseController;
@ -216,4 +218,16 @@ public class DepartmentResourceController extends BaseController {
return departmentService.getDepartmentWithAllSubDepartmentById(departmentId);
}
@ApiOperation(value = "部门列表", notes = "部门列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "access_token", value = "access_token", paramType = "query", dataType = "String"),
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list-sort")
public List<DepartmentSortDTO> listSort() {
Map<String, Object> params = requestParams();
return departmentService.listSort(params);
}
}

View File

@ -7,6 +7,7 @@ import com.cm.common.exception.UpdateException;
import com.cm.common.plugin.pojo.bos.department.DepartmentResourceBO;
import com.cm.common.pojo.bos.DepartmentBO;
import com.cm.common.pojo.dtos.ZTreeDTO;
import com.cm.common.pojo.dtos.department.DepartmentSortDTO;
import com.cm.serviceusercenter.pojo.dtos.DepartmentDTO;
import com.cm.serviceusercenter.pojo.dtos.department.DepartmentSimpleDTO;
import org.springframework.stereotype.Repository;
@ -180,4 +181,13 @@ public interface IDepartmentDao {
* @throws SearchException
*/
List<DepartmentResourceBO> listDepartmentResource(Map<String, Object> params) throws SearchException;
/**
* 部门列表
*
* @param params
* @return
* @throws SearchException
*/
List<DepartmentSortDTO> listSort(Map<String, Object> params) throws SearchException;
}

View File

@ -8,6 +8,7 @@ import com.cm.common.exception.SearchException;
import com.cm.common.exception.UpdateException;
import com.cm.common.pojo.ListPage;
import com.cm.common.pojo.dtos.ZTreeDTO;
import com.cm.common.pojo.dtos.department.DepartmentSortDTO;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
@ -373,9 +374,18 @@ public interface IDepartmentService {
/**
* 部门列表
*
* @param params
* @return
* @throws SearchException
*/
List<DepartmentSimpleDTO> listDepartmentSimple(Map<String, Object> params) throws SearchException;
/**
* 部门列表
*
* @param params
* @return
*/
List<DepartmentSortDTO> listSort(Map<String, Object> params);
}

View File

@ -13,6 +13,7 @@ import com.cm.common.plugin.service.file.IFileService;
import com.cm.common.pojo.ListPage;
import com.cm.common.pojo.bos.DepartmentBO;
import com.cm.common.pojo.dtos.ZTreeDTO;
import com.cm.common.pojo.dtos.department.DepartmentSortDTO;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
@ -593,6 +594,11 @@ public class DepartmentServiceImpl extends BaseService implements IDepartmentSer
return departmentDao.listDepartmentSimple(params);
}
@Override
public List<DepartmentSortDTO> listSort(Map<String, Object> params) {
return departmentDao.listSort(params);
}
/**
* 合并组织到指定组织
*

View File

@ -142,6 +142,14 @@
<result property="departmentCode" column="department_code"/>
</resultMap>
<resultMap id="departmentSortDTO" type="com.cm.common.pojo.dtos.department.DepartmentSortDTO">
<id property="departmentId" column="department_id"/>
<result property="departmentParentId" column="department_parent_id"/>
<result property="departmentName" column="department_name"/>
<result property="departmentCode" column="department_code"/>
<result property="departmentType" column="department_type"/>
</resultMap>
<!-- 新增组织部门 -->
<insert id="saveDepartment" parameterType="map" flushCache="true">
INSERT INTO sys_department(
@ -991,4 +999,49 @@
</if>
</select>
<!-- 部门列表 -->
<select id="listSort" parameterType="map" resultMap="departmentSortDTO">
SELECT
department_id,
department_parent_id,
department_name,
department_code,
department_type
FROM
sys_department
WHERE
is_delete = 0
<if test="departmentType != null">
AND
department_type = #{departmentType}
</if>
<if test="departmentParentId != null and departmentParentId != ''">
AND
department_parent_id = #{departmentParentId}
</if>
<if test="departmentCode != null and departmentCode != ''">
AND
department_code LIKE CONCAT(#{departmentCode}, '%')
</if>
<if test="departmentIds != null and departmentIds.size > 0">
AND
department_id IN
<foreach collection="departmentIds" index="index" open="(" separator="," close=")">
#{departmentIds[${index}]}
</foreach>
</if>
<if test="departmentName != null and departmentName != ''">
AND
department_name = #{departmentName}
</if>
<if test="keywords != null and keywords != ''">
AND
department_name LIKE CONCAT('%', #{keywords}, '%')
</if>
<if test="departmentState != null">
AND
department_state = #{departmentState}
</if>
</select>
</mapper>

View File

@ -78,6 +78,7 @@
<select name="departmentType" lay-verify="required" readonly>
<option value="1" selected>机构</option>
<option value="2">部门</option>
<option value="3">委办局</option>
</select>
</div>
</div>

View File

@ -104,6 +104,9 @@
case 2:
value = '部门';
break;
case 3:
value = '委办局';
break;
default:
value = '无';
}

View File

@ -63,6 +63,7 @@
<select name="departmentType" lay-verify="required">
<option value="1" selected>机构</option>
<option value="2">部门</option>
<option value="3">委办局<option>
</select>
</div>
</div>

View File

@ -69,6 +69,7 @@
<select name="departmentType" lay-verify="required">
<option value="1" selected>机构</option>
<option value="2">部门</option>
<option value="3">委办局<option>
</select>
</div>
</div>

View File

@ -15,7 +15,7 @@
</style>
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein" style="padding: 0;overflow: hidden; height: 100%;">
<div class="layui-fluid layui-anim layui-anim-fadein" style="padding: 0;height: 100%;">
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
@ -78,6 +78,7 @@
<select name="departmentType" lay-verify="required">
<option value="1" selected>机构</option>
<option value="2">部门</option>
<option value="3">委办局</option>
</select>
</div>
</div>

View File

@ -69,6 +69,7 @@
<select name="departmentType" lay-verify="required">
<option value="1" selected>机构</option>
<option value="2">部门</option>
<option value="3">委办局<option>
</select>
</div>
</div>

View File

@ -15,7 +15,7 @@
</style>
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein" style="padding: 0;overflow: hidden; height: 100%;">
<div class="layui-fluid layui-anim layui-anim-fadein" style="padding: 0;height: 100%;">
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
@ -78,6 +78,7 @@
<select name="departmentType" lay-verify="required">
<option value="1" selected>机构</option>
<option value="2">部门</option>
<option value="3">委办局</option>
</select>
</div>
</div>