SELECT e.id eid,e.name emp_name,d.name dept_name
FROM hrms_employee e
LEFT JOIN hrms_employee_dept ed
ON e.id = ed.employee_id
LEFT JOIN hrms_dept d
ON d.id = ed.dept_id
LEFT JOIN hrms_user u
ON e.user_id = u.id
WHERE u.del_or_not = 0
AND e.id
IN
#{id}
SELECT e.name name
FROM hrms_employee e
LEFT JOIN hrms_user u
ON e.user_id = u.id
WHERE u.del_or_not = 0
AND e.id = #{id}
SELECT e.id,e.name
FROM hrms_employee e
LEFT JOIN hrms_employee_dept ed
ON e.id = ed.employee_id
LEFT JOIN hrms_dept d
ON ed.dept_id = d.id
LEFT JOIN hrms_user u
ON e.user_id = u.id
WHERE u.del_or_not = 0
AND d.id = #{id}
SELECT e.id id,e.name name
FROM hrms_employee e
LEFT JOIN hrms_user u
ON e.user_id = u.id
WHERE u.del_or_not = 0
SELECT e.id eid,e.name emp_name,d.name
,u.account,e.job_number,u.create_time,p.name pos_name
FROM hrms_employee e
LEFT JOIN hrms_employee_dept ed ON e.id = ed.employee_id
LEFT JOIN hrms_dept d ON d.id = ed.dept_id
LEFT JOIN hrms_user u ON e.user_id = u.id
LEFT JOIN hrms_employee_position ep ON e.id = ep.emp_id
LEFT JOIN hrms_position p ON p.id = ep.position_id
e.`name` LIKE CONCAT('%',#{employee.name},'%')
AND e.job_number = #{employee.jobNumber}
AND u.del_or_not = 0
SELECT e.id id,e.name name,u.account account,e.job_number job_number,
u.create_time create_time,u.status status
FROM hrms_employee e
LEFT JOIN hrms_user u
ON e.user_id = u.id
WHERE u.del_or_not = 0
AND (e.name LIKE CONCAT('%',#{employee.codeOrName},'%') OR u.account LIKE CONCAT('%',#{employee.codeOrName},'%')
OR e.job_number LIKE CONCAT('%',#{employee.codeOrName},'%'))
SELECT e.id id,e.name name,u.account account,e.job_number job_number,
u.create_time create_time,u.status status
FROM hrms_employee e
LEFT JOIN hrms_user u
ON e.user_id = u.id
WHERE u.del_or_not = 0
SELECT e.id id,e.name name,u.account account,e.job_number job_number,
u.create_time create_time,u.status status
FROM hrms_employee e
LEFT JOIN hrms_user u
ON e.user_id = u.id
LEFT JOIN hrms_employee_dept ed
ON e.id = ed.employee_id
LEFT JOIN hrms_dept d
ON ed.dept_id = d.id
WHERE u.del_or_not = 0
AND d.id = #{employee.id}
AND (e.name LIKE CONCAT('%',#{employee.codeOrName},'%') OR u.account LIKE CONCAT('%',#{employee.codeOrName},'%')
OR e.job_number LIKE CONCAT('%',#{employee.codeOrName},'%'))
SELECT d.name
FROM hrms_dept d
LEFT JOIN hrms_employee_dept ed
ON d.id = ed.dept_id
LEFT JOIN hrms_employee e
ON ed.employee_id = e.id
WHERE e.id = #{id}
SELECT p.name
FROM hrms_position p
LEFT JOIN hrms_employee_position ep
ON p.id = ep.position_id
LEFT JOIN hrms_employee e
ON ep.emp_id = e.id
WHERE e.id = #{id}
SELECT r.name
FROM hrms_role r
LEFT JOIN hrms_employee_role er
ON r.id = er.role_id
LEFT JOIN hrms_user u
ON u.id = er.user_id
LEFT JOIN hrms_employee e
ON e.user_id = u.id
WHERE e.id = #{id}
SELECT user_id FROM hrms_employee e
LEFT JOIN hrms_user u
ON e.user_id = u.id
WHERE u.del_or_not = 0
AND e.id IN
#{id}
UPDATE hrms_user SET del_or_not = 1 WHERE id IN
#{id}
SELECT u.status status FROM hrms_user u
LEFT JOIN hrms_employee e
ON e.user_id = u.id
WHERE u.del_or_not = 0
AND e.id = #{id}
UPDATE hrms_user SET status = #{status},disable_start_time = #{disableStartTime},
disable_end_time = #{disableEndTime},disable_cause = #{disableCause}
WHERE id = #{id}
SELECT disable_start_time,disable_end_time,disable_cause
FROM hrms_user WHERE id = #{id}
SELECT id,disable_start_time,disable_end_time,disable_cause
FROM hrms_user WHERE status = 1 OR status = 2
SELECT user_id FROM hrms_employee WHERE id = #{id}
UPDATE hrms_user SET password = #{password} WHERE id = #{id}
SELECT e.id id,e.name name,e.job_number job_number,e.phone phone,e.gender gender,
e.birthday birthday,e.company_mail company_mail,u.account account,u.status status,
d.id dept_id,d.name dept_name,r.id role_id,r.name role_name,po.id position_id,
po.name position_name
FROM hrms_employee e
LEFT JOIN hrms_user u
ON e.user_id = u.id
LEFT JOIN hrms_employee_dept ed
ON ed.employee_id = e.id
LEFT JOIN hrms_dept d
ON ed.dept_id = d.id
LEFT JOIN hrms_employee_role er
ON er.user_id = u.id
LEFT JOIN hrms_role r
ON er.role_id = r.id
LEFT JOIN hrms_employee_position ep
ON ep.emp_id = e.id
LEFT JOIN hrms_position po
ON ep.position_id = po.id
WHERE u.del_or_not = 0
AND e.id = #{id}
UPDATE hrms_employee SET name = #{name},job_number = #{jobNumber},gender = #{gender},birthday = #{birthday},
phone = #{phone},company_mail = #{companyMail}
WHERE id = #{id}
UPDATE hrms_user SET account = #{account},motify_time = #{modifyTime} WHERE id = #{id}
DELETE FROM hrms_employee_dept WHERE employee_id = #{id}
DELETE FROM hrms_employee_position WHERE emp_id = #{id}
DELETE FROM hrms_employee_role WHERE user_id = #{id}
INSERT INTO hrms_employee_dept
(employee_id,dept_id)
VALUES
(#{id},#{deptId})
INSERT INTO hrms_employee_position
(emp_id,position_id)
VALUES
(#{id},#{positionId})
INSERT INTO hrms_employee_role
(user_id,role_id)
VALUES
(#{id},#{roleId})
INSERT INTO hrms_employee (name,job_number,gender,birthday,phone,company_mail,user_id)
VALUES (#{name},#{jobNumber},#{gender},#{birthday},#{phone},#{companyMail},#{userId})
INSERT INTO hrms_user (account,create_time) VALUES (#{account},#{createTime})
SELECT e.id id,e.name name,e.job_number job_number,e.phone phone,e.gender gender,
e.birthday birthday,e.company_mail company_mail,e.spare_mail spare_mail,
e.office_phone office_phone,e.position_description position_description,
e.head_portarit_url head_portarit_url,e.user_id user_id,u.account account,
u.password password,u.login_num login_num,u.lasttime lasttime,u.phone_account
phone_account,u.wechat_id wechat_id,d.name dept_name,r.name role_name,
po.name position_name
FROM hrms_employee e
LEFT JOIN hrms_user u
ON e.user_id = u.id
LEFT JOIN hrms_employee_dept ed
ON ed.employee_id = e.id
LEFT JOIN hrms_dept d
ON ed.dept_id = d.id
LEFT JOIN hrms_employee_role er
ON er.user_id = u.id
LEFT JOIN hrms_role r
ON er.role_id = r.id
LEFT JOIN hrms_employee_position ep
ON ep.emp_id = e.id
LEFT JOIN hrms_position po
ON ep.position_id = po.id
WHERE u.del_or_not = 0
AND u.id = #{id}
UPDATE hrms_employee SET gender = #{gender},office_phone = #{officePhone},phone = #{phone},
company_mail = #{companyMail},spare_mail = #{spareMail},head_portarit_url = #{headPortaritUrl}
WHERE id = #{id}