Commit b9aef449be6d6966bdf9db8bb28ce5797d23966e
1 parent
2ae793ba
材料登录增加归属单位
Showing
3 changed files
with
79 additions
and
28 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/materialinventory/MaterialInventoryController.java
| @@ -119,8 +119,8 @@ public class MaterialInventoryController { | @@ -119,8 +119,8 @@ public class MaterialInventoryController { | ||
| 119 | @Operation(summary ="物料类型基础表-耗材类型List") | 119 | @Operation(summary ="物料类型基础表-耗材类型List") |
| 120 | @GetMapping(value = "/getMaterialBigTypeList") | 120 | @GetMapping(value = "/getMaterialBigTypeList") |
| 121 | @PreAuthorize("@ss.hasPermission('garden:material-type:query')") | 121 | @PreAuthorize("@ss.hasPermission('garden:material-type:query')") |
| 122 | - public CommonResult getInfo() { | ||
| 123 | - return success(materialInventoryService.queryMaterialBigType(null)); | 122 | + public CommonResult getInfo(@RequestParam("companyId") Long companyId) { |
| 123 | + return success(materialInventoryService.queryMaterialBigType(null, companyId)); | ||
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | /** | 126 | /** |
| @@ -129,8 +129,8 @@ public class MaterialInventoryController { | @@ -129,8 +129,8 @@ public class MaterialInventoryController { | ||
| 129 | @Operation(summary ="物料类型基础表-类别List") | 129 | @Operation(summary ="物料类型基础表-类别List") |
| 130 | @GetMapping(value = "/getMaterialMidTypeList") | 130 | @GetMapping(value = "/getMaterialMidTypeList") |
| 131 | @PreAuthorize("@ss.hasPermission('garden:material-type:query')") | 131 | @PreAuthorize("@ss.hasPermission('garden:material-type:query')") |
| 132 | - public CommonResult getMaterialMidTypeList(@RequestParam("materialTypeId") Long materialTypeId) { | ||
| 133 | - return success(materialInventoryService.queryMaterialMidType(materialTypeId)); | 132 | + public CommonResult getMaterialMidTypeList(@RequestParam("materialTypeId") Long materialTypeId, @RequestParam("companyId") Long companyId) { |
| 133 | + return success(materialInventoryService.queryMaterialMidType(materialTypeId, companyId)); | ||
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | /** | 136 | /** |
| @@ -139,8 +139,8 @@ public class MaterialInventoryController { | @@ -139,8 +139,8 @@ public class MaterialInventoryController { | ||
| 139 | @Operation(summary ="物料类型基础表-类别List") | 139 | @Operation(summary ="物料类型基础表-类别List") |
| 140 | @GetMapping(value = "/getMaterialDetailTypeList") | 140 | @GetMapping(value = "/getMaterialDetailTypeList") |
| 141 | @PreAuthorize("@ss.hasPermission('garden:material-type:query')") | 141 | @PreAuthorize("@ss.hasPermission('garden:material-type:query')") |
| 142 | - public CommonResult getMaterialDetailTypeList(@RequestParam("typeId") Long typeId) { | ||
| 143 | - return success(materialInventoryService.queryMaterialDetailType(typeId)); | 142 | + public CommonResult getMaterialDetailTypeList(@RequestParam("typeId") Long typeId, @RequestParam("companyId") Long companyId) { |
| 143 | + return success(materialInventoryService.queryMaterialDetailType(typeId, companyId)); | ||
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | /** | 146 | /** |
| @@ -149,7 +149,7 @@ public class MaterialInventoryController { | @@ -149,7 +149,7 @@ public class MaterialInventoryController { | ||
| 149 | @Operation(summary ="物料-类别List") | 149 | @Operation(summary ="物料-类别List") |
| 150 | @GetMapping(value = "/getMaterialList") | 150 | @GetMapping(value = "/getMaterialList") |
| 151 | @PreAuthorize("@ss.hasPermission('garden:material-type:query')") | 151 | @PreAuthorize("@ss.hasPermission('garden:material-type:query')") |
| 152 | - public CommonResult getMaterialList(@RequestParam("typeDetailId") Long typeDetailId) { | ||
| 153 | - return success(materialInventoryService.getMaterialInventorList(typeDetailId)); | 152 | + public CommonResult getMaterialList(@RequestParam("typeDetailId") Long typeDetailId, @RequestParam("companyId") Long companyId) { |
| 153 | + return success(materialInventoryService.getMaterialInventorList(typeDetailId, companyId)); | ||
| 154 | } | 154 | } |
| 155 | } | 155 | } |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/materialinventory/MaterialInventoryService.java
| @@ -109,12 +109,37 @@ public interface MaterialInventoryService { | @@ -109,12 +109,37 @@ public interface MaterialInventoryService { | ||
| 109 | */ | 109 | */ |
| 110 | MaterialInventoryDO selectMaterialInventoryByMaterialId(Long materialId); | 110 | MaterialInventoryDO selectMaterialInventoryByMaterialId(Long materialId); |
| 111 | 111 | ||
| 112 | - List<MaterialTypeResp> queryMaterialBigType(Long materialTypeId); | ||
| 113 | - | ||
| 114 | - List<MaterialTypeResp> queryMaterialMidType(Long materialTypeId); | ||
| 115 | - | ||
| 116 | - List<MaterialTypeResp> queryMaterialDetailType(Long typeId); | ||
| 117 | - | ||
| 118 | - List<MaterialTypeResp> getMaterialInventorList(Long typeDetailId); | 112 | + /** |
| 113 | + * @Author wangqian | ||
| 114 | + * @Description 查询所有种类 | ||
| 115 | + * @Date 2025/12/20 22:00 | ||
| 116 | + * @Param materialTypeId | ||
| 117 | + * @param companyId | ||
| 118 | + */ | ||
| 119 | + List<MaterialTypeResp> queryMaterialBigType(Long materialTypeId, Long companyId); | ||
| 120 | + /** | ||
| 121 | + * @Author wangqian | ||
| 122 | + * @Description 根据种类查询类别 | ||
| 123 | + * @Date 2025/12/20 22:01 | ||
| 124 | + * @Param materialTypeId | ||
| 125 | + * @param companyId | ||
| 126 | + */ | ||
| 127 | + List<MaterialTypeResp> queryMaterialMidType(Long materialTypeId, Long companyId); | ||
| 128 | + /** | ||
| 129 | + * @Author wangqian | ||
| 130 | + * @Description 根据类型查询明细 | ||
| 131 | + * @Date 2025/12/20 22:01 | ||
| 132 | + * @Param typeId | ||
| 133 | + * @param companyId | ||
| 134 | + */ | ||
| 135 | + List<MaterialTypeResp> queryMaterialDetailType(Long typeId, Long companyId); | ||
| 136 | + /** | ||
| 137 | + * @Author wangqian | ||
| 138 | + * @Description 根据明细查询物料 | ||
| 139 | + * @Date 2025/12/20 22:01 | ||
| 140 | + * @Param typeDetailId | ||
| 141 | + * @param companyId | ||
| 142 | + */ | ||
| 143 | + List<MaterialTypeResp> getMaterialInventorList(Long typeDetailId, Long companyId); | ||
| 119 | 144 | ||
| 120 | } | 145 | } |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/materialinventory/MaterialInventoryServiceImpl.java
| @@ -180,14 +180,13 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService { | @@ -180,14 +180,13 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService { | ||
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | @Override | 182 | @Override |
| 183 | - public List<MaterialTypeResp> queryMaterialBigType(Long materialTypeId) { | ||
| 184 | - List<MaterialInventoryDO> list; | ||
| 185 | - // 入参为空时查询所有,非空时按ID查询 | ||
| 186 | - if (materialTypeId == null) { | ||
| 187 | - list = materialInventoryMapper.selectList(); | ||
| 188 | - } else { | ||
| 189 | - list = materialInventoryMapper.selectList(MaterialInventoryDO::getMaterialTypeId, materialTypeId); | 183 | + public List<MaterialTypeResp> queryMaterialBigType(Long materialTypeId, Long companyId) { |
| 184 | + if (companyId == null) { | ||
| 185 | + throw exception0(BAD_REQUEST.getCode(),"归属单位不能为空!"); | ||
| 190 | } | 186 | } |
| 187 | + LambdaQueryWrapper<MaterialInventoryDO> queryWrapper = Wrappers.lambdaQuery(); | ||
| 188 | + queryWrapper.eq(MaterialInventoryDO::getBelongCompanyId, companyId); | ||
| 189 | + List<MaterialInventoryDO> list = materialInventoryMapper.selectList(queryWrapper); | ||
| 191 | 190 | ||
| 192 | // 空列表判断,避免空指针 | 191 | // 空列表判断,避免空指针 |
| 193 | if (list == null || list.isEmpty()) { | 192 | if (list == null || list.isEmpty()) { |
| @@ -207,8 +206,17 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService { | @@ -207,8 +206,17 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService { | ||
| 207 | } | 206 | } |
| 208 | 207 | ||
| 209 | @Override | 208 | @Override |
| 210 | - public List<MaterialTypeResp> queryMaterialMidType(Long materialTypeId) { | ||
| 211 | - List<MaterialInventoryDO> list = materialInventoryMapper.selectList(MaterialInventoryDO::getMaterialTypeId, materialTypeId); | 209 | + public List<MaterialTypeResp> queryMaterialMidType(Long materialTypeId, Long companyId) { |
| 210 | + if (materialTypeId == null) { | ||
| 211 | + throw exception0(BAD_REQUEST.getCode(),"种类不能为空!"); | ||
| 212 | + } | ||
| 213 | + if (companyId == null) { | ||
| 214 | + throw exception0(BAD_REQUEST.getCode(),"归属单位不能为空!"); | ||
| 215 | + } | ||
| 216 | + LambdaQueryWrapper<MaterialInventoryDO> queryWrapper = Wrappers.lambdaQuery(); | ||
| 217 | + queryWrapper.eq(MaterialInventoryDO::getMaterialTypeId, materialTypeId); | ||
| 218 | + queryWrapper.eq(MaterialInventoryDO::getBelongCompanyId, companyId); | ||
| 219 | + List<MaterialInventoryDO> list = materialInventoryMapper.selectList(queryWrapper); | ||
| 212 | // 2. 空列表判断,避免空指针 | 220 | // 2. 空列表判断,避免空指针 |
| 213 | if (list == null || list.isEmpty()) { | 221 | if (list == null || list.isEmpty()) { |
| 214 | return List.of(); // 返回空列表而非null,更符合Java规范 | 222 | return List.of(); // 返回空列表而非null,更符合Java规范 |
| @@ -226,8 +234,17 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService { | @@ -226,8 +234,17 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService { | ||
| 226 | } | 234 | } |
| 227 | 235 | ||
| 228 | @Override | 236 | @Override |
| 229 | - public List<MaterialTypeResp> queryMaterialDetailType(Long typeId) { | ||
| 230 | - List<MaterialInventoryDO> list = materialInventoryMapper.selectList(MaterialInventoryDO::getTypeId, typeId); | 237 | + public List<MaterialTypeResp> queryMaterialDetailType(Long typeId, Long companyId) { |
| 238 | + if (typeId == null) { | ||
| 239 | + throw exception0(BAD_REQUEST.getCode(),"类别不能为空!"); | ||
| 240 | + } | ||
| 241 | + if (companyId == null) { | ||
| 242 | + throw exception0(BAD_REQUEST.getCode(),"归属单位不能为空!"); | ||
| 243 | + } | ||
| 244 | + LambdaQueryWrapper<MaterialInventoryDO> queryWrapper = Wrappers.lambdaQuery(); | ||
| 245 | + queryWrapper.eq(MaterialInventoryDO::getTypeId, typeId); | ||
| 246 | + queryWrapper.eq(MaterialInventoryDO::getBelongCompanyId, companyId); | ||
| 247 | + List<MaterialInventoryDO> list = materialInventoryMapper.selectList(queryWrapper); | ||
| 231 | // 2. 空列表判断,避免空指针 | 248 | // 2. 空列表判断,避免空指针 |
| 232 | if (list == null || list.isEmpty()) { | 249 | if (list == null || list.isEmpty()) { |
| 233 | return List.of(); // 返回空列表而非null,更符合Java规范 | 250 | return List.of(); // 返回空列表而非null,更符合Java规范 |
| @@ -245,8 +262,17 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService { | @@ -245,8 +262,17 @@ public class MaterialInventoryServiceImpl implements MaterialInventoryService { | ||
| 245 | } | 262 | } |
| 246 | 263 | ||
| 247 | @Override | 264 | @Override |
| 248 | - public List<MaterialTypeResp> getMaterialInventorList(Long typeDetailId) { | ||
| 249 | - List<MaterialInventoryDO> list = materialInventoryMapper.selectList(MaterialInventoryDO::getTypeDetailId, typeDetailId); | 265 | + public List<MaterialTypeResp> getMaterialInventorList(Long typeDetailId, Long companyId) { |
| 266 | + if (typeDetailId == null) { | ||
| 267 | + throw exception0(BAD_REQUEST.getCode(),"明细不能为空!"); | ||
| 268 | + } | ||
| 269 | + if (companyId == null) { | ||
| 270 | + throw exception0(BAD_REQUEST.getCode(),"归属单位不能为空!"); | ||
| 271 | + } | ||
| 272 | + LambdaQueryWrapper<MaterialInventoryDO> queryWrapper = Wrappers.lambdaQuery(); | ||
| 273 | + queryWrapper.eq(MaterialInventoryDO::getTypeDetailId, typeDetailId); | ||
| 274 | + queryWrapper.eq(MaterialInventoryDO::getBelongCompanyId, companyId); | ||
| 275 | + List<MaterialInventoryDO> list = materialInventoryMapper.selectList(queryWrapper); | ||
| 250 | // 2. 空列表判断,避免空指针 | 276 | // 2. 空列表判断,避免空指针 |
| 251 | if (list == null || list.isEmpty()) { | 277 | if (list == null || list.isEmpty()) { |
| 252 | return List.of(); // 返回空列表而非null,更符合Java规范 | 278 | return List.of(); // 返回空列表而非null,更符合Java规范 |