hangzhoumesParent/common/servicebase/src/main/resources/mapper/LargenScreenMapper.xml
@@ -33,7 +33,7 @@ count_out_one, round(sum(t1.width * t1.height) / 1000000, 2) as total_area_out_one from edg_storage_device_task_history t inner join glass_info t1 on t.glass_id_in = t1.glass_id inner join glass_info t1 on t.glass_id_out = t1.glass_id where t.task_type in (2, 3) and STR_TO_DATE(t.create_time, '%Y-%m-%d') BETWEEN #{beginDate} and #{endDate} @@ -47,7 +47,7 @@ count_out_two, round(sum(t1.width * t1.height) / 1000000, 2) as total_area_out_two from edg_storage_device_task_history t inner join glass_info t1 on t.glass_id_in = t1.glass_id inner join glass_info t1 on t.glass_id_out = t1.glass_id where t.task_type in (2, 3) and STR_TO_DATE(t.create_time, '%Y-%m-%d') BETWEEN #{beginDate} and #{endDate} hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/opctask/controller/EdgStorageDeviceTaskHistoryController.java
@@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mes.largenscreen.entity.DailyProductionVO; import com.mes.opctask.entity.EdgStorageDeviceTaskHistory; import com.mes.opctask.entity.request.TaskHistoryRequest; import com.mes.opctask.service.EdgStorageDeviceTaskHistoryService; @@ -9,10 +10,12 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.List; /** * (EdgStorageDeviceTaskHistory)表控制层 @@ -36,5 +39,11 @@ return Result.success(edgStorageDeviceTaskHistoryService.queryEdgStorageDeviceTaskHistory(request)); } @ApiOperation(value = "查询本条线历史指定日期的日生产数据", notes = "查询本条线历史指定日期的日生产数据") @PostMapping("/queryEdgDailyProduction") public Result<DailyProductionVO> queryEdgDailyProduction(@RequestBody TaskHistoryRequest request) { return Result.success(edgStorageDeviceTaskHistoryService.queryEdgDailyProduction(request)); } } hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/opctask/mapper/EdgStorageDeviceTaskHistoryMapper.java
@@ -1,7 +1,9 @@ package com.mes.opctask.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.mes.largenscreen.entity.DailyProductionVO; import com.mes.opctask.entity.EdgStorageDeviceTaskHistory; import org.apache.ibatis.annotations.Param; /** * (EdgStorageDeviceTaskHistory)表数据库访问层 @@ -11,5 +13,6 @@ */ public interface EdgStorageDeviceTaskHistoryMapper extends BaseMapper<EdgStorageDeviceTaskHistory> { DailyProductionVO queryEdgDailyProduction(@Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("deviceId") Integer deviceId); } hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/opctask/service/EdgStorageDeviceTaskHistoryService.java
@@ -2,10 +2,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.mes.largenscreen.entity.DailyProductionVO; import com.mes.opctask.entity.EdgStorageDeviceTaskHistory; import com.mes.opctask.entity.request.TaskHistoryRequest; import java.util.List; /** * (EdgStorageDeviceTaskHistory)表服务接口 @@ -16,5 +15,7 @@ public interface EdgStorageDeviceTaskHistoryService extends IService<EdgStorageDeviceTaskHistory> { Page<EdgStorageDeviceTaskHistory> queryEdgStorageDeviceTaskHistory(TaskHistoryRequest request); DailyProductionVO queryEdgDailyProduction(TaskHistoryRequest request); } hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/opctask/service/impl/EdgStorageDeviceTaskHistoryServiceImpl.java
@@ -4,13 +4,14 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.mes.largenscreen.entity.DailyProductionVO; import com.mes.opctask.entity.EdgStorageDeviceTaskHistory; import com.mes.opctask.entity.request.TaskHistoryRequest; import com.mes.opctask.mapper.EdgStorageDeviceTaskHistoryMapper; import com.mes.opctask.service.EdgStorageDeviceTaskHistoryService; import org.springframework.stereotype.Service; import java.util.List; import java.text.SimpleDateFormat; /** * (EdgStorageDeviceTaskHistory)表服务实现类 @@ -36,5 +37,17 @@ } return this.page(page, wrapper); } @Override public DailyProductionVO queryEdgDailyProduction(TaskHistoryRequest request) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String beginDate = null; String endDate = null; if (StringUtils.checkValNotNull(request.getStartTime())) { beginDate = sdf.format(request.getStartTime()); endDate = sdf.format(request.getEndTime()); } return baseMapper.queryEdgDailyProduction(beginDate, endDate, request.getDeviceId()); } } hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/mapper/EdgStorageDeviceTaskHistoryMapper.xml
New file @@ -0,0 +1,41 @@ <?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="com.mes.opctask.mapper.EdgStorageDeviceTaskHistoryMapper"> <resultMap id="baseMap" type="com.mes.largenscreen.entity.DailyProductionVO"> <result column="date" property="date"/> <result column="count_out_one" property="countOutOne"/> <result column="total_area_out_one" property="totalAreaOutOne"/> <result column="count_out_two" property="countOutTwo"/> <result column="total_area_out_two" property="totalAreaOutTwo"/> <result column="count_in" property="countIn"/> <result column="total_area_in" property="totalAreaIn"/> <result column="count_out" property="countOut"/> <result column="total_area_out" property="totalAreaOut"/> <result column="hollow_count_out_one" property="hollowCountOutOne"/> <result column="hollow_total_area_out_one" property="hollowTotalAreaOutOne"/> <result column="hollow_count_out_two" property="hollowCountOutTwo"/> <result column="hollow_total_area_out_two" property="hollowTotalAreaOutTwo"/> </resultMap> <select id="queryEdgDailyProduction" resultMap="baseMap"> SELECT count( t.glass_id_out ) AS count_out_one, round( sum( t1.width * t1.height )/ 1000000, 2 ) AS total_area_out_one FROM edg_storage_device_task_history t INNER JOIN glass_info t1 ON t.glass_id_out = t1.glass_id WHERE t.task_type IN ( 2, 3 ) <if test="beginDate != null and beginDate != ''"> AND STR_TO_DATE( t.create_time, '%Y-%m-%d' ) BETWEEN #{beginDate} AND #{endDate} </if> <if test="deviceId != null and deviceId != 0"> AND device_id = #{deviceId} </if> </select> </mapper>