新增 航班代理 基础数据接口

This commit is contained in:
fanghongchao
2018-12-17 10:53:03 +08:00
parent bd1a85717f
commit 28aba5cafc
5 changed files with 210 additions and 0 deletions
@@ -0,0 +1,49 @@
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.SysFlightAgentDao;
import com.gzzn.omms.adminapi.domain.secondary.entity.baiscdata.SysFlightAgent;
import com.gzzn.omms.adminapi.dto.ResponseDto;
import com.gzzn.omms.adminapi.dto.basicdata.SysFlightAgentDto;
import com.gzzn.omms.adminapi.dto.basicdata.convert.SysFlightAgentConvert;
/**
* 航班代理单位
* @author fhc
* @since 2018-12-17
*
*/
@RestController
public class SysFlightAgentController {
@Autowired
private SysFlightAgentConvert sysFlightAgentConvert;
@Autowired
private SysFlightAgentDao sysFlightAgentDao;
/**
* 获取所有代理事务代码(航班服务代码)
* @return
*/
@ApiOperation(value="获取所有代理事务代码(航班服务代码)列表",tags="基础数据")
@GetMapping(value="/basicdata/sysFlightAgents")
public ResponseDto<List<SysFlightAgentDto>> getSysFlightAgents() {
List<SysFlightAgent> sysFlightAgents = (List<SysFlightAgent>) sysFlightAgentDao.findAll();
//转换dto
List<SysFlightAgentDto> dtoList = sysFlightAgents.stream().map(
x -> sysFlightAgentConvert.sysFlightAgentToSysFlightAgentDto(x)
).collect(Collectors.toList());
return ResponseDto.success(dtoList);
}
}
@@ -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.SysFlightAgent;
public interface SysFlightAgentDao extends CrudRepository<SysFlightAgent, String> {
}
@@ -0,0 +1,100 @@
package com.gzzn.omms.adminapi.domain.secondary.entity.baiscdata;
import java.io.Serializable;
import javax.persistence.*;
/**
* The persistent class for the SYS_FLIGHTAGENT database table.
* 航班代理单位
*/
@Entity
@Table(name="SYS_FLIGHTAGENT")
@NamedQuery(name="SysFlightAgent.findAll", query="SELECT s FROM SysFlightAgent s")
public class SysFlightAgent implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@SequenceGenerator(name="FLIGHTAGENT_ID_GENERATOR", sequenceName="FLIGHTAGENT_ID")
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="FLIGHTAGENT_ID_GENERATOR")
@Column(name="FLIGHTAGENT_ID")
private String flightAgentId;//航班代理ID
@Column(name="FLIGHTAGENT_NAME")
private String flightAgentName;//代理机构中文名称
@Column(name="OGID")
private String oGId;//代理机构标识
public String getFlightAgentId() {
return flightAgentId;
}
public void setFlightAgentId(String flightAgentId) {
this.flightAgentId = flightAgentId;
}
public String getFlightAgentName() {
return flightAgentName;
}
public void setFlightAgentName(String flightAgentName) {
this.flightAgentName = flightAgentName;
}
public String getoGId() {
return oGId;
}
public void setoGId(String oGId) {
this.oGId = oGId;
}
@Override
public String toString() {
return "SysFlightAgent [flightAgentId=" + flightAgentId
+ ", flightAgentName=" + flightAgentName + ", oGId=" + oGId
+ "]";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((flightAgentId == null) ? 0 : flightAgentId.hashCode());
result = prime * result
+ ((flightAgentName == null) ? 0 : flightAgentName.hashCode());
result = prime * result + ((oGId == null) ? 0 : oGId.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SysFlightAgent other = (SysFlightAgent) obj;
if (flightAgentId == null) {
if (other.flightAgentId != null)
return false;
} else if (!flightAgentId.equals(other.flightAgentId))
return false;
if (flightAgentName == null) {
if (other.flightAgentName != null)
return false;
} else if (!flightAgentName.equals(other.flightAgentName))
return false;
if (oGId == null) {
if (other.oGId != null)
return false;
} else if (!oGId.equals(other.oGId))
return false;
return true;
}
}
@@ -0,0 +1,40 @@
package com.gzzn.omms.adminapi.dto.basicdata;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
*
* 航班代理单位Dto
*/
@ApiModel(value="航班代理单位Dto",description="航班代理单位基础数据")
public class SysFlightAgentDto {
@ApiModelProperty(value="航班代理ID",example="95756594")
private String flightAgentId;//航班代理ID
@ApiModelProperty(value="代理机构中文名称",example="川航代理")
private String flightAgentName;//代理机构中文名称
@ApiModelProperty(value="代理机构标识",example="2508")
private String oGId;//代理机构标识
public String getFlightAgentId() {
return flightAgentId;
}
public void setFlightAgentId(String flightAgentId) {
this.flightAgentId = flightAgentId;
}
public String getFlightAgentName() {
return flightAgentName;
}
public void setFlightAgentName(String flightAgentName) {
this.flightAgentName = flightAgentName;
}
public String getoGId() {
return oGId;
}
public void setoGId(String oGId) {
this.oGId = oGId;
}
}
@@ -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.SysFlightAgent;
import com.gzzn.omms.adminapi.dto.basicdata.SysFlightAgentDto;
@Mapper(componentModel="spring")
public interface SysFlightAgentConvert {
public SysFlightAgent sysFlightAgentDtoToSysFlightAgent(SysFlightAgentDto sysFlightAgentDto);
public SysFlightAgentDto sysFlightAgentToSysFlightAgentDto(SysFlightAgent sysFlightAgent);
}