45 lines
1.4 KiB
Java
45 lines
1.4 KiB
Java
package com.mijiu.service;
|
|
|
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
|
import com.mijiu.common.exception.CustomException;
|
|
import com.mijiu.entity.site.GroutingStation;
|
|
import com.mijiu.mapper.GroutingStationMapper;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import java.util.List;
|
|
|
|
@Service
|
|
public class GroutingStationServiceImpl {
|
|
|
|
@Autowired
|
|
private GroutingStationMapper groutingStationMapper;
|
|
|
|
public GroutingStation getById(Long GS_Id) {
|
|
return groutingStationMapper.selectById(GS_Id);
|
|
}
|
|
|
|
public List<GroutingStation> getAll() {
|
|
return new LambdaQueryChainWrapper<>(groutingStationMapper).list();
|
|
}
|
|
|
|
public void save(GroutingStation groutingStation) {
|
|
int inserted = groutingStationMapper.insert(groutingStation);
|
|
if (inserted == 0) {
|
|
throw new CustomException("保存失败!");
|
|
}
|
|
}
|
|
|
|
public void update(GroutingStation groutingStation) {
|
|
int i = groutingStationMapper.updateById(groutingStation);
|
|
if (i == 0) {
|
|
throw new CustomException("更新失败!");
|
|
}
|
|
}
|
|
|
|
public void deleteById(Long GS_Id) {
|
|
int i = groutingStationMapper.deleteById(GS_Id);
|
|
if (i == 0) {
|
|
throw new CustomException("删除失败!");
|
|
}
|
|
}
|
|
} |