From d3c8435c9594b8e2991e0c5ada05a7b9c5193d95 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B5=B5=E5=95=B8=E9=9D=9E?= <8153694@qq.com>
Date: Tue, 13 May 2025 12:29:28 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9B=B4=E6=96=B0=E5=9F=BA?=
 =?UTF-8?q?=E7=A1=80=E5=8C=BA=E5=9F=9F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../base/system/user/model/UserEntity.java    | 12 ++-
 .../resources/sqlmap/base/system/user.xml     | 78 +++++++++++++++++--
 2 files changed, 83 insertions(+), 7 deletions(-)

diff --git a/agent-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserEntity.java b/agent-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserEntity.java
index 065a515..c2e7d5d 100644
--- a/agent-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserEntity.java
+++ b/agent-manager/src/main/java/com/mortals/xhx/base/system/user/model/UserEntity.java
@@ -78,6 +78,11 @@ public class UserEntity extends UserVo implements IUser {
      */
     private String lastLoginAddress;
 
+    /**
+     * 浠e姙鍛樺伐id
+     */
+    private Long customerId;
+
     public void setSiteId(Long siteId) {
         this.siteId = siteId;
     }
@@ -238,7 +243,7 @@ public class UserEntity extends UserVo implements IUser {
 
     @Override
     public Long getCustomerId() {
-        return null;
+        return this.customerId;
     }
 
     @Override
@@ -343,7 +348,10 @@ public class UserEntity extends UserVo implements IUser {
     }
 
 
-
+    @Override
+    public void setCustomerId(Long customerId) {
+        this.customerId = customerId;
+    }
 
     @Override
     public int hashCode() {
diff --git a/agent-manager/src/main/resources/sqlmap/base/system/user.xml b/agent-manager/src/main/resources/sqlmap/base/system/user.xml
index 1dc209f..5e77017 100644
--- a/agent-manager/src/main/resources/sqlmap/base/system/user.xml
+++ b/agent-manager/src/main/resources/sqlmap/base/system/user.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "mybatis-3-mapper.dtd">
-<mapper namespace="com.mortals.xhx.base.system.user.dao.ibatis.UserDaoImpl">
+<mapper namespace="com.mortals.xhx.module.user.dao.ibatis.UserDaoImpl">
 
     <!-- 瀛楁鍜屽睘鎬ф槧灏� -->
     <resultMap type="UserEntity" id="UserEntity-Map">
@@ -25,6 +25,7 @@
         <result property="createUserName" column="createUserName" />
         <result property="lastLoginTime" column="lastLoginTime" />
         <result property="lastLoginAddress" column="lastLoginAddress" />
+        <result property="customerId" column="customerId" />
     </resultMap>
 
     <!-- 琛ㄦ墍鏈夊垪 -->
@@ -90,23 +91,26 @@
             <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('lastLoginAddress') or colPickMode == 1 and data.containsKey('lastLoginAddress')))">
                 a.lastLoginAddress,
             </if>
+            <if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('customerId') or colPickMode == 1 and data.containsKey('customerId')))">
+                a.customerId,
+            </if>
         </trim>
     </sql>
     <!-- 鏂板 鍖哄垎涓婚敭鑷鍔犺繕鏄笟鍔℃彃鍏� -->
     <insert id="insert" parameterType="UserEntity"  useGeneratedKeys="true" keyProperty="id">
         insert into mortals_agent_user
-        (loginName,loginPwd,loginLimitAddress,realName,mobile,phone,email,qq,open_id,company_id,userType,siteIds,areaCodes,status,createTime,createUserId,createUserName,lastLoginTime,lastLoginAddress)
+        (loginName,loginPwd,loginLimitAddress,realName,mobile,phone,email,qq,open_id,company_id,userType,siteIds,areaCodes,status,createTime,createUserId,createUserName,lastLoginTime,lastLoginAddress,customerId)
         VALUES
-        (#{loginName},#{loginPwd},#{loginLimitAddress},#{realName},#{mobile},#{phone},#{email},#{qq},#{openId},#{companyId},#{userType},#{siteIds},#{areaCodes},#{status},#{createTime},#{createUserId},#{createUserName},#{lastLoginTime},#{lastLoginAddress})
+        (#{loginName},#{loginPwd},#{loginLimitAddress},#{realName},#{mobile},#{phone},#{email},#{qq},#{openId},#{companyId},#{userType},#{siteIds},#{areaCodes},#{status},#{createTime},#{createUserId},#{createUserName},#{lastLoginTime},#{lastLoginAddress},#{customerId})
     </insert>
 
     <!-- 鎵归噺鏂板 -->
     <insert id="insertBatch" parameterType="paramDto">
         insert into mortals_agent_user
-        (loginName,loginPwd,loginLimitAddress,realName,mobile,phone,email,qq,open_id,company_id,userType,siteIds,areaCodes,status,createTime,createUserId,createUserName,lastLoginTime,lastLoginAddress)
+        (loginName,loginPwd,loginLimitAddress,realName,mobile,phone,email,qq,open_id,company_id,userType,siteIds,areaCodes,status,createTime,createUserId,createUserName,lastLoginTime,lastLoginAddress,customerId)
         VALUES
         <foreach collection="data.dataList" item="item" index="index" separator="," >
-            (#{item.loginName},#{item.loginPwd},#{item.loginLimitAddress},#{item.realName},#{item.mobile},#{item.phone},#{item.email},#{item.qq},#{item.openId},#{item.companyId},#{item.userType},#{item.siteIds},#{item.areaCodes},#{item.status},#{item.createTime},#{item.createUserId},#{item.createUserName},#{item.lastLoginTime},#{item.lastLoginAddress})
+            (#{item.loginName},#{item.loginPwd},#{item.loginLimitAddress},#{item.realName},#{item.mobile},#{item.phone},#{item.email},#{item.qq},#{item.openId},#{item.companyId},#{item.userType},#{item.siteIds},#{item.areaCodes},#{item.status},#{item.createTime},#{item.createUserId},#{item.createUserName},#{item.lastLoginTime},#{item.lastLoginAddress},#{item.customerId})
         </foreach>
     </insert>
 
@@ -185,6 +189,12 @@
             <if test="(colPickMode==0 and data.containsKey('lastLoginAddress')) or (colPickMode==1 and !data.containsKey('lastLoginAddress'))">
                 a.lastLoginAddress=#{data.lastLoginAddress},
             </if>
+            <if test="(colPickMode==0 and data.containsKey('customerId')) or (colPickMode==1 and !data.containsKey('customerId'))">
+                a.customerId=#{data.customerId},
+            </if>
+            <if test="(colPickMode==0 and data.containsKey('customerIdIncrement')) or (colPickMode==1 and !data.containsKey('customerIdIncrement'))">
+                a.customerId=ifnull(a.customerId,0) + #{data.customerIdIncrement},
+            </if>
         </trim>
         <trim suffixOverrides="where" suffix="">
             where
@@ -350,6 +360,18 @@
                     </if>
                 </foreach>
             </trim>
+            <trim prefix="customerId=(case" suffix="ELSE customerId end),">
+                <foreach collection="data.dataList" item="item" index="index" separator="" >
+                    <choose>
+                        <when test="(colPickMode==0 and item.containsKey('customerId')) or (colPickMode==1 and !item.containsKey('customerId'))">
+                            when a.id=#{item.id} then #{item.customerId}
+                        </when>
+                        <when test="(colPickMode==0 and item.containsKey('customerIdIncrement')) or (colPickMode==1 and !item.containsKey('customerIdIncrement'))">
+                            when a.id=#{item.id} then ifnull(a.customerId,0) + #{item.customerIdIncrement}
+                        </when>
+                    </choose>
+                </foreach>
+            </trim>
         </trim>
         where id in
         <foreach collection="data.dataList" item="item" index="index" open="(" separator="," close=")">
@@ -908,6 +930,33 @@
                 #{item}
             </foreach>
         </if>
+        <if test="conditionParamRef.containsKey('customerId')">
+            <if test="conditionParamRef.customerId != null ">
+                ${_conditionType_} a.customerId = #{${_conditionParam_}.customerId}
+            </if>
+            <if test="conditionParamRef.customerId == null">
+                ${_conditionType_} a.customerId is null
+            </if>
+        </if>
+        <if test="conditionParamRef.containsKey('customerIdList') and conditionParamRef.customerIdList.size() > 0">
+            ${_conditionType_} a.customerId in
+            <foreach collection="conditionParamRef.customerIdList" open="(" close=")" index="index" item="item" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="conditionParamRef.containsKey('customerIdNotList') and conditionParamRef.customerIdNotList.size() > 0">
+            ${_conditionType_} a.customerId not in
+            <foreach collection="conditionParamRef.customerIdNotList" open="(" close=")" index="index" item="item" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="conditionParamRef.containsKey('customerIdStart') and conditionParamRef.customerIdStart != null">
+            ${_conditionType_} a.customerId <![CDATA[ >= ]]> #{${_conditionParam_}.customerIdStart}
+        </if>
+        <if test="conditionParamRef.containsKey('customerIdEnd') and conditionParamRef.customerIdEnd != null">
+            ${_conditionType_} a.customerId <![CDATA[ <= ]]> #{${_conditionParam_}.customerIdEnd}
+        </if>
+
     </sql>
     <sql id="_orderCols_">
         <if test="orderColList != null and !orderColList.isEmpty()">
@@ -947,6 +996,13 @@
                 </foreach>
                 ,
             </if>
+            <if test="conditionParamRef.containsKey('customerIdList') and conditionParamRef.customerIdList.size() > 0">
+                field(a.customerId,
+                <foreach collection="conditionParamRef.customerIdList" open="" close=")" index="index" item="item" separator=",">
+                    #{item}
+                </foreach>
+                ,
+            </if>
             <trim suffixOverrides=","  suffix="">
                 <foreach collection="orderColList" open="" close="" index="index" item="item" separator=",">
                     a.${item.colName} ${item.sortKind}
@@ -991,6 +1047,13 @@
                 </foreach>
                 ,
             </if>
+            <if test="conditionParamRef.containsKey('customerIdList') and conditionParamRef.customerIdList.size() > 0">
+                field(a.customerId,
+                <foreach collection="conditionParamRef.customerIdList" open="" close=")" index="index" item="item" separator=",">
+                    #{item}
+                </foreach>
+                ,
+            </if>
             <trim suffixOverrides=","  suffix="">
                 <if test="orderCol.containsKey('id')">
                     a.id
@@ -1092,6 +1155,11 @@
                     <if test='orderCol.lastLoginAddress != null and "DESC".equalsIgnoreCase(orderCol.lastLoginAddress)'>DESC</if>
                     ,
                 </if>
+                <if test="orderCol.containsKey('customerId')">
+                    a.customerId
+                    <if test='orderCol.customerId != null and "DESC".equalsIgnoreCase(orderCol.customerId)'>DESC</if>
+                    ,
+                </if>
             </trim>
         </if>
 
-- 
2.24.3