package io.modules.item.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import cn.hutool.core.util.StrUtil;
import io.common.service.impl.CrudServiceImpl;
import io.modules.item.dao.ManagementDao;
import io.modules.item.dto.ManagementDTO;
import io.modules.item.entity.ManagementEntity;
import io.modules.item.service.ManagementService;
import org.springframework.stereotype.Service;
import java.util.Map;

/**
 * 药品管理表

 */
@Service
public class ManagementServiceImpl extends CrudServiceImpl<ManagementDao, ManagementEntity, ManagementDTO> implements ManagementService {

    @Override
    public QueryWrapper<ManagementEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");
        String medicineName = (String)params.get("medicineName");
        String category = (String)params.get("category");

        QueryWrapper<ManagementEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StrUtil.isNotBlank(id), "id", id);
        wrapper.like(StrUtil.isNotBlank(medicineName), "medicine_name", medicineName);
        wrapper.like(StrUtil.isNotBlank(category), "category", category);

        return wrapper;
    }


}