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 05928980..d051dc07 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 @@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; +import java.util.List; import java.util.Map; /** @@ -79,6 +80,14 @@ public class ResourceCarController { } } + @PostMapping("/batchInsert") + @ApiOperation("批量添加申购车") + @LogOperation(value = "批量添加申购车", operationTable = "tb_resource_car;") + public Result save(@RequestBody List dtoList) { + dtoList.stream().forEach(dto->resourceCarService.insertOrUpdate(dto)); + return new Result(); + } + @DeleteMapping("/delete") @ApiOperation("删除申购记录") @LogOperation(value = "删除申购记录", operationTable = "tb_resource_car;") 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 86a83cce..e0406714 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 @@ -38,4 +38,15 @@ public interface ResourceCarDao extends BaseDao { @Param("pageSize") Integer pageSize); Integer selectProvideDeptCount(@Param("userId") Long userId, @Param("name") String name); + + List selectInfrastructureCarGroupByDept(@Param("userId") Long userId, + @Param("pageNum") Integer pageNum, + @Param("pageSize") Integer pageSize, + @Param("name") String name); + + List selectInfrastructureListByDept(@Param("name") String name, + @Param("userId") Long userId, + @Param("deptId") Long deptId, + @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/impl/ResourceCarServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/resourceCar/service/impl/ResourceCarServiceImpl.java index 92511e0f..947e8cbe 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceCar/service/impl/ResourceCarServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceCar/service/impl/ResourceCarServiceImpl.java @@ -15,12 +15,11 @@ import io.renren.modules.security.user.UserDetail; import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; +import java.util.stream.Collectors; /** * 申购记录表 @@ -37,6 +36,9 @@ public class ResourceCarServiceImpl extends CrudServiceImpl getWrapper(Map params) { QueryWrapper wrapper = new QueryWrapper<>(); @@ -107,15 +109,37 @@ public class ResourceCarServiceImpl extends CrudServiceImpl resultMap = new HashMap<>(); - List maps = resourceCarDao.selectResourceCarGroupByDept(userId, (pageNum - 1) * pageSize, pageSize, name); - resultMap.put("list", maps); - resultMap.put("deptCount", resourceCarDao.selectProvideDeptCount(userId, name)); + switch (Constant.ProjectPlace.getByFlag(projectPlace)) { + case TSINGTAO: { + List maps = resourceCarDao.selectResourceCarGroupByDept(userId, (pageNum - 1) * pageSize, pageSize, name); + resultMap.put("list", maps); + resultMap.put("deptCount", resourceCarDao.selectProvideDeptCount(userId, name)); + } + break; + case TSINGTAO_XHA: { + List 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()); + } + break; + } return resultMap; } @Override public Object selectResourceListByDept(String name, Long deptId, Integer pageNum, Integer pageSize) { Long userId = SecurityUser.getUserId(); - return resourceCarDao.selectResourceListByDept(name, userId, deptId, (pageNum - 1) * pageSize, pageSize); + List result=new ArrayList<>(); + switch (Constant.ProjectPlace.getByFlag(projectPlace)) { + case TSINGTAO: { + result.addAll(resourceCarDao.selectResourceListByDept(name, userId, deptId, (pageNum - 1) * pageSize, pageSize)); + } + break; + case TSINGTAO_XHA: { + result.addAll(resourceCarDao.selectInfrastructureListByDept(name, userId, deptId, (pageNum - 1) * pageSize, pageSize)); + } + break; + } + return result; } } \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/resourceCar/ResourceCarDao.xml b/renren-admin/src/main/resources/mapper/resourceCar/ResourceCarDao.xml index 81c9e80a..398248c2 100644 --- a/renren-admin/src/main/resources/mapper/resourceCar/ResourceCarDao.xml +++ b/renren-admin/src/main/resources/mapper/resourceCar/ResourceCarDao.xml @@ -82,6 +82,25 @@ LIMIT ${pageNum}, ${pageSize} + + + +