package cn.novalon.gym.manage.db.entity.query;

import cn.novalon.gym.manage.sys.core.query.SysUserQuery;
import cn.novalon.gym.manage.common.dao.QueryField;

/**
 * 用户查询条件对象
 * 
 * @author 张翔
 * @date 2026-03-13
 */
public class SysUserQueryCriteria {

    @QueryField(propName = "username", type = QueryField.Type.INNER_LIKE)
    private String username;

    @QueryField(propName = "email", type = QueryField.Type.INNER_LIKE)
    private String email;

    @QueryField(propName = "roleId", type = QueryField.Type.EQUAL)
    private Long roleId;

    @QueryField(propName = "status", type = QueryField.Type.EQUAL)
    private Integer status;

    @QueryField(blurry = "username,email", type = QueryField.Type.INNER_LIKE)
    private String keyword;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getKeyword() {
        return keyword;
    }

    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }

    /**
     * 从领域查询对象转换
     * 
     * @param query 领域查询对象
     */
    public void convert(SysUserQuery query) {
        if (query == null) {
            return;
        }
        this.username = query.getUsername();
        this.email = query.getEmail();
        this.roleId = query.getRoleId();
        this.status = query.getStatus();
        this.keyword = query.getKeyword();
    }
    
    /**
     * 从领域查询对象转换（不包含keyword）
     * 
     * @param query 领域查询对象
     */
    public void convertWithoutKeyword(SysUserQuery query) {
        if (query == null) {
            return;
        }
        this.username = query.getUsername();
        this.email = query.getEmail();
        this.roleId = query.getRoleId();
        this.status = query.getStatus();
        this.keyword = null;
    }
}
