Bladeren bron

添加字段

zwj 10 maanden geleden
bovenliggende
commit
3061ed4cc6

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysPostMapper.java

@@ -96,4 +96,11 @@ public interface SysPostMapper
96 96
      * @return 结果
97 97
      */
98 98
     public SysPost checkPostCodeUnique(String postCode);
99
+
100
+    /**
101
+     * 根据部门查询岗位
102
+     * @param deptId
103
+     * @return
104
+     */
105
+    public SysPost selectPostByDeptId(Long deptId);
99 106
 }

+ 1 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDeptService.java

@@ -121,4 +121,5 @@ public interface ISysDeptService
121 121
      * @return 结果
122 122
      */
123 123
     public int deleteDeptById(Long deptId);
124
+
124 125
 }

+ 8 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysPostService.java

@@ -1,6 +1,7 @@
1 1
 package com.ruoyi.system.service;
2 2
 
3 3
 import java.util.List;
4
+
4 5
 import com.ruoyi.system.domain.SysPost;
5 6
 
6 7
 /**
@@ -96,4 +97,11 @@ public interface ISysPostService
96 97
      * @return 结果
97 98
      */
98 99
     public int updatePost(SysPost post);
100
+
101
+    /**
102
+     * 根据部门查询岗位
103
+     * @param deptId
104
+     * @return
105
+     */
106
+    public SysPost selectPostByDeptId(Long deptId);
99 107
 }

+ 10 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java

@@ -175,4 +175,14 @@ public class SysPostServiceImpl implements ISysPostService
175 175
     {
176 176
         return postMapper.updatePost(post);
177 177
     }
178
+
179
+    /**
180
+     * 根据部门查询岗位
181
+     * @param deptId
182
+     * @return
183
+     */
184
+    @Override
185
+    public SysPost selectPostByDeptId(Long deptId) {
186
+        return postMapper.selectPostByDeptId(deptId);
187
+    }
178 188
 }

+ 9 - 1
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -20,10 +20,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
20 20
 		<result property="createTime" column="create_time" />
21 21
 		<result property="updateBy"   column="update_by"   />
22 22
 		<result property="updateTime" column="update_time" />
23
+		<result property="deptCode"   column="dept_code"   />
24
+		<result property="type"       column="type"        />
23 25
 	</resultMap>
24 26
 
25 27
 	<sql id="selectDeptVo">
26
-        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
28
+        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.dept_code, d.type
27 29
         from sys_dept d
28 30
     </sql>
29 31
 
@@ -99,6 +101,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
99 101
  			<if test="email != null and email != ''">email,</if>
100 102
  			<if test="status != null">status,</if>
101 103
  			<if test="createBy != null and createBy != ''">create_by,</if>
104
+			<if test="deptCode != null and deptCode != ''">dept_code,</if>
105
+			<if test="type != null and type != ''">type,</if>
102 106
  			create_time
103 107
  		)values(
104 108
  			<if test="deptId != null and deptId != 0">#{deptId},</if>
@@ -111,6 +115,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
111 115
  			<if test="email != null and email != ''">#{email},</if>
112 116
  			<if test="status != null">#{status},</if>
113 117
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
118
+			<if test="deptCode != null and deptCode != ''">#{deptCode},</if>
119
+			<if test="type != null and type != ''">#{type},</if>
114 120
 		<!-- sysdate() -->
115 121
 		CURRENT_TIMESTAMP
116 122
  		)
@@ -128,6 +134,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
128 134
  			<if test="email != null">email = #{email},</if>
129 135
  			<if test="status != null and status != ''">status = #{status},</if>
130 136
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
137
+			<if test="deptCode != null and deptCode != ''">dept_code = #{deptCode},</if>
138
+			<if test="type != null and type != ''">type = #{type},</if>
131 139
  			update_time =
132 140
 			<!-- sysdate() -->
133 141
 			CURRENT_TIMESTAMP

+ 15 - 1
ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml

@@ -15,10 +15,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
15 15
 		<result property="updateBy"      column="update_by"     />
16 16
 		<result property="updateTime"    column="update_time"   />
17 17
 		<result property="remark"        column="remark"        />
18
+		<result property="deptId"        column="dept_id"       />
19
+		<result property="postLevel"     column="post_level"    />
18 20
 	</resultMap>
19 21
 
20 22
 	<sql id="selectPostVo">
21
-        select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark
23
+        select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark, dept_id, post_level
22 24
 		from sys_post
23 25
     </sql>
24 26
 
@@ -81,6 +83,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
81 83
  			<if test="status != null and status != ''">status = #{status},</if>
82 84
  			<if test="remark != null">remark = #{remark},</if>
83 85
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
86
+			<if test="deptId != null and deptId != ''">dept_id = #{deptId},</if>
87
+			<if test="postLevel != null and postLevel != ''">post_level = #{postLevel},</if>
84 88
  			update_time =
85 89
 			<!-- sysdate() -->
86 90
 			CURRENT_TIMESTAMP
@@ -97,6 +101,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
97 101
  			<if test="status != null and status != ''">status,</if>
98 102
  			<if test="remark != null and remark != ''">remark,</if>
99 103
  			<if test="createBy != null and createBy != ''">create_by,</if>
104
+			<if test="deptId != null and deptId != ''">dept_id,</if>
105
+			<if test="postLevel != null and postLevel != ''">post_level,</if>
100 106
  			create_time
101 107
  		)values(
102 108
  			<if test="postId != null and postId != 0">#{postId},</if>
@@ -106,6 +112,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
106 112
  			<if test="status != null and status != ''">#{status},</if>
107 113
  			<if test="remark != null and remark != ''">#{remark},</if>
108 114
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
115
+			<if test="deptId != null and deptId != ''">#{deptId},</if>
116
+			<if test="postLevel != null and postLevel != ''">#{postLevel},</if>
109 117
 		<!-- sysdate() -->
110 118
 		CURRENT_TIMESTAMP
111 119
  		)
@@ -122,4 +130,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
122 130
         </foreach>
123 131
  	</delete>
124 132
 
133
+
134
+	<select id="selectPostByDeptId" parameterType="Long" resultMap="SysPostResult">
135
+		<include refid="selectPostVo"/>
136
+		where p.dept_id = #{deptId}
137
+	</select>
138
+
125 139
 </mapper>