forked from Big-Data-Lab/CET-cmd-2.0
代码优化
This commit is contained in:
parent
2a68bc53ee
commit
b1992d60e1
|
@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.dto.getRateByEntryDate;
|
||||
import org.jeecg.modules.dto.getRateByEntryDateDto;
|
||||
import org.jeecg.modules.dto.getRateByMajorAndLastestBatchDto;
|
||||
import org.jeecg.modules.entity.Cet_6;
|
||||
import org.jeecg.modules.service.CenterService;
|
||||
|
@ -139,14 +139,14 @@ public class CenterController {
|
|||
|
||||
|
||||
/**
|
||||
* @param getRateByEntryDateParams
|
||||
* @param getRateByEntryDateDtoParams
|
||||
* @return {@link Result }<{@link JSONObject }>
|
||||
*/
|
||||
@PostMapping( "/getRateByEntryDate")
|
||||
@ApiOperation(value = "根据学院/专业的每个年级的通过率")
|
||||
public Result<JSONObject> getRateByEntryDate(@RequestBody getRateByEntryDate getRateByEntryDateParams) {
|
||||
log.info("根据学院/专业的每个年级的通过率: {}", JSONObject.toJSONString(getRateByEntryDateParams));
|
||||
return cet4Service.getRateByEntryDate(getRateByEntryDateParams);
|
||||
public Result<JSONObject> getRateByEntryDate(@RequestBody getRateByEntryDateDto getRateByEntryDateDtoParams) {
|
||||
log.info("根据学院/专业的每个年级的通过率: {}", JSONObject.toJSONString(getRateByEntryDateDtoParams));
|
||||
return cet4Service.getRateByEntryDate(getRateByEntryDateDtoParams);
|
||||
}
|
||||
@GetMapping("/getTest")
|
||||
public Result<JSONObject> getTest() {
|
||||
|
|
|
@ -8,7 +8,7 @@ import javax.validation.constraints.NotBlank;
|
|||
|
||||
@ApiModel(value = "根据专业获取每个年级最新批次的通过率")
|
||||
@Data
|
||||
public class getRateByEntryDate {
|
||||
public class getRateByEntryDateDto {
|
||||
// @ApiModelProperty(value = "年级")
|
||||
// @NotBlank
|
||||
// String entrydate;
|
|
@ -3,7 +3,7 @@ package org.jeecg.modules.service;
|
|||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.dto.getRateByEntryDate;
|
||||
import org.jeecg.modules.dto.getRateByEntryDateDto;
|
||||
import org.jeecg.modules.dto.getRateByMajorAndLastestBatchDto;
|
||||
import org.jeecg.modules.entity.Cet_4;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
@ -30,5 +30,5 @@ public interface ICet_4Service extends IService<Cet_4> {
|
|||
|
||||
Result<JSONObject> getRateByMajorAndLastestBatch(getRateByMajorAndLastestBatchDto getRateByMajorAndLastestBatchParam);
|
||||
|
||||
Result<JSONObject> getRateByEntryDate(getRateByEntryDate getRateByEntryDateParams);
|
||||
Result<JSONObject> getRateByEntryDate(getRateByEntryDateDto getRateByEntryDateDtoParams);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.modules.dto.getRateByEntryDate;
|
||||
import org.jeecg.modules.dto.getRateByEntryDateDto;
|
||||
import org.jeecg.modules.dto.getRateByMajorAndLastestBatchDto;
|
||||
import org.jeecg.modules.entity.Cet4_major;
|
||||
import org.jeecg.modules.entity.CetClean;
|
||||
|
@ -614,12 +614,12 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result<JSONObject> getRateByEntryDate(getRateByEntryDate getRateByEntryDateParams) {
|
||||
public Result<JSONObject> getRateByEntryDate(getRateByEntryDateDto getRateByEntryDateDtoParams) {
|
||||
LambdaQueryWrapper<Cet_4> cet4Wrapper = new LambdaQueryWrapper<>();
|
||||
cet4Wrapper.eq(Cet_4::getCollege, getRateByEntryDateParams.getCollege());
|
||||
cet4Wrapper.eq(Cet_4::getCollege, getRateByEntryDateDtoParams.getCollege());
|
||||
//根据前端数据是否传major 判断是否添加 sql 条件
|
||||
if (getRateByEntryDateParams.getMajor() != null && !getRateByEntryDateParams.getMajor().isEmpty()) {
|
||||
cet4Wrapper.eq(Cet_4::getMajorname, getRateByEntryDateParams.getMajor());
|
||||
if (getRateByEntryDateDtoParams.getMajor() != null && !getRateByEntryDateDtoParams.getMajor().isEmpty()) {
|
||||
cet4Wrapper.eq(Cet_4::getMajorname, getRateByEntryDateDtoParams.getMajor());
|
||||
}
|
||||
//创建所以年级的list
|
||||
List<Map<String, Object>> maps = cet4Mapper.selectMaps(cet4Wrapper);
|
||||
|
@ -630,10 +630,10 @@ public class Cet_4ServiceImpl extends ServiceImpl<Cet_4Mapper, Cet_4> implements
|
|||
for (Map<String, Object> Date : entryDateList) {
|
||||
//当前年纪的总人数
|
||||
LambdaQueryWrapper<Cet_4> cet4StudentCount = new LambdaQueryWrapper<>();
|
||||
cet4StudentCount.eq(Cet_4::getCollege, getRateByEntryDateParams.getCollege())
|
||||
cet4StudentCount.eq(Cet_4::getCollege, getRateByEntryDateDtoParams.getCollege())
|
||||
.eq(Cet_4::getEntrydate, Date.get("entrydate"));
|
||||
if (getRateByEntryDateParams.getMajor() != null && !getRateByEntryDateParams.getMajor().isEmpty()) {
|
||||
cet4StudentCount.eq(Cet_4::getMajorname, getRateByEntryDateParams.getMajor());
|
||||
if (getRateByEntryDateDtoParams.getMajor() != null && !getRateByEntryDateDtoParams.getMajor().isEmpty()) {
|
||||
cet4StudentCount.eq(Cet_4::getMajorname, getRateByEntryDateDtoParams.getMajor());
|
||||
}
|
||||
long allStudentCount = cet4Mapper.selectCount(cet4StudentCount);
|
||||
// 统计当前 entryDate 下的通过人数
|
||||
|
|
Loading…
Reference in New Issue