#JAVA##æ•°æ®åº“æ“作###Hibernateæ“作å�¯æ¹æ®å¡«è¡¨å•ä½ç¼–å·è¿‡æ»¤æ•°æ®ä»¥åŠæ‹¼æŽ¥æŸ¥è¯¢è¯å¥ã€æ‹¼æŽ¥æŸ¥è¯¢å‚数。```javaStringBufferhql=newStringBuffer();ListObjectparams=newArrayListObject();hql.append(FromRyMqryxxasryxxWhereryxx.scbz!='1'andryxx.tbdwbhlike?);params.add(COMMON.makeDwbhLike(curUser.getTbdwbh()));//所在å•ä½åŠä¸‹å±žå•ä½if(!COMMON.empty(queryInfo.getRjlx())){hql.append(andryxx.rjlx=?);params.add(queryInfo.getRjlx());}çœç•¥...returnthis.find(page,hql.toString(),,params.toArray());```eecmisws,接å£kz_queryOfficialBatch部分代ç�```java//æž„é€æŸ¥è¯¢æ�¡ä»¶StringBuffersql=newStringBuffer();ListObjectsqlv=newArrayListObject();sql.append(fromKzGjgzryjbxxtwhere1=1);//登记å•ä½ä¸ä¸ºç©ºæ—¶,进行æ¡ä»¶æ‹¼æŽ¥if(!HxStringUtil.isEmpty(tbdwbh)){if(tbdwbh.length()==12){sql.append(and(t.tbdwbh=?));sqlv.add(tbdwbh);}else{sql.append(String.format(and(t.tbdwbhlike'%s%%'),SqlStringUtil.escapeByLike(tbdwbh)));}}//结æŸæ—¶é—´ä¸�为空时,进行æ¡ä»¶æ‹¼æŽ¥if(null!=timeend){sql.append(String.format(and%s=cast(?asdate),timeField));sqlv.add(timeend);}ListKzGjgzryjbxxlstsrc=(ListKzGjgzryjbxx)this.queryDBList(start,limit,sql.toString(),sqlv.toArray());```queryJdbcKajqdTotal方法```javaif(!COMMON.empty(queryInfo.getDateBegin())){hql.append(ANDlrsj=TO_DATE(').append(COMMON.formatDate(queryInfo.getDateBegin())).append(','YYYYMMDD'));}if(!COMMON.empty(queryInfo.getDateEnd())){//hql.append(andlrsj).append(queryInfo.getDateEnd());hql.append(ANDlrsj=TO_DATE(').append(COMMON.formatDate(DateUtils.afterDate(queryInfo.getDateEnd(),1))).append(','YYYYMMDD'));}çœç•¥...returnthis.getJdbcTemplate().queryForList(hql.toString());``````javapublicList?queryDBPjcxList(Pagepage,PjcxQueryInfoinfo){if(COMMON.empty(info)){returnCollections.emptyList();}ListObjectparams=newArrayListObject();StringBuffersql=newStringBuffer(fromPjEvaluationInfowherescbz1);if(COMMON.notEmpty(info.getFromTime())){sql.append(andpjsj=to_date(?,'YYYYMMDD'));params.add(COMMON.formatDate(info.getFromTime()));}if(COMMON.notEmpty(info.getToTime())){sql.append(andpjsjto_date(?,'YYYYMMDD'));params.add(COMMON.formatDate(COMMON.addNowDay(info.getToTime(),1)));}çœç•¥...returnthis.find(page,sql.toString(),params.toArray());}``````javaif(!COMMON.empty(queryModel.getSldw())){if(1.equals(queryModel.getSfckxj())){hql.append(andt1.sldwlike'+COMMON.makeDwbhLike(queryModel.getSldw())+');}elseif(0.equals(queryModel.getSfckxj())){hql.append(andt1.sldwlike'+queryModel.getSldw()+%');}}``````javaKajqdjbxxitem=newKajqdjbxx();item.setScbz(0);this.getHibernateTemplate().saveOrUpdate(item);``````java//querylist.hql.append())awhererownum=?)wherern=?);hqlv.add(lastindex);hqlv.add(startindex);headSql=headSql+hql.toString();//ListDonelistlistSrc=(ListDonelist)this.queryDBList(startindex,limit,distinctsqId+hql.toString(),hqlv.toArray());ListMapString,ObjectlistSrc=this.getSpringEecmisDao().queryDBForList(headSql,hqlv.toArray());```###æ›´æ–°ã€�ä¿å˜```java/*if(dzxx.getTbdwbh()==null)dzxx.setTbdwbh(user.getYhUser().getTbdwbh());*/if(COMMON.empty(item.getLrsj())){item.setLrr(curUser.getUserId());item.setZhxgr(curUser.getUserId());}else{item.setZhxgr(curUser.getUserId());}this.getHibernateTemplate().save();this.getHibernateTemplate().saveOrUpdate();this.getHibernateTemplate().update();``````Stringhql=fromJhZjWbsjrkqkwhereywbh=?;List?wbsjrkqkList=wsCommonService.queryDBList(hql,newObject[]{ywbh});if(wbsjrkqkList.size()0){JhZjWbsjrkqkwbsjrkqk=(JhZjWbsjrkqk)wbsjrkqkList.get(0);}```###JSONæ“作```javaMapString,DateFormatdataformats=newHashMapString,DateFormat();dataformats.put(csrq,newSimpleDateFormat(yyyyMMdd));//出生日期,日期æ¼å¼�yyyyMMdd.JSONArraylstpj=HzJsonUtil.toJSONArray(lstsrc,dataformats);//整体将数æ®è½¬ä¸ºJSON,然åŽå†åŠå·¥.HzJsonUtil.renameField(jsonObj,oldname,newname,HzJsonUtil.NAMEMODE_DEFAULT);//é‡å‘½åå—段HzJsonUtil.copyField(dest,src,field1,field2,field3,HzJsonUtil.NAMEMODE_IGNORE_CASE);//copyHzJsonUtil.nullToEmptyString(json,ZWXM,SFZH,CSRQ);//å°†jsonä¸çš„null值转为空å—符串optå’Œget方法的区别,如getJSONObjectå’ŒoptJSONobject();get方法会抛异常,opt方法ä¸æŠ›å¼‚常。```###limitã€�offset```sqlSELECT*FROMCOMPANYLIMIT6//é™åˆ¶ç”±SELECTè¯å¥è¿”回的数æ®æ•°é‡ï¼Œé™åˆ¶è¿”回6æ¡æ•°æ®ã€‚select*fromtablelimit2,1;//å«ä¹‰æ˜¯è·³è¿‡2æ¡å–出1æ¡æ•°æ®ï¼ŒlimitåŽé¢æ˜¯ä»Žç¬¬2æ¡å¼€å§‹è¯»ï¼Œè¯»å–1æ¡ä¿¡æ¯ï¼Œå³è¯»å–第3æ¡æ•°æ®SELECT*FROMCOMPANYLIMIT3OFFSET2;//从一个特定的å移开始æå–记录,从第三ä½å¼€å§‹æ��å�–3个记录```###å—典相关```javapublicStringgetZdms(Stringkind,Stringcode,Stringzdms){Stringdetail=HZdb.getZdms(kind,code,zdms);if(detail==null)returncode;returndetail;}```###```javainputtype=hnisi/buttonvalue=修改onclick=$('#save').click();CommonUtils.closeModal('xg');/``````申领å•ä½æ›¾ç»ä½¿ç”¨çš„是702å—典(6ä½ï¼‰ï¼ŒçŽ°åœ¨ä½¿ç”¨çš„是701å—典(12ä½ï¼‰ã€‚tbdwbh也有用700的。``````Eclipse相关é…置:JavaBuildPathJavaCompi