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.DepartmentsDao;
import io.modules.item.dto.DepartmentsDTO;
import io.modules.item.entity.DepartmentsEntity;
import io.modules.item.service.DepartmentsService;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 科室管理
 *
 * @author Mark #
 * @since 1.0.0 2025-03-03
 */
@Service
public class DepartmentsServiceImpl extends CrudServiceImpl<DepartmentsDao, DepartmentsEntity, DepartmentsDTO> implements DepartmentsService {

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

        QueryWrapper<DepartmentsEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StrUtil.isNotBlank(id), "id", id);
        wrapper.like(StrUtil.isNotBlank(name), "name", name);

        return wrapper;
    }


}