Browse Source

【NEW】增加部门类型

ZhaoMn 4 years ago
parent
commit
7fbf97a4c1

+ 13 - 0
railway-common/src/main/java/com/railway/common/core/domain/entity/SysDept.java

@@ -50,6 +50,19 @@ public class SysDept extends BaseEntity {
   @Size(max = 30, message = "部门名称长度不能超过30个字符")
   private String deptName;
 
+  /**
+   * 部门类型
+   */
+  @ApiModelProperty(value = "部门类型")
+  @Size(max = 20, message = "部门名称长度不能超过20个字符")
+  private String deptType;
+
+  /**
+   * 部门类型
+   */
+  @ApiModelProperty(value = "部门类型")
+  private String deptTypeText;
+
   /**
    * 显示顺序
    */

+ 8 - 1
railway-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -9,6 +9,8 @@
     <result property="parentId" column="parent_id"/>
     <result property="ancestors" column="ancestors"/>
     <result property="deptName" column="dept_name"/>
+    <result property="deptType" column="dept_type"/>
+    <result property="deptTypeText" column="dept_type_text"/>
     <result property="orderNum" column="order_num"/>
     <result property="leader" column="leader"/>
     <result property="phone" column="phone"/>
@@ -26,8 +28,10 @@
 
   <sql id="selectDeptVo">
     select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone,
-    d.email, d.status, d.del_flag, d.create_by, d.create_time, d.remark, t.user_count
+    d.email, d.status, d.del_flag, d.create_by, d.create_time, d.remark, t.user_count,
+    d.dept_type, dict.dict_label as dept_type_text
     from sys_dept d
+    left join sys_dict_data dict on d.dept_type = dict.dict_value and dict.dict_type = 'dictType'
     left join (select dept_id, count(*) as user_count from sys_user where del_flag = '0' group by dept_id) t on t.dept_id = d.dept_id
   </sql>
 
@@ -96,6 +100,7 @@
     <if test="deptId != null and deptId != 0">dept_id,</if>
     <if test="parentId != null and parentId != 0">parent_id,</if>
     <if test="deptName != null and deptName != ''">dept_name,</if>
+    <if test="deptType != null and deptType != ''">dept_type,</if>
     <if test="ancestors != null and ancestors != ''">ancestors,</if>
     <if test="orderNum != null and orderNum != ''">order_num,</if>
     <if test="leader != null and leader != ''">leader,</if>
@@ -109,6 +114,7 @@
     <if test="deptId != null and deptId != 0">#{deptId},</if>
     <if test="parentId != null and parentId != 0">#{parentId},</if>
     <if test="deptName != null and deptName != ''">#{deptName},</if>
+    <if test="deptType != null and deptType != ''">#{deptType},</if>
     <if test="ancestors != null and ancestors != ''">#{ancestors},</if>
     <if test="orderNum != null and orderNum != ''">#{orderNum},</if>
     <if test="leader != null and leader != ''">#{leader},</if>
@@ -126,6 +132,7 @@
     <set>
       <if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
       <if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
+      <if test="deptType != null and deptType != ''">dept_type = #{deptType},</if>
       <if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
       <if test="orderNum != null and orderNum != ''">order_num = #{orderNum},</if>
       <if test="leader != null">leader = #{leader},</if>