From 13a31edf7f569cdcf15d3c43a476a2c947f47fbf Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期日, 09 十一月 2025 22:33:24 +0800
Subject: [PATCH] feat: 增加hospdata表,同步sqlserver过来

---
 ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml |   62 +++++++++++++++++++++++++++++--
 1 files changed, 58 insertions(+), 4 deletions(-)

diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
index 8c40c86..206df95 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -19,6 +19,7 @@
         <result property="loginIp"      column="login_ip"     />
         <result property="loginDate"    column="login_date"   />
         <result property="oaUserId"     column="oa_user_id"   />
+        <result property="oaOrderClass" column="oa_order_class" />
         <result property="createBy"     column="create_by"    />
         <result property="createTime"   column="create_time"  />
         <result property="updateBy"     column="update_by"    />
@@ -48,7 +49,7 @@
     </resultMap>
 	
 	<sql id="selectUserVo">
-        select u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.oa_user_id, u.create_by, u.create_time, u.remark, 
+        select u.user_id, u.dept_id, u.user_name,u.oa_user_id, u.oa_order_class, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.oa_user_id, u.create_by, u.create_time, u.remark,
         d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
         r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
         from sys_user u
@@ -65,7 +66,7 @@
 			AND u.user_id = #{userId}
 		</if>
 		<if test="userName != null and userName != ''">
-			AND u.user_name like concat('%', #{userName}, '%')
+			AND u.nick_name like concat('%', #{userName}, '%')
 		</if>
 		<if test="status != null and status != ''">
 			AND u.status = #{status}
@@ -80,7 +81,44 @@
 			AND date_format(u.create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
 		</if>
 		<if test="deptId != null and deptId != 0">
-			AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
+			<![CDATA[
+			AND u.dept_id IN (
+				-- 鏌ヨ鐢ㄦ埛鎵�灞炲垎鍏徃鍙婂叾鎵�鏈夊瓙閮ㄩ棬
+				SELECT t.dept_id FROM sys_dept t 
+				WHERE t.del_flag = '0' AND (
+					-- 鎯呭喌1锛氫紶鍏ョ殑閮ㄩ棬灏辨槸鍒嗗叕鍙�(parent_id=100)
+					(t.dept_id = ]]>#{deptId}<![CDATA[ AND EXISTS (
+						SELECT 1 FROM sys_dept d WHERE d.dept_id = ]]>#{deptId}<![CDATA[ AND d.parent_id = 100
+					))
+					OR
+					-- 鏌ヨ璇ュ垎鍏徃鐨勬墍鏈夊瓙閮ㄩ棬
+					(find_in_set(
+						(SELECT d.dept_id FROM sys_dept d WHERE d.dept_id = ]]>#{deptId}<![CDATA[ AND d.parent_id = 100),
+						t.ancestors
+					) > 0)
+					OR
+					-- 鎯呭喌2锛氫紶鍏ョ殑鏄瓙閮ㄩ棬锛屾壘鍒板叾鎵�灞炲垎鍏徃
+					(t.dept_id IN (
+						SELECT branch.dept_id FROM sys_dept branch
+						WHERE branch.parent_id = 100
+						  AND find_in_set(branch.dept_id, (
+							SELECT sub.ancestors FROM sys_dept sub WHERE sub.dept_id = ]]>#{deptId}<![CDATA[
+						  )) > 0
+					))
+					OR
+					-- 鏌ヨ璇ュ垎鍏徃鐨勬墍鏈夊瓙閮ㄩ棬
+					(find_in_set(
+						(SELECT branch.dept_id FROM sys_dept branch
+						 WHERE branch.parent_id = 100
+						   AND find_in_set(branch.dept_id, (
+							 SELECT sub.ancestors FROM sys_dept sub WHERE sub.dept_id = ]]>#{deptId}<![CDATA[
+						   )) > 0
+						),
+						t.ancestors
+					) > 0)
+				)
+			)
+			]]>
 		</if>
 		<!-- 鏁版嵁鑼冨洿杩囨护 -->
 		${params.dataScope}
@@ -125,7 +163,11 @@
 	    <include refid="selectUserVo"/>
 		where u.user_name = #{userName} and u.del_flag = '0'
 	</select>
-	
+    <select id="selectUserByPhonenumber" parameterType="String" resultMap="SysUserResult">
+        <include refid="selectUserVo"/>
+        where u.phonenumber = #{phonenumber} and u.del_flag = '0'
+    </select>
+
 	<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
 		<include refid="selectUserVo"/>
 		where u.user_id = #{userId}
@@ -156,6 +198,7 @@
  			<if test="password != null and password != ''">password,</if>
  			<if test="status != null and status != ''">status,</if>
  			<if test="oaUserId != null">oa_user_id,</if>
+ 			<if test="oaOrderClass != null and oaOrderClass != ''">oa_order_class,</if>
  			<if test="createBy != null and createBy != ''">create_by,</if>
  			<if test="remark != null and remark != ''">remark,</if>
  			create_time
@@ -171,6 +214,7 @@
  			<if test="password != null and password != ''">#{password},</if>
  			<if test="status != null and status != ''">#{status},</if>
  			<if test="oaUserId != null">#{oaUserId},</if>
+ 			<if test="oaOrderClass != null and oaOrderClass != ''">#{oaOrderClass},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
  			<if test="remark != null and remark != ''">#{remark},</if>
  			sysdate()
@@ -189,6 +233,10 @@
  			<if test="password != null and password != ''">password = #{password},</if>
  			<if test="status != null and status != ''">status = #{status},</if>
  			<if test="oaUserId != null">oa_user_id = #{oaUserId},</if>
+ 			<if test="oaOrderClass != null">oa_order_class = #{oaOrderClass},</if>
+ 			<if test="openId != null and openId != ''">open_id = #{openId},</if>
+ 			<if test="unionId != null and unionId != ''">union_id = #{unionId},</if>
+ 			<if test="wechatNickname != null and wechatNickname != ''">wechat_nickname = #{wechatNickname},</if>
  			<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
  			<if test="loginDate != null">login_date = #{loginDate},</if>
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
@@ -229,4 +277,10 @@
 		limit 1
 	</select>
 	
+	<!-- 閫氳繃寰俊OpenID鏌ヨ鐢ㄦ埛 -->
+	<select id="selectUserByOpenId" parameterType="String" resultMap="SysUserResult">
+		<include refid="selectUserVo"/>
+		where u.open_id = #{openId} and u.del_flag = '0'
+	</select>
+	
 </mapper> 
\ No newline at end of file

--
Gitblit v1.9.1