Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	gateway/src/main/resources/application.yml
dongxin před 1 rokem
rodič
revize
b9b512a25e

+ 14 - 18
commons/src/main/java/com/jzg/commons/entity/dto/JyxConfigAdd.java

@@ -4,64 +4,60 @@ package com.jzg.commons.entity.dto;
 import com.jzg.commons.entity.po.JyxBlame;
 import com.jzg.commons.entity.po.jyxSetting;
 import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotEmpty;
 import jakarta.validation.constraints.NotNull;
 import lombok.Data;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 @Data
 @Schema(description = "驾意险配置")
 public class JyxConfigAdd {
 
-    @Schema(description = "产品类型")
-    @NotNull(message = "产品类型不能为空")
+    @Schema(description = "产品类型1-主险;2-附加险")
+    @NotBlank(message = "产品类型不能为空")
     private String productType;
 
     @Schema(description = "上级产品")
-    @NotNull(message = "上级产品不能为空")
     private String parentId;
 
     @Schema(description = " 产品名称")
-    @NotNull(message = "产品名称不能为空")
+    @NotBlank(message = "产品名称不能为空")
     private String productName;
 
     @Schema(description = "别名")
-    @NotNull(message = "别名不能为空")
     private String alias;
 
     @Schema(description = "保险公司")
-    @NotNull(message = "保险公司不能为空")
+    @NotBlank(message = "保险公司不能为空")
     private String company;
 
     @Schema(description = "产品编码")
-    @NotNull(message = "产品编码不能为空")
+    //@NotBlank(message = "产品编码不能为空")
     private String productCode;
 
     @Schema(description = "对接方式")
-    @NotNull(message = "对接方式不能为空")
+    @NotBlank(message = "对接方式不能为空")
     private String connectionMethod;
 
     @Schema(description = "保费设置")
-    @NotNull(message = "保费设置不能为空")
-    private String premiumSetting;
+    private int premiumSetting;
 
     @Schema(description = "总保额")
-    @NotNull(message = "总保额不能为空")
-    private  String coverage;
+    private BigDecimal coverage;
 
     @Schema(description = "总保费")
-    @NotNull(message = "总保费不能为空")
-    private String premium;
+    private BigDecimal premium;
 
-    @Schema(description = "租户编码")
-    private String systemCode;
 
     @Schema(description = "保险责任")
-    @NotNull(message = "保险责任不能为空")
+    //@NotEmpty(message = "保险责任不能为空")
     private List<JyxBlame> blameList;
 
     @Schema(description = "驾意险保费设置")
-    @NotNull(message = "驾意险保费设置不能为空")
+    //@NotEmpty(message = "驾意险保费设置不能为空")
     private List<jyxSetting> settingList;
 
 }

+ 0 - 4
commons/src/main/java/com/jzg/commons/entity/dto/JyxConfigEnd.java

@@ -21,7 +21,6 @@ public class JyxConfigEnd {
     private String productType;
 
     @Schema(description = "上级产品")
-    @NotNull(message = "上级产品不能为空")
     private String parentId;
 
     @Schema(description = " 产品名称")
@@ -29,7 +28,6 @@ public class JyxConfigEnd {
     private String productName;
 
     @Schema(description = "别名")
-    @NotNull(message = "别名不能为空")
     private String alias;
 
     @Schema(description = "保险公司")
@@ -60,11 +58,9 @@ public class JyxConfigEnd {
     private String systemCode;
 
     @Schema(description = "保险责任")
-    @NotNull(message = "保险责任不能为空")
     private List<JyxBlame> blameList;
 
     @Schema(description = "驾意险保费设置")
-    @NotNull(message = "驾意险保费设置不能为空")
     private List<jyxSetting> settingList;
 
 }

+ 5 - 0
commons/src/main/java/com/jzg/commons/entity/dto/JyxConfigParam.java

@@ -12,7 +12,12 @@ public class JyxConfigParam extends PageRequest {
     @Schema(description = "查询参数 输入产品名称,别名查找")
     private String params;
 
+    @Schema(description = "查询参数 保险公司")
+    private String company;
+
     @Schema(description = "查询参数 输入座位数")
     private String seats;
 
+    private String parentId;
+
 }

+ 4 - 0
commons/src/main/java/com/jzg/commons/entity/po/JyxBlame.java

@@ -18,12 +18,16 @@ public class JyxBlame extends BaseModel {
 
     private String jyxConfigId;
 
+    @Schema(description = "保险责任")
     private String blame;
 
+    @Schema(description = "责任编码")
     private String blameCode;
 
+    @Schema(description = "责任保额")
     private BigDecimal blameCoverage;
 
+    @Schema(description = "责任保费")
     private BigDecimal blamePremium;
 
     private String systemCode;

+ 6 - 4
commons/src/main/java/com/jzg/commons/entity/po/JyxConfig.java

@@ -7,6 +7,8 @@ import com.jzg.commons.core.base.BaseModel;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
+import java.math.BigDecimal;
+
 @Data
 @Schema(description = "驾意险配置")
 public class JyxConfig extends BaseModel {
@@ -14,7 +16,7 @@ public class JyxConfig extends BaseModel {
     @TableId(type = IdType.ASSIGN_ID)
     private String id;
 
-    private String productType;
+    private int productType;
 
     private String parentId;
 
@@ -28,11 +30,11 @@ public class JyxConfig extends BaseModel {
 
     private String connectionMethod;
 
-    private String premiumSetting;
+    private int premiumSetting;
 
-    private  String coverage;
+    private BigDecimal coverage;
 
-    private String premium;
+    private BigDecimal premium;
 
     private String systemCode;
 

+ 3 - 1
commons/src/main/java/com/jzg/commons/entity/po/jyxSetting.java

@@ -17,11 +17,13 @@ public class jyxSetting extends BaseModel {
     private String id;
 
     private String jyxConfigId;
-
+    @Schema(description = "座位数")
     private int seats;
 
+    @Schema(description = "保额")
     private BigDecimal coverage;
 
+    @Schema(description = "保费")
     private BigDecimal premium;
 
     private String systemCode;

+ 3 - 0
commons/src/main/java/com/jzg/commons/entity/vo/EsmInsCompanyReq.java

@@ -18,6 +18,9 @@ public class EsmInsCompanyReq implements Serializable {
     @Schema(description = "供应商类型")
     private String type;
 
+    @Schema(description = "parentId")
+    private String parentId;
+
 }
 
 

+ 6 - 1
commons/src/main/java/com/jzg/commons/entity/vo/JyxConfigVo.java

@@ -12,7 +12,7 @@ import java.util.List;
 public class JyxConfigVo {
 
     @Schema(description = "ID")
-    private Long id;
+    private String id;
 
     @Schema(description = "产品类型")
     private String productType;
@@ -44,9 +44,14 @@ public class JyxConfigVo {
     @Schema(description = "总保费")
     private String premium;
 
+    private int isDelete;
+
     @Schema(description = "租户编码")
     private String systemCode;
 
+    @Schema(description = "子集")
+    private List<JyxConfigVo> children;
+
     @Schema(description = "保险责任")
     private List<JyxBlame> blameList;
 

+ 20 - 0
commons/src/main/java/com/jzg/commons/exception/GlobalExceptionHandler.java

@@ -1,6 +1,10 @@
 package com.jzg.commons.exception;
 
+import cn.hutool.core.util.StrUtil;
 import com.jzg.commons.core.page.HttpResult;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.validation.ConstraintViolation;
+import jakarta.validation.ConstraintViolationException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.dao.DuplicateKeyException;
@@ -13,6 +17,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
 
 import java.sql.SQLIntegrityConstraintViolationException;
 import java.util.List;
+import java.util.Set;
 
 @ControllerAdvice
 public class GlobalExceptionHandler {
@@ -66,5 +71,20 @@ public class GlobalExceptionHandler {
     public HttpResult sqlExceptionHandle(SQLIntegrityConstraintViolationException sqlException) {
         return HttpResult.error("违反唯一约束:" + sqlException.getMessage().substring(0, sqlException.getMessage().indexOf("for key")));
     }
+
+
+    @ExceptionHandler(ConstraintViolationException.class)
+    @ResponseBody
+    public HttpResult exceptionHandler(HttpServletRequest httpServletRequest, ConstraintViolationException e) {
+        LOGGER.error("{}, 发生异常: {}", httpServletRequest.getRequestURI(), e);
+        StringBuilder sb = new StringBuilder();
+        e.getConstraintViolations().forEach(constraintViolation -> {
+            sb.append( constraintViolation.getMessageTemplate());
+        });
+        return HttpResult.error(sb.toString().trim());
+    }
+
+
+
 }
 

+ 1 - 1
gateway/src/main/resources/application.yml

@@ -16,7 +16,7 @@ spring:
         - id: platform_route
           uri: http://localhost:8083/
           predicates:
-            - Path=/userRole/**,/system/**,/file/**,/user/**,/esmInsCompany/**,/sysDept/**
+            - Path=/userRole/**,/system/**,/file/**,/user/**,/esmInsCompany/**,/jyxConfig/**,/sysDept/**
 
         - id: tenant_route
           uri: http://localhost:8084/

+ 7 - 0
platform/src/main/java/com/jzg/constants/ConstantsParent.java

@@ -0,0 +1,7 @@
+package com.jzg.constants;
+
+public class ConstantsParent {
+
+    public static final String PARENT_ID_ROOT = "0";
+
+}

+ 17 - 0
platform/src/main/java/com/jzg/controller/EsmInsCompanyController.java

@@ -49,6 +49,23 @@ public class EsmInsCompanyController extends BaseController {
         return HttpResult.ok(list);
     }
 
+    /**
+     * 查询下级保险公司(列表)
+     *
+     * @param req
+     * @return
+     */
+    @Operation(summary = "查询下级保险公司(列表)")
+    @PostMapping(value = "/selectLevelList")
+    public HttpResult<List<EsmInsCompanyVo>> selectLevelList(@RequestBody EsmInsCompanyReq req) {
+        LambdaQueryWrapper<EsmInsCompany> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        lambdaQueryWrapper.eq(EsmInsCompany::getParentId, "0");
+        lambdaQueryWrapper.eq(EsmInsCompany::getIsDelete, 0);
+        lambdaQueryWrapper.like(StringUtils.isNotEmpty(req.getName()),EsmInsCompany::getName, req.getName());
+        List<EsmInsCompany> selectList = esmInsCompanyService.list(lambdaQueryWrapper);
+        List<EsmInsCompanyVo> esmInsCompanyVos = BeanUtil.copyToList(selectList, EsmInsCompanyVo.class);
+        return HttpResult.ok(esmInsCompanyVos);
+    }
 
     @PostMapping("/findLeftInsTree")
     @Operation(summary = "查询左侧树")

+ 13 - 15
platform/src/main/java/com/jzg/controller/JyxConfigController.java

@@ -1,6 +1,7 @@
 package com.jzg.controller;
 
 
+import com.jzg.commons.core.base.BaseController;
 import com.jzg.commons.core.page.HttpResult;
 import com.jzg.commons.entity.dto.JyxConfigAdd;
 import com.jzg.commons.entity.dto.JyxConfigEnd;
@@ -8,16 +9,18 @@ import com.jzg.commons.entity.dto.JyxConfigParam;
 import com.jzg.service.JyxConfigService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotBlank;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.concurrent.TimeUnit;
 
+@Validated
 @Tag(name="驾意险配置")
 @RestController
 @RequestMapping("/jyxConfig")
-public class JyxConfigController {
+public class JyxConfigController extends BaseController {
 
 
     @Autowired
@@ -25,20 +28,15 @@ public class JyxConfigController {
 
     @PostMapping("saveAll")
     @Operation(summary = "保存驾意险配置")
-    public HttpResult saveAll(@Validated @RequestBody JyxConfigAdd configAdd){
+    public HttpResult saveAll(@Valid @RequestBody JyxConfigAdd configAdd){
         return jyxConfigService.saveAll(configAdd);
     }
 
-    @GetMapping("/print")
-    public String print() {
-        System.out.println(Thread.currentThread());
-        return "ok";
-    }
 
-    @GetMapping("/demo")
-    public String demo() throws InterruptedException {
-        TimeUnit.SECONDS.sleep(2);
-        return "ok";
+    @GetMapping("selectMainInsurance")
+    @Operation(summary = "查询主险")
+    public HttpResult selectMainInsurance(@NotBlank(message = "保险公司不能为空") @RequestParam String company){
+        return HttpResult.ok(jyxConfigService.selectMainInsurance(company));
     }
 
 
@@ -51,14 +49,14 @@ public class JyxConfigController {
 
     @GetMapping("getById")
     @Operation(summary = "根据id查询驾意险配置")
-    public HttpResult getById(@RequestParam Long id){
+    public HttpResult getById(@NotBlank(message = "id不能为空") @RequestParam String id){
         return jyxConfigService.selectById(id);
     }
 
 
     @PostMapping("updateById")
     @Operation(summary = "根据id修改驾意险配置")
-    public HttpResult updateById(@RequestBody JyxConfigEnd configEnd){
+    public HttpResult updateById(@Valid @RequestBody JyxConfigEnd configEnd){
         return jyxConfigService.updateById(configEnd);
     }
 
@@ -66,7 +64,7 @@ public class JyxConfigController {
 
     @GetMapping("deleteById")
     @Operation(summary = "根据id删除驾意险配置")
-    public HttpResult deleteById(@RequestParam String id){
+    public HttpResult deleteById(@NotBlank(message = "id不能为空") @RequestParam String id){
         return jyxConfigService.deleteById(id);
     }
 

+ 6 - 1
platform/src/main/java/com/jzg/mapper/JyxConfigMapper.java

@@ -7,13 +7,18 @@ import com.jzg.commons.entity.po.JyxConfig;
 import com.jzg.commons.entity.vo.JyxConfigVo;
 import org.apache.ibatis.annotations.*;
 
+import java.util.ArrayList;
 import java.util.List;
 
 @Mapper
 public interface JyxConfigMapper extends BaseMapper<JyxConfig> {
 
 
-    List<JyxConfigVo> jyxList(JyxConfigParam configParam);
+    List<JyxConfigVo> jyxList(JyxConfigParam configParam );
 
+    List<JyxConfigVo> selectIds(@Param("ids") List<String> ids);
 
+    List<JyxConfigVo> selectMainInsurance(String company);
+
+    List<JyxConfigVo> selectParentIds(@Param("ids") List<String> ids);
 }

+ 4 - 1
platform/src/main/java/com/jzg/service/JyxConfigService.java

@@ -7,6 +7,7 @@ import com.jzg.commons.entity.dto.JyxConfigEnd;
 import com.jzg.commons.entity.dto.JyxConfigParam;
 import com.jzg.commons.entity.po.JyxConfig;
 import com.jzg.commons.entity.vo.JyxConfigVo;
+import jakarta.validation.constraints.NotBlank;
 
 import java.util.List;
 
@@ -15,7 +16,7 @@ public interface JyxConfigService extends IService<JyxConfig> {
 
     HttpResult saveAll(JyxConfigAdd configAdd);
 
-    HttpResult selectById(Long id);
+    HttpResult selectById(String id);
 
     HttpResult updateById(JyxConfigEnd configEnd);
 
@@ -23,4 +24,6 @@ public interface JyxConfigService extends IService<JyxConfig> {
 
     HttpResult deleteById(String id);
 
+    List<JyxConfigVo> selectMainInsurance(@NotBlank(message = "不能为空") String company);
+
 }

+ 84 - 23
platform/src/main/java/com/jzg/service/impl/JyxConfigServiceImpl.java

@@ -1,6 +1,7 @@
 package com.jzg.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.jzg.commons.core.page.HttpResult;
 import com.jzg.commons.entity.dto.JyxConfigAdd;
@@ -10,6 +11,9 @@ import com.jzg.commons.entity.po.JyxBlame;
 import com.jzg.commons.entity.po.JyxConfig;
 import com.jzg.commons.entity.po.jyxSetting;
 import com.jzg.commons.entity.vo.JyxConfigVo;
+import com.jzg.commons.util.ConvertUtils;
+import com.jzg.commons.util.StringUtils;
+import com.jzg.constants.ConstantsParent;
 import com.jzg.mapper.JyxConfigMapper;
 import com.jzg.service.JyxBlameService;
 import com.jzg.service.JyxConfigService;
@@ -18,8 +22,14 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
+import org.springframework.util.ObjectUtils;
 
-import java.util.List;
+import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+import static java.util.stream.Collectors.collectingAndThen;
+import static java.util.stream.Collectors.toCollection;
 
 
 @Service
@@ -35,20 +45,18 @@ public class JyxConfigServiceImpl extends ServiceImpl<JyxConfigMapper, JyxConfig
     private JyxBlameService blameService;
 
 
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public HttpResult saveAll(JyxConfigAdd configAdd) {
         try {
-            List<JyxBlame> blameList = configAdd.getBlameList();
-            if (CollectionUtils.isEmpty(blameList)){
-                return HttpResult.error("请添加保险责任");
-            }
-            List<jyxSetting> settingList = configAdd.getSettingList();
-            if (CollectionUtils.isEmpty(settingList)){
-                return HttpResult.error("请添加保费设置");
+            if (StringUtils.isEmpty(configAdd.getParentId())){
+                configAdd.setParentId("0");
             }
             JyxConfig jyxConfig = BeanUtil.copyProperties(configAdd, JyxConfig.class);
             int insert = jyxConfigMapper.insert(jyxConfig);
+            List<JyxBlame> blameList = configAdd.getBlameList();
+            List<jyxSetting> settingList = configAdd.getSettingList();
             blameList.stream().forEach(blame -> {
                 blame.setJyxConfigId(jyxConfig.getId());
             });
@@ -64,7 +72,7 @@ public class JyxConfigServiceImpl extends ServiceImpl<JyxConfigMapper, JyxConfig
     }
 
     @Override
-    public HttpResult selectById(Long id) {
+    public HttpResult selectById(String id) {
         JyxConfig config = jyxConfigMapper.selectById(id);
         if (config == null){
             return HttpResult.error("查询失败");
@@ -93,13 +101,45 @@ public class JyxConfigServiceImpl extends ServiceImpl<JyxConfigMapper, JyxConfig
            }
            return HttpResult.error("修改失败");
        }catch (Exception e){
-           return HttpResult.error("修改失败" + e.getMessage());
+           e.printStackTrace();
+           return HttpResult.error("修改失败");
        }
     }
 
     @Override
     public List<JyxConfigVo> jyxList(JyxConfigParam configParam) {
-        return jyxConfigMapper.jyxList(configParam);
+        try {
+            List<JyxConfigVo> jyxConfigVos = Optional.ofNullable(jyxConfigMapper.jyxList(configParam)).orElse(Collections.emptyList());
+            if (StringUtils.isNotEmpty(configParam.getSeats()) || StringUtils.isNotEmpty(configParam.getParams())) {
+                configParam.setParentId(ConstantsParent.PARENT_ID_ROOT);
+                List<JyxConfigVo> additionalConfigs = Optional.ofNullable(jyxConfigMapper.jyxList(configParam)).orElse(Collections.emptyList());
+                if (!additionalConfigs.isEmpty()) {
+                    Set<String> ids = additionalConfigs.stream().map(JyxConfigVo::getId).collect(Collectors.toSet());
+                    List<JyxConfigVo> parentConfigs = jyxConfigMapper.selectParentIds(new ArrayList<>(ids));
+                    jyxConfigVos.addAll(parentConfigs);
+                    jyxConfigVos = jyxConfigVos.stream().collect(collectingAndThen(
+                            toCollection(() -> new TreeSet<>(Comparator.comparing(JyxConfigVo::getId))), ArrayList::new
+                    ));
+                }
+            }
+            if (jyxConfigVos.isEmpty()) {
+                return Collections.emptyList();
+            }
+            Set<String> parentIds = jyxConfigVos.stream().map(JyxConfigVo::getParentId).collect(Collectors.toSet());
+            List<JyxConfigVo> jyxConfigs = Optional.ofNullable(jyxConfigMapper.selectIds(new ArrayList<>(parentIds))).orElse(Collections.emptyList());
+            Map<String, List<JyxConfigVo>> childrenMap = jyxConfigVos.stream()
+                    .filter(vo -> !ConstantsParent.PARENT_ID_ROOT.equals(vo.getParentId()))
+                    .collect(Collectors.groupingBy(vo -> String.valueOf(vo.getParentId()), Collectors.mapping(Function.identity(), Collectors.toList())));
+            List<JyxConfigVo> parentConfigs = BeanUtil.copyToList(jyxConfigs, JyxConfigVo.class);
+            parentConfigs.forEach(parentConfig -> {
+                parentConfig.setChildren(childrenMap.getOrDefault(String.valueOf(parentConfig.getId()), Collections.emptyList()));
+            });
+            return parentConfigs;
+        } catch (Exception e) {
+            // 记录日志或进行其他异常处理
+            e.printStackTrace();
+            return Collections.emptyList();
+        }
     }
 
     @Override
@@ -107,28 +147,49 @@ public class JyxConfigServiceImpl extends ServiceImpl<JyxConfigMapper, JyxConfig
     public HttpResult deleteById(String id) {
         try {
             JyxConfig config = jyxConfigMapper.selectById(id);
-            if (config == null){
+            if (config == null) {
                 return HttpResult.error("该驾意险配置不存在");
             }
-            config.setIsDelete(1);
-            int i = jyxConfigMapper.updateById(config);
-            if (i > 0){
-                blameService.lambdaUpdate().eq(JyxBlame::getJyxConfigId, id).set(JyxBlame::getIsDelete, 1).update();
-                settingService.lambdaUpdate().eq(jyxSetting::getJyxConfigId, id).set(jyxSetting::getIsDelete, 1).update();
-                return HttpResult.ok("删除成功");
+            int deletedRows = jyxConfigMapper.deleteById(config);
+            if (deletedRows <= 0) {
+                return HttpResult.error("删除失败");
             }
-            return HttpResult.error("删除失败");
-        }catch (Exception e){
-            return HttpResult.error("删除失败" + e.getMessage());
+            if (ConstantsParent.PARENT_ID_ROOT.equals(config.getParentId())) {
+                LambdaQueryWrapper<JyxConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+                lambdaQueryWrapper.eq(JyxConfig::getParentId, config.getId());
+                // 批量删除子配置
+                List<String> childIds = jyxConfigMapper.selectList(lambdaQueryWrapper).stream()
+                        .map(JyxConfig::getId)
+                        .collect(Collectors.toList());
+
+                if (!childIds.isEmpty()) {
+                    jyxConfigMapper.deleteBatchIds(childIds);
+                    blameService.lambdaUpdate().in(JyxBlame::getJyxConfigId, childIds).remove();
+                    settingService.lambdaUpdate().in(jyxSetting::getJyxConfigId, childIds).remove();
+                }
+            } else {
+                blameService.lambdaUpdate().eq(JyxBlame::getJyxConfigId, config.getId()).remove();
+                settingService.lambdaUpdate().eq(jyxSetting::getJyxConfigId, config.getId()).remove();
+            }
+            return HttpResult.ok("删除成功");
+        } catch (Exception e) {
+            // 记录异常信息到日志
+            return HttpResult.error("删除失败: " + e.getMessage());
         }
     }
 
+    @Override
+    public List<JyxConfigVo> selectMainInsurance(String company) {
+        List<JyxConfigVo> jyxConfigVos = jyxConfigMapper.selectMainInsurance(company);
+        return jyxConfigVos;
+    }
+
 
-    public List<JyxBlame> selectBlameList(Long id){
+    public List<JyxBlame> selectBlameList(String id){
         return blameService.lambdaQuery().eq(JyxBlame::getJyxConfigId, id).list();
     }
 
-    public List<jyxSetting> selectSettingList(Long id){
+    public List<jyxSetting> selectSettingList(String id){
         return settingService.lambdaQuery().eq(jyxSetting::getJyxConfigId, id).list();
     }
 

+ 73 - 3
platform/src/main/resources/mapper/JyxConfigMapper.xml

@@ -17,6 +17,7 @@
         <result column="jsCoverage" property="coverage"/>
         <result column="jsPremium" property="premium"/>
         <result column="system_code" property="systemCode"/>
+        <result column="jcDelete" property="isDelete"/>
         <collection property="blameList" ofType="com.jzg.commons.entity.po.JyxBlame">
             <id column="blame_id" property="id"/>
             <result column="blame" property="blame"/>
@@ -38,7 +39,7 @@
 
 
     <sql id="params">
-       jc.`id`, jc.`product_type`,jc.`parent_id`, jc.`product_name`,jc.`alias`,jc.`company`, jc.`product_code`,jc.`connection_method`,jc.`premium_setting`, jc.`coverage` as jsCoverage, jc.`premium` as jsPremium, jc.`system_code`
+       jc.`id`, jc.`product_type`,jc.`parent_id`, jc.`product_name`,jc.`alias`,jc.`company`, jc.`product_code`,jc.`connection_method`,jc.`premium_setting`, jc.`coverage` as jsCoverage, jc.`premium` as jsPremium, jc.`system_code`, jc.`is_delete` as isDelete
     </sql>
 
     <select id="jyxList" resultMap="jyxConfigVo">
@@ -50,13 +51,82 @@
             left join jyx_blame jb on jc.id = jb.jyx_config_id
             left join jyx_setting js on jc.id = js.jyx_config_id
         <where>
-                is_delete = 0
+                jc.is_delete = 0
             <if test="params != null and params != ''">
-                and (jc.product_name like concat('%',#{params},'%') or jc.alias like concat('%',#{params},'%') or jc.product_code like concat('%',#{params},'%'))
+                and (jc.product_name like concat('%',#{params},'%') or jc.alias like concat('%',#{params},'%'))
             </if>
             <if test="seats != null and seats != ''">
                 and js.seats = #{seats}
             </if>
+            <if test="company != null and company != ''">
+                and jc.company = #{company}
+            </if>
+            <if test="parentId == 0">
+                and jc.parent_id = 0
+            </if>
+            <if test="parentId == null and parentId == ''">
+                and jc.parent_id != 0
+            </if>
+        </where>
+        order by jc.create_time desc
+    </select>
+
+
+    <select id="selectIds" resultMap="jyxConfigVo">
+        select
+        <include refid="params"/> ,
+        jb.id as blame_id,jb.blame,jb.blame_code,jb.blame_coverage,jb.blame_premium,jb.system_code as blame_system_code,jb.jyx_config_id as blame_jyx_config_id,
+        js.id as setting_id,js.seats,js.coverage as setting_coverage,js.premium as setting_premium,js.system_code as setting_system_code,js.jyx_config_id as setting_jyx_config_id
+        from jyx_config jc
+        left join jyx_blame jb on jc.id = jb.jyx_config_id
+        left join jyx_setting js on jc.id = js.jyx_config_id
+        <where>
+            <if test="ids != null and ids != ''">
+                and jc.id in
+                <foreach collection="ids" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        order by jc.create_time desc
+    </select>
+
+
+
+    <select id="selectParentIds" resultMap="jyxConfigVo">
+        select
+        <include refid="params"/> ,
+        jb.id as blame_id,jb.blame,jb.blame_code,jb.blame_coverage,jb.blame_premium,jb.system_code as blame_system_code,jb.jyx_config_id as blame_jyx_config_id,
+        js.id as setting_id,js.seats,js.coverage as setting_coverage,js.premium as setting_premium,js.system_code as setting_system_code,js.jyx_config_id as setting_jyx_config_id
+        from jyx_config jc
+        left join jyx_blame jb on jc.id = jb.jyx_config_id
+        left join jyx_setting js on jc.id = js.jyx_config_id
+        <where>
+            <if test="ids != null and ids != ''">
+                and jc.parent_id in
+                <foreach collection="ids" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        order by jc.create_time desc
+    </select>
+
+
+
+    <select id="selectMainInsurance" resultType="com.jzg.commons.entity.vo.JyxConfigVo">
+        select
+        <include refid="params"/> ,
+        jb.id as blame_id,jb.blame,jb.blame_code,jb.blame_coverage,jb.blame_premium,jb.system_code as blame_system_code,jb.jyx_config_id as blame_jyx_config_id,
+        js.id as setting_id,js.seats,js.coverage as setting_coverage,js.premium as setting_premium,js.system_code as setting_system_code,js.jyx_config_id as setting_jyx_config_id
+        from jyx_config jc
+        left join jyx_blame jb on jc.id = jb.jyx_config_id
+        left join jyx_setting js on jc.id = js.jyx_config_id
+        <where>
+            jc.is_delete = 0 and jc.parent_id = 0
+            <if test="company != null and company != ''">
+                and jc.company = #{company}
+            </if>
         </where>
         order by jc.create_time desc
     </select>