作者 王勇

提交git做备份,为稍后修改做铺垫

... ... @@ -43,6 +43,12 @@ public class YardController {
return yardService.selectListByPage(yard, pageNum, pageSize);
}
@GetMapping("/list")
public ResultJson selectList()
{
return yardService.selectList();
}
/**
* 删除
* 条件:id
... ...
package com.sunyo.wlpt.station.manage.mapper;
import com.sunyo.wlpt.station.manage.domain.Yard;
import com.sunyo.wlpt.station.manage.response.ResultJson;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
... ... @@ -68,4 +70,19 @@ public interface YardMapper {
* @return
*/
List<Yard> selectListByPage(Yard yard);
/**
* 查询全部场站列表
*
* @return
*/
List<Yard> selectList();
/**
* 根据场站名称查询场站信息
*
* @param name 场站名称
* @return
*/
Yard selectByYardName(@Param("name") String name);
}
\ No newline at end of file
... ...
... ... @@ -68,4 +68,11 @@ public interface YardService {
* @return
*/
ResultJson selectListByPage(Yard yard, Integer pageNum, Integer pageSize);
/**
* 查询全部场站
*
* @return
*/
ResultJson selectList();
}
... ...
... ... @@ -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)
... ...
... ... @@ -98,4 +98,13 @@ public class YardServiceImpl implements YardService {
? ResultJson.success("200", "查询场站信息列表,成功!", pageInfo)
: ResultJson.error("500", "查询场站信息列表,失败!");
}
@Override
public ResultJson selectList()
{
List<Yard> yards = yardMapper.selectList();
return yards.size()>=0
? ResultJson.success("200", "查询场站信息列表,成功!", yards)
: ResultJson.error("500", "查询场站信息列表,失败!");
}
}
... ...
... ... @@ -65,7 +65,7 @@
<if test="stationName != null and stationName != ''">
and y.name = #{stationName,jdbcType=VARCHAR}
</if>
and b.yard_id = y.stationId
and b.yard_id = y.id
</where>
</select>
... ...
... ... @@ -30,6 +30,18 @@
where id = #{id,jdbcType=VARCHAR}
</select>
<select id="selectByYardName" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from yard
where name = #{name,jdbcType=VARCHAR}
</select>
<select id="selectList" parameterType="com.sunyo.wlpt.station.manage.domain.Yard" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from yard
</select>
<select id="selectListByPage" parameterType="com.sunyo.wlpt.station.manage.domain.Yard" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
... ...