123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
- <mapper namespace="com.bowintek.practice.mapper.SysUserCQuery">
- <select id="selectUserByAccount" resultType="com.bowintek.practice.vo.user.UserModel">
- 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>
- <select id="selectUserByUserID" resultType="com.bowintek.practice.vo.user.UserModel">
- 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>
- <select id="selectUserList" resultType="java.util.HashMap">
- 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
- <if test="username != null and username != ''">
- and us.Name like Concat('%',#{username},'%')
- </if>
- <if test="loginid != null and loginid != ''">
- and us.loginid like Concat('%',#{loginid},'%')
- </if>
- <if test="recordStatu != null">
- and us.RecordStatus =#{recordStatu}
- </if>
- <if test="userType != null">
- and us.UserTypeID =#{userType}
- </if>
- order by createTime desc
- </select>
- <select id="selectUserDataRange" resultType="java.util.HashMap">
- 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>
- <select id="selectUserInfo" resultType="com.bowintek.practice.vo.user.UserInfoModel">
- select us.userId,us.name,us.loginID
- ,us.userTypeID
- from sys_user us
- where us.userId = #{userId}
- </select>
- <select id="selectUserMenuList" resultType="com.bowintek.practice.model.SysMenu">
- select distinct mu.menuNo,mu.orderNo,mu.menuName,mu.icon,mu.viewPath,mu.url,mu.parentMenuNo,mu.isTopMenu,mu.isVisible,mu.isLeaf,mu.functionCode
- from sys_menu mu
- inner join (
- with recursive type_cte as (
- select MenuNo,MenuName,ParentMenuNo from sys_menu where MenuNo in(
- select m.MenuNo from sys_menu m
- inner join sys_function_code fc on m.FunctionCode = fc.FunctionCode
- 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}
- )
- union all
- select t.MenuNo,concat(type_cte2.MenuName,'>',t.MenuName),t.ParentMenuNo
- from sys_menu t
- inner join type_cte type_cte2 on t.MenuNo = type_cte2.ParentMenuNo
- )
- select
- MenuNo, MenuName, ParentMenuNo
- from type_cte
- ) mu2 on mu.MenuNo = mu2.MenuNo or (mu.ParentMenuNo = mu2.MenuNo and mu.IsVisible=0)
- where mu.recordStatus=1
- order by mu.orderNo
- </select>
- <select id="selectUserShortcutMenuList" resultType="com.bowintek.practice.model.SysMenu">
- select distinct mu.menuNo,mu.orderNo,mu.menuName,mu.icon,mu.viewPath,mu2.url,mu.parentMenuNo,mu.isTopMenu,mu.isVisible,mu.isLeaf,mu.functionCode,mu.shortcutIcon
- from sys_menu mu
- inner join (
- with recursive type_cte as (
- select m.menuNo,m.menuName,m.parentMenuNo,m.url,m.orderNo
- from sys_menu m
- inner join sys_function_code fc on m.FunctionCode = fc.FunctionCode
- 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
- inner join sys_role_sys_menu_shortcut rms on rms.MenuNo = m.MenuNo and rms.RoleID = ur.RoleID
- where 1=1 and ur.userID=#{userID} group by m.menuNo,m.menuName,m.parentMenuNo,m.url
- union all
- select type_cte2.menuNo,concat(t.menuName,'>',type_cte2.menuName),t.parentMenuNo, case when locate(t.url,type_cte2.url)=1 then type_cte2.url else concat(t.url,type_cte2.url) end,concat(t.orderNo,type_cte2.orderNo)
- from sys_menu t
- inner join type_cte type_cte2 on t.MenuNo = type_cte2.ParentMenuNo
- )
- select
- MenuNo, MenuName, ParentMenuNo,url,orderNo
- from type_cte
- ) mu2 on mu.MenuNo = mu2.MenuNo or (mu.ParentMenuNo = mu2.MenuNo and mu.IsVisible=0)
- where mu.recordStatus=1 and mu2.ParentMenuNo is null
- order by mu.orderNo
- </select>
- <select id="selectUserByLoginID" resultType="com.bowintek.practice.vo.user.UserModel">
- select us.userId,us.name,us.loginId from sys_user us where us.loginID = #{loginID}
- </select>
- <select id="selectUserCollege" resultType="java.lang.String">
- select CollegeID from sys_user_cf_college where userID= #{userID}
- union
- select CollegeID from cf_teacher where userID= #{userID}
- </select>
- <select id="selectUserMajor" resultType="java.lang.String">
- 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>
- <select id="selectUserMajorGrade" resultType="java.lang.String">
- 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>
- <select id="selectUserMajorClass" resultType="java.lang.String">
- 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
- </select>
- <insert id="insertUser" parameterType="java.util.List">
- insert into Sys_User(UserID, UserTypeID,LoginID,Password,Name,RecordStatus,CreateBy,CreateTime,UpdateBy,UpdateTime)
- values
- <foreach collection="dataList" item="item" separator=",">
- (#{item.userID},#{item.userTypeID},#{item.loginID},#{item.password},#{item.name},#{item.recordStatus},#{item.createBy},#{item.createTime},null,null)
- </foreach>
- </insert>
- <insert id="insertUserRole" parameterType="java.util.List">
- insert into sys_user_sys_role(UserID, RoleID)
- values
- <foreach collection="dataList" item="item" separator=",">
- (#{item.userID},#{item.roleID})
- </foreach>
- </insert>
- <update id="batchUpdateStudentUserID">
- <foreach collection="dataList" item="item" separator=";">
- update
- `cf_student`
- set
- `userID` = #{item.userID},
- `updateBy` = #{updateBy},
- `updateTime` = sysdate()
- where
- studentID = #{item.studentID}
- and userID is null
- </foreach>
- </update>
- <select id="selectUserPerms" resultType="java.lang.String">
- 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}
- </select>
- </mapper>
|