76 lines
2.5 KiB
Java
76 lines
2.5 KiB
Java
package com.engine.salary.cmd.TaxAgent;
|
|
|
|
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.salary.component.SalaryWeaTable;
|
|
import com.engine.salary.entity.taxrate.vo.TaxAgentTableVO;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import weaver.conn.RecordSet;
|
|
import weaver.hrm.User;
|
|
|
|
import java.util.Map;
|
|
|
|
public class TaxAgentListCmd extends AbstractCommonCommand<Map<String, Object>> {
|
|
|
|
public TaxAgentListCmd(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) {
|
|
|
|
SalaryWeaTable<TaxAgentTableVO> table = new SalaryWeaTable<TaxAgentTableVO>(user, TaxAgentTableVO.class);
|
|
|
|
//sql条件
|
|
String sqlWhere = makeSqlWhere(params);
|
|
table.setSqlwhere(sqlWhere);
|
|
|
|
WeaResultMsg result = new WeaResultMsg(false);
|
|
result.putAll(table.makeDataResult());
|
|
result.success();
|
|
return result.getResultMap();
|
|
}
|
|
|
|
/**
|
|
* sql条件
|
|
*
|
|
* @param params
|
|
* @return
|
|
*/
|
|
private String makeSqlWhere(Map<String, Object> params) {
|
|
|
|
RecordSet rs = new RecordSet();
|
|
String sqlWhere = "where delete_Type = 0";
|
|
// Collection<String> ids = (Collection<String>) params.get("ids");
|
|
// if (CollectionUtils.isNotEmpty(ids)) {
|
|
// sqlWhere.append(" AND id in (").append(String.join(",", ids)).append(")");
|
|
// }
|
|
//模糊查询
|
|
String name = (String) params.get("name");
|
|
if (StringUtils.isNotBlank(name)) {
|
|
// if ("mysql".equalsIgnoreCase(rs.getDBType())) {
|
|
// sqlWhere.append(" AND name like '%").append(name).append("%') ");
|
|
// } else if ("sqlserver".equalsIgnoreCase(rs.getDBType())) {
|
|
// sqlWhere.append(" AND name like CONCAT('%',").append(name).append(",'%') ");
|
|
// } else if ("oracle".equalsIgnoreCase(rs.getDBType())) {
|
|
// sqlWhere.append(" AND name like '%'||").append(name).append("||'%' ");
|
|
// } else {
|
|
// sqlWhere.append(" AND name like '%'").append(name).append("'%' ");
|
|
// }
|
|
sqlWhere += " AND name like '%" + name + "%'";
|
|
}
|
|
|
|
return sqlWhere;
|
|
}
|
|
|
|
|
|
}
|