Explorar el Código

[标签][查询]修改json 查询方式

release_toaliyun_real
jinguo24@163.com hace 7 años
padre
commit
09a5542e5e
Se han modificado 3 ficheros con 4 adiciones y 9 borrados
  1. +1
    -3
      mallinkService/src/main/java/com/simple/mapper/WxCUserTagsMapper.java
  2. +2
    -1
      mallinkService/src/main/java/com/simple/service/impl/WxMsgServiceImpl.java
  3. +1
    -5
      mallinkService/src/main/resources/mapper/WxCUserTagsMapper.xml

+ 1
- 3
mallinkService/src/main/java/com/simple/mapper/WxCUserTagsMapper.java Ver fichero

@@ -9,10 +9,8 @@ import org.apache.ibatis.annotations.Param;
public interface WxCUserTagsMapper extends CommonMapper<WxCUserTags, String> { public interface WxCUserTagsMapper extends CommonMapper<WxCUserTags, String> {


List<WxCUserTags> findList(WxCUserTags wxCUserTags); List<WxCUserTags> findList(WxCUserTags wxCUserTags);
long findCountByTag(List<Long> tagIds);


List<Long> findUserByTag(List<Long> tagIds);
List<Long> findUserByTag(@Param("tagIds")String tagIds);


long findCountByTags(@Param("tagIds")String tagIds); long findCountByTags(@Param("tagIds")String tagIds);




+ 2
- 1
mallinkService/src/main/java/com/simple/service/impl/WxMsgServiceImpl.java Ver fichero

@@ -1,5 +1,6 @@
package com.simple.service.impl; package com.simple.service.impl;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@@ -122,7 +123,7 @@ public class WxMsgServiceImpl implements WxMsgService {
for (int i = 0; i < arys.length; i++) { for (int i = 0; i < arys.length; i++) {
tagids.add(Long.parseLong(arys[i])); tagids.add(Long.parseLong(arys[i]));
} }
List<Long> userIds = wxCUserTagsMapper.findUserByTag(tagids);
List<Long> userIds = wxCUserTagsMapper.findUserByTag(JSON.toJSONString(tagids));
if(userIds.size()==0) { if(userIds.size()==0) {
return ""; return "";
} }


+ 1
- 5
mallinkService/src/main/resources/mapper/WxCUserTagsMapper.xml Ver fichero

@@ -60,12 +60,8 @@
<include refid="dynamicWhereConditions" /> <include refid="dynamicWhereConditions" />
</select> </select>
<select id ="findCountByTag" resultType="java.lang.Long">
select count(user_id) from wx_c_user_tags where JSON_CONTAINS(tags,JSON_ARRAY(#{list}) );
</select>
<select id ="findUserByTag" resultType="java.lang.Long"> <select id ="findUserByTag" resultType="java.lang.Long">
select user_id from wx_c_user_tags where JSON_CONTAINS(tags,JSON_ARRAY(#{list}) );
select user_id from wx_c_user_tags where JSON_CONTAINS(tags,#{tagIds} );
</select> </select>


<select id ="findCountByTags" resultType="java.lang.Long"> <select id ="findCountByTags" resultType="java.lang.Long">


Cargando…
Cancelar
Guardar