首页量表详情优化
This commit is contained in:
parent
78943cb88f
commit
701a67e094
|
@ -2,12 +2,9 @@ package org.dromara.scale.domain;
|
|||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import io.github.linpeilie.annotations.AutoMapping;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
import org.dromara.scale.domain.vo.SysScaleVo;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.math.BigDecimal;
|
||||
|
@ -21,7 +18,7 @@ import java.math.BigDecimal;
|
|||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("sys_scale")
|
||||
@AutoMapper(target = SysScaleVo.class, reverseConvertGenerate = false)
|
||||
//@AutoMapper(target = SysScaleVo.class, reverseConvertGenerate = false)
|
||||
public class SysScale extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
|
@ -66,13 +63,12 @@ public class SysScale extends TenantEntity {
|
|||
/**
|
||||
* 适应人群:对应字典项people_type
|
||||
*/
|
||||
@AutoMapping(target = "peopleType", expression = "java(cn.hutool.core.util.StrUtil.split(source.getPeopleType(), \",\"))")
|
||||
private String peopleType;
|
||||
|
||||
/**
|
||||
* 适用年龄段:对应字典项age_range
|
||||
*/
|
||||
@AutoMapping(target = "ageRange", expression = "java(cn.hutool.core.util.StrUtil.split(source.getAgeRange(), \",\"))")
|
||||
|
||||
private String ageRange;
|
||||
|
||||
/**
|
||||
|
@ -90,7 +86,7 @@ public class SysScale extends TenantEntity {
|
|||
/**
|
||||
* 量表类型:对应字典项scale_type
|
||||
*/
|
||||
@AutoMapping(target = "scaleType", expression = "java(cn.hutool.core.util.StrUtil.split(source.getScaleType(), \",\"))")
|
||||
|
||||
private String scaleType;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package org.dromara.scale.domain.vo;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import io.github.linpeilie.annotations.AutoMapping;
|
||||
import lombok.Data;
|
||||
import org.dromara.common.translation.annotation.Translation;
|
||||
import org.dromara.common.translation.constant.TransConstant;
|
||||
import org.dromara.scale.domain.SysScale;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
@ -18,6 +20,7 @@ import java.util.List;
|
|||
* @date 2024-03-29
|
||||
*/
|
||||
@Data
|
||||
@AutoMapper(target = SysScale.class)
|
||||
public class SysScaleVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
|
@ -61,16 +64,19 @@ public class SysScaleVo implements Serializable {
|
|||
/**
|
||||
* 适应人群:对应字典项people_type
|
||||
*/
|
||||
@AutoMapping(target = "peopleType", expression = "java(cn.hutool.core.util.StrUtil.split(source.getPeopleType(), \",\"))")
|
||||
private List<String> peopleType;
|
||||
|
||||
/**
|
||||
* 适应人群
|
||||
*/
|
||||
|
||||
private List<String> peopleTypeName;
|
||||
|
||||
/**
|
||||
* 适用年龄段:对应字典项age_range
|
||||
*/
|
||||
@AutoMapping(target = "ageRange", expression = "java(cn.hutool.core.util.StrUtil.split(source.getAgeRange(), \",\"))")
|
||||
private List<String> ageRange;
|
||||
|
||||
/**
|
||||
|
@ -99,6 +105,7 @@ public class SysScaleVo implements Serializable {
|
|||
/**
|
||||
* 量表类型:对应字典项scale_type
|
||||
*/
|
||||
@AutoMapping(target = "scaleType", expression = "java(cn.hutool.core.util.StrUtil.split(source.getScaleType(), \",\"))")
|
||||
private List<String> scaleType;
|
||||
|
||||
/**
|
||||
|
|
|
@ -48,6 +48,11 @@ public class SysScaleServiceImpl implements ISysScaleService {
|
|||
public SysScaleVo queryById(Long scaleId) {
|
||||
|
||||
SysScaleVo sysScaleVo = baseMapper.selectVoById(scaleId);
|
||||
List<SysDictDataVo> scaleTypeList = sysDictDataMapper.selectDictDataByTypeAndDictValue("scale_type", StrUtil.join(StrUtil.COMMA, sysScaleVo.getScaleType()));
|
||||
sysScaleVo.setScaleTypeName(scaleTypeList.stream().map(SysDictDataVo::getDictLabel).collect(Collectors.toList()));
|
||||
|
||||
List<SysDictDataVo> peopleTypeList = sysDictDataMapper.selectDictDataByTypeAndDictValue("people_type", StrUtil.join(StrUtil.COMMA, sysScaleVo.getPeopleType()));
|
||||
sysScaleVo.setPeopleTypeName(peopleTypeList.stream().map(SysDictDataVo::getDictLabel).collect(Collectors.toList()));
|
||||
//计算均分
|
||||
List<ScoreRecord> scoreList = scoreMapper.selectList(new LambdaQueryWrapper<ScoreRecord>().select(ScoreRecord::getScore).eq(ScoreRecord::getBusinessId, scaleId).eq(ScoreRecord::getRecordStatus, 0));
|
||||
OptionalDouble averageScore = scoreList.stream()
|
||||
|
|
Loading…
Reference in New Issue