Browse Source

add:添加乐理管理

liujunchi 2 years ago
parent
commit
bc00bf1041

+ 126 - 0
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/controller/MusicTheoryController.java

@@ -0,0 +1,126 @@
+package com.yonge.cooleshow.cms.controller;
+
+import com.yonge.cooleshow.cms.dal.entity.SysNewsType;
+import com.yonge.cooleshow.cms.dto.SysNewsTypeDto;
+import com.yonge.cooleshow.cms.dto.search.MusicTheorySearch;
+import com.yonge.cooleshow.cms.service.SysNewsTypeService;
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import com.yonge.cooleshow.common.page.PageInfo;
+import com.yonge.cooleshow.common.page.QueryInfo;
+import com.yonge.toolset.utils.string.StringUtil;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.Date;
+
+import static com.yonge.cooleshow.common.entity.HttpResponseResult.failed;
+import static com.yonge.cooleshow.common.entity.HttpResponseResult.succeed;
+
+/**
+ * Description
+ *
+ * @author liujunchi
+ * @date 2022-04-26
+ */
+@RestController
+@RequestMapping("music/theory")
+@Api(tags = "乐理管理")
+public class MusicTheoryController {
+
+    @Autowired
+    private SysNewsTypeService newsTypeService;
+
+
+    /**
+     * 查询单条
+     */
+    @GetMapping("/detail/{id}")
+    @ApiOperation(value = "乐理章节详情", notes = "传入id")
+    public HttpResponseResult<SysNewsType> detail(@ApiParam(value = "编号", required = true) @PathVariable("id") Long id) {
+        return succeed(newsTypeService.get(id));
+    }
+
+    @PostMapping(value = "/page", consumes="application/json", produces="application/json")
+    @ApiOperation(value = "乐理章节详情查询分页", httpMethod="POST", consumes="application/json", produces="application/json")
+    public HttpResponseResult<PageInfo<SysNewsType>> page(@Valid @RequestBody MusicTheorySearch query) {
+        query.setParentId(6L);
+        PageInfo<SysNewsType> pages = newsTypeService.queryPage( query);
+        return succeed(pages);
+    }
+
+
+    /**
+     * 新增
+     */
+    @PostMapping(value = "/save",  consumes="application/json", produces="application/json")
+    @ApiOperation(value = "乐理章节详情新增", httpMethod="POST", consumes="application/json", produces="application/json")
+    public HttpResponseResult<Boolean> save( @RequestBody SysNewsType newsType) {
+        if (newsType.getOrder() == null) {
+            return failed("排序不能为空");
+        }
+        if (StringUtil.isEmpty(newsType.getName())) {
+            return failed("章节名称不能为空");
+        }
+        newsType.setDelFlag(false);
+        newsType.setParentId(6L);
+        newsType.setCreateTime(new Date());
+        newsType.setUpdateTime(new Date());
+
+        return succeed(newsTypeService.insert(newsType) > 0);
+    }
+
+    /**
+     * 修改
+     */
+    @PostMapping(value =  "/update",  consumes="application/json", produces="application/json")
+    @ApiOperation(value = "乐理章节详情修改", httpMethod="POST", consumes="application/json", produces="application/json")
+    public HttpResponseResult<Boolean> update(  @RequestBody SysNewsType newsType) {
+        if (newsType.getOrder() == null) {
+            return failed("排序不能为空");
+        }
+        if (StringUtil.isEmpty(newsType.getName())) {
+            return failed("章节名称不能为空");
+        }
+        if (newsType.getId() == null) {
+            return failed("章节id不能为空");
+        }
+        newsType.setDelFlag(false);
+        newsType.setParentId(6L);
+        newsType.setUpdateTime(new Date());
+        return succeed(newsTypeService.update(newsType)>0);
+    }
+
+    /**
+     * 删除
+     */
+    @PostMapping("/remove/{id}")
+    @ApiOperation(value = "乐理章节详情逻辑删除", notes = "传入id")
+    public HttpResponseResult<Boolean> remove(@ApiParam(value = "编号", required = true) @PathVariable Long id) {
+        if (StringUtil.isEmpty(id)) {
+            return failed("参数不能为空");
+        }
+        SysNewsType sysNewsType = newsTypeService.get(id);
+        if (sysNewsType == null || sysNewsType.getParentId() != 6) {
+            return failed("未找到乐理章节");
+        }
+
+        return succeed(newsTypeService.delete(id) > 0);
+    }
+
+
+    /**
+     * 删除
+     */
+    @PostMapping("/app/page")
+    @ApiOperation(value = "app乐理知识")
+    public HttpResponseResult<PageInfo<SysNewsTypeDto>> appPage(@RequestBody QueryInfo query) {
+
+        return succeed(newsTypeService.appPage(query));
+    }
+
+
+}

+ 57 - 5
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/controller/NewsController.java

@@ -6,6 +6,7 @@ import com.yonge.cooleshow.cms.dto.AppParam;
 import com.yonge.cooleshow.cms.dto.SysNewsInformationDto;
 import com.yonge.cooleshow.cms.dto.SysNewsInformationDto;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.page.PageInfo;
 import com.yonge.cooleshow.common.page.PageInfo;
+import com.yonge.toolset.utils.string.StringUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
@@ -16,18 +17,13 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.MediaType;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.cms.controller.queryinfo.NewsInformationQueryInfo;
 import com.yonge.cooleshow.cms.controller.queryinfo.NewsInformationQueryInfo;
-import com.yonge.cooleshow.cms.dal.dao.StudentRegistrationDao;
-import com.yonge.cooleshow.cms.dal.dao.SysNewsInformationDao;
 import com.yonge.cooleshow.cms.dal.entity.SysNewsInformation;
 import com.yonge.cooleshow.cms.dal.entity.SysNewsInformation;
 import com.yonge.cooleshow.cms.service.SysNewsInformationService;
 import com.yonge.cooleshow.cms.service.SysNewsInformationService;
-import com.yonge.cooleshow.cms.service.SysNewsTypeService;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.toolset.log.model.AuditLogAnnotation;
 import com.yonge.toolset.log.model.AuditLogAnnotation;
 import com.yonge.toolset.utils.collection.MapUtil;
 import com.yonge.toolset.utils.collection.MapUtil;
@@ -72,6 +68,10 @@ public class NewsController extends BaseController {
 		if (sysUser == null || sysUser.getId() == null) {
 		if (sysUser == null || sysUser.getId() == null) {
 			return failed("用户信息获取失败");
 			return failed("用户信息获取失败");
 		}
 		}
+		HttpResponseResult<Object> check = check(newsInfo);
+		if (!check.getStatus()) {
+			return check;
+		}
 		newsInfo.setStatus(NewsStatusEnum.HIDDEN);
 		newsInfo.setStatus(NewsStatusEnum.HIDDEN);
 		newsInfo.setCreateTime(new Date());
 		newsInfo.setCreateTime(new Date());
 		newsInfo.setCreateBy(sysUser.getId());
 		newsInfo.setCreateBy(sysUser.getId());
@@ -80,6 +80,54 @@ public class NewsController extends BaseController {
 		return succeed(sysNewsInformationService.insert(newsInfo));
 		return succeed(sysNewsInformationService.insert(newsInfo));
 	}
 	}
 
 
+	HttpResponseResult<Object> check(SysNewsInformation newsInfo) {
+
+		// 1 2 3 4 5 6
+		if (StringUtil.isEmpty(newsInfo.getTitle())) {
+			return failed("标题不能为空");
+		}
+		// 6
+		if (newsInfo.getSubType() == null && newsInfo.getType() == 6) {
+			return failed("章节不能为空");
+		}
+		// 1 2 3 4 5 6
+		if (StringUtil.isEmpty(newsInfo.getCoverImage())) {
+			return failed("封面不能为空");
+		}
+		// 1 4 6
+		if (newsInfo.getType() == 1 ||newsInfo.getType() == 4 || newsInfo.getType() == 6) {
+			if (newsInfo.getOrder() == null) {
+				return failed("排序值不能为空");
+			}
+		}
+
+		// 1 6
+		if (newsInfo.getType() == 1  || newsInfo.getType() == 6) {
+			if (StringUtil.isEmpty(newsInfo.getContent())) {
+				return failed("内容不能为空");
+			}
+		}
+		// 2 3 4
+		if (newsInfo.getType() == 2 ||newsInfo.getType() == 3 ||newsInfo.getType() == 4 ) {
+			if (newsInfo.getOnlineTime() == null || newsInfo.getOfflineTime() == null) {
+				return failed("生效时间不能为空");
+			}
+		}
+		// 2
+		if (newsInfo.getType() == 2) {
+			if (StringUtil.isEmpty(newsInfo.getAttribute2())) {
+				return failed("广告类型不能为空");
+			}
+			// 2
+			if (newsInfo.getShowTime() == null || newsInfo.getShowTime() < 1) {
+				return failed("显示时长不能为空且不能小于1秒");
+			}
+		}
+
+
+		return succeed();
+	}
+
 	@ApiOperation(value = "更新资讯/广告/闪页/轮播图 ", httpMethod="POST", consumes="application/json", produces="application/json")
 	@ApiOperation(value = "更新资讯/广告/闪页/轮播图 ", httpMethod="POST", consumes="application/json", produces="application/json")
 	@PostMapping(value = "/update",  consumes="application/json", produces="application/json")
 	@PostMapping(value = "/update",  consumes="application/json", produces="application/json")
 	@AuditLogAnnotation(operateName = "资讯更新",interfaceURL = "news/update")
 	@AuditLogAnnotation(operateName = "资讯更新",interfaceURL = "news/update")
@@ -97,6 +145,10 @@ public class NewsController extends BaseController {
 		if(NewsStatusEnum.SHOW.getCode().equals(sysNewsInformationDto.getStatus().getCode())) {
 		if(NewsStatusEnum.SHOW.getCode().equals(sysNewsInformationDto.getStatus().getCode())) {
 			return failed("启用状态下,不可修改");
 			return failed("启用状态下,不可修改");
 		}
 		}
+		HttpResponseResult<Object> check = check(newsInfo);
+		if (!check.getStatus()) {
+			return check;
+		}
 		newsInfo.setUpdateTime(new Date());
 		newsInfo.setUpdateTime(new Date());
 		newsInfo.setUpdateBy(sysUser.getId());
 		newsInfo.setUpdateBy(sysUser.getId());
 
 

+ 1 - 1
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/controller/queryinfo/NewsInformationQueryInfo.java

@@ -13,7 +13,7 @@ import javax.validation.constraints.NotNull;
 
 
 public class NewsInformationQueryInfo extends QueryInfo {
 public class NewsInformationQueryInfo extends QueryInfo {
 
 
-	@ApiModelProperty(value = "类型,1热门资讯,2开屏广告,3闪页管理,4轮播图管理 5按钮管理", required = true)
+	@ApiModelProperty(value = "类型,1热门资讯,2开屏广告,3闪页管理,4轮播图管理 5按钮管理 6 乐理章节", required = true)
 	@NotNull(message = "类型不能为空")
 	@NotNull(message = "类型不能为空")
 	private Integer type;
 	private Integer type;
 
 

+ 4 - 0
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dal/dao/SysNewsTypeDao.java

@@ -1,13 +1,17 @@
 package com.yonge.cooleshow.cms.dal.dao;
 package com.yonge.cooleshow.cms.dal.dao;
 
 
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 
 
 import com.yonge.cooleshow.cms.dal.entity.SysNewsType;
 import com.yonge.cooleshow.cms.dal.entity.SysNewsType;
 import com.yonge.cooleshow.cms.dal.entity.SysNewsTypeTree;
 import com.yonge.cooleshow.cms.dal.entity.SysNewsTypeTree;
+import com.yonge.cooleshow.cms.dto.SysNewsTypeDto;
 import com.yonge.cooleshow.common.dal.BaseDAO;
 import com.yonge.cooleshow.common.dal.BaseDAO;
 
 
 public interface SysNewsTypeDao extends BaseDAO<Long, SysNewsType> {
 public interface SysNewsTypeDao extends BaseDAO<Long, SysNewsType> {
 
 
 	// 根据父级查询子集
 	// 根据父级查询子集
 	List<SysNewsTypeTree> queryByParentId(Long parentId);
 	List<SysNewsTypeTree> queryByParentId(Long parentId);
+
+    List<SysNewsTypeDto> queryAppPage(Map<String, Object> params);
 }
 }

+ 6 - 5
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dal/entity/SysNewsInformation.java

@@ -39,8 +39,8 @@ public class SysNewsInformation {
 	@NotNull(message = "类型不能为空")
 	@NotNull(message = "类型不能为空")
 	private Integer type;
 	private Integer type;
 	
 	
-	@ApiModelProperty(value = "子类型  IMAGE:图片,VIDEO:视频 ", required = false)
-	private String subType;
+	@ApiModelProperty(value = "子类型  章节id ", required = false)
+	private Integer subType;
 
 
 	/** 状态(1-可见 0-不可见) */
 	/** 状态(1-可见 0-不可见) */
 	@ApiModelProperty(value = "状态(1-启用 0-禁用)")
 	@ApiModelProperty(value = "状态(1-启用 0-禁用)")
@@ -83,7 +83,8 @@ public class SysNewsInformation {
 
 
 	@ApiModelProperty("版本号")
 	@ApiModelProperty("版本号")
 	private String attribute1;
 	private String attribute1;
-	
+
+	@ApiModelProperty("广告类型  IMAGE:图片,VIDEO:视频")
 	private String attribute2;
 	private String attribute2;
 	
 	
 	private String subjectIdList;
 	private String subjectIdList;
@@ -226,11 +227,11 @@ public class SysNewsInformation {
 		this.delFlag = delFlag;
 		this.delFlag = delFlag;
 	}
 	}
 
 
-	public String getSubType() {
+	public Integer getSubType() {
 		return subType;
 		return subType;
 	}
 	}
 
 
-	public void setSubType(String subType) {
+	public void setSubType(Integer subType) {
 		this.subType = subType;
 		this.subType = subType;
 	}
 	}
 
 

+ 16 - 0
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dal/entity/SysNewsType.java

@@ -1,5 +1,6 @@
 package com.yonge.cooleshow.cms.dal.entity;
 package com.yonge.cooleshow.cms.dal.entity;
 
 
+import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 
 /**
 /**
@@ -8,16 +9,24 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
 public class SysNewsType {
 public class SysNewsType {
 
 
 	/**  */
 	/**  */
+	@ApiModelProperty("id")
 	private Long id;
 	private Long id;
 	
 	
+
 	/**  */
 	/**  */
+	@ApiModelProperty("名称")
 	private String name;
 	private String name;
 	
 	
 	/**  */
 	/**  */
+	@ApiModelProperty("上级id")
 	private Long parentId;
 	private Long parentId;
 	
 	
 	/**  */
 	/**  */
+
 	private Boolean delFlag= false;
 	private Boolean delFlag= false;
+
+	@ApiModelProperty("排序")
+	private Integer order;
 	
 	
 	/**  */
 	/**  */
 	private java.util.Date createTime;
 	private java.util.Date createTime;
@@ -78,4 +87,11 @@ public class SysNewsType {
 		return ToStringBuilder.reflectionToString(this);
 		return ToStringBuilder.reflectionToString(this);
 	}
 	}
 
 
+	public Integer getOrder() {
+		return order;
+	}
+
+	public void setOrder(Integer order) {
+		this.order = order;
+	}
 }
 }

+ 1 - 0
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dto/SysNewsInformationDto.java

@@ -7,6 +7,7 @@ public class SysNewsInformationDto extends SysNewsInformation {
 
 
 	private String typeName;
 	private String typeName;
 
 
+	@ApiModelProperty("子类型名称")
 	private String subTypeName;
 	private String subTypeName;
 
 
 	@ApiModelProperty("更新人姓名")
 	@ApiModelProperty("更新人姓名")

+ 29 - 0
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dto/SysNewsTypeDto.java

@@ -0,0 +1,29 @@
+package com.yonge.cooleshow.cms.dto;
+
+import com.yonge.cooleshow.cms.dal.entity.SysNewsInformation;
+import com.yonge.cooleshow.cms.dal.entity.SysNewsType;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author liujunchi
+ * @date 2022-04-26
+ */
+@ApiModel("app乐理知识")
+public class SysNewsTypeDto extends SysNewsType {
+
+    @ApiModelProperty("乐理知识")
+    private List<SysNewsInformation> newsInformationList;
+
+    public List<SysNewsInformation> getNewsInformationList() {
+        return newsInformationList;
+    }
+
+    public void setNewsInformationList(List<SysNewsInformation> newsInformationList) {
+        this.newsInformationList = newsInformationList;
+    }
+}

+ 37 - 0
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dto/search/MusicTheorySearch.java

@@ -0,0 +1,37 @@
+package com.yonge.cooleshow.cms.dto.search;
+
+import com.yonge.cooleshow.common.page.QueryInfo;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Description
+ *
+ * @author liujunchi
+ * @date 2022-04-26
+ */
+@ApiModel("乐理章节查询")
+public class MusicTheorySearch extends QueryInfo {
+
+    @ApiModelProperty("章节编号/名称")
+    private String search;
+
+    @ApiModelProperty("上级id")
+    private Long parentId;
+
+    public String getSearch() {
+        return search;
+    }
+
+    public void setSearch(String search) {
+        this.search = search;
+    }
+
+    public Long getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Long parentId) {
+        this.parentId = parentId;
+    }
+}

+ 5 - 0
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/service/SysNewsTypeService.java

@@ -4,6 +4,9 @@ import java.util.List;
 
 
 import com.yonge.cooleshow.cms.dal.entity.SysNewsType;
 import com.yonge.cooleshow.cms.dal.entity.SysNewsType;
 import com.yonge.cooleshow.cms.dal.entity.SysNewsTypeTree;
 import com.yonge.cooleshow.cms.dal.entity.SysNewsTypeTree;
+import com.yonge.cooleshow.cms.dto.SysNewsTypeDto;
+import com.yonge.cooleshow.common.page.PageInfo;
+import com.yonge.cooleshow.common.page.QueryInfo;
 import com.yonge.cooleshow.common.service.BaseService;
 import com.yonge.cooleshow.common.service.BaseService;
 
 
 public interface SysNewsTypeService extends BaseService<Long, SysNewsType> {
 public interface SysNewsTypeService extends BaseService<Long, SysNewsType> {
@@ -12,4 +15,6 @@ public interface SysNewsTypeService extends BaseService<Long, SysNewsType> {
 
 
 	//根据父级查询子集
 	//根据父级查询子集
 	List<SysNewsTypeTree> queryByParentId(Long parentId);
 	List<SysNewsTypeTree> queryByParentId(Long parentId);
+
+	PageInfo<SysNewsTypeDto> appPage(QueryInfo query);
 }
 }

+ 30 - 1
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/service/impl/SysNewsTypeServiceImpl.java

@@ -1,7 +1,15 @@
 package com.yonge.cooleshow.cms.service.impl;
 package com.yonge.cooleshow.cms.service.impl;
 
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.List;
+import java.util.Map;
 
 
+import com.yonge.cooleshow.cms.dal.entity.SysNewsInformation;
+import com.yonge.cooleshow.cms.dto.SysNewsTypeDto;
+import com.yonge.cooleshow.common.page.PageInfo;
+import com.yonge.cooleshow.common.page.QueryInfo;
+import com.yonge.toolset.utils.collection.MapUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
@@ -45,5 +53,26 @@ public class SysNewsTypeServiceImpl extends BaseServiceImpl<Long, SysNewsType>
 		}
 		}
 		return sysNewsTypeDao.queryByParentId(parentId);
 		return sysNewsTypeDao.queryByParentId(parentId);
 	}
 	}
-	
+
+    @Override
+    public PageInfo<SysNewsTypeDto> appPage(QueryInfo query) {
+		PageInfo<SysNewsTypeDto> pageInfo = new PageInfo<>(query.getPage(), query.getRows());
+		Map<String, Object> params = new HashMap<>();
+		MapUtil.populateMap(params, query);
+
+		List<SysNewsTypeDto> dataList = null;
+		int count = sysNewsTypeDao.queryCount(params);
+		if (count > 0) {
+			pageInfo.setTotal(count);
+			params.put("offset", pageInfo.getOffset());
+			dataList = sysNewsTypeDao.queryAppPage(params);
+		}
+		if (count == 0) {
+			dataList = new ArrayList<>();
+		}
+		pageInfo.setRows(dataList);
+		return pageInfo;
+
+    }
+
 }
 }

+ 6 - 3
cooleshow-cms/src/main/resources/config/mybatis/SysNewsInformationMapper.xml

@@ -33,6 +33,7 @@
 	
 	
 	<resultMap type="com.yonge.cooleshow.cms.dto.SysNewsInformationDto" id="SysNewsInformationDto" extends="SysNewsInformation">
 	<resultMap type="com.yonge.cooleshow.cms.dto.SysNewsInformationDto" id="SysNewsInformationDto" extends="SysNewsInformation">
 		<result column="updateName" property="updateName" />
 		<result column="updateName" property="updateName" />
+		<result column="subTypeName" property="subTypeName" />
 	</resultMap>
 	</resultMap>
 	
 	
 	<sql id="queryCondition">
 	<sql id="queryCondition">
@@ -41,7 +42,7 @@
 			<if test="type != null">
 			<if test="type != null">
 				and sni.type_ = #{type}
 				and sni.type_ = #{type}
 			</if>
 			</if>
-			<if test="subType != null and subType != ''">
+			<if test="subType != null">
 				and sni.sub_type_ = #{subType}
 				and sni.sub_type_ = #{subType}
 			</if>
 			</if>
 			<if test="status != null">
 			<if test="status != null">
@@ -168,10 +169,12 @@
 	<select id="selectPage" resultMap="SysNewsInformationDto" parameterType="map">
 	<select id="selectPage" resultMap="SysNewsInformationDto" parameterType="map">
 		SELECT sni.*
 		SELECT sni.*
 		, su.username_ as updateName
 		, su.username_ as updateName
+		, snt.name_ as subTypeName
 		FROM sys_news_information sni
 		FROM sys_news_information sni
+		left join sys_news_type snt on snt.id_ = sni.sub_type_
 		left join sys_user su on sni.update_by_ = su.id_
 		left join sys_user su on sni.update_by_ = su.id_
 		<include refid="queryCondition" />
 		<include refid="queryCondition" />
-		order by sni.status_ desc,sni.order_ desc,sni.update_time_ desc
+		order by sni.status_ desc,sni.order_,sni.update_time_ desc
 		<include refid="global.limit"/>
 		<include refid="global.limit"/>
 	</select>
 	</select>
 	
 	
@@ -227,7 +230,7 @@
 				and find_in_set(#{subjectId},sni.subject_id_list_)
 				and find_in_set(#{subjectId},sni.subject_id_list_)
 			</if>
 			</if>
 		group by sni.id_
 		group by sni.id_
-		order by sni.status_ desc,sni.order_ desc,sni.update_time_ desc
+		order by sni.status_ desc,sni.order_,sni.update_time_ desc
 		<include refid="global.limit" />
 		<include refid="global.limit" />
 	</select>
 	</select>
 
 

+ 76 - 4
cooleshow-cms/src/main/resources/config/mybatis/SysNewsTypeMapper.xml

@@ -8,6 +8,7 @@
 		<result column="name_" property="name" />
 		<result column="name_" property="name" />
 		<result column="parent_id_" property="parentId" />
 		<result column="parent_id_" property="parentId" />
 		<result column="del_flag_" property="delFlag" />
 		<result column="del_flag_" property="delFlag" />
+		<result column="order_" property="order" />
 		<result column="create_time_" property="createTime" />
 		<result column="create_time_" property="createTime" />
 		<result column="update_time_" property="updateTime" />
 		<result column="update_time_" property="updateTime" />
 	</resultMap>
 	</resultMap>
@@ -31,8 +32,8 @@
 	<insert id="insert" parameterType="com.yonge.cooleshow.cms.dal.entity.SysNewsType"
 	<insert id="insert" parameterType="com.yonge.cooleshow.cms.dal.entity.SysNewsType"
 		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO sys_news_type
 		INSERT INTO sys_news_type
-		(id_,name_,parent_id_,del_flag_,create_time_,update_time_)
-		VALUES(#{id},#{name},#{parentId},#{delFlag},#{createTime},#{updateTime})
+		(id_,name_,parent_id_,del_flag_,create_time_,update_time_,order_)
+		VALUES(#{id},#{name},#{parentId},#{delFlag},#{createTime},#{updateTime},#{order})
 	</insert>
 	</insert>
 
 
 	<!-- 根据主键查询一条记录 -->
 	<!-- 根据主键查询一条记录 -->
@@ -57,27 +58,98 @@
 			<if test="createTime != null">
 			<if test="createTime != null">
 				create_time_ = #{createTime},
 				create_time_ = #{createTime},
 			</if>
 			</if>
+			<if test="order != null">
+				order_ = #{order}
+			</if>
 		</set>
 		</set>
 		WHERE id_ = #{id}
 		WHERE id_ = #{id}
 	</update>
 	</update>
 
 
 	<!-- 根据主键删除一条记录 -->
 	<!-- 根据主键删除一条记录 -->
 	<delete id="delete">
 	<delete id="delete">
-		DELETE FROM sys_news_type WHERE id_ = #{id}
+		update sys_news_type set del_flag_ = 1 WHERE id_ = #{id}
 	</delete>
 	</delete>
 
 
 	<!-- 分页查询 -->
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="SysNewsType" parameterType="map">
 	<select id="queryPage" resultMap="SysNewsType" parameterType="map">
-		SELECT * FROM sys_news_type ORDER BY id_
+		SELECT * FROM sys_news_type
+
+		<include refid="queryCondition" />
+		ORDER BY order_ , id_
 		<include refid="global.limit" />
 		<include refid="global.limit" />
 	</select>
 	</select>
 
 
 	<!-- 查询当前表的总记录数 -->
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
 	<select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM sys_news_type
 		SELECT COUNT(*) FROM sys_news_type
+		<include refid="queryCondition" />
 	</select>
 	</select>
 	
 	
 	<select id="queryByParentId" resultMap="SysNewsTypeTree">
 	<select id="queryByParentId" resultMap="SysNewsTypeTree">
 		SELECT * FROM sys_news_type where parent_id_ = #{parentId}
 		SELECT * FROM sys_news_type where parent_id_ = #{parentId}
 	</select>
 	</select>
+
+	<sql id="queryCondition">
+		<where>
+			del_flag_ = 0
+			<if test="search != null and searcer != ''">
+				and (id_ like concat('%',#{search},'%') or name_ like concat('%',#{search},'%'))
+			</if>
+			<if test="parentId != null">
+				and parent_id_ = #{parentId}
+			</if>
+		</where>
+	</sql>
+
+	<select id="queryAppPage" resultMap="SysNewsTypeDto">
+		SELECT snt.id_ as sntId
+		,snt.name_ as name,
+		snt.parent_id_ as parentId,
+		snt.order_ as sntOrder,
+		snt.del_flag_ as sntDelFlag,
+		snt.create_time_ as createTime,
+		snt.update_time_ as updateTime,
+		sni.*
+		FROM sys_news_type snt
+		left join sys_news_information sni on sni.sub_type_ = snt.id_
+		where snt.del_flag_ = 0 and snt.parent_id_ = 6 and sni.del_flag_ = 0 and sni.status_ = 1
+		ORDER BY snt.order_ , sni.order_
+		<include refid="global.limit" />
+	</select>
+
+	<resultMap type="com.yonge.cooleshow.cms.dto.SysNewsTypeDto" id="SysNewsTypeDto">
+
+		<result column="sntId" property="id" />
+		<result column="name" property="name" />
+		<result column="parentId" property="parentId" />
+		<result column="sntOrder" property="order" />
+		<result column="sntDelFlag" property="delFlag" />
+		<result column="createTime" property="createTime" />
+		<result column="updateTime" property="updateTime" />
+
+		<collection property="newsInformationList"  ofType="com.yonge.cooleshow.cms.dal.entity.SysNewsInformation">
+			<result column="id_" property="id" />
+			<result column="title_" property="title" />
+			<result column="content_" property="content" />
+			<result column="cover_image_" property="coverImage" />
+			<result column="video_cover_image_" property="videoCoverImage" />
+			<result column="link_url_" property="linkUrl"/>
+			<result column="type_" property="type"/>
+			<result column="online_time_" property="onlineTime"/>
+			<result column="offline_time_" property="offlineTime"/>
+			<result column="sub_type_" property="subType"/>
+			<result column="status_" property="status" typeHandler="com.yonge.cooleshow.common.dal.CustomEnumTypeHandler" />
+			<result column="create_time_" property="createTime" />
+			<result column="update_time_" property="updateTime" />
+			<result column="del_flag_" property="delFlag" />
+			<result column="href_target_" property="hrefTarget" />
+			<result column="order_" property="order" />
+			<result column="memo_" property="memo" />
+			<result column="attribute1_" property="attribute1" />
+			<result column="attribute2_" property="attribute2" />
+			<result column="show_time_" property="showTime" />
+			<result column="update_by_" property="updateBy" />
+			<result column="create_by_" property="createBy" />
+		</collection>
+	</resultMap>
 </mapper>
 </mapper>