Commit 5075d32a by jscat

nyx javaapp: 更新

1. 添加activity和activity_info 相关的query函数
parent 599abade
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/08/04.
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Rockwell_keyT_activity{
private String activityId; // 活动的id, uuid format
private String memberId; // 商家的id, uuid format
private String tag; // 活动的标签
private String title; // 活动的标题
private String numLike; // 针对每条activity的点赞次数,每点一次,则累加
private String content; // 活动内容
private String noteImage; // 该条活动的image列表
@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/08/04.
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Rockwell_keyV_activity_info{
private String activityId; // 活动的id, uuid format
private String memberId; // 活动的id, uuid format
private String memberName; // 商家名称
private String memberSlogan; // 商家slogan
private String tag; // 活动的标签
private String title; // 活动的标题
private String numLike; // 针对每条activity的点赞次数,每点一次,则累加
private String content; // 活动内容
private String noteImage; // 该条活动的image列表
private String memberStatus; // 用户状态: 00: 未注册用户; 01: 已注册用户
@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 cn.com.fun.nyxkey.api.domain.Rockwell_keyT_match;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* Created by jscat on 2020/08/04
*/
@Data
@AllArgsConstructor
public class Rockwell_keyT_activityQuery {
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createDatetime;
private String activityId; // 活动id
private String memberId; // 商家id
private String memberName; // 商家名称
private String memberStatus; // 商家状态, 00: 未注册用户; 01: 已注册用户
private String tag; // 发布的标签,比如: 酒单;;活动;;心情;;饮事;;最热Gluh Wein
private String title; // 发布标题,比如:此生必去系列。
private Pagination pagination;
//默认返回1页4条记录
public Rockwell_keyT_activityQuery()
{
this.pagination = new Pagination(1, 4);
}
public void activityId(String strActivityId)
{
if(strActivityId.equals("0"))
{
this.activityId = null;
}
else
{
this.activityId = strActivityId;
}
}
public void setMemberId(String strMemberId)
{
if(strMemberId.equals("0"))
{
this.memberId = null;
}
else
{
this.memberId = strMemberId;
}
}
public void setMemberName(String strMemberName)
{
if(strMemberName.equals("0"))
{
this.memberName = null;
}
else
{
this.memberName = strMemberName;
}
}
public void setMemberStatus(String strMemberStatus)
{
if(strMemberStatus.equals("0"))
{
this.memberStatus = null;
}
else
{
this.memberStatus = strMemberStatus;
}
}
public void setTag(String strTag)
{
if(strTag.equals("0"))
{
this.tag = null;
}
else
{
this.tag = strTag;
}
}
public void setTitle(String strTitle)
{
if(strTitle.equals("0"))
{
this.title = null;
}
else
{
this.title = strTitle;
}
}
@Override
public String toString() {
return "Rockwell_keyT_matchQuery{" +
"createDatetime='" + createDatetime + '\'' +
"activityId='" + activityId + '\'' +
"memberId='" + memberId + '\'' +
"memberName='" + memberName + '\'' +
"memberStatus='" + memberStatus + '\'' +
"tag='" + tag + '\'' +
"title='" + title + '\'' +
"pagination='" + pagination + '\'' +
'}';
}
}
package cn.com.fun.nyxkey.api.domain.query;
package cn.com.fun.nyxkey.api.domain.query;
......@@ -2,7 +2,6 @@ package cn.com.fun.nyxkey.api.domain.query;
import cn.com.fun.nyxkey.api.common.Pagination;
import cn.com.fun.nyxkey.api.domain.Rockwell_keyT_match;
import cn.com.fun.nyxkey.api.domain.Rockwell_keyV_match_rank;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
......
package cn.com.fun.nyxkey.api.repository;
package cn.com.fun.nyxkey.api.repository;
......@@ -33,6 +33,10 @@ public interface Rockwell_keyMapper {
List<Rockwell_keyV_match_point> getV_match_point_by_page(Rockwell_keyT_matchQuery rockwell_keyT_matchQuery);
List<Rockwell_keyT_match_bonus> getT_match_bonus_by_id(Rockwell_keyT_matchQuery rockwell_keyT_matchQuery);
/* activity api */
List<Rockwell_keyV_activity_info> getV_activity_info_by_page(Rockwell_keyT_activityQuery rockwell_keyT_activityQuery);
/* post api */
List<Rockwell_keyV_post_info> getV_post_info(Rockwell_keyT_postQuery rockwell_keyT_postQuery);
void addT_post(Rockwell_keyT_post rockwell_keyT_post);
......
package cn.com.fun.nyxkey.api.service;
package cn.com.fun.nyxkey.api.service;
......@@ -4,6 +4,7 @@ import cn.com.fun.nyxkey.api.common.JSONResult;
import cn.com.fun.nyxkey.api.domain.*;
import cn.com.fun.nyxkey.api.domain.*;
import cn.com.fun.nyxkey.api.domain.query.*;
import com.alibaba.fastjson.JSON;
import org.joda.time.DateTime;
import java.io.UnsupportedEncodingException;
......@@ -37,6 +38,12 @@ public interface Rockwell_keyService {
int pageNum, int pageCount);
JSONResult Rockwell_keyServiceGetT_match_bonus_by_id(String matchId);
/*
activity api
*/
JSONResult Rockwell_keyServiceGetV_activity_info(String tag, String title,
String memberId, String memberName, String memberStatus,
int pageNum, int pageCount);
/* post api */
JSONResult Rockwell_keyServiceGetV_post_info(String tag, String title, String top, int pageNum, int pageCount);
......
package cn.com.fun.nyxkey.api.service.impl;
package cn.com.fun.nyxkey.api.service.impl;
......@@ -244,7 +244,7 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService {
LOGGER.debug("find Rockwell_keyServiceGetT_match_bonus_by_id");
//判断某字符串是否为空,为空的标准是 str==null 或 str.length()==0
if(StringUtils.isEmpty(matchId))
if(StringUtils.isEmpty(matchId) || matchId.equals("0"))
{
return new JSONResult(ExceptionMsg.ParamError);
}
......@@ -257,6 +257,38 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService {
return jsonResult;
}
public JSONResult Rockwell_keyServiceGetV_activity_info(String tag, String title,
String memberId, String memberName, String memberStatus,
int pageNum, int pageCount)
{
LOGGER.debug("find Rockwell_keyServiceGetV_activity_info");
List<Rockwell_keyV_activity_info> listRockwell_keyV_activity_info = new ArrayList<>();
Rockwell_keyT_activityQuery rockwell_keyT_activityQuery = new Rockwell_keyT_activityQuery();
//判断某字符串是否为空,为空的标准是 str==null 或 str.length()==0
//默认设置memberStatus=="01"
if(StringUtils.isEmpty(memberStatus) || memberStatus.equals("0"))
{
rockwell_keyT_activityQuery.setMemberStatus("01");
}
else
{
rockwell_keyT_activityQuery.setMemberStatus(memberStatus);
}
rockwell_keyT_activityQuery.setMemberId(memberId);
rockwell_keyT_activityQuery.setMemberName(memberName);
rockwell_keyT_activityQuery.setTag(tag);
rockwell_keyT_activityQuery.setTitle(title);
rockwell_keyT_activityQuery.setPagination(new Pagination(pageNum, pageCount));
listRockwell_keyV_activity_info = rockwell_keyMapper.getV_activity_info_by_page(rockwell_keyT_activityQuery);
int totalCount = listRockwell_keyV_activity_info.size();
JSONResult jsonResult = new JSONResult(totalCount, listRockwell_keyV_activity_info);
return jsonResult;
}
/* post api */
// getV_post_info
public JSONResult Rockwell_keyServiceGetV_post_info(String tag, String title, String top, int pageNum, int pageCount)
......
package cn.com.fun.nyxkey.api.web.controller;
package cn.com.fun.nyxkey.api.web.controller;
......@@ -2,7 +2,6 @@ package cn.com.fun.nyxkey.api.web.controller;
import cn.com.fun.nyxkey.api.common.JSONResult;
import cn.com.fun.nyxkey.api.domain.Rockwell_keyT_match;
import cn.com.fun.nyxkey.api.domain.Rockwell_keyV_match_rank;
import cn.com.fun.nyxkey.api.service.*;
import cn.com.fun.nyxkey.api.web.common.ResponseHelper;
......@@ -242,6 +241,30 @@ public class NyxApiController {
return keyService.Rockwell_keyServiceGetT_match_bonus_by_id(matchId);
}
// APi3 tbl_activity接口 jscat 20200804
// 3.1 获取 view_activity_info的数据 by page, not by activityId
@ApiOperation(value="获取商家的activity info", notes="获取商家的activity info")
@ApiImplicitParams({
@ApiImplicitParam(name = "tag", value = "按标签查找; 饮事", required = false, dataType = "String"),
@ApiImplicitParam(name = "title", value = "按标题查找: 清新", required = false, dataType = "String"),
@ApiImplicitParam(name = "memberId", value = "按商家id查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "memberName", value = "按商家名称查找", required = false, dataType = "String"),
@ApiImplicitParam(name = "memberStatus", 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/activity/query", method = RequestMethod.GET)
public JSONResult RockwellQueryActivity(
@RequestParam(value = "tag", required = false, defaultValue = "0") String tag,
@RequestParam(value = "title", required = false, defaultValue = "0") String title,
@RequestParam(value = "memberId", required = false, defaultValue = "0") String memberId,
@RequestParam(value = "memberName", required = false, defaultValue = "0") String memberName,
@RequestParam(value = "memberStatus", required = false, defaultValue = "0") String memberStatus,
@RequestParam(value = "pageNum", required = false, defaultValue = "1") int pageNum,
@RequestParam(value = "pageCount", required = false, defaultValue = "4") int pageCount
) {
return keyService.Rockwell_keyServiceGetV_activity_info(tag, title, memberId, memberName, memberStatus, pageNum, pageCount);
}
// 4.0 post info api
@ApiOperation(value="获取用户的post info", notes="获取用户的post info")
......@@ -258,7 +281,7 @@ public class NyxApiController {
@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
@RequestParam(value = "pageCount", required = false, defaultValue = "4") int pageCount
) {
return keyService.Rockwell_keyServiceGetV_post_info(tag, title, top, pageNum, pageCount);
}
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
......@@ -214,7 +214,30 @@ limitations under the License.
</if>
</select>
<!-- activity api 2-1 获取 v_activity_info 的值 update jscat 20200804 -->
<select id="getV_activity_info_by_page" parameterType="cn.com.fun.nyxkey.api.domain.query.Rockwell_keyT_activityQuery"
resultType="cn.com.fun.nyxkey.api.domain.Rockwell_keyV_activity_info">
select * from view_activity_info
where 1=1
<if test="memberId != null and memberId != '' ">
AND member_id=#{memberId}
</if>
<if test="memberStatus != null and memberStatus != '' ">
AND member_status=#{memberStatus}
</if>
<if test="memberName != null and memberName != '' ">
AND member_name=#{memberName}
</if>
<if test="tag != null and tag != '' ">
AND tag=#{tag}
</if>
<if test="title != null and title != '' ">
AND ( tag LIKE CONCAT('%', #{title} ,'%') OR title LIKE CONCAT('%', #{title} ,'%') OR member_name LIKE CONCAT('%', #{title} ,'%') )
</if>
<if test="pagination != null ">
<include refid="pagination"/>
</if>
</select>
<!-- post api 4.1 从 view_post_info 获取 post信息
-->
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论