Przeglądaj źródła

专家及明星列表

Antiloveg 8 lat temu
rodzic
commit
f7c9c83a5f

+ 10 - 6
schema/201707012-lecture.sql

@@ -1,12 +1,16 @@
 CREATE TABLE `lecture` (
-  `id` VARCHAR(36) NOT NULL,
-  `uid` VARCHAR(36) NOT NULL COMMENT '开展讲座人ID',
-  `lecture_time` TIMESTAMP NOT NULL COMMENT '讲座开展时间',
+  `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 '讲座开展时间',
   `create_time` TIMESTAMP NULL COMMENT '记录创建时间',
   `last_update_time` TIMESTAMP NULL COMMENT '记录最后更新时间',
-  `name` VARCHAR(45) NOT NULL COMMENT '名称',
-  `summary` VARCHAR(128) NULL COMMENT '简介',
+  `name` VARCHAR(45) CHARACTER SET 'utf8mb4' NOT NULL COMMENT '名称',
+  `summary` VARCHAR(128) CHARACTER SET 'utf8mb4' NULL COMMENT '简介',
   `deleted_sign` INT(1) NOT NULL DEFAULT 0 COMMENT '删除标记',
+  `lecture_url` VARCHAR(255) NULL COMMENT '展示图',
+  `hot` INT(1) NOT NULL DEFAULT 0 COMMENT '是否在大咖说页面展示(0--不展示,1--展示)',
+  `dynamic` INT(1) NOT NULL DEFAULT 0 COMMENT '是否在科技明星页面展示活动动态(0--不展示,1--展示)',
   PRIMARY KEY (`id`))
 ENGINE = InnoDB DEFAULT CHARSET=utf8mb4
-COMMENT = '科技讲堂';
+COMMENT = '科技讲堂';
+

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

@@ -22,6 +22,7 @@ import com.goafanti.common.enums.PatentInfoFields;
 import com.goafanti.common.model.Lecture;
 import com.goafanti.lecture.bo.InputLecture;
 import com.goafanti.lecture.service.LectureService;
+import com.goafanti.user.service.UserService;
 
 /**
  * 科技讲堂
@@ -31,6 +32,28 @@ import com.goafanti.lecture.service.LectureService;
 public class AdminLectureApiController extends BaseApiController {
 	@Resource
 	private LectureService lectureService;
+	@Resource
+	private UserService userService;
+	
+	/**
+	 * 专家及明星列表
+	 */
+	@RequestMapping(value= "/starAndExpertList", method = RequestMethod.GET)
+	public Result starAndExpertList(Integer number, String engagedField, String username, String professionalTitle,
+			String workUnit, 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(userService.listStarAndExpert(number, engagedField, username, professionalTitle, workUnit, pNo, pSize));
+		return res;
+	}
 
 	/**
 	 * 新增

+ 31 - 7
src/main/java/com/goafanti/common/mapper/LectureMapper.xml

@@ -11,9 +11,12 @@
     <result column="summary" property="summary" jdbcType="VARCHAR" />
     <result column="deleted_sign" property="deletedSign" jdbcType="INTEGER" />
     <result column="lecture_url" property="lectureUrl" jdbcType="VARCHAR" />
+    <result column="hot" property="hot" jdbcType="INTEGER" />
+    <result column="dynamic" property="dynamic" jdbcType="INTEGER" />
   </resultMap>
   <sql id="Base_Column_List" >
-    id, uid, lecture_time, create_time, last_update_time, name, summary, deleted_sign, lecture_url
+    id, uid, lecture_time, create_time, last_update_time, name, summary, deleted_sign, lecture_url,
+    hot, dynamic
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
     select 
@@ -28,10 +31,11 @@
   <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, lecture_url)
+      summary, deleted_sign, lecture_url, hot, dynamic)
     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}, #{lectureUrl,jdbcType=VARCHAR})
+      #{summary,jdbcType=VARCHAR}, #{deletedSign,jdbcType=INTEGER}, #{lectureUrl,jdbcType=VARCHAR},
+      #{hot,jdbcType=INTEGER}, #{dynamic,jdbcType=INTEGER})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.Lecture" >
     insert into lecture
@@ -60,9 +64,15 @@
       <if test="deletedSign != null" >
         deleted_sign,
       </if>
-       <if test="lectureUrl != null" >
+      <if test="lectureUrl != null" >
         lecture_url,
       </if>
+      <if test="hot != null" >
+        hot,
+      </if>
+      <if test="dynamic != null" >
+        dynamic,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides="," >
       <if test="id != null" >
@@ -89,9 +99,15 @@
       <if test="deletedSign != null" >
         #{deletedSign,jdbcType=INTEGER},
       </if>
-       <if test="lectureUrl != null" >
+      <if test="lectureUrl != null" >
         #{lectureUrl,jdbcType=VARCHAR},
       </if>
+      <if test="hot != null" >
+        #{hot,jdbcType=INTEGER},
+      </if>
+      <if test="dynamic != null" >
+        #{dynamic,jdbcType=INTEGER},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Lecture" >
@@ -118,9 +134,15 @@
       <if test="deletedSign != null" >
         deleted_sign = #{deletedSign,jdbcType=INTEGER},
       </if>
-       <if test="lectureUrl != null" >
+      <if test="lectureUrl != null" >
         lecture_url = #{lectureUrl,jdbcType=VARCHAR},
       </if>
+      <if test="hot != null" >
+        hot = #{hot,jdbcType=INTEGER},
+      </if>
+      <if test="dynamic != null" >
+        dynamic = #{dynamic,jdbcType=INTEGER},
+      </if>
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
@@ -133,7 +155,9 @@
       name = #{name,jdbcType=VARCHAR},
       summary = #{summary,jdbcType=VARCHAR},
       deleted_sign = #{deletedSign,jdbcType=INTEGER},
-      lecture_url = #{lectureUrl,jdbcType=VARCHAR}
+      lecture_url = #{lectureUrl,jdbcType=VARCHAR},
+      hot = #{hot,jdbcType=INTEGER},
+      dynamic = #{dynamic,jdbcType=INTEGER}
     where id = #{id,jdbcType=VARCHAR}
   </update>
   

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

@@ -860,4 +860,66 @@
   		and uc.work_unit like CONCAT('%',#{workUnit,jdbcType=VARCHAR},'%')
   	</if>
   </select>
+  
+  <select id="findStarAndExpertListByPage" parameterType="String" resultType="com.goafanti.user.bo.StarAndExpertListBo">
+  	select 
+  		u.id as uid,
+  		u.number,
+  		ui.username,
+  		uc.engaged_field as engagedField,
+  		uc.professional_title as professionalTitle,
+  		uc.work_unit as workUnit,
+  		adc.achievement_count as achievementNum
+  	from user u
+  	left join user_identity ui on ui.uid = u.id
+  	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
+  	<if test="number != null">
+  		and u.number = #{number,jdbcType=INTEGER}
+  	</if>
+  	<if test="engagedField != null">
+  		and uc.engaged_field like CONCAT(#{engagedField,jdbcType=VARCHAR},'%')
+  	</if>
+  	<if test="username != null">
+  		and ui.username like CONCAT('%',#{username,jdbcType=VARCHAR},'%')
+  	</if>
+  	<if test="professionalTitle != null">
+  		and uc.professional_title like CONCAT('%',#{professionalTitle,jdbcType=VARCHAR},'%')
+  	</if>
+  	<if test="workUnit != null">
+  		and uc.work_unit like CONCAT('%',#{workUnit,jdbcType=VARCHAR},'%')
+  	</if>
+  	ORDER BY adc.achievement_count DESC
+	<if test="page_sql!=null">
+		${page_sql}
+	</if>
+  	
+  </select>
+  
+  <select id="findStarAndExpertCount" parameterType="String" resultType="java.lang.Integer">
+  	select 
+  		count(1)
+  	from user u
+  	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
+  	<if test="number != null">
+  		and u.number = #{number,jdbcType=INTEGER}
+  	</if>
+  	<if test="engagedField != null">
+  		and uc.engaged_field like CONCAT(#{engagedField,jdbcType=VARCHAR},'%')
+  	</if>
+  	<if test="username != null">
+  		and ui.username like CONCAT('%',#{username,jdbcType=VARCHAR},'%')
+  	</if>
+  	<if test="professionalTitle != null">
+  		and uc.professional_title like CONCAT('%',#{professionalTitle,jdbcType=VARCHAR},'%')
+  	</if>
+  	<if test="workUnit != null">
+  		and uc.work_unit like CONCAT('%',#{workUnit,jdbcType=VARCHAR},'%')
+  	</if>
+  </select>
 </mapper>

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

@@ -49,6 +49,16 @@ public class Lecture {
 	 * 展示图URL
 	 */
 	private String	lectureUrl;
+	
+	/**
+	 * 是否在大咖页面展示
+	 */
+	private Integer	hot;
+	
+	/**
+	 * 是否在科技明星动态展示
+	 */
+	private Integer	dynamic;
 
 	public String getId() {
 		return id;
@@ -125,6 +135,22 @@ public class Lecture {
 		this.lectureUrl = lectureUrl;
 	}
 
+	public Integer getHot() {
+		return hot;
+	}
+
+	public void setHot(Integer hot) {
+		this.hot = hot;
+	}
+
+	public Integer getDynamic() {
+		return dynamic;
+	}
+
+	public void setDynamic(Integer dynamic) {
+		this.dynamic = dynamic;
+	}
+
 	public String getLectureTimeFormattedDate() {
 		if (this.lectureTime == null) {
 			return null;

+ 5 - 0
src/main/java/com/goafanti/user/bo/StarAndExpertListBo.java

@@ -0,0 +1,5 @@
+package com.goafanti.user.bo;
+
+public class StarAndExpertListBo extends StarListBo {
+
+}

+ 4 - 0
src/main/java/com/goafanti/user/service/UserService.java

@@ -8,6 +8,7 @@ import com.goafanti.common.model.User;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.user.bo.OrgListBo;
 import com.goafanti.user.bo.OrgUnitNames;
+import com.goafanti.user.bo.StarAndExpertListBo;
 import com.goafanti.user.bo.StarListBo;
 import com.goafanti.user.bo.UserDownLoadBo;
 import com.goafanti.user.bo.UserListBo;
@@ -61,4 +62,7 @@ public interface UserService {
 	Pagination<StarListBo> listStar(Integer number, String engagedField, String username, String professionalTitle, String workUnit,
 			Integer pNo, Integer pSize);
 
+	Pagination<StarAndExpertListBo> listStarAndExpert(Integer number, String engagedField, String username, String professionalTitle,
+			String workUnit, Integer pNo, Integer pSize);
+
 }

+ 49 - 13
src/main/java/com/goafanti/user/service/impl/UserServiceImpl.java

@@ -31,6 +31,7 @@ import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.user.bo.OrgListBo;
 import com.goafanti.user.bo.OrgPartnerDetailBo;
 import com.goafanti.user.bo.OrgUnitNames;
+import com.goafanti.user.bo.StarAndExpertListBo;
 import com.goafanti.user.bo.StarListBo;
 import com.goafanti.user.bo.UserDownLoadBo;
 import com.goafanti.user.bo.UserListBo;
@@ -438,27 +439,63 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 	public Pagination<StarListBo> listStar(Integer number, String engagedField, String username,
 			String professionalTitle, String workUnit, Integer pNo, Integer pSize) {
 		Map<String, Object> params = new HashMap<>();
-		
-		if (null != number){
+
+		if (null != number) {
 			params.put("number", number);
 		}
-		
-		if (StringUtils.isNotBlank(engagedField)){
+
+		if (StringUtils.isNotBlank(engagedField)) {
 			params.put("engagedField", engagedField);
 		}
-		
-		if (StringUtils.isNotBlank(username)){
+
+		if (StringUtils.isNotBlank(username)) {
 			params.put("username", username);
 		}
-		
-		if (StringUtils.isNotBlank(professionalTitle)){
+
+		if (StringUtils.isNotBlank(professionalTitle)) {
 			params.put("professionalTitle", professionalTitle);
 		}
-		
-		if (StringUtils.isNotBlank(workUnit)){
+
+		if (StringUtils.isNotBlank(workUnit)) {
 			params.put("workUnit", workUnit);
 		}
-		
+
+		if (pNo == null || pNo < 0) {
+			pNo = 1;
+		}
+
+		if (pSize == null || pSize < 0 || pSize > 10) {
+			pSize = 10;
+		}
+		return (Pagination<StarListBo>) findPage("findStarListByPage", "findStarCount", params, pNo, pSize);
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<StarAndExpertListBo> listStarAndExpert(Integer number, String engagedField, String username,
+			String professionalTitle, String workUnit, Integer pNo, Integer pSize) {
+		Map<String, Object> params = new HashMap<>();
+
+		if (null != number) {
+			params.put("number", number);
+		}
+
+		if (StringUtils.isNotBlank(engagedField)) {
+			params.put("engagedField", engagedField);
+		}
+
+		if (StringUtils.isNotBlank(username)) {
+			params.put("username", username);
+		}
+
+		if (StringUtils.isNotBlank(professionalTitle)) {
+			params.put("professionalTitle", professionalTitle);
+		}
+
+		if (StringUtils.isNotBlank(workUnit)) {
+			params.put("workUnit", workUnit);
+		}
+
 		if (pNo == null || pNo < 0) {
 			pNo = 1;
 		}
@@ -466,8 +503,7 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 		if (pSize == null || pSize < 0 || pSize > 10) {
 			pSize = 10;
 		}
-		return (Pagination<StarListBo>) findPage("findStarListByPage", "findStarCount", params,
-				pNo, pSize);
+		return (Pagination<StarAndExpertListBo>) findPage("findStarAndExpertListByPage", "findStarAndExpertCount", params, pNo, pSize);
 	}
 
 }