模板权限

This commit is contained in:
钱涛 2024-12-02 15:01:06 +08:00
parent 9daa406d83
commit 09b5dee199
3 changed files with 53 additions and 8 deletions

View File

@ -0,0 +1,49 @@
package com.engine.salary.handle;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* 集合的转换
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Slf4j
public class LongListTypeHandler extends BaseTypeHandler<List<Long>> {
@Override
public void setNonNullParameter(PreparedStatement preparedStatement, int i, List<Long> list, JdbcType jdbcType) throws SQLException {
preparedStatement.setString(i, JSON.toJSONString(list));
}
@Override
public List<Long> getNullableResult(ResultSet resultSet, String s) throws SQLException {
List jsonArray = JSONArray.parseArray(resultSet.getString(s), Long.class);
return jsonArray == null ? new ArrayList<>() : jsonArray;
}
@Override
public List<Long> getNullableResult(ResultSet resultSet, int i) throws SQLException {
List jsonArray = JSONArray.parseArray(resultSet.getString(i), Long.class);
return jsonArray == null ? new ArrayList<>() : jsonArray;
}
@Override
public List<Long> getNullableResult(CallableStatement callableStatement, int i) throws SQLException {
List jsonArray = JSONArray.parseArray(callableStatement.getString(i), Long.class);
return jsonArray == null ? new ArrayList<>() : jsonArray;
}
}

View File

@ -6,7 +6,7 @@
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="id" property="id"/>
<result column="limit_ids" property="limitIds" typeHandler="com.engine.salary.handle.SalaryListTypeHandler"/>
<result column="limit_ids" property="limitIds" typeHandler="com.engine.salary.handle.LongListTypeHandler"/>
<result column="name" property="name"/>
<result column="page" property="page"/>
<result column="setting" property="setting" typeHandler="com.engine.salary.handle.SalaryListTypeHandler" />

View File

@ -245,15 +245,11 @@ public class SettingServiceImpl extends Service implements SettingService {
PageLinkPO link = getPageLinkMapper().getLink((long) user.getUID(), SALARY_DETAILS_REPORT.getValue());
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService().listAllTaxAgents((long) user.getUID());
List<String> taxIds = SalaryEntityUtil.properties(taxAgentPOS, po -> po.getId().toString(), Collectors.toList());
List<Long> taxIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId, Collectors.toList());
pos = pos.stream().filter(po -> {
if (po.getSharedType() == 1) {
List limitIds = po.getLimitIds();
List<String> collect = new ArrayList<>();
for (int i = 0; i < limitIds.size(); i++) {
collect.add(limitIds.get(i).toString());
}
return CollectionUtil.isNotEmpty(limitIds) && CollectionUtil.intersection(collect, taxIds).size() != 0;
List<Long> limitIds = po.getLimitIds();
return CollectionUtil.isNotEmpty(limitIds) && CollectionUtil.intersection(limitIds, taxIds).size() != 0;
}
return true;
}).peek(po -> {