fg电池监控平台的达梦数据库版本
whycxzp
2024-11-12 3c51c159a12f820c335af6b969d0c73eac798b94
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?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.whyc.mapper.FaultUploadMapper" >
 
 
    <select id="getList" resultType="com.whyc.pojo.FaultUpload">
        SELECT distinct
            u.*,s.StationName as station_name,s.StationName3 as station_name3
        FROM
            web_site.tb_fault_upload u,
            db_battinf.tb_station_inf s
        WHERE
            u.station_id = s.StationId
 
        <if test="upload.uploadStartTime !=null and upload.uploadStartTime!=''">
            and u.create_time &gt;= #{upload.uploadStartTime}
        </if>
        <if test="upload.uploadEndTime !=null and upload.uploadEndTime!=''">
            and u.create_time &lt;= #{upload.uploadEndTime}
        </if>
 
 
        <if test="upload.confirmStartTime !=null and upload.confirmStartTime!=''">
            and u.confirm_time &gt;= #{upload.confirmStartTime}
        </if>
        <if test="upload.confirmEndTime !=null and upload.confirmEndTime!=''">
            and u.confirm_time &lt;= #{upload.confirmEndTime}
        </if>
 
        <if test="upload.type !=null and upload.type !=0">
            and u.type = #{upload.type}
        </if>
        and
            station_id in
            (
                select distinct stationId
                from db_user.tb_user_battgroup_baojigroup_battgroup
                , db_user.tb_user_battgroup_baojigroup_usr
                , db_user.tb_user_inf
                where db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id =
                db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id
                and db_user.tb_user_inf.uid = db_user.tb_user_battgroup_baojigroup_usr.uid
                and db_user.tb_user_inf.uid = #{userId}
            )
    </select>
    <select id="getList2" resultType="com.whyc.pojo.FaultUpload">
        SELECT distinct
            u.*,s.StationName as station_name,s.StationName3 as station_name3,g.baoji_group_name as group_name
        FROM
            web_site.tb_fault_upload u,
            db_battinf.tb_station_inf s,
            db_user.tb_user_battgroup_baojigroup_usr gu,
            db_user.tb_user_battgroup_baojigroup g
        WHERE
            u.station_id = s.StationId
        and u.upload_user_id = gu.uId
        and gu.baoji_group_id = g.baoji_group_id
 
        <if test="upload.uploadStartTime !=null and upload.uploadStartTime!=''">
            and u.create_time &gt;= #{upload.uploadStartTime}
        </if>
        <if test="upload.uploadEndTime !=null and upload.uploadEndTime!=''">
            and u.create_time &lt;= #{upload.uploadEndTime}
        </if>
 
 
        <if test="upload.confirmStartTime !=null and upload.confirmStartTime!=''">
            and u.confirm_time &gt;= #{upload.confirmStartTime}
        </if>
        <if test="upload.confirmEndTime !=null and upload.confirmEndTime!=''">
            and u.confirm_time &lt;= #{upload.confirmEndTime}
        </if>
 
        <if test="upload.type !=null and upload.type !=0">
            and u.type = #{upload.type}
        </if>
        <if test="upload.groupName !=null and upload.groupName !=''">
            and g.baoji_group_name = #{upload.groupName}
        </if>
        and
            station_id in
            (
                select distinct stationId
                from db_user.tb_user_battgroup_baojigroup_battgroup
                , db_user.tb_user_battgroup_baojigroup_usr
                , db_user.tb_user_inf
                where db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id =
                db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id
                and db_user.tb_user_inf.uid = db_user.tb_user_battgroup_baojigroup_usr.uid
                and db_user.tb_user_inf.uid = #{userId}
            )
    </select>
    <select id="getListWithGroupName" resultType="com.whyc.pojo.FaultUpload">
        SELECT distinct
            u.*,usr.uName as upload_user_name,g.baoji_group_name as group_name
        FROM
            web_site.tb_fault_upload u,
            db_user.tb_user_battgroup_baojigroup_battgroup bb,
            db_user.tb_user_battgroup_baojigroup g,
            db_user.tb_user_inf usr
        WHERE
            u.station_id = bb.StationId
        and bb.baoji_group_id = g.baoji_group_id
        and u.upload_user_id = usr.uId
        and g.discharge_plan_flag = 1
        and u.create_time like  CONCAT('%',#{year},'%')
        and station_id in
        (
            select distinct stationId
            from db_user.tb_user_battgroup_baojigroup_battgroup
            , db_user.tb_user_battgroup_baojigroup_usr
            , db_user.tb_user_inf
            where db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id =
            db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id
            and db_user.tb_user_inf.uid = db_user.tb_user_battgroup_baojigroup_usr.uid
            and db_user.tb_user_inf.uid = #{userId}
        )
    </select>
</mapper>