Commit 67bc9f68 authored by wangyangyang's avatar wangyangyang

借阅单:借阅单统计

parent a4ae3239
...@@ -44,6 +44,11 @@ public class ExtBorrowingFormSearchVo { ...@@ -44,6 +44,11 @@ public class ExtBorrowingFormSearchVo {
*/ */
private Boolean borrowingDateIs; private Boolean borrowingDateIs;
/**
* 文件类型
*/
private Boolean fileSubtypeNameIs;
//查询条件 //查询条件
......
...@@ -24,7 +24,7 @@ public class SqlConstants { ...@@ -24,7 +24,7 @@ public class SqlConstants {
"\t\tui.NAME AS dxBorrowingUserInfoName,\n" + "\t\tui.NAME AS dxBorrowingUserInfoName,\n" +
//"\t\tCONCAT(YEAR(bf.BORROWING_DATE),'-01-01 00:00:00') AS borrowingDate ,\n" + //"\t\tCONCAT(YEAR(bf.BORROWING_DATE),'-01-01 00:00:00') AS borrowingDate ,\n" +
"\t\tYEAR(bf.BORROWING_DATE) 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" + "\t\tmd.DISPLAY_NAME AS fileSubtypeName\n" +
"FROM\n" + "FROM\n" +
"\t\tEXT_BORROWING_FORM bf\n" + "\t\tEXT_BORROWING_FORM bf\n" +
...@@ -62,13 +62,15 @@ public class SqlConstants { ...@@ -62,13 +62,15 @@ public class SqlConstants {
public static String SQL_GROUP_USER = ", dxBorrowingUserInfoName "; public static String SQL_GROUP_USER = ", dxBorrowingUserInfoName ";
//年度 //年度
public static String SQL_GROUP_DATE = ", borrowingDate "; public static String SQL_GROUP_DATE = ", borrowingDate ";
//文件类型
public static String SQL_GROUP_FILE = ", fileSubtypeName ";
//最终sql 其中两个属性需要替换 //最终sql 其中两个属性需要替换
// REPLACE_GROUP_ATTR 分组属性 // REPLACE_GROUP_ATTR 分组属性
// REPLACE_WHERE_ATTR 过滤条件 // REPLACE_WHERE_ATTR 过滤条件
public static String SQL_SEARCH = "SELECT " + SQL_GROUP_STATE 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 + SQL_STATE + SQL_BORROW_STATE + SQL_RETURN_STATE + SQL_PROCESS_STATE
+ " FROM (" + " FROM ("
......
package com.inet.dcs.document.core.service.impl; package com.inet.dcs.document.core.service.impl;
import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.inet.dcs.document.common.otherVo.ExtBorrowingFormCountVo; import com.inet.dcs.document.common.otherVo.ExtBorrowingFormCountVo;
import com.inet.dcs.document.common.otherVo.ExtBorrowingFormSearchVo; import com.inet.dcs.document.common.otherVo.ExtBorrowingFormSearchVo;
...@@ -72,21 +73,25 @@ public class ExtBorrowingFormServiceImpl<V extends ExtBorrowingFormVO> implement ...@@ -72,21 +73,25 @@ public class ExtBorrowingFormServiceImpl<V extends ExtBorrowingFormVO> implement
//状态分组自带 //状态分组自带
String replace_group_attr = " "; String replace_group_attr = " ";
//借阅部门 //借阅部门
if (searchVo.getDxBorrowingOrgIs()) { if (BooleanUtil.isTrue(searchVo.getDxBorrowingOrgIs())) {
replace_group_attr = replace_group_attr + SqlConstants.SQL_GROUP_ORG; 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; 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; 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; 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 = ""; String replace_where_attr = "";
...@@ -122,15 +127,15 @@ public class ExtBorrowingFormServiceImpl<V extends ExtBorrowingFormVO> implement ...@@ -122,15 +127,15 @@ public class ExtBorrowingFormServiceImpl<V extends ExtBorrowingFormVO> implement
replace_where_attr = replace_where_attr + " borrowingDate >= '" + searchVo.getBorrowingDateStart() + "'"; replace_where_attr = replace_where_attr + " borrowingDate >= '" + searchVo.getBorrowingDateStart() + "'";
} }
//文件名称 //文件名称
if (!StrUtil.isEmpty(searchVo.getFileName())) { // if (!StrUtil.isEmpty(searchVo.getFileName())) {
if (isAddAnd) { // if (isAddAnd) {
replace_where_attr = replace_where_attr + " and "; // replace_where_attr = replace_where_attr + " and ";
} // }
isAddAnd = true; // isAddAnd = true;
replace_where_attr = replace_where_attr + " fileName = '" + searchVo.getFileName() + "'"; // replace_where_attr = replace_where_attr + " fileName = '" + searchVo.getFileName() + "'";
} // }
//文件类型 //文件类型
if (!StrUtil.isEmpty(searchVo.getDxContextId())) { if (!StrUtil.isEmpty(searchVo.getFileSubtypeName())) {
if (isAddAnd) { if (isAddAnd) {
replace_where_attr = replace_where_attr + " and "; replace_where_attr = replace_where_attr + " and ";
} }
...@@ -141,7 +146,7 @@ public class ExtBorrowingFormServiceImpl<V extends ExtBorrowingFormVO> implement ...@@ -141,7 +146,7 @@ public class ExtBorrowingFormServiceImpl<V extends ExtBorrowingFormVO> implement
String finalSql = SqlConstants.SQL_SEARCH.replaceAll(SqlConstants.REPLACE_GROUP_ATTR, replace_group_attr); 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; finalSql = finalSql + " HAVING " + replace_where_attr;
} }
......
...@@ -19,7 +19,6 @@ FROM ...@@ -19,7 +19,6 @@ FROM
bf.STATE AS STATE , bf.STATE AS STATE ,
ui.NAME AS dxBorrowingUserInfoName, ui.NAME AS dxBorrowingUserInfoName,
YEAR(bf.BORROWING_DATE) AS borrowingDate , YEAR(bf.BORROWING_DATE) AS borrowingDate ,
d.NAME AS fileName ,
md.DISPLAY_NAME AS fileSubtypeName md.DISPLAY_NAME AS fileSubtypeName
FROM FROM
EXT_BORROWING_FORM bf 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