select us.userId,us.name,us.loginId,us.recordStatus,us.createTime,us.createBy,us.updateTime,us.updateBy,us.userTypeId from sys_user us
where RecordStatus=1 and us.loginId = #{account} and lower(us.password)=lower(#{password})
select us.userId,us.name,us.loginId,us.recordStatus,us.createTime,us.createBy,us.updateTime,us.updateBy,us.userTypeId from sys_user us
where RecordStatus=1 and us.userId = #{userId}
select us.*,dic.Name as UserTypeName ,urole.roleName from sys_user us
left join sys_dictionary_item dic on dic.Value = us.UserTypeID and dic.DictionaryCode='UserType'
left join (
select usr.UserID, group_concat(sr.Name) roleName from sys_user_sys_role usr
inner join sys_role sr on usr.RoleID = sr.RoleID
group by usr.UserID
) urole on us.UserID=urole.UserID
where 1=1
and us.Name like Concat('%',#{username},'%')
and us.loginid like Concat('%',#{loginid},'%')
and us.RecordStatus =#{recordStatu}
and us.UserTypeID =#{userType}
order by createTime desc
select mu.MenuNo,MIN(datarange.DataRangeID) as DataRangeID,0 as OrderNo
from sys_user_sys_role userrole
inner join sys_role_datarange datarange on userrole.RoleID=datarange.RoleID
inner join sys_menu mu on datarange.FunctionCode = mu.FunctionCode
where userrole.UserID=#{userID}
group by mu.MenuNo
union all
select distinct menu.MenuNo,MIN(role.DefaultDataRange) as DataRangeID,1 as OrderNo
from sys_menu menu
inner join sys_role_sys_function_code rolecode on menu.FunctionCode=rolecode.FunctionCode
inner join sys_user_sys_role userrole on rolecode.RoleID=userrole.RoleID
inner join sys_role role on userrole.RoleID=role.RoleID
where userrole.UserID=#{userID}
group by menu.MenuNo
select us.userId,us.name,us.loginID
,us.userTypeID
from sys_user us
where us.userId = #{userId}
select us.userId,us.name,us.loginId from sys_user us where us.loginID = #{loginID}
select CollegeID from sys_user_cf_college where userID= #{userID}
union
select CollegeID from cf_teacher where userID= #{userID}
select MajorID from sys_user_cf_major where userID= #{userID}
union
select mj.MajorID from
(
select CollegeID from sys_user_cf_college where userID= #{userID}
union
select CollegeID from cf_teacher where userID= #{userID}
) t
inner join cf_major mj on t.CollegeID = mj.CollegeID
where (select count(1) as count from sys_user_cf_major where userID= #{userID}) = 0
select MajorGradeID from sys_user_cf_major_grade where userID= #{userID}
union
select mg.MajorGradeID from
(
select CollegeID from sys_user_cf_college where userID= #{userID}
union
select CollegeID from cf_teacher where userID= #{userID}
) t
inner join cf_major mj on t.CollegeID = mj.CollegeID
inner join cf_major_grade mg on mg.MajorID = mj.MajorID
where (select count(1) as count from sys_user_cf_major_grade where userID= #{userID}) = 0
select MajorClassID from sys_user_cf_major_class where userID= #{userID}
union
select mc.MajorClassID from
(
select CollegeID from sys_user_cf_college where userID= #{userID}
union
select CollegeID from cf_teacher where userID= #{userID}
) t
inner join cf_major mj on t.CollegeID = mj.CollegeID
inner join cf_major_grade mg on mg.MajorID = mj.MajorID
inner join cf_major_class mc on mg.MajorGradeID = mc.MajorGradeID
where (select count(1) as count from sys_user_cf_major_class where userID= #{userID}) = 0
insert into Sys_User(UserID, UserTypeID,LoginID,Password,Name,RecordStatus,CreateBy,CreateTime,UpdateBy,UpdateTime)
values
(#{item.userID},#{item.userTypeID},#{item.loginID},#{item.password},#{item.name},#{item.recordStatus},#{item.createBy},#{item.createTime},null,null)
insert into sys_user_sys_role(UserID, RoleID)
values
(#{item.userID},#{item.roleID})
update
`cf_student`
set
`userID` = #{item.userID},
`updateBy` = #{updateBy},
`updateTime` = sysdate()
where
studentID = #{item.studentID}
and userID is null
select fc.functionCode
from sys_function_code fc
inner join sys_role_sys_function_code rfc on fc.FunctionCode = rfc.FunctionCode
inner join sys_user_sys_role ur on rfc.RoleID = ur.RoleID
where 1=1 and ur.userID=#{userID}
delete from sys_user_sys_role where 1=1
and userID in
#{userID}