完善:西海岸申购车

This commit is contained in:
lizhicheng 2022-10-09 17:20:03 +08:00
parent 77aac95526
commit bb9d5847bf
7 changed files with 32 additions and 19 deletions

View File

@ -1,5 +1,6 @@
package io.renren.modules.monitor.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@ -29,4 +30,7 @@ public class CameraChannel {
private String parentId;
@TableField(exist = false)
private String managementUnitName;
}

View File

@ -110,7 +110,14 @@ public class ResourceCarController {
@ApiOperation("根据部门查询申购车资源列表")
@LogOperation("根据部门查询申购车资源列表")
public Result selectResourceListByDept(String name, @RequestParam Long deptId, @RequestParam Integer pageNum, @RequestParam Integer pageSize) {
return new Result().ok(resourceCarService.selectResourceListByDept(name, deptId, pageNum, pageSize));
return new Result().ok(resourceCarService.selectResourceListByDept(name, deptId, null, pageNum, pageSize));
}
@GetMapping("/selectResourceListByDeptName")
@ApiOperation("根据部门名称查询申购车资源列表")
@LogOperation("根据部门名称查询申购车资源列表")
public Result selectResourceListByDeptName(String name, @RequestParam String deptName, @RequestParam Integer pageNum, @RequestParam Integer pageSize) {
return new Result().ok(resourceCarService.selectResourceListByDept(name, null, deptName, pageNum, pageSize));
}
}

View File

@ -44,9 +44,9 @@ public interface ResourceCarDao extends BaseDao<ResourceCarEntity> {
@Param("pageSize") Integer pageSize,
@Param("name") String name);
List<Map> selectInfrastructureListByDept(@Param("name") String name,
List<Map> selectInfrastructureListByDeptName(@Param("name") String name,
@Param("userId") Long userId,
@Param("deptId") Long deptId,
@Param("deptName") String deptName,
@Param("pageNum") Integer pageNum,
@Param("pageSize") Integer pageSize);
}

View File

@ -26,5 +26,5 @@ public interface ResourceCarService extends CrudService<ResourceCarEntity, Resou
Object selectResourceCarGroupByDept(String name, Integer pageNum, Integer pageSize);
Object selectResourceListByDept(String name, Long deptId, Integer pageNum, Integer pageSize);
Object selectResourceListByDept(String name, Long deptId, String deptName, Integer pageNum, Integer pageSize);
}

View File

@ -119,7 +119,7 @@ public class ResourceCarServiceImpl extends CrudServiceImpl<ResourceCarDao, Reso
case TSINGTAO_XHA: {
List<Map> maps = resourceCarDao.selectInfrastructureCarGroupByDept(userId, (pageNum - 1) * pageSize, pageSize, name);
resultMap.put("list", maps);
resultMap.put("deptCount", maps.stream().collect(Collectors.groupingBy(it -> it.get("deptId"))).size());
resultMap.put("deptCount", maps.stream().collect(Collectors.groupingBy(it->it.get("deptName"))).size());
}
break;
}
@ -127,7 +127,7 @@ public class ResourceCarServiceImpl extends CrudServiceImpl<ResourceCarDao, Reso
}
@Override
public Object selectResourceListByDept(String name, Long deptId, Integer pageNum, Integer pageSize) {
public Object selectResourceListByDept(String name, Long deptId, String deptName, Integer pageNum, Integer pageSize) {
Long userId = SecurityUser.getUserId();
List<Map> result = new ArrayList<>();
switch (Constant.ProjectPlace.getByFlag(projectPlace)) {
@ -136,7 +136,7 @@ public class ResourceCarServiceImpl extends CrudServiceImpl<ResourceCarDao, Reso
}
break;
case TSINGTAO_XHA: {
result.addAll(resourceCarDao.selectInfrastructureListByDept(name, userId, deptId, (pageNum - 1) * pageSize, pageSize));
result.addAll(resourceCarDao.selectInfrastructureListByDeptName(name, userId, deptName, (pageNum - 1) * pageSize, pageSize));
}
break;
}

View File

@ -0,0 +1,3 @@
ALTER TABLE `sys_notice`
ADD COLUMN `apply_id` varchar(255) NULL COMMENT '通知来源id',
ADD COLUMN `apply_state` int NULL COMMENT '通知来源状态';

View File

@ -84,16 +84,14 @@
<select id="selectInfrastructureCarGroupByDept" resultType="java.util.Map">
SELECT
dept.id AS "deptId",
dept.name AS "deptName",
IFNULL(dept.id, -1) AS "deptId",
car.dept_name AS "deptName",
COUNT(car.id) AS "count"
FROM
(select del_flag, user_id, json_extract(note1, '$[0].idtCameraChannel') as id, TRIM(BOTH '"' FROM
json_extract(note1, '$[0].managementUnitName')) as dept_name, json_extract(note1, '$[0].channelName') as name
from tb_resource_car where note1 IS NOT NULL) car,
sys_dept dept
(select del_flag, user_id, json_extract(note1, '$[0].idtCameraChannel') as id, TRIM(BOTH '"' FROM json_extract(note1, '$[0].managementUnitName')) as dept_name, json_extract(note1, '$[0].channelName') as name
from tb_resource_car where note1 IS NOT NULL) car
left join sys_dept dept on car.dept_name=dept.name
WHERE car.user_id = #{userId}
AND car.dept_name=dept.name
AND car.del_flag = 0
<if test="name != null and name != ''">
AND car.name LIKE CONCAT('%',#{name},'%')
@ -155,22 +153,23 @@
LIMIT ${pageNum}, ${pageSize}
</select>
<select id="selectInfrastructureListByDept" resultType="java.util.Map">
<select id="selectInfrastructureListByDeptName" resultType="java.util.Map">
SELECT
car.id AS "id",
car.resource_id AS "resourceId",
car.name AS "resourceName",
car.note1,
car.create_date AS "time"
car.create_date AS "time",
car.del_flag AS delFlag,
car.idtCameraChannel
FROM
(select del_flag, user_id, note1, create_date, resource_id, json_extract(note1, '$[0].idtCameraChannel') as id,
(select del_flag, id, user_id, note1, create_date, resource_id, json_extract(note1, '$[0].idtCameraChannel') as idtCameraChannel,
TRIM(BOTH '"' FROM json_extract(note1, '$[0].managementUnitName')) as dept_name, json_extract(note1,
'$[0].channelName') as name
from tb_resource_car where note1 IS NOT NULL) car
left join sys_dept dept on car.dept_name=dept.name
WHERE 1 = 1
AND car.user_id = #{userId}
AND dept.id = #{deptId}
AND car.dept_name = #{deptName}
AND car.del_flag = 0
<if test="name != null and name != ''">
AND car.name LIKE CONCAT('%',#{name},'%')