liujunchi 3 лет назад
Родитель
Сommit
ed9e60641b

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

@@ -8,6 +8,7 @@ import java.util.List;
 import com.yonge.cooleshow.cms.dal.entity.NewsStatusEnum;
 import com.yonge.cooleshow.common.page.QueryInfo;
 
+import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 
 public class NewsInformationQueryInfo extends QueryInfo {
@@ -16,6 +17,10 @@ public class NewsInformationQueryInfo extends QueryInfo {
 	@NotNull(message = "类型不能为空")
 	private Integer type;
 
+	@ApiModelProperty(value = "平台类型  ADMIN:平台端  STUDENT:学生端  TEACHER:老师端",required = true)
+	@NotBlank(message = "平台类型不能为空")
+	private String platformType;
+
 	@ApiModelProperty(value = "子类型  IMAGE:图片,VIDEO:视频", required = false)
 	private String subType;
 
@@ -99,4 +104,12 @@ public class NewsInformationQueryInfo extends QueryInfo {
 	public void setExcludeIds(List<Long> excludeIds) {
 		this.excludeIds = excludeIds;
 	}
+
+	public String getPlatformType() {
+		return platformType;
+	}
+
+	public void setPlatformType(String platformType) {
+		this.platformType = platformType;
+	}
 }

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

@@ -56,7 +56,8 @@ public class SysNewsInformation {
 	@ApiModelProperty(value = "顺序号", required = true)
 	private Integer order;
 	
-	@ApiModelProperty(value = "上线时间", required = false)
+	@ApiModelProperty(value = "上线、生效时间", required = false)
+	@NotNull(message = "上线、生效时间不为空")
 	private Date onlineTime;
 	
 	@ApiModelProperty(value = "下线时间", required = false)

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

@@ -58,6 +58,12 @@
 			<if test="subjectId != null">
 				and find_in_set(#{subjectId},sni.subject_id_list_)
 			</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)
+				</if>
+			</if>
 			<if test="excludeIds!=null and excludeIds.size()>0">
 				AND sni.id_ NOT IN
 				<foreach collection="excludeIds" item="excludeId" open="(" close=")" separator=",">