Antiloveg лет назад: 8
Родитель
Сommit
e22b2c3953

+ 1 - 1
schema/201707011-star.sql

@@ -5,5 +5,5 @@ CREATE TABLE `star` (
   `star` INT(1) NOT NULL DEFAULT 0 COMMENT '是否在科技明星页显示(0--不显示,1--显示)',
   `portal_url` VARCHAR(255) NULL COMMENT '个人主页URL',
   PRIMARY KEY (`id`))
-ENGINE = InnoDB
+ENGINE = InnoDB DEFAULT CHARSET=utf8mb4
 COMMENT = '科技明星';

+ 12 - 0
schema/201707012-lecture.sql

@@ -0,0 +1,12 @@
+CREATE TABLE `lecture` (
+  `id` VARCHAR(36) NOT NULL,
+  `uid` VARCHAR(36) NOT NULL COMMENT '开展讲座人ID',
+  `lecture_time` TIMESTAMP NOT NULL COMMENT '讲座开展时间',
+  `create_time` TIMESTAMP NULL COMMENT '记录创建时间',
+  `last_update_time` TIMESTAMP NULL COMMENT '记录最后更新时间',
+  `name` VARCHAR(45) NOT NULL COMMENT '名称',
+  `summary` VARCHAR(128) NULL COMMENT '简介',
+  `deleted_sign` INT(1) NOT NULL DEFAULT 0 COMMENT '删除标记',
+  PRIMARY KEY (`id`))
+ENGINE = InnoDB DEFAULT CHARSET=utf8mb4
+COMMENT = '科技讲堂';

+ 126 - 0
src/main/java/com/goafanti/admin/controller/AdminLectureApiController.java

@@ -1,9 +1,135 @@
 package com.goafanti.admin.controller;
 
+import java.util.Arrays;
+
+import javax.annotation.Resource;
+import javax.validation.Valid;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+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.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.BaseApiController;
+import com.goafanti.common.enums.PatentInfoFields;
+import com.goafanti.common.model.Lecture;
+import com.goafanti.lecture.bo.InputLecture;
+import com.goafanti.lecture.service.LectureService;
+
 /**
  * 科技讲堂
  */
+@RestController
+@RequestMapping(value = "/api/admin/lecture")
 public class AdminLectureApiController extends BaseApiController {
+	@Resource
+	private LectureService lectureService;
+
+	/**
+	 * 新增
+	 */
+	@RequestMapping(value = "/add", method = RequestMethod.POST)
+	public Result add(@Valid InputLecture il, BindingResult bindingResult, String lectureTimeFormattedDate) {
+		Result res = new Result();
+		if (bindingResult.hasErrors()) {
+			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+					PatentInfoFields.getFieldDesc(bindingResult.getFieldError().getField())));
+			return res;
+		}
+
+		if (StringUtils.isBlank(il.getUid())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "讲堂开展人ID"));
+			return res;
+		}
+
+		if (StringUtils.isBlank(il.getName())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "讲堂名称"));
+			return res;
+		}
+
+		if (StringUtils.isBlank(lectureTimeFormattedDate)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "讲堂开展时间"));
+			return res;
+		}
+		Lecture l = new Lecture();
+		BeanUtils.copyProperties(il, l);
+		lectureService.save(l, lectureTimeFormattedDate);
+		return res;
+	}
+
+	/**
+	 * 修改
+	 */
+	@RequestMapping(value = "/update", method = RequestMethod.POST)
+	public Result update(@Valid InputLecture il, BindingResult bindingResult, String lectureTimeFormattedDate) {
+		Result res = new Result();
+		if (bindingResult.hasErrors()) {
+			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+					PatentInfoFields.getFieldDesc(bindingResult.getFieldError().getField())));
+			return res;
+		}
+
+		if (StringUtils.isBlank(il.getId())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "记录ID"));
+			return res;
+		}
+
+		if (StringUtils.isBlank(il.getUid())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "讲堂开展人ID"));
+			return res;
+		}
+
+		if (StringUtils.isBlank(il.getName())) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "讲堂名称"));
+			return res;
+		}
+
+		if (StringUtils.isBlank(lectureTimeFormattedDate)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "讲堂开展时间"));
+			return res;
+		}
+		Lecture l = new Lecture();
+		BeanUtils.copyProperties(il, l);
+		lectureService.update(l, lectureTimeFormattedDate);
+		return res;
+	}
+
+	/**
+	 * 批量删除
+	 */
+	@RequestMapping(value = "/delete", method = RequestMethod.POST)
+	public Result delete(@RequestParam(name = "ids[]", required = false) String[] ids) {
+		Result res = new Result();
+		if (ids == null || ids.length < 1) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
+		} else {
+			res.setData(lectureService.batchDeleteByPrimaryKey(Arrays.asList(ids)));
+		}
+		return res;
+	}
+
+	/**
+	 * 科技讲堂列表
+	 */
+	@RequestMapping(value = "/list", method = RequestMethod.GET)
+	public Result lectureList(String uid, String username, String name, String startLectureTime, String endLectureTime,
+			String pageNo, String pageSize) {
+		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(lectureService.listLecture(uid, username, name, startLectureTime, endLectureTime, pNo, pSize));
+		return res;
+	}
 }

+ 9 - 5
src/main/java/com/goafanti/admin/controller/AdminStarApiController.java

@@ -1,5 +1,7 @@
 package com.goafanti.admin.controller;
 
+import java.util.List;
+
 import javax.annotation.Resource;
 
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -7,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import com.alibaba.fastjson.JSON;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.BaseApiController;
@@ -75,10 +78,11 @@ public class AdminStarApiController extends BaseApiController {
 	 * 保存展示科技明星
 	 */
 	@RequestMapping(value = "/save", method = RequestMethod.POST)
-	public Result save(@RequestParam(name = "star[]", required = false) Star[] star,
+	public Result save(@RequestParam(name = "data", required = false) String d,
 			@RequestParam(name = "hot[]", required = false) String[] hot) {
 		Result res = new Result();
-		if (null == star || star.length < 1) {
+		List<Star> data = JSON.parseArray(d, Star.class);
+		if (null == data || data.size() < 1) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "科技明星列表"));
 			return res;
 		}
@@ -88,7 +92,7 @@ public class AdminStarApiController extends BaseApiController {
 			return res;
 		}
 
-		if (star.length > STAR_MAX_NUM) {
+		if (data.size() > STAR_MAX_NUM) {
 			res.getError().add(buildError("", "科技明星数量过多!"));
 			return res;
 		}
@@ -98,7 +102,7 @@ public class AdminStarApiController extends BaseApiController {
 			return res;
 		}
 
-		for (Star s : star) {
+		for (Star s : data) {
 			if (StringUtils.isBlank(s.getUid())) {
 				res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "科技明星ID"));
 				return res;
@@ -113,7 +117,7 @@ public class AdminStarApiController extends BaseApiController {
 				return res;
 			}
 		}
-		starService.save(star, hot);
+		starService.save(data, hot);
 		return res;
 	}
 }

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

@@ -0,0 +1,21 @@
+package com.goafanti.common.dao;
+
+import java.util.List;
+
+import com.goafanti.common.model.Lecture;
+
+public interface LectureMapper {
+    int deleteByPrimaryKey(String id);
+
+    int insert(Lecture record);
+
+    int insertSelective(Lecture record);
+
+    Lecture selectByPrimaryKey(String id);
+
+    int updateByPrimaryKeySelective(Lecture record);
+
+    int updateByPrimaryKey(Lecture record);
+
+	int batchDeleteByPrimaryKey(List<String> id);
+}

+ 194 - 0
src/main/java/com/goafanti/common/mapper/LectureMapper.xml

@@ -0,0 +1,194 @@
+<?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.LectureMapper" >
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.Lecture" >
+    <id column="id" property="id" jdbcType="VARCHAR" />
+    <result column="uid" property="uid" jdbcType="VARCHAR" />
+    <result column="lecture_time" property="lectureTime" jdbcType="TIMESTAMP" />
+    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
+    <result column="last_update_time" property="lastUpdateTime" jdbcType="TIMESTAMP" />
+    <result column="name" property="name" jdbcType="VARCHAR" />
+    <result column="summary" property="summary" jdbcType="VARCHAR" />
+    <result column="deleted_sign" property="deletedSign" jdbcType="INTEGER" />
+  </resultMap>
+  <sql id="Base_Column_List" >
+    id, uid, lecture_time, create_time, last_update_time, name, summary, deleted_sign
+  </sql>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
+    select 
+    <include refid="Base_Column_List" />
+    from lecture
+    where id = #{id,jdbcType=VARCHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
+    delete from lecture
+    where id = #{id,jdbcType=VARCHAR}
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.Lecture" >
+    insert into lecture (id, uid, lecture_time, 
+      create_time, last_update_time, name, 
+      summary, deleted_sign)
+    values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{lectureTime,jdbcType=TIMESTAMP}, 
+      #{createTime,jdbcType=TIMESTAMP}, #{lastUpdateTime,jdbcType=TIMESTAMP}, #{name,jdbcType=VARCHAR}, 
+      #{summary,jdbcType=VARCHAR}, #{deletedSign,jdbcType=INTEGER})
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.Lecture" >
+    insert into lecture
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        id,
+      </if>
+      <if test="uid != null" >
+        uid,
+      </if>
+      <if test="lectureTime != null" >
+        lecture_time,
+      </if>
+      <if test="createTime != null" >
+        create_time,
+      </if>
+      <if test="lastUpdateTime != null" >
+        last_update_time,
+      </if>
+      <if test="name != null" >
+        name,
+      </if>
+      <if test="summary != null" >
+        summary,
+      </if>
+      <if test="deletedSign != null" >
+        deleted_sign,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        #{id,jdbcType=VARCHAR},
+      </if>
+      <if test="uid != null" >
+        #{uid,jdbcType=VARCHAR},
+      </if>
+      <if test="lectureTime != null" >
+        #{lectureTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="createTime != null" >
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="lastUpdateTime != null" >
+        #{lastUpdateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="name != null" >
+        #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="summary != null" >
+        #{summary,jdbcType=VARCHAR},
+      </if>
+      <if test="deletedSign != null" >
+        #{deletedSign,jdbcType=INTEGER},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Lecture" >
+    update lecture
+    <set >
+      <if test="uid != null" >
+        uid = #{uid,jdbcType=VARCHAR},
+      </if>
+      <if test="lectureTime != null" >
+        lecture_time = #{lectureTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="createTime != null" >
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="lastUpdateTime != null" >
+        last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="name != null" >
+        name = #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="summary != null" >
+        summary = #{summary,jdbcType=VARCHAR},
+      </if>
+      <if test="deletedSign != null" >
+        deleted_sign = #{deletedSign,jdbcType=INTEGER},
+      </if>
+    </set>
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Lecture" >
+    update lecture
+    set uid = #{uid,jdbcType=VARCHAR},
+      lecture_time = #{lectureTime,jdbcType=TIMESTAMP},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP},
+      name = #{name,jdbcType=VARCHAR},
+      summary = #{summary,jdbcType=VARCHAR},
+      deleted_sign = #{deletedSign,jdbcType=INTEGER}
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  
+  <update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
+		update lecture set deleted_sign = 1
+		where id in
+		<foreach item="item" index="index" collection="list" open="("
+			separator="," close=")">
+			#{item}
+		</foreach>
+  </update>
+  
+  <select id="findLectureListByPage" parameterType="String" resultType="com.goafanti.lecture.bo.LectureListBo">
+	  	select 
+	  		l.id,
+	  		l.uid,
+	  		l.name,
+	  		l.lecture_time as lectureTime,
+	  		l.summary,
+	  		ui.username 
+	  	from lecture l
+	  	left join  user_identity ui on ui.uid = l.uid
+	  	where 
+	  	l.deleted_sign = 0 
+	  	<if test="uid != null">
+	  	 and l.uid = #{uid,jdbcType=VARCHAR}
+	  	</if>
+	  	<if test="name != null">
+	  	 and l.name like CONCAT('%', #{name,jdbcType=VARCHAR}, '%')
+	  	</if>
+	  	<if test="username != null">
+	  	 and ui.username like CONCAT('%',  #{username,jdbcType=VARCHAR}, '%')
+	  	</if>
+	  	<if test="startL != null">
+	  	 and l.lecture_time <![CDATA[ >= ]]> #{startL,jdbcType=TIMESTAPM}
+	  	</if>
+	  	<if test="endL != null">
+	  	 and l.lecture_time <![CDATA[ < ]]> #{endL,jdbcType=TIMESTAPM}
+	  	</if>
+	  	order by l.lecture_time desc
+	  	<if test="page_sql!=null">
+			${page_sql}
+		</if>
+  </select>
+  
+  <select id="findLectureCount" 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 
+	  	<if test="uid != null">
+	  	 and l.uid = #{uid,jdbcType=VARCHAR}
+	  	</if>
+	  	<if test="name != null">
+	  	 and l.name like CONCAT('%', #{name,jdbcType=VARCHAR}, '%')
+	  	</if>
+	  	<if test="username != null">
+	  	 and ui.username like CONCAT('%',  #{username,jdbcType=VARCHAR}, '%')
+	  	</if>
+	  	<if test="startL != null">
+	  	 and l.lecture_time <![CDATA[ >= ]]> #{startL,jdbcType=TIMESTAMP}
+	  	</if>
+	  	<if test="endL != null">
+	  	 and l.lecture_time <![CDATA[ < ]]> #{endL,jdbcType=TIMESTAMP}
+	  	</if>
+  </select>
+</mapper>

+ 126 - 0
src/main/java/com/goafanti/common/model/Lecture.java

@@ -0,0 +1,126 @@
+package com.goafanti.common.model;
+
+import java.util.Date;
+
+import org.apache.commons.lang3.time.DateFormatUtils;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.goafanti.common.constant.AFTConstants;
+
+public class Lecture {
+	private String	id;
+
+	/**
+	 * 开展讲座人ID
+	 */
+	private String	uid;
+
+	/**
+	 * 讲座开展时间
+	 */
+	private Date	lectureTime;
+
+	/**
+	 * 记录创建时间
+	 */
+	private Date	createTime;
+
+	/**
+	 * 记录最后更新时间
+	 */
+	private Date	lastUpdateTime;
+
+	/**
+	 * 名称
+	 */
+	private String	name;
+
+	/**
+	 * 简介
+	 */
+	private String	summary;
+
+	/**
+	 * 删除标记
+	 */
+	private Integer	deletedSign;
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public String getUid() {
+		return uid;
+	}
+
+	public void setUid(String uid) {
+		this.uid = uid;
+	}
+
+	public Date getLectureTime() {
+		return lectureTime;
+	}
+
+	public void setLectureTime(Date lectureTime) {
+		this.lectureTime = lectureTime;
+	}
+
+	@JsonIgnore
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	@JsonIgnore
+	public Date getLastUpdateTime() {
+		return lastUpdateTime;
+	}
+
+	public void setLastUpdateTime(Date lastUpdateTime) {
+		this.lastUpdateTime = lastUpdateTime;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getSummary() {
+		return summary;
+	}
+
+	public void setSummary(String summary) {
+		this.summary = summary;
+	}
+
+	@JsonIgnore
+	public Integer getDeletedSign() {
+		return deletedSign;
+	}
+
+	public void setDeletedSign(Integer deletedSign) {
+		this.deletedSign = deletedSign;
+	}
+
+	public String getLectureTimeFormattedDate() {
+		if (this.lectureTime == null) {
+			return null;
+		} else {
+			return DateFormatUtils.format(this.lectureTime, AFTConstants.YYYYMMDDHHMMSS);
+		}
+	}
+
+	public void setLectureTimeFormattedDate(String lectureTimeFormattedDate) {
+
+	}
+}

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

@@ -0,0 +1,50 @@
+package com.goafanti.lecture.bo;
+
+import javax.validation.constraints.Size;
+
+import com.goafanti.common.constant.ErrorConstants;
+
+public class InputLecture {
+	@Size(min = 0, max = 36, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String	id;
+	@Size(min = 0, max = 36, message = "{" + ErrorConstants.PARAM_SIZE_ERROR + "}")
+	private String	uid;
+
+	@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	describe;
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	public String getUid() {
+		return uid;
+	}
+
+	public void setUid(String uid) {
+		this.uid = uid;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getDescribe() {
+		return describe;
+	}
+
+	public void setDescribe(String describe) {
+		this.describe = describe;
+	}
+
+}

+ 16 - 0
src/main/java/com/goafanti/lecture/bo/LectureListBo.java

@@ -0,0 +1,16 @@
+package com.goafanti.lecture.bo;
+
+import com.goafanti.common.model.Lecture;
+
+public class LectureListBo extends Lecture {
+	private String username;
+
+	public String getUsername() {
+		return username;
+	}
+
+	public void setUsername(String username) {
+		this.username = username;
+	}
+
+}

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

@@ -0,0 +1,20 @@
+package com.goafanti.lecture.service;
+
+import java.util.List;
+
+import com.goafanti.common.model.Lecture;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.lecture.bo.LectureListBo;
+
+public interface LectureService {
+
+	void save(Lecture l, String lectureTimeFormattedDate);
+
+	void update(Lecture l, String lectureTimeFormattedDate);
+
+	int batchDeleteByPrimaryKey(List<String> asList);
+
+	Pagination<LectureListBo> listLecture(String uid, String username, String name, String startLectureTime, String endLectureTime,
+			Integer pNo, Integer pSize);
+
+}

+ 98 - 0
src/main/java/com/goafanti/lecture/service/impl/LectureServiceImpl.java

@@ -0,0 +1,98 @@
+package com.goafanti.lecture.service.impl;
+
+import java.text.ParseException;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.LectureMapper;
+import com.goafanti.common.enums.DeleteStatus;
+import com.goafanti.common.model.Lecture;
+import com.goafanti.common.utils.DateUtils;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.lecture.bo.LectureListBo;
+import com.goafanti.lecture.service.LectureService;
+
+@Service
+public class LectureServiceImpl extends BaseMybatisDao<LectureMapper> implements LectureService {
+	@Autowired
+	private LectureMapper lectureMapper;
+
+	@Override
+	public void save(Lecture l, String lectureTimeFormattedDate) {
+		l.setId(UUID.randomUUID().toString());
+		try {
+			l.setLectureTime(DateUtils.parseDate(lectureTimeFormattedDate, AFTConstants.YYYYMMDDHHMMSS));
+		} catch (ParseException e) {
+		}
+		Calendar now = Calendar.getInstance();
+		now.set(Calendar.MILLISECOND, 0);
+		l.setCreateTime(now.getTime());
+		l.setLastUpdateTime(l.getCreateTime());
+		l.setDeletedSign(DeleteStatus.UNDELETE.getCode());
+		lectureMapper.insert(l);
+	}
+
+	@Override
+	public void update(Lecture l, String lectureTimeFormattedDate) {
+		try {
+			l.setLectureTime(DateUtils.parseDate(lectureTimeFormattedDate, AFTConstants.YYYYMMDDHHMMSS));
+		} catch (ParseException e) {
+		}
+		Calendar now = Calendar.getInstance();
+		now.set(Calendar.MILLISECOND, 0);
+		l.setLastUpdateTime(now.getTime());
+		lectureMapper.updateByPrimaryKeySelective(l);
+	}
+
+	@Override
+	public int batchDeleteByPrimaryKey(List<String> id) {
+		return lectureMapper.batchDeleteByPrimaryKey(id);
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<LectureListBo> listLecture(String uid, String username, String name, String startLectureTime,
+			String endLectureTime, Integer pageNo, Integer pageSize) {
+		Map<String, Object> params = new HashMap<>();
+
+		if (StringUtils.isNotBlank(uid)) {
+			params.put("uid", uid);
+		}
+
+		if (StringUtils.isNotBlank(username)) {
+			params.put("username", username);
+		}
+
+		if (StringUtils.isNotBlank(name)) {
+			params.put("name", name);
+		}
+
+		try {
+			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));
+		} catch (ParseException e) {
+		}
+
+		if (pageNo == null || pageNo < 0) {
+			pageNo = 1;
+		}
+
+		if (pageSize == null || pageSize < 0 || pageSize > 10) {
+			pageSize = 10;
+		}
+		return (Pagination<LectureListBo>) findPage("findLectureListByPage", "findLectureCount", params, pageNo,
+				pageSize);
+	}
+
+}

+ 1 - 1
src/main/java/com/goafanti/star/service/StarService.java

@@ -12,6 +12,6 @@ public interface StarService {
 
 	List<HotStarListBo> listStarList();
 
-	void save(Star[] star, String[] hot);
+	void save(List<Star> star, String[] hot);
 
 }

+ 1 - 2
src/main/java/com/goafanti/star/service/impl/StarServiceImpl.java

@@ -25,9 +25,8 @@ public class StarServiceImpl implements StarService {
 		return starMapper.listStarList();
 	}
 	@Override
-	public void save(Star[] star, String[] hot) {
+	public void save(List<Star> startList, String[] hot) {
 		starMapper.deleteAll();
-		List<Star> startList = Arrays.asList(star);
 		List<String> hotList = Arrays.asList(hot);
 		for (Star s : startList){
 			s.setId(UUID.randomUUID().toString());