diff --git a/src/main/java/club/joylink/rtss/controller/draft/DraftMapFlsController.java b/src/main/java/club/joylink/rtss/controller/draft/DraftMapFlsController.java new file mode 100644 index 000000000..6f3eea11d --- /dev/null +++ b/src/main/java/club/joylink/rtss/controller/draft/DraftMapFlsController.java @@ -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 pagingQuery(@PathVariable Long id, MapRouteFlankProtectionQueryVO queryVO) { + return this.draftMapFlsService.pagingQuery(id, queryVO); + } + + @GetMapping("/all") + public List 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); + } +} diff --git a/src/main/java/club/joylink/rtss/services/SysUserService.java b/src/main/java/club/joylink/rtss/services/SysUserService.java index c61da4330..431f0bbda 100644 --- a/src/main/java/club/joylink/rtss/services/SysUserService.java +++ b/src/main/java/club/joylink/rtss/services/SysUserService.java @@ -260,6 +260,9 @@ public class SysUserService implements ISysUserService { // return PageVO.convert(page); SysUserExample example = new SysUserExample(); SysUserExample.Criteria criteria = example.createCriteria(); + if (queryVO.getId() != null) { + criteria.andIdEqualTo(queryVO.getId()); + } if (StringUtils.hasText(queryVO.getName())) { criteria.andNameLike(String.format("%%%s%%", queryVO.getName())); } diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapFlsService.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapFlsService.java new file mode 100644 index 000000000..0affaaea6 --- /dev/null +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapFlsService.java @@ -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 pagingQuery(Long id, MapRouteFlankProtectionQueryVO queryVO); + + List queryAll(Long id); + + void update(Long id, String code, MapRouteFlankProtectionNewVO vo); + + void delete(Long id, String code); +} diff --git a/src/main/java/club/joylink/rtss/services/draftData/DraftMapFlsServiceImpl.java b/src/main/java/club/joylink/rtss/services/draftData/DraftMapFlsServiceImpl.java new file mode 100644 index 000000000..88c51a5b5 --- /dev/null +++ b/src/main/java/club/joylink/rtss/services/draftData/DraftMapFlsServiceImpl.java @@ -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 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 mapOverlaps = (Page) this.draftMapRouteFlankProtectionDAO.selectByExampleWithBLOBs(example); + List voList = mapOverlaps.getResult().stream() + .map(MapRouteFlankProtectionNewVO::convert2VO).collect(Collectors.toList()); + return PageVO.convert(mapOverlaps, voList); + } + + @Override + public List queryAll(Long id) { + DraftMapRouteFlankProtectionExample example = new DraftMapRouteFlankProtectionExample(); + example.createCriteria() + .andMapIdEqualTo(id); + List 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 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); + } +} diff --git a/src/main/java/club/joylink/rtss/vo/UserQueryVO.java b/src/main/java/club/joylink/rtss/vo/UserQueryVO.java index dfb44a534..a490470ce 100644 --- a/src/main/java/club/joylink/rtss/vo/UserQueryVO.java +++ b/src/main/java/club/joylink/rtss/vo/UserQueryVO.java @@ -1,7 +1,7 @@ package club.joylink.rtss.vo; -import com.fasterxml.jackson.annotation.JsonIgnore; import club.joylink.rtss.vo.client.PageQueryVO; +import com.fasterxml.jackson.annotation.JsonIgnore; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Getter; @@ -15,6 +15,8 @@ import java.util.List; @Setter public class UserQueryVO extends PageQueryVO { + private Long id; + /** * 真实姓名 */ diff --git a/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapRouteFlankProtectionQueryVO.java b/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapRouteFlankProtectionQueryVO.java index 19fdd98d4..269d75faf 100644 --- a/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapRouteFlankProtectionQueryVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/map/newmap/MapRouteFlankProtectionQueryVO.java @@ -10,12 +10,12 @@ import lombok.Setter; @Setter @ApiModel(value = "侧防查询") public class MapRouteFlankProtectionQueryVO extends PageQueryVO { - - @ApiModelProperty(value = "联锁车站唯一编码") - private String stationCode; +// +// @ApiModelProperty(value = "联锁车站唯一编码") +// private String stationCode; @ApiModelProperty(value = "侧防编号") - private String number; + private String code; @ApiModelProperty(value = "侧防名称") private String name;