diff --git a/renren-admin/src/main/java/io/renren/modules/monitor/entity/CameraChannel.java b/renren-admin/src/main/java/io/renren/modules/monitor/entity/CameraChannel.java index 69fc6d7b..c08adee7 100644 --- a/renren-admin/src/main/java/io/renren/modules/monitor/entity/CameraChannel.java +++ b/renren-admin/src/main/java/io/renren/modules/monitor/entity/CameraChannel.java @@ -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; + } diff --git a/renren-admin/src/main/java/io/renren/modules/resourceCar/controller/ResourceCarController.java b/renren-admin/src/main/java/io/renren/modules/resourceCar/controller/ResourceCarController.java index d442b436..ea98c184 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceCar/controller/ResourceCarController.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceCar/controller/ResourceCarController.java @@ -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)); } } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resourceCar/dao/ResourceCarDao.java b/renren-admin/src/main/java/io/renren/modules/resourceCar/dao/ResourceCarDao.java index 811c0237..4bef40d1 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceCar/dao/ResourceCarDao.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceCar/dao/ResourceCarDao.java @@ -44,9 +44,9 @@ public interface ResourceCarDao extends BaseDao { @Param("pageSize") Integer pageSize, @Param("name") String name); - List selectInfrastructureListByDept(@Param("name") String name, + List 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); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resourceCar/service/ResourceCarService.java b/renren-admin/src/main/java/io/renren/modules/resourceCar/service/ResourceCarService.java index e173ec02..0ade9a3c 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceCar/service/ResourceCarService.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceCar/service/ResourceCarService.java @@ -26,5 +26,5 @@ public interface ResourceCarService extends CrudService 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 result = new ArrayList<>(); switch (Constant.ProjectPlace.getByFlag(projectPlace)) { @@ -136,7 +136,7 @@ public class ResourceCarServiceImpl extends CrudServiceImpl 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 AND car.name LIKE CONCAT('%',#{name},'%') @@ -155,22 +153,23 @@ LIMIT ${pageNum}, ${pageSize} - 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 AND car.name LIKE CONCAT('%',#{name},'%')