package io.modules.item.service.impl;


import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.common.service.impl.BaseServiceImpl;
import io.common.service.impl.CrudServiceImpl;
import io.modules.item.dao.UserDao;
import io.modules.item.dto.UserDTO;
import io.modules.item.entity.FrontUserEntity;
import io.modules.item.entity.UserEntity;
import io.modules.item.service.FrontUserService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class FrontUserServiceImpl extends CrudServiceImpl<UserDao, UserEntity, UserDTO> implements FrontUserService {
    @Override
    public QueryWrapper<UserEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");
        String username = (String)params.get("username");

        QueryWrapper<UserEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StrUtil.isNotBlank(id), "id", id);
        wrapper.like(StrUtil.isNotBlank(username), "username", username);
        return wrapper;
    }

}
