Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
joylink_zhangsai 2021-05-27 17:48:31 +08:00
commit cd5adce755
5 changed files with 140 additions and 5 deletions

View File

@ -0,0 +1,40 @@
package club.joylink.rtss.controller.draft;
import club.joylink.rtss.services.draftData.DraftMapFlsService;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.newmap.MapRouteFlankProtectionNewVO;
import club.joylink.rtss.vo.client.map.newmap.MapRouteFlankProtectionQueryVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/draftMap/{id}/fls")
@Slf4j
public class DraftMapFlsController {
@Autowired
private DraftMapFlsService draftMapFlsService;
@GetMapping("/paging")
public PageVO<MapRouteFlankProtectionNewVO> pagingQuery(@PathVariable Long id, MapRouteFlankProtectionQueryVO queryVO) {
return this.draftMapFlsService.pagingQuery(id, queryVO);
}
@GetMapping("/all")
public List<MapRouteFlankProtectionNewVO> queryAll(@PathVariable Long id) {
return this.draftMapFlsService.queryAll(id);
}
@PutMapping("/{code}")
public void update(@PathVariable Long id, @PathVariable String code, @RequestBody MapRouteFlankProtectionNewVO vo) {
this.draftMapFlsService.update(id, code, vo);
}
@DeleteMapping("/{code}")
public void delete(@PathVariable Long id, @PathVariable String code) {
this.draftMapFlsService.delete(id, code);
}
}

View File

@ -0,0 +1,17 @@
package club.joylink.rtss.services.draftData;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.newmap.MapRouteFlankProtectionNewVO;
import club.joylink.rtss.vo.client.map.newmap.MapRouteFlankProtectionQueryVO;
import java.util.List;
public interface DraftMapFlsService {
PageVO<MapRouteFlankProtectionNewVO> pagingQuery(Long id, MapRouteFlankProtectionQueryVO queryVO);
List<MapRouteFlankProtectionNewVO> queryAll(Long id);
void update(Long id, String code, MapRouteFlankProtectionNewVO vo);
void delete(Long id, String code);
}

View File

@ -0,0 +1,78 @@
package club.joylink.rtss.services.draftData;
import club.joylink.rtss.dao.DraftMapRouteFlankProtectionDAO;
import club.joylink.rtss.entity.DraftMapRouteFlankProtection;
import club.joylink.rtss.entity.DraftMapRouteFlankProtectionExample;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.map.newmap.MapRouteFlankProtectionNewVO;
import club.joylink.rtss.vo.client.map.newmap.MapRouteFlankProtectionQueryVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class DraftMapFlsServiceImpl implements DraftMapFlsService {
@Autowired
private DraftMapRouteFlankProtectionDAO draftMapRouteFlankProtectionDAO;
@Override
public PageVO<MapRouteFlankProtectionNewVO> pagingQuery(Long id, MapRouteFlankProtectionQueryVO queryVO) {
PageHelper.startPage(queryVO.getPageNum(), queryVO.getPageSize());
DraftMapRouteFlankProtectionExample example = new DraftMapRouteFlankProtectionExample();
DraftMapRouteFlankProtectionExample.Criteria criteria = example.createCriteria()
.andMapIdEqualTo(id);
if (StringUtils.hasText(queryVO.getName())) {
criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
}
if (StringUtils.hasText(queryVO.getCode())) {
criteria.andCodeLike(String.format("%%%s%%", queryVO.getCode()));
}
Page<DraftMapRouteFlankProtection> mapOverlaps = (Page<DraftMapRouteFlankProtection>) this.draftMapRouteFlankProtectionDAO.selectByExampleWithBLOBs(example);
List<MapRouteFlankProtectionNewVO> voList = mapOverlaps.getResult().stream()
.map(MapRouteFlankProtectionNewVO::convert2VO).collect(Collectors.toList());
return PageVO.convert(mapOverlaps, voList);
}
@Override
public List<MapRouteFlankProtectionNewVO> queryAll(Long id) {
DraftMapRouteFlankProtectionExample example = new DraftMapRouteFlankProtectionExample();
example.createCriteria()
.andMapIdEqualTo(id);
List<DraftMapRouteFlankProtection> flsList = this.draftMapRouteFlankProtectionDAO.selectByExampleWithBLOBs(example);
return flsList.stream()
.map(MapRouteFlankProtectionNewVO::convert2VO).collect(Collectors.toList());
}
@Override
public void update(Long id, String code, MapRouteFlankProtectionNewVO vo) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(vo.getName());
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertCollectionNotEmpty(vo.getLevel1List());
DraftMapRouteFlankProtectionExample example = new DraftMapRouteFlankProtectionExample();
example.createCriteria()
.andMapIdEqualTo(id)
.andCodeEqualTo(code);
List<DraftMapRouteFlankProtection> flsList = this.draftMapRouteFlankProtectionDAO.selectByExampleWithBLOBs(example);
BusinessExceptionAssertEnum.DATA_NOT_EXIST.assertCollectionNotEmpty(flsList);
MapRouteFlankProtectionNewVO update = MapRouteFlankProtectionNewVO.convert2VO(flsList.get(0));
update.setName(vo.getName());
update.setLevel1List(vo.getLevel1List());
update.setLevel2List(vo.getLevel2List());
DraftMapRouteFlankProtection db = update.convert2Draft();
this.draftMapRouteFlankProtectionDAO.updateByPrimaryKeyWithBLOBs(db);
}
@Override
public void delete(Long id, String code) {
BusinessExceptionAssertEnum.ARGUMENT_ILLEGAL.assertHasText(code);
DraftMapRouteFlankProtectionExample example = new DraftMapRouteFlankProtectionExample();
example.createCriteria()
.andMapIdEqualTo(id)
.andCodeEqualTo(code);
this.draftMapRouteFlankProtectionDAO.deleteByExample(example);
}
}

View File

@ -1,7 +1,7 @@
package club.joylink.rtss.vo; package club.joylink.rtss.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import club.joylink.rtss.vo.client.PageQueryVO; import club.joylink.rtss.vo.client.PageQueryVO;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Getter; import lombok.Getter;

View File

@ -10,12 +10,12 @@ import lombok.Setter;
@Setter @Setter
@ApiModel(value = "侧防查询") @ApiModel(value = "侧防查询")
public class MapRouteFlankProtectionQueryVO extends PageQueryVO { public class MapRouteFlankProtectionQueryVO extends PageQueryVO {
//
@ApiModelProperty(value = "联锁车站唯一编码") // @ApiModelProperty(value = "联锁车站唯一编码")
private String stationCode; // private String stationCode;
@ApiModelProperty(value = "侧防编号") @ApiModelProperty(value = "侧防编号")
private String number; private String code;
@ApiModelProperty(value = "侧防名称") @ApiModelProperty(value = "侧防名称")
private String name; private String name;