1. 指标子集映射

This commit is contained in:
李玉东 2025-08-17 14:22:24 +08:00
parent 49f0bbcc01
commit e2d86ae384
6 changed files with 215 additions and 0 deletions

View File

@ -0,0 +1,52 @@
package com.hshh.evaluation.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;
/**
* <p>
* 模板指标权重表
* </p>
*
* @author liDongYu
* @since 2025-08-14
*/
@TableName("m_data_evaluation_template_weight")
@Data
public class EvaluationTemplateWeight implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 顶级指标ID.
*/
private Integer indicatorTopId;
private Integer templateId;
/**
* 指标ID(开始).
*/
private Integer fromIndicatorId;
private Integer toIndicatorId;
/**
* 权重.
*/
private Double weight;
/**
* 父指标ID.
*/
private int indicatorParentId;
private int rowNum;
}

View File

@ -0,0 +1,16 @@
package com.hshh.evaluation.mapper;
import com.hshh.evaluation.entity.EvaluationTemplateWeight;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 模板指标权重表 Mapper 接口
* </p>
*
* @author liDongYu
* @since 2025-08-14
*/
public interface EvaluationTemplateWeightMapper extends BaseMapper<EvaluationTemplateWeight> {
}

View File

@ -0,0 +1,43 @@
package com.hshh.evaluation.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hshh.evaluation.entity.EvaluationTemplateWeight;
import java.util.List;
/**
* 模板指标权重表 服务类.
*
* @author liDongYu
* @since 2025-08-14
*/
public interface EvaluationTemplateWeightService extends IService<EvaluationTemplateWeight> {
/**
* 根据模板id+指标id删除.
*
* @param templateId 模板ID
* @param indicatorTopId 顶级指标ID
* @param parentId 上级指标ID
*/
void deleteEvaluationTemplateWeightWithTemplateIdAndIndicatorId(Integer templateId,
Integer indicatorTopId,
Integer parentId);
/**
* 根据模板ID删除权重信息.
*
* @param templateId 模板ID
*/
void deleteEvaluationTemplateWeightWithTemplateId(Integer templateId);
/**
* 根据指标父ID和模板id获取权重列表.
*
* @param indicatorParentId 父ID
* @param templateId 模板ID
* @return 权重列表
*/
List<EvaluationTemplateWeight> queryListByIndicatorParentIdAndTemplateId(
Integer indicatorParentId, Integer templateId);
}

View File

@ -0,0 +1,54 @@
package com.hshh.evaluation.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hshh.evaluation.entity.EvaluationTemplateWeight;
import com.hshh.evaluation.mapper.EvaluationTemplateWeightMapper;
import com.hshh.evaluation.service.EvaluationTemplateWeightService;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* <p>
* 模板指标权重表 服务实现类
* </p>
*
* @author liDongYu
* @since 2025-08-14
*/
@Service
public class EvaluationTemplateWeightServiceImpl extends
ServiceImpl<EvaluationTemplateWeightMapper, EvaluationTemplateWeight> implements
EvaluationTemplateWeightService {
@Transactional(rollbackFor = Exception.class)
@Override
public void deleteEvaluationTemplateWeightWithTemplateIdAndIndicatorId(Integer templateId,
Integer indicatorTopId, Integer parentId) {
QueryWrapper<EvaluationTemplateWeight> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("template_id", templateId);
queryWrapper.eq("indicator_top_id", indicatorTopId);
queryWrapper.eq("indicator_parent_id", parentId);
this.remove(queryWrapper);
}
@Override
public void deleteEvaluationTemplateWeightWithTemplateId(Integer templateId) {
QueryWrapper<EvaluationTemplateWeight> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("template_id", templateId);
this.remove(queryWrapper);
}
@Override
public List<EvaluationTemplateWeight> queryListByIndicatorParentIdAndTemplateId(
Integer indicatorParentId, Integer templateId) {
QueryWrapper<EvaluationTemplateWeight> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("template_id", templateId);
queryWrapper.eq("indicator_parent_id", indicatorParentId);
return this.list(queryWrapper);
}
}

View File

@ -0,0 +1,5 @@
<?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.hshh.evaluation.mapper.EvaluationTemplateWeightMapper">
</mapper>

View File

@ -0,0 +1,45 @@
<div class="map-scroller">
<table class="table table-vcenter table-striped table-hover align-middle map-table" id="ahpTable">
<thead>
<tr id="dynamic_header_tr">
<th></th>
<th th:each="item:${data.headerMap}" th:text="${item.value.name}" th:data-value="${item.value.id}" th:data-name="${item.value.name}"></th>
</tr>
</thead>
<tbody class="autonum" id="dynamic_tbody_tr">
<tr th:each="item,stat:${data.headerMap}">
<td th:text="${item.value.name}"></td>
<td th:each="listItem:${data.weight.get(stat.index)}">
<label>
<select onchange="mapperChange(this)" class="form-select" th:id="${listItem.rowId+'_'+listItem.colId}" name="mapper-select" th:data-pid="${listItem.parentId}" th:disabled="${listItem.rowId == listItem.colId}" >
<option value="1" th:selected="${listItem.value=='1'}">同样重要(1)</option>
<option value="2" th:selected="${listItem.value=='2'}">微小重要(2)</option>
<option value="3" th:selected="${listItem.value=='3'}">稍微重要(3)</option>
<option value="4" th:selected="${listItem.value=='4'}">更为重要(4)</option>
<option value="5" th:selected="${listItem.value=='5'}">明显重要(5)</option>
<option value="6" th:selected="${listItem.value=='6'}">十分重要(6)</option>
<option value="7" th:selected="${listItem.value=='7'}">强烈重要(7)</option>
<option value="8" th:selected="${listItem.value=='8'}">更强烈重要(8)</option>
<option value="9" th:selected="${listItem.value=='9'}">极端重要(9)</option>
<option value="0.5" th:selected="${listItem.value=='0.5'}">微小次要(0.5)</option>
<option value="0.3333" th:selected="${listItem.value=='0.3333'}">稍微次要(0.3333)</option>
<option value="0.25" th:selected="${listItem.value=='0.25'}">更为次要(0.25)</option>
<option value="0.2" th:selected="${listItem.value=='0.2'}">明显次要(0.2)</option>
<option value="0.16667" th:selected="${listItem.value=='0.16667'}">十分次要(0.16667)</option>
<option value="0.14286" th:selected="${listItem.value=='0.14286'}">强烈次要(0.14286)</option>
<option value="0.125" th:selected="${listItem.value=='0.125'}">更强烈次要(0.125)</option>
<option value="0.11111" th:selected="${listItem.value=='0.11111'}">极端次要(0.11111)</option>
</select>
<div class="invalid-feedback" th:id="${listItem.rowId+'_'+listItem.colId+'_error_tip'}" ></div>
</label>
</td>
</tr>
<tr th:if="${data.headerMap.size()==0}">
<td>无下级指标</td>
</tr>
</tbody>
</table>
</div>