Browse Source

feat:勇哥内容管理

Joburgess 4 years ago
parent
commit
0cf4deaa72

+ 13 - 4
cms/src/main/java/com/ym/mec/cms/controller/NewsController.java

@@ -1,8 +1,5 @@
 package com.ym.mec.cms.controller;
 
-import com.ym.mec.auth.api.client.SysUserFeignService;
-import com.ym.mec.auth.api.entity.SysUser;
-
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
@@ -19,10 +16,13 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.cms.controller.queryinfo.NewsInformationQueryInfo;
 import com.ym.mec.cms.dal.dao.SysNewsInformationDao;
 import com.ym.mec.cms.dal.entity.SysNewsInformation;
 import com.ym.mec.cms.service.SysNewsInformationService;
+import com.ym.mec.cms.service.SysNewsTypeService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.util.collection.MapUtil;
 import com.yonge.log.model.AuditLogAnnotation;
@@ -36,6 +36,9 @@ public class NewsController extends BaseController {
 	private SysNewsInformationService sysNewsInformationService;
 	
 	@Autowired
+	private SysNewsTypeService sysNewsTypeService;
+	
+	@Autowired
 	private SysNewsInformationDao sysNewsInformationDao;
 	
 	@Autowired
@@ -57,6 +60,12 @@ public class NewsController extends BaseController {
 		return succeed(sysNewsInformationService.queryPage(queryInfo));
 	}
 
+	@ApiOperation("资讯类型列表查询")
+	@GetMapping(value = "/typeList")
+	public Object getTypeList(Integer parentId) {
+		return succeed(sysNewsTypeService.queryByParentId(parentId));
+	}
+
 	@ApiOperation("资讯列表分页查询")
 	@GetMapping(value = "/homeList")
 	public Object getHomeList(NewsInformationQueryInfo queryInfo) {
@@ -70,7 +79,7 @@ public class NewsController extends BaseController {
 	@GetMapping(value = "/query")
 	public Object query(Long id) {
 
-		return succeed(sysNewsInformationService.get(id));
+		return succeed(sysNewsInformationService.queryById(id));
 	}
 
 	@ApiOperation("新增资讯")

+ 3 - 0
cms/src/main/java/com/ym/mec/cms/dal/dao/SysNewsInformationDao.java

@@ -4,6 +4,7 @@ import java.util.List;
 import java.util.Map;
 
 import com.ym.mec.cms.dal.entity.SysNewsInformation;
+import com.ym.mec.cms.dto.SysNewsInformationDto;
 import com.ym.mec.common.dal.BaseDAO;
 
 public interface SysNewsInformationDao extends BaseDAO<Long, SysNewsInformation> {
@@ -31,4 +32,6 @@ public interface SysNewsInformationDao extends BaseDAO<Long, SysNewsInformation>
 	 * @return
 	 */
 	List<SysNewsInformation> queryNeedUpdateStatusList();
+	
+	SysNewsInformationDto queryById(Long id);
 }

+ 26 - 0
cms/src/main/java/com/ym/mec/cms/dto/SysNewsInformationDto.java

@@ -0,0 +1,26 @@
+package com.ym.mec.cms.dto;
+
+import com.ym.mec.cms.dal.entity.SysNewsInformation;
+
+public class SysNewsInformationDto extends SysNewsInformation {
+
+	private String typeName;
+
+	private String subTypeName;
+
+	public String getTypeName() {
+		return typeName;
+	}
+
+	public void setTypeName(String typeName) {
+		this.typeName = typeName;
+	}
+
+	public String getSubTypeName() {
+		return subTypeName;
+	}
+
+	public void setSubTypeName(String subTypeName) {
+		this.subTypeName = subTypeName;
+	}
+}

+ 9 - 1
cms/src/main/java/com/ym/mec/cms/service/SysNewsInformationService.java

@@ -6,6 +6,7 @@ import java.util.Map;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.cms.controller.queryinfo.NewsInformationQueryInfo;
 import com.ym.mec.cms.dal.entity.SysNewsInformation;
+import com.ym.mec.cms.dto.SysNewsInformationDto;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
@@ -32,7 +33,14 @@ public interface SysNewsInformationService extends BaseService<Long, SysNewsInfo
 	 * @return
 	 */
 	Map<String, PageInfo<SysNewsInformation>> getHomeList(SysUser user, NewsInformationQueryInfo queryInfo);
-	
+
+	/**
+	 * 获取详情
+	 * @param id
+	 * @return
+	 */
+	SysNewsInformationDto queryById(Long id);
+
 	/**
 	 * 自动更新状态
 	 * @return

+ 6 - 0
cms/src/main/java/com/ym/mec/cms/service/impl/SysNewsInformationServiceImpl.java

@@ -17,6 +17,7 @@ import com.ym.mec.cms.controller.queryinfo.NewsInformationQueryInfo;
 import com.ym.mec.cms.dal.dao.SysNewsInformationDao;
 import com.ym.mec.cms.dal.entity.NewsStatusEnum;
 import com.ym.mec.cms.dal.entity.SysNewsInformation;
+import com.ym.mec.cms.dto.SysNewsInformationDto;
 import com.ym.mec.cms.service.SysNewsInformationService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.page.PageInfo;
@@ -133,6 +134,11 @@ public class SysNewsInformationServiceImpl extends BaseServiceImpl<Long, SysNews
 		return homeList;
 	}
 	
+	@Override
+	public SysNewsInformationDto queryById(Long id) {
+		return sysNewsInformationDao.queryById(id);
+	}
+
 	private PageInfo<SysNewsInformation> queryHomePage(QueryInfo queryInfo) {
 		PageInfo<SysNewsInformation> pageInfo = new PageInfo<SysNewsInformation>(queryInfo.getPage(), queryInfo.getRows());
 		Map<String, Object> params = new HashMap<String, Object>();

+ 12 - 0
cms/src/main/resources/config/mybatis/SysNewsInformationMapper.xml

@@ -31,6 +31,11 @@
 		<result column="subject_name_" property="subjectName" />
 	</resultMap>
 	
+	<resultMap type="com.ym.mec.cms.dto.SysNewsInformationDto" id="SysNewsInformationDto" extends="SysNewsInformation">
+		<result column="typeName" property="typeName" />
+		<result column="subTypeName" property="subTypeName" />
+	</resultMap>
+	
 	<sql id="queryCondition">
 		<where>
 			sni.del_flag_=0 
@@ -268,4 +273,11 @@
 		or (online_time_ is not null and online_time_ &gt;= now() and status_ = 1)
 		)
 	</select>
+	
+	<select id="queryById" resultMap="SysNewsInformationDto" >
+		SELECT sni.*,sntp.name_ typeName,snts.name_ subTypeName FROM sys_news_information sni 
+		left join sys_news_type sntp on sni.type_ = sntp.id_
+		left join sys_news_type snts on sni.sub_type_ = snts.id_
+		where sni.id_ = #{id}
+	</select>
 </mapper>