From c30bf257e682643e3c721b7329597b64a11581af Mon Sep 17 00:00:00 2001 From: ZY <zc857179121@qq.com> Date: 星期三, 21 八月 2024 10:46:04 +0800 Subject: [PATCH] 档查询出来有多条数据时,加上数量条件,进行匹配,如果数量也匹配不上,就默认返回第一个 --- src/main/java/com/zy/common/model/LocTypeDto.java | 28 ++++++++-------------------- 1 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/zy/common/model/LocTypeDto.java b/src/main/java/com/zy/common/model/LocTypeDto.java index ccd52fc..c6630aa 100644 --- a/src/main/java/com/zy/common/model/LocTypeDto.java +++ b/src/main/java/com/zy/common/model/LocTypeDto.java @@ -1,12 +1,15 @@ package com.zy.common.model; +import com.alibaba.fastjson.JSON; import com.core.exception.CoolException; -import com.zy.core.model.protocol.StaProtocol; +import com.zy.asrs.entity.BasDevp; import lombok.Data; +import lombok.extern.slf4j.Slf4j; /** * Created by vincent on 2020/10/19 */ +@Slf4j @Data public class LocTypeDto { @@ -22,31 +25,16 @@ public LocTypeDto() { } - public LocTypeDto(StaProtocol staProtocol) { - if (staProtocol.isHigh() == staProtocol.isLow()) { + public LocTypeDto(BasDevp basDevp) { + if (basDevp.getLocType1() == null || basDevp.getLocType1() == 0) { throw new CoolException("plc楂樹綆妫�娴嬪紓甯�"); } - if (staProtocol.isLow()) { + if (basDevp.getLocType1() == 1) { this.locType1 = 1; // 浣庡簱浣� } else { this.locType1 = 2; // 楂樺簱浣� } - } - - /** - * 搴撲綅绫诲瀷瑙f瀽 - */ - public static LocTypeDto process(StaProtocol staProtocol) { - LocTypeDto dto = new LocTypeDto(); - if (staProtocol.isHigh() == staProtocol.isLow()) { - throw new CoolException("plc楂樹綆妫�娴嬪紓甯�"); - } - if (staProtocol.isLow()) { - dto.setLocType1((short) 1); // 浣庡簱浣� - } else { - dto.setLocType1((short) 2); // 楂樺簱浣� - } - return dto; + log.info(JSON.toJSONString(this)); } } -- Gitblit v1.9.1