Commit 379ac1ea authored by suhuiguang's avatar suhuiguang

1.ccs换流站详情

parent cb47ecc3
package com.yeejoin.amos.boot.module.ccs.api.service;
import com.yeejoin.amos.boot.module.ccs.api.dto.FireStationInfoDto;
/**
* 站端信息表接口类
*
......@@ -9,4 +11,10 @@ package com.yeejoin.amos.boot.module.ccs.api.service;
*/
public interface IFireStationInfoService {
/**
* 详情
* @param stationCode
* @return
*/
FireStationInfoDto getOneByCode(String stationCode);
}
......@@ -8,10 +8,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
......@@ -46,4 +43,11 @@ public class FireStationInfoController extends BaseController {
@ApiParam(value = "排序条件") @RequestParam(required = false) String orderBy) throws Exception {
return ResponseHelper.buildResponse(fireStationInfoServiceImpl.queryForFireStationInfoList(orderBy));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "站端信息详情", notes = "站端信息详情")
@GetMapping(value = "/{stationCode}/detail")
public ResponseModel getOne(@PathVariable String stationCode) {
return ResponseHelper.buildResponse(fireStationInfoServiceImpl.getOneByCode(stationCode));
}
}
......@@ -7,7 +7,6 @@ import com.yeejoin.amos.boot.module.ccs.api.mapper.FireStationInfoMapper;
import com.yeejoin.amos.boot.module.ccs.api.service.IFireStationInfoService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.StringUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.List;
......@@ -20,18 +19,28 @@ import java.util.Optional;
* @date 2021-11-09
*/
@Service
public class FireStationInfoServiceImpl extends BaseService<FireStationInfoDto,FireStationInfo,FireStationInfoMapper> implements IFireStationInfoService {
public class FireStationInfoServiceImpl extends BaseService<FireStationInfoDto, FireStationInfo, FireStationInfoMapper> implements IFireStationInfoService {
/**
* 列表查询 示例
*
* @param orderBy
*/
public List<FireStationInfoDto> queryForFireStationInfoList(String orderBy) throws Exception {
if(StringUtils.isNotBlank(orderBy)){
if (StringUtils.isNotBlank(orderBy)) {
Optional<StationOrderByTypeEnum> op = StationOrderByTypeEnum.getEnum(orderBy);
op.orElseThrow(()->new Exception("不存在查询排序条件"));
op.orElseThrow(() -> new Exception("不存在查询排序条件"));
return this.baseMapper.queryStationListWithStatistics(op.get().getOrderBy());
} else {
return this.baseMapper.queryStationListWithStatistics(null);
}
}
@Override
public FireStationInfoDto getOneByCode(String stationCode) {
List<FireStationInfoDto> dtos = this.queryForList("", false, stationCode);
if (dtos.isEmpty()) {
throw new RuntimeException("不存在指定数据");
}
return dtos.iterator().next();
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment