添加新的侧防数据管理接口

用户管理添加id查询条件
This commit is contained in:
walker-sheng 2021-05-27 17:30:40 +08:00
parent e7db4a7382
commit 9a6f5b18ae
6 changed files with 145 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

@ -260,6 +260,9 @@ public class SysUserService implements ISysUserService {
// return PageVO.convert(page); // return PageVO.convert(page);
SysUserExample example = new SysUserExample(); SysUserExample example = new SysUserExample();
SysUserExample.Criteria criteria = example.createCriteria(); SysUserExample.Criteria criteria = example.createCriteria();
if (queryVO.getId() != null) {
criteria.andIdEqualTo(queryVO.getId());
}
if (StringUtils.hasText(queryVO.getName())) { if (StringUtils.hasText(queryVO.getName())) {
criteria.andNameLike(String.format("%%%s%%", queryVO.getName())); criteria.andNameLike(String.format("%%%s%%", queryVO.getName()));
} }

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;
@ -15,6 +15,8 @@ import java.util.List;
@Setter @Setter
public class UserQueryVO extends PageQueryVO { public class UserQueryVO extends PageQueryVO {
private Long id;
/** /**
* 真实姓名 * 真实姓名
*/ */

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;