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

This commit is contained in:
kuang.yife 2024-09-25 18:16:49 +08:00
parent e398ad7e25
commit aac5ba8b20
19 changed files with 1175 additions and 18 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.constant.UserConstants; import com.ghy.common.constant.UserConstants;
import com.ghy.common.core.controller.BaseController; import com.ghy.common.core.controller.BaseController;
@ -7,16 +8,24 @@ import com.ghy.common.core.domain.AjaxResult;
import com.ghy.common.core.domain.Ztree; import com.ghy.common.core.domain.Ztree;
import com.ghy.common.enums.BusinessType; import com.ghy.common.enums.BusinessType;
import com.ghy.common.utils.ShiroUtils; import com.ghy.common.utils.ShiroUtils;
import com.ghy.common.utils.StringUtils;
import com.ghy.goods.domain.CategoryInsuranceRelation;
import com.ghy.goods.domain.GoodsCategory; import com.ghy.goods.domain.GoodsCategory;
import com.ghy.goods.domain.InsuranceManager;
import com.ghy.goods.service.GoodsCategoryService; import com.ghy.goods.service.GoodsCategoryService;
import com.ghy.goods.service.ICategoryInsuranceRelationService;
import com.ghy.goods.service.IInsuranceManagerService;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author HH 2022/3/19 * @author HH 2022/3/19
@ -30,6 +39,12 @@ public class GoodsCategoryController extends BaseController {
@Resource @Resource
private GoodsCategoryService goodsCategoryService; private GoodsCategoryService goodsCategoryService;
@Resource
private IInsuranceManagerService insuranceManagerService;
@Resource
private ICategoryInsuranceRelationService categoryInsuranceRelationService;
@RequiresPermissions("goods:category:view") @RequiresPermissions("goods:category:view")
@GetMapping() @GetMapping()
public String goodsCategory() { public String goodsCategory() {
@ -43,6 +58,7 @@ public class GoodsCategoryController extends BaseController {
@GetMapping("/add/{parentCategoryId}") @GetMapping("/add/{parentCategoryId}")
public String add(@PathVariable("parentCategoryId") Long parentCategoryId, ModelMap mmap) { public String add(@PathVariable("parentCategoryId") Long parentCategoryId, ModelMap mmap) {
mmap.put("goodsCategory", goodsCategoryService.selectById(parentCategoryId)); mmap.put("goodsCategory", goodsCategoryService.selectById(parentCategoryId));
mmap.put("insurances", insuranceManagerService.selectInsuranceManagerList(new InsuranceManager()));
return PREFIX + "/add"; return PREFIX + "/add";
} }
@ -50,7 +66,8 @@ public class GoodsCategoryController extends BaseController {
* 新增商品类别页面 * 新增商品类别页面
*/ */
@GetMapping("/add") @GetMapping("/add")
public String add() { public String add(ModelMap mmap) {
mmap.put("insurances", insuranceManagerService.selectInsuranceManagerList(new InsuranceManager()));
return PREFIX + "/add"; return PREFIX + "/add";
} }
@ -60,7 +77,21 @@ public class GoodsCategoryController extends BaseController {
@RequiresPermissions("goods:category:edit") @RequiresPermissions("goods:category:edit")
@GetMapping("/edit/{goodsId}") @GetMapping("/edit/{goodsId}")
public String edit(@PathVariable("goodsId") Long goodsId, ModelMap mmap) { public String edit(@PathVariable("goodsId") Long goodsId, ModelMap mmap) {
mmap.put("goodsCategory", goodsCategoryService.selectById(goodsId)); GoodsCategory goodsCategory = goodsCategoryService.selectById(goodsId);
mmap.put("goodsCategory", goodsCategory);
List<InsuranceManager> list = insuranceManagerService.selectInsuranceManagerList(new InsuranceManager());
CategoryInsuranceRelation param = new CategoryInsuranceRelation();
param.setGoodsCategoryId(goodsCategory.getGoodsCategoryId());
List<CategoryInsuranceRelation> relations = categoryInsuranceRelationService.selectCategoryInsuranceRelationList(param);
if(CollectionUtil.isNotEmpty(relations)){
Map<Long, List<CategoryInsuranceRelation>> map = relations.stream().collect(Collectors.groupingBy(CategoryInsuranceRelation::getInsuranceId));
list.forEach(model->{
if(map.containsKey(model.getId())){
model.setFlag(true);
}
});
}
mmap.put("insurances", list);
return PREFIX + "/edit"; return PREFIX + "/edit";
} }
@ -103,12 +134,10 @@ public class GoodsCategoryController extends BaseController {
@Log(title = "商品类别管理", businessType = BusinessType.UPDATE) @Log(title = "商品类别管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit") @PostMapping("/edit")
@ResponseBody @ResponseBody
@Transactional
public AjaxResult editSave(@Validated GoodsCategory category) { public AjaxResult editSave(@Validated GoodsCategory category) {
// if (goodsCategoryService.checkGoodsCategoryNameUnique(category)) { // 更新保险设置
// return error("新增商品类别'" + category.getGoodsCategoryName() + "'失败,商品类别名称已存在"); categoryInsuranceRelationService.updateCategoryInsuranceRelation(category.getInsuranceIds(), category.getGoodsCategoryId());
// } else if (goodsCategoryService.checkGoodsCategoryCodeUnique(category)) {
// return error("新增商品类别'" + category.getGoodsCategoryCode() + "'失败,商品类别编码已存在");
// }
category.setUpdateBy(getLoginName()); category.setUpdateBy(getLoginName());
return toAjax(goodsCategoryService.updateGoodsCategory(category)); return toAjax(goodsCategoryService.updateGoodsCategory(category));
} }

View File

@ -0,0 +1,135 @@
package com.ghy.web.controller.goods;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import com.ghy.common.annotation.Log;
import com.ghy.common.enums.BusinessType;
import com.ghy.goods.domain.InsuranceManager;
import com.ghy.goods.service.IInsuranceManagerService;
import com.ghy.common.core.controller.BaseController;
import com.ghy.common.core.domain.AjaxResult;
import com.ghy.common.utils.poi.ExcelUtil;
import com.ghy.common.core.page.TableDataInfo;
/**
* 保险管理Controller
*
* @author clunt
* @date 2024-09-25
*/
@Controller
@RequestMapping("/goods/manager")
public class InsuranceManagerController extends BaseController
{
private String prefix = "goods/manager";
@Autowired
private IInsuranceManagerService insuranceManagerService;
@RequiresPermissions("goods:manager:view")
@GetMapping()
public String manager()
{
return prefix + "/manager";
}
/**
* 查询保险管理列表
*/
@RequiresPermissions("goods:manager:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(InsuranceManager insuranceManager)
{
startPage();
List<InsuranceManager> list = insuranceManagerService.selectInsuranceManagerList(insuranceManager);
return getDataTable(list);
}
/**
* App查询保险管理列表
*/
@PostMapping("/app/list")
@ResponseBody
public TableDataInfo appList(@RequestBody InsuranceManager insuranceManager)
{
startPage();
List<InsuranceManager> list = insuranceManagerService.selectInsuranceManagerList(insuranceManager);
return getDataTable(list);
}
/**
* 导出保险管理列表
*/
@RequiresPermissions("goods:manager:export")
@Log(title = "保险管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(InsuranceManager insuranceManager)
{
List<InsuranceManager> list = insuranceManagerService.selectInsuranceManagerList(insuranceManager);
ExcelUtil<InsuranceManager> util = new ExcelUtil<InsuranceManager>(InsuranceManager.class);
return util.exportExcel(list, "保险管理数据");
}
/**
* 新增保险管理
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存保险管理
*/
@RequiresPermissions("goods:manager:add")
@Log(title = "保险管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(InsuranceManager insuranceManager)
{
return toAjax(insuranceManagerService.insertInsuranceManager(insuranceManager));
}
/**
* 修改保险管理
*/
@RequiresPermissions("goods:manager:edit")
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
InsuranceManager insuranceManager = insuranceManagerService.selectInsuranceManagerById(id);
mmap.put("insuranceManager", insuranceManager);
return prefix + "/edit";
}
/**
* 修改保存保险管理
*/
@RequiresPermissions("goods:manager:edit")
@Log(title = "保险管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(InsuranceManager insuranceManager)
{
return toAjax(insuranceManagerService.updateInsuranceManager(insuranceManager));
}
/**
* 删除保险管理
*/
@RequiresPermissions("goods:manager:remove")
@Log(title = "保险管理", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(insuranceManagerService.deleteInsuranceManagerByIds(ids));
}
}

View File

@ -46,6 +46,18 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<label class="col-xs-2 control-label">保险设定:</label>
<div class="col-xs-10">
<label th:each="insurance:${insurances}" class="check-box">
<input name="insurance" type="checkbox" th:value="${insurance.id}" th:text="${insurance.companyName}">
</label>
</div>
</div>
</div>
</div>
</form> </form>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />

View File

@ -17,15 +17,15 @@
<!-- </div>--> <!-- </div>-->
<!-- </div>--> <!-- </div>-->
<!-- </div>--> <!-- </div>-->
<div class="form-group"> <!-- <div class="form-group">-->
<label class="col-sm-3 control-label is-required">上级类目:</label> <!-- <label class="col-sm-3 control-label is-required">上级类目:</label>-->
<div class="col-sm-8"> <!-- <div class="col-sm-8">-->
<div class="input-group"> <!-- <div class="input-group">-->
<input class="form-control" type="text" onclick="selectDeptTree()" id="treeName" readonly="true" th:value="${goodsCategoryName}" required> <!-- <input class="form-control" type="text" onclick="selectDeptTree()" id="treeName" readonly="true" th:value="${goodsCategoryName}" required>-->
<span class="input-group-addon"><i class="fa fa-search"></i></span> <!-- <span class="input-group-addon"><i class="fa fa-search"></i></span>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
</div> <!-- </div>-->
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label is-required">类别名称:</label> <label class="col-sm-3 control-label is-required">类别名称:</label>
<div class="col-sm-8"> <div class="col-sm-8">
@ -62,6 +62,18 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<label class="col-xs-2 control-label">保险设定:</label>
<div class="col-xs-10">
<label th:each="insurance:${insurances}" class="check-box">
<input name="insurance" type="checkbox" th:value="${insurance.id}" th:text="${insurance.companyName}" th:checked="${insurance.flag}">
</label>
</div>
</div>
</div>
</div>
</form> </form>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
@ -103,7 +115,10 @@
function submitHandler() { function submitHandler() {
if ($.validate.form()) { if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-dept-edit').serialize()); var data = $("#form-dept-edit").serializeArray();
var insuranceIds = $.form.selectCheckeds("insurance");
data.push({"name": "insuranceIds", "value": insuranceIds});
$.operate.save(prefix + "/edit", data);
} }
} }

View File

@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增保险管理')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-manager-add">
<div class="form-group">
<label class="col-sm-3 control-label">保险公司名称:</label>
<div class="col-sm-8">
<input name="companyName" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">保险项目名称:</label>
<div class="col-sm-8">
<input name="insuranceName" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">保险费用:</label>
<div class="col-sm-8">
<input name="insuranceAmount" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">保险条例url</label>
<div class="col-sm-8">
<textarea name="insuranceUrl" class="form-control"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input name="remark" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "goods/manager"
$("#form-manager-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-manager-add').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改保险管理')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-manager-edit" th:object="${insuranceManager}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">保险公司名称:</label>
<div class="col-sm-8">
<input name="companyName" th:field="*{companyName}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">保险项目名称:</label>
<div class="col-sm-8">
<input name="insuranceName" th:field="*{insuranceName}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">保险费用:</label>
<div class="col-sm-8">
<input name="insuranceAmount" th:field="*{insuranceAmount}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">保险条例url</label>
<div class="col-sm-8">
<textarea name="insuranceUrl" class="form-control">[[*{insuranceUrl}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input name="remark" th:field="*{remark}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "goods/manager";
$("#form-manager-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-manager-edit').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,110 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('保险管理列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>保险公司名称:</label>
<input type="text" name="companyName"/>
</li>
<li>
<label>保险项目名称:</label>
<input type="text" name="insuranceName"/>
</li>
<li>
<label>保险费用:</label>
<input type="text" name="insuranceAmount"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="goods:manager:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="goods:manager:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="goods:manager:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="goods:manager:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('goods:manager:edit')}]];
var removeFlag = [[${@permission.hasPermi('goods:manager:remove')}]];
var prefix = ctx + "goods/manager";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "保险管理",
columns: [{
checkbox: true
},
{
field: 'id',
title: '主键',
visible: false
},
{
field: 'companyName',
title: '保险公司名称'
},
{
field: 'insuranceName',
title: '保险项目名称'
},
{
field: 'insuranceAmount',
title: '保险费用'
},
{
field: 'insuranceUrl',
title: '保险条例url'
},
{
field: 'remark',
title: '备注'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -0,0 +1,31 @@
package com.ghy.goods.domain;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.ghy.common.annotation.Excel;
import com.ghy.common.core.domain.BaseEntity;
/**
* 总类目保险关联关系对象 category_insurance_relation
*
* @author clunt
* @date 2024-09-25
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class CategoryInsuranceRelation extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 保险id */
@Excel(name = "保险id")
private Long insuranceId;
/** 总平台类目id */
@Excel(name = "总平台类目id")
private Long goodsCategoryId;
}

View File

@ -5,6 +5,8 @@ import com.ghy.common.annotation.Excel;
import com.ghy.common.core.domain.BaseEntity; import com.ghy.common.core.domain.BaseEntity;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
/** /**
* 商品类别表 * 商品类别表
* *
@ -39,5 +41,15 @@ public class GoodsCategory extends BaseEntity {
@Excel(name = "状态") @Excel(name = "状态")
private Integer status; private Integer status;
/**
* 保险状态 01.启用 02.禁用
* */
private String insuranceStatus;
private String insuranceUrl;
private BigDecimal insuranceAmount = BigDecimal.ZERO;
private String insuranceIds;
} }

View File

@ -0,0 +1,45 @@
package com.ghy.goods.domain;
import java.math.BigDecimal;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ghy.common.annotation.Excel;
import com.ghy.common.core.domain.BaseEntity;
/**
* 保险管理对象 insurance_manager
*
* @author clunt
* @date 2024-09-25
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class InsuranceManager extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 保险公司名称 */
@Excel(name = "保险公司名称")
private String companyName;
/** 保险项目名称 */
@Excel(name = "保险项目名称")
private String insuranceName;
/** 保险费用 */
@Excel(name = "保险费用")
private BigDecimal insuranceAmount;
/** 保险条例url */
@Excel(name = "保险条例url")
private String insuranceUrl;
private Boolean flag = false;
}

View File

@ -0,0 +1,61 @@
package com.ghy.goods.mapper;
import java.util.List;
import com.ghy.goods.domain.CategoryInsuranceRelation;
/**
* 总类目保险关联关系Mapper接口
*
* @author clunt
* @date 2024-09-25
*/
public interface CategoryInsuranceRelationMapper
{
/**
* 查询总类目保险关联关系
*
* @param id 总类目保险关联关系主键
* @return 总类目保险关联关系
*/
public CategoryInsuranceRelation selectCategoryInsuranceRelationById(Long id);
/**
* 查询总类目保险关联关系列表
*
* @param categoryInsuranceRelation 总类目保险关联关系
* @return 总类目保险关联关系集合
*/
public List<CategoryInsuranceRelation> selectCategoryInsuranceRelationList(CategoryInsuranceRelation categoryInsuranceRelation);
/**
* 新增总类目保险关联关系
*
* @param categoryInsuranceRelation 总类目保险关联关系
* @return 结果
*/
public int insertCategoryInsuranceRelation(CategoryInsuranceRelation categoryInsuranceRelation);
/**
* 修改总类目保险关联关系
*
* @param categoryInsuranceRelation 总类目保险关联关系
* @return 结果
*/
public int updateCategoryInsuranceRelation(CategoryInsuranceRelation categoryInsuranceRelation);
/**
* 删除总类目保险关联关系
*
* @param id 总类目保险关联关系主键
* @return 结果
*/
public int deleteCategoryInsuranceRelationById(Long id);
/**
* 批量删除总类目保险关联关系
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteCategoryInsuranceRelationByIds(String[] ids);
}

View File

@ -0,0 +1,60 @@
package com.ghy.goods.mapper;
import java.util.List;
import com.ghy.goods.domain.InsuranceManager;
/**
* 保险管理Mapper接口
*
* @author clunt
* @date 2024-09-25
*/
public interface InsuranceManagerMapper
{
/**
* 查询保险管理
*
* @param id 保险管理主键
* @return 保险管理
*/
public InsuranceManager selectInsuranceManagerById(Long id);
/**
* 查询保险管理列表
*
* @param insuranceManager 保险管理
* @return 保险管理集合
*/
public List<InsuranceManager> selectInsuranceManagerList(InsuranceManager insuranceManager);
/**
* 新增保险管理
*
* @param insuranceManager 保险管理
* @return 结果
*/
public int insertInsuranceManager(InsuranceManager insuranceManager);
/**
* 修改保险管理
*
* @param insuranceManager 保险管理
* @return 结果
*/
public int updateInsuranceManager(InsuranceManager insuranceManager);
/**
* 删除保险管理
*
* @param id 保险管理主键
* @return 结果
*/
public int deleteInsuranceManagerById(Long id);
/**
* 批量删除保险管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteInsuranceManagerByIds(String[] ids);
}

View File

@ -0,0 +1,64 @@
package com.ghy.goods.service;
import java.util.List;
import com.ghy.goods.domain.CategoryInsuranceRelation;
/**
* 总类目保险关联关系Service接口
*
* @author clunt
* @date 2024-09-25
*/
public interface ICategoryInsuranceRelationService
{
/**
* 查询总类目保险关联关系
*
* @param id 总类目保险关联关系主键
* @return 总类目保险关联关系
*/
public CategoryInsuranceRelation selectCategoryInsuranceRelationById(Long id);
/**
* 查询总类目保险关联关系列表
*
* @param categoryInsuranceRelation 总类目保险关联关系
* @return 总类目保险关联关系集合
*/
public List<CategoryInsuranceRelation> selectCategoryInsuranceRelationList(CategoryInsuranceRelation categoryInsuranceRelation);
/**
* 新增总类目保险关联关系
*
* @param categoryInsuranceRelation 总类目保险关联关系
* @return 结果
*/
public int insertCategoryInsuranceRelation(CategoryInsuranceRelation categoryInsuranceRelation);
/**
* 修改总类目保险关联关系
*
* @param categoryInsuranceRelation 总类目保险关联关系
* @return 结果
*/
public int updateCategoryInsuranceRelation(CategoryInsuranceRelation categoryInsuranceRelation);
/**
* 批量删除总类目保险关联关系
*
* @param ids 需要删除的总类目保险关联关系主键集合
* @return 结果
*/
public int deleteCategoryInsuranceRelationByIds(String ids);
/**
* 删除总类目保险关联关系信息
*
* @param id 总类目保险关联关系主键
* @return 结果
*/
public int deleteCategoryInsuranceRelationById(Long id);
void updateCategoryInsuranceRelation(String insuranceIds, Long categoryId);
}

View File

@ -0,0 +1,61 @@
package com.ghy.goods.service;
import java.util.List;
import com.ghy.goods.domain.InsuranceManager;
/**
* 保险管理Service接口
*
* @author clunt
* @date 2024-09-25
*/
public interface IInsuranceManagerService
{
/**
* 查询保险管理
*
* @param id 保险管理主键
* @return 保险管理
*/
public InsuranceManager selectInsuranceManagerById(Long id);
/**
* 查询保险管理列表
*
* @param insuranceManager 保险管理
* @return 保险管理集合
*/
public List<InsuranceManager> selectInsuranceManagerList(InsuranceManager insuranceManager);
/**
* 新增保险管理
*
* @param insuranceManager 保险管理
* @return 结果
*/
public int insertInsuranceManager(InsuranceManager insuranceManager);
/**
* 修改保险管理
*
* @param insuranceManager 保险管理
* @return 结果
*/
public int updateInsuranceManager(InsuranceManager insuranceManager);
/**
* 批量删除保险管理
*
* @param ids 需要删除的保险管理主键集合
* @return 结果
*/
public int deleteInsuranceManagerByIds(String ids);
/**
* 删除保险管理信息
*
* @param id 保险管理主键
* @return 结果
*/
public int deleteInsuranceManagerById(Long id);
}

View File

@ -0,0 +1,127 @@
package com.ghy.goods.service.impl;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollectionUtil;
import com.ghy.common.utils.DateUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ghy.goods.mapper.CategoryInsuranceRelationMapper;
import com.ghy.goods.domain.CategoryInsuranceRelation;
import com.ghy.goods.service.ICategoryInsuranceRelationService;
import com.ghy.common.core.text.Convert;
/**
* 总类目保险关联关系Service业务层处理
*
* @author clunt
* @date 2024-09-25
*/
@Service
public class CategoryInsuranceRelationServiceImpl implements ICategoryInsuranceRelationService
{
@Autowired
private CategoryInsuranceRelationMapper categoryInsuranceRelationMapper;
/**
* 查询总类目保险关联关系
*
* @param id 总类目保险关联关系主键
* @return 总类目保险关联关系
*/
@Override
public CategoryInsuranceRelation selectCategoryInsuranceRelationById(Long id)
{
return categoryInsuranceRelationMapper.selectCategoryInsuranceRelationById(id);
}
/**
* 查询总类目保险关联关系列表
*
* @param categoryInsuranceRelation 总类目保险关联关系
* @return 总类目保险关联关系
*/
@Override
public List<CategoryInsuranceRelation> selectCategoryInsuranceRelationList(CategoryInsuranceRelation categoryInsuranceRelation)
{
return categoryInsuranceRelationMapper.selectCategoryInsuranceRelationList(categoryInsuranceRelation);
}
/**
* 新增总类目保险关联关系
*
* @param categoryInsuranceRelation 总类目保险关联关系
* @return 结果
*/
@Override
public int insertCategoryInsuranceRelation(CategoryInsuranceRelation categoryInsuranceRelation)
{
categoryInsuranceRelation.setCreateTime(DateUtils.getNowDate());
return categoryInsuranceRelationMapper.insertCategoryInsuranceRelation(categoryInsuranceRelation);
}
/**
* 修改总类目保险关联关系
*
* @param categoryInsuranceRelation 总类目保险关联关系
* @return 结果
*/
@Override
public int updateCategoryInsuranceRelation(CategoryInsuranceRelation categoryInsuranceRelation)
{
categoryInsuranceRelation.setUpdateTime(DateUtils.getNowDate());
return categoryInsuranceRelationMapper.updateCategoryInsuranceRelation(categoryInsuranceRelation);
}
/**
* 批量删除总类目保险关联关系
*
* @param ids 需要删除的总类目保险关联关系主键
* @return 结果
*/
@Override
public int deleteCategoryInsuranceRelationByIds(String ids)
{
return categoryInsuranceRelationMapper.deleteCategoryInsuranceRelationByIds(Convert.toStrArray(ids));
}
/**
* 删除总类目保险关联关系信息
*
* @param id 总类目保险关联关系主键
* @return 结果
*/
@Override
public int deleteCategoryInsuranceRelationById(Long id)
{
return categoryInsuranceRelationMapper.deleteCategoryInsuranceRelationById(id);
}
@Override
public void updateCategoryInsuranceRelation(String insuranceIds, Long categoryId) {
CategoryInsuranceRelation param = new CategoryInsuranceRelation();
param.setGoodsCategoryId(categoryId);
List<CategoryInsuranceRelation> oldRecord = categoryInsuranceRelationMapper.selectCategoryInsuranceRelationList(param);
// 删除历史记录
if(CollectionUtil.isNotEmpty(oldRecord)){
String [] arr = new String[oldRecord.size()];
for (int index = 0; index < oldRecord.size(); index ++){
arr[index] = oldRecord.get(index).getId().toString();
}
categoryInsuranceRelationMapper.deleteCategoryInsuranceRelationByIds(arr);
}
// 增加新记录
if(StringUtils.isNotEmpty(insuranceIds)){
String [] insuranceStr = insuranceIds.split(",");
for (String str : insuranceStr) {
CategoryInsuranceRelation model = new CategoryInsuranceRelation();
model.setInsuranceId(Long.valueOf(str));
model.setGoodsCategoryId(categoryId);
categoryInsuranceRelationMapper.insertCategoryInsuranceRelation(model);
}
}
}
}

View File

@ -0,0 +1,97 @@
package com.ghy.goods.service.impl;
import java.util.List;
import com.ghy.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ghy.goods.mapper.InsuranceManagerMapper;
import com.ghy.goods.domain.InsuranceManager;
import com.ghy.goods.service.IInsuranceManagerService;
import com.ghy.common.core.text.Convert;
/**
* 保险管理Service业务层处理
*
* @author clunt
* @date 2024-09-25
*/
@Service
public class InsuranceManagerServiceImpl implements IInsuranceManagerService
{
@Autowired
private InsuranceManagerMapper insuranceManagerMapper;
/**
* 查询保险管理
*
* @param id 保险管理主键
* @return 保险管理
*/
@Override
public InsuranceManager selectInsuranceManagerById(Long id)
{
return insuranceManagerMapper.selectInsuranceManagerById(id);
}
/**
* 查询保险管理列表
*
* @param insuranceManager 保险管理
* @return 保险管理
*/
@Override
public List<InsuranceManager> selectInsuranceManagerList(InsuranceManager insuranceManager)
{
return insuranceManagerMapper.selectInsuranceManagerList(insuranceManager);
}
/**
* 新增保险管理
*
* @param insuranceManager 保险管理
* @return 结果
*/
@Override
public int insertInsuranceManager(InsuranceManager insuranceManager)
{
insuranceManager.setCreateTime(DateUtils.getNowDate());
return insuranceManagerMapper.insertInsuranceManager(insuranceManager);
}
/**
* 修改保险管理
*
* @param insuranceManager 保险管理
* @return 结果
*/
@Override
public int updateInsuranceManager(InsuranceManager insuranceManager)
{
insuranceManager.setUpdateTime(DateUtils.getNowDate());
return insuranceManagerMapper.updateInsuranceManager(insuranceManager);
}
/**
* 批量删除保险管理
*
* @param ids 需要删除的保险管理主键
* @return 结果
*/
@Override
public int deleteInsuranceManagerByIds(String ids)
{
return insuranceManagerMapper.deleteInsuranceManagerByIds(Convert.toStrArray(ids));
}
/**
* 删除保险管理信息
*
* @param id 保险管理主键
* @return 结果
*/
@Override
public int deleteInsuranceManagerById(Long id)
{
return insuranceManagerMapper.deleteInsuranceManagerById(id);
}
}

View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ghy.goods.mapper.CategoryInsuranceRelationMapper">
<resultMap type="CategoryInsuranceRelation" id="CategoryInsuranceRelationResult">
<result property="id" column="id" />
<result property="insuranceId" column="insurance_id" />
<result property="goodsCategoryId" column="goods_category_id" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectCategoryInsuranceRelationVo">
select id, insurance_id, goods_category_id, create_by, update_by, create_time, update_time, remark from category_insurance_relation
</sql>
<select id="selectCategoryInsuranceRelationList" parameterType="CategoryInsuranceRelation" resultMap="CategoryInsuranceRelationResult">
<include refid="selectCategoryInsuranceRelationVo"/>
<where>
<if test="insuranceId != null "> and insurance_id = #{insuranceId}</if>
<if test="goodsCategoryId != null "> and goods_category_id = #{goodsCategoryId}</if>
</where>
</select>
<select id="selectCategoryInsuranceRelationById" parameterType="Long" resultMap="CategoryInsuranceRelationResult">
<include refid="selectCategoryInsuranceRelationVo"/>
where id = #{id}
</select>
<insert id="insertCategoryInsuranceRelation" parameterType="CategoryInsuranceRelation" useGeneratedKeys="true" keyProperty="id">
insert into category_insurance_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="insuranceId != null">insurance_id,</if>
<if test="goodsCategoryId != null">goods_category_id,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="insuranceId != null">#{insuranceId},</if>
<if test="goodsCategoryId != null">#{goodsCategoryId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateCategoryInsuranceRelation" parameterType="CategoryInsuranceRelation">
update category_insurance_relation
<trim prefix="SET" suffixOverrides=",">
<if test="insuranceId != null">insurance_id = #{insuranceId},</if>
<if test="goodsCategoryId != null">goods_category_id = #{goodsCategoryId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCategoryInsuranceRelationById" parameterType="Long">
delete from category_insurance_relation where id = #{id}
</delete>
<delete id="deleteCategoryInsuranceRelationByIds" parameterType="String">
delete from category_insurance_relation where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -16,11 +16,15 @@
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="insuranceStatus" column="insurance_status" />
<result property="insuranceUrl" column="insurance_url" />
<result property="insuranceAmount" column="insurance_amount" />
</resultMap> </resultMap>
<sql id="selectGoodsCategory"> <sql id="selectGoodsCategory">
SELECT goods_category_id, goods_category_code, goods_category_name, parent_category_id, SELECT goods_category_id, goods_category_code, goods_category_name, parent_category_id,
level, type, status, create_by, create_time, remark, category_sort level, type, status, create_by, create_time, remark, category_sort, insurance_status
, insurance_amount, insurance_url
FROM goods_category FROM goods_category
</sql> </sql>
@ -61,6 +65,9 @@
<if test="level != null and level != ''">level = #{level},</if> <if test="level != null and level != ''">level = #{level},</if>
<if test="type != null and type != ''">type = #{type},</if> <if test="type != null and type != ''">type = #{type},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="insuranceStatus != null">insurance_status = #{insuranceStatus},</if>
<if test="insuranceAmount != null">insurance_amount = #{insuranceAmount},</if>
<if test="insuranceUrl != null">insurance_url = #{insuranceUrl},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate() update_time = sysdate()
</set> </set>
@ -85,6 +92,9 @@
<if test="level != null and level != ''">level,</if> <if test="level != null and level != ''">level,</if>
<if test="type != null and type != ''">type,</if> <if test="type != null and type != ''">type,</if>
<if test="remark != null and remark != ''">remark,</if> <if test="remark != null and remark != ''">remark,</if>
<if test="insuranceStatus != null and insuranceStatus != ''">insurance_status,</if>
<if test="insuranceUrl != null and insuranceUrl != ''">insurance_url,</if>
<if test="insuranceAmount != null and insuranceAmount != ''">insurance_amount,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
create_time create_time
)values( )values(
@ -96,6 +106,9 @@
<if test="level != null and level != ''">#{level},</if> <if test="level != null and level != ''">#{level},</if>
<if test="type != null and type != ''">#{type},</if> <if test="type != null and type != ''">#{type},</if>
<if test="remark != null and remark != ''">#{remark},</if> <if test="remark != null and remark != ''">#{remark},</if>
<if test="insuranceStatus != null and insuranceStatus != ''">#{insuranceStatus},</if>
<if test="insuranceUrl != null and insuranceUrl != ''">#{insuranceUrl},</if>
<if test="insuranceAmount != null and insuranceAmount != ''">#{insuranceAmount},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate() sysdate()
) )

View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ghy.goods.mapper.InsuranceManagerMapper">
<resultMap type="InsuranceManager" id="InsuranceManagerResult">
<result property="id" column="id" />
<result property="companyName" column="company_name" />
<result property="insuranceName" column="insurance_name" />
<result property="insuranceAmount" column="insurance_amount" />
<result property="insuranceUrl" column="insurance_url" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectInsuranceManagerVo">
select id, company_name, insurance_name, insurance_amount, insurance_url, create_by, update_by, create_time, update_time, remark from insurance_manager
</sql>
<select id="selectInsuranceManagerList" parameterType="InsuranceManager" resultMap="InsuranceManagerResult">
<include refid="selectInsuranceManagerVo"/>
<where>
<if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
<if test="insuranceName != null and insuranceName != ''"> and insurance_name like concat('%', #{insuranceName}, '%')</if>
<if test="insuranceAmount != null "> and insurance_amount = #{insuranceAmount}</if>
<if test="insuranceUrl != null and insuranceUrl != ''"> and insurance_url = #{insuranceUrl}</if>
</where>
</select>
<select id="selectInsuranceManagerById" parameterType="Long" resultMap="InsuranceManagerResult">
<include refid="selectInsuranceManagerVo"/>
where id = #{id}
</select>
<insert id="insertInsuranceManager" parameterType="InsuranceManager" useGeneratedKeys="true" keyProperty="id">
insert into insurance_manager
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="companyName != null">company_name,</if>
<if test="insuranceName != null">insurance_name,</if>
<if test="insuranceAmount != null">insurance_amount,</if>
<if test="insuranceUrl != null">insurance_url,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="companyName != null">#{companyName},</if>
<if test="insuranceName != null">#{insuranceName},</if>
<if test="insuranceAmount != null">#{insuranceAmount},</if>
<if test="insuranceUrl != null">#{insuranceUrl},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateInsuranceManager" parameterType="InsuranceManager">
update insurance_manager
<trim prefix="SET" suffixOverrides=",">
<if test="companyName != null">company_name = #{companyName},</if>
<if test="insuranceName != null">insurance_name = #{insuranceName},</if>
<if test="insuranceAmount != null">insurance_amount = #{insuranceAmount},</if>
<if test="insuranceUrl != null">insurance_url = #{insuranceUrl},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteInsuranceManagerById" parameterType="Long">
delete from insurance_manager where id = #{id}
</delete>
<delete id="deleteInsuranceManagerByIds" parameterType="String">
delete from insurance_manager where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>