博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
GreenDao-自定义SQL查询-拼接多个查询条件-AndroidStudio
阅读量:6076 次
发布时间:2019-06-20

本文共 5409 字,大约阅读时间需要 18 分钟。

1     //获取本地Pad(离线工作票列表)  2     public static List
getPadWTList(String token, 3 String userId, 4 String org, 5 String dept, 6 String strClass, 7 String ticketNo, 8 String type, 9 String status, 10 String isEvaluated, 11 String exceedTimeLimit, 12 String error, 13 String workLeader, 14 String signatory, 15 String content, 16 String createTimeLimit, 17 String year, 18 String workLeaderOpenTime,//工作负责人签字时间从 19 String workLeaderCloseTime,//工作负责人签字时间到 20 String allowEndOpenTime, 21 String allowEndCloseTime, 22 String page_number, 23 String each_page){ 24 25 List
lWTDetailTableBeanLt = new ArrayList
(); 26 27 //请求参数 28 ArrayList
strParamLt = new ArrayList
(); 29 30 String queryString = 31 "SELECT DISTINCT * FROM " + WTDetailTableBeanDao.TABLENAME + " where 1==1 "; 32 //组织 33 if (!CommonUtil.isNull(org)){ 34 queryString = queryString + " and " 35 + WTDetailTableBeanDao.Properties.ORG_ID.columnName + " = ?"; 36 strParamLt.add(org); 37 } 38 //部门 39 if (!CommonUtil.isNull(dept)){ 40 queryString = queryString + " and " 41 + WTDetailTableBeanDao.Properties.UNIT_ID.columnName + " = ?"; 42 strParamLt.add(dept); 43 } 44 //班组 45 if (!CommonUtil.isNull(strClass)){ 46 queryString = queryString + " and " 47 + WTDetailTableBeanDao.Properties.CLASS_ID.columnName + " = ?"; 48 strParamLt.add(strClass); 49 } 50 //票号 51 if (!CommonUtil.isNull(ticketNo)){ 52 queryString = queryString + " and " 53 + WTDetailTableBeanDao.Properties.TICKET_NO.columnName + " like '%" + ticketNo + "%' "; 54 } 55 56 //状态 57 if (!CommonUtil.isNull(status)){ 58 queryString = queryString + " and " 59 + WTDetailTableBeanDao.Properties.STATUS.columnName + " = ?"; 60 strParamLt.add(status); 61 } 62 63 //工作负责人 64 if (!CommonUtil.isNull(workLeader)){ 65 queryString = queryString + " and " 66 + WTDetailTableBeanDao.Properties.WORK_RESPONSOR_NAME.columnName + " like '%" + workLeader + "%' "; 67 } 68 69 //签字人 70 if (!CommonUtil.isNull(signatory)){ 71 queryString = queryString + " and " 72 + WTDetailTableBeanDao.Properties.WORK_SIGN_FIRST_NAME.columnName + " like '%" + signatory + "%' "; 73 74 queryString = queryString + " or " 75 + WTDetailTableBeanDao.Properties.WORK_SIGN_SECOND_NAME.columnName + " like '%" + signatory + "%' "; 76 77 } 78 79 //工作内容 80 if (!CommonUtil.isNull(content)){ 81 queryString = queryString + " and " 82 + WTDetailTableBeanDao.Properties.WORK_RESPONSOR_JOB.columnName + " like '%" + content + "%' "; 83 } 84 85 //工作负责人签字时间从 和 工作负责人签字时间到 都不为空 86 if (!CommonUtil.isNull(workLeaderOpenTime) && !CommonUtil.isNull(workLeaderCloseTime)){ 87 queryString = queryString + " and " 88 + WTDetailTableBeanDao.Properties.WORK_SIGN_THRID_DATE.columnName + " BETWEEN '" + workLeaderOpenTime + "' AND '" + workLeaderCloseTime + "' "; 89 //工作负责人签字时间从 不为空 和 工作负责人签字时间到 为空 90 }else if (!CommonUtil.isNull(workLeaderOpenTime) && CommonUtil.isNull(workLeaderCloseTime)){ 91 queryString = queryString + " and " 92 + WTDetailTableBeanDao.Properties.WORK_SIGN_THRID_DATE.columnName + " BETWEEN '" + workLeaderOpenTime + "' AND '" + CommonUtil.getCurrentTime() + "' "; 93 //工作负责人签字时间从 为空 和 工作负责人签字时间到 不为空 94 }else if (!CommonUtil.isNull(workLeaderOpenTime) && CommonUtil.isNull(workLeaderCloseTime)){ 95 queryString = queryString + " and " 96 + WTDetailTableBeanDao.Properties.WORK_SIGN_THRID_DATE.columnName + " BETWEEN '2000-01-01 00:00:00' AND '" + workLeaderCloseTime + "' "; 97 } 98 99 Object [] objs=strParamLt.toArray();100 String [] strs=new String[objs.length];101 for(int i=0;i

 

页面结果:

 

转载地址:http://nvxgx.baihongyu.com/

你可能感兴趣的文章
VS2008查看dll导出函数
查看>>
VM EBS R12迁移,启动APTier . AutoConfig错误
查看>>
atitit.细节决定成败的适合情形与缺点
查看>>
iOS - Library 库
查看>>
MATLAB 读取DICOM格式文件
查看>>
spring事务管理(Transaction)
查看>>
django.contrib.auth登陆注销学习
查看>>
js执行本地exe文件的3种方法
查看>>
理解B树索引
查看>>
vi编辑器的命令集合
查看>>
Mysql利用binlog恢复数据
查看>>
解决 Windows启动时要求验证
查看>>
我的友情链接
查看>>
用yum安装mariadb
查看>>
一点IT"边缘化"的人的思考
查看>>
Gallery循环滑动
查看>>
Sql与C#中日期格式转换总结
查看>>
iOS开发流程总结
查看>>
hadoop datanode 启动出错
查看>>
js颜色拾取器
查看>>