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.CertificatesDao;
import io.modules.item.dao.UserDao;
import io.modules.item.dto.CertificatesDTO;
import io.modules.item.entity.CertificatesEntity;
import io.modules.item.service.CertificatesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 主表
 *
 * @author Mark #
 * @since 1.0.0 2025-01-24
 */
@Service
public class CertificatesServiceImpl extends CrudServiceImpl<CertificatesDao, CertificatesEntity, CertificatesDTO> implements CertificatesService {

    @Autowired
    private UserDao userService;



    @Override
    public QueryWrapper<CertificatesEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");
        String status = (String)params.get("status");
        String isBlock = (String)params.get("isBlock");
        String auditStatus = (String)params.get("auditStatus");

        QueryWrapper<CertificatesEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StrUtil.isNotBlank(id), "id", id);
        wrapper.eq(StrUtil.isNotBlank(status), "status", status);
        wrapper.eq(StrUtil.isNotBlank(isBlock), "is_block", isBlock);
        wrapper.eq(StrUtil.isNotBlank(auditStatus) && !auditStatus.equals("all"), "audit_status", auditStatus);
        return wrapper;
    }



}