guoyujia 1 рік тому
батько
коміт
a8b853c011

+ 11 - 0
src/main/java/cn/ezhizao/project/system/domain/SysDept.java

@@ -117,6 +117,17 @@ public class SysDept extends BaseEntity {
     @TableField(exist = false)
     private Long Value;
 
+    @TableField(exist = false)
+    private String Code;
+
+    public String getCode() {
+        return Code;
+    }
+
+    public void setCode(String code) {
+        Code = code;
+    }
+
     public String getLabel() {
         return Label;
     }

+ 29 - 0
src/main/java/cn/ezhizao/project/system/domain/SysUser.java

@@ -22,6 +22,8 @@ import java.util.List;
  * @author ruoyi
  */
 public class SysUser extends BaseEntity {
+
+    private static final long serialVersionUID = 1L;
     /**
      * 用户ID
      */
@@ -136,6 +138,33 @@ public class SysUser extends BaseEntity {
     private Long roleId;
 
     private Long deptId;
+    private String deptName;
+    private Long usageId;
+    private String usageCode;
+
+    public Long getUsageId() {
+        return usageId;
+    }
+
+    public void setUsageId(Long usageId) {
+        this.usageId = usageId;
+    }
+
+    public String getUsageCode() {
+        return usageCode;
+    }
+
+    public void setUsageCode(String usageCode) {
+        this.usageCode = usageCode;
+    }
+
+    public String getDeptName() {
+        return deptName;
+    }
+
+    public void setDeptName(String deptName) {
+        this.deptName = deptName;
+    }
 
     public Long getDeptId() {
         return deptId;

+ 4 - 1
src/main/resources/mybatis/system/SysDeptMapper.xml

@@ -73,10 +73,13 @@
 	</select>
 
 	<select id="getDeptList" parameterType="SysDept" resultMap="SysDeptResult">
-		SELECT dept_name as Label,dept_id as `Value` FROM sys_dept where del_flag = '0' And type = #{type}
+		SELECT dept_name as Label,dept_id as `Value`,dept_code as `Code` FROM sys_dept where del_flag = '0'
 		<if test="tenantId != null  and tenantId != 0">
 			AND tenant_id = #{tenantId}
 		</if>
+		<if test="type != null ">
+			And type = #{type}
+		</if>
 
 	</select>
 	<select id="selectDeptListByRoleId" resultType="Long">

+ 19 - 3
src/main/resources/mybatis/system/SysUserMapper.xml

@@ -27,12 +27,15 @@
 		<result property="updateBy"            column="update_by"    />
 		<result property="updateTime"          column="update_time"  />
 		<result property="remark"              column="remark"       />
+		<result property="usageId"             column="usage_id"       />
+		<result property="usageCode"           column="usage_code"       />
 		<result property="isLeader"            column="is_leader"/>
 		<result property="isPartTime"          column="is_part_time"/>
 		<result property="isDispatcher"        column="is_dispatcher"/>
 		<result property="isFormman"           column="is_formman"/>
 		<result property="isYardman"           column="is_yardman"/>
 		<result property="isEdit"              column="is_edit"/>
+		<association property="deptName" column="usage_id" select="getDeptName"></association>
 		<collection  property="roles"   javaType="java.util.List"  resultMap="RoleResult" />
 	</resultMap>
 
@@ -46,13 +49,16 @@
 	</resultMap>
 
 	<sql id="selectUserTenantVo">
-		SELECT u.user_id, u.tenant_id, IFNULL(t.org_name, '超级管理员') AS tenant_name, u.user_type,u.user_name, u.nick_name, u.email,u.contract_company_name, u.contract_company_id, u.avatar, u.phone_number, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
+		SELECT u.user_id, u.tenant_id, IFNULL(t.org_name, '超级管理员') AS tenant_name, u.user_type,u.user_name, u.nick_name, u.email,u.contract_company_name, u.contract_company_id, u.avatar, u.phone_number, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.usage_id,u.usage_code,
 			   r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
 		FROM sys_user u
 		         LEFT JOIN biz_tenant t ON t.id = u.tenant_id
 				 LEFT JOIN sys_user_role ur ON u.user_id = ur.user_id
 				 LEFT JOIN sys_role r ON r.role_id = ur.role_id
 	</sql>
+	<select id="getDeptName" resultType="String">
+		select dept_name deptName from sys_dept where dept_id = #{usage_id}
+	</select>
 	<select id="getListByDeptId" parameterType="java.util.List" resultMap="SysUserResult">
         SELECT u.*,
             -- 用于前端控制是否进入编辑状态
@@ -104,6 +110,8 @@
 		       u.login_date,
 		       u.create_by,
 		       u.create_time,
+		       u.usage_id,
+		       u.usage_code,
 		       u.remark FROM sys_user u left join sys_dept_user d on u.user_id = d.user_id
 		WHERE u.del_flag = '0' and d.deleted = 0
 		<if test="userId != null and userId != 0">
@@ -160,7 +168,9 @@
 		   u.login_date,
 		   u.create_by,
 		   u.create_time,
-		   u.remark
+		   u.remark,
+		   u.usage_id,
+		   u.usage_code
 		FROM sys_user u
 		WHERE u.del_flag = '0' AND u.user_type='02'
 		<if test="userId != null and userId != 0">
@@ -261,7 +271,7 @@
 	<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
 		SELECT user_id, email FROM sys_user WHERE email = #{email} AND del_flag = '0' limit 1
 	</select>
-	<select id="listByLikeNickNameOrUserName" resultType="cn.ezhizao.project.system.domain.SysUser">
+	<select id="listByLikeNickNameOrUserName" resultMap="SysUserResult">
         SELECT * FROM sys_user
         <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
 			del_flag = '0'
@@ -287,6 +297,8 @@
 		<if test="userType != null and userType != ''">user_type,</if>
 		<if test="contractCompanyName != null and contractCompanyName != ''">contract_company_name,</if>
 		<if test="contractCompanyId != null and contractCompanyId != ''">contract_company_id,</if>
+		<if test="usageId != null and usageId != 0">usage_id,</if>
+		<if test="usageCode != null and usageCode != ''">usage_code,</if>
 		create_time
 		)VALUES(
 		<if test="userId != null and userId != ''">#{userId},</if>
@@ -304,6 +316,8 @@
 		<if test="userType != null and userType != ''">#{userType},</if>
 		<if test="contractCompanyName != null and contractCompanyName != ''">#{contractCompanyName},</if>
 		<if test="contractCompanyId != null and contractCompanyId != ''">#{contractCompanyId},</if>
+		<if test="usageId != null and usageId != 0">#{usageId},</if>
+		<if test="usageCode != null and usageCode != 0">#{usageCode},</if>
 		sysdate()
 		)
 	</insert>
@@ -326,6 +340,8 @@
 			<if test="remark != null">remark = #{remark},</if>
 			<if test="contractCompanyName != null and contractCompanyName != ''">contract_company_name = #{contractCompanyName},</if>
 			<if test="contractCompanyId != null and contractCompanyId != ''">contract_company_id = #{contractCompanyId},</if>
+			<if test="usageId != null and usageId != 0">usage_id = #{usageId},</if>
+			<if test="usageCode != null and usageCode != 0">usage_code = #{usageCode},</if>
 			update_time = sysdate()
 		</set>
 		WHERE user_id = #{userId}