考勤,出差申请明细列表查询sql优化
parent
ae3baba0fb
commit
54f04ea51b
@ -1,109 +0,0 @@
|
|||||||
package com.engine.attendance.workflow.cmd;
|
|
||||||
|
|
||||||
import com.cloudstore.eccom.constant.WeaBoolAttr;
|
|
||||||
import com.cloudstore.eccom.pc.table.WeaTable;
|
|
||||||
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
|
||||||
import com.cloudstore.eccom.result.WeaResultMsg;
|
|
||||||
import com.engine.common.biz.AbstractCommonCommand;
|
|
||||||
import com.engine.common.entity.BizLogContext;
|
|
||||||
import com.engine.core.interceptor.CommandContext;
|
|
||||||
import com.engine.common.util.DbTools;
|
|
||||||
import weaver.general.Util;
|
|
||||||
import weaver.hrm.User;
|
|
||||||
import weaver.systeminfo.SystemEnv;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author: sy
|
|
||||||
* @Description: 出差申请列表
|
|
||||||
* @Date: 2024/3/15
|
|
||||||
**/
|
|
||||||
public class GetBusinessTripsApplyListCmd extends AbstractCommonCommand<Map<String, Object>> {
|
|
||||||
|
|
||||||
public GetBusinessTripsApplyListCmd(Map<String, Object> params, User user){
|
|
||||||
this.user = user;
|
|
||||||
this.params = params;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BizLogContext getLogContext() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> execute(CommandContext commandContext) {
|
|
||||||
Map<String, Object> retmap = new HashMap<String, Object>();
|
|
||||||
|
|
||||||
//获取主表id列表
|
|
||||||
String targetUserId = Util.null2String(params.get("targetUserId"));
|
|
||||||
String businessTripsType = Util.null2String(params.get("businessTripsType"));
|
|
||||||
String startDate = Util.null2String(params.get("startDate"));
|
|
||||||
String endDate = Util.null2String(params.get("endDate"));
|
|
||||||
|
|
||||||
String sql = "select * from uf_jcl_kq_ccjl where ccr="+targetUserId;
|
|
||||||
if (!businessTripsType.equals("")) {
|
|
||||||
sql += "and cclx = " + businessTripsType;
|
|
||||||
}
|
|
||||||
if (!startDate.equals("")) {
|
|
||||||
sql += "and ksrq >= " + startDate;
|
|
||||||
}
|
|
||||||
if (!endDate.equals("")) {
|
|
||||||
sql += "and jsrq <= " + endDate;
|
|
||||||
}
|
|
||||||
List<String> maidList = new ArrayList<>();
|
|
||||||
if (!targetUserId.equals("")) {
|
|
||||||
List<Map<String,Object>> datas = DbTools.getSqlToList(sql);
|
|
||||||
if (datas.size() > 0) {
|
|
||||||
datas.forEach(f -> {
|
|
||||||
maidList.add(f.get("id").toString());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String backFields = "a.id,a.cxcc,a.ksrq,a.kssj,a.jsrq,a.jssj,a.ccsc,a.qtcc,a.btcc,a.cxsm";
|
|
||||||
String sqlFrom = " uf_jcl_kq_ccjl_dt1 a";
|
|
||||||
String sqlWhere = " where 1=1";
|
|
||||||
if (maidList.size() > 0) {
|
|
||||||
sqlWhere = sqlWhere+ " and mainid in ("+String.join(",",maidList)+")";
|
|
||||||
}
|
|
||||||
String orderby = " id ";
|
|
||||||
String tableString = "";
|
|
||||||
|
|
||||||
// String pageId = PageUidFactory.getHrmPageUid("KQCalendarSettingList");
|
|
||||||
WeaTable table = new WeaTable();
|
|
||||||
// table.setPageID(pageId);
|
|
||||||
// table.setPageUID(pageId + "_" + user.getUID());
|
|
||||||
// String pageSize = PageIdConst.getPageSize(pageId, user.getUID());
|
|
||||||
table.setPagesize("10");
|
|
||||||
|
|
||||||
table.setBackfields(backFields);
|
|
||||||
table.setSqlform(sqlFrom);
|
|
||||||
table.setSqlwhere(sqlWhere);
|
|
||||||
table.setSqlprimarykey("id");
|
|
||||||
table.setSqlorderby("id");
|
|
||||||
// table.getColumns().addAll(tableFields());
|
|
||||||
|
|
||||||
WeaResultMsg result = new WeaResultMsg(false);
|
|
||||||
if (maidList.size() > 0) {
|
|
||||||
result.putAll(table.makeDataResult());
|
|
||||||
}
|
|
||||||
result.success();
|
|
||||||
retmap.putAll(result.getResultMap());
|
|
||||||
|
|
||||||
return retmap;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 构建表格字段
|
|
||||||
*/
|
|
||||||
private List<WeaTableColumn> tableFields() {
|
|
||||||
return new ArrayList<WeaTableColumn>() {{
|
|
||||||
add(new WeaTableColumn("id").setDisplay(WeaBoolAttr.FALSE));
|
|
||||||
add(new WeaTableColumn("10%", SystemEnv.getHtmlLabelName(000000, user.getLanguage()), "xxxxxxx"));//
|
|
||||||
}};
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue