保险管理、总平台保险、保险关系

This commit is contained in:
kuang.yife 2024-09-27 17:15:34 +08:00
parent aac5ba8b20
commit 02683fcfeb
6 changed files with 65 additions and 8 deletions

View File

@ -1,5 +1,6 @@
package com.ghy.web.controller.goods; package com.ghy.web.controller.goods;
import cn.hutool.core.collection.CollectionUtil;
import com.ghy.common.annotation.Log; import com.ghy.common.annotation.Log;
import com.ghy.common.core.controller.BaseController; import com.ghy.common.core.controller.BaseController;
import com.ghy.common.core.domain.AjaxResult; 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.ExceptionUtil;
import com.ghy.common.utils.ShiroUtils; import com.ghy.common.utils.ShiroUtils;
import com.ghy.common.utils.StringUtils; import com.ghy.common.utils.StringUtils;
import com.ghy.goods.domain.CategoryInsuranceRelation;
import com.ghy.goods.domain.DeptGoodsCategory; import com.ghy.goods.domain.DeptGoodsCategory;
import com.ghy.goods.domain.GoodsImgs; import com.ghy.goods.domain.GoodsImgs;
import com.ghy.goods.domain.InsuranceManager;
import com.ghy.goods.service.DeptGoodsCategoryService; import com.ghy.goods.service.DeptGoodsCategoryService;
import com.ghy.goods.service.GoodsImgsService; 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.AppCategoryRequest;
import com.ghy.web.pojo.vo.HotCategoryResponse; import com.ghy.web.pojo.vo.HotCategoryResponse;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
@ -38,6 +43,12 @@ public class GoodsDeptCategoryController extends BaseController {
@Resource @Resource
DeptGoodsCategoryService deptGoodsCategoryService; DeptGoodsCategoryService deptGoodsCategoryService;
@Resource
ICategoryInsuranceRelationService categoryInsuranceRelationService;
@Resource
IInsuranceManagerService insuranceManagerService;
@Autowired @Autowired
private GoodsImgsService goodsImgsService; private GoodsImgsService goodsImgsService;
@ -145,6 +156,17 @@ public class GoodsDeptCategoryController extends BaseController {
@GetMapping("/edit/{id}") @GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap) { public String edit(@PathVariable("id") Long id, ModelMap mmap) {
DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.get(id); DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.get(id);
CategoryInsuranceRelation relation = new CategoryInsuranceRelation();
relation.setGoodsCategoryId(deptGoodsCategory.getGoodsCategoryId());
List<CategoryInsuranceRelation> relations = categoryInsuranceRelationService.selectCategoryInsuranceRelationList(relation);
List<InsuranceManager> 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); mmap.put("deptGoodsCategory", deptGoodsCategory);
return PREFIX + "/edit"; return PREFIX + "/edit";
} }

View File

@ -238,14 +238,31 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-sm-6"> </div>
<div class="form-group"> <div class="row">
<label class="col-sm-6 control-label">是否需要保险:</label> <div class="row">
<div class="col-sm-6"> <div class="col-sm-12">
<select name="isSure" class="form-control m-b" th:field="*{isSure}" th:with="type=${@dict.getType('sys_user_sex')}"> <div class="form-group">
<option th:text="否" th:value="0"/> <label class="col-xs-3 control-label">PC保险设定</label>
<option th:text="是" th:value="1"/> <div class="col-xs-9">
</select> <label th:each="insurance:${insurances}" class="check-box">
<input name="pcInsurance" type="checkbox" th:value="${insurance.id}" th:text="${insurance.insuranceName}" th:checked="${insurance.flag}">
</label>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<label class="col-xs-3 control-label">商城保险设定:</label>
<div class="col-xs-9">
<label th:each="insurance:${insurances}" class="check-box">
<input name="shopInsurance" type="checkbox" th:value="${insurance.id}" th:text="${insurance.insuranceName}" th:checked="${insurance.flag}">
</label>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,6 +1,7 @@
package com.ghy.goods.mapper; package com.ghy.goods.mapper;
import java.util.List; import java.util.List;
import com.ghy.goods.domain.InsuranceManager; import com.ghy.goods.domain.InsuranceManager;
import org.apache.ibatis.annotations.Param;
/** /**
* 保险管理Mapper接口 * 保险管理Mapper接口
@ -57,4 +58,7 @@ public interface InsuranceManagerMapper
* @return 结果 * @return 结果
*/ */
public int deleteInsuranceManagerByIds(String[] ids); public int deleteInsuranceManagerByIds(String[] ids);
List<InsuranceManager> selectByIds(@Param("ids") List<Long> ids);
} }

View File

@ -27,6 +27,8 @@ public interface IInsuranceManagerService
*/ */
public List<InsuranceManager> selectInsuranceManagerList(InsuranceManager insuranceManager); public List<InsuranceManager> selectInsuranceManagerList(InsuranceManager insuranceManager);
public List<InsuranceManager> selectByIds(List<Long> ids);
/** /**
* 新增保险管理 * 新增保险管理
* *

View File

@ -45,6 +45,11 @@ public class InsuranceManagerServiceImpl implements IInsuranceManagerService
return insuranceManagerMapper.selectInsuranceManagerList(insuranceManager); return insuranceManagerMapper.selectInsuranceManagerList(insuranceManager);
} }
@Override
public List<InsuranceManager> selectByIds(List<Long> ids) {
return insuranceManagerMapper.selectByIds(ids);
}
/** /**
* 新增保险管理 * 新增保险管理
* *

View File

@ -89,4 +89,11 @@
</foreach> </foreach>
</delete> </delete>
<select id="selectByIds" resultMap="InsuranceManagerResult">
<include refid="selectInsuranceManagerVo"/>
where id in
<foreach collection="ids" item="name" open="(" separator="," close=")">
#{name}
</foreach>
</select>
</mapper> </mapper>