校驗規則列表

This commit is contained in:
钱涛 2022-03-30 12:15:49 +08:00
parent f8a704e66c
commit a3604a28f0
9 changed files with 115 additions and 45 deletions

View File

@ -1,7 +1,10 @@
package com.engine.salary.biz;
import com.engine.salary.entity.salarysob.param.SalarySobCheckRuleQueryParam;
import com.engine.salary.entity.salarysob.po.SalarySobCheckRulePO;
import com.engine.salary.mapper.salarysob.SalarySobCheckRuleMapper;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.PageUtil;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
@ -85,4 +88,17 @@ public class SalarySobCheckRuleBiz {
sqlSession.close();
}
}
public PageInfo<SalarySobCheckRulePO> listPageByParam(SalarySobCheckRuleQueryParam param) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
SalarySobCheckRuleMapper mapper = sqlSession.getMapper(SalarySobCheckRuleMapper.class);
PageUtil.start(param.getCurrent(), param.getPageSize());
List<SalarySobCheckRulePO> list = mapper.listByParam(param);
PageInfo<SalarySobCheckRulePO> pageInfo = new PageInfo<SalarySobCheckRulePO>(list, SalarySobCheckRulePO.class);
return pageInfo;
} finally {
sqlSession.close();
}
}
}

View File

@ -4,6 +4,7 @@ import com.cloudstore.eccom.pc.table.WeaTableType;
import com.engine.salary.annotation.SalaryTable;
import com.engine.salary.annotation.SalaryTableColumn;
import com.engine.salary.annotation.SalaryTableOperate;
import com.engine.salary.annotation.TableTitle;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@ -29,20 +30,24 @@ public class SalarySobCheckRuleListDTO {
//主键id
@SalaryTableColumn(column = "id", display = false)
@TableTitle(title = "id", dataIndex = "id", key = "id")
private Long id;
//薪资账套id
private Long salarySobId;
@SalaryTableColumn(text = "名称", width = "10%", column = "name")
@TableTitle(title = "名称", dataIndex = "name", key = "name")
private String name;
//公式id
private Long formulaId;
@SalaryTableColumn(text = "校验规则", width = "10%", column = "formulaContent")
@TableTitle(title = "校验规则", dataIndex = "formulaContent", key = "formulaContent")
private String formulaContent;
@SalaryTableColumn(text = "备注", width = "10%", column = "description")
@TableTitle(title = "备注", dataIndex = "description", key = "description")
private String description;
}

View File

@ -7,12 +7,13 @@ import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @description: 薪资账套校验规则查询参数
* @author: xiajun
* @modified By: xiajun
* @date: Created in 11/23/21 7:02 PM
* @version:v1.0
*/
* 薪资账套校验规则查询参数
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor

View File

@ -1,5 +1,6 @@
package com.engine.salary.mapper.salarysob;
import com.engine.salary.entity.salarysob.param.SalarySobCheckRuleQueryParam;
import com.engine.salary.entity.salarysob.po.SalarySobCheckRulePO;
import org.apache.ibatis.annotations.Param;
@ -21,6 +22,8 @@ public interface SalarySobCheckRuleMapper {
* @return 返回集合没有返回空List
*/
List<SalarySobCheckRulePO> listSome(SalarySobCheckRulePO salarySobCheckRule);
List<SalarySobCheckRulePO> listByParam(SalarySobCheckRuleQueryParam param);
/**
@ -83,5 +86,6 @@ public interface SalarySobCheckRuleMapper {
* @param salarySobCheckRules
*/
void batchInsert(@Param("collection") Collection<SalarySobCheckRulePO> salarySobCheckRules);
}

View File

@ -93,6 +93,45 @@
</select>
<!-- 条件查询 -->
<select id="listByParam" resultMap="BaseResultMap"
parameterType="com.engine.salary.entity.salarysob.po.SalarySobCheckRulePO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_salary_sob_check_rule t
WHERE delete_type = 0
<include refid="paramSql"/>
ORDER BY id DESC
</select>
<sql id="paramSql">
<if test="salarySobId != null">
AND salary_sob_id = #{salarySobId}
</if>
<if test="name != null and name != ''">
AND name like CONCAT('%',#{name},'%')
</if>
</sql>
<sql id="paramSql" databaseId="oracle">
<if test="salarySobId != null">
AND salary_sob_id = #{salarySobId}
</if>
<if test="name != null and name != ''">
AND name like '%'||#{name}||'%'
</if>
</sql>
<sql id="paramSql" databaseId="sqlserver">
<if test="salarySobId != null">
AND salary_sob_id = #{salarySobId}
</if>
<if test="name != null and name != ''">
AND name like '%'+#{name}+'%'
</if>
</sql>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.salarysob.po.SalarySobCheckRulePO"
keyProperty="id" keyColumn="id" useGeneratedKeys="true"

View File

@ -1,8 +1,10 @@
package com.engine.salary.service;
import com.engine.salary.entity.salarysob.param.SalarySobCheckRuleQueryParam;
import com.engine.salary.entity.salarysob.param.SalarySobCheckRuleSaveParam;
import com.engine.salary.entity.salarysob.param.UpdateCheckRuleFormulaParam;
import com.engine.salary.entity.salarysob.po.SalarySobCheckRulePO;
import com.engine.salary.util.page.PageInfo;
import java.util.Collection;
import java.util.List;
@ -56,7 +58,7 @@ public interface SalarySobCheckRuleService {
* @param queryParam 搜索条件
* @return
*/
// Page<SalarySobCheckRulePO> listPageByParam(SalarySobCheckRuleQueryParam queryParam);
PageInfo<SalarySobCheckRulePO> listPageByParam(SalarySobCheckRuleQueryParam queryParam);
/**
* 保存
@ -99,4 +101,6 @@ public interface SalarySobCheckRuleService {
* @param salarySobIds 薪资账套id
*/
void deleteBySalarySobIds(Collection<Long> salarySobIds);
}

View File

@ -4,6 +4,7 @@ import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.biz.SalarySobCheckRuleBiz;
import com.engine.salary.entity.salarysob.bo.SalarySobCheckRuleBO;
import com.engine.salary.entity.salarysob.param.SalarySobCheckRuleQueryParam;
import com.engine.salary.entity.salarysob.param.SalarySobCheckRuleSaveParam;
import com.engine.salary.entity.salarysob.param.UpdateCheckRuleFormulaParam;
import com.engine.salary.entity.salarysob.po.SalarySobCheckRulePO;
@ -13,6 +14,7 @@ import com.engine.salary.service.SalarySobCheckRuleService;
import com.engine.salary.service.SalarySobService;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.valid.RuntimeTypeEnum;
import com.engine.salary.util.valid.ValidUtil;
import org.apache.commons.collections4.CollectionUtils;
@ -57,19 +59,12 @@ public class SalarySobCheckRuleServiceImpl extends Service implements SalarySobC
return salarySobCheckRuleMapper.listSome(SalarySobCheckRulePO.builder().salarySobId(salarySobId).name(name).build());
}
// @Override
// public Page<SalarySobCheckRulePO> listPageByParam(SalarySobCheckRuleQueryParam queryParam) {
// // 分页参数
// Page<SalarySobCheckRulePO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize());
// // 查询薪资账套的校验规则
// return new LambdaQueryChainWrapper<>(salarySobCheckRuleMapper)
// .eq(SalarySobCheckRulePO::getTenantKey, tenantKey)
// .eq(SalarySobCheckRulePO::getDeleteType, 0)
// .eq(SalarySobCheckRulePO::getSalarySobId, queryParam.getSalarySobId())
// .like(SalaryEntityUtil.isNotNullOrEmpty(queryParam.getName()), SalarySobCheckRulePO::getName, queryParam.getName())
// .orderByDesc(SalarySobCheckRulePO::getId)
// .page(page);
// }
@Override
public PageInfo<SalarySobCheckRulePO> listPageByParam(SalarySobCheckRuleQueryParam queryParam) {
return salarySobCheckRuleMapper.listPageByParam(queryParam);
}
@Override
public void save(SalarySobCheckRuleSaveParam saveParam) {

View File

@ -313,13 +313,13 @@ public class SalarySobController {
/**
* 薪资账套校验规则列表
*/
// @POST
// @Path("/checkrule/list")
// @Produces(MediaType.APPLICATION_JSON)
// public String listSalarySobCheckRule(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobCheckRuleQueryParam queryParam) {
// User user = HrmUserVarify.getUser(request, response);
// return new ResponseResult<SalarySobCheckRuleQueryParam, Map<String, Object>>().run(getSalarySobCheckRuleWrapper(user)::listPage, queryParam);
// }
@POST
@Path("/checkrule/list")
@Produces(MediaType.APPLICATION_JSON)
public String listSalarySobCheckRule(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalarySobCheckRuleQueryParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalarySobCheckRuleQueryParam, PageInfo<SalarySobCheckRuleListDTO>>().run(getSalarySobCheckRuleWrapper(user)::listPage, queryParam);
}
/**
* 薪资账套校验规则表单

View File

@ -4,6 +4,8 @@ import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.salarysob.bo.SalarySobCheckRuleBO;
import com.engine.salary.entity.salarysob.dto.SalarySobCheckRuleFormDTO;
import com.engine.salary.entity.salarysob.dto.SalarySobCheckRuleListDTO;
import com.engine.salary.entity.salarysob.param.SalarySobCheckRuleQueryParam;
import com.engine.salary.entity.salarysob.param.SalarySobCheckRuleSaveParam;
import com.engine.salary.entity.salarysob.param.UpdateCheckRuleFormulaParam;
import com.engine.salary.entity.salarysob.po.SalarySobCheckRulePO;
@ -12,10 +14,13 @@ import com.engine.salary.service.SalaryFormulaService;
import com.engine.salary.service.SalarySobCheckRuleService;
import com.engine.salary.service.impl.SalarySobCheckRuleServiceImpl;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.page.PageInfo;
import com.weaver.excel.formula.api.entity.ExpressFormula;
import weaver.hrm.User;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
/**
@ -40,27 +45,28 @@ public class SalarySobCheckRuleWrapper extends Service {
* 薪资账套的校验规则列表
*
* @param queryParam 列表查询条件
* @param tenantKey 租户key
* @return
*/
// public WeaTable<SalarySobCheckRuleListDTO> listPage(SalarySobCheckRuleQueryParam queryParam, String tenantKey) {
// // 分页查询薪资账套的校验规则
// Page<SalarySobCheckRulePO> page = salarySobCheckRuleService.listPageByParam(queryParam, tenantKey);
// // 查询公式详情
// Set<Long> formulaIds = SalaryEntityUtil.properties(page.getRecords(), SalarySobCheckRulePO::getFormulaId);
// List<ExpressFormula> expressFormulas = salaryFormulaService.listExpressFormula(formulaIds, tenantKey);
// // 转换成dto
// List<SalarySobCheckRuleListDTO> salarySobCheckRuleListDTOS = SalarySobCheckRuleBO.convert2ListDTO(page.getRecords(), expressFormulas);
// // 转换成前端所需的数据格式
// Page<SalarySobCheckRuleListDTO> dtoPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount());
// dtoPage.setRecords(salarySobCheckRuleListDTOS);
// return SalaryFormatUtil.<SalarySobCheckRuleListDTO>getInstance().buildTable(SalarySobCheckRuleListDTO.class, dtoPage);
// }
public PageInfo<SalarySobCheckRuleListDTO> listPage(SalarySobCheckRuleQueryParam queryParam) {
// 分页查询薪资账套的校验规则
PageInfo<SalarySobCheckRulePO> page = getSalarySobCheckRuleService(user).listPageByParam(queryParam);
// todo 查询公式详情
// Set<Long> formulaIds = SalaryEntityUtil.properties(page.getList(), SalarySobCheckRulePO::getFormulaId);
// List<ExpressFormula> expressFormulas = salaryFormulaService.listExpressFormula(formulaIds);
// 转换成dto
List<SalarySobCheckRuleListDTO> salarySobCheckRuleListDTOS = SalarySobCheckRuleBO.convert2ListDTO(page.getList(), new ArrayList<>());
// 转换成前端所需的数据格式
PageInfo<SalarySobCheckRuleListDTO> dtoPage = new PageInfo<>(salarySobCheckRuleListDTOS, SalarySobCheckRuleListDTO.class);
dtoPage.setPageSize(page.getPageSize());
dtoPage.setPageNum(page.getPageNum());
dtoPage.setTotal(page.getTotal());
return dtoPage;
}
/**
* 薪资账套的校验规则详情
*
* @param id 校验规则的id
* @param id 校验规则的id
* @return
*/
public SalarySobCheckRuleFormDTO getForm(Long id) {
@ -83,7 +89,7 @@ public class SalarySobCheckRuleWrapper extends Service {
/**
* 保存
*
* @param saveParam 保存参数
* @param saveParam 保存参数
*/
public void save(SalarySobCheckRuleSaveParam saveParam) {
getSalarySobCheckRuleService(user).save(saveParam);
@ -110,7 +116,7 @@ public class SalarySobCheckRuleWrapper extends Service {
/**
* 删除
*
* @param ids 校验规则的id
* @param ids 校验规则的id
*/
public void delete(Collection<Long> ids) {
getSalarySobCheckRuleService(user).deleteByIds(ids);