yanite vor 3 Jahren
Ursprung
Commit
cf06d0686a

+ 11 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Subject.java

@@ -20,7 +20,10 @@ public class Subject {
 	/**  */
 	@ApiModelProperty(value = "科目名称",required = false)
 	private String name;
-	
+
+	@ApiModelProperty(value = "父类目录名")
+	private String parentSubjectName;
+
 	/**  */
 	@ApiModelProperty(value = "科目编号",required = false)
 	private String code;
@@ -147,4 +150,11 @@ public class Subject {
 		return ToStringBuilder.reflectionToString(this);
 	}
 
+	public String getParentSubjectName() {
+		return parentSubjectName;
+	}
+
+	public void setParentSubjectName(String parentSubjectName) {
+		this.parentSubjectName = parentSubjectName;
+	}
 }

+ 6 - 4
mec-biz/src/main/resources/config/mybatis/SubjectMapper.xml

@@ -157,14 +157,16 @@
         </where>
     </select>
     <select id="queryPageByIdOrName" resultMap="Subject">
-        SELECT * FROM `subject`
+        SELECT *,
+               (select name_ from `subject` s1 where s.parent_subject_id_ = s1.id_) as parentSubjectName
+               FROM `subject` s
         <where>
-            del_flag_ = 0 AND parent_subject_id_  != 0
+            s.del_flag_ = 0 AND s.parent_subject_id_  != 0
             <if test="parentSubjectId != null and parentSubjectId != ''">
-                AND parent_subject_id_ = #{parentSubjectId}
+                AND s.parent_subject_id_ = #{parentSubjectId}
             </if>
             <if test="search != null and search != ''">
-                AND (id_ = #{search} or name_ like concat('%', #{search}, '%'))
+                AND (s.id_ = #{search} or s.name_ like concat('%', #{search}, '%'))
             </if>
         </where>
         <include refid="global.limit"/>