修改量测逻辑后,优化统计查询sql,量测完成的统计,量测预警的统计
This commit is contained in:
parent
57dc8d7859
commit
747f6eea2a
|
@ -3,6 +3,7 @@ package org.dromara.scale.controller;
|
|||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.scale.domain.bo.BaseQueryBo;
|
||||
import org.dromara.scale.domain.vo.StatisticNumVo;
|
||||
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
||||
import org.dromara.scale.service.IStatisticService;
|
||||
|
@ -30,46 +31,46 @@ public class StatisticController extends BaseController {
|
|||
* 获取完成情况统计
|
||||
*/
|
||||
@GetMapping("/complete/all")
|
||||
public R<StatisticNumVo> getComplete(Long batchNo, Long scaleId) {
|
||||
return R.ok(statisticService.getComplete4All(batchNo, scaleId));
|
||||
public R<StatisticNumVo> getComplete(BaseQueryBo query) {
|
||||
return R.ok(statisticService.getComplete4All(query));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取完成情况统计
|
||||
*/
|
||||
@GetMapping("/complete/class")
|
||||
public R<List<StatisticNumVo>> getComplete4Class(Long batchNo, Long scaleId) {
|
||||
return R.ok(statisticService.getComplete4Class(batchNo, scaleId));
|
||||
public R<List<StatisticNumVo>> getComplete4Class(BaseQueryBo query) {
|
||||
return R.ok(statisticService.getComplete4Class(query));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取预警情况统计
|
||||
*/
|
||||
@GetMapping("/warn/all")
|
||||
public R<StatisticWarnVo> getWarn(Long batchNo, Long scaleId) {
|
||||
return R.ok(statisticService.getWarn4All(batchNo, scaleId));
|
||||
public R<StatisticWarnVo> getWarn(BaseQueryBo query) {
|
||||
return R.ok(statisticService.getWarn4All(query));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取预警情况统计
|
||||
*/
|
||||
@GetMapping("/warn/class")
|
||||
public R<List<StatisticWarnVo>> getWarn4Class(Long batchNo, Long scaleId) {
|
||||
return R.ok(statisticService.getWarn4Class(batchNo, scaleId));
|
||||
public R<List<StatisticWarnVo>> getWarn4Class(BaseQueryBo query) {
|
||||
return R.ok(statisticService.getWarn4Class(query));
|
||||
}
|
||||
/**
|
||||
* 获取预警情况统计
|
||||
*/
|
||||
@GetMapping("/factor/all")
|
||||
public R<List<StatisticNumVo>> getFactor(Long batchNo, Long scaleId) {
|
||||
return R.ok(statisticService.getFactor4All(batchNo, scaleId));
|
||||
public R<List<StatisticNumVo>> getFactor(BaseQueryBo query) {
|
||||
return R.ok(statisticService.getFactor4All(query));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取预警情况统计
|
||||
*/
|
||||
@GetMapping("/factor/class")
|
||||
public R<List<StatisticNumVo>> getFactor4Class(Long batchNo, Long scaleId) {
|
||||
return R.ok(statisticService.getFactor4Class(batchNo, scaleId));
|
||||
public R<List<StatisticNumVo>> getFactor4Class(BaseQueryBo query) {
|
||||
return R.ok(statisticService.getFactor4Class(query));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import org.dromara.common.log.enums.BusinessType;
|
|||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.scale.domain.bo.BaseQueryBo;
|
||||
import org.dromara.scale.domain.bo.SysScalePublishBo;
|
||||
import org.dromara.scale.domain.vo.EvaluationVo;
|
||||
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
||||
|
@ -97,7 +98,7 @@ public class SysScalePublishController extends BaseController {
|
|||
*/
|
||||
@SaCheckPermission("evaluation:record:query")
|
||||
@GetMapping("/evaluation/list")
|
||||
public R<List<EvaluationVo>> getEvaluationList(Long batchNo, Long scaleId) {
|
||||
return R.ok(sysScalePublishService.getEvaluationList(batchNo, scaleId));
|
||||
public R<List<EvaluationVo>> getEvaluationList(BaseQueryBo query) {
|
||||
return R.ok(sysScalePublishService.getEvaluationList(query));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package org.dromara.scale.domain.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* <p>TODO<p>
|
||||
*
|
||||
* @author cjw
|
||||
* @version V1.0.0
|
||||
* @date 2024/4/22 10:57
|
||||
*/
|
||||
@Data
|
||||
public class BaseQueryBo {
|
||||
|
||||
Long batchNo;
|
||||
Long scaleId;
|
||||
Long deptId;
|
||||
}
|
|
@ -33,6 +33,6 @@ public class EvaluationVo implements Serializable {
|
|||
|
||||
private String deptName;
|
||||
|
||||
private Boolean used;
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package org.dromara.scale.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.scale.domain.vo.StatisticNumVo;
|
||||
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>TODO<p>
|
||||
*
|
||||
* @author cjw
|
||||
* @version V1.0.0
|
||||
* @date 2024/4/22 13:55
|
||||
*/
|
||||
@Mapper
|
||||
public interface StatisticMapper {
|
||||
|
||||
List<StatisticNumVo> selectCompleteAvaluation(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||
|
||||
List<StatisticWarnVo> selectStatisticWarn(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||
|
||||
List<StatisticNumVo> selectStatisticFactor(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||
}
|
|
@ -5,8 +5,6 @@ import org.apache.ibatis.annotations.Param;
|
|||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.scale.domain.SysScalePublish;
|
||||
import org.dromara.scale.domain.vo.EvaluationVo;
|
||||
import org.dromara.scale.domain.vo.StatisticNumVo;
|
||||
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
||||
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -20,24 +18,8 @@ import java.util.List;
|
|||
@Mapper
|
||||
public interface SysScalePublishMapper extends BaseMapperPlus<SysScalePublish, SysScalePublishVo> {
|
||||
|
||||
StatisticNumVo selectSingleAllAvaluation(Long batchNo);
|
||||
List<EvaluationVo> selectEvaluationVoList(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId, @Param("deptId") Long deptId);
|
||||
|
||||
StatisticNumVo selectSingleCompleteAvaluation(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||
String selectDeptNameByBatchNo(Long batchNo);
|
||||
|
||||
|
||||
List<StatisticNumVo> selectAllAvaluation(Long batchNo);
|
||||
|
||||
List<StatisticNumVo> selectCompleteAvaluation(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||
|
||||
List<EvaluationVo> selectEvaluationVoList(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||
|
||||
List<EvaluationVo> selectEvaluationVoList4Parent(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||
|
||||
StatisticWarnVo selectStatisticWarn(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||
|
||||
List<StatisticWarnVo> selectStatisticWarn4Class(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||
|
||||
List<StatisticNumVo> selectStatisticFactor(@Param("batchNo")Long batchNo, @Param("scaleId") Long scaleId);
|
||||
|
||||
List<StatisticNumVo> selectStatisticFactor4Class(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.dromara.scale.service;
|
||||
|
||||
import org.dromara.scale.domain.bo.BaseQueryBo;
|
||||
import org.dromara.scale.domain.vo.StatisticNumVo;
|
||||
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
||||
|
||||
|
@ -8,16 +9,16 @@ import java.util.List;
|
|||
public interface IStatisticService {
|
||||
|
||||
|
||||
StatisticNumVo getComplete4All(Long batchNo, Long scaleId);
|
||||
StatisticNumVo getComplete4All(BaseQueryBo query);
|
||||
|
||||
List<StatisticNumVo> getComplete4Class(Long batchNo, Long scaleId);
|
||||
List<StatisticNumVo> getComplete4Class(BaseQueryBo query);
|
||||
|
||||
|
||||
StatisticWarnVo getWarn4All(Long batchNo, Long scaleId);
|
||||
StatisticWarnVo getWarn4All(BaseQueryBo query);
|
||||
|
||||
List<StatisticWarnVo> getWarn4Class(Long batchNo, Long scaleId);
|
||||
List<StatisticWarnVo> getWarn4Class(BaseQueryBo query);
|
||||
|
||||
List<StatisticNumVo> getFactor4All(Long batchNo, Long scaleId);
|
||||
List<StatisticNumVo> getFactor4All(BaseQueryBo query);
|
||||
|
||||
List<StatisticNumVo> getFactor4Class(Long batchNo, Long scaleId);
|
||||
List<StatisticNumVo> getFactor4Class(BaseQueryBo query);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.dromara.scale.service;
|
|||
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.scale.domain.bo.BaseQueryBo;
|
||||
import org.dromara.scale.domain.bo.SysScalePublishBo;
|
||||
import org.dromara.scale.domain.vo.EvaluationVo;
|
||||
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
||||
|
@ -48,6 +49,6 @@ public interface ISysScalePublishService {
|
|||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
|
||||
List<EvaluationVo> getEvaluationList(Long batchNo,Long scaleId);
|
||||
List<EvaluationVo> getEvaluationList(BaseQueryBo query);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
package org.dromara.scale.service.impl;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.scale.domain.bo.BaseQueryBo;
|
||||
import org.dromara.scale.domain.vo.StatisticNumVo;
|
||||
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
||||
import org.dromara.scale.mapper.StatisticMapper;
|
||||
import org.dromara.scale.mapper.SysScalePublishMapper;
|
||||
import org.dromara.scale.service.IStatisticService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>TODO<p>
|
||||
|
@ -23,51 +23,73 @@ import java.util.stream.Collectors;
|
|||
@Service
|
||||
public class StatisticService implements IStatisticService {
|
||||
|
||||
private final SysScalePublishMapper scalePublishMapper;
|
||||
private final StatisticMapper statisticMapper;
|
||||
|
||||
private final SysScalePublishMapper publishMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public StatisticNumVo getComplete4All(Long batchNo, Long scaleId) {
|
||||
StatisticNumVo all = scalePublishMapper.selectSingleAllAvaluation(batchNo);
|
||||
int total = all.getValue();
|
||||
StatisticNumVo already = scalePublishMapper.selectSingleCompleteAvaluation(batchNo, scaleId);
|
||||
int alreadyValue = already.getValue();
|
||||
all.setSpareValue(total - alreadyValue);
|
||||
return all;
|
||||
public StatisticNumVo getComplete4All(BaseQueryBo query) {
|
||||
Long batchNo = query.getBatchNo();
|
||||
Long scaleId = query.getScaleId();
|
||||
List<StatisticNumVo> list = statisticMapper.selectCompleteAvaluation(batchNo, scaleId);
|
||||
int complete = list.stream().mapToInt(StatisticNumVo::getValue).sum();
|
||||
int uncompleted = list.stream().mapToInt(StatisticNumVo::getSpareValue).sum();
|
||||
String deptName = publishMapper.selectDeptNameByBatchNo(batchNo);
|
||||
StatisticNumVo data = new StatisticNumVo();
|
||||
data.setName(deptName);
|
||||
data.setValue(complete);
|
||||
data.setSpareValue(uncompleted);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StatisticNumVo> getComplete4Class(Long batchNo, Long scaleId) {
|
||||
List<StatisticNumVo> all = scalePublishMapper.selectAllAvaluation(batchNo);
|
||||
Map<String, Integer> collect = all.stream().collect(Collectors.groupingBy(StatisticNumVo::getName,
|
||||
Collectors.collectingAndThen(Collectors.mapping(StatisticNumVo::getValue, Collectors.toList()),
|
||||
values -> values.get(0))));
|
||||
List<StatisticNumVo> completeList = scalePublishMapper.selectCompleteAvaluation(batchNo, scaleId);
|
||||
completeList.forEach(a -> {
|
||||
String name = a.getName();
|
||||
int total = collect.get(name);
|
||||
a.setSpareValue(total - a.getValue());
|
||||
});
|
||||
return completeList;
|
||||
public List<StatisticNumVo> getComplete4Class(BaseQueryBo query) {
|
||||
Long batchNo = query.getBatchNo();
|
||||
Long scaleId = query.getScaleId();
|
||||
return statisticMapper.selectCompleteAvaluation(batchNo, scaleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatisticWarnVo getWarn4All(Long batchNo, Long scaleId) {
|
||||
return scalePublishMapper.selectStatisticWarn(batchNo, scaleId);
|
||||
public StatisticWarnVo getWarn4All(BaseQueryBo query) {
|
||||
Long batchNo = query.getBatchNo();
|
||||
Long scaleId = query.getScaleId();
|
||||
List<StatisticWarnVo> list = statisticMapper.selectStatisticWarn(batchNo, scaleId);
|
||||
int noneNum = list.stream().mapToInt(StatisticWarnVo::getNoneNum).sum();
|
||||
int lowNum = list.stream().mapToInt(StatisticWarnVo::getLowNum).sum();
|
||||
int middleNum = list.stream().mapToInt(StatisticWarnVo::getMiddleNum).sum();
|
||||
int highNum = list.stream().mapToInt(StatisticWarnVo::getHighNum).sum();
|
||||
int majorNum = list.stream().mapToInt(StatisticWarnVo::getMajorNum).sum();
|
||||
String deptName = publishMapper.selectDeptNameByBatchNo(batchNo);
|
||||
StatisticWarnVo data = new StatisticWarnVo();
|
||||
data.setDeptName(deptName);
|
||||
data.setNoneNum(noneNum);
|
||||
data.setLowNum(lowNum);
|
||||
data.setMiddleNum(middleNum);
|
||||
data.setHighNum(highNum);
|
||||
data.setMajorNum(majorNum);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StatisticWarnVo> getWarn4Class(Long batchNo, Long scaleId) {
|
||||
return scalePublishMapper.selectStatisticWarn4Class(batchNo, scaleId);
|
||||
public List<StatisticWarnVo> getWarn4Class(BaseQueryBo query) {
|
||||
Long batchNo = query.getBatchNo();
|
||||
Long scaleId = query.getScaleId();
|
||||
return statisticMapper.selectStatisticWarn(batchNo, scaleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StatisticNumVo> getFactor4All(Long batchNo, Long scaleId) {
|
||||
public List<StatisticNumVo> getFactor4All(BaseQueryBo query) {
|
||||
Long batchNo = query.getBatchNo();
|
||||
Long scaleId = query.getScaleId();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StatisticNumVo> getFactor4Class(Long batchNo, Long scaleId) {
|
||||
public List<StatisticNumVo> getFactor4Class(BaseQueryBo query) {
|
||||
Long batchNo = query.getBatchNo();
|
||||
Long scaleId = query.getScaleId();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|||
import org.dromara.common.redis.utils.QueueUtils;
|
||||
import org.dromara.scale.constant.StatusEnum;
|
||||
import org.dromara.scale.domain.SysScalePublish;
|
||||
import org.dromara.scale.domain.bo.BaseQueryBo;
|
||||
import org.dromara.scale.domain.bo.SysScalePublishBo;
|
||||
import org.dromara.scale.domain.vo.EvaluationVo;
|
||||
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
||||
|
@ -170,24 +171,14 @@ public class SysScalePublishServiceImpl implements ISysScalePublishService {
|
|||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取量测进度
|
||||
*/
|
||||
@Override
|
||||
public List<EvaluationVo> getEvaluationList(Long batchNo, Long scaleId) {
|
||||
SysScalePublishVo scalePublishVo = baseMapper.selectVoById(batchNo);
|
||||
Long deptId = scalePublishVo.getDeptId();
|
||||
//为父级
|
||||
List<EvaluationVo> evaluationVos;
|
||||
if (deptService.isParent(deptId)) {
|
||||
evaluationVos = baseMapper.selectEvaluationVoList4Parent(batchNo, scaleId);
|
||||
} else {
|
||||
evaluationVos = baseMapper.selectEvaluationVoList(batchNo, scaleId);
|
||||
public List<EvaluationVo> getEvaluationList(BaseQueryBo query) {
|
||||
Long batchNo = query.getBatchNo();
|
||||
Long scaleId = query.getScaleId();
|
||||
Long deptId = query.getDeptId();
|
||||
return baseMapper.selectEvaluationVoList(batchNo, scaleId, deptId);
|
||||
}
|
||||
SysScaleVo sysScaleVo = scaleMapper.selectVoById(scaleId);
|
||||
evaluationVos.forEach(e -> {
|
||||
e.setScaleId(scaleId);
|
||||
e.setScaleName(sysScaleVo.getScaleName());
|
||||
e.setUsed(e.getRecordId() != null);
|
||||
});
|
||||
return evaluationVos;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<?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="org.dromara.scale.mapper.StatisticMapper">
|
||||
|
||||
<select id="selectCompleteAvaluation" resultType="org.dromara.scale.domain.vo.StatisticNumVo">
|
||||
select d.dept_name as `name`,
|
||||
count(if(er.status = 1, 1, null)) as value,
|
||||
count(if(er.status = 0, 1, null)) as spareValue
|
||||
from sys_evaluation_record er
|
||||
left join sys_dept d on d.dept_id = er.dept_id
|
||||
where er.batch_no = #{batchNo}
|
||||
and er.scale_id = #{scaleId}
|
||||
group by d.dept_id
|
||||
</select>
|
||||
|
||||
<select id="selectStatisticWarn" resultType="org.dromara.scale.domain.vo.StatisticWarnVo">
|
||||
select d.dept_name,
|
||||
count(if(sfr.situation = 1, 1, null)) as noneNum,
|
||||
count(if(sfr.situation = 2, 1, null)) as lowNum,
|
||||
count(if(sfr.situation = 3, 1, null)) as middleNum,
|
||||
count(if(sfr.situation = 4, 1, null)) as highNum,
|
||||
count(if(sfr.situation = 5, 1, null)) as majorNum
|
||||
from sys_evaluation_record er
|
||||
left join sys_dept d on d.dept_id = er.dept_id
|
||||
left join sys_evaluation_conclusion ec on ec.record_id = er.record_id
|
||||
left join sys_scale_factor_range sfr on sfr.range_id = ec.factor_range_id
|
||||
where er.batch_no = #{batchNo}
|
||||
and er.scale_id = #{scaleId}
|
||||
and er.status = 1
|
||||
and ec.status = 1
|
||||
group by d.dept_id
|
||||
</select>
|
||||
|
||||
<select id="selectStatisticFactor" resultType="org.dromara.scale.domain.vo.StatisticNumVo">
|
||||
select *
|
||||
from sys_evaluation_record er
|
||||
left join sys_dept d on find_in_set(er.dept_id, d.ancestors)
|
||||
left join sys_evaluation_conclusion ec on ec.record_id = er.record_id
|
||||
left join sys_scale_factor_range sfr on sfr.range_id = ec.factor_range_id
|
||||
where er.batch_no = #{batchNo}
|
||||
and er.scale_id = #{scaleId}
|
||||
and er.status = 1
|
||||
and ec.status = 1
|
||||
</select>
|
||||
</mapper>
|
|
@ -3,107 +3,31 @@
|
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.scale.mapper.SysScalePublishMapper">
|
||||
<select id="selectSingleAllAvaluation" resultType="org.dromara.scale.domain.vo.StatisticNumVo">
|
||||
select d.dept_name as `name`, count(u.user_id) as `value`
|
||||
from sys_scale_publish sp
|
||||
left join sys_dept d on d.dept_id = sp.dept_id
|
||||
left join sys_user u on find_in_set(u.dept_id, d.ancestors) and u.user_type = 'student'
|
||||
where sp.batch_no = #{batchNo}
|
||||
group by d.dept_id
|
||||
</select>
|
||||
|
||||
<select id="selectSingleCompleteAvaluation" resultType="org.dromara.scale.domain.vo.StatisticNumVo">
|
||||
select d.dept_name as `name`, count(er.record_id) as `value`
|
||||
from sys_scale_publish sp
|
||||
left join sys_dept d on d.dept_id = sp.dept_id
|
||||
left join sys_evaluation_record er on er.batch_no = sp.batch_no
|
||||
where sp.batch_no = #{batchNo}
|
||||
and er.scale_id = #{scaleId}
|
||||
group by d.dept_id
|
||||
</select>
|
||||
|
||||
<select id="selectAllAvaluation" resultType="org.dromara.scale.domain.vo.StatisticNumVo">
|
||||
select d.dept_name as `name`, count(u.user_id) as `value`
|
||||
from sys_scale_publish sp
|
||||
left join sys_dept d on d.parent_id = sp.dept_id
|
||||
left join sys_user u on u.dept_id = d.dept_id and u.user_type = 'student'
|
||||
where sp.batch_no = #{batchNo}
|
||||
group by d.dept_id
|
||||
</select>
|
||||
|
||||
<select id="selectCompleteAvaluation" resultType="org.dromara.scale.domain.vo.StatisticNumVo">
|
||||
select d.dept_name as `name`, count(er.record_id) as `value`
|
||||
from sys_scale_publish sp
|
||||
left join sys_dept d on d.parent_id = sp.dept_id
|
||||
left join sys_evaluation_record er on er.batch_no = sp.batch_no
|
||||
where sp.batch_no = #{batchNo}
|
||||
and er.scale_id = #{scaleId}
|
||||
group by d.dept_id
|
||||
</select>
|
||||
|
||||
<select id="selectEvaluationVoList" resultType="org.dromara.scale.domain.vo.EvaluationVo">
|
||||
select d.dept_id,
|
||||
d.dept_name,
|
||||
u.user_id,
|
||||
u.nick_name,
|
||||
er.record_id
|
||||
s.scale_id,
|
||||
s.scale_name,
|
||||
er.record_id,
|
||||
er.status
|
||||
from sys_evaluation_record er
|
||||
left join sys_scale s on s.scale_id = er.scale_id
|
||||
left join sys_dept d on d.dept_id = er.dept_id
|
||||
left join sys_user u on u.dept_id = d.dept_id
|
||||
where er.batch_no = #{batchNo}
|
||||
and er.scale_id = #{scaleId}
|
||||
<if test="deptId != null">
|
||||
and er.dept_id = #{deptId}
|
||||
</if>
|
||||
order by d.dept_id
|
||||
</select>
|
||||
|
||||
<select id="selectDeptNameByBatchNo" resultType="java.lang.String">
|
||||
select d.dept_name
|
||||
from sys_scale_publish sp
|
||||
left join sys_dept d on d.dept_id = sp.dept_id
|
||||
left join sys_user u on u.dept_id = d.dept_id and u.user_type = 'student'
|
||||
left join sys_evaluation_record er on er.user_id = u.user_id and er.scale_id = #{scaleId}
|
||||
where sp.batch_no = #{batchNo}
|
||||
</select>
|
||||
|
||||
<select id="selectEvaluationVoList4Parent" resultType="org.dromara.scale.domain.vo.EvaluationVo">
|
||||
select d.dept_id, d.dept_name, u.user_id, u.nick_name, er.record_id
|
||||
from sys_scale_publish sp
|
||||
left join sys_dept d on d.parent_id = sp.dept_id
|
||||
left join sys_user u on u.dept_id = d.dept_id and u.user_type = 'student'
|
||||
left join sys_evaluation_record er on er.user_id = u.user_id and er.scale_id = #{scaleId}
|
||||
where sp.batch_no = #{batchNo}
|
||||
</select>
|
||||
|
||||
<select id="selectStatisticWarn" resultType="org.dromara.scale.domain.vo.StatisticWarnVo">
|
||||
select d.dept_name,
|
||||
count(if(sfr.situation = 1,1,null)) as noneNum,
|
||||
count(if(sfr.situation = 2,1,null)) as lowNum,
|
||||
count(if(sfr.situation = 3,1,null)) as middleNum,
|
||||
count(if(sfr.situation = 4,1,null)) as highNum,
|
||||
count(if(sfr.situation = 5,1,null)) as majorNum
|
||||
from sys_scale_publish sp
|
||||
left join sys_dept d on d.dept_id = sp.dept_id
|
||||
left join sys_evaluation_record er on er.batch_no = sp.batch_no
|
||||
left join sys_evaluation_conclusion ec on ec.record_id = er.record_id
|
||||
left join sys_scale_factor_range sfr on sfr.range_id = ec.factor_range_id
|
||||
where sp.batch_no = #{batchNo}
|
||||
and er.scale_id = #{scaleId}
|
||||
and ec.status = 1
|
||||
group by d.dept_id
|
||||
</select>
|
||||
|
||||
<select id="selectStatisticWarn4Class" resultType="org.dromara.scale.domain.vo.StatisticWarnVo">
|
||||
select d.dept_name,
|
||||
count(if(sfr.situation = 1,1,null)) as noneNum,
|
||||
count(if(sfr.situation = 2,1,null)) as lowNum,
|
||||
count(if(sfr.situation = 3,1,null)) as middleNum,
|
||||
count(if(sfr.situation = 4,1,null)) as highNum,
|
||||
count(if(sfr.situation = 5,1,null)) as majorNum
|
||||
from sys_scale_publish sp
|
||||
left join sys_dept d on d.parent_id = sp.dept_id
|
||||
left join sys_evaluation_record er on er.batch_no = sp.batch_no
|
||||
left join sys_evaluation_conclusion ec on ec.record_id = er.record_id
|
||||
left join sys_scale_factor_range sfr on sfr.range_id = ec.factor_range_id
|
||||
where sp.batch_no = #{batchNo}
|
||||
and er.scale_id = #{scaleId}
|
||||
and ec.status = 1
|
||||
group by d.dept_id
|
||||
</select>
|
||||
|
||||
<select id="selectStatisticFactor" resultType="org.dromara.scale.domain.vo.StatisticNumVo">
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectStatisticFactor4Class" resultType="org.dromara.scale.domain.vo.StatisticNumVo">
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -119,6 +119,6 @@ public interface SysUserMapper extends BaseMapperPlus<SysUser, SysUserVo> {
|
|||
int updatePasswordBatchById(List<SysUserVo> list);
|
||||
|
||||
|
||||
List<SysUser> selectStudentListByDeptId(@Param("deptId") Long deptId,@Param("flag") boolean flag);
|
||||
List<SysUser> selectStudentListByDeptId(@Param("deptId") Long deptId,@Param("isParent") boolean isParent);
|
||||
|
||||
}
|
||||
|
|
|
@ -188,11 +188,12 @@
|
|||
from sys_dept d
|
||||
left join sys_user u on u.dept_id = d.dept_id
|
||||
<where>
|
||||
u.user_type = 'student'
|
||||
<choose>
|
||||
<when test="flag == true">
|
||||
d.parent_id = #{deptId}
|
||||
<when test="isParent == true">
|
||||
and d.parent_id = #{deptId}
|
||||
</when>
|
||||
<when test="flag != true">
|
||||
<when test="isParent == false">
|
||||
and d.dept_id = #{deptId}
|
||||
</when>
|
||||
<!-- 如果以上都不成立,则使用其他条件 -->
|
||||
|
|
Loading…
Reference in New Issue