| | |
| | | package com.whyc.service; |
| | | |
| | | import com.whyc.mapper.BattInfMapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.*; |
| | | import com.whyc.pojo.db_batt.BattInf; |
| | | import com.whyc.pojo.db_power_alarm.PowerAlarm; |
| | | import com.whyc.pojo.db_real_batt.RtData; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Service |
| | | public class BattInfService { |
| | | |
| | | @Autowired(required = false) |
| | | private BattInfMapper mapper; |
| | | } |
| | | |
| | | public Response add(BattInf battInf) { |
| | | mapper.insert(battInf); |
| | | return new Response().setII(1,"新增完成"); |
| | | } |
| | | |
| | | public Response delete(int battGroupId) { |
| | | mapper.deleteById(battGroupId); |
| | | return new Response().setII(1,"删除完成"); |
| | | } |
| | | |
| | | public Response update(BattInf battInf) { |
| | | mapper.updateById(battInf); |
| | | return new Response().setII(1,"修改完成"); |
| | | } |
| | | |
| | | public Response getPage(int pageNum, int pageSize) { |
| | | PageHelper helper = new PageHelper(); |
| | | helper.startPage(pageNum,pageSize); |
| | | List<BattInf> battInfs = mapper.selectList(null); |
| | | PageInfo<BattInf> pageInfo = new PageInfo<>(battInfs); |
| | | return new Response().set(1,pageInfo); |
| | | |
| | | } |
| | | |
| | | public BattInf getById(int battGroupId) { |
| | | return mapper.selectById(battGroupId); |
| | | |
| | | } |
| | | } |