package com.kcim.dao.repository; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; 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.CostAccountShareParamMapper; import com.kcim.dao.model.CostAccountShareParam; import org.springframework.stereotype.Repository; import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; import java.util.Date; import java.util.List; /** * @program: CostAccount * @description: * @author: Wang.YS * @create: 2024-04-03 14:49 **/ @Repository public class CostAccountShareParamRepository extends ServiceImpl { /** * 获取指定分摊设置对应的分摊参数 * @param accountShareId * @return */ public List getCostAccountShareParam(Long accountShareId) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(CostAccountShareParam::getHospId, UserContext.getHospId()); queryWrapper.eq(CostAccountShareParam::getDelFlag, NumberConstant.ZERO); if(!ObjectUtils.isEmpty(accountShareId)) { queryWrapper.eq(CostAccountShareParam::getAccountShareId, accountShareId); } return this.list(queryWrapper); } /** * 作废指定分摊设置对应的分摊参数 * @param accountShareId * @return */ public boolean delCostAccountShareDetail(Long accountShareId) { LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); updateWrapper.set(CostAccountShareParam::getDelFlag,NumberConstant.ONE); updateWrapper.set(CostAccountShareParam::getDeleteUser,UserContext.getCurrentUser().getId()); updateWrapper.set(CostAccountShareParam::getDeleteTime,new Date()); updateWrapper.eq(CostAccountShareParam::getHospId, UserContext.getHospId()); updateWrapper.eq(CostAccountShareParam::getDelFlag, NumberConstant.ZERO); if(!ObjectUtils.isEmpty(accountShareId)) { updateWrapper.eq(CostAccountShareParam::getAccountShareId, accountShareId); } return this.update(updateWrapper); } /** * 批量删除指定分摊设置对应的分摊参数 * @param accountShareIdList * @return */ public boolean delCostAccountShareDetailList(List accountShareIdList) { LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); updateWrapper.set(CostAccountShareParam::getDelFlag,NumberConstant.ONE); updateWrapper.set(CostAccountShareParam::getDeleteUser,UserContext.getCurrentUser().getId()); updateWrapper.set(CostAccountShareParam::getDeleteTime,new Date()); updateWrapper.eq(CostAccountShareParam::getHospId, UserContext.getHospId()); updateWrapper.eq(CostAccountShareParam::getDelFlag, NumberConstant.ZERO); if(!CollectionUtils.isEmpty(accountShareIdList)) { updateWrapper.in(CostAccountShareParam::getAccountShareId, accountShareIdList); } return this.update(updateWrapper); } }