Browse Source

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

wubb 8 years ago
parent
commit
3ba1986935

+ 6 - 0
schema/20170719-alter-activity.sql

@@ -0,0 +1,6 @@
+alter table `activity` 
+add  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间(报名开始时间)',
+add `enroll_deadline`  datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '报名截止时间';
+
+alter table `activity`  add  `title_url` varchar(255) DEFAULT NULL COMMENT '题图地址';
+alter table `activity` modify column `img_urls` varchar(1000) DEFAULT NULL COMMENT '活动图片地址';

+ 107 - 0
src/main/java/com/goafanti/activity/bo/ActivityListBo.java

@@ -0,0 +1,107 @@
+package com.goafanti.activity.bo;
+
+import java.util.Date;
+
+public class ActivityListBo {
+	private Long	id;
+
+	/**
+	 * 开始时间
+	 */
+	private Date	startTime;
+
+	/**
+	 * 结束时间
+	 */
+	private Date	endTime;
+
+	/**
+	 * 标题
+	 */
+	private String	name;
+
+	/**
+	 * 主办单位
+	 */
+	private String	host;
+
+	/**
+	 * 活动类型
+	 */
+	private Integer	type;
+
+	/**
+	 * 活动形式
+	 */
+	private Integer	form;
+
+	/**
+	 * 报名截止时间
+	 */
+	private Date	enrollDeadline;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Date getStartTime() {
+		return startTime;
+	}
+
+	public void setStartTime(Date startTime) {
+		this.startTime = startTime;
+	}
+
+	public Date getEndTime() {
+		return endTime;
+	}
+
+	public void setEndTime(Date endTime) {
+		this.endTime = endTime;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getHost() {
+		return host;
+	}
+
+	public void setHost(String host) {
+		this.host = host;
+	}
+
+	public Integer getType() {
+		return type;
+	}
+
+	public void setType(Integer type) {
+		this.type = type;
+	}
+
+	public Integer getForm() {
+		return form;
+	}
+
+	public void setForm(Integer form) {
+		this.form = form;
+	}
+
+	public Date getEnrollDeadline() {
+		return enrollDeadline;
+	}
+
+	public void setEnrollDeadline(Date enrollDeadline) {
+		this.enrollDeadline = enrollDeadline;
+	}
+
+}

+ 147 - 0
src/main/java/com/goafanti/activity/bo/InputActivity.java

@@ -0,0 +1,147 @@
+package com.goafanti.activity.bo;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.Size;
+
+import com.goafanti.common.constant.ErrorConstants;
+
+public class InputActivity {
+	@Max(value = 999999999999999999L, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Long	id;
+
+	@Size(min = 0, max = 45, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String	name;
+
+	@Size(min = 0, max = 128, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String	address;
+
+	@Size(min = 0, max = 45, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String	host;
+
+	@Size(min = 0, max = 45, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String	undertake;
+
+	@Size(min = 0, max = 255, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String	asist;
+
+	@Max(value = 9, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer	type;
+
+	@Max(value = 9, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	private Integer	form;
+
+	@Size(min = 0, max = 1000, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String	imgUrls;
+
+	@Size(min = 0, max = 255, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String	result;
+
+	@Size(min = 0, max = 255, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String	titleUrl;
+
+	/**
+	 * 描述
+	 */
+	private String	desc;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getAddress() {
+		return address;
+	}
+
+	public void setAddress(String address) {
+		this.address = address;
+	}
+
+	public String getHost() {
+		return host;
+	}
+
+	public void setHost(String host) {
+		this.host = host;
+	}
+
+	public String getUndertake() {
+		return undertake;
+	}
+
+	public void setUndertake(String undertake) {
+		this.undertake = undertake;
+	}
+
+	public String getAsist() {
+		return asist;
+	}
+
+	public void setAsist(String asist) {
+		this.asist = asist;
+	}
+
+	public Integer getType() {
+		return type;
+	}
+
+	public void setType(Integer type) {
+		this.type = type;
+	}
+
+	public Integer getForm() {
+		return form;
+	}
+
+	public void setForm(Integer form) {
+		this.form = form;
+	}
+
+	public String getImgUrls() {
+		return imgUrls;
+	}
+
+	public void setImgUrls(String imgUrls) {
+		this.imgUrls = imgUrls;
+	}
+
+	public String getResult() {
+		return result;
+	}
+
+	public void setResult(String result) {
+		this.result = result;
+	}
+
+	public String getTitleUrl() {
+		return titleUrl;
+	}
+
+	public void setTitleUrl(String titleUrl) {
+		this.titleUrl = titleUrl;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+
+	public void setDesc(String desc) {
+		this.desc = desc;
+	}
+
+}

+ 6 - 0
src/main/java/com/goafanti/activity/service/ActivityService.java

@@ -1,5 +1,11 @@
 package com.goafanti.activity.service;
 
+import com.goafanti.common.model.Activity;
+import com.goafanti.core.mybatis.page.Pagination;
+
 public interface ActivityService {
 
+	Pagination<Activity> listActivity(String sTime, String eTime, String name, String host, Integer type, Integer form,
+			Integer pNo, Integer pSize);
+
 }

+ 57 - 3
src/main/java/com/goafanti/activity/service/impl/ActivityServiceImpl.java

@@ -1,10 +1,64 @@
 package com.goafanti.activity.service.impl;
 
+import java.text.ParseException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.goafanti.activity.service.ActivityService;
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.ActivityMapper;
+import com.goafanti.common.model.Activity;
+import com.goafanti.common.utils.DateUtils;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
+
 @Service
-public class ActivityServiceImpl implements ActivityService {
-	/*@Autowired
-	private ActivityMapper activityMapper;*/
+public class ActivityServiceImpl extends BaseMybatisDao<ActivityMapper> implements ActivityService {
+	@Autowired
+	private ActivityMapper activityMapper;
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<Activity> listActivity(String sTime, String eTime, String name, String host, Integer type,
+			Integer form, Integer pNo, Integer pSize) {
+
+		Map<String, Object> params = new HashMap<>();
+
+		try {
+			params.put("sTime", StringUtils.isBlank(sTime) ? null : DateUtils.parseDate(sTime, AFTConstants.YYYYMMDD));
+			params.put("eTime", StringUtils.isBlank(eTime) ? null
+					: DateUtils.addDays(DateUtils.parseDate(eTime, AFTConstants.YYYYMMDD), 1));
+		} catch (ParseException e) {
+		}
+
+		if (StringUtils.isNotBlank(name)) {
+			params.put("name", name);
+		}
+
+		if (StringUtils.isNotBlank(host)) {
+			params.put("host", host);
+		}
+
+		if (null != type) {
+			params.put("type", type);
+		}
+
+		if (null != form) {
+			params.put("form", form);
+		}
+
+		if (pNo == null || pNo < 0) {
+			pNo = 1;
+		}
+
+		if (pSize == null || pSize < 0 || pSize > 10) {
+			pSize = 10;
+		}
+		return (Pagination<Activity>) findPage("findActivityListByPage", "findActivityCount", params, pNo, pSize);
+	}
+
 }

+ 39 - 3
src/main/java/com/goafanti/admin/controller/AdminActivityApiController.java

@@ -1,14 +1,20 @@
 package com.goafanti.admin.controller;
 
 import javax.annotation.Resource;
+import javax.validation.Valid;
 
+import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
+import com.goafanti.activity.bo.InputActivity;
 import com.goafanti.activity.service.ActivityService;
 import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.BaseApiController;
+import com.goafanti.common.enums.ActivityFields;
+import com.goafanti.common.utils.StringUtils;
 
 /**
  * 活动圈
@@ -23,10 +29,40 @@ public class AdminActivityApiController extends BaseApiController {
 	 * 活动列表
 	 */
 	@RequestMapping(value = "/list", method = RequestMethod.GET)
-	public Result list(String sTime, String eTime, String name, Integer status, String host, String undertake,
-			Integer type, Integer form, String pageSize, String pageNo) {
+	public Result list(String sTime, String eTime, String name, String host, Integer type, Integer form,
+			String pageSize, String pageNo) {
 		Result res = new Result();
+		Integer pNo = 1;
+		Integer pSize = 10;
+		if (StringUtils.isNumeric(pageSize)) {
+			pSize = Integer.parseInt(pageSize);
+		}
+		if (StringUtils.isNumeric(pageNo)) {
+			pNo = Integer.parseInt(pageNo);
+		}
+		res.setData(activityService.listActivity(sTime, eTime, name, host, type, form, pNo, pSize));
+		return res;
+	}
+	
+	/**
+	 * 新增
+	 */
+	@RequestMapping(value = "/add", method = RequestMethod.POST)
+	public Result add(@Valid InputActivity ia, BindingResult bindingResult, String startTimeFormattedDate,
+			String endTimeFormattedDate, String enrollDeadlineFormattedDate){
+		Result res = new Result();
+		if (bindingResult.hasErrors()) {
+			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+					ActivityFields.getFieldDesc(bindingResult.getFieldError().getField())));
+			return res;
+		}
+		
+		if (StringUtils.isBlank(ia.getName())){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "标题"));
+			return res;
+		}
+		
+		//if(StringUtils.)
 		return res;
-
 	}
 }

+ 1 - 1
src/main/java/com/goafanti/common/controller/WebpageController.java

@@ -401,7 +401,7 @@ public class WebpageController extends BaseController {
 		return modelview;
 	}
 
-	protected void handleBanners(ModelAndView modelview, BannersType bannersType) {
+	private void handleBanners(ModelAndView modelview, BannersType bannersType) {
 		List<Banners> banners = bannersService.findPortalBanners(bannersType.getKey());
 		if (!banners.isEmpty()) {
 			modelview.addObject("banners", banners);

+ 58 - 0
src/main/java/com/goafanti/common/enums/ActivityFields.java

@@ -0,0 +1,58 @@
+package com.goafanti.common.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum ActivityFields {
+	ID("id", "活动圈活动ID"),
+	NAME("name", "标题"),
+	ADDRESS("address", "活动地址"),
+	HOST("host", "主办单位"),
+	UNDERTAKE("undertake", "承办单位"),
+	ASIST("asist", "协办单位"),
+	TYPE("type", "活动类型"),
+	FORM("form", "活动形式"),
+	IMGURLS("imgUrls", "活动图片地址"),
+	RESULT("result", "活动结果描述"),
+	TITLEURL("titleUrl", "题图地址"),
+	OTHER("", "未知参数");
+
+	private ActivityFields(String code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+
+	private static Map<String, ActivityFields> status = new HashMap<String, ActivityFields>();
+
+	static {
+		for (ActivityFields value : ActivityFields.values()) {
+			status.put(value.getCode(), value);
+		}
+	}
+
+	public static ActivityFields getField(String code) {
+		if (containsType(code)) {
+			return status.get(code);
+		}
+		return OTHER;
+	}
+
+	public static String getFieldDesc(String code) {
+		return getField(code).getDesc();
+	}
+
+	public static boolean containsType(String code) {
+		return status.containsKey(code);
+	}
+
+	private String	code;
+	private String	desc;
+
+	public String getCode() {
+		return code;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+}

+ 42 - 4
src/main/java/com/goafanti/common/mapper/ActivityMapper.xml

@@ -15,13 +15,16 @@
     <result column="form" property="form" jdbcType="INTEGER" />
     <result column="img_urls" property="imgUrls" jdbcType="VARCHAR" />
     <result column="result" property="result" jdbcType="VARCHAR" />
+    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
+    <result column="enroll_deadline" property="enrollDeadline" jdbcType="TIMESTAMP" />
+    <result column="title_url" property="titleUrl" jdbcType="VARCHAR" />
   </resultMap>
   <resultMap id="ResultMapWithBLOBs" type="com.goafanti.common.model.Activity" extends="BaseResultMap" >
     <result column="desc" property="desc" jdbcType="LONGVARCHAR" />
   </resultMap>
   <sql id="Base_Column_List" >
     id, start_time, end_time, name, status, address, host, undertake, asist, type, form, 
-    img_urls, result
+    img_urls, result, create_time, enroll_deadline, title_url
   </sql>
   <sql id="Blob_Column_List" >
     desc
@@ -43,12 +46,14 @@
       name, status, address, 
       host, undertake, asist, 
       type, form, img_urls, 
-      result, desc)
+      result, create_time, enroll_deadline, 
+      title_url, desc)
     values (#{id,jdbcType=BIGINT}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, 
       #{name,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{address,jdbcType=VARCHAR}, 
       #{host,jdbcType=VARCHAR}, #{undertake,jdbcType=VARCHAR}, #{asist,jdbcType=VARCHAR}, 
       #{type,jdbcType=INTEGER}, #{form,jdbcType=INTEGER}, #{imgUrls,jdbcType=VARCHAR}, 
-      #{result,jdbcType=VARCHAR}, #{desc,jdbcType=LONGVARCHAR})
+      #{result,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{enrollDeadline,jdbcType=TIMESTAMP}, 
+      #{titleUrl,jdbcType=VARCHAR}, #{desc,jdbcType=LONGVARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.Activity" >
     insert into activity
@@ -92,6 +97,15 @@
       <if test="result != null" >
         result,
       </if>
+      <if test="createTime != null" >
+        create_time,
+      </if>
+      <if test="enrollDeadline != null" >
+        enroll_deadline,
+      </if>
+      <if test="titleUrl != null" >
+        title_url,
+      </if>
       <if test="desc != null" >
         desc,
       </if>
@@ -136,6 +150,15 @@
       <if test="result != null" >
         #{result,jdbcType=VARCHAR},
       </if>
+      <if test="createTime != null" >
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="enrollDeadline != null" >
+        #{enrollDeadline,jdbcType=TIMESTAMP},
+      </if>
+      <if test="titleUrl != null" >
+        #{titleUrl,jdbcType=VARCHAR},
+      </if>
       <if test="desc != null" >
         #{desc,jdbcType=LONGVARCHAR},
       </if>
@@ -180,6 +203,15 @@
       <if test="result != null" >
         result = #{result,jdbcType=VARCHAR},
       </if>
+      <if test="createTime != null" >
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="enrollDeadline != null" >
+        enroll_deadline = #{enrollDeadline,jdbcType=TIMESTAMP},
+      </if>
+      <if test="titleUrl != null" >
+        title_url = #{titleUrl,jdbcType=VARCHAR},
+      </if>
       <if test="desc != null" >
         desc = #{desc,jdbcType=LONGVARCHAR},
       </if>
@@ -200,6 +232,9 @@
       form = #{form,jdbcType=INTEGER},
       img_urls = #{imgUrls,jdbcType=VARCHAR},
       result = #{result,jdbcType=VARCHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      enroll_deadline = #{enrollDeadline,jdbcType=TIMESTAMP},
+      title_url = #{titleUrl,jdbcType=VARCHAR},
       desc = #{desc,jdbcType=LONGVARCHAR}
     where id = #{id,jdbcType=BIGINT}
   </update>
@@ -216,7 +251,10 @@
       type = #{type,jdbcType=INTEGER},
       form = #{form,jdbcType=INTEGER},
       img_urls = #{imgUrls,jdbcType=VARCHAR},
-      result = #{result,jdbcType=VARCHAR}
+      result = #{result,jdbcType=VARCHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      enroll_deadline = #{enrollDeadline,jdbcType=TIMESTAMP},
+      title_url = #{titleUrl,jdbcType=VARCHAR}
     where id = #{id,jdbcType=BIGINT}
   </update>
 </mapper>

+ 64 - 0
src/main/java/com/goafanti/common/mapper/ActivityMapperExt.xml

@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.goafanti.common.dao.ActivityMapper">
+	<select id="findActivityListByPage" parameterType="String" resultType="com.goafanti.activity.bo.ActivityListBo">
+		select
+			id,
+			start_time as startTime,
+			end_time as endTime, 
+			name,
+			host,
+			type,
+			form,
+			enroll_deadline as enrollDeadline
+		from activity
+		where 1=1
+		<if test="sTime != null">
+			start_time <![CDATA[ >= ]]> #{sTime,jdbcType=TIMESTAMP}
+		</if>
+		<if test="eTime != null">
+			start_time <![CDATA[ < ]]> #{eTime,jdbcType=TIMESTAMP}
+		</if>
+		<if test="name != null">
+			name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+		</if>
+		<if test="host != null">
+			host like CONCAT('%',#{host,jdbcType=VARCHAR},'%')
+		</if>
+		<if test="type != null">
+			type = #{type,jdbcType=INTEGER}
+		</if>
+		<if test="form != null">
+			form = #{form,jdbcType=INTEGER}
+		</if>
+		order by start_time desc
+		<if test="page_sql!=null">
+			${page_sql}
+		</if>
+	</select>
+	
+	<select id="findActivityCount" parameterType="String" resultType="java.lang.Integer">
+		select
+			count(1)
+		from activity
+		where 1=1
+		<if test="sTime != null">
+			start_time <![CDATA[ >= ]]> #{sTime,jdbcType=TIMESTAMP}
+		</if>
+		<if test="eTime != null">
+			start_time <![CDATA[ < ]]> #{eTime,jdbcType=TIMESTAMP}
+		</if>
+		<if test="name != null">
+			name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
+		</if>
+		<if test="host != null">
+			host like CONCAT('%',#{host,jdbcType=VARCHAR},'%')
+		</if>
+		<if test="type != null">
+			type = #{type,jdbcType=INTEGER}
+		</if>
+		<if test="form != null">
+			form = #{form,jdbcType=INTEGER}
+		</if>
+	</select>
+</mapper>

+ 0 - 95
src/main/java/com/goafanti/common/mapper/NewsMapper.xml

@@ -196,100 +196,5 @@
     where id = #{id,jdbcType=BIGINT}
   </update>
   
-  <select id="findNewsListByPage" parameterType="String" resultMap="BaseResultMap">
-  	select
-  		id,
-  		create_time,
-  		title,
-  		author,
-  		type,
-  		hot,
-  		source,
-  		summary
-  	from news
-  	where 1 =1
-  	<if test="type != null">
-  		and type = #{type,jdbcType=INTEGER}
-  	</if>
-  	<if test="title != null">
-  		and title like CONCAT('%',#{title,jdbcType=VARCHAR},'%')
-  	</if>
-  	<if test="author != null">
-  		and author like CONCAT('%',#{author,jdbcType=VARCHAR},'%')
-  	</if>
-  	<if test="sDate != null">
-  	    and create_time <![CDATA[ >= ]]>  #{sDate,jdbcType=TIMESTAMP}
-  	</if>
-  	<if test="eDate != null">
-  		and create_time <![CDATA[ < ]]>  #{eDate,jdbcType=TIMESTAMP}
-  	</if>
-  	<if test="source != null">
-  		and source like CONCAT('%',#{source,jdbcType=VARCHAR},'%')
-  	</if>
-  	<if test="hot != null">
-  		and hot = #{hot,jdbcType=INTEGER}
-  	</if>
-  	order by create_time desc
-  	<if test="page_sql!=null">
-			${page_sql}
-	</if>
-  </select>
-  
-   <select id="findNewsCount" parameterType="String" resultType="java.lang.Integer">
-  	select
-  		count(1)
-  	from news
-  	where 1 =1
-  	<if test="type != null">
-  		and type = #{type,jdbcType=INTEGER}
-  	</if>
-  	<if test="title != null">
-  		and title like CONCAT('%',#{title,jdbcType=VARCHAR},'%')
-  	</if>
-  	<if test="author != null">
-  		and author like CONCAT('%',#{author,jdbcType=VARCHAR},'%')
-  	</if>
-  	<if test="sDate != null">
-  	    and create_time <![CDATA[ >= ]]>  #{sDate,jdbcType=TIMESTAMP}
-  	</if>
-  	<if test="eDate != null">
-  		and create_time <![CDATA[ < ]]>  #{eDate,jdbcType=TIMESTAMP}
-  	</if>
-  	<if test="source != null">
-  		and source like CONCAT('%',#{source,jdbcType=VARCHAR},'%')
-  	</if>
-  	<if test="hot != null">
-  		and hot = #{hot,jdbcType=INTEGER}
-  	</if>
-  </select>
-  
-  <delete id="batchDeleteByPrimaryKey" parameterType="java.util.List">
-  	delete
-  		from news
-  	where id in
-  	<foreach item="item" index="index" collection="list" open="("
-			separator="," close=")">
-			#{item}
-	</foreach>
-  </delete>
   
-  <select id="findPortalList" resultType="com.goafanti.news.bo.NewsPortalList">
-		select
-			id, 
-			create_time as createTime, 
-			title , 
-			title_img as titleImg, 
-			type, 
-			hot, 
-			summary,
-			source,
-			content
-		from news
-		where 1 =1
-		<if test="type != null and type != 0" >
-			and type = #{type,jdbcType=INTEGER}
-		</if>
-		order by create_time desc
-		limit #{pageNo,jdbcType=INTEGER}, #{pageSize,jdbcType=INTEGER}
-	</select>
 </mapper>

+ 98 - 1
src/main/java/com/goafanti/common/mapper/NewsMapperExt.xml

@@ -17,11 +17,108 @@
 		select
 		<include refid="Summary_Column_List" />
 		from news
-		where hot = 1 
+		where hot = 0 
 		<if test=" type != null">
 			and type = #{type,jdbcType=INTEGER}
 		</if>
 		order by id desc
 		limit #{pageNo,jdbcType=INTEGER}, #{pageSize,jdbcType=INTEGER}
 	</select>
+	
+	<select id="findNewsListByPage" parameterType="String" resultMap="BaseResultMap">
+  	select
+  		id,
+  		create_time,
+  		title,
+  		author,
+  		type,
+  		hot,
+  		source,
+  		summary
+  	from news
+  	where 1 =1
+  	<if test="type != null">
+  		and type = #{type,jdbcType=INTEGER}
+  	</if>
+  	<if test="title != null">
+  		and title like CONCAT('%',#{title,jdbcType=VARCHAR},'%')
+  	</if>
+  	<if test="author != null">
+  		and author like CONCAT('%',#{author,jdbcType=VARCHAR},'%')
+  	</if>
+  	<if test="sDate != null">
+  	    and create_time <![CDATA[ >= ]]>  #{sDate,jdbcType=TIMESTAMP}
+  	</if>
+  	<if test="eDate != null">
+  		and create_time <![CDATA[ < ]]>  #{eDate,jdbcType=TIMESTAMP}
+  	</if>
+  	<if test="source != null">
+  		and source like CONCAT('%',#{source,jdbcType=VARCHAR},'%')
+  	</if>
+  	<if test="hot != null">
+  		and hot = #{hot,jdbcType=INTEGER}
+  	</if>
+  	order by create_time desc
+  	<if test="page_sql!=null">
+			${page_sql}
+	</if>
+  </select>
+  
+   <select id="findNewsCount" parameterType="String" resultType="java.lang.Integer">
+  	select
+  		count(1)
+  	from news
+  	where 1 =1
+  	<if test="type != null">
+  		and type = #{type,jdbcType=INTEGER}
+  	</if>
+  	<if test="title != null">
+  		and title like CONCAT('%',#{title,jdbcType=VARCHAR},'%')
+  	</if>
+  	<if test="author != null">
+  		and author like CONCAT('%',#{author,jdbcType=VARCHAR},'%')
+  	</if>
+  	<if test="sDate != null">
+  	    and create_time <![CDATA[ >= ]]>  #{sDate,jdbcType=TIMESTAMP}
+  	</if>
+  	<if test="eDate != null">
+  		and create_time <![CDATA[ < ]]>  #{eDate,jdbcType=TIMESTAMP}
+  	</if>
+  	<if test="source != null">
+  		and source like CONCAT('%',#{source,jdbcType=VARCHAR},'%')
+  	</if>
+  	<if test="hot != null">
+  		and hot = #{hot,jdbcType=INTEGER}
+  	</if>
+  </select>
+  
+  <delete id="batchDeleteByPrimaryKey" parameterType="java.util.List">
+  	delete
+  		from news
+  	where id in
+  	<foreach item="item" index="index" collection="list" open="("
+			separator="," close=")">
+			#{item}
+	</foreach>
+  </delete>
+  
+  <select id="findPortalList" resultType="com.goafanti.news.bo.NewsPortalList">
+		select
+			id, 
+			create_time as createTime, 
+			title , 
+			title_img as titleImg, 
+			type, 
+			hot, 
+			summary,
+			source,
+			content
+		from news
+		where 1 =1
+		<if test="type != null and type != 0" >
+			and type = #{type,jdbcType=INTEGER}
+		</if>
+		order by create_time desc
+		limit #{pageNo,jdbcType=INTEGER}, #{pageSize,jdbcType=INTEGER}
+	</select>
 </mapper>

+ 39 - 0
src/main/java/com/goafanti/common/model/Activity.java

@@ -66,6 +66,21 @@ public class Activity {
     private String result;
 
     /**
+    * 创建时间(报名开始时间)
+    */
+    private Date createTime;
+
+    /**
+    * 报名截止时间
+    */
+    private Date enrollDeadline;
+
+    /**
+    * 题图地址
+    */
+    private String titleUrl;
+
+    /**
     * 描述
     */
     private String desc;
@@ -174,6 +189,30 @@ public class Activity {
         this.result = result;
     }
 
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getEnrollDeadline() {
+        return enrollDeadline;
+    }
+
+    public void setEnrollDeadline(Date enrollDeadline) {
+        this.enrollDeadline = enrollDeadline;
+    }
+
+    public String getTitleUrl() {
+        return titleUrl;
+    }
+
+    public void setTitleUrl(String titleUrl) {
+        this.titleUrl = titleUrl;
+    }
+
     public String getDesc() {
         return desc;
     }

+ 15 - 3
src/main/java/com/goafanti/news/controller/NewsController.java

@@ -1,5 +1,7 @@
 package com.goafanti.news.controller;
 
+import java.util.List;
+
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 
@@ -10,18 +12,21 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
 import com.goafanti.banners.enums.BannersType;
+import com.goafanti.banners.service.BannersService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
-import com.goafanti.common.controller.WebpageController;
+import com.goafanti.common.controller.BaseController;
+import com.goafanti.common.model.Banners;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.news.enums.NewsType;
 import com.goafanti.news.service.NewsService;
 
 @Controller
-public class NewsController extends WebpageController {
+public class NewsController extends BaseController {
 	@Resource
 	NewsService newsService;
-
+	@Resource
+	private BannersService		bannersService;
 	/**
 	 * 策源地
 	 * 
@@ -105,5 +110,12 @@ public class NewsController extends WebpageController {
 		res.setData(newsService.findNewsDetail(id));
 		return res;
 	}
+	
+	private void handleBanners(ModelAndView modelview, BannersType bannersType) {
+		List<Banners> banners = bannersService.findPortalBanners(bannersType.getKey());
+		if (!banners.isEmpty()) {
+			modelview.addObject("banners", banners);
+		}
+	}
 
 }

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

@@ -12,9 +12,11 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
 import com.goafanti.banners.enums.BannersType;
+import com.goafanti.banners.service.BannersService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.controller.WebpageController;
+import com.goafanti.common.controller.BaseController;
+import com.goafanti.common.model.Banners;
 import com.goafanti.common.model.User;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.engagedFieldGlossory.service.EngagedFieldGlossoryService;
@@ -28,7 +30,7 @@ import com.goafanti.user.service.UserInterestService;
  * 大咖说
  */
 @Controller
-public class PortalBigShotController extends WebpageController {
+public class PortalBigShotController extends BaseController {
 	@Resource
 	private StarService					starService;
 	@Resource
@@ -37,6 +39,8 @@ public class PortalBigShotController extends WebpageController {
 	private LectureService				lectureService;
 	@Resource
 	private EngagedFieldGlossoryService	engagedFieldGlossoryService;
+	@Resource
+	private BannersService				bannersService;
 
 	@RequestMapping(value = "/portal/scienceTechnology/bigShot", method = RequestMethod.GET)
 	public ModelAndView bigShot() {
@@ -86,4 +90,11 @@ public class PortalBigShotController extends WebpageController {
 		return res;
 	}
 
+	private void handleBanners(ModelAndView modelview, BannersType bannersType) {
+		List<Banners> banners = bannersService.findPortalBanners(bannersType.getKey());
+		if (!banners.isEmpty()) {
+			modelview.addObject("banners", banners);
+		}
+	}
+
 }

+ 14 - 3
src/main/java/com/goafanti/portal/controller/PortalLectureController.java

@@ -13,9 +13,11 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
 import com.goafanti.banners.enums.BannersType;
+import com.goafanti.banners.service.BannersService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.controller.WebpageController;
+import com.goafanti.common.controller.BaseController;
+import com.goafanti.common.model.Banners;
 import com.goafanti.lecture.bo.LectureListBo;
 import com.goafanti.lecture.service.LectureService;
 
@@ -23,10 +25,12 @@ import com.goafanti.lecture.service.LectureService;
  * 科技讲堂
  */
 @Controller
-public class PortalLectureController extends WebpageController {
+public class PortalLectureController extends BaseController {
 	@Resource
 	private LectureService lectureService;
-
+	@Resource
+	private BannersService		bannersService;
+	
 	@RequestMapping(value = "/portal/scienceTechnology/lecture", method = RequestMethod.GET)
 	public ModelAndView lecture() {
 		ModelAndView mv = new ModelAndView();
@@ -58,5 +62,12 @@ public class PortalLectureController extends WebpageController {
 		res.setData(lectureService.loadMore(pSize, pNo));
 		return res;
 	}
+	
+	private void handleBanners(ModelAndView modelview, BannersType bannersType) {
+		List<Banners> banners = bannersService.findPortalBanners(bannersType.getKey());
+		if (!banners.isEmpty()) {
+			modelview.addObject("banners", banners);
+		}
+	}
 
 }

+ 13 - 2
src/main/java/com/goafanti/portal/controller/PortalStarController.java

@@ -12,9 +12,11 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
 import com.goafanti.banners.enums.BannersType;
+import com.goafanti.banners.service.BannersService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.controller.WebpageController;
+import com.goafanti.common.controller.BaseController;
+import com.goafanti.common.model.Banners;
 import com.goafanti.common.model.User;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.engagedFieldGlossory.service.EngagedFieldGlossoryService;
@@ -28,7 +30,7 @@ import com.goafanti.user.service.UserInterestService;
  * 科技明星
  */
 @Controller
-public class PortalStarController extends WebpageController {
+public class PortalStarController extends BaseController {
 	@Resource
 	private StarService					starService;
 	@Resource
@@ -37,6 +39,8 @@ public class PortalStarController extends WebpageController {
 	private UserInterestService			userInterestService;
 	@Resource
 	private EngagedFieldGlossoryService	engagedFieldGlossoryService;
+	@Resource
+	private BannersService				bannersService;
 
 	@RequestMapping(value = "/portal/scienceTechnology/star", method = RequestMethod.GET)
 	public ModelAndView star() {
@@ -84,4 +88,11 @@ public class PortalStarController extends WebpageController {
 		}
 		return res;
 	}
+
+	private void handleBanners(ModelAndView modelview, BannersType bannersType) {
+		List<Banners> banners = bannersService.findPortalBanners(bannersType.getKey());
+		if (!banners.isEmpty()) {
+			modelview.addObject("banners", banners);
+		}
+	}
 }

+ 1 - 18
src/main/webapp/WEB-INF/views/portal/news/newsDetail.html

@@ -1,20 +1,3 @@
-<<<<<<< HEAD
-<!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml"
-	xmlns:th="http://www.thymeleaf.org">
-<head th:replace="common::header(~{::title},~{::link})">
-	<title>新闻详情</title>
-	<link th:href="${staticHost+'/portal/news/newsDetail.css'}" rel="stylesheet">
-</head>
-<body>
-	<div id="root"></div>
-	
-	<div th:replace="common::footer(~{::script})">
-		<script type="text/javascript" th:src="${staticHost+'/vendors.js'}"></script>
-		<script type="text/javascript" th:src="${staticHost+'/portal/news/newsDetail.css'}"></script>
-	</div>
-</body>
-=======
 <!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
 
@@ -94,5 +77,5 @@
 	</div>
 </body>
 
->>>>>>> branch 'master' of https://git.coding.net/aft/AFT.git
+
 </html>