Commit 8bf95921303df1ea309e2b7547ed8fea1e64b9e6
1 parent
cdb04c18
iss提交17;
创建TTInfoBxDetailController类,对应之前的TTInfoBxDetailController_facade,方便切换是否使用dubbo时调用不同的controller
Showing
6 changed files
with
198 additions
and
0 deletions
src/main/java/com/bsth/controller/schedule/core/legacy/TTInfoBxDetailController.java
0 → 100644
| 1 | +package com.bsth.controller.schedule.core.legacy; | |
| 2 | + | |
| 3 | +import com.bsth.controller.schedule.BController; | |
| 4 | +import com.bsth.controller.schedule.core.TTInfoBxDetailController_facade; | |
| 5 | +import com.bsth.entity.schedule.TTInfoBxDetail; | |
| 6 | +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | |
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 8 | +import org.springframework.web.bind.annotation.RestController; | |
| 9 | + | |
| 10 | +@RestController | |
| 11 | +@ConditionalOnMissingBean(TTInfoBxDetailController_facade.class) | |
| 12 | +@RequestMapping("tibxdc") | |
| 13 | +public class TTInfoBxDetailController extends BController<TTInfoBxDetail, Long> { | |
| 14 | +} | ... | ... |
src/main/java/com/bsth/entity/schedule/TTInfoBxDetail.java
0 → 100644
| 1 | +package com.bsth.entity.schedule; | |
| 2 | + | |
| 3 | +import com.bsth.control_v2.plan_module.common.enums.ttinfo.BxType; | |
| 4 | +import com.bsth.entity.Line; | |
| 5 | +import com.bsth.entity.schedule.covert.BxTypeConverter; | |
| 6 | + | |
| 7 | +import javax.persistence.*; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * 时刻表明细信息(班型信息)。 | |
| 11 | + */ | |
| 12 | +@Entity | |
| 13 | +@Table(name = "bsth_c_s_ttinfo_bx_detail") | |
| 14 | +public class TTInfoBxDetail extends BEntity { | |
| 15 | + | |
| 16 | + /** 主健Id */ | |
| 17 | + @Id | |
| 18 | + @GeneratedValue | |
| 19 | + private Long id; | |
| 20 | + | |
| 21 | + | |
| 22 | + /** 关联线路 */ | |
| 23 | + @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY) | |
| 24 | + private Line xl; | |
| 25 | + /** 线路版本(bsth_c_line_versions表对应字段) */ | |
| 26 | + @Column(nullable = false) | |
| 27 | + private int lineVersion; | |
| 28 | + /** 时刻表主对象关联 */ | |
| 29 | + @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY) | |
| 30 | + private TTInfo ttinfo; | |
| 31 | + /** 关联的路牌 */ | |
| 32 | + @ManyToOne(optional = false, cascade = CascadeType.DETACH, fetch = FetchType.LAZY) | |
| 33 | + private GuideboardInfo lp; | |
| 34 | + | |
| 35 | + /** 路牌班型1 */ | |
| 36 | + @Convert(converter = BxTypeConverter.class) | |
| 37 | + @Column(nullable = false) | |
| 38 | + private BxType bxType1; | |
| 39 | + /** 路牌班型2 */ | |
| 40 | + @Column(nullable = false) | |
| 41 | + @Convert(converter = BxTypeConverter.class) | |
| 42 | + private BxType bxType2; | |
| 43 | + /** 路牌配档数 */ | |
| 44 | + private String bxPds; | |
| 45 | + | |
| 46 | + /** 版本控制 */ | |
| 47 | + @Version | |
| 48 | + @Column(nullable = false) | |
| 49 | + private int version; | |
| 50 | + | |
| 51 | + // TODO: | |
| 52 | + | |
| 53 | + public Long getId() { | |
| 54 | + return id; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public void setId(Long id) { | |
| 58 | + this.id = id; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public Line getXl() { | |
| 62 | + return xl; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public void setXl(Line xl) { | |
| 66 | + this.xl = xl; | |
| 67 | + } | |
| 68 | + | |
| 69 | + public int getLineVersion() { | |
| 70 | + return lineVersion; | |
| 71 | + } | |
| 72 | + | |
| 73 | + public void setLineVersion(int lineVersion) { | |
| 74 | + this.lineVersion = lineVersion; | |
| 75 | + } | |
| 76 | + | |
| 77 | + public TTInfo getTtinfo() { | |
| 78 | + return ttinfo; | |
| 79 | + } | |
| 80 | + | |
| 81 | + public void setTtinfo(TTInfo ttinfo) { | |
| 82 | + this.ttinfo = ttinfo; | |
| 83 | + } | |
| 84 | + | |
| 85 | + public GuideboardInfo getLp() { | |
| 86 | + return lp; | |
| 87 | + } | |
| 88 | + | |
| 89 | + public void setLp(GuideboardInfo lp) { | |
| 90 | + this.lp = lp; | |
| 91 | + } | |
| 92 | + | |
| 93 | + public BxType getBxType1() { | |
| 94 | + return bxType1; | |
| 95 | + } | |
| 96 | + | |
| 97 | + public void setBxType1(BxType bxType1) { | |
| 98 | + this.bxType1 = bxType1; | |
| 99 | + } | |
| 100 | + | |
| 101 | + public BxType getBxType2() { | |
| 102 | + return bxType2; | |
| 103 | + } | |
| 104 | + | |
| 105 | + public void setBxType2(BxType bxType2) { | |
| 106 | + this.bxType2 = bxType2; | |
| 107 | + } | |
| 108 | + | |
| 109 | + public String getBxPds() { | |
| 110 | + return bxPds; | |
| 111 | + } | |
| 112 | + | |
| 113 | + public void setBxPds(String bxPds) { | |
| 114 | + this.bxPds = bxPds; | |
| 115 | + } | |
| 116 | + | |
| 117 | + public int getVersion() { | |
| 118 | + return version; | |
| 119 | + } | |
| 120 | + | |
| 121 | + public void setVersion(int version) { | |
| 122 | + this.version = version; | |
| 123 | + } | |
| 124 | + | |
| 125 | +} | ... | ... |
src/main/java/com/bsth/entity/schedule/covert/BxTypeConverter.java
0 → 100644
| 1 | +package com.bsth.entity.schedule.covert; | |
| 2 | + | |
| 3 | +import com.bsth.control_v2.plan_module.common.enums.ttinfo.BxType; | |
| 4 | +import org.apache.commons.lang3.StringUtils; | |
| 5 | + | |
| 6 | +import javax.persistence.AttributeConverter; | |
| 7 | +import javax.persistence.Convert; | |
| 8 | + | |
| 9 | +@Convert | |
| 10 | +public class BxTypeConverter implements AttributeConverter<BxType, String> { | |
| 11 | + @Override | |
| 12 | + public String convertToDatabaseColumn(BxType attribute) { | |
| 13 | + return attribute.getDicDesc(); | |
| 14 | + } | |
| 15 | + | |
| 16 | + @Override | |
| 17 | + public BxType convertToEntityAttribute(String dbData) { | |
| 18 | + if (StringUtils.isEmpty(dbData)) { | |
| 19 | + return null; | |
| 20 | + } else { | |
| 21 | + return BxType.fromDicDesc(dbData); | |
| 22 | + } | |
| 23 | + | |
| 24 | + } | |
| 25 | +} | ... | ... |
src/main/java/com/bsth/repository/schedule/TTInfoBxDetailRepository.java
0 → 100644
| 1 | +package com.bsth.repository.schedule; | |
| 2 | + | |
| 3 | +import com.bsth.entity.schedule.TTInfoBxDetail; | |
| 4 | +import com.bsth.repository.BaseRepository; | |
| 5 | +import org.springframework.stereotype.Repository; | |
| 6 | + | |
| 7 | +@Repository | |
| 8 | +public interface TTInfoBxDetailRepository extends BaseRepository<TTInfoBxDetail, Long> { | |
| 9 | + | |
| 10 | +} | ... | ... |
src/main/java/com/bsth/service/schedule/TTInfoBxDetailService.java
0 → 100644
src/main/java/com/bsth/service/schedule/impl/TTInfoBxDetailServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.schedule.impl; | |
| 2 | + | |
| 3 | +import com.bsth.entity.schedule.TTInfoBxDetail; | |
| 4 | +import com.bsth.service.schedule.TTInfoBxDetailService; | |
| 5 | +import org.springframework.stereotype.Service; | |
| 6 | +import org.springframework.transaction.annotation.Isolation; | |
| 7 | +import org.springframework.transaction.annotation.Propagation; | |
| 8 | +import org.springframework.transaction.annotation.Transactional; | |
| 9 | + | |
| 10 | +@Service | |
| 11 | +@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED) | |
| 12 | +public class TTInfoBxDetailServiceImpl extends BServiceImpl<TTInfoBxDetail, Long> implements TTInfoBxDetailService { | |
| 13 | + | |
| 14 | +} | ... | ... |