Browse Source

Merge branch 'master' of https://git.coding.net/aft/AFT.git

albertshaw 8 years ago
parent
commit
045e1936dd

+ 1 - 1
schema/201707012-lecture.sql

@@ -1,7 +1,7 @@
 CREATE TABLE `lecture` (
   `id` VARCHAR(36) CHARACTER SET 'utf8mb4' NOT NULL,
   `uid` VARCHAR(36) CHARACTER SET 'utf8mb4' NOT NULL COMMENT '开展讲座人ID',
-  `lecture_time` VARCHAR(45) NOT NULL COMMENT '讲座开展时间',
+  `lecture_time` DATETIME NOT NULL COMMENT '讲座开展时间',
   `create_time` DATETIME NULL COMMENT '记录创建时间',
   `last_update_time` DATETIME NULL COMMENT '记录最后更新时间',
   `name` VARCHAR(45) CHARACTER SET 'utf8mb4' NOT NULL COMMENT '名称',

+ 2 - 0
src/main/java/com/goafanti/common/dao/LectureMapper.java

@@ -30,4 +30,6 @@ public interface LectureMapper {
 	List<LectureListBo> listDynamic();
 
 	List<BigShotLectureListBo> listBigShotLecture();
+
+	List<LectureListBo> findLectureList();
 }

+ 54 - 3
src/main/java/com/goafanti/common/mapper/LectureMapper.xml

@@ -207,10 +207,10 @@
 	  	 and ui.username like CONCAT('%',  #{username,jdbcType=VARCHAR}, '%')
 	  	</if>
 	  	<if test="startL != null">
-	  	 and l.lecture_time <![CDATA[ >= ]]> #{startL,jdbcType=TIMESTAPM}
+	  	 and l.lecture_time <![CDATA[ >= ]]> #{startL,jdbcType=TIMESTAMP}
 	  	</if>
 	  	<if test="endL != null">
-	  	 and l.lecture_time <![CDATA[ < ]]> #{endL,jdbcType=TIMESTAPM}
+	  	 and l.lecture_time <![CDATA[ <= ]]> #{endL,jdbcType=TIMESTAMP}
 	  	</if>
 	  	order by l.lecture_time desc
 	  	<if test="page_sql!=null">
@@ -238,7 +238,7 @@
 	  	 and l.lecture_time <![CDATA[ >= ]]> #{startL,jdbcType=TIMESTAMP}
 	  	</if>
 	  	<if test="endL != null">
-	  	 and l.lecture_time <![CDATA[ < ]]> #{endL,jdbcType=TIMESTAMP}
+	  	 and l.lecture_time <![CDATA[ <= ]]> #{endL,jdbcType=TIMESTAMP}
 	  	</if>
   </select>
   
@@ -312,4 +312,55 @@
 	  		l.deleted_sign = 0
 	  	and l.hot = 1
   </select>
+  
+  <select id="findLectureList" resultType="com.goafanti.lecture.bo.LectureListBo">
+  		select 
+	  		l.id,
+	  		l.uid,
+	  		l.name,
+	  		l.lecture_time as lectureTime,
+	  		l.summary,
+	  		l.lecture_url as lectureUrl,
+	  		ui.username,
+	  		l.hot,
+	  		l.dynamic,
+	  		l.end_time as endTime
+	  	from lecture l
+	  	left join  user_identity ui on ui.uid = l.uid
+	  	where 
+	  		l.deleted_sign = 0
+	  	order by lecture_time desc
+	  	limit 0 , 5
+  </select>
+  
+  <select id="findMoreLectureListByPage" parameterType="String" resultType="com.goafanti.lecture.bo.LectureListBo">
+	  	select 
+	  		l.id,
+	  		l.uid,
+	  		l.name,
+	  		l.lecture_time as lectureTime,
+	  		l.summary,
+	  		l.lecture_url as lectureUrl,
+	  		ui.username,
+	  		l.hot,
+	  		l.dynamic,
+	  		l.end_time as endTime
+	  	from lecture l
+	  	left join  user_identity ui on ui.uid = l.uid
+	  	where 
+	  	l.deleted_sign = 0 
+	  	order by l.lecture_time desc
+	  	<if test="page_sql!=null">
+			${page_sql}
+		</if>
+  </select>
+  
+  <select id="findMoreLectureCount" parameterType="String" resultType="java.lang.Integer">
+  		select 
+	  		count(1)
+	  	from lecture l
+	  	left join  user_identity ui on ui.uid = l.uid
+	  	where 
+	  	l.deleted_sign = 0 
+  </select>
 </mapper>

+ 2 - 2
src/main/java/com/goafanti/common/mapper/UserMapper.xml

@@ -875,7 +875,7 @@
   	left join user_career uc on uc.uid = u.id
   	left join achievement_demand_count adc on adc.uid = u.id
   	where 
-  		ui.celebrity = 1 or ui.expert = 1
+  		(ui.celebrity = 1 or ui.expert = 1)
   	<if test="number != null">
   		and u.number = #{number,jdbcType=INTEGER}
   	</if>
@@ -905,7 +905,7 @@
   	left join user_identity ui on ui.uid = u.id
   	left join user_career uc on uc.uid = u.id
   	where 
-  		ui.celebrity = 1 or ui.expert = 1
+  		(ui.celebrity = 1 or ui.expert = 1)
   	<if test="number != null">
   		and u.number = #{number,jdbcType=INTEGER}
   	</if>

+ 7 - 7
src/main/java/com/goafanti/lecture/bo/InputLecture.java

@@ -17,15 +17,15 @@ public class InputLecture {
 	private String	name;
 
 	@Size(min = 0, max = 128, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
-	private String	describe;
+	private String	summary;
 
 	@Size(min = 0, max = 255, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
 	private String	lectureUrl;
-	
+
 	@Max(value = 1, message = "{" + ErrorConstants.PARAM_ERROR + "}")
 	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
 	private Integer	hot;
-	
+
 	@Max(value = 1, message = "{" + ErrorConstants.PARAM_ERROR + "}")
 	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
 	private Integer	dynamic;
@@ -54,12 +54,12 @@ public class InputLecture {
 		this.name = name;
 	}
 
-	public String getDescribe() {
-		return describe;
+	public String getSummary() {
+		return summary;
 	}
 
-	public void setDescribe(String describe) {
-		this.describe = describe;
+	public void setSummary(String summary) {
+		this.summary = summary;
 	}
 
 	public String getLectureUrl() {

+ 4 - 0
src/main/java/com/goafanti/lecture/service/LectureService.java

@@ -28,4 +28,8 @@ public interface LectureService {
 
 	List<BigShotLectureListBo> listBigShotLecture();
 
+	List<LectureListBo> findLectureList();
+
+	Pagination<LectureListBo> loadMore(Integer pSize, Integer pNo);
+
 }

+ 20 - 1
src/main/java/com/goafanti/lecture/service/impl/LectureServiceImpl.java

@@ -83,7 +83,7 @@ public class LectureServiceImpl extends BaseMybatisDao<LectureMapper> implements
 			params.put("startL", StringUtils.isBlank(startLectureTime) ? null
 					: DateUtils.parseDate(startLectureTime, AFTConstants.YYYYMMDDHHMMSS));
 			params.put("endL", StringUtils.isBlank(endLectureTime) ? null
-					: DateUtils.addDays(DateUtils.parseDate(endLectureTime, AFTConstants.YYYYMMDDHHMMSS), 1));
+					: DateUtils.parseDate(endLectureTime, AFTConstants.YYYYMMDDHHMMSS));
 		} catch (ParseException e) {
 		}
 
@@ -123,4 +123,23 @@ public class LectureServiceImpl extends BaseMybatisDao<LectureMapper> implements
 		return lectureMapper.listBigShotLecture();
 	}
 
+	@Override
+	public List<LectureListBo> findLectureList() {
+		return lectureMapper.findLectureList();
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<LectureListBo> loadMore(Integer pageSize, Integer pageNo) {
+		if (pageNo == null || pageNo < 0) {
+			pageNo = 2;
+		}
+
+		if (pageSize == null || pageSize < 0 || pageSize > 5) {
+			pageSize = 10;
+		}
+		return (Pagination<LectureListBo>) findPage("findMoreLectureListByPage", "findMoreLectureCount", null, pageNo,
+				pageSize);
+	}
+
 }

+ 1 - 1
src/main/java/com/goafanti/portal/controller/PortalBigShotController.java

@@ -27,7 +27,7 @@ public class PortalBigShotController {
 	private LectureService		lectureService;
 
 	/**
-	 * 科技明星展示
+	 * 
 	 */
 	// @RequestMapping(value = "/portal/scienceTechnology/bigShot", method =
 	// RequestMethod.GET)

+ 58 - 0
src/main/java/com/goafanti/portal/controller/PortalLectureController.java

@@ -0,0 +1,58 @@
+package com.goafanti.portal.controller;
+
+import java.util.Collections;
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
+
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.controller.BaseApiController;
+import com.goafanti.lecture.bo.LectureListBo;
+import com.goafanti.lecture.service.LectureService;
+
+/**
+ * 科技讲堂
+ */
+@RestController
+public class PortalLectureController extends BaseApiController {
+	@Resource
+	private LectureService lectureService;
+
+	// @RequestMapping(value = "/portal/scienceTechnology/lecture", method =
+	// RequestMethod.GET)
+	public ModelAndView lecture() {
+		ModelAndView mv = new ModelAndView();
+		List<LectureListBo> lectureList = lectureService.findLectureList();
+		if (null != lectureList && lectureList.size() > 0) {
+			Collections.reverse(lectureList);
+		}
+		mv.addObject("lectureList", lectureList);
+		mv.setViewName("/portal/scienceTechnology/lecture");
+		return mv;
+	}
+
+	/**
+	 * 查看更多
+	 */
+	@RequestMapping(value = "/portal/scienceTechnology/lecture/loadMore", method = RequestMethod.GET)
+	public Result loadMore(String pageSize, String pageNo) {
+		Result res = new Result();
+		Integer pNo = 2;
+		Integer pSize = 5;
+		if (StringUtils.isNumeric(pageSize)) {
+			pSize = Integer.parseInt(pageSize);
+		}
+		if (StringUtils.isNumeric(pageNo)) {
+			pNo = Integer.parseInt(pageNo);
+		}
+		res.setData(lectureService.loadMore(pSize, pNo));
+		return res;
+	}
+
+}

+ 4 - 4
src/main/webapp/WEB-INF/views/portal/scienceTechnology/bigShot.html

@@ -56,15 +56,15 @@
 		</div>
 		<div class="star_list">
 			<ul>
-				<li>
+				<li th:each="star,iterStart:${starList}">
 					<div class="star_content_img">
 						<img th:src="${portalHost + '/img/star_img_1.png'}">
 						<a href="#">报名中</a>
 					</div>
 					<div class="star_content_info">
-						<h4>陈政清</h4>
-						<h5>湖南大学 土木工程学院</h5>
-						<h5>“985”工程首席科学家</h5>
+						<h4 th:text="${star.username}">陈政清</h4>
+						<h5 th:text="${star.workUnit}">湖南大学 土木工程学院</h5>
+						<h5 th:text="${star.professionalTitle}">“985”工程首席科学家</h5>
 						<p class="mt20"><label>技术:</label> <span class="red">4</span>项</p>
 						<p><label>粉丝:</label> <span class="red">456</span>人</p>
 					</div>