|
@@ -0,0 +1,120 @@
|
|
|
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
+<mapper namespace="com.jubotech.business.web.dao.WxContactDao">
|
|
|
|
+ <resultMap type="com.jubotech.business.web.domain.WxContactInfo" id="resultMap">
|
|
|
|
+ <id column="id" property="id"/>
|
|
|
|
+ <result column="cid" property="cid"/>
|
|
|
|
+ <result column="wechatid" property="wechatid"/>
|
|
|
|
+ <result column="friendid" property="friendid"/>
|
|
|
|
+ <result column="friend_wechatno" property="friend_wechatno"/>
|
|
|
|
+ <result column="nickname" property="nickname"/>
|
|
|
|
+ <result column="remark" property="remark"/>
|
|
|
|
+ <result column="phone" property="phone"/>
|
|
|
|
+ <result column="gender" property="gender"/>
|
|
|
|
+ <result column="avatar" property="avatar"/>
|
|
|
|
+ <result column="country" property="country"/>
|
|
|
|
+ <result column="province" property="province"/>
|
|
|
|
+ <result column="city" property="city"/>
|
|
|
|
+ <result column="memo" property="memo"/>
|
|
|
|
+ <result column="type" property="type"/>
|
|
|
|
+ <result column="modify_time" property="modify_time"/>
|
|
|
|
+ <result column="create_time" property="create_time"/>
|
|
|
|
+ </resultMap>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <select id="queryTongji" resultType="com.jubotech.business.web.domain.vo.FriendVo">
|
|
|
|
+ select t1.wechatid ,t2.wechatnick ,t2.wechatno, count(friendid) as count from tbl_wx_contactinfo t1
|
|
|
|
+ LEFT JOIN tbl_wx_accountinfo t2 on t1.wechatid=t2.wechatid
|
|
|
|
+ where 1 = 1
|
|
|
|
+ <if test="cid != null">
|
|
|
|
+ and t1.cid = #{cid}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="list != null">
|
|
|
|
+ and t1.wechatid in
|
|
|
|
+ <foreach item="item" index="index" collection="list"
|
|
|
|
+ open="(" separator="," close=")">
|
|
|
|
+ #{item}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ GROUP BY t1.wechatid
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="findContactinfoByid" resultType="com.jubotech.business.web.domain.WxContactInfo">
|
|
|
|
+ select * from tbl_wx_contactinfo where id = #{id}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <select id="findContactinfoByfriendid" resultType="com.jubotech.business.web.domain.WxContactInfo">
|
|
|
|
+ select * from tbl_wx_contactinfo
|
|
|
|
+ where cid = #{cid}
|
|
|
|
+ and wechatid = #{wechatid}
|
|
|
|
+ and friendid = #{friendid} limit 1;
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="findContactinfoByWechatidFriendid" resultType="com.jubotech.business.web.domain.WxContactInfo">
|
|
|
|
+ select * from tbl_wx_contactinfo
|
|
|
|
+ where wechatid = #{wechatid}
|
|
|
|
+ and friendid = #{friendid} limit 1;
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="findContactinfoByWeChatId" resultMap="resultMap">
|
|
|
|
+ select *
|
|
|
|
+ from tbl_wx_contactinfo
|
|
|
|
+ where cid = #{cid} and wechatid = #{wechatid}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="findContactinfoByCidType" resultType="java.lang.Integer">
|
|
|
|
+ select count(1)
|
|
|
|
+ from tbl_wx_contactinfo
|
|
|
|
+ where cid =#{cid} and type = #{type}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="findContactinfoByCidTypeDistWechatId" resultType="java.lang.Integer">
|
|
|
|
+ select count(DISTINCT friendid)
|
|
|
|
+ from tbl_wx_contactinfo
|
|
|
|
+ where cid =#{cid} and type = #{type}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <select id="queryFriendAddCount" resultType="java.lang.Integer">
|
|
|
|
+ select count(1)
|
|
|
|
+ from tbl_wx_contactinfo
|
|
|
|
+ where wechatid = #{wechatid}
|
|
|
|
+ and create_time >#{start}
|
|
|
|
+ and create_time <#{end}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <insert id="insert" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
+ <![CDATA[
|
|
|
|
+ insert into tbl_wx_contactinfo(cid,wechatid,friendid,friend_wechatno,nickname,remark,phone,gender,avatar,country,province,city,memo,type,create_time)
|
|
|
|
+ values(#{cid},#{wechatid},#{friendid},#{friend_wechatno},#{nickname},#{remark},#{phone},#{gender},#{avatar},#{country},#{province},#{city},#{memo},#{type},now());
|
|
|
|
+ ]]>
|
|
|
|
+ </insert>
|
|
|
|
+
|
|
|
|
+ <update id="update">
|
|
|
|
+ update tbl_wx_contactinfo
|
|
|
|
+ set
|
|
|
|
+ friend_wechatno = #{friend_wechatno},
|
|
|
|
+ nickname = #{nickname},
|
|
|
|
+ remark = #{remark},
|
|
|
|
+ phone = #{phone},
|
|
|
|
+ gender = #{gender},
|
|
|
|
+ avatar = #{avatar},
|
|
|
|
+ country = #{country},
|
|
|
|
+ province = #{province},
|
|
|
|
+ city = #{city},
|
|
|
|
+ memo = #{memo},
|
|
|
|
+ modify_time = now()
|
|
|
|
+ where
|
|
|
|
+ id = #{id}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+ <update id="delete">
|
|
|
|
+ delete from tbl_wx_contactinfo where id = #{id}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+</mapper>
|