Commit c85db24c by jscat

nyx: discover页面功能添加

1. 添加post_info query接口
parent f339012d
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
...@@ -2,7 +2,19 @@ ...@@ -2,7 +2,19 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="86dc399d-9323-4124-8c4f-671d1ecb849c" name="Default Changelist" comment=""> <list default="true" id="86dc399d-9323-4124-8c4f-671d1ecb849c" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/../nyx-master/pages/discover/discover.js" beforeDir="false" afterPath="$PROJECT_DIR$/../nyx-master/pages/discover/discover.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../nyx-master/pages/discover/discover.wxml" beforeDir="false" afterPath="$PROJECT_DIR$/../nyx-master/pages/discover/discover.wxml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../nyx-master/pages/discover/discover.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/../nyx-master/pages/discover/discover.wxss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../nyx-master/pages/discover/note-info/note-info.js" beforeDir="false" afterPath="$PROJECT_DIR$/../nyx-master/pages/discover/note-info/note-info.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../nyx-master/pages/discover/note-info/note-info.wxml" beforeDir="false" afterPath="$PROJECT_DIR$/../nyx-master/pages/discover/note-info/note-info.wxml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../nyx-master/pages/discover/note-info/note-info.wxss" beforeDir="false" afterPath="$PROJECT_DIR$/../nyx-master/pages/discover/note-info/note-info.wxss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../nyx-master/pages/map/map.js" beforeDir="false" afterPath="$PROJECT_DIR$/../nyx-master/pages/map/map.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/api/src/main/java/cn/com/fun/nyxkey/api/repository/Rockwell_keyMapper.java" beforeDir="false" afterPath="$PROJECT_DIR$/api/src/main/java/cn/com/fun/nyxkey/api/repository/Rockwell_keyMapper.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/api/src/main/java/cn/com/fun/nyxkey/api/service/Rockwell_keyService.java" beforeDir="false" afterPath="$PROJECT_DIR$/api/src/main/java/cn/com/fun/nyxkey/api/service/Rockwell_keyService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/api/src/main/java/cn/com/fun/nyxkey/api/service/impl/Rockwell_keyServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/api/src/main/java/cn/com/fun/nyxkey/api/service/impl/Rockwell_keyServiceImpl.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/api/src/main/java/cn/com/fun/nyxkey/api/web/controller/NyxApiController.java" beforeDir="false" afterPath="$PROJECT_DIR$/api/src/main/java/cn/com/fun/nyxkey/api/web/controller/NyxApiController.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/api/src/main/resources/cn/com/fun/nyxkey/api/repository/Rockwell_keyMapper.xml" beforeDir="false" afterPath="$PROJECT_DIR$/api/src/main/resources/cn/com/fun/nyxkey/api/repository/Rockwell_keyMapper.xml" afterDir="false" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
...@@ -95,7 +107,8 @@ ...@@ -95,7 +107,8 @@
<option name="number" value="Default" /> <option name="number" value="Default" />
<option name="presentableId" value="Default" /> <option name="presentableId" value="Default" />
<updated>1585101820304</updated> <updated>1585101820304</updated>
<workItem from="1585101824767" duration="1484000" /> <workItem from="1585101824767" duration="2687000" />
<workItem from="1585228951314" duration="9032000" />
</task> </task>
<servers /> <servers />
</component> </component>
...@@ -107,10 +120,23 @@ ...@@ -107,10 +120,23 @@
<map> <map>
<entry key="MAIN"> <entry key="MAIN">
<value> <value>
<State /> <State>
<option name="COLUMN_ORDER" />
</State>
</value> </value>
</entry> </entry>
</map> </map>
</option> </option>
</component> </component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/api/src/main/java/cn/com/fun/nyxkey/api/service/impl/Rockwell_keyServiceImpl.java</url>
<line>272</line>
<option name="timeStamp" value="2" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
</project> </project>
\ No newline at end of file
package cn.com.fun.nyxkey.api.domain;
package cn.com.fun.nyxkey.api.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 发布表
* Created by jscat on 2020/03/26.
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Rockwell_keyT_post{
private String postId; // 发文的id, uuid format
private String userId; // 用户的id, uuid format
private String tag; // 发布的标签
private String title; // 发布的标题
private String numLike; // 针对每条post的点赞次数,每点一次,则累加
private String noteImage; // 该条post的image列表
private String content; // 发文内容
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createDatetime; // 统计周期
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date updateDatetime; // 更新日期
}
package cn.com.fun.nyxkey.api.domain;
package cn.com.fun.nyxkey.api.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 发布-用户信息系视图表
* Created by jscat on 2020/03/26.
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Rockwell_keyV_post_info{
private String postId; // 发文的id, uuid format
private String nickName; // nickName
private String tag; // 发布的标签
private String title; // 发布的标题
private String numLike; // 针对每条post的点赞次数,每点一次,则累加
private String noteImage; // 该条post的image列表
private String content; // 发文内容
private String avatarUrl; // avatarUrl
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createDatetime; // 统计周期
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date updateDatetime; // 更新日期
}
package cn.com.fun.nyxkey.api.domain.query;
package cn.com.fun.nyxkey.api.domain.query;
import cn.com.fun.nyxkey.api.common.Pagination;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.Date;
/**
* Created by jscat on 2020/03/27.
*/
@Data
@AllArgsConstructor
public class Rockwell_keyT_postQuery {
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createDatetime;
private String tag;
private String title;
private Pagination pagination;
public Rockwell_keyT_postQuery(){
// 分页设置,默认是1页4条记录
this.pagination = new Pagination(1, 4);
}
public void setTag(String strTag)
{
if(strTag.equals("null") || strTag.equals("0") )
{
this.tag = null;
}
else
{
this.tag = strTag;
}
}
public void setTitle(String strTitle)
{
if(strTitle.equals("null") || strTitle.equals("0"))
{
this.title = null;
}
else
{
this.title = strTitle;
}
}
public void setCreateDatetime(Date createDatetime)
{
if(createDatetime.equals("null"))
{
this.createDatetime = null;
}
else
{
this.createDatetime = createDatetime;
}
}
@Override
public String toString() {
return "Rockwell_keyT_postQuery{" +
"createDatetime='" + createDatetime + '\'' +
"tag='" + tag + '\'' +
"title='" + title + '\'' +
"pagination='" + pagination + '\'' +
'}';
}
}
package cn.com.fun.nyxkey.api.repository; package cn.com.fun.nyxkey.api.repository;
...@@ -34,6 +34,9 @@ public interface Rockwell_keyMapper { ...@@ -34,6 +34,9 @@ public interface Rockwell_keyMapper {
void updateT_match_rank_defaultType(Rockwell_keyT_matchQuery rockwell_keyT_matchQuery); void updateT_match_rank_defaultType(Rockwell_keyT_matchQuery rockwell_keyT_matchQuery);
void genT_match_rank(Rockwell_keyT_matchQuery rockwell_keyT_matchQuery); void genT_match_rank(Rockwell_keyT_matchQuery rockwell_keyT_matchQuery);
/* post api */
List<Rockwell_keyV_post_info> getV_post_info(Rockwell_keyT_postQuery rockwell_keyT_postQuery);
/* testing */ /* testing */
void test(Rockwell_keyT_matchQuery rockwell_keyT_matchQuery); void test(Rockwell_keyT_matchQuery rockwell_keyT_matchQuery);
......
package cn.com.fun.nyxkey.api.service; package cn.com.fun.nyxkey.api.service;
...@@ -40,6 +40,9 @@ public interface Rockwell_keyService { ...@@ -40,6 +40,9 @@ public interface Rockwell_keyService {
void Rockwell_keyServiceUpdateT_match_rank_defaultType(List<Rockwell_keyV_match_rank> listRockwell_keyV_match_rank); void Rockwell_keyServiceUpdateT_match_rank_defaultType(List<Rockwell_keyV_match_rank> listRockwell_keyV_match_rank);
void Rockwell_keyServiceGenT_match_rank(String matchSeason); void Rockwell_keyServiceGenT_match_rank(String matchSeason);
/* post api */
JSONResult Rockwell_keyServiceGetV_post_info(String tag, String title, String top);
// testing // testing
void Rockwell_keyServiceTest(List<Rockwell_keyT_match> listRockwell_keyT_match); void Rockwell_keyServiceTest(List<Rockwell_keyT_match> listRockwell_keyT_match);
......
package cn.com.fun.nyxkey.api.service.impl; package cn.com.fun.nyxkey.api.service.impl;
...@@ -266,6 +266,28 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService { ...@@ -266,6 +266,28 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService {
rockwell_keyMapper.genT_match_rank(rockwell_keyT_matchQuery); rockwell_keyMapper.genT_match_rank(rockwell_keyT_matchQuery);
} }
/* post api */
// getV_post_info
public JSONResult Rockwell_keyServiceGetV_post_info(String tag, String title, String top)
{
Rockwell_keyT_postQuery rockwell_keyT_postQuery = new Rockwell_keyT_postQuery();
rockwell_keyT_postQuery.setTag(tag);
rockwell_keyT_postQuery.setTitle(title);
if(top.equals("1"))
{
Calendar before7 = Calendar.getInstance();
before7.add(Calendar.DAY_OF_MONTH, -7);
Date createDatetime =before7.getTime();
rockwell_keyT_postQuery.setCreateDatetime(createDatetime);
}
List<Rockwell_keyV_post_info> listRockwell_keyV_post_info= new ArrayList<Rockwell_keyV_post_info>();
listRockwell_keyV_post_info = rockwell_keyMapper.getV_post_info(rockwell_keyT_postQuery);
int totalCount = listRockwell_keyV_post_info.size();
JSONResult jsonResult = new JSONResult(totalCount, listRockwell_keyV_post_info);
return jsonResult;
}
// testing // testing
public void Rockwell_keyServiceTest(List<Rockwell_keyT_match> listRockwell_keyT_match) public void Rockwell_keyServiceTest(List<Rockwell_keyT_match> listRockwell_keyT_match)
......
package cn.com.fun.nyxkey.api.web.controller; package cn.com.fun.nyxkey.api.web.controller;
...@@ -242,6 +242,28 @@ public class NyxApiController { ...@@ -242,6 +242,28 @@ public class NyxApiController {
keyService.Rockwell_keyServiceUpdateT_match_rank_defaultType(Rockwell_keyV_match_rank); keyService.Rockwell_keyServiceUpdateT_match_rank_defaultType(Rockwell_keyV_match_rank);
} }
// 4.0 post info api
@ApiOperation(value="获取用户的post info", notes="获取用户的post info")
@ApiImplicitParams({
@ApiImplicitParam(name = "tag", value = "标签; 饮事", required = false, dataType = "String"),
@ApiImplicitParam(name = "title", value = "标题: 清新", required = false, dataType = "String"),
@ApiImplicitParam(name = "top", value = "推荐", required = false, dataType = "String"),
@ApiImplicitParam(name = "pageNum", value = "页码,从1开始", required = false, dataType = "String", defaultValue = "1"),
@ApiImplicitParam(name = "pageCount", value = "每页的数据个数,默认是4个", required = false, dataType = "String", defaultValue = "4")
})
@RequestMapping(value = "/nyx/post/query", method = RequestMethod.GET)
public JSONResult RockwellQueryPost(
@RequestParam(value = "tag", required = false, defaultValue = "0") String tag,
@RequestParam(value = "title", required = false, defaultValue = "0") String title,
@RequestParam(value = "top", required = false, defaultValue = "0") String top,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") int pageNum,
@RequestParam(value = "pageCount", required = false, defaultValue = "5") int pageCount
) {
return keyService.Rockwell_keyServiceGetV_post_info(tag, title, top);
}
// 2.0 test // 2.0 test
@ApiOperation(value="test", notes="test") @ApiOperation(value="test", notes="test")
@ApiImplicitParams({ @ApiImplicitParams({
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
...@@ -238,5 +238,25 @@ limitations under the License. ...@@ -238,5 +238,25 @@ limitations under the License.
</select> </select>
<!-- post api 4.1 从 view_post_info 获取 post信息
-->
<select id="getV_post_info" parameterType="cn.com.fun.nyxkey.api.domain.query.Rockwell_keyT_postQuery" resultType="cn.com.fun.nyxkey.api.domain.Rockwell_keyV_post_info">
SELECT * FROM view_post_info
WHERE 1=1
<if test="tag != null and tag != '' ">
AND tag LIKE CONCAT('%', #{tag} ,'%')
</if>
<if test="title != null and title != '' ">
AND title LIKE CONCAT('%', #{title} ,'%')
</if>
<if test="createDatetime != null">
AND DATE_FORMAT(create_datetime, '%Y-%m-%d') &gt;= DATE_FORMAT(#{createDatetime,jdbcType=DATE}, '%Y-%m-%d')
</if>
order by num_like desc, create_datetime desc
<if test="pagination != null ">
<include refid="pagination"/>
</if>
</select>
<!-- ending API interface --> <!-- ending API interface -->
</mapper> </mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论