Commit 22eadc83 by jscat

nyx javaapp: 功能优化

1. 按matchId查询优化为两种方式
1) matchId=mid_001
2) matchId=mid_001::mid_002
可支持多id查询;
parent bbe9c286
package cn.com.fun.nyxkey.api.domain.query;
package cn.com.fun.nyxkey.api.domain.query;
......@@ -19,6 +19,7 @@ public class Rockwell_keyT_matchQuery {
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createDatetime;
private String matchId;
private List<String> ids;
private String memberId;
private String userId;
private String matchStatus; // 积分状态, 可用|不可用
......@@ -91,6 +92,7 @@ public class Rockwell_keyT_matchQuery {
"userId='" + userId + '\'' +
"pagination='" + pagination + '\'' +
"listRockwell_keyT_match='" + listRockwell_keyT_match + '\'' +
"ids='" + ids + '\'' +
'}';
}
}
package cn.com.fun.nyxkey.api.service.impl;
package cn.com.fun.nyxkey.api.service.impl;
......@@ -147,7 +147,17 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService {
List<Rockwell_keyT_match> listRockwell_keyT_match = new ArrayList<Rockwell_keyT_match>();
Rockwell_keyT_matchQuery rockwell_keyT_matchQuery = new Rockwell_keyT_matchQuery();
rockwell_keyT_matchQuery.setMatchId(matchId);
// 判断某字符串是否为空,为空的标准是 str==null 或 str.length()==0
// 对于 http://localhost:8085/api/nyx/match/query/id?matchId=
// matchId=="", ids.size == 1;
// sql 语句为 AND match_id IN ( "" )
// 问题, 需不需要禁掉,如何禁
if(StringUtils.isEmpty(matchId) || matchId.equals("0"))
{
return new JSONResult(ExceptionMsg.ParamError);
}
List<String> ids = Arrays.asList(matchId.split("::"));
rockwell_keyT_matchQuery.setIds(ids);
listRockwell_keyT_match = rockwell_keyMapper.getT_match_by_matchid(rockwell_keyT_matchQuery);
int totalCount = listRockwell_keyT_match.size();
JSONResult jsonResult = new JSONResult(totalCount, listRockwell_keyT_match);
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
......@@ -142,7 +142,12 @@ limitations under the License.
resultType="cn.com.fun.nyxkey.api.domain.Rockwell_keyT_match">
select * from tbl_match
where 1=1
AND match_id=#{matchId}
<if test="ids != null and ids.size > 0">
AND match_id IN
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<!-- match api 1-5 获取t_match的值 update jscat 20200731 -->
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论