Merge branch 'dev' into dev.caojiawei
This commit is contained in:
commit
d1a7e3f82e
|
@ -2,11 +2,15 @@ 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.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.scale.domain.vo.SysScaleVo;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 心理测评量对象 sys_scale
|
||||
|
@ -17,6 +21,7 @@ import java.io.Serial;
|
|||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("sys_scale")
|
||||
@AutoMapper(target = SysScaleVo.class, reverseConvertGenerate = false)
|
||||
public class SysScale extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
|
@ -28,11 +33,26 @@ public class SysScale extends BaseEntity {
|
|||
@TableId(value = "scale_id")
|
||||
private Long scaleId;
|
||||
|
||||
/**
|
||||
* 量表名称
|
||||
*/
|
||||
private String scaleName;
|
||||
|
||||
/**
|
||||
* 量表编码
|
||||
*/
|
||||
private String scaleCode;
|
||||
|
||||
/**
|
||||
* 测评标题
|
||||
*/
|
||||
private String scaleTitle;
|
||||
|
||||
/**
|
||||
* 测评子标题
|
||||
*/
|
||||
private String scaleSubTitle;
|
||||
|
||||
/**
|
||||
* 测评详情
|
||||
*/
|
||||
|
@ -44,9 +64,39 @@ public class SysScale extends BaseEntity {
|
|||
private String status;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
* 适应人群:对应字典项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;
|
||||
|
||||
/**
|
||||
* 封面
|
||||
*/
|
||||
private Long cover;
|
||||
|
||||
|
||||
/**
|
||||
* 测评次数
|
||||
*/
|
||||
private Integer evalNums;
|
||||
|
||||
/**
|
||||
* 量表类型:对应字典项scale_type
|
||||
*/
|
||||
@AutoMapping(target = "scaleType", expression = "java(cn.hutool.core.util.StrUtil.split(source.getScaleType(), \",\"))")
|
||||
private String scaleType;
|
||||
|
||||
/**
|
||||
* 价格/ 单次
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 维度类型:0:单项单维,1:多项单维型,2:多项多维型
|
||||
*/
|
||||
|
@ -57,6 +107,11 @@ public class SysScale extends BaseEntity {
|
|||
*/
|
||||
private Integer selectDirection;
|
||||
|
||||
/**
|
||||
* 题量
|
||||
*/
|
||||
private Integer questionsNum;
|
||||
|
||||
/**
|
||||
* 测评时间
|
||||
*/
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package org.dromara.scale.domain.bo;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import io.github.linpeilie.annotations.AutoMapping;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
@ -10,6 +13,9 @@ import org.dromara.common.core.validate.EditGroup;
|
|||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.scale.domain.SysScale;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 心理测评量业务对象 sys_scale
|
||||
*
|
||||
|
@ -27,12 +33,30 @@ public class SysScaleBo extends BaseEntity {
|
|||
@NotNull(message = "测评id不能为空", groups = {EditGroup.class})
|
||||
private Long scaleId;
|
||||
|
||||
/**
|
||||
* 量表名称
|
||||
*/
|
||||
@NotBlank(message = "量表名称不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String scaleName;
|
||||
|
||||
/**
|
||||
* 量表编码
|
||||
*/
|
||||
@NotBlank(message = "量表编码不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String scaleCode;
|
||||
|
||||
/**
|
||||
* 测评标题
|
||||
*/
|
||||
@NotBlank(message = "测评标题不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String scaleTitle;
|
||||
|
||||
/**
|
||||
* 测评子标题
|
||||
*/
|
||||
@NotBlank(message = "测评子标题不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String scaleSubTitle;
|
||||
|
||||
/**
|
||||
* 测评详情
|
||||
*/
|
||||
|
@ -46,10 +70,40 @@ public class SysScaleBo extends BaseEntity {
|
|||
private String status;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
* 适应人群:对应字典项people_type
|
||||
*/
|
||||
@NotBlank(message = "类型不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String scaleType;
|
||||
@AutoMapping(target = "peopleType", expression = "java(java.lang.String.join(\",\", source.getPeopleType()))")
|
||||
private List<String> peopleType;
|
||||
|
||||
/**
|
||||
* 适用年龄段:对应字典项age_range
|
||||
*/
|
||||
@AutoMapping(target = "ageRange", expression = "java(java.lang.String.join(\",\", source.getAgeRange()))")
|
||||
private List<String> ageRange;
|
||||
|
||||
/**
|
||||
* 封面
|
||||
*/
|
||||
@NotNull(message = "封面不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long cover;
|
||||
|
||||
/**
|
||||
* 测评次数
|
||||
*/
|
||||
private Integer evalNums;
|
||||
|
||||
/**
|
||||
* 量表类型:对应字典项scale_type
|
||||
*/
|
||||
@NotEmpty(message = "类型不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
@AutoMapping(target = "scaleType", expression = "java(java.lang.String.join(\",\", source.getScaleType()))")
|
||||
private List<String> scaleType;
|
||||
|
||||
/**
|
||||
* 价格/ 单次
|
||||
*/
|
||||
@NotNull(message = "价格/ 单次不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 维度类型:0:单项单维,1:多项单维型,2:多项多维型
|
||||
|
@ -63,10 +117,14 @@ public class SysScaleBo extends BaseEntity {
|
|||
private Integer selectDirection;
|
||||
|
||||
/**
|
||||
* 测评时间
|
||||
* 题量
|
||||
*/
|
||||
@NotBlank(message = "测评时间不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
@NotNull(message = "题量不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Integer questionsNum;
|
||||
|
||||
/**
|
||||
* 测评时长
|
||||
*/
|
||||
@NotBlank(message = "测评时长不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String scaleTime;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,14 +2,14 @@ package org.dromara.scale.domain.vo;
|
|||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import org.dromara.scale.domain.SysScale;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,6 @@ import java.io.Serializable;
|
|||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = SysScale.class)
|
||||
public class SysScaleVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
|
@ -32,12 +31,27 @@ public class SysScaleVo implements Serializable {
|
|||
@ExcelProperty(value = "测评id")
|
||||
private Long scaleId;
|
||||
|
||||
/**
|
||||
* 量表名称
|
||||
*/
|
||||
private String scaleName;
|
||||
|
||||
/**
|
||||
* 量表编码
|
||||
*/
|
||||
private String scaleCode;
|
||||
|
||||
/**
|
||||
* 测评标题
|
||||
*/
|
||||
@ExcelProperty(value = "测评标题")
|
||||
private String scaleTitle;
|
||||
|
||||
/**
|
||||
* 测评子标题
|
||||
*/
|
||||
private String scaleSubTitle;
|
||||
|
||||
/**
|
||||
* 测评详情
|
||||
*/
|
||||
|
@ -51,17 +65,51 @@ public class SysScaleVo implements Serializable {
|
|||
@ExcelDictFormat(readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 适应人群:对应字典项people_type
|
||||
*/
|
||||
private List<String> peopleType;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
* 适应人群
|
||||
*/
|
||||
private List<String> peopleTypeName;
|
||||
|
||||
/**
|
||||
* 适用年龄段:对应字典项age_range
|
||||
*/
|
||||
private List<String> ageRange;
|
||||
|
||||
/**
|
||||
* 封面
|
||||
*/
|
||||
private Long cover;
|
||||
|
||||
/**
|
||||
* 封面地址
|
||||
*/
|
||||
private String coverUrl;
|
||||
|
||||
/**
|
||||
* 测评次数
|
||||
*/
|
||||
private Integer evalNums;
|
||||
|
||||
/**
|
||||
* 量表类型:对应字典项scale_type
|
||||
*/
|
||||
@ExcelProperty(value = "类型")
|
||||
private String scaleType;
|
||||
private List<String> scaleType;
|
||||
|
||||
/**
|
||||
* 量表类型名称
|
||||
*/
|
||||
private String scaleTypeName;
|
||||
private List<String> scaleTypeName;
|
||||
|
||||
/**
|
||||
* 价格/ 单次
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 维度类型:0:单项单维,1:多项单维型,2:多项多维型
|
||||
|
@ -73,10 +121,14 @@ public class SysScaleVo implements Serializable {
|
|||
*/
|
||||
private Integer selectDirection;
|
||||
|
||||
/**
|
||||
* 题量
|
||||
*/
|
||||
private Integer questionsNum;
|
||||
|
||||
/**
|
||||
* 测评时间
|
||||
*/
|
||||
@ExcelProperty(value = "测评时间")
|
||||
private String scaleTime;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,28 +1,30 @@
|
|||
package org.dromara.scale.service.impl;
|
||||
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.scale.domain.SysScaleFormula;
|
||||
import org.dromara.scale.mapper.SysScaleFormulaMapper;
|
||||
import org.dromara.system.domain.SysDictData;
|
||||
import org.dromara.system.domain.vo.SysDictDataVo;
|
||||
import org.dromara.system.mapper.SysDictDataMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.scale.domain.SysScale;
|
||||
import org.dromara.scale.domain.bo.SysScaleBo;
|
||||
import org.dromara.scale.domain.vo.SysScaleVo;
|
||||
import org.dromara.scale.domain.SysScale;
|
||||
import org.dromara.scale.mapper.SysScaleMapper;
|
||||
import org.dromara.scale.service.ISysScaleService;
|
||||
import org.dromara.system.domain.SysOss;
|
||||
import org.dromara.system.domain.vo.SysDictDataVo;
|
||||
import org.dromara.system.mapper.SysDictDataMapper;
|
||||
import org.dromara.system.mapper.SysOssMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 心理测评量Service业务层处理
|
||||
|
@ -33,10 +35,9 @@ import java.util.Collection;
|
|||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SysScaleServiceImpl implements ISysScaleService {
|
||||
|
||||
private final SysScaleMapper baseMapper;
|
||||
private final SysScaleFormulaMapper sysScaleFormulaMapper;
|
||||
private final SysDictDataMapper sysDictDataMapper;
|
||||
private final SysOssMapper sysOssMapper;
|
||||
|
||||
/**
|
||||
* 查询心理测评量
|
||||
|
@ -54,8 +55,14 @@ public class SysScaleServiceImpl implements ISysScaleService {
|
|||
LambdaQueryWrapper<SysScale> lqw = buildQueryWrapper(bo);
|
||||
Page<SysScaleVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
for (SysScaleVo record : result.getRecords()) {
|
||||
SysDictDataVo sysScaleType = sysDictDataMapper.selectDictDataByTypeAndDictValue("sys_scale_type", record.getScaleType());
|
||||
record.setScaleTypeName(sysScaleType.getDictLabel());
|
||||
List<SysDictDataVo> scaleTypeList = sysDictDataMapper.selectDictDataByTypeAndDictValue("scale_type", StrUtil.join(StrUtil.COMMA, record.getScaleType()));
|
||||
record.setScaleTypeName(scaleTypeList.stream().map(SysDictDataVo::getDictLabel).collect(Collectors.toList()));
|
||||
|
||||
List<SysDictDataVo> peopleTypeList = sysDictDataMapper.selectDictDataByTypeAndDictValue("people_type", StrUtil.join(StrUtil.COMMA, record.getPeopleType()));
|
||||
record.setPeopleTypeName(peopleTypeList.stream().map(SysDictDataVo::getDictLabel).collect(Collectors.toList()));
|
||||
|
||||
SysOss sysOss = sysOssMapper.selectById(record.getCover());
|
||||
record.setCoverUrl(sysOss.getUrl());
|
||||
}
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
@ -70,13 +77,15 @@ public class SysScaleServiceImpl implements ISysScaleService {
|
|||
}
|
||||
|
||||
private LambdaQueryWrapper<SysScale> buildQueryWrapper(SysScaleBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<SysScale> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getScaleTitle()), SysScale::getScaleTitle, bo.getScaleTitle());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getScaleDetails()), SysScale::getScaleDetails, bo.getScaleDetails());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getScaleName()), SysScale::getScaleName, bo.getScaleName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getScaleCode()), SysScale::getScaleCode, bo.getScaleCode());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), SysScale::getStatus, bo.getStatus());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getScaleType()), SysScale::getScaleType, bo.getScaleType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getScaleTime()), SysScale::getScaleTime, bo.getScaleTime());
|
||||
|
||||
if (CollUtil.isNotEmpty(bo.getScaleType())) {
|
||||
lqw.like(CollUtil.isNotEmpty(bo.getScaleType()), SysScale::getScaleType, bo.getScaleType().get(0));
|
||||
}
|
||||
|
||||
return lqw;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,11 +23,5 @@ public interface SysDictDataMapper extends BaseMapperPlus<SysDictData, SysDictDa
|
|||
.orderByAsc(SysDictData::getDictSort));
|
||||
}
|
||||
|
||||
default SysDictDataVo selectDictDataByTypeAndDictValue(String dictType, String dictValue) {
|
||||
return selectVoOne(
|
||||
new LambdaQueryWrapper<SysDictData>()
|
||||
.eq(SysDictData::getDictType, dictType)
|
||||
.eq(SysDictData::getDictValue, dictValue)
|
||||
.last("limit 1"));
|
||||
}
|
||||
List<SysDictDataVo> selectDictDataByTypeAndDictValue(String dictType, String dictValue);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.dromara.system.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.system.domain.SysOss;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
|
@ -9,5 +10,6 @@ import org.dromara.system.domain.vo.SysOssVo;
|
|||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysOssMapper extends BaseMapperPlus<SysOss, SysOssVo> {
|
||||
}
|
||||
|
|
|
@ -4,4 +4,9 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.system.mapper.SysDictDataMapper">
|
||||
|
||||
<select id="selectDictDataByTypeAndDictValue" resultType="org.dromara.system.domain.vo.SysDictDataVo">
|
||||
SELECT *
|
||||
FROM sys_dict_data t
|
||||
WHERE t.dict_type=#{dictType} AND FIND_IN_SET(t.dict_value, #{dictValue})
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue