新增停机位类别 基础数据接口

This commit is contained in:
fanghongchao
2018-12-24 13:37:34 +08:00
parent add69d0e81
commit cab7ae17a0
5 changed files with 148 additions and 0 deletions
@@ -0,0 +1,54 @@
package com.gzzn.omms.adminapi.controller.basicdata;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gzzn.omms.adminapi.domain.secondary.dao.basicdata.OrmsStandTypeDao;
import com.gzzn.omms.adminapi.domain.secondary.entity.baiscdata.OrmsStandType;
import com.gzzn.omms.adminapi.dto.ResponseDto;
import com.gzzn.omms.adminapi.dto.basicdata.OrmsStandTypeDto;
import com.gzzn.omms.adminapi.dto.basicdata.convert.OrmsStandTypeConvert;
/**
* 停机位类别
* @author fhc
*
*/
@RestController
public class OrmsStandTypeController {
/**
* 机位接口
*/
@Autowired
private OrmsStandTypeDao ormsStandTypeDao;
/**
* 机位Dto接口
*/
@Autowired
private OrmsStandTypeConvert ormsStandTypeConvert;
/**
* 获取所有机位数据
* @return
*/
@ApiOperation(value="获取停机位类别列表",tags="基础数据")
@GetMapping(value="/basicdata/ormsStandTypes")
public ResponseDto<List<OrmsStandTypeDto>> getOrmsStand() {
List<OrmsStandType> ormsStandTypeList = (List<OrmsStandType>) ormsStandTypeDao.findAll();
//转换dto
List<OrmsStandTypeDto> ormsStandTypeListDto = ormsStandTypeList.stream().map(x -> {
OrmsStandTypeDto dto = ormsStandTypeConvert.ormsStandTypeToOrmsStandTypeDto(x);
return dto;
}).collect(Collectors.toList());
return ResponseDto.success(ormsStandTypeListDto);
}
}
@@ -0,0 +1,9 @@
package com.gzzn.omms.adminapi.domain.secondary.dao.basicdata;
import org.springframework.data.repository.CrudRepository;
import com.gzzn.omms.adminapi.domain.secondary.entity.baiscdata.OrmsStandType;
public interface OrmsStandTypeDao extends CrudRepository<OrmsStandType, String> {
}
@@ -0,0 +1,34 @@
package com.gzzn.omms.adminapi.domain.secondary.entity.baiscdata;
import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
/**
* 停机位类别
* @author fhc
* @date 18-12-24
*/
@Entity
@Table(name="ORMS_STANDTYPE")
@NamedQuery(name="OrmsStandType.findAll", query="SELECT o FROM OrmsStandType o")
public class OrmsStandType {
@Id
@SequenceGenerator(name="STAND_TYPE_GENERATOR", sequenceName="STAND_TYPE")
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="STAND_TYPE_GENERATOR")
@Column(name="STAND_TYPE")
private String standType; //停机位类别 可取值:bridge-靠桥机位、remote-远机位、near-近机位、night-过夜机位、specific-专机位...
@Column(name="STAND_TYPE_DESC")
private BigDecimal standTypeDesc; //停机位类别说明 可取值:靠桥机位、远机位、近机位、过夜机位、专机位
}
@@ -0,0 +1,39 @@
package com.gzzn.omms.adminapi.dto.basicdata;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
/**
* 停机位类别
* @author fhc
* @date 18-12-24
*/
@ApiModel(value="停机位类别Dto",description="停机位类别基础数据")
public class OrmsStandTypeDto {
@ApiModelProperty(value="停机位类别 bridge-靠桥机位、remote-远机位、near-近机位、night-过夜机位、specific-专机位...",example="bridge")
private String standType; //停机位类别 可取值:bridge-靠桥机位、remote-远机位、near-近机位、night-过夜机位、specific-专机位...
@ApiModelProperty(value="停机位类别说明 可取值:靠桥机位、远机位、近机位、过夜机位、专机位",example="靠桥机位")
private BigDecimal standTypeDesc; //停机位类别说明 可取值:靠桥机位、远机位、近机位、过夜机位、专机位
public String getStandType() {
return standType;
}
public void setStandType(String standType) {
this.standType = standType;
}
public BigDecimal getStandTypeDesc() {
return standTypeDesc;
}
public void setStandTypeDesc(BigDecimal standTypeDesc) {
this.standTypeDesc = standTypeDesc;
}
}
@@ -0,0 +1,12 @@
package com.gzzn.omms.adminapi.dto.basicdata.convert;
import org.mapstruct.Mapper;
import com.gzzn.omms.adminapi.domain.secondary.entity.baiscdata.OrmsStandType;
import com.gzzn.omms.adminapi.dto.basicdata.OrmsStandTypeDto;
@Mapper(componentModel="spring")
public interface OrmsStandTypeConvert {
public OrmsStandTypeDto ormsStandTypeToOrmsStandTypeDto(OrmsStandType ormsStandType);
}