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
package com.fgkj.mapper.impl;
 
import java.util.List;
 
import com.fgkj.dto.BattInf;
import com.fgkj.dto.User_battgroup_baojigroup;
import com.fgkj.dto.User_inf;
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 User_battgroup_baojigroupMapper {
 
    //5.3添加新包机组
    @Insert("insert into db_user.tb_user_battgroup_baojigroup(baoji_group_name) values(#{baoji_group_id})")
    public int add(User_battgroup_baojigroup obj) ;
    //5.3修改包机组名
    @Update("update db_user.tb_user_battgroup_baojigroup set baoji_group_name=#{baoji_group_name} where baoji_group_id=#{baoji_group_id}")
    public int update(User_battgroup_baojigroup obj) ;
    
    //5.3删除包机组
    public boolean del(Object obj) ;
 
    //5.3删除包机组(多表删除事务回滚)
    @Delete("delete db_user.tb_user_battgroup_baojigroup from db_user.tb_user_battgroup_baojigroup where baoji_group_id=#{baoji_group_id}")
    public int delPro(User_battgroup_baojigroup obj) ;
 
    //5.3查所有包机组
    @Select("select baoji_group_id,baoji_group_name from db_user.tb_user_battgroup_baojigroup")
    public List<User_battgroup_baojigroup> searchAll() ;
 
    //5.3根据包机组id查包机组对应的用户
    @Select("select  distinct(db_user.tb_user_inf.uid) ,db_user.tb_user_inf.uName,db_user.tb_user_battgroup_baojigroup_usr.num " +
            "from db_user.tb_user_inf,db_user.tb_user_battgroup_baojigroup,db_user.tb_user_battgroup_baojigroup_usr " +
            "where db_user.tb_user_battgroup_baojigroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id  " +
            "and db_user.tb_user_battgroup_baojigroup_usr.uId=db_user.tb_user_inf.uId " +
            "and db_user.tb_user_battgroup_baojigroup.baoji_group_id=#{baoji_group_id} " +
            "order by db_user.tb_user_inf.uid")
    public List<User_inf> serchByCondition(User_battgroup_baojigroup obj) ;
 
    //5.3根据包机组id查对应的机房和电池组
    @Select("select  distinct(db_battinf.tb_battinf.BattGroupId)" +
            ",db_battinf.tb_battinf.stationid,db_battinf.tb_battinf.BattGroupId,db_battinf.tb_battinf.StationName,db_battinf.tb_battinf.BattGroupName,db_battinf.tb_battinf.fBSDeviceId " +
            "from db_battinf.tb_battinf,db_user.tb_user_battgroup_baojigroup,db_user.tb_user_battgroup_baojigroup_battgroup " +
            "where  db_user.tb_user_battgroup_baojigroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id " +
            "and db_user.tb_user_battgroup_baojigroup_battgroup.stationid=db_battinf.tb_battinf.stationid " +
            "and db_user.tb_user_battgroup_baojigroup.baoji_group_id=#{baoji_group_id}  and db_user.tb_user_battgroup_baojigroup_battgroup.BattGroupId = db_battinf.tb_battinf.BattGroupId " +
            "order by db_battinf.tb_battinf.BattGroupId")
    public List<BattInf> serchByInfo(User_battgroup_baojigroup obj) ;
 
}