package com.kcim.dao.repository; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.kcim.common.constants.NumberConstant; import com.kcim.common.util.UserContext; import com.kcim.dao.mapper.AccountingMapper; import com.kcim.dao.model.Accounting; import org.springframework.stereotype.Repository; import org.springframework.util.StringUtils; import java.util.List; /** * @program: CostAccount * @description: * @author: Wang.YS * @create: 2023-11-14 14:28 **/ @Repository public class AccountingRepository extends ServiceImpl { /** * 获取会计科目收入字典 */ public List getAccountIncome(String name){ LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(Accounting::getHospId, UserContext.getHospId()); queryWrapper.eq(Accounting::getAccountingType, NumberConstant.ONE); if(!StringUtils.isEmpty(name)){ queryWrapper.like(Accounting::getAccountingName, name); } return this.list(queryWrapper); } public List getAllIncome() { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(Accounting::getHospId, UserContext.getHospId()); queryWrapper.eq(Accounting::getAccountingType, NumberConstant.ONE); return this.list(queryWrapper); } public List getAllCostAccounting() { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(Accounting::getHospId, UserContext.getHospId()); queryWrapper.eq(Accounting::getAccountingType, NumberConstant.TWO); return this.list(queryWrapper); } public List getList(Integer accountType) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(Accounting::getHospId, UserContext.getHospId()); queryWrapper.eq(Accounting::getAccountingType, accountType); queryWrapper.orderByDesc(Accounting::getCreateTime); return this.list(queryWrapper); } public List getBaseCostList(String filter) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(Accounting::getHospId, UserContext.getHospId()); queryWrapper.eq(Accounting::getAccountingType, NumberConstant.TWO); queryWrapper.eq(Accounting::getIsBaseCost,NumberConstant.ONE); if(!StringUtils.isEmpty(filter)){ queryWrapper.like(Accounting::getAccountingName,filter); } queryWrapper.orderByDesc(Accounting::getCreateTime); return this.list(queryWrapper); } public List getList(Integer accountType, String filter) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(Accounting::getHospId, UserContext.getHospId()); queryWrapper.eq(Accounting::getAccountingType, accountType); queryWrapper.and(q->q.like(Accounting::getAccountingCode,filter).or().like(Accounting::getAccountingName,filter)); queryWrapper.orderByDesc(Accounting::getCreateTime); return this.list(queryWrapper); } }