feiyu02
2022-10-21 f22c4b9230808fed4fec80c435eccb4c833349a0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package cn.flightfeather.supervision.lightshare.service.Impl
 
import cn.flightfeather.supervision.domain.entity.Problem
import cn.flightfeather.supervision.domain.mapper.BaseInfoMapper
import cn.flightfeather.supervision.domain.mapper.ProblemMapper
import cn.flightfeather.supervision.lightshare.service.ProblemService
import org.springframework.stereotype.Service
import tk.mybatis.mapper.entity.Example
import java.util.*
 
@Service
class ProblemServiceImpl(
        val problemMapper: ProblemMapper,
        val baseInfoMapper: BaseInfoMapper
): ProblemService {
 
    override fun getProblemsByPeriod(userId: String, year: Int, month: Int): List<Problem> {
        val baseInfo = baseInfoMapper.selectByPrimaryKey(userId)
 
        val startTime = Calendar.getInstance().apply {
            set(year, month-1, 1, 0, 0, 0)
        }.time
        val endTime = Calendar.getInstance().apply {
            set(year, month-1, 30, 0, 0, 0)
        }.time
 
        return problemMapper.selectByExample(Example(Problem::class.java).apply {
            createCriteria().andEqualTo("prSceneId", baseInfo.biGuid)
                    .andBetween("prInspectionPeriod", startTime, endTime)
        })
    }
}