XMTT 6 gadi atpakaļ
vecāks
revīzija
2e00f69e5d

+ 2 - 2
src/main/java/com/ekexiu/project/bridge/envdata/EnvDataDao.java

@ -131,10 +131,10 @@ public interface EnvDataDao {
131 131
132 132
    @SelectOne
133 133
    @Nullable
134
    EnvServer queryTraByCode(Connection con, String code, @Nullable @UnEquals String id, @Nullable Boolean active) throws SQLException;
134
    EnvTransducer queryTraByCode(Connection con, Integer code, @Nullable @UnEquals String id, @Nullable Boolean active) throws SQLException;
135 135
136 136
    @SelectOne
137 137
    @Nullable
138
    EnvServer queryTraBySeq(Connection con, String seq, @Nullable @UnEquals String id,@Nullable Boolean active) throws SQLException;
138
    EnvTransducer queryTraBySeq(Connection con, Integer seq, @Nullable @UnEquals String id,@Nullable Boolean active) throws SQLException;
139 139
140 140
}

+ 46 - 2
src/main/java/com/ekexiu/project/bridge/envdata/EnvDataService.java

@ -13,9 +13,11 @@ import org.jfw.util.PageQueryResult;
13 13
import org.jfw.util.StringUtil;
14 14
import org.jfw.util.jdbc.JdbcUtil;
15 15
import org.jfw.util.jdbc.PreparedStatementConfig;
16
import org.jfw.util.jdbc.ResultSetExtractor;
16 17
17 18
import java.sql.Connection;
18 19
import java.sql.PreparedStatement;
20
import java.sql.ResultSet;
19 21
import java.sql.SQLException;
20 22
import java.util.HashMap;
21 23
import java.util.List;
@ -177,13 +179,13 @@ public class EnvDataService {
177 179
178 180
    @Get
179 181
    @Path("/transducer/checkSeq")
180
    public EnvServer transducerBySeq(@JdbcConn Connection con, String seq, @Nullable String id, @Nullable Boolean active)throws SQLException {
182
    public EnvTransducer transducerBySeq(@JdbcConn Connection con, Integer seq, @Nullable String id, @Nullable Boolean active)throws SQLException {
181 183
        return this.envDataDao.queryTraBySeq(con, seq,id,active);
182 184
    }
183 185
184 186
    @Get
185 187
    @Path("/transducer/checkCode")
186
    public EnvServer transducerByCode(@JdbcConn Connection con,String code,@Nullable String id,@Nullable Boolean active)throws SQLException {
188
    public EnvTransducer transducerByCode(@JdbcConn Connection con,Integer code,@Nullable String id,@Nullable Boolean active)throws SQLException {
187 189
        return this.envDataDao.queryTraByCode(con, code, id,active);
188 190
    }
189 191
@ -226,8 +228,50 @@ public class EnvDataService {
226 228
        return map;
227 229
    }
228 230
231
    @Path("/server/typeahead")
232
    @Get
233
    public List<TypeaheadItem> get(@JdbcConn Connection con)throws SQLException {
234
        return JdbcUtil.queryList(con, "SELECT CODE,ID FROM ENV_SERVER", new ResultSetExtractor<TypeaheadItem>() {
235
            @Override
236
            public TypeaheadItem extractData(ResultSet resultSet) throws SQLException {
237
                TypeaheadItem typeaheadItem = new TypeaheadItem();
238
                typeaheadItem.setCaption(resultSet.getString(1));
239
                typeaheadItem.setCaption(resultSet.getString(2));
240
                return typeaheadItem;
241
            }
242
        });
243
    }
229 244
245
    @Path("/transducer/position")
246
    public List<TypeaheadItem> getPosition(@JdbcConn Connection con)throws SQLException {
247
        return JdbcUtil.queryList(con, "SELECT POSITION FROM ENV_TRANSDUCER GROUP BY POSITION", new ResultSetExtractor<TypeaheadItem>() {
248
            @Override
249
            public TypeaheadItem extractData(ResultSet resultSet) throws SQLException {
250
                TypeaheadItem typeaheadItem = new TypeaheadItem();
251
                typeaheadItem.setCaption(resultSet.getString(1));
252
                typeaheadItem.setCaption(resultSet.getString(1));
253
                return typeaheadItem;
254
            }
255
        });
256
    }
230 257
231 258
259
    public static class TypeaheadItem{
260
        private String code;
261
        private String caption;
262
        public String getCode() {
263
            return code;
264
        }
265
        public void setCode(String code) {
266
            this.code = code;
267
        }
268
        public String getCaption() {
269
            return caption;
270
        }
271
        public void setCaption(String caption) {
272
            this.caption = caption;
273
        }
274
275
    }
232 276
233 277
}