From 02683fcfebd56bf6b8b5fc1781ce90f2c8ed7391 Mon Sep 17 00:00:00 2001 From: "kuang.yife" Date: Fri, 27 Sep 2024 17:15:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E9=99=A9=E7=AE=A1=E7=90=86=E3=80=81?= =?UTF-8?q?=E6=80=BB=E5=B9=B3=E5=8F=B0=E4=BF=9D=E9=99=A9=E3=80=81=E4=BF=9D?= =?UTF-8?q?=E9=99=A9=E5=85=B3=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods/GoodsDeptCategoryController.java | 22 +++++++++++++ .../templates/goods/deptcategory/edit.html | 33 ++++++++++++++----- .../goods/mapper/InsuranceManagerMapper.java | 4 +++ .../service/IInsuranceManagerService.java | 2 ++ .../impl/InsuranceManagerServiceImpl.java | 5 +++ .../mapper/goods/InsuranceManagerMapper.xml | 7 ++++ 6 files changed, 65 insertions(+), 8 deletions(-) diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsDeptCategoryController.java b/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsDeptCategoryController.java index 2bd0f406..abd433f7 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsDeptCategoryController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsDeptCategoryController.java @@ -1,5 +1,6 @@ package com.ghy.web.controller.goods; +import cn.hutool.core.collection.CollectionUtil; import com.ghy.common.annotation.Log; import com.ghy.common.core.controller.BaseController; import com.ghy.common.core.domain.AjaxResult; @@ -10,10 +11,14 @@ import com.ghy.common.enums.ImgType; import com.ghy.common.utils.ExceptionUtil; import com.ghy.common.utils.ShiroUtils; import com.ghy.common.utils.StringUtils; +import com.ghy.goods.domain.CategoryInsuranceRelation; import com.ghy.goods.domain.DeptGoodsCategory; import com.ghy.goods.domain.GoodsImgs; +import com.ghy.goods.domain.InsuranceManager; import com.ghy.goods.service.DeptGoodsCategoryService; import com.ghy.goods.service.GoodsImgsService; +import com.ghy.goods.service.ICategoryInsuranceRelationService; +import com.ghy.goods.service.IInsuranceManagerService; import com.ghy.web.pojo.vo.AppCategoryRequest; import com.ghy.web.pojo.vo.HotCategoryResponse; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -38,6 +43,12 @@ public class GoodsDeptCategoryController extends BaseController { @Resource DeptGoodsCategoryService deptGoodsCategoryService; + @Resource + ICategoryInsuranceRelationService categoryInsuranceRelationService; + + @Resource + IInsuranceManagerService insuranceManagerService; + @Autowired private GoodsImgsService goodsImgsService; @@ -145,6 +156,17 @@ public class GoodsDeptCategoryController extends BaseController { @GetMapping("/edit/{id}") public String edit(@PathVariable("id") Long id, ModelMap mmap) { DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.get(id); + CategoryInsuranceRelation relation = new CategoryInsuranceRelation(); + relation.setGoodsCategoryId(deptGoodsCategory.getGoodsCategoryId()); + List relations = categoryInsuranceRelationService.selectCategoryInsuranceRelationList(relation); + List list = null; + if(CollectionUtil.isNotEmpty(relations)){ + list = insuranceManagerService.selectByIds(relations.stream().map(CategoryInsuranceRelation::getInsuranceId).collect(Collectors.toList())); + list.forEach(model->{ + model.setInsuranceName(model.getCompanyName() + "||" + model.getInsuranceName() + "||" + model.getInsuranceAmount() + "元"); + }); + } + mmap.put("insurances", list); mmap.put("deptGoodsCategory", deptGoodsCategory); return PREFIX + "/edit"; } diff --git a/ghy-admin/src/main/resources/templates/goods/deptcategory/edit.html b/ghy-admin/src/main/resources/templates/goods/deptcategory/edit.html index ec870f34..de9e8cbc 100644 --- a/ghy-admin/src/main/resources/templates/goods/deptcategory/edit.html +++ b/ghy-admin/src/main/resources/templates/goods/deptcategory/edit.html @@ -238,14 +238,31 @@ -
-
- -
- +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+
+
+ +
+ +
diff --git a/ghy-goods/src/main/java/com/ghy/goods/mapper/InsuranceManagerMapper.java b/ghy-goods/src/main/java/com/ghy/goods/mapper/InsuranceManagerMapper.java index bdd3cc8c..2ebaade0 100644 --- a/ghy-goods/src/main/java/com/ghy/goods/mapper/InsuranceManagerMapper.java +++ b/ghy-goods/src/main/java/com/ghy/goods/mapper/InsuranceManagerMapper.java @@ -1,6 +1,7 @@ package com.ghy.goods.mapper; import java.util.List; import com.ghy.goods.domain.InsuranceManager; +import org.apache.ibatis.annotations.Param; /** * 保险管理Mapper接口 @@ -57,4 +58,7 @@ public interface InsuranceManagerMapper * @return 结果 */ public int deleteInsuranceManagerByIds(String[] ids); + + List selectByIds(@Param("ids") List ids); + } diff --git a/ghy-goods/src/main/java/com/ghy/goods/service/IInsuranceManagerService.java b/ghy-goods/src/main/java/com/ghy/goods/service/IInsuranceManagerService.java index dee1d7c5..261be7ec 100644 --- a/ghy-goods/src/main/java/com/ghy/goods/service/IInsuranceManagerService.java +++ b/ghy-goods/src/main/java/com/ghy/goods/service/IInsuranceManagerService.java @@ -27,6 +27,8 @@ public interface IInsuranceManagerService */ public List selectInsuranceManagerList(InsuranceManager insuranceManager); + public List selectByIds(List ids); + /** * 新增保险管理 * diff --git a/ghy-goods/src/main/java/com/ghy/goods/service/impl/InsuranceManagerServiceImpl.java b/ghy-goods/src/main/java/com/ghy/goods/service/impl/InsuranceManagerServiceImpl.java index 50a4ad42..11abedbd 100644 --- a/ghy-goods/src/main/java/com/ghy/goods/service/impl/InsuranceManagerServiceImpl.java +++ b/ghy-goods/src/main/java/com/ghy/goods/service/impl/InsuranceManagerServiceImpl.java @@ -45,6 +45,11 @@ public class InsuranceManagerServiceImpl implements IInsuranceManagerService return insuranceManagerMapper.selectInsuranceManagerList(insuranceManager); } + @Override + public List selectByIds(List ids) { + return insuranceManagerMapper.selectByIds(ids); + } + /** * 新增保险管理 * diff --git a/ghy-goods/src/main/resources/mapper/goods/InsuranceManagerMapper.xml b/ghy-goods/src/main/resources/mapper/goods/InsuranceManagerMapper.xml index 11e0295f..4f098612 100644 --- a/ghy-goods/src/main/resources/mapper/goods/InsuranceManagerMapper.xml +++ b/ghy-goods/src/main/resources/mapper/goods/InsuranceManagerMapper.xml @@ -89,4 +89,11 @@ + \ No newline at end of file