

<table width="100%" class="form_table">
<tr>
<td align="right" class="form_label">档案名称 :</td>
<td>
<!-- like 条件 -->
<h:text property="criteria/_expr[2]/fileName"/>
<h:hidden property="criteria/_expr[2]/_op" value="like"/>
<h:hidden property="criteria/_expr[2]/_likeRule" value="all"/>
</td>
<td align="right" class="form_label">是否作废 :</td>
<td>
<!-- 等于 条件 -->
<h:select id="select2" name="delFlag" property="criteria/_expr[3]/status" onchange="setCriteriaDelFlagValue()">
<h:option label="请选择" value="" />
<h:option label="是" value="1" />
<h:option label="否" value="0" />
</h:select>
<h:hidden property="criteria/_expr[3]/status" id="criteria3" />
<h:hidden property="criteria/_expr[3]/_op" id="criteria3op" />
</td>
</tr>
<tr>
<td align="right" class="form_label">档案编号 :</td>
<td class="height_td">
<h:text property="criteria/_expr[4]/code"/>
</td>
<td align="right" class="form_label">版本号 :</td>
<td class="height_td">
<h:text property="criteria/_expr[5]/versionNo" />
</td>
</tr>
<tr class="height_td">
<!-- between 条件 -->
<h:hidden property="criteria/_expr[6]/_op" value="between" />
<h:hidden property="criteria/_expr[6]/placeTime" value=" " />
<h:hidden property="criteria/_expr[6]/_pattern" value="yyyy-MM-dd HH:mm:ss"/>
<td align="right" class="form_label">归档开始时间 :</td>
<td class="height_td">
<w:date property="criteria/_expr[6]/_min" format="yyyy-MM-dd HH:mm:ss" id = "startDate"/>
</td>
<td align="right" class="form_label">归档结束时间 :</td>
<td class="height_td">
<w:date property="criteria/_expr[6]/_max" format="yyyy-MM-dd HH:mm:ss" id = "endDate"/>
</td>
</tr>
<tr class="height_td">
<td align="right" class="form_label">数据安全等级 :</td>
<td class="height_td" colspan="3">
<h:radio property="criteria/_expr[7]/safeClass" value="绝密级"/>绝密级
<h:radio property="criteria/_expr[7]/safeClass" value="秘密级"/>秘密级
<h:radio property="criteria/_expr[7]/safeClass" value="内部级"/>内部级
<h:radio property="criteria/_expr[7]/safeClass" value="公共级"/>公共级
</td>
</tr>
<l:notEmpty property="tblArchivesKeywords">
<l:iterate id="classKeyWords" property="tblArchivesKeywords" indexId="id1" >
<l:output oddOutput=" <tr>" />
<td align="right" class="form_label"><b:write iterateId="classKeyWords" property="keywordsName"/> :</td>
<td>
<h:hidden name="criteria/_and[1]/_or[1]/_and[${id1}]/_expr[1]/keywordsId" property="keywordsId" iterateId="classKeyWords"/>
<h:hidden property="criteria/_and[1]/_or[1]/_and[${id1}]/_expr[2]/_op" value="like"/>
<h:text property="criteria/_and[1]/_or[1]/_and[${id1}]/_expr[2]/keyValue" />
</td>
<l:output evenOutput=" </tr>" />
</l:iterate>
</l:notEmpty>
<tr align="center" >
<td colspan="4" >
<input type="button" value="查询" class="button" id="saveBtn" style="width:150px;" />
</td>
</tr>
</table>
<!-- 查询字段 -->
<h:hidden property="criteria/_select/_field[1]" value="fileId"/>
<h:hidden property="criteria/_select/_field[2]" value="classificationId"/>
<h:hidden property="criteria/_select/_field[3]" value="fileName"/>
<h:hidden property="criteria/_select/_field[4]" value="source"/>
<h:hidden property="criteria/_select/_field[5]" value="placeTime"/>
<h:hidden property="criteria/_select/_field[6]" value="code"/>
<h:hidden property="criteria/_select/_field[7]" value="status"/>
<h:hidden property="criteria/_distinct" value="true"/>
生成的SQL 语句
SELECT COUNT(*) EOS_ROW_COUNT
FROM (SELECT DISTINCT THIS_.FILE_ID AS Y0_,
THIS_.CLASSIFICATION_ID AS Y1_,
THIS_.FILE_NAME AS Y2_,
THIS_.SOURCE AS Y3_,
THIS_.PLACE_TIME AS Y4_,
THIS_.CODE AS Y5_,
THIS_.STATUS AS Y6_
FROM (SELECT TAF.FILE_ID,
TACF.CLASSIFICATION_ID,
TAF.FILE_NAME,
TAF.CODE,
TAF.STATUS,
TAF.SOURCE,
TAF.PLACE_TIME,
TAKF.KEYWORDS_ID,
TAKF.KEY_VALUE
FROM TBL_ARCHIVES_FILES TAF
RIGHT JOIN TBL_ARCHIVES_CALSS_FILES TACF
ON TAF.FILE_ID = TACF.FILE_ID
LEFT JOIN TBL_ARCHIVES_KEY_FILE TAKF
ON TAKF.FILE_ID = TAF.FILE_ID
ORDER BY TAF.FILE_NAME) THIS_
WHERE (((THIS_.KEYWORDS_ID = ? AND THIS_.KEY_VALUE LIKE ? ESCAPE '~') OR
(THIS_.KEYWORDS_ID = ? AND THIS_.KEY_VALUE LIKE ? ESCAPE '~')) OR
(THIS_.KEYWORDS_ID = ? AND THIS_.KEY_VALUE LIKE ? ESCAPE '~'))
AND THIS_.CLASSIFICATION_ID = ?
AND THIS_.FILE_NAME LIKE ? ESCAPE '~'
AND THIS_.STATUS = ?
AND THIS_.CODE = ?
AND THIS_.PLACE_TIME BETWEEN ? AND ?) TABLE_
在java代码中设置查询条件
public CriteriaType handleSearchCriteria(DataObject criteria, DataObject userInfo){
List<LogicType> andLTList = new ArrayList<LogicType>();
criteria.setList("_or",andLTList); //添加and条件
List<LogicType> orLTList = new ArrayList<LogicType>();
LogicType lt = new LogicTypeImpl();
lt.set_or(orLTList);
andLTList.add(lt);//and条件中添加or条件list
/* 人员 */
String userId = userInfo.getString("userId");
String userName = userInfo.getString("realName");
LogicType perLT = new LogicTypeImpl();
LogicType perLT1 = new LogicTypeImpl();
List<ExprType> andListPerson = new ArrayList<ExprType>();
List<LogicType> andLTListPerson = new ArrayList<LogicType>();
ExprType etId = new ExprTypeImpl();
etId.set_op("like");
etId.set_property("borrowerId");
etId.set_value(userId);
andListPerson.add(etId);
ExprType etName = new ExprTypeImpl();
etName.set_op("like");
etName.set_property("borrowerName");
etName.set_value(userName);
andListPerson.add(etName);
perLT1.set_expr(andListPerson);
andLTListPerson.add(perLT1);
perLT.set_and(andLTListPerson);
orLTList.add(perLT);
/* 岗位 */
List<DataObject> positionsList = userInfo.getList("positions");
if (!CollectionUtils.isEmpty(positionsList)) {
List<LogicType> orLitPO = new ArrayList<LogicType>();
LogicType poLT = new LogicTypeImpl();
for (DataObject object : positionsList) {
List<ExprType> andETList = new ArrayList<ExprType>();
List<LogicType> andLTListPO = new ArrayList<LogicType>();
LogicType tmpLt = new LogicTypeImpl();
LogicType andLt = new LogicTypeImpl();
ExprType exprType1 = new ExprTypeImpl();
exprType1.set_op("like");
exprType1.set_property("positionId");
exprType1.set_value(object.getString("positionId"));
andETList.add(exprType1);
ExprType exprType2 = new ExprTypeImpl();
exprType2.set_op("like");
exprType2.set_property("positionName");
exprType2.set_value(object.getString("positionName"));
andETList.add(exprType2);
tmpLt.set_expr(andETList);
andLTListPO.add(tmpLt);
andLt.set_and(andLTListPO);
orLitPO.add(andLt);
}
poLT.set_or(orLitPO);
orLTList.add(poLT);
}
/* 岗位组 */
List<DataObject> posGroupsList = userInfo.getList("posGroups");
if (!CollectionUtils.isEmpty(posGroupsList)) {
List<LogicType> orListPG = new ArrayList<LogicType>();
LogicType pgLT = new LogicTypeImpl();
for (DataObject object1 : posGroupsList) {
List<ExprType> andETLitPG = new ArrayList<ExprType>();
List<LogicType> andLTListPG = new ArrayList<LogicType>();
LogicType tmpLt = new LogicTypeImpl();
LogicType andLt = new LogicTypeImpl();
ExprType exprType1 = new ExprTypeImpl();
exprType1.set_op("like");
exprType1.set_property("positionGroupId");
exprType1.set_value(object1.getString("posGroupId"));
andETLitPG.add(exprType1);
ExprType exprType2 = new ExprTypeImpl();
exprType2.set_op("like");
exprType2.set_property("positionGroupName");
exprType2.set_value(object1.getString("groupName"));
andETLitPG.add(exprType2);
tmpLt.set_expr(andETLitPG);
andLTListPG.add(tmpLt);
andLt.set_and(andLTListPG);
orListPG.add(andLt);
}
pgLT.set_or(orListPG);
orLTList.add(pgLT);
}
/* 角色 */
List<DataObject> rolesList = userInfo.getList("roles");
if (!CollectionUtils.isEmpty(rolesList)) {
List<LogicType> orListRO = new ArrayList<LogicType>();
LogicType roleLT = new LogicTypeImpl();
for (DataObject object : rolesList) {
List<ExprType> andETLitRO = new ArrayList<ExprType>();
List<LogicType> andLTListRO = new ArrayList<LogicType>();
LogicType tmpLt = new LogicTypeImpl();
LogicType andLt = new LogicTypeImpl();
ExprType exprType1 = new ExprTypeImpl();
exprType1.set_op("like");
exprType1.set_property("roleId");
exprType1.set_value(object.getString("roleId"));
andETLitRO.add(exprType1);
ExprType exprType2 = new ExprTypeImpl();
exprType2.set_op("like");
exprType2.set_property("roleName");
exprType2.set_value(object.getString("roleName"));
andETLitRO.add(exprType2);
tmpLt.set_expr(andETLitRO);
andLTListRO.add(tmpLt);
andLt.set_and(andLTListRO);
orListRO.add(andLt);
}
roleLT.set_or(orListRO);
orLTList.add(roleLT);
}
/* 工作组 */
List<DataObject> teamrolesList = userInfo.getList("teamroles");
if (!CollectionUtils.isEmpty(teamrolesList)) {
List<LogicType> orListTR = new ArrayList<LogicType>();
LogicType trLT = new LogicTypeImpl();
for (DataObject object : teamrolesList) {
List<ExprType> andETLitTR = new ArrayList<ExprType>();
List<LogicType> andLTListTR = new ArrayList<LogicType>();
LogicType tmpLt = new LogicTypeImpl();
LogicType andLt = new LogicTypeImpl();
ExprType exprType1 = new ExprTypeImpl();
exprType1.set_op("like");
exprType1.set_property("workItemId");
exprType1.set_value(object.getString("grouproleId"));
andETLitTR.add(exprType1);
ExprType exprType2 = new ExprTypeImpl();
exprType2.set_op("like");
exprType2.set_property("workItemName");
exprType2.set_value(object.getString("groupRoleName"));
andETLitTR.add(exprType2);
tmpLt.set_expr(andETLitTR);
andLTListTR.add(tmpLt);
andLt.set_and(andLTListTR);
orListTR.add(andLt);
}
trLT.set_or(orListTR);
orLTList.add(trLT);
}
//List groupsList = userInfo.getList("groups");
return (CriteriaType) criteria;
}
生成的SQL语句
SELECT DISTINCT THIS_.FILE_ID AS Y0_,
THIS_.CLASSIFICATION_ID AS Y1_,
THIS_.FILE_NAME AS Y2_,
THIS_.SOURCE AS Y3_,
THIS_.PLACE_TIME AS Y4_,
THIS_.CODE AS Y5_,
THIS_.STATUS AS Y6_,
THIS_.IS_RECHECK AS Y7_,
THIS_.BEGIN_TIME AS Y8_,
THIS_.END_TIME AS Y9_,
THIS_.BOROW_RESULT AS Y10_,
THIS_.BORROWER_NAME AS Y11_,
THIS_.APPLY_NAME AS Y12_,
THIS_.BOROW_ID AS Y13_,
THIS_.DB_DATE AS Y14_
FROM (SELECT TAF.FILE_ID,
TACF.CLASSIFICATION_ID,
TAF.FILE_NAME,
TAF.CODE,
TAF.STATUS,
TAF.SOURCE,
TAF.IS_RECHECK,
TAF.VERSION_NO,
TAF.SAFE_CLASS,
TAF.PLACE_TIME,
TAKF.KEYWORDS_ID,
TAKF.KEY_VALUE,
TAB.BOROW_ID,
TAB.BEGIN_TIME,
TAB.END_TIME,
TAB.BOROW_DISIC,
TAB.BOROW_RESULT,
TAB.RESULT_REASON,
TAB.BORROWER_ID,
TAB.BORROWER_NAME,
TAB.POSITION_ID,
TAB.POSITION_NAME,
TAB.POSITION_GROUP_ID,
TAB.POSITION_GROUP_NAME,
TAB.ROLE_ID,
TAB.ROLE_NAME,
TAB.WORK_ITEM_ID,
TAB.WORK_ITEM_NAME,
TAB.APPLY_ID,
TAB.APPLY_NAME,
SYSDATE AS DB_DATE
FROM TBL_ARCHIVES_FILES TAF
RIGHT JOIN TBL_ARCHIVES_CALSS_FILES TACF
ON TAF.FILE_ID = TACF.FILE_ID
LEFT JOIN TBL_ARCHIVES_KEY_FILE TAKF
ON TAKF.FILE_ID = TAF.FILE_ID
RIGHT JOIN TBL_ARCHIVES_BORROW TAB
ON TAKF.FILE_ID = TAB.FILE_ID
ORDER BY TAF.FILE_NAME) THIS_
WHERE ((((THIS_.BORROWER_ID LIKE ? ESCAPE '~' AND THIS_.BORROWER_NAME LIKE ? ESCAPE '~')
OR
((((
(THIS_.POSITION_ID LIKE ? ESCAPE '~' AND THIS_.POSITION_NAME LIKE ? ESCAPE '~')
OR
(THIS_.POSITION_ID LIKE ? ESCAPE '~' AND THIS_.POSITION_NAME LIKE ? ESCAPE '~')
)
OR
(THIS_.POSITION_ID LIKE ? ESCAPE
'~' AND THIS_.POSITION_NAME LIKE ? ESCAPE '~'))
OR
(THIS_.POSITION_ID LIKE ? ESCAPE
'~' AND THIS_.POSITION_NAME LIKE ? ESCAPE '~'))
OR
(THIS_.POSITION_ID LIKE ? ESCAPE
'~' AND THIS_.POSITION_NAME LIKE ? ESCAPE '~')))
OR
(THIS_.POSITION_GROUP_ID LIKE ? ESCAPE
'~' AND THIS_.POSITION_GROUP_NAME LIKE ? ESCAPE '~')) OR
((((((((((THIS_.ROLE_ID LIKE ? ESCAPE
'~' AND THIS_.ROLE_NAME LIKE ? ESCAPE '~') OR
(THIS_.ROLE_ID LIKE ? ESCAPE
'~' AND THIS_.ROLE_NAME LIKE ? ESCAPE '~')) OR
(THIS_.ROLE_ID LIKE ? ESCAPE
'~' AND THIS_.ROLE_NAME LIKE ? ESCAPE '~')) OR
(THIS_.ROLE_ID LIKE ? ESCAPE
'~' AND THIS_.ROLE_NAME LIKE ? ESCAPE '~')) OR
(THIS_.ROLE_ID LIKE ? ESCAPE
'~' AND THIS_.ROLE_NAME LIKE ? ESCAPE '~')) OR
(THIS_.ROLE_ID LIKE ? ESCAPE
'~' AND THIS_.ROLE_NAME LIKE ? ESCAPE '~')) OR
(THIS_.ROLE_ID LIKE ? ESCAPE
'~' AND THIS_.ROLE_NAME LIKE ? ESCAPE '~')) OR
(THIS_.ROLE_ID LIKE ? ESCAPE
'~' AND THIS_.ROLE_NAME LIKE ? ESCAPE '~')) OR
(THIS_.ROLE_ID LIKE ? ESCAPE '~' AND THIS_.ROLE_NAME LIKE ?
ESCAPE '~')) OR
(THIS_.ROLE_ID LIKE ? ESCAPE '~' AND THIS_.ROLE_NAME LIKE ?
ESCAPE '~')))
AND THIS_.CLASSIFICATION_ID = ?
6万+




被折叠的 条评论
为什么被折叠?



