zoukankan      html  css  js  c++  java
  • mysql-视图

    SELECT DISTINCT
    `u`.`user_id` AS `id`,
    `u`.`user_name` AS `loginName`,
    `u`.`staff_name` AS `name`,
    `u`.`password` AS `password`,
    `c`.`company_id` AS `companyId`,
    `c`.`company_name` AS `companyName`,
    `c`.`member_id` AS `memberId`,
    `c`.`company_desc` AS `companyDesc`,
    `g`.`group_id` AS `departmentId`,
    `g`.`group_name` AS `departmentName`,
    `u`.`staff_id` AS `staff_id`,
    (
    SELECT
    group_concat(`r`.`pinyin` SEPARATOR ',')
    FROM
    (
    `ralasafe_ralasafe_userrole` `ur`
    LEFT JOIN `ralasafe_role` `r` ON ((`ur`.`roleid` = `r`.`id`))
    )
    WHERE
    (
    `ur`.`userid` = `u`.`user_id`
    )
    GROUP BY
    `ur`.`userid`
    ) AS `roles`,
    `staf`.`staff_work_status` AS `status`
    FROM
    (
    (
    (
    (
    (
    `sys_user` `u`
    LEFT JOIN `sys_user_group` `ug` ON (
    (
    `u`.`user_id` = `ug`.`user_id`
    )
    )
    )
    LEFT JOIN `sys_group` `g` ON (
    (
    `ug`.`group_id` = `g`.`group_id`
    )
    )
    )
    LEFT JOIN `sys_user_company` `cm` ON (
    (
    `u`.`user_id` = `cm`.`user_id`
    )
    )
    )
    LEFT JOIN `sys_company` `c` ON (
    (
    `cm`.`company_id` = `c`.`company_id`
    )
    )
    )
    LEFT JOIN `hr_staff` `staf` ON (
    (
    `u`.`staff_id` = `staf`.`staff_id`
    )
    )
    )
    WHERE
    (
    (
    (
    `staf`.`staff_work_status` = '1'
    )
    OR (
    `staf`.`staff_work_status` = '2'
    )
    )
    AND (`u`.`status` = '1')
    )

  • 相关阅读:
    安装lamp服务器
    Linux ssh登录命令
    一些替代Xshell的软件推荐
    字符串输入的几种方式
    Java数据库操作的一些注意
    模拟堆
    web安全基础第一天
    情报搜集
    kali中的postgres怎么连接
    LeetCode:Validate Binary Search Tree
  • 原文地址:https://www.cnblogs.com/h-wei/p/10150087.html
Copyright © 2011-2022 走看看