Commit 67bc9f68 authored by wangyangyang's avatar wangyangyang

借阅单:借阅单统计

parent a4ae3239
......@@ -44,6 +44,11 @@ public class ExtBorrowingFormSearchVo {
*/
private Boolean borrowingDateIs;
/**
* 文件类型
*/
private Boolean fileSubtypeNameIs;
//查询条件
......
......@@ -24,7 +24,7 @@ public class SqlConstants {
"\t\tui.NAME AS dxBorrowingUserInfoName,\n" +
//"\t\tCONCAT(YEAR(bf.BORROWING_DATE),'-01-01 00:00:00') AS borrowingDate ,\n" +
"\t\tYEAR(bf.BORROWING_DATE) AS borrowingDate ,\n" +
"\t\td.NAME AS fileName ,\n" +
//"\t\td.NAME AS fileName ,\n" +
"\t\tmd.DISPLAY_NAME AS fileSubtypeName\n" +
"FROM\n" +
"\t\tEXT_BORROWING_FORM bf\n" +
......@@ -62,13 +62,15 @@ public class SqlConstants {
public static String SQL_GROUP_USER = ", dxBorrowingUserInfoName ";
//年度
public static String SQL_GROUP_DATE = ", borrowingDate ";
//文件类型
public static String SQL_GROUP_FILE = ", fileSubtypeName ";
//最终sql 其中两个属性需要替换
// REPLACE_GROUP_ATTR 分组属性
// REPLACE_WHERE_ATTR 过滤条件
public static String SQL_SEARCH = "SELECT " + SQL_GROUP_STATE
+ REPLACE_GROUP_ATTR
+ REPLACE_GROUP_ATTR + " , "
//四种状态数量
+ SQL_STATE + SQL_BORROW_STATE + SQL_RETURN_STATE + SQL_PROCESS_STATE
+ " FROM ("
......
package com.inet.dcs.document.core.service.impl;
import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.StrUtil;
import com.inet.dcs.document.common.otherVo.ExtBorrowingFormCountVo;
import com.inet.dcs.document.common.otherVo.ExtBorrowingFormSearchVo;
......@@ -72,21 +73,25 @@ public class ExtBorrowingFormServiceImpl<V extends ExtBorrowingFormVO> implement
//状态分组自带
String replace_group_attr = " ";
//借阅部门
if (searchVo.getDxBorrowingOrgIs()) {
if (BooleanUtil.isTrue(searchVo.getDxBorrowingOrgIs())) {
replace_group_attr = replace_group_attr + SqlConstants.SQL_GROUP_ORG;
}
//借阅人
if (searchVo.getDxBorrowingUserInfoIdIs()) {
if (BooleanUtil.isTrue(searchVo.getDxBorrowingUserInfoIdIs())) {
replace_group_attr = replace_group_attr + SqlConstants.SQL_GROUP_USER;
}
//项目
if (searchVo.getDxContextIdIs()) {
if (BooleanUtil.isTrue(searchVo.getDxContextIdIs())) {
replace_group_attr = replace_group_attr + SqlConstants.SQL_GROUP_CONTEXT;
}
//年度
if (searchVo.getBorrowingDateIs()) {
if (BooleanUtil.isTrue(searchVo.getBorrowingDateIs())) {
replace_group_attr = replace_group_attr + SqlConstants.SQL_GROUP_DATE;
}
//文件类型
if (BooleanUtil.isTrue(searchVo.getFileSubtypeNameIs())) {
replace_group_attr = replace_group_attr + SqlConstants.SQL_GROUP_FILE;
}
//过滤条件
String replace_where_attr = "";
......@@ -122,15 +127,15 @@ public class ExtBorrowingFormServiceImpl<V extends ExtBorrowingFormVO> implement
replace_where_attr = replace_where_attr + " borrowingDate >= '" + searchVo.getBorrowingDateStart() + "'";
}
//文件名称
if (!StrUtil.isEmpty(searchVo.getFileName())) {
if (isAddAnd) {
replace_where_attr = replace_where_attr + " and ";
}
isAddAnd = true;
replace_where_attr = replace_where_attr + " fileName = '" + searchVo.getFileName() + "'";
}
// if (!StrUtil.isEmpty(searchVo.getFileName())) {
// if (isAddAnd) {
// replace_where_attr = replace_where_attr + " and ";
// }
// isAddAnd = true;
// replace_where_attr = replace_where_attr + " fileName = '" + searchVo.getFileName() + "'";
// }
//文件类型
if (!StrUtil.isEmpty(searchVo.getDxContextId())) {
if (!StrUtil.isEmpty(searchVo.getFileSubtypeName())) {
if (isAddAnd) {
replace_where_attr = replace_where_attr + " and ";
}
......@@ -139,9 +144,9 @@ public class ExtBorrowingFormServiceImpl<V extends ExtBorrowingFormVO> implement
}
String finalSql = SqlConstants.SQL_SEARCH.replaceAll(SqlConstants.REPLACE_GROUP_ATTR, replace_group_attr);
//.replace(SqlConstants.REPLACE_WHERE_ATTR, replace_where_attr);
//.replace(SqlConstants.REPLACE_WHERE_ATTR, replace_where_attr);
if (!StrUtil.isEmpty(replace_where_attr)){
if (!StrUtil.isEmpty(replace_where_attr)) {
finalSql = finalSql + " HAVING " + replace_where_attr;
}
......
......@@ -19,7 +19,6 @@ FROM
bf.STATE AS STATE ,
ui.NAME AS dxBorrowingUserInfoName,
YEAR(bf.BORROWING_DATE) AS borrowingDate ,
d.NAME AS fileName ,
md.DISPLAY_NAME AS fileSubtypeName
FROM
EXT_BORROWING_FORM bf
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment