数据权限的修改

This commit is contained in:
1745237360-cloud
2026-01-10 16:39:33 +08:00
parent 29b24e8450
commit 4b427e1b2e
97 changed files with 3056 additions and 466 deletions
@@ -124,11 +124,51 @@ public class BusinessDocumentApplicationService {
public List<BusinessDocumentPO> queryList(BusinessDocumentDO businessDocumentDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser == null || loginUser.getUserPo() == null) {
log.warn("运单管理查询 - 未获取到登录用户信息,跳过数据权限过滤");
return businessDocumentDomainService.queryList(businessDocumentDO);
}
UserPo userPo = loginUser.getUserPo();
if (userPo.getUserAccountType() == 3){
businessDocumentDO.setTopOrganizationId(userPo.getTopOrganizationId());
}else {
businessDocumentDO.setOrganizationId(userPo.getOrganizationId());
Long loginUserOrganizationId = userPo.getOrganizationId();
Long topOrganizationId = userPo.getTopOrganizationId();
// 先保存前端传递的 organizationId(如果存在)
Long frontendOrganizationId = businessDocumentDO.getOrganizationId();
// 数据权限:根据organizationId来设置查询权限
// organizationId等于2827时查询全部,其他仅查询各自组织的信息
if (loginUserOrganizationId != null && loginUserOrganizationId.equals(2827L)) {
// 南光组织(organizationId=2827):可以查询所有组织的数据
// 如果前端传递了 organizationId,使用前端传递的值进行过滤
// 如果前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
if (frontendOrganizationId != null) {
businessDocumentDO.setOrganizationId(frontendOrganizationId);
businessDocumentDO.setTopOrganizationId(null);
} else {
businessDocumentDO.setOrganizationId(null);
businessDocumentDO.setTopOrganizationId(null);
}
} else {
// 其他组织:根据userAccountType设置组织过滤
if (userPo.getUserAccountType() == 3){
// 租户管理员:使用topOrganizationId
if (topOrganizationId != null) {
businessDocumentDO.setTopOrganizationId(topOrganizationId);
}
businessDocumentDO.setOrganizationId(null);
} else {
// 其他用户:使用organizationId
if (frontendOrganizationId != null && !frontendOrganizationId.equals(loginUserOrganizationId)) {
// 前端传递了其他组织的organizationId,强制使用当前登录用户的组织ID,防止越权查询
log.warn("运单管理查询 - 前端传递的组织ID {} 与当前登录用户的组织ID {} 不一致,使用当前登录用户的组织ID进行过滤",
frontendOrganizationId, loginUserOrganizationId);
businessDocumentDO.setOrganizationId(loginUserOrganizationId);
} else if (frontendOrganizationId == null) {
businessDocumentDO.setOrganizationId(loginUserOrganizationId);
}
businessDocumentDO.setTopOrganizationId(null);
}
}
return businessDocumentDomainService.queryList(businessDocumentDO);
}
@@ -1347,6 +1387,21 @@ public class BusinessDocumentApplicationService {
detail.setUpdateBy(loginUser.getUserid());
detail.setUpdateByName(loginUser.getUsername());
detail.setUpdateTime(now);
// 设置审核人的组织ID和组织名称
if (loginUser.getUserPo() != null) {
Long organizationId = loginUser.getUserPo().getOrganizationId();
String organizationName = loginUser.getUserPo().getOrganizationName();
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (organizationId != null) {
detail.setOrganizationId(organizationId);
}
if (organizationName != null) {
detail.setOrganizationName(organizationName);
}
if (topOrganizationId != null) {
detail.setTopOrganizationId(topOrganizationId);
}
}
businessDocumentDetaliUpdateList.add(detail);
BusinessDocumentDetaliDTO detailDto = new BusinessDocumentDetaliDTO();
@@ -1401,6 +1456,7 @@ public class BusinessDocumentApplicationService {
Verification verification = new Verification();
verification.setOrganizationId(businessDocumentDetaliDTO.getOrganizationId());
verification.setTopOrganizationId(businessDocumentDetaliDTO.getTopOrganizationId());
verification.setOrganizationName(businessDocumentDetaliDTO.getOrganizationName());
verification.setVerificationStatus(1);//未支付
verification.setBusinessDocumentDetaliId(businessDocumentDetaliDTO.getBusinessDocumentDetaliId());
verification.setBusinessDocumentDetaliNumber(businessDocumentDetaliDTO.getBusinessDocumentDetaliNumber());
@@ -56,7 +56,7 @@ public class ReceivingAccountApplicationService {
}
/**
* 批量新增收款账户(先删除所有,再新增
* 批量新增收款账户(追加式新增,不删除旧数据
*
* @param receivingAccountDTOList 收款账户DTO列表
* @return 是否成功
@@ -65,9 +65,10 @@ public class ReceivingAccountApplicationService {
public Boolean batchInsert(List<ReceivingAccountDO> receivingAccountDTOList) {
log.info("批量新增收款账户,数量:{}", receivingAccountDTOList.size());
// 先删除所有现有数据
int deleteCount = receivingAccountRepository.deleteAll();
log.info("已删除现有收款账户数量:{}", deleteCount);
if (receivingAccountDTOList == null || receivingAccountDTOList.isEmpty()) {
log.warn("批量新增收款账户:数据列表为空");
return false;
}
List<ReceivingAccount> receivingAccountList = new ArrayList<>();
Date now = new Date();
@@ -75,17 +75,68 @@ public class ReconciliationApplicationService {
public List<ReconciliationPO> queryList(ReconciliationDO reconciliationDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
UserPo userPo = loginUser.getUserPo();
if (userPo.getUserAccountType() == 3) {
reconciliationDO.setTopOrganizationId(userPo.getTopOrganizationId());
} else if (userPo.getUserAccountType() == 2){
reconciliationDO.setOrganizationId(userPo.getOrganizationId());
// 先保存前端传递的 organizationId(如果存在)
Long frontendOrganizationId = reconciliationDO.getOrganizationId();
// 获取当前登录用户的组织信息
Long loginUserOrganizationId = userPo.getOrganizationId();
Long topOrganizationId = userPo.getTopOrganizationId();
// 数据权限:根据organizationId来设置查询权限
// organizationId等于2827时查询全部,其他仅查询各自组织的信息
if (loginUserOrganizationId != null && loginUserOrganizationId.equals(2827L)) {
// 南光组织(organizationId=2827):可以查询所有组织的数据
// 如果前端传递了 organizationId,使用前端传递的值进行过滤(包括2827)
// 如果前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId,使用前端传递的值进行过滤
reconciliationDO.setOrganizationId(frontendOrganizationId);
reconciliationDO.setTopOrganizationId(null);
} else {
// 前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
reconciliationDO.setOrganizationId(null);
reconciliationDO.setTopOrganizationId(null);
}
} else {
if (loginUser.getRoleList().contains(RoleEnum.SHIPPER.getCode()) || loginUser.getRoleList().contains(RoleEnum.COMPANY.getCode())){
reconciliationDO.setUserId(userPo.getUserId());
}else {
reconciliationDO.setOrganizationId(userPo.getOrganizationId());
// 其他组织:设置organizationId,只查询当前组织的数据
// 其他组织只能查询自己组织的数据,不能查询其他组织(包括南光)的数据
// 如果其他组织尝试查询南光(organizationId=2827)的数据,返回空数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId.equals(2827L)) {
// 其他组织尝试查询南光的数据,设置一个不存在的 organizationId,返回空数据
reconciliationDO.setOrganizationId(-1L);
reconciliationDO.setTopOrganizationId(null);
} else if (!frontendOrganizationId.equals(loginUserOrganizationId)) {
// 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询
reconciliationDO.setOrganizationId(loginUserOrganizationId);
if (topOrganizationId != null) {
reconciliationDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 前端传递的 organizationId 与当前登录用户的组织ID一致,使用前端传递的值
reconciliationDO.setOrganizationId(frontendOrganizationId);
if (topOrganizationId != null) {
reconciliationDO.setTopOrganizationId(topOrganizationId);
}
}
} else {
// 前端没有传递 organizationId,根据用户账号类型设置组织过滤条件
if (userPo.getUserAccountType() == 3) {
reconciliationDO.setTopOrganizationId(topOrganizationId);
} else if (userPo.getUserAccountType() == 2){
reconciliationDO.setOrganizationId(loginUserOrganizationId);
} else {
if (loginUser.getRoleList().contains(RoleEnum.SHIPPER.getCode()) || loginUser.getRoleList().contains(RoleEnum.COMPANY.getCode())){
reconciliationDO.setUserId(userPo.getUserId());
}else {
reconciliationDO.setOrganizationId(loginUserOrganizationId);
}
}
}
}
return reconciliationDomainService.queryList(reconciliationDO);
}
@@ -50,13 +50,80 @@ public class TmsReceiptApplicationService {
public List<TmsReceiptPO> queryList(TmsReceiptDO tmsReceiptDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
tmsReceiptDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
if (loginUser == null || loginUser.getUserPo() == null) {
log.warn("收款单查询 - 未获取到登录用户信息,跳过数据权限过滤");
return tmsReceiptDomainService.queryList(tmsReceiptDO);
}
// 先保存前端传递的 organizationId(如果存在)
Long frontendOrganizationId = tmsReceiptDO.getOrganizationId();
// 获取当前登录用户的组织信息
Long loginUserOrganizationId = loginUser.getUserPo().getOrganizationId();
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
log.info("收款单查询 - 开始数据权限处理 - 登录用户组织ID: {}, topOrganizationId: {}, 前端传递组织ID: {}",
loginUserOrganizationId, topOrganizationId, frontendOrganizationId);
// 数据权限:根据organizationId来设置查询权限
// organizationId等于2827时查询全部,其他仅查询各自组织的信息
if (loginUserOrganizationId != null && loginUserOrganizationId.equals(2827L)) {
// 南光组织(organizationId=2827):可以查询所有组织的数据
// 如果前端传递了 organizationId,使用前端传递的值进行过滤(包括2827)
// 如果前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId,使用前端传递的值进行过滤
tmsReceiptDO.setOrganizationId(frontendOrganizationId);
tmsReceiptDO.setTopOrganizationId(null);
} else {
// 前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
tmsReceiptDO.setOrganizationId(null);
tmsReceiptDO.setTopOrganizationId(null);
}
} else {
// 其他组织:设置organizationId,只查询当前组织的数据
// 其他组织只能查询自己组织的数据,不能查询其他组织(包括南光)的数据
// 如果其他组织尝试查询南光(organizationId=2827)的数据,返回空数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (frontendOrganizationId.equals(2827L)) {
// 其他组织尝试查询南光的数据,设置一个不存在的 organizationId,返回空数据
tmsReceiptDO.setOrganizationId(-1L);
tmsReceiptDO.setTopOrganizationId(null);
} else if (!frontendOrganizationId.equals(loginUserOrganizationId)) {
// 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询
tmsReceiptDO.setOrganizationId(loginUserOrganizationId);
if (topOrganizationId != null && topOrganizationId != 1) {
tmsReceiptDO.setTopOrganizationId(topOrganizationId);
}
} else {
// 前端传递的 organizationId 与当前登录用户的组织ID一致,使用前端传递的值
tmsReceiptDO.setOrganizationId(frontendOrganizationId);
if (topOrganizationId != null && topOrganizationId != 1) {
tmsReceiptDO.setTopOrganizationId(topOrganizationId);
}
}
} else {
// 前端没有传递 organizationId,根据用户组织信息设置过滤条件
// 优先使用 topOrganizationId(如果存在且不等于1),否则使用 organizationId
if (topOrganizationId != null && topOrganizationId != 1) {
tmsReceiptDO.setTopOrganizationId(topOrganizationId);
tmsReceiptDO.setOrganizationId(null);
} else if (loginUserOrganizationId != null) {
tmsReceiptDO.setOrganizationId(loginUserOrganizationId);
tmsReceiptDO.setTopOrganizationId(null);
}
}
}
return tmsReceiptDomainService.queryList(tmsReceiptDO);
// 调试日志:打印设置的查询条件
log.info("收款单查询 - 数据权限处理完成 - 登录用户组织ID: {}, 前端传递组织ID: {}, 最终查询条件 - organizationId: {}, topOrganizationId: {}, 是否为南光组织: {}",
loginUserOrganizationId, frontendOrganizationId, tmsReceiptDO.getOrganizationId(), tmsReceiptDO.getTopOrganizationId(),
(loginUserOrganizationId != null && loginUserOrganizationId.equals(2827L)));
List<TmsReceiptPO> result = tmsReceiptDomainService.queryList(tmsReceiptDO);
log.info("收款单查询 - 查询完成,返回数据条数: {}", result != null ? result.size() : 0);
return result;
}
@@ -351,6 +351,12 @@ public class InvoiceInfoManageApplicationService {
//数据装配
InvoiceInfo invoiceInfo = new InvoiceAssembler().toDo(invoiceInfoDto);
// 设置当前登录用户的组织信息
com.mhd.system.api.model.LoginUser loginUser = com.mhd.common.security.utils.SecurityUtils.getLoginUser();
if (loginUser != null && loginUser.getUserPo() != null) {
invoiceInfo.setOrganizationId(loginUser.getUserPo().getOrganizationId());
invoiceInfo.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
}
invoiceInfo.setInvoiceStatus(1);
invoiceInfo.setInvoiceHeader(invoiceInfoManagePo.getInvoiceHeader());
invoiceInfo.setWaybillAmount(new BigDecimal(invoiceInfoDto.getInvoiceOrderIds().length));
@@ -137,6 +137,12 @@ public class RevenueExpensesRecordApplicationService
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
// 设置当前登录用户的组织信息
if (loginUser.getUserPo() != null) {
revenueExpensesRecord.setOrganizationId(loginUser.getUserPo().getOrganizationId());
revenueExpensesRecord.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
}
//支付通道
if(StringUtils.isNotEmpty(revenueExpensesRecord.getPayChannel())){
List<SysDictDataVo> timeTagEndVos = selectListByDictType(DictCode.pay_channel.getCode());
@@ -151,44 +151,58 @@ public class VerificationApplicationService
* @return 收入核销集合
*/
public List<VerificationPo> selectVerificationList(VerificationPo verificationPo){
List<VerificationPo> list = new ArrayList<>();
List<Long> organizationIdList = new ArrayList<>();
//获取登录人信息
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser == null || loginUser.getUserPo() == null) {
log.warn("应付账单查询 - 未获取到登录用户信息,跳过数据权限过滤");
return verificationDomainService.selectVerificationList(verificationPo);
}
UserPo userPo = loginUser.getUserPo();
//当前组织id
Long organizationId = new Long("2");
OrganizationPo organizationPo = loginUser.getOrganizationPo();
if (organizationPo == null){
organizationIdList.add(userPo.getOrganizationId());
}else {
List<Long> organizationIdList1 = organizationPo.getOrganizationIdList();
if (organizationIdList1 != null && organizationIdList1.size() > 0){
organizationIdList.addAll(organizationIdList1);
}else {
organizationIdList.add(organizationPo.getOrganizationId());
// 先保存前端传递的 organizationId(如果存在)
Long frontendOrganizationId = verificationPo.getOrganizationId();
// 获取当前登录用户的组织信息
Long loginUserOrganizationId = userPo.getOrganizationId();
Long topOrganizationId = userPo.getTopOrganizationId();
// 数据权限:根据organizationId来设置查询权限
// topOrganizationId为null时,为顶级组织(南光组织),查所有;其他组织查自己
if (topOrganizationId == null) {
// 南光组织:可以查询所有组织的数据
// 如果前端传递了 organizationId,使用前端传递的值进行过滤
// 如果前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId,使用前端传递的值进行过滤
verificationPo.setOrganizationId(frontendOrganizationId);
verificationPo.setTopOrganizationId(null);
} else {
// 前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
verificationPo.setOrganizationId(null);
verificationPo.setTopOrganizationId(null);
}
} else {
// 其他组织:设置organizationId,只查询当前组织的数据
// 其他组织只能查询自己组织的数据
if (frontendOrganizationId != null) {
// 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
if (!frontendOrganizationId.equals(loginUserOrganizationId)) {
// 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询
verificationPo.setOrganizationId(loginUserOrganizationId);
} else {
// 前端传递的 organizationId 与当前登录用户的组织ID一致,使用前端传递的值
verificationPo.setOrganizationId(frontendOrganizationId);
}
verificationPo.setTopOrganizationId(topOrganizationId);
} else {
// 前端没有传递 organizationId,使用当前登录用户的组织ID
verificationPo.setOrganizationId(loginUserOrganizationId);
verificationPo.setTopOrganizationId(topOrganizationId);
}
}
if(loginUser != null){
// if(loginUser.getUserPo() != null && loginUser.getUserPo().getOrganizationId() != null){
// organizationId = loginUser.getUserPo().getOrganizationId();
// AjaxResult info = specialLogisticsServiceFeign.getBranchByOrganizationId(organizationId);
// if("200".equals(String.valueOf(info.get("code")))){
// BranchPo branchPo = JSONObject.parseObject(JSONObject.toJSONString(info.get("data")), BranchPo.class);
// verificationPo.setBranchId(branchPo.getBranchId());
// }
// }
}
if (organizationIdList != null && organizationIdList.size() > 0){
organizationIdList.add(userPo.getOrganizationId());
}
// verificationPo.setOrganizationIdList(organizationIdList);
// verificationPo.setVerificationType(2);
// if (StringUtils.isNotBlank(verificationPo.getWaybillNumbers())){
// verificationPo.setWaybillNumberList(CollectionUtil.toList(verificationPo.getWaybillNumbers().split(",")));
// }
return verificationDomainService.selectOutVerificationList(verificationPo);
// return verificationDomainService.selectVerificationList(verificationPo);
}
/**
@@ -58,6 +58,11 @@ public class InvoiceOrderDomainService
*/
public int insertInvoiceOrder(InvoiceOrder invoiceOrder)
{
// 设置当前登录用户的组织信息
com.mhd.system.api.model.LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null && loginUser.getUserPo() != null) {
invoiceOrder.setOrganizationId(loginUser.getUserPo().getOrganizationId());
}
invoiceOrder.setCreateTime(new Date());
invoiceOrder.setCreateBy(SecurityUtils.getUserId());
invoiceOrder.setCreateByName(SecurityUtils.getUsername());
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.linke.finance.domain.receivingAccount.entity.ReceivingAccount;
import com.linke.finance.domain.receivingAccount.repository.po.ReceivingAccountPO;
import com.linke.finance.domain.receivingAccount.repository.todo.ReceivingAccountDO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -46,6 +47,15 @@ public interface ReceivingAccountMapper extends BaseMapper<ReceivingAccount> {
*/
int deleteAll();
/**
* 根据组织ID删除收款账户(删除当前组织的所有收款账户)
*
* @param topOrganizationId 一级组织ID
* @param organizationId 组织ID
* @return 影响行数
*/
int deleteByOrganization(@Param("topOrganizationId") String topOrganizationId, @Param("organizationId") String organizationId);
/**
* 根据ID删除收款账户
*
@@ -60,6 +60,17 @@ public class ReceivingAccountRepository {
return receivingAccountMapper.deleteAll();
}
/**
* 根据组织ID删除收款账户(删除当前组织的所有收款账户)
*
* @param topOrganizationId 一级组织ID
* @param organizationId 组织ID
* @return 影响行数
*/
public int deleteByOrganization(String topOrganizationId, String organizationId) {
return receivingAccountMapper.deleteByOrganization(topOrganizationId, organizationId);
}
/**
* 根据ID删除收款账户
*
@@ -28,7 +28,7 @@ public class TmsReceiptDTO extends BaseVOEntity{
@ApiModelProperty("一级组织ID")
@Excel(name = "一级组织ID")
private Integer topOrganizationId;
private Long topOrganizationId;
@ApiModelProperty("收款单号")
@Excel(name = "收款单号")
@@ -107,22 +107,19 @@ public class TmsReceiptDTO extends BaseVOEntity{
@Excel(name = "是否删除", readConverterExp = "删除标记:0-无状态,1-正常,2-已删除")
private Integer delFlag;
@ApiModelProperty(name = "组织ID集合")
private List<Long> organizationIdList;
// @ApiModelProperty(name = "组织ID集合")
// @Excel(name = "组织ID集合")
// private List<Long> organizationIdList;
//
// @ApiModelProperty(name = "权限菜单ID")
// @Excel(name = "权限菜单ID")
// private Long permissionMenuId;
//
// @ApiModelProperty("组织表id")
// @Excel(name = "组织表id")
// private Long organizationId;
//
// @ApiModelProperty("组织名称")
// @Excel(name = "组织名称")
// private String organizationName;
@ApiModelProperty(name = "权限菜单ID")
private Long permissionMenuId;
@ApiModelProperty("组织表id")
@Excel(name = "组织表id")
private Long organizationId;
@ApiModelProperty("组织名称")
@Excel(name = "组织名称")
private String organizationName;
@ApiModelProperty("挂账原因")
@Excel(name = "挂账原因")
@@ -15,6 +15,8 @@ import com.linke.finance.domain.reconciliation.repository.po.FinacialReconciliat
import com.linke.finance.infrastructure.util.UniqueKeyUtil;
import com.linke.finance.interfaces.dto.InvoiceOrderDto;
import com.mhd.common.core.domain.dto.BusinessDocumentDetaliDTO;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.model.LoginUser;
import com.mhd.common.core.domain.dto.EditPaymentMethodDTO;
import com.mhd.common.log.annotation.Log;
import com.mhd.common.log.enums.BusinessType;
@@ -16,6 +16,8 @@ import com.mhd.common.core.utils.IgnoreNullUtil;
import com.mhd.common.core.utils.bean.BeanUtils;
import com.mhd.common.log.annotation.Log;
import com.mhd.common.log.enums.BusinessType;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.model.LoginUser;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -56,6 +58,39 @@ public class TmsReceiptApi extends BaseController{
// TmsReceiptDO tmsReceiptDO = tmsReceiptAssembler.toDO(tmsReceiptDTO);
TmsReceiptDO tmsReceiptDO = new TmsReceiptDO();
BeanUtils.copyProperties(tmsReceiptDTO, tmsReceiptDO);
// 获取当前登录用户的组织信息,用于SQL中的数据隔离
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null && loginUser.getUserPo() != null) {
Long loginOrgId = loginUser.getUserPo().getOrganizationId();
// 保存前端传入的组织查询条件(如果有)
Long frontendOrgId = tmsReceiptDO.getOrganizationId();
Long frontendTopOrgId = tmsReceiptDO.getTopOrganizationId();
// 如果当前登录用户的organizationId为2827(南光组织),可查询全部组织数据;其他组织只能查询自己组织的数据
if (loginOrgId == null || !loginOrgId.equals(2827L)) {
// 其他组织:只能查询自己组织的数据,忽略前端传入的组织查询条件
Long topOrgId = loginUser.getUserPo().getTopOrganizationId();
Long orgId = loginUser.getUserPo().getOrganizationId();
// 强制使用当前登录用户的组织信息,确保只能查询自己组织的数据
if (topOrgId != null) {
tmsReceiptDO.setTopOrganizationId(topOrgId);
}
if (orgId != null) {
tmsReceiptDO.setOrganizationId(orgId);
}
// 注意:organizationName 条件仍然可以使用,但会被 organizationId 条件限制,只能查询自己组织的
} else {
// 南光组织(organizationId = 2827):可以查询全部组织数据
// 如果前端传入了组织查询条件(organizationId、topOrganizationId或organizationName),则使用前端条件
// 如果前端没有传入任何组织查询条件,则不设置组织ID过滤,查询全部(但organization_name IS NOT NULL仍会生效)
if (frontendOrgId == null && frontendTopOrgId == null && (tmsReceiptDO.getOrganizationName() == null || tmsReceiptDO.getOrganizationName().isEmpty())) {
// 前端没有传入任何组织查询条件,清空组织ID过滤,查询全部组织数据
tmsReceiptDO.setTopOrganizationId(null);
tmsReceiptDO.setOrganizationId(null);
}
// 如果前端传入了组织查询条件,则保留使用前端条件(organizationId、topOrganizationId或organizationName
}
}
startPage();
List<TmsReceiptPO> list = tmsReceiptApplicationService.queryList(tmsReceiptDO);
return getDataTable(list);
@@ -71,6 +106,22 @@ public class TmsReceiptApi extends BaseController{
//转换实体
ReceivingAccountDO receivingAccountDO = new ReceivingAccountDO();
BeanUtils.copyProperties(receivingAccountDTO, receivingAccountDO);
// 获取当前登录用户的组织信息,用于数据隔离
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null && loginUser.getUserPo() != null) {
Long organizationId = loginUser.getUserPo().getOrganizationId();
// 如果当前登录用户的organizationId为2827(南光组织),可查询全部组织数据;其他组织只能查询自己组织的数据
if (organizationId == null || !organizationId.equals(2827L)) {
Long topOrgId = loginUser.getUserPo().getTopOrganizationId();
Long orgId = loginUser.getUserPo().getOrganizationId();
if (topOrgId != null) {
receivingAccountDO.setTopOrganizationId(String.valueOf(topOrgId));
}
if (orgId != null) {
receivingAccountDO.setOrganizationId(String.valueOf(orgId));
}
}
}
startPage();
List<ReceivingAccountPO> list = receivingAccountApplicationService.queryList(receivingAccountDO);
return getDataTable(list);
@@ -87,6 +138,18 @@ public class TmsReceiptApi extends BaseController{
//转换实体
ReceivingAccountDO receivingAccountDO = new ReceivingAccountDO();
BeanUtils.copyProperties(receivingAccountDTO, receivingAccountDO);
// 获取当前登录用户的组织信息
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null && loginUser.getUserPo() != null) {
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
Long organizationId = loginUser.getUserPo().getOrganizationId();
if (topOrganizationId != null) {
receivingAccountDO.setTopOrganizationId(String.valueOf(topOrganizationId));
}
if (organizationId != null) {
receivingAccountDO.setOrganizationId(String.valueOf(organizationId));
}
}
return toAjax(receivingAccountApplicationService.insert(receivingAccountDO));
}
@@ -98,11 +161,28 @@ public class TmsReceiptApi extends BaseController{
@PostMapping("/batchAddAccount")
public AjaxResult batchAddAccount(@RequestBody List<ReceivingAccountDTO> receivingAccountDTOList)
{
// 获取当前登录用户的组织信息
LoginUser loginUser = SecurityUtils.getLoginUser();
String topOrganizationId = null;
String organizationId = null;
if (loginUser != null && loginUser.getUserPo() != null) {
Long topOrgId = loginUser.getUserPo().getTopOrganizationId();
Long orgId = loginUser.getUserPo().getOrganizationId();
if (topOrgId != null) {
topOrganizationId = String.valueOf(topOrgId);
}
if (orgId != null) {
organizationId = String.valueOf(orgId);
}
}
//转换实体
List<ReceivingAccountDO> receivingAccountDOList = new ArrayList<>();
for (ReceivingAccountDTO dto : receivingAccountDTOList) {
ReceivingAccountDO receivingAccountDO = new ReceivingAccountDO();
BeanUtils.copyProperties(dto, receivingAccountDO);
// 设置当前登录用户的组织信息
receivingAccountDO.setTopOrganizationId(topOrganizationId);
receivingAccountDO.setOrganizationId(organizationId);
receivingAccountDOList.add(receivingAccountDO);
}
return toAjax(receivingAccountApplicationService.batchInsert(receivingAccountDOList));
@@ -11,10 +11,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="delFlag" column="del_flag" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="topOrganizationId" column="top_organization_id" />
<result property="organizationId" column="organization_id" />
</resultMap>
<sql id="selectReceivingAccountPo">
select id, account_name, account_information, del_flag, create_time, update_time
select id, account_name, account_information, del_flag, create_time, update_time, top_organization_id, organization_id
from receiving_account
</sql>
@@ -30,6 +32,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="accountInformation != null and accountInformation != ''">
and account_information like concat('%', #{accountInformation}, '%')
</if>
<if test="topOrganizationId != null and topOrganizationId != ''">
and top_organization_id = #{topOrganizationId}
</if>
<if test="organizationId != null and organizationId != ''">
and organization_id = #{organizationId}
</if>
order by create_time desc
</where>
</sql>
@@ -47,6 +55,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delFlag != null">del_flag,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="topOrganizationId != null and topOrganizationId != ''">top_organization_id,</if>
<if test="organizationId != null and organizationId != ''">organization_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="accountName != null and accountName != ''">#{accountName},</if>
@@ -54,6 +64,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="delFlag != null">#{delFlag},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="topOrganizationId != null and topOrganizationId != ''">#{topOrganizationId},</if>
<if test="organizationId != null and organizationId != ''">#{organizationId},</if>
</trim>
</insert>
@@ -84,4 +96,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
update_time = now()
where del_flag = 1
</update>
<update id="deleteByOrganization">
update receiving_account
set del_flag = 2,
update_time = now()
where del_flag = 1
<if test="topOrganizationId != null and topOrganizationId != ''">
and top_organization_id = #{topOrganizationId}
</if>
<if test="organizationId != null and organizationId != ''">
and organization_id = #{organizationId}
</if>
</update>
</mapper>
@@ -31,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateByName" column="update_by_name" />
<result property="delFlag" column="del_flag" />
<result property="organizationId" column="organization_id" />
<result property="organizationName" column="organization_name" />
<result property="topOrganizationId" column="top_organization_id" />
<result property="approvalNumber" column="approval_number" />
<result property="isInvoice" column="is_invoice" />
@@ -134,12 +135,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateByName != null and updateByName != ''">
and a.update_by_name like concat('%', #{updateByName}, '%')
</if>
<!-- 组织ID过滤条件:如果设置了organizationId,则按组织ID精确匹配 -->
<if test="organizationId != null ">
and a.organization_id = #{organizationId}
</if>
<!-- 一级组织ID过滤条件:如果设置了topOrganizationId,则按一级组织ID匹配 -->
<if test="topOrganizationId != null ">
and a.top_organization_id = #{topOrganizationId}
</if>
<!-- 组织名称模糊查询条件:如果前端传入了组织名称,则按组织名称模糊匹配 -->
<if test="organizationName != null and organizationName != ''">
and a.organization_name LIKE CONCAT('%',#{organizationName},'%')
</if>
<!-- 当设置了组织相关查询条件时,确保organization_name不为null且不为空字符串 -->
<if test="organizationId != null or topOrganizationId != null or (organizationName != null and organizationName != '')">
and a.organization_name IS NOT NULL
and a.organization_name &lt;&gt; ''
and LENGTH(TRIM(a.organization_name)) > 0
</if>
<if test="collectionTimeStart != null and collectionTimeEnd != null">
AND (date_format(a.collection_time,'%Y-%m-%d') >= date_format(#{collectionTimeStart},'%Y-%m-%d')
and date_format(a.collection_time,'%Y-%m-%d') <![CDATA[<=]]> date_format(#{collectionTimeEnd},'%Y-%m-%d'))
@@ -45,8 +45,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="bankAccount" column="bank_account" />
<result property="oilNumber" column="oil_number" />
<result property="voucherImages" column="voucher_images" />
<result property="payChannel" column="pay_channel" />
<result property="payChannelName" column="pay_channel_name" />
<result property="kingdee" column="kingdee" />
<result property="kingdeeSubjectCode" column="kingdee_subject_code" />
@@ -95,8 +93,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bank_account,
oil_number,
voucher_images,
pay_channel,
pay_channel_name,
kingdee,
kingdee_subject_code,
kingdee_subject_name,
@@ -97,6 +97,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
<if test="accountInformation != null and accountInformation != ''">
and account_information like concat('%', #{accountInformation}, '%')
</if>
<!-- 无论什么情况,organization_name 都不能为空,也不能为空字符串 -->
and organization_name IS NOT NULL
and organization_name &lt;&gt; ''
and LENGTH(TRIM(organization_name)) > 0
<!-- 组织ID过滤条件:如果设置了organizationId,则按组织ID精确匹配 -->
<if test="organizationId != null ">
and organization_id = #{organizationId}
</if>
<!-- 一级组织ID过滤条件:如果设置了topOrganizationId,则按一级组织ID匹配 -->
<if test="topOrganizationId != null ">
and top_organization_id = #{topOrganizationId}
</if>
<!-- 组织名称模糊查询条件:如果前端传入了组织名称,则按组织名称模糊匹配 -->
<if test="organizationName != null and organizationName != ''">
and organization_name LIKE CONCAT('%',#{organizationName},'%')
</if>
order by create_time desc
</where>
@@ -47,61 +47,62 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="delFlag" column="del_flag" />
<result property="organizationId" column="organization_id" />
<result property="topOrganizationId" column="top_organization_id" />
<result property="organizationName" column="organization_name" />
</resultMap>
<sql id="selectVerificationVo">
SELECT
verification_id,
verification_status,
business_document_detali_id,
business_document_detali_number,
business_document_id,
business_document_number,
business_type,
inner_number,
enter_account_time,
expense_item,
first_subject,
first_subject_name,
second_subject,
second_subject_name,
verification_money,
pay_id,
pay_person,
pay_channel,
pay_channel_name,
bank_number,
receipt_number,
pay_remark,
account_holder_name,
account_holder_bank,
bank_account,
images,
audit_remark,
create_time,
create_by,
create_by_name,
update_time,
update_by,
update_by_name,
del_flag,
pay_way,
pay_way_name,
organization_id,
top_organization_id,
receivable_type,
department_id,
department_name,
payee,
pay_type,
license_number,
pay_id,
pay_name,
bill_remarks,
payment_method,
fuel_card_number
v.verification_id,
v.verification_status,
v.business_document_detali_id,
v.business_document_detali_number,
v.business_document_id,
v.business_document_number,
v.business_type,
v.inner_number,
v.enter_account_time,
v.expense_item,
v.first_subject,
v.first_subject_name,
v.second_subject,
v.second_subject_name,
v.verification_money,
v.pay_id,
v.pay_person,
v.pay_channel,
v.pay_channel_name,
v.bank_number,
v.receipt_number,
v.pay_remark,
v.account_holder_name,
v.account_holder_bank,
v.bank_account,
v.images,
v.audit_remark,
v.create_time,
v.create_by,
v.create_by_name,
v.update_time,
v.update_by,
v.update_by_name,
v.del_flag,
v.pay_way,
v.pay_way_name,
v.organization_id,
v.top_organization_id,
v.receivable_type,
v.department_id,
v.department_name,
v.payee,
v.pay_type,
v.license_number,
v.pay_name,
v.bill_remarks,
v.payment_method,
v.fuel_card_number,
v.organization_name
FROM
verification
verification v
</sql>
<select id="selectVerificationOneList" parameterType="com.mhd.common.core.domain.po.VerificationPo" resultMap="VerificationResult">
@@ -343,9 +344,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectVerificationList" parameterType="com.mhd.common.core.domain.po.VerificationPo" resultMap="VerificationResult">
<include refid="selectVerificationVo"/>
<where>
and del_flag = 1
and v.del_flag = 1
<!-- 组织查询条件:南光组织查所有,其他组织查自己 -->
<if test="organizationId != null">
<choose>
<!-- 南光组织判断:如果topOrganizationId为null,则为顶级组织(南光组织),查所有 -->
<when test="topOrganizationId == null">
<!-- 南光组织查所有数据,不添加组织过滤条件 -->
<!-- 如果organizationName为null,根据组织ID查询时不显示organizationName为null的数据 -->
<if test="organizationName == null or organizationName == ''">
AND v.organization_name IS NOT NULL
</if>
</when>
<otherwise>
<!-- 其他组织只查自己组织的数据 -->
AND v.organization_id = #{organizationId}
<!-- organizationName为null时,根据组织ID查询时不显示organizationName为null的数据 -->
<if test="organizationName == null or organizationName == ''">
AND v.organization_name IS NOT NULL
</if>
</otherwise>
</choose>
</if>
<if test="businessDocumentNumberList != null and businessDocumentNumberList.size() != 0">
AND business_document_number in
AND v.business_document_number in
<foreach item="waybill" collection="businessDocumentNumberList" open="(" separator="," close=")">
#{waybill}
</foreach>
@@ -369,55 +391,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- )-->
<!-- </if>-->
<if test="enterAccountTimeStart != null">
AND date_format(create_time,'%Y-%m-%d') >= #{enterAccountTimeStart}
AND date_format(v.create_time,'%Y-%m-%d') >= #{enterAccountTimeStart}
</if>
<if test="enterAccountTimeEnd != null">
AND date_format(create_time,'%Y-%m-%d') <![CDATA[<=]]> #{enterAccountTimeEnd}
AND date_format(v.create_time,'%Y-%m-%d') <![CDATA[<=]]> #{enterAccountTimeEnd}
</if>
<if test="cancelAfterVerificationTimeStart != null and cancelAfterVerificationTimeStart != ''">
AND date_format(cancel_after_verification_time,'%Y-%m-%d') >= #{cancelAfterVerificationTimeStart}
AND date_format(v.cancel_after_verification_time,'%Y-%m-%d') >= #{cancelAfterVerificationTimeStart}
</if>
<if test="cancelAfterVerificationTimeEnd != null and cancelAfterVerificationTimeEnd != ''">
AND date_format(cancel_after_verification_time,'%Y-%m-%d') <![CDATA[<=]]> #{cancelAfterVerificationTimeEnd}
AND date_format(v.cancel_after_verification_time,'%Y-%m-%d') <![CDATA[<=]]> #{cancelAfterVerificationTimeEnd}
</if>
<if test="cancelAfterVerificationType != null"> and cancel_after_verification_type = #{cancelAfterVerificationType}</if>
<if test="mailBranch != null"> and mail_branch = #{mailBranch}</if>
<if test="accountHolderBank != null and accountHolderBank != ''"> and account_holder_bank = #{accountHolderBank}</if>
<if test="accountHolderName != null and accountHolderName != ''"> and account_holder_name = #{accountHolderName}</if>
<if test="bankAccount != null and bankAccount != ''"> and bank_account = #{bankAccount}</if>
<if test="arriveBranch != null"> and arrive_branch = #{arriveBranch}</if>
<if test="verificationType != null "> and verification_type = #{verificationType}</if>
<if test="verificationStatusOne != null and verificationStatusOne != '0'.toString()"> and verification_status = #{verificationStatusOne}</if>
<if test="verificationStatus != null and verificationStatus == '5'.toString()"> and verification_status <![CDATA[<=]]> #{verificationStatus}</if>
<if test="verificationStatus != null and verificationStatus == '6'.toString()"> and verification_status = #{verificationStatus}</if>
<if test="innerNumber != null and innerNumber != ''"> and inner_number like concat('%', #{innerNumber}, '%')</if>
<if test="enterAccountTime != null "> and enter_account_time = #{enterAccountTime}</if>
<if test="firstSubject != null and firstSubject != ''"> and first_subject = #{firstSubject}</if>
<if test="secondSubject != null and secondSubject != ''"> and second_subject = #{secondSubject}</if>
<if test="verificationMoney != null "> and verification_money = #{verificationMoney}</if>
<if test="payPerson != null and payPerson != ''"> and pay_person = #{payPerson}</if>
<if test="payChannel != null and payChannel != ''"> and pay_channel = #{payChannel}</if>
<if test="bankNumber != null and bankNumber != ''"> and bank_number = #{bankNumber}</if>
<if test="receiptNumber != null and receiptNumber != ''"> and receipt_number = #{receiptNumber}</if>
<if test="collectionRemark != null and collectionRemark != ''"> and collection_remark = #{collectionRemark}</if>
<if test="waybillId != null "> and waybill_id = #{waybillId}</if>
<if test="waybillNumber != null and waybillNumber != ''"> and waybill_number like concat('%', #{waybillNumber}, '%')</if>
<if test="waybillRemark != null and waybillRemark != ''"> and waybill_remark = #{waybillRemark}</if>
<if test="waybillSource != null and waybillSource != ''"> and waybill_source = #{waybillSource}</if>
<if test="revenueExpensesNumber != null and revenueExpensesNumber != ''"> and revenue_expenses_number = #{revenueExpensesNumber}</if>
<if test="enterAccountId != null "> and enter_account_id = #{enterAccountId}</if>
<if test="enterAccountName != null and enterAccountName != ''"> and enter_account_name like concat('%', #{enterAccountName}, '%')</if>
<if test="cancelAfterVerificationId != null "> and cancel_after_verification_id = #{cancelAfterVerificationId}</if>
<if test="cancelAfterVerificationName != null and cancelAfterVerificationName != ''"> and cancel_after_verification_name like concat('%', #{cancelAfterVerificationName}, '%')</if>
<if test="cancelAfterVerificationTime != null "> and cancel_after_verification_time = #{cancelAfterVerificationTime}</if>
<if test="createByName != null and createByName != ''"> and create_by_name like concat('%', #{createByName}, '%')</if>
<if test="updateByName != null and updateByName != ''"> and update_by_name like concat('%', #{updateByName}, '%')</if>
<if test="cancelAfterVerificationStatus != null and cancelAfterVerificationStatus == '5'.toString()"> and verification_status in (1,2,3,4,5)</if>
<if test="cancelAfterVerificationStatus != null and cancelAfterVerificationStatus == '6'.toString()"> and verification_status = 6</if>
<if test="inVerificationStatus != null"> and in_verification_status = #{inVerificationStatus}</if>
<if test="uuidCode != null"> and uuid_code = #{uuidCode}</if>
<if test="cancelAfterVerificationType != null"> and v.cancel_after_verification_type = #{cancelAfterVerificationType}</if>
<if test="mailBranch != null"> and v.mail_branch = #{mailBranch}</if>
<if test="accountHolderBank != null and accountHolderBank != ''"> and v.account_holder_bank = #{accountHolderBank}</if>
<if test="accountHolderName != null and accountHolderName != ''"> and v.account_holder_name = #{accountHolderName}</if>
<if test="bankAccount != null and bankAccount != ''"> and v.bank_account = #{bankAccount}</if>
<if test="arriveBranch != null"> and v.arrive_branch = #{arriveBranch}</if>
<if test="verificationType != null "> and v.verification_type = #{verificationType}</if>
<if test="verificationStatusOne != null and verificationStatusOne != '0'.toString()"> and v.verification_status = #{verificationStatusOne}</if>
<if test="verificationStatus != null and verificationStatus == '5'.toString()"> and v.verification_status <![CDATA[<=]]> #{verificationStatus}</if>
<if test="verificationStatus != null and verificationStatus == '6'.toString()"> and v.verification_status = #{verificationStatus}</if>
<if test="innerNumber != null and innerNumber != ''"> and v.inner_number like concat('%', #{innerNumber}, '%')</if>
<if test="enterAccountTime != null "> and v.enter_account_time = #{enterAccountTime}</if>
<if test="firstSubject != null and firstSubject != ''"> and v.first_subject = #{firstSubject}</if>
<if test="secondSubject != null and secondSubject != ''"> and v.second_subject = #{secondSubject}</if>
<if test="verificationMoney != null "> and v.verification_money = #{verificationMoney}</if>
<if test="payPerson != null and payPerson != ''"> and v.pay_person = #{payPerson}</if>
<if test="payChannel != null and payChannel != ''"> and v.pay_channel = #{payChannel}</if>
<if test="bankNumber != null and bankNumber != ''"> and v.bank_number = #{bankNumber}</if>
<if test="receiptNumber != null and receiptNumber != ''"> and v.receipt_number = #{receiptNumber}</if>
<if test="collectionRemark != null and collectionRemark != ''"> and v.collection_remark = #{collectionRemark}</if>
<if test="waybillId != null "> and v.waybill_id = #{waybillId}</if>
<if test="waybillNumber != null and waybillNumber != ''"> and v.waybill_number like concat('%', #{waybillNumber}, '%')</if>
<if test="waybillRemark != null and waybillRemark != ''"> and v.waybill_remark = #{waybillRemark}</if>
<if test="waybillSource != null and waybillSource != ''"> and v.waybill_source = #{waybillSource}</if>
<if test="revenueExpensesNumber != null and revenueExpensesNumber != ''"> and v.revenue_expenses_number = #{revenueExpensesNumber}</if>
<if test="enterAccountId != null "> and v.enter_account_id = #{enterAccountId}</if>
<if test="enterAccountName != null and enterAccountName != ''"> and v.enter_account_name like concat('%', #{enterAccountName}, '%')</if>
<if test="cancelAfterVerificationId != null "> and v.cancel_after_verification_id = #{cancelAfterVerificationId}</if>
<if test="cancelAfterVerificationName != null and cancelAfterVerificationName != ''"> and v.cancel_after_verification_name like concat('%', #{cancelAfterVerificationName}, '%')</if>
<if test="cancelAfterVerificationTime != null "> and v.cancel_after_verification_time = #{cancelAfterVerificationTime}</if>
<if test="createByName != null and createByName != ''"> and v.create_by_name like concat('%', #{createByName}, '%')</if>
<if test="updateByName != null and updateByName != ''"> and v.update_by_name like concat('%', #{updateByName}, '%')</if>
<if test="cancelAfterVerificationStatus != null and cancelAfterVerificationStatus == '5'.toString()"> and v.verification_status in (1,2,3,4,5)</if>
<if test="cancelAfterVerificationStatus != null and cancelAfterVerificationStatus == '6'.toString()"> and v.verification_status = 6</if>
<if test="inVerificationStatus != null"> and v.in_verification_status = #{inVerificationStatus}</if>
<if test="uuidCode != null"> and v.uuid_code = #{uuidCode}</if>
</where>
order by create_time desc
order by v.create_time desc
</select>
<select id="selectVerificationByVerificationId" parameterType="java.lang.Long" resultMap="VerificationResult">
@@ -989,12 +1011,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY
a.create_time DESC, a.verification_id DESC
</select>
<select id="selectOutVerificationList" resultType="com.mhd.common.core.domain.po.VerificationPo">
<select id="selectOutVerificationList" parameterType="com.mhd.common.core.domain.po.VerificationPo" resultMap="VerificationResult">
<include refid="selectVerificationVo"/>
<where>
and del_flag = 1
and v.del_flag = 1
<!-- 组织查询条件:南光组织查所有,其他组织查自己 -->
<if test="organizationId != null">
<choose>
<!-- 南光组织判断:如果topOrganizationId为null,则为顶级组织(南光组织),查所有 -->
<when test="topOrganizationId == null">
<!-- 南光组织查所有数据,不添加组织过滤条件 -->
<!-- 如果organizationName为null,根据组织ID查询时不显示organizationName为null的数据 -->
<if test="organizationName == null or organizationName == ''">
AND v.organization_name IS NOT NULL
</if>
</when>
<otherwise>
<!-- 其他组织只查自己组织的数据 -->
AND v.organization_id = #{organizationId}
<!-- organizationName为null时,根据组织ID查询时不显示organizationName为null的数据 -->
<if test="organizationName == null or organizationName == ''">
AND v.organization_name IS NOT NULL
</if>
</otherwise>
</choose>
</if>
<if test="businessDocumentNumberList != null and businessDocumentNumberList.size() != 0">
AND business_document_number in
AND v.business_document_number in
<foreach item="waybill" collection="businessDocumentNumberList" open="(" separator="," close=")">
#{waybill}
</foreach>
@@ -1018,50 +1061,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- )-->
<!-- </if>-->
<if test="enterAccountTimeStart != null">
AND date_format(create_time,'%Y-%m-%d') >= #{enterAccountTimeStart}
AND date_format(v.create_time,'%Y-%m-%d') >= #{enterAccountTimeStart}
</if>
<if test="enterAccountTimeEnd != null">
AND date_format(create_time,'%Y-%m-%d') <![CDATA[<=]]> #{enterAccountTimeEnd}
AND date_format(v.create_time,'%Y-%m-%d') <![CDATA[<=]]> #{enterAccountTimeEnd}
</if>
<if test="paymentMethod != null ">
and payment_method = #{paymentMethod}
and v.payment_method = #{paymentMethod}
</if>
<if test="cancelAfterVerificationTimeStart != null and cancelAfterVerificationTimeStart != ''">
AND date_format(cancel_after_verification_time,'%Y-%m-%d') >= #{cancelAfterVerificationTimeStart}
AND date_format(v.cancel_after_verification_time,'%Y-%m-%d') >= #{cancelAfterVerificationTimeStart}
</if>
<if test="cancelAfterVerificationTimeEnd != null and cancelAfterVerificationTimeEnd != ''">
AND date_format(cancel_after_verification_time,'%Y-%m-%d') <![CDATA[<=]]> #{cancelAfterVerificationTimeEnd}
AND date_format(v.cancel_after_verification_time,'%Y-%m-%d') <![CDATA[<=]]> #{cancelAfterVerificationTimeEnd}
</if>
<!-- <if test="cancelAfterVerificationType != null"> and cancel_after_verification_type = #{cancelAfterVerificationType}</if>-->
<!-- <if test="mailBranch != null"> and mail_branch = #{mailBranch}</if>-->
<if test="accountHolderBank != null and accountHolderBank != ''"> and account_holder_bank = #{accountHolderBank}</if>
<if test="businessDocumentDetaliNumber != null and businessDocumentDetaliNumber != ''"> and business_document_detali_number like concat('%', #{businessDocumentDetaliNumber}, '%')</if>
<if test="accountHolderName != null and accountHolderName != ''"> and account_holder_name = #{accountHolderName}</if>
<if test="bankAccount != null and bankAccount != ''"> and bank_account = #{bankAccount}</if>
<if test="accountHolderBank != null and accountHolderBank != ''"> and v.account_holder_bank = #{accountHolderBank}</if>
<if test="businessDocumentDetaliNumber != null and businessDocumentDetaliNumber != ''"> and v.business_document_detali_number like concat('%', #{businessDocumentDetaliNumber}, '%')</if>
<if test="accountHolderName != null and accountHolderName != ''"> and v.account_holder_name = #{accountHolderName}</if>
<if test="bankAccount != null and bankAccount != ''"> and v.bank_account = #{bankAccount}</if>
<!-- <if test="arriveBranch != null"> and arrive_branch = #{arriveBranch}</if>-->
<!-- <if test="verificationType != null "> and verification_type = #{verificationType}</if>-->
<!-- <if test="verificationStatusOne != null and verificationStatusOne != '0'.toString()"> and verification_status = #{verificationStatusOne}</if>-->
<!-- <if test="verificationStatus != null and verificationStatus == '5'.toString()"> and verification_status <![CDATA[<=]]> #{verificationStatus}</if>-->
<if test="verificationStatus != null "> and verification_status = #{verificationStatus}</if>
<if test="businessType != null "> and business_type = #{businessType}</if>
<if test="innerNumber != null and innerNumber != ''"> and inner_number like concat('%', #{innerNumber}, '%')</if>
<if test="businessDocumentNumber != null and businessDocumentNumber != ''"> and business_document_number = #{businessDocumentNumber} </if>
<if test="expenseItem != null and expenseItem != ''"> and expense_item = #{expenseItem} </if>
<if test="enterAccountTime != null "> and enter_account_time = #{enterAccountTime}</if>
<if test="firstSubject != null and firstSubject != ''"> and first_subject = #{firstSubject}</if>
<if test="secondSubject != null and secondSubject != ''"> and second_subject = #{secondSubject}</if>
<if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
<if test="payee != null and payee != ''"> and payee like concat('%', #{payee}, '%')</if>
<if test="payName != null and payName != ''"> and pay_name like concat('%', #{payName}, '%')</if>
<if test="licenseNumber != null and licenseNumber != ''"> and license_number like concat('%', #{licenseNumber}, '%')</if>
<if test="departmentName != null and departmentName != ''"> and department_name like concat('%', #{departmentName}, '%')</if>
<if test="verificationMoney != null "> and verification_money = #{verificationMoney}</if>
<if test="payPerson != null and payPerson != ''"> and pay_person = #{payPerson}</if>
<if test="payChannel != null and payChannel != ''"> and pay_channel = #{payChannel}</if>
<if test="bankNumber != null and bankNumber != ''"> and bank_number = #{bankNumber}</if>
<if test="receiptNumber != null and receiptNumber != ''"> and receipt_number = #{receiptNumber}</if>
<if test="verificationStatus != null "> and v.verification_status = #{verificationStatus}</if>
<if test="businessType != null "> and v.business_type = #{businessType}</if>
<if test="innerNumber != null and innerNumber != ''"> and v.inner_number like concat('%', #{innerNumber}, '%')</if>
<if test="businessDocumentNumber != null and businessDocumentNumber != ''"> and v.business_document_number = #{businessDocumentNumber} </if>
<if test="expenseItem != null and expenseItem != ''"> and v.expense_item = #{expenseItem} </if>
<if test="enterAccountTime != null "> and v.enter_account_time = #{enterAccountTime}</if>
<if test="firstSubject != null and firstSubject != ''"> and v.first_subject = #{firstSubject}</if>
<if test="secondSubject != null and secondSubject != ''"> and v.second_subject = #{secondSubject}</if>
<if test="payType != null and payType != ''"> and v.pay_type = #{payType}</if>
<if test="payee != null and payee != ''"> and v.payee like concat('%', #{payee}, '%')</if>
<if test="payName != null and payName != ''"> and v.pay_name like concat('%', #{payName}, '%')</if>
<if test="licenseNumber != null and licenseNumber != ''"> and v.license_number like concat('%', #{licenseNumber}, '%')</if>
<if test="departmentName != null and departmentName != ''"> and v.department_name like concat('%', #{departmentName}, '%')</if>
<if test="verificationMoney != null "> and v.verification_money = #{verificationMoney}</if>
<if test="payPerson != null and payPerson != ''"> and v.pay_person = #{payPerson}</if>
<if test="payChannel != null and payChannel != ''"> and v.pay_channel = #{payChannel}</if>
<if test="bankNumber != null and bankNumber != ''"> and v.bank_number = #{bankNumber}</if>
<if test="receiptNumber != null and receiptNumber != ''"> and v.receipt_number = #{receiptNumber}</if>
<!-- <if test="collectionRemark != null and collectionRemark != ''"> and collection_remark = #{collectionRemark}</if>-->
<!-- <if test="waybillId != null "> and waybill_id = #{waybillId}</if>-->
<!-- <if test="waybillNumber != null and waybillNumber != ''"> and waybill_number like concat('%', #{waybillNumber}, '%')</if>-->
@@ -1073,12 +1116,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- <if test="cancelAfterVerificationId != null "> and cancel_after_verification_id = #{cancelAfterVerificationId}</if>-->
<!-- <if test="cancelAfterVerificationName != null and cancelAfterVerificationName != ''"> and cancel_after_verification_name like concat('%', #{cancelAfterVerificationName}, '%')</if>-->
<!-- <if test="cancelAfterVerificationTime != null "> and cancel_after_verification_time = #{cancelAfterVerificationTime}</if>-->
<if test="createByName != null and createByName != ''"> and create_by_name like concat('%', #{createByName}, '%')</if>
<if test="updateByName != null and updateByName != ''"> and update_by_name like concat('%', #{updateByName}, '%')</if>
<if test="createByName != null and createByName != ''"> and v.create_by_name like concat('%', #{createByName}, '%')</if>
<if test="updateByName != null and updateByName != ''"> and v.update_by_name like concat('%', #{updateByName}, '%')</if>
<!-- <if test="cancelAfterVerificationStatus != null and cancelAfterVerificationStatus == '5'.toString()"> and verification_status in (1,2,3,4,5)</if>-->
<!-- <if test="cancelAfterVerificationStatus != null and cancelAfterVerificationStatus == '6'.toString()"> and verification_status = 6</if>-->
</where>
order by create_time desc
order by v.create_time desc
</select>