NutzCN Logo
问答 为什么cnd实例在for外面 条件还是and加起来
发布于 290天前 作者 少年不再年少 277 次浏览 复制 上一个帖子 下一个帖子
标签:
----------R [channel=null, brand=360, model=1505-A01, IMEI=863170032238450, IMSI=null, OS=null, version=null, number0=null, number1=null, network=null, MAC=null, pluginName=null, pluginVersion=null, pluginKey=null, softwareCount=0, application=0, time=0, apkItems=null, userDate=[ [PackageName=com.UCMobile, Date_Time=Sat Dec 02 11:24:25 CST 2017, CS_INT=16],  [PackageName=com.jingdong.app.mall, Date_Time=Sat Dec 02 11:23:06 CST 2017, CS_INT=2]]]
---------[ [PackageName=com.UCMobile, Date_Time=Sat Dec 02 11:24:25 CST 2017, CS_INT=16],  [PackageName=com.jingdong.app.mall, Date_Time=Sat Dec 02 11:23:06 CST 2017, CS_INT=2]]
2-----[ [PackageName=com.UCMobile, Date_Time=Sat Dec 02 11:24:25 CST 2017, CS_INT=16]]
2017-12-02 11:53:44,267 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM t_device  WHERE c_imei1=? LIMIT 0, 1 
    |               1 |
    |-----------------|
    | 863170032238450 |
  For example:> "SELECT * FROM t_device  WHERE c_imei1='863170032238450' LIMIT 0, 1 "
------Device [id=167, channelId=1, brand=360, model=1505-A01, IMEI1=863170032238450, IMEI2=null, MEID=null, IMSI=, OS=android, version=6.0, number0=null, number1=null, network=null, MAC=02:00:00:00:00:00, source=null, pluginName=blackcrow, pluginVersion=1.0.0, pluginKey=null, registerDateTime=Sat Dec 02 11:22:58 CST 2017, firstUpdateDateTime=Sat Dec 02 11:18:59 CST 2017, lastUpdateDateTime=Sat Dec 02 11:22:58 CST 2017, firstIP=192.168.1.164, firstArea=null, lastIP=192.168.1.164, lastArea=null, totalPreinstallApk=0, targetPreinstallApk=0, matchCount=0, IMEIS=null, softwareCount=2, channelName=null, pluginChannelName=null]
-------[]
Where----- WHERE packageName='com.UCMobile'
2017-12-02 11:53:44,285 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM t_device_apk  WHERE c_package_name=? LIMIT 0, 1 
    |            1 |
    |--------------|
    | com.UCMobile |
  For example:> "SELECT * FROM t_device_apk  WHERE c_package_name='com.UCMobile' LIMIT 0, 1 "
---appDeviceApk [id=187, deviceId=10, channelId=1, name=UC浏览器, packageName=com.UCMobile, versionCode=700, versionName=11.6.2.948, system=false, match=false, preinstallChecksum=null, firstChecksum=8521443e67234c4af64b70b5c7b0d3c6439701df, lastChecksum=8521443e67234c4af64b70b5c7b0d3c6439701df, registerDateTime=null, firstInstallDateTime=Sat Aug 19 03:28:53 CST 2017, lastUpdateDateTime=Wed Aug 23 07:25:43 CST 2017, lastMatchDateTime=null, validate=false]
2-----[ [PackageName=com.jingdong.app.mall, Date_Time=Sat Dec 02 11:23:06 CST 2017, CS_INT=2]]
2017-12-02 11:53:44,306 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM t_device  WHERE c_imei1=? AND c_imei1=? LIMIT 0, 1 
    |               1 |               2 |
    |-----------------|-----------------|
    | 863170032238450 | 863170032238450 |
  For example:> "SELECT * FROM t_device  WHERE c_imei1='863170032238450' AND c_imei1='863170032238450' LIMIT 0, 1 "
------Device [id=167, channelId=1, brand=360, model=1505-A01, IMEI1=863170032238450, IMEI2=null, MEID=null, IMSI=, OS=android, version=6.0, number0=null, number1=null, network=null, MAC=02:00:00:00:00:00, source=null, pluginName=blackcrow, pluginVersion=1.0.0, pluginKey=null, registerDateTime=Sat Dec 02 11:22:58 CST 2017, firstUpdateDateTime=Sat Dec 02 11:18:59 CST 2017, lastUpdateDateTime=Sat Dec 02 11:22:58 CST 2017, firstIP=192.168.1.164, firstArea=null, lastIP=192.168.1.164, lastArea=null, totalPreinstallApk=0, targetPreinstallApk=0, matchCount=0, IMEIS=null, softwareCount=2, channelName=null, pluginChannelName=null]
-------[]
Where----- WHERE c_package_name='com.UCMobile' AND c_package_name='com.jingdong.app.mall'
11 回复

你是需要每个sql仅一个条件?

你是不是要这种效果?

List<User> users = new ArrayList();
for (Apk apk : apks) {
     User user = dao.fetch(User.class, Cnd.where("apkId", "=", apk.getId());
     users.add(user);
}

Cnd cn2 = Cnd.NEW();
Cnd cn1 = Cnd.NEW();
Sql sql = null;
List list1=new ArrayList();
// ActivatingQuantity Quantity = new ActivatingQuantity();
for (int i = 0; i < temp; i++) {
if (i == temp - 1) {
if (special) {
break;
}
} else {
cutList = statistics.subList(flag * i, flag * (i + 1));
System.err.println("2-----" + cutList);
for (int j = 0; j < cutList.size(); j++) {
cn1 = Where.where(cn1, "IMEI1", "=", updateClientInfo.getIMEI()); // 查询手机唯一
Device device = dao.fetch(Device.class, cn1);
System.err.println("------"+device.toString());
cn2 = Where.where(cn2, "deviceId", "=",device.getId()); //查询包名
System.err.println("Where-----"+cn2);
// cn2 = Where.where(cn2, "", "in",list1 );
//cn2.or("packageName", "=", cutList.get(j).getPackageName());
DeviceApk deviceApk = dao.fetch(DeviceApk.class, cn2);
System.err.println("---app" + deviceApk.toString());

         }

       }
    }

日志·:
第一次的数据是正确的
------Device [id=167, channelId=1, brand=360, model=1505-A01, IMEI1=863170032238450, IMEI2=null, MEID=null, IMSI=, OS=android, version=6.0, number0=null, number1=null, network=null, MAC=02:00:00:00:00:00, source=null, pluginName=blackcrow, pluginVersion=1.0.0, pluginKey=null, registerDateTime=Sat Dec 02 12:01:14 CST 2017, firstUpdateDateTime=Sat Dec 02 11:18:59 CST 2017, lastUpdateDateTime=Sat Dec 02 12:01:14 CST 2017, firstIP=192.168.1.164, firstArea=null, lastIP=192.168.1.164, lastArea=null, totalPreinstallApk=0, targetPreinstallApk=0, matchCount=0, IMEIS=null, softwareCount=2, channelName=null, pluginChannelName=null]
Where----- WHERE deviceId=167
---appDeviceApk [id=16228, deviceId=167, channelId=1, name=火山小视频, packageName=com.ss.android.ugc.live, versionCode=272, versionName=2.7.2, system=false, match=false, preinstallChecksum=null, firstChecksum=aef8d0dbcedf79b6d722a9dcd9b48db171081485, lastChecksum=aef8d0dbcedf79b6d722a9dcd9b48db171081485, registerDateTime=Sat Dec 02 11:18:59 CST 2017, firstInstallDateTime=Sat Dec 02 11:18:59 CST 2017, lastUpdateDateTime=Sat Dec 02 11:18:59 CST 2017, lastMatchDateTime=null, validate=false]
第二次的数据
-----[ [PackageName=com.jingdong.app.mall, Date_Time=Sat Dec 02 11:23:06 CST 2017, CS_INT=2]]
------Device [id=167, channelId=1, brand=360, model=1505-A01, IMEI1=863170032238450, IMEI2=null, MEID=null, IMSI=, OS=android, version=6.0, number0=null, number1=null, network=null, MAC=02:00:00:00:00:00, source=null, pluginName=blackcrow, pluginVersion=1.0.0, pluginKey=null, registerDateTime=Sat Dec 02 12:01:14 CST 2017, firstUpdateDateTime=Sat Dec 02 11:18:59 CST 2017, lastUpdateDateTime=Sat Dec 02 12:01:14 CST 2017, firstIP=192.168.1.164, firstArea=null, lastIP=192.168.1.164, lastArea=null, totalPreinstallApk=0, targetPreinstallApk=0, matchCount=0, IMEIS=null, softwareCount=2, channelName=null, pluginChannelName=null]
Where----- WHERE c_device_id=167 AND c_device_id=167 这个有问题
查询的也是第一次数据的记录
---appDeviceApk [id=16228, deviceId=167, channelId=1, name=火山小视频, packageName=com.ss.android.ugc.live, versionCode=272, versionName=2.7.2, system=false, match=false, preinstallChecksum=null, firstChecksum=aef8d0dbcedf79b6d722a9dcd9b48db171081485, lastChecksum=aef8d0dbcedf79b6d722a9dcd9b48db171081485, registerDateTime=Sat Dec 02 11:18:59 CST 2017, firstInstallDateTime=Sat Dec 02 11:18:59 CST 2017, lastUpdateDateTime=Sat Dec 02 11:18:59 CST 2017, lastMatchDateTime=null, validate=false]

 cn1 = Where.where(cn1,

你这样写, 就是一直加条件啊!!!!

我写的demo完全看不懂的?? 完全没有 "推理" "类比" 思维的??

你这是深陷自己"以为正确""的写法里面, 瞎猜瞎写啊

你贴的日志, 除了你自己看得懂, 没人知道你在说啥

你这样搞下去, 明年都搞不出来的

我才不信你找到了

真的了 我找到这个点的错误的

说说是啥错误

少写一个cnd参数 所以没有查询到对应的数据 我还是用小号去开源中国去投票  谢谢你的几个星期的指点  大神
添加回复
请先登陆
回到顶部