whycrzg
2021-02-23 351b9a53cb9ecebdf8f79db0117f540d9c42c2a4
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
package com.fgkj.mapper.impl;
 
import java.util.List;
 
import com.fgkj.dto.BattInf;
import com.fgkj.dto.Batt_Devdischarge;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
 
public interface Batt_DevdischargeMapper{
 
    @Insert("insert into web_site.tb_batt_devdischarge_cm(dev_id,dev_name,dev_recordtime,dev_vol,dev_curr,dev_power,note) " +
            "VALUES (#{dev_id},#{dev_name},#{dev_recordtime}, #{dev_vol}, #{dev_curr}, #{dev_power}, #{note})")
    public int add(Batt_Devdischarge devdischarge);
 
    @Update("update web_site.tb_batt_devdischarge_cm set dev_id=#{dev_id},dev_name=#{dev_name},dev_recordtime=#{dev_recordtime},dev_vol=#{dev_vol},dev_curr=#{dev_curr},dev_power=#{dev_power},note=#{note} where num=#{num}")
    public int update(Batt_Devdischarge devdischarge);
 
    @Delete("delete from web_site.tb_batt_devdischarge_cm where num=#{num}")
    public int del(Batt_Devdischarge devdischarge);
 
 
    //TODO tb_batt_devdischarge_cm tb_batt_devdischarge不存在
    @Select("select num,dev_id,dev_name,dev_recordtime,dev_vol,dev_curr,dev_power,note from web_site.tb_batt_devdischarge_cm")
    public List<Batt_Devdischarge> searchAll() ;
 
    //10.1根据设备id连battinf和batt_devdischarge表
    /*
     * 记录时间放在battinf的battproducer
     **/
    public List serchByCondition(BattInf obj);
 
    @Select(" SELECT COUNT(tb_batt_devdischarge_CM.record_num) AS dev_curr,MAX(tb_batt_devdischarge_CM.record_num) AS dev_power,MIN(tb_batt_devdischarge_CM.record_num) AS dev_vol  " +
            "FROM web_site.tb_batt_devdischarge_CM,(select DISTINCT(FBSdeviceid),FBSDeviceName from db_battinf.tb_battinf where stationid=#{stationId})  as DISTINCTbattinf  "+
            " WHERE DISTINCTbattinf.FBSdeviceid=tb_batt_devdischarge_CM.dev_id and web_site.tb_batt_devdischarge_CM.dev_recordtime >= #{battProductDate} and web_site.tb_batt_devdischarge_CM.dev_recordtime <= #{battProductDate1} LIMIT 1")
    public List<Batt_Devdischarge> serchMaxAndMinNum(BattInf obj);
 
    /*public static void main(String[] args) throws ParseException {
        Batt_DevdischargeImpl bimpl=new Batt_DevdischargeImpl();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date date1 = sdf.parse("2000-01-01");
        Date date2 = sdf.parse("2020-01-01");
        BattInf binf=new BattInf();
        binf.setStationId("42070450");
        binf.setStationName("湖北省-鄂州市-东方世纪城-设备1");
        binf.setStationName1("");
        binf.setBattProducer("");
        binf.setMonCount(1);
        binf.setBattProductDate(ActionUtil.getSimpDate(date1));
        binf.setBattProductDate1(ActionUtil.getSimpDate(date2));
        List<Batt_Devdischarge_all> list=bimpl.serchByCondition(binf);
        for (Batt_Devdischarge_all b : list) {
            System.out.println(b);
        }
        System.out.println(list.size());
        
    }*/
    
}