1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- 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<CostAccountShareParamMapper, CostAccountShareParam> {
- /**
- * 获取指定分摊设置对应的分摊参数
- * @param accountShareId
- * @return
- */
- public List<CostAccountShareParam> getCostAccountShareParam(Long accountShareId) {
- LambdaQueryWrapper<CostAccountShareParam> 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<CostAccountShareParam> 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<Long> accountShareIdList) {
- LambdaUpdateWrapper<CostAccountShareParam> 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);
- }
- }
|