package io.renren.modules.sys.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.sys.dao.AppSysUserDao;
import io.renren.modules.sys.dto.AppSysUserDTO;
import io.renren.modules.sys.entity.AppSysUserEntity;
import io.renren.modules.sys.service.AppSysUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * APP系统用户
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0 2022-05-09
 */
@Service
public class AppSysUserServiceImpl extends CrudServiceImpl<AppSysUserDao, AppSysUserEntity, AppSysUserDTO> implements AppSysUserService {

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

        QueryWrapper<AppSysUserEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);
        wrapper.eq(StringUtils.isNotBlank(superUser), "super_user", superUser);
        wrapper.eq(StringUtils.isNotBlank(username), "username", username);

        return wrapper;
    }


}