Merge branch 'fix/sysSalaryItemSearchBUG' into release/2.8.3.2306.01
This commit is contained in:
commit
b2f39f56e2
|
|
@ -3,6 +3,7 @@ package com.engine.salary.entity.salaryitem.dto;
|
|||
import com.cloudstore.eccom.pc.table.WeaTableType;
|
||||
import com.engine.salary.annotation.SalaryTable;
|
||||
import com.engine.salary.annotation.SalaryTableColumn;
|
||||
import com.engine.salary.annotation.TableTitle;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
@ -34,18 +35,23 @@ public class SysSalaryItemListDTO {
|
|||
private Long id;
|
||||
|
||||
@SalaryTableColumn(text = "名称", width = "10%", column = "name")
|
||||
@TableTitle(title = "名称", key = "name", dataIndex = "name")
|
||||
private String name;
|
||||
|
||||
@SalaryTableColumn(text = "进位规则", width = "10%", column = "roundingMode",transmethod = "com.engine.salary.transmethod.TransMethod.roundingMode")
|
||||
@TableTitle(title = "进位规则", key = "roundingMode", dataIndex = "roundingMode")
|
||||
private String roundingMode;
|
||||
|
||||
@SalaryTableColumn(text = "保留小数位", width = "10%", column = "pattern")
|
||||
@TableTitle(title = "保留小数位", key = "pattern", dataIndex = "pattern")
|
||||
private Integer pattern;
|
||||
|
||||
@SalaryTableColumn(text = "取值方式", width = "10%", column = "valueType",transmethod = "com.engine.salary.transmethod.TransMethod.datasource")
|
||||
@TableTitle(title = "取值方式", key = "valueType", dataIndex = "valueType")
|
||||
private String valueType;
|
||||
|
||||
@SalaryTableColumn(text = "字段类型", width = "10%", column = "dataType",transmethod = "com.engine.salary.transmethod.TransMethod.dataType")
|
||||
@TableTitle(title = "字段类型", key = "dataType", dataIndex = "dataType")
|
||||
private String dataType;
|
||||
|
||||
// @SalaryTableColumn(text = "个税申报表对应字段", width = "10%", column = "taxDeclarationColumn")
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_sys_salary_item t
|
||||
WHERE delete_type = 0
|
||||
WHERE delete_type = 0 order by id desc
|
||||
</select>
|
||||
|
||||
<!-- 根据主键获取单条记录 -->
|
||||
|
|
@ -66,7 +66,7 @@
|
|||
</select>
|
||||
|
||||
<select id="listSome" resultMap="BaseResultMap"
|
||||
parameterType="com.engine.salary.entity.salaryitem.po.SysSalaryItemPO">
|
||||
parameterType="com.engine.salary.entity.salaryitem.po.SysSalaryItemPO" databaseId="sqlserver">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_sys_salary_item t
|
||||
|
|
@ -75,7 +75,146 @@
|
|||
AND id = #{id}
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
AND name = #{name}
|
||||
AND name like '%'+#{name}+'%'
|
||||
</if>
|
||||
<if test="code != null and code != ''">
|
||||
AND code = #{code}
|
||||
</if>
|
||||
<if test="systemType != null and systemType != ''">
|
||||
AND system_type = #{systemType}
|
||||
</if>
|
||||
<if test="useDefault != null and useDefault != ''">
|
||||
AND use_default = #{useDefault}
|
||||
</if>
|
||||
<if test="useInEmployeeSalary != null and useInEmployeeSalary != ''">
|
||||
AND use_in_employee_salary = #{useInEmployeeSalary}
|
||||
</if>
|
||||
<if test="roundingMode != null and roundingMode != ''">
|
||||
AND rounding_mode = #{roundingMode}
|
||||
</if>
|
||||
<if test="pattern != null and pattern != ''">
|
||||
AND pattern = #{pattern}
|
||||
</if>
|
||||
<if test="valueType != null and valueType != ''">
|
||||
AND value_type = #{valueType}
|
||||
</if>
|
||||
<if test="formulaId != null and formulaId != ''">
|
||||
AND formula_id = #{formulaId}
|
||||
</if>
|
||||
<if test="description != null and description != ''">
|
||||
AND description = #{description}
|
||||
</if>
|
||||
<if test="canEdit != null and canEdit != ''">
|
||||
AND can_edit = #{canEdit}
|
||||
</if>
|
||||
<if test="dataType != null and dataType != ''">
|
||||
AND data_type = #{dataType}
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
AND creator = #{creator}
|
||||
</if>
|
||||
<if test="deleteType != null and deleteType != ''">
|
||||
AND delete_type = #{deleteType}
|
||||
</if>
|
||||
<if test="tenantKey != null and tenantKey != ''">
|
||||
AND tenant_key = #{tenantKey}
|
||||
</if>
|
||||
<if test="createTime != null and createTime != ''">
|
||||
AND create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null and updateTime != ''">
|
||||
AND update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="ids != null and ids.size()>0">
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
|
||||
<select id="listSome" resultMap="BaseResultMap"
|
||||
parameterType="com.engine.salary.entity.salaryitem.po.SysSalaryItemPO" >
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_sys_salary_item t
|
||||
WHERE delete_type = 0
|
||||
<if test="id != null and id != ''">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
AND name like CONCAT('%',#{name},'%')
|
||||
</if>
|
||||
<if test="code != null and code != ''">
|
||||
AND code = #{code}
|
||||
</if>
|
||||
<if test="systemType != null and systemType != ''">
|
||||
AND system_type = #{systemType}
|
||||
</if>
|
||||
<if test="useDefault != null and useDefault != ''">
|
||||
AND use_default = #{useDefault}
|
||||
</if>
|
||||
<if test="useInEmployeeSalary != null and useInEmployeeSalary != ''">
|
||||
AND use_in_employee_salary = #{useInEmployeeSalary}
|
||||
</if>
|
||||
<if test="roundingMode != null and roundingMode != ''">
|
||||
AND rounding_mode = #{roundingMode}
|
||||
</if>
|
||||
<if test="pattern != null and pattern != ''">
|
||||
AND pattern = #{pattern}
|
||||
</if>
|
||||
<if test="valueType != null and valueType != ''">
|
||||
AND value_type = #{valueType}
|
||||
</if>
|
||||
<if test="formulaId != null and formulaId != ''">
|
||||
AND formula_id = #{formulaId}
|
||||
</if>
|
||||
<if test="description != null and description != ''">
|
||||
AND description = #{description}
|
||||
</if>
|
||||
<if test="canEdit != null and canEdit != ''">
|
||||
AND can_edit = #{canEdit}
|
||||
</if>
|
||||
<if test="dataType != null and dataType != ''">
|
||||
AND data_type = #{dataType}
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
AND creator = #{creator}
|
||||
</if>
|
||||
<if test="deleteType != null and deleteType != ''">
|
||||
AND delete_type = #{deleteType}
|
||||
</if>
|
||||
<if test="tenantKey != null and tenantKey != ''">
|
||||
AND tenant_key = #{tenantKey}
|
||||
</if>
|
||||
<if test="createTime != null and createTime != ''">
|
||||
AND create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null and updateTime != ''">
|
||||
AND update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="ids != null and ids.size()>0">
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
|
||||
|
||||
<select id="listSome" resultMap="BaseResultMap"
|
||||
parameterType="com.engine.salary.entity.salaryitem.po.SysSalaryItemPO" databaseId="oracle">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_sys_salary_item t
|
||||
WHERE delete_type = 0
|
||||
<if test="id != null and id != ''">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
AND name like '%'||#{name}||'%'
|
||||
</if>
|
||||
<if test="code != null and code != ''">
|
||||
AND code = #{code}
|
||||
|
|
|
|||
|
|
@ -55,4 +55,6 @@ public interface SysSalaryItemService {
|
|||
void add2SalaryItem(Collection<Long> ids);
|
||||
|
||||
List<SysSalaryItemPO> listAll();
|
||||
|
||||
List<SysSalaryItemPO> listSome(SysSalaryItemPO po);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,4 +106,9 @@ public class SysSalaryItemServiceImpl extends Service implements SysSalaryItemSe
|
|||
public List<SysSalaryItemPO> listAll() {
|
||||
return getSysSalaryItemMapper().listAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysSalaryItemPO> listSome(SysSalaryItemPO po) {
|
||||
return getSysSalaryItemMapper().listSome(po);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public enum DBType implements DBOperateAdapter {
|
|||
ORACLE("oracle") {
|
||||
@Override
|
||||
public String like(String some) {
|
||||
return "'%" + some + "%'";
|
||||
return "like '%" + some + "%'";
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import com.engine.salary.common.SalaryContext;
|
|||
import com.engine.salary.component.WeaFormOption;
|
||||
import com.engine.salary.entity.salaryitem.dto.SalaryItemFormDTO;
|
||||
import com.engine.salary.entity.salaryitem.dto.SalaryItemListDTO;
|
||||
import com.engine.salary.entity.salaryitem.dto.SysSalaryItemListDTO;
|
||||
import com.engine.salary.entity.salaryitem.param.SalaryItemSaveParam;
|
||||
import com.engine.salary.entity.salaryitem.param.SalaryItemSearchParam;
|
||||
import com.engine.salary.entity.salaryitem.param.SysSalaryItemSearchParam;
|
||||
|
|
@ -176,7 +177,7 @@ public class SalaryItemController {
|
|||
public String listSysSalaryItem(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SysSalaryItemSearchParam searchParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
|
||||
return new ResponseResult<SysSalaryItemSearchParam, Map<String, Object>>(user).run(getSysSalaryItemWrapper(user)::listPage, searchParam);
|
||||
return new ResponseResult<SysSalaryItemSearchParam, PageInfo<SysSalaryItemListDTO>>(user).run(getSysSalaryItemWrapper(user)::listPage, searchParam);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,27 +1,24 @@
|
|||
package com.engine.salary.wrapper;
|
||||
|
||||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.component.SalaryWeaTable;
|
||||
import com.engine.salary.entity.salaryitem.bo.SysSalaryItemBO;
|
||||
import com.engine.salary.entity.salaryitem.dto.SysSalaryItemListDTO;
|
||||
import com.engine.salary.entity.salaryitem.param.SysSalaryItemSearchParam;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.entity.salaryitem.po.SysSalaryItemPO;
|
||||
import com.engine.salary.enums.SalarySystemTypeEnum;
|
||||
import com.engine.salary.service.SalaryItemService;
|
||||
import com.engine.salary.service.SysSalaryItemService;
|
||||
import com.engine.salary.service.impl.SalaryItemServiceImpl;
|
||||
import com.engine.salary.service.impl.SysSalaryItemServiceImpl;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.db.DBType;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.util.page.SalaryPageUtil;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -52,53 +49,48 @@ public class SysSalaryItemWrapper extends Service {
|
|||
* @param searchParam 高级搜索的查询条件
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> listPage(SysSalaryItemSearchParam searchParam) {
|
||||
public PageInfo<SysSalaryItemListDTO> listPage(SysSalaryItemSearchParam searchParam) {
|
||||
// 查询已经添加过的系统薪资项目(已经添加过的系统薪资项目不能二次添加)
|
||||
List<SalaryItemPO> salaryItemPOS = getSalaryItemService(user).listBySystemType(SalarySystemTypeEnum.SYSTEM);
|
||||
Set<Long> sysSalaryItemIds = SalaryEntityUtil.properties(salaryItemPOS, SalaryItemPO::getSysSalaryItemId);
|
||||
searchParam.setExcludeIds(sysSalaryItemIds);
|
||||
|
||||
|
||||
SalaryWeaTable<SysSalaryItemListDTO> table = new SalaryWeaTable<SysSalaryItemListDTO>(user, SysSalaryItemListDTO.class);
|
||||
table.setSqlwhere(makeSqlWhere(searchParam));
|
||||
table.setSqlorderby("t.id DESC");
|
||||
table.setSqlprimarykey("t.id");
|
||||
table.setSqlisdistinct("false");
|
||||
|
||||
WeaResultMsg result = new WeaResultMsg(false);
|
||||
result.putAll(table.makeDataResult());
|
||||
result.success();
|
||||
return result.getResultMap();
|
||||
List<SysSalaryItemPO> sysSalaryItemPOS = getSysSalaryItemService(user).listSome(SysSalaryItemPO.builder().name(searchParam.getName()).build());
|
||||
List<SysSalaryItemPO> finalItems = sysSalaryItemPOS.stream().filter(item -> !sysSalaryItemIds.contains(item.getId())).collect(Collectors.toList());
|
||||
List<SysSalaryItemListDTO> sysSalaryItemListDTOS = SysSalaryItemBO.convert2ListDTO(finalItems);
|
||||
// 分页参数
|
||||
PageInfo<SysSalaryItemListDTO> pageInfo = SalaryPageUtil.buildPage(searchParam.getCurrent(), searchParam.getPageSize(), sysSalaryItemListDTOS, SysSalaryItemListDTO.class);
|
||||
return pageInfo;
|
||||
}
|
||||
|
||||
private String makeSqlWhere(SysSalaryItemSearchParam searchParam) {
|
||||
DBType dbType = DBType.get(new RecordSet().getDBType());
|
||||
String sqlWhere = " t.delete_type = 0 ";
|
||||
|
||||
String name = searchParam.getName();
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
sqlWhere += " AND t.name " + dbType.like(name);
|
||||
}
|
||||
|
||||
String itemType = searchParam.getItemType();
|
||||
if (StringUtils.isNotBlank(itemType)) {
|
||||
sqlWhere += " AND t.item_type = " + itemType;
|
||||
}
|
||||
|
||||
String category = searchParam.getCategory();
|
||||
if (StringUtils.isNotBlank(category)) {
|
||||
sqlWhere += " AND t.category = " + category;
|
||||
}
|
||||
|
||||
Collection<Long> excludeIds = searchParam.getExcludeIds();
|
||||
if (CollectionUtils.isNotEmpty(excludeIds)) {
|
||||
String idsStr = excludeIds.stream().map(String::valueOf).collect(Collectors.joining(","));
|
||||
sqlWhere += " AND t.id NOT IN (" + idsStr + ")";
|
||||
}
|
||||
|
||||
|
||||
return sqlWhere;
|
||||
}
|
||||
// private String makeSqlWhere(SysSalaryItemSearchParam searchParam) {
|
||||
// DBType dbType = DBType.get(new RecordSet().getDBType());
|
||||
// String sqlWhere = " t.delete_type = 0 ";
|
||||
//
|
||||
// String name = searchParam.getName();
|
||||
// if (StringUtils.isNotBlank(name)) {
|
||||
// sqlWhere += " AND t.name " + dbType.like(name);
|
||||
// }
|
||||
//
|
||||
// String itemType = searchParam.getItemType();
|
||||
// if (StringUtils.isNotBlank(itemType)) {
|
||||
// sqlWhere += " AND t.item_type = " + itemType;
|
||||
// }
|
||||
//
|
||||
// String category = searchParam.getCategory();
|
||||
// if (StringUtils.isNotBlank(category)) {
|
||||
// sqlWhere += " AND t.category = " + category;
|
||||
// }
|
||||
//
|
||||
// Collection<Long> excludeIds = searchParam.getExcludeIds();
|
||||
// if (CollectionUtils.isNotEmpty(excludeIds)) {
|
||||
// String idsStr = excludeIds.stream().map(String::valueOf).collect(Collectors.joining(","));
|
||||
// sqlWhere += " AND t.id NOT IN (" + idsStr + ")";
|
||||
// }
|
||||
//
|
||||
//
|
||||
// return sqlWhere;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 获取高级搜索
|
||||
|
|
|
|||
Loading…
Reference in New Issue