package com.hotent.baseInfo.manager.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hotent.base.util.StringUtil;
import com.hotent.baseInfo.model.CostDictData;
import com.hotent.baseInfo.dao.CostDictDataDao;
import com.hotent.baseInfo.manager.CostDictDataManager;
import com.hotent.base.manager.impl.BaseManagerImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collections;
import java.util.List;


/**
 * 字典数据表 服务实现类
 *
 * @company 山西清众科技股份有限公司
 * @author 超级管理员
 * @since 2025-09-13
 */
@Service
public class CostDictDataManagerImpl extends BaseManagerImpl<CostDictDataDao, CostDictData> implements CostDictDataManager {

	@Override
	public CostDictData getDetail(String id) {
    	CostDictData costDictData = this.get(id);
    	

		return costDictData;
	}
	@Override
	@Transactional
	public void createOrUpdate(CostDictData costDictData) {
		//新建或更新
		this.saveOrUpdate(costDictData);
	}

	@Override
	public List<CostDictData> getValueByDictType(List<String> list,String sort, String sysAuditType) {
		QueryWrapper<CostDictData> wrapper = new QueryWrapper<>();
		if (StringUtil.isNotEmpty(sysAuditType)) {
			wrapper.eq("dict_type",sysAuditType);
		}

		if (StringUtil.isNotEmpty(sort)) {
			wrapper.eq("dict_sort",sort);
		}

		if (list!=null && !list.isEmpty()) {
			wrapper.in("dict_sort",list);
		}

		return this.list(wrapper);
	}
}
