mengkang před 4 roky
rodič
revize
13ff8022cc

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java

@ -360,7 +360,7 @@ public class IotInterfaceController extends EnvelopRestEndpoint {
                size = 10;
            }
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_find, iotInterfaceLogService.findInterfaceLog(page,size,interfaceName,addressIp));
            return iotInterfaceLogService.findInterfaceLog(page,size,interfaceName,addressIp);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());

+ 6 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotInterfaceLogService.java

@ -101,17 +101,21 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io
        StringBuffer sql =new StringBuffer("SELECT c.* FROM iot_interface_log c WHERE 1=1 ");
        StringBuffer countSql=new StringBuffer("SELECT COUNT(c.id) count FROM iot_interface_log c WHERE 1=1 ");
        if (StringUtils.isNotBlank(interfaceName)){
            sql.append(" and c.interface_name like'%").append(interfaceName).append("%'");
            countSql.append(" and c.interface_name like'%").append(interfaceName).append("%'");
        }
        if (StringUtils.isNotBlank(addressIP)){
            sql.append(" and c.address_ip='").append(addressIP).append("'");
            countSql.append(" and c.address_ip='").append(addressIP).append("'");
        }
        sql.append(" order by c.time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotInterfaceLogDO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(IotInterfaceLogDO.class));
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(countSql.toString());
        ArrayList<IotInterfaceLogVO> resultList = new ArrayList<>();
        list.forEach(one->{
@ -120,7 +124,7 @@ public class IotInterfaceLogService extends BaseJpaService<IotInterfaceLogDO, Io
            resultList.add(target);
        });
        long count =list.size();
        long count = (long) mapList.get(0).get("count");
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Platform.message_success_find,resultList,page, size,count);