feat:pg数据库适配

pg_adapter
wangxy 5 months ago
parent 34e27ab031
commit 58e29cd915

@ -2,6 +2,7 @@ package com.ruoyi.web.controller.manager;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.ruoyi.system.domain.check.TdCheckReport;
import com.ruoyi.system.domain.count.ExamManagerDTO;
import com.ruoyi.system.domain.paper.dto.request.PaperListReqDTO;
import com.ruoyi.system.domain.paper.dto.response.PaperListRespDTO;
import com.ruoyi.system.domain.userexam.ElUserExam;
@ -103,7 +104,7 @@ public class UserExamManager {
return elUserExamService.selectCountExam();
}
public Integer countExamMonth(Date minDayTime, Date maxDayTime,Boolean passed){
public Integer countExamMonths(Date minDayTime, Date maxDayTime,Boolean passed){
return new LambdaQueryChainWrapper<>(elUserExamService.getBaseMapper())
.ge(ElUserExam::getUpdateTime, minDayTime)
.le(ElUserExam::getUpdateTime, maxDayTime)
@ -111,4 +112,9 @@ public class UserExamManager {
.count();
}
public Integer countExamMonth(ExamManagerDTO examManagerDTO){
return elUserExamService.countExamMonth(examManagerDTO);
}
}

@ -14,6 +14,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.ruoyi.common.utils.ObtainLastSixMonthsUtil;
import com.ruoyi.system.domain.check.TdCheckReport;
import com.ruoyi.system.domain.count.ExamManagerDTO;
import com.ruoyi.system.domain.userbook.dto.UserBookDTO;
import com.ruoyi.system.domain.userexam.dto.request.UserExamReqDTO;
import com.ruoyi.system.domain.userexam.dto.response.UserExamExportDTO;
@ -136,7 +137,11 @@ public class TdExamnumController extends BaseController {
date = Date.from(LocalDate.parse(month.concat(StrPool.DASHED).concat("01")).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
Date minDayTime = ObtainLastSixMonthsUtil.getStartOfDay(date);
AtomicReference<Long> yAxis = new AtomicReference<>(0L);
Integer count = userExamManager.countExamMonth(minDayTime, maxDayTime,true);
ExamManagerDTO examManagerDTO = new ExamManagerDTO();
examManagerDTO.setMinDayTime(minDayTime);
examManagerDTO.setMaxDayTime(maxDayTime);
examManagerDTO.setPassed(1);
Integer count = userExamManager.countExamMonth(examManagerDTO);
if(Objects.isNull(count)){
count = 0;
}
@ -169,7 +174,11 @@ public class TdExamnumController extends BaseController {
date = Date.from(LocalDate.parse(month.concat(StrPool.DASHED).concat("01")).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
Date minDayTime = ObtainLastSixMonthsUtil.getStartOfDay(date);
AtomicReference<Long> yAxis = new AtomicReference<>(0L);
Integer count = userExamManager.countExamMonth(minDayTime, maxDayTime,false);
ExamManagerDTO examManagerDTO = new ExamManagerDTO();
examManagerDTO.setMinDayTime(minDayTime);
examManagerDTO.setMaxDayTime(maxDayTime);
examManagerDTO.setPassed(0);
Integer count = userExamManager.countExamMonth(examManagerDTO);
if(Objects.isNull(count)){
count = 0;
}

@ -0,0 +1,31 @@
package com.ruoyi.system.domain.count;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* ClassName: PropertyManagerDTO
* Package: com.ruoyi.system.domain.count
* Description:
*
* @Author wangxy
* @Create 2024/10/8 16:21
* @Version 1.0
*/
@Data
@ApiModel(value="密品报废统计", description="密品报废统计")
public class ExamManagerDTO implements Serializable {
private Date minDayTime;
private Date maxDayTime;
private Integer passed;
}

@ -1,6 +1,7 @@
package com.ruoyi.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.domain.count.ExamManagerDTO;
import com.ruoyi.system.domain.userexam.ElUserExam;
import com.ruoyi.system.domain.userexam.dto.request.UserExamReqDTO;
import com.ruoyi.system.domain.userexam.dto.response.ExamCountDTO;
@ -8,6 +9,7 @@ import com.ruoyi.system.domain.userexam.dto.response.UserExamCountDTO;
import com.ruoyi.system.domain.userexam.dto.response.UserExamRespDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.Date;
import java.util.List;
/**
@ -28,6 +30,13 @@ public interface ElUserExamMapper extends BaseMapper<ElUserExam> {
public List<ExamCountDTO> selectCountExam();
public Integer countExamMonth(ExamManagerDTO examManagerDTO);
}

@ -1,6 +1,7 @@
package com.ruoyi.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.system.domain.count.ExamManagerDTO;
import com.ruoyi.system.domain.exam.dto.ExamDTO;
import com.ruoyi.system.domain.userexam.ElUserExam;
import com.ruoyi.system.domain.userexam.dto.request.UserExamReqDTO;
@ -8,6 +9,7 @@ import com.ruoyi.system.domain.userexam.dto.response.ExamCountDTO;
import com.ruoyi.system.domain.userexam.dto.response.UserExamCountDTO;
import com.ruoyi.system.domain.userexam.dto.response.UserExamRespDTO;
import java.util.Date;
import java.util.List;
/**
@ -27,4 +29,7 @@ public interface ElUserExamService extends IService<ElUserExam> {
public List<ExamCountDTO> selectCountExam();
public Integer countExamMonth(ExamManagerDTO examManagerDTO);
}

@ -1,6 +1,7 @@
package com.ruoyi.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.domain.count.ExamManagerDTO;
import com.ruoyi.system.domain.exam.dto.ExamDTO;
import com.ruoyi.system.domain.userexam.ElUserExam;
import com.ruoyi.system.domain.userexam.dto.request.UserExamReqDTO;
@ -12,6 +13,7 @@ import com.ruoyi.system.service.ElUserExamService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
@ -40,6 +42,11 @@ public class ElUserExamServiceImpl extends ServiceImpl<ElUserExamMapper, ElUserE
public List<ExamCountDTO> selectCountExam() {
return userExamMapper.selectCountExam();
}
@Override
public Integer countExamMonth(ExamManagerDTO examManagerDTO) {
return userExamMapper.countExamMonth(examManagerDTO);
}
}

@ -65,8 +65,11 @@
exam_id
ORDER BY u.create_time desc LIMIT 10
</select>
<select id="countExamMonth" resultType="java.lang.Integer" parameterType="ExamManagerDTO">
SELECT COUNT(*) FROM public.el_user_exam
WHERE update_time >= #{minDayTime} AND update_time &lt;= #{maxDayTime} AND passed = #{passed}
</select>
</mapper>

Loading…
Cancel
Save