...
|
...
|
@@ -3,6 +3,7 @@ package com.sunyo.wlpt.station.manage.service.impl; |
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.sunyo.wlpt.station.manage.domain.Yard;
|
|
|
import com.sunyo.wlpt.station.manage.mapper.YardMapper;
|
|
|
import com.sunyo.wlpt.station.manage.response.ResultJson;
|
|
|
import com.sunyo.wlpt.station.manage.utils.IdUtils;
|
|
|
import org.springframework.stereotype.Service;
|
...
|
...
|
@@ -25,6 +26,8 @@ public class BayonetServiceImpl implements BayonetService { |
|
|
|
|
|
@Resource
|
|
|
private BayonetMapper bayonetMapper;
|
|
|
@Resource
|
|
|
private YardMapper yardMapper;
|
|
|
|
|
|
/**
|
|
|
* 删除卡口信息
|
...
|
...
|
@@ -55,6 +58,8 @@ public class BayonetServiceImpl implements BayonetService { |
|
|
@Override
|
|
|
public ResultJson insertSelective(Bayonet bayonet)
|
|
|
{
|
|
|
Yard yard = yardMapper.selectByYardName(bayonet.getStationName());
|
|
|
bayonet.setYardId(yard.getId());
|
|
|
bayonet.setId(IdUtils.generateId());
|
|
|
return bayonetMapper.insertSelective(bayonet) > 0
|
|
|
? ResultJson.success("200", "新增卡口信息,成功")
|
...
|
...
|
@@ -76,6 +81,8 @@ public class BayonetServiceImpl implements BayonetService { |
|
|
@Override
|
|
|
public ResultJson updateByPrimaryKeySelective(Bayonet bayonet)
|
|
|
{
|
|
|
Yard yard = yardMapper.selectByYardName(bayonet.getStationName());
|
|
|
bayonet.setYardId(yard.getId());
|
|
|
return bayonetMapper.updateByPrimaryKeySelective(bayonet) > 0
|
|
|
? ResultJson.success("200", "编辑卡口信息,成功")
|
|
|
: ResultJson.error("500", "编辑卡口信息,失败");
|
...
|
...
|
@@ -100,6 +107,11 @@ public class BayonetServiceImpl implements BayonetService { |
|
|
{
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
List<Bayonet> bayonetList = bayonetMapper.selectListByPage(bayonet);
|
|
|
|
|
|
bayonetList.stream().parallel().forEach(item -> {
|
|
|
item.setStationName(yardMapper.selectByPrimaryKey(item.getYardId()).getName());
|
|
|
});
|
|
|
|
|
|
PageInfo<Bayonet> pageInfo = new PageInfo<>(bayonetList);
|
|
|
return pageInfo.getTotal() >= 0
|
|
|
? ResultJson.success("200", "查询卡口信息列表,成功!", pageInfo)
|
...
|
...
|
|