Explorar o código

update:app首页按钮根据版本查询

liujunchi %!s(int64=3) %!d(string=hai) anos
pai
achega
41994f1d4c

+ 8 - 6
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/controller/NewsController.java

@@ -2,6 +2,7 @@ package com.yonge.cooleshow.cms.controller;
 
 import com.yonge.cooleshow.cms.dal.entity.NewsStatusEnum;
 import com.yonge.cooleshow.cms.dto.AppHomeDto;
+import com.yonge.cooleshow.cms.dto.AppParam;
 import com.yonge.cooleshow.cms.dto.SysNewsInformationDto;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.cooleshow.common.page.PageInfo;
@@ -131,7 +132,7 @@ public class NewsController extends BaseController {
 
 	@ApiOperation("app首页banner、按钮、资讯")
 	@PostMapping(value = "/app/home")
-	public HttpResponseResult<AppHomeDto> appHome() {
+	public HttpResponseResult<AppHomeDto> appHome(@RequestBody AppParam param) {
 		AppHomeDto appHomeDto = new AppHomeDto();
 		NewsInformationQueryInfo queryInfo = new NewsInformationQueryInfo();
 		queryInfo.setStatus(NewsStatusEnum.SHOW);
@@ -145,25 +146,26 @@ public class NewsController extends BaseController {
 		List<SysNewsInformationDto> rows = sysNewsInformationService.selectPage(queryInfo).getRows();
 		appHomeDto.setInformation(rows);
 
+
+		// 查所有
+		queryInfo.setRows(999);
 		// 轮播图
 		queryInfo.setType(4);
-		queryInfo.setRows(999);
 		params = new HashMap<>();
 		MapUtil.populateMap(params, queryInfo);
 		appHomeDto.setBanner(sysNewsInformationService.selectPage(queryInfo).getRows());
 		// 闪页
 		queryInfo.setType(3);
-		queryInfo.setRows(999);
 		params = new HashMap<>();
 		MapUtil.populateMap(params, queryInfo);
 		appHomeDto.setFlashPage(sysNewsInformationService.selectPage(queryInfo).getRows());
 
 		// 按钮
-		queryInfo.setType(35);
-		queryInfo.setRows(999);
+		queryInfo.setType(5);
+		queryInfo.setVersion(param.getVersion());
 		params = new HashMap<>();
 		MapUtil.populateMap(params, queryInfo);
-		appHomeDto.setFlashPage(sysNewsInformationService.selectPage(queryInfo).getRows());
+		appHomeDto.setAppMenu(sysNewsInformationService.selectPage(queryInfo).getRows());
 		return succeed(appHomeDto);
 	}
 }

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

@@ -39,6 +39,9 @@ public class NewsInformationQueryInfo extends QueryInfo {
 	@ApiModelProperty(value = "需排除编号")
 	private List<Long> excludeIds;
 
+	@ApiModelProperty("版本号")
+	private String version;
+
 	private Date date;
 
 	public Integer getType() {
@@ -112,4 +115,12 @@ public class NewsInformationQueryInfo extends QueryInfo {
 	public void setPlatformType(String platformType) {
 		this.platformType = platformType;
 	}
+
+	public String getVersion() {
+		return version;
+	}
+
+	public void setVersion(String version) {
+		this.version = version;
+	}
 }

+ 0 - 2
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dal/entity/SysNewsInformation.java

@@ -24,7 +24,6 @@ public class SysNewsInformation {
 
 	/** 内容 */
 	@ApiModelProperty(value = "内容", required = true)
-	@NotBlank(message = "内容不能为空")
 	private String content;
 
 	/** 封面图片 */
@@ -57,7 +56,6 @@ public class SysNewsInformation {
 	private Integer order;
 	
 	@ApiModelProperty(value = "上线、生效时间", required = false)
-	@NotNull(message = "上线、生效时间不为空")
 	private Date onlineTime;
 	
 	@ApiModelProperty(value = "下线时间", required = false)

+ 25 - 0
cooleshow-cms/src/main/java/com/yonge/cooleshow/cms/dto/AppParam.java

@@ -0,0 +1,25 @@
+package com.yonge.cooleshow.cms.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Description
+ *
+ * @author liujunchi
+ * @date 2022-04-25
+ */
+@ApiModel("app首页查询参数")
+public class AppParam {
+
+    @ApiModelProperty("版本号")
+    private String version;
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+}

+ 8 - 2
cooleshow-cms/src/main/resources/config/mybatis/SysNewsInformationMapper.xml

@@ -60,8 +60,11 @@
 			</if>
 			<if test="platformType != null and platformType != ''">
 				<if test="platformType != 'ADMIN'" >
-					and sni.status_ = 1 and sni.online_time_ &lt;= now()
-					and if(sni.offline_time_ is not null,sni.offline_time_ &gt;= now(),1=1)
+					and sni.status_ = 1
+					<if test="type != 5">
+						and sni.online_time_ &lt;= now()
+						and if(sni.offline_time_ is not null,sni.offline_time_ &gt;= now(),1=1)
+					</if>
 				</if>
 			</if>
 			<if test="excludeIds!=null and excludeIds.size()>0">
@@ -70,6 +73,9 @@
 					#{excludeId}
 				</foreach>
 			</if>
+			<if test="version != null and version != ''">
+				and sni.attribute1_ = #{version}
+			</if>
 		</where>
 	</sql>