| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.whyc.dto.A059StationInfDTO; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.BattInfMapper; |
| | | import com.whyc.pojo.Battinf; |
| | | import com.whyc.pojo.UserInf; |
| | | import com.whyc.service.A059StationInfService; |
| | | import com.whyc.service.BattInfService; |
| | | import com.whyc.util.ActionUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @Api(tags = "配置信息-A059") |
| | |
| | | public class A059StationInfController { |
| | | @Resource |
| | | private A059StationInfService service; |
| | | @Resource |
| | | private BattInfService battInfService; |
| | | @Resource |
| | | private BattInfMapper battInfMapper; |
| | | |
| | | @GetMapping("/getAll") |
| | | @ApiOperation("获取A059配置信息") |
| | | public Response<A059StationInfDTO> getA059StationInfList(@RequestParam int pageNum, @RequestParam int pageSize){ |
| | | return service.getA059StationInfListAndBattInf(pageNum,pageSize); |
| | | public Response getA059StationInfList(@RequestParam int pageNum, @RequestParam int pageSize,@RequestParam String province,@RequestParam String city,@RequestParam String county){ |
| | | return service.getA059StationInfListAndBattInf(pageNum,pageSize,province,city,county); |
| | | } |
| | | |
| | | @PostMapping("/importBatt") |
| | | @ApiOperation("新增电池组并更新原先对应设备编号为0") |
| | | public Response addBattAndUpdateDevNum(@RequestBody Battinf battinf){ |
| | | UserInf userInf = (UserInf) ActionUtil.getUser(); |
| | | QueryWrapper<Battinf> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("dev_num",battinf.getDevNum()); |
| | | List<Battinf> list = battInfMapper.selectList(queryWrapper); |
| | | for (Battinf batt:list) { |
| | | batt.setDevNum(0+""); |
| | | battInfMapper.updateById(batt); |
| | | } |
| | | return battInfService.add(battinf,userInf.getUId().intValue()); |
| | | } |
| | | |
| | | } |