zouxuan 5 gadi atpakaļ
vecāks
revīzija
a1eac8ff1a

+ 13 - 20
edu-auth/edu-auth-server/src/main/java/com/keao/edu/auth/web/controller/UserController.java

@@ -1,24 +1,5 @@
 package com.keao.edu.auth.web.controller;
 
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-
-import java.util.Date;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.MediaType;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
 import com.keao.edu.auth.api.dto.AuthUser;
 import com.keao.edu.auth.api.entity.SysUser;
 import com.keao.edu.auth.api.util.SecurityConstants;
@@ -34,6 +15,18 @@ import com.keao.edu.im.api.client.ImFeignService;
 import com.keao.edu.im.api.entity.ImResult;
 import com.keao.edu.im.api.entity.ImUserModel;
 import com.keao.edu.util.date.DateUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Date;
 
 @RestController()
 @RequestMapping("user")
@@ -222,7 +215,7 @@ public class UserController extends BaseController {
 	}
 
 	@ApiOperation(value = "修改用户")
-	@PostMapping(value = "/update", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
+	@PostMapping(value = "/update")
 	public Object update(SysUser sysUser) {
 		AuthUser user = SecurityUtils.getUser();
 		if (user != null) {

+ 11 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/Subject.java

@@ -23,6 +23,9 @@ public class Subject {
 	@ApiModelProperty(value = "父级",required = false)
 	private Integer parentSubjectId;
 
+	@ApiModelProperty(value = "父级名称",required = false)
+	private String parentName;
+
 	@ApiModelProperty(value = "图片",required = false)
 	private String img;
 
@@ -38,6 +41,14 @@ public class Subject {
 
 	private String tenantId;
 
+	public String getParentName() {
+		return parentName;
+	}
+
+	public void setParentName(String parentName) {
+		this.parentName = parentName;
+	}
+
 	public Subject() {
 	}
 

+ 1 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/page/SubjectQueryInfo.java

@@ -7,7 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
 
 public class SubjectQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "父节点编号,默认0",required = false)
-    private Integer parentId = 0;
+    private Integer parentId;
 
     @ApiModelProperty(value = "节点状态,默认0未删除,1删除",required = false)
     private YesOrNoEnum delFlag = YesOrNoEnum.NO;

+ 10 - 8
edu-user/edu-user-server/src/main/resources/config/mybatis/SubjectMapper.xml

@@ -11,6 +11,7 @@
         <result column="name_" property="name"/>
         <result column="code_" property="code"/>
         <result column="parent_subject_id_" property="parentSubjectId"/>
+        <result column="parent_name_" property="parentName"/>
         <result column="img_" property="img"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
@@ -71,15 +72,16 @@
 
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="Subject" parameterType="map">
-        SELECT * FROM subject
+        SELECT s.*,sp.name_ parent_name_ FROM subject s
+        LEFT JOIN `subject` sp ON s.parent_subject_id_ = sp.id_
         <include refid="querySubPageSql"/>
-        ORDER BY id_
+        ORDER BY s.id_
         <include refid="global.limit"/>
     </select>
 
     <!-- 查询当前表的总记录数 -->
     <select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM subject <include refid="querySubPageSql"/>
+		SELECT COUNT(*) FROM subject s <include refid="querySubPageSql"/>
 	</select>
 
     <select id="findByParentId" resultMap="Subject">
@@ -104,18 +106,18 @@
 
     <sql id="querySubPageSql">
         <where>
-            tenant_id_ = #{tenantId}
+            s.tenant_id_ = #{tenantId}
             <if test="parentId != null">
-                AND parent_subject_id_ = #{parentId}
+                AND s.parent_subject_id_ = #{parentId}
             </if>
             <if test="parentId == null">
-                AND parent_subject_id_ != 0
+                AND s.parent_subject_id_ != 0
             </if>
             <if test="tenantId != null">
-                AND tenant_id_ = #{tenantId}
+                AND s.tenant_id_ = #{tenantId}
             </if>
             <if test="delFlag != null">
-                AND del_flag_ = #{delFlag}
+                AND s.del_flag_ = #{delFlag}
             </if>
         </where>
     </sql>