whycxzp
2025-03-25 bf60848c0d97d3f440eee20719010e49bc2aae2d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.whyc.service;
 
import com.whyc.mapper.StationPowerRelationMapper;
import com.whyc.pojo.db_batt.StationPowerRelation;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
 
@Service
public class StationPowerRelationService {
 
    @Resource
    private StationPowerRelationMapper mapper;
 
    public void add(int stationId, int powerId) {
        StationPowerRelation relation = new StationPowerRelation();
        relation.setStationId(stationId);
        relation.setPowerId(powerId);
        //获取最大num
        int num = mapper.getMaxNum();
        relation.setNum(num+1);
        mapper.insert(relation);
    }
}