package com.ruoyi.materialClass.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.common.utils.StringUtils;
import java.util.List;
import java.util.Map;
import com.ruoyi.materialClass.mapper.MaterialClassSubMapper;
import com.ruoyi.materialClass.domain.MaterialClassSub;
import com.ruoyi.materialClass.service.IMaterialClassSubService;

/**
 * 物资分类-二级分类Service业务层处理
 *
 * @author ruoyi
 * @date 2024-01-04
 */
@Service
public class MaterialClassSubServiceImpl extends ServiceImpl<MaterialClassSubMapper, MaterialClassSub> implements IMaterialClassSubService {

	@Autowired
	private MaterialClassSubMapper materialClassSubMapper;

	/**
	 * 查询物资分类-二级分类
	 *
	 * @param classSubId 物资分类-二级分类主键
	 * @return 物资分类-二级分类
	 */
	@Override
	public MaterialClassSub selectMaterialClassSubByClassSubId(String classSubId)
	{
		return materialClassSubMapper.selectMaterialClassSubByClassSubId(classSubId);
	}

	/**
	 * 查询物资分类-二级分类列表
	 *
	 * @param materialClassSub 物资分类-二级分类
	 * @return 物资分类-二级分类
	 */
	@Override
	public List<MaterialClassSub> selectMaterialClassSubList(MaterialClassSub materialClassSub)
	{
		return materialClassSubMapper.selectMaterialClassSubList(materialClassSub);
	}


	private LambdaQueryWrapper<MaterialClassSub> buildQueryWrapper(MaterialClassSub query) {
		Map<String, Object> params = query.getParams();
		LambdaQueryWrapper<MaterialClassSub> lqw = Wrappers.lambdaQuery();
					lqw.eq(StringUtils.isNotBlank(query.getClassMastId()), MaterialClassSub::getClassMastId, query.getClassMastId());
					lqw.like(StringUtils.isNotBlank(query.getClassNameSub()), MaterialClassSub::getClassNameSub, query.getClassNameSub());
		return lqw;
	}

}
