Parcourir la source

Merge remote-tracking branch 'origin/master'

weifanli il y a 3 ans
Parent
commit
bc192935af

+ 5 - 3
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/SubjectController.java

@@ -17,6 +17,8 @@ import com.yonge.cooleshow.biz.dal.entity.Subject;
 import com.yonge.cooleshow.biz.dal.queryInfo.SubjectQueryInfo;
 import com.yonge.cooleshow.biz.dal.service.SubjectService;
 import com.yonge.cooleshow.common.controller.BaseController;
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import com.yonge.cooleshow.common.page.PageInfo;
 
 @RequestMapping("subject")
 @Api(tags = "科目服务")
@@ -37,21 +39,21 @@ public class SubjectController extends BaseController {
 	@ApiOperation(value = "根据科目编号查询科目")
 	@GetMapping("/get/{id}")
 	@PreAuthorize("@pcs.hasPermissions('subject/get')")
-	public Object get(@ApiParam(value = "科目编号", required = true) @PathVariable("id") Long id) {
+	public HttpResponseResult<Subject> get(@ApiParam(value = "科目编号", required = true) @PathVariable("id") Long id) {
 		return succeed(subjectService.get(id));
 	}
 
 	@ApiOperation(value = "分页查询科目列表")
 	@GetMapping("/queryPage")
 	@PreAuthorize("@pcs.hasPermissions('subject/queryPage')")
-	public Object queryPage(SubjectQueryInfo queryInfo) {
+	public HttpResponseResult<PageInfo<Subject>> queryPage(SubjectQueryInfo queryInfo) {
 		return succeed(subjectService.queryPage(queryInfo));
 	}
 
 	@ApiOperation(value = "分页查询科目树状列表")
 	@GetMapping("/queryPageTree")
 	@PreAuthorize("@pcs.hasPermissions('subject/queryPageTree')")
-	public Object queryPageTree(SubjectQueryInfo queryInfo) {
+	public HttpResponseResult<PageInfo<Subject>> queryPageTree(SubjectQueryInfo queryInfo) {
 		return succeed(subjectService.queryPageTree(queryInfo));
 	}
 }

+ 13 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/queryInfo/SubjectQueryInfo.java

@@ -6,8 +6,11 @@ import com.yonge.cooleshow.biz.dal.enums.YesOrNoEnum;
 import com.yonge.cooleshow.common.page.QueryInfo;
 
 public class SubjectQueryInfo extends QueryInfo {
-    @ApiModelProperty(value = "父节点编号,默认0",required = false)
-    private Long parentId = 0L;
+    @ApiModelProperty(value = "父节点编号",required = false)
+    private Long parentId;
+    
+    @ApiModelProperty(value = "查询类型(category - 分类   list - 列表)",required = false)
+    private String queryType;
 
     @ApiModelProperty(value = "节点状态,默认0未删除,1删除",required = false)
     private YesOrNoEnum delFlag = YesOrNoEnum.NO;
@@ -27,4 +30,12 @@ public class SubjectQueryInfo extends QueryInfo {
     public void setParentId(Long parentId) {
         this.parentId = parentId;
     }
+
+	public String getQueryType() {
+		return queryType;
+	}
+
+	public void setQueryType(String queryType) {
+		this.queryType = queryType;
+	}
 }

+ 0 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/SubjectService.java

@@ -1,7 +1,6 @@
 package com.yonge.cooleshow.biz.dal.service;
 
 import java.util.List;
-import java.util.Map;
 
 import com.yonge.cooleshow.biz.dal.entity.Subject;
 import com.yonge.cooleshow.biz.dal.queryInfo.SubjectQueryInfo;

+ 6 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/SubjectMapper.xml

@@ -94,6 +94,12 @@
             <if test="delFlag != null">
                 AND del_flag_ = #{delFlag,typeHandler=com.yonge.cooleshow.common.dal.CustomEnumTypeHandler}
             </if>
+            <if test="queryType == 'category'">
+            	and (parent_subject_id_ = 0 or parent_subject_id_ is null)
+            </if>
+            <if test="queryType == 'list'">
+            	and parent_subject_id_ > 0
+            </if>
         </where>
     </sql>