wangfei
2025-04-15 cd7f3fa89aed4e7a4b87c0ee4164cd606103b318
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.mes.temperingglass.mapper;
 
import com.baomidou.dynamic.datasource.annotation.DS;
import com.github.yulichang.base.MPJBaseMapper;
import com.mes.largenscreen.entity.PieChartVO;
import com.mes.temperingglass.entity.TemperingGlassInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
 
import java.util.List;
 
/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author zhoush
 * @since 2024-04-07
 */
@DS("salve_northGlassMes")
public interface TemperingGlassInfoMapper extends MPJBaseMapper<TemperingGlassInfo> {
 
    boolean saveBatch(@Param(value = "list") List<TemperingGlassInfo> list);
    //绕过全局逻辑进行查询
    @Select("SELECT * FROM tempering_glass_info " + "WHERE tempering_layout_id = #{temperingLayoutId} " + "AND engineer_id = #{engineerId} " + "ORDER BY tempering_layout_id DESC, tempering_feed_sequence ASC")
    List<TemperingGlassInfo> selectByEngineerIdAndLayoutId(String engineerId, Integer temperingLayoutId);
    //绕过全局逻辑进行修改
    @Update("UPDATE tempering_glass_info " +
            "SET state = #{state}, " +
            "deleted = CASE WHEN #{state} < 8 THEN 0 ELSE deleted END " +
            "WHERE glass_id = #{glassId}")
    Integer updateTemperingGlassInfo(TemperingGlassInfo temperingGlassInfo);
 
    @Select("SELECT\n" +
            "\tround( SUM ( CASE WHEN state <> - 1 AND state <> 8 THEN 1 ELSE 0 END ), 2 ) AS oneCompletedQuantity,\n" +
            "\tround( SUM ( CASE WHEN state <> - 1 AND state <> 8 THEN CAST ( width AS FLOAT ) * height / 1000000 ELSE 0 END ), 2 ) AS oneCompletedArea,\n" +
            "\tround( SUM ( CASE WHEN state = 8 THEN 1 ELSE 0 END ), 2 ) AS oneDamageQuantity,\n" +
            "\tround( SUM ( CASE WHEN state = 8 THEN CAST ( width AS FLOAT ) * height / 1000000 ELSE 0 END ), 2 ) AS oneDamageArea,\n" +
            "\tround( SUM ( CASE WHEN state = - 1 THEN 1 ELSE 0 END ), 2 ) AS oneUncompletedQuantity,\n" +
            "\tround(SUM ( CASE WHEN state = - 1 THEN CAST ( width AS FLOAT ) * height / 1000000 ELSE 0 END ), 2 ) AS oneUncompletedArea \n" +
            "FROM\n" +
            "\ttempering_glass_info \n" +
            "WHERE\n" +
            "\tCONVERT ( DATE, create_time ) = CONVERT ( DATE, getdate( ) )")
    List<PieChartVO> queryPieChart();
}