| | |
| | | <select id="getLastData" resultType="org.jeecg.modules.mdc.entity.MdcProcessCount"> |
| | | SELECT TOP 1 * FROM mdc_process_count WHERE equipment_id = #{equipmentId} ORDER BY the_date DESC |
| | | </select> |
| | | |
| | | <!--分页查询--> |
| | | <select id="pageList" resultType="org.jeecg.modules.mdc.dto.MdcProcessCountDto"> |
| | | SELECT |
| | | t1.equipment_id equipmentId, |
| | | MAX(t1.equipment_name) equipmentName, |
| | | MAX(t2.drive_type) driveType, |
| | | t1.the_date theDate, |
| | | t1.sequence_number sequenceNumber, |
| | | COUNT(*) processCount, |
| | | SUM(t1.duration) duration |
| | | FROM |
| | | mdc_process_count t1 |
| | | LEFT JOIN mdc_equipment t2 ON t1.equipment_id = t2.equipment_id |
| | | <where> |
| | | <if test="mdcProcessCountVo.equipmentId != null and mdcProcessCountVo.equipmentId != ''"> |
| | | AND t1.equipment_id = #{ mdcProcessCountVo.equipmentId } |
| | | </if> |
| | | <if test="mdcProcessCountVo.equipmentName != null and mdcProcessCountVo.equipmentName != ''"> |
| | | AND t1.equipment_name LIKE CONCAT(CONCAT('%',#{mdcProcessCountVo.equipmentName}),'%') |
| | | </if> |
| | | <if test="mdcProcessCountVo.driveType != null and mdcProcessCountVo.driveType != ''"> |
| | | AND t2.drive_type = #{ mdcProcessCountVo.driveType } |
| | | </if> |
| | | <if test="mdcProcessCountVo.startTime != null and mdcProcessCountVo.startTime != '' and mdcProcessCountVo.endTime != '' and mdcProcessCountVo.endTime != null"> |
| | | AND t1.the_date BETWEEN #{ mdcProcessCountVo.startTime } AND #{ mdcProcessCountVo.endTime } |
| | | </if> |
| | | <if test="mdcProcessCountVo.mdcSectionIds != null and mdcProcessCountVo.mdcSectionIds.size() > 0 "> |
| | | AND t1.equipment_id IN |
| | | <foreach collection="mdcProcessCountVo.mdcSectionIds" item="id" index="index" open="(" close=")" separator=","> |
| | | #{ id } |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | t1.equipment_id, |
| | | t1.the_date, |
| | | t1.sequence_number |
| | | </select> |
| | | </mapper> |