package com.xdap.self_development.domain.view;

import com.definesys.mpaas.query.annotation.SQL;
import com.definesys.mpaas.query.annotation.SQLQuery;
import lombok.Data;

@SQLQuery(value = {
        @SQL(view = "getUserByDepartment",
                sql = "SELECT u.id AS \"userId\", u.username AS \"username\", u.user_number AS \"userNumber\", d.id AS \"departmentId\", d.name AS \"department\" FROM xdap_users u LEFT JOIN xdap_dept_users du ON du.user_id = u.id LEFT JOIN xdap_departments d ON d.id = du.department_id WHERE u.exit_status = 'ENABLE' and d.id = #departmentId"),
        @SQL(view = "getUserAndDept",
                sql = "SELECT u.id AS \"userId\", u.username AS \"username\", u.user_number AS \"userNumber\", d.name AS \"department\" FROM xdap_users u LEFT JOIN xdap_dept_users du ON u.id = du.user_id LEFT JOIN xdap_departments d ON d.id = du.department_id")

})
@Data
public class DepartmentUserView {
    private String userId;
    private String username;
    private String userNumber;
    private String departmentId;
    private String department;
}
