Commit 195a3597 by 徐高华

社群排序

parent 702f175b
<?xml version="1.0" encoding="UTF-8" ?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.haoban.manage.service.dao.mapper.chat.GroupChatPlanOwnerLogMapper"> <mapper namespace="com.gic.haoban.manage.service.dao.mapper.chat.GroupChatPlanOwnerLogMapper">
<resultMap type="com.gic.haoban.manage.service.entity.chat.TabGroupChatPlanOwnerLog" id="result-map-tabHaobanGroupChatPlanOwnerLog"> <resultMap type="com.gic.haoban.manage.service.entity.chat.TabGroupChatPlanOwnerLog" id="result-map-tabHaobanGroupChatPlanOwnerLog">
<result column="owner_log_id" property="ownerLogId"/> <result column="owner_log_id" property="ownerLogId"/>
<result column="plan_id" property="planId"/> <result column="plan_id" property="planId"/>
<result column="wx_enterprise_id" property="wxEnterpriseId"/> <result column="wx_enterprise_id" property="wxEnterpriseId"/>
<result column="enterprise_id" property="enterpriseId"/> <result column="enterprise_id" property="enterpriseId"/>
<result column="staff_id" property="staffId"/> <result column="staff_id" property="staffId"/>
<result column="store_id" property="storeId"/> <result column="store_id" property="storeId"/>
<result column="clerk_id" property="clerkId"/> <result column="clerk_id" property="clerkId"/>
<result column="send_status" property="sendStatus"/> <result column="send_status" property="sendStatus"/>
<result column="send_count" property="sendCount"/> <result column="send_count" property="sendCount"/>
<result column="create_time" property="createTime"/> <result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/> <result column="update_time" property="updateTime"/>
<result column="remark" property="remark"/> <result column="remark" property="remark"/>
<result column="msgid" property="msgid"/> <result column="msgid" property="msgid"/>
<result column="delete_flag" property="deleteFlag"/> <result column="delete_flag" property="deleteFlag"/>
<result column="done_flag" property="doneFlag"/> <result column="done_flag" property="doneFlag"/>
<result column="send_time" property="sendTime"/> <result column="send_time" property="sendTime"/>
<result column="fail_count" property="failCount"/> <result column="fail_count" property="failCount"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
owner_log_id, owner_log_id,
plan_id, plan_id,
wx_enterprise_id, wx_enterprise_id,
enterprise_id, enterprise_id,
staff_id, staff_id,
store_id, store_id,
clerk_id, clerk_id,
send_status, send_status,
send_count, send_count,
create_time, create_time,
update_time , remark , msgid , delete_flag , done_flag , send_time , fail_count update_time , remark , msgid , delete_flag , done_flag , send_time , fail_count
</sql> </sql>
<!-- ===================== 新增 ======================== --> <!-- ===================== 新增 ======================== -->
<insert id="batchInsert"> <insert id="batchInsert">
INSERT INTO tab_haoban_group_chat_plan_owner_log( INSERT INTO tab_haoban_group_chat_plan_owner_log(
owner_log_id, owner_log_id,
plan_id, plan_id,
wx_enterprise_id, wx_enterprise_id,
enterprise_id, enterprise_id,
staff_id, staff_id,
store_id, store_id,
clerk_id, clerk_id,
send_status, send_status,
send_count, send_count,
fail_count, fail_count,
create_time, create_time,
update_time , remark , msgid , delete_flag , done_flag update_time , remark , msgid , delete_flag , done_flag
)VALUES )VALUES
<foreach collection="list" item="item" separator="," > <foreach collection="list" item="item" separator="," >
( #{item.ownerLogId,jdbcType=BIGINT}, ( #{item.ownerLogId,jdbcType=BIGINT},
#{item.planId,jdbcType=BIGINT}, #{item.planId,jdbcType=BIGINT},
#{item.wxEnterpriseId}, #{item.wxEnterpriseId},
#{item.enterpriseId}, #{item.enterpriseId},
#{item.staffId}, #{item.staffId},
#{item.storeId}, #{item.storeId},
#{item.clerkId}, #{item.clerkId},
#{item.sendStatus}, #{item.sendStatus},
0, 0,
0, 0,
#{item.createTime}, #{item.createTime},
#{item.updateTime} , #{item.remark} , #{item.msgid} , 0 , 0 #{item.updateTime} , #{item.remark} , #{item.msgid} , 0 , 0
) )
</foreach> </foreach>
</insert> </insert>
<update id="update" parameterType="com.gic.haoban.manage.service.entity.chat.TabGroupChatPlanOwnerLog"> <update id="update" parameterType="com.gic.haoban.manage.service.entity.chat.TabGroupChatPlanOwnerLog">
<![CDATA[ <![CDATA[
UPDATE tab_haoban_group_chat_plan_owner_log SET UPDATE tab_haoban_group_chat_plan_owner_log SET
store_id=#{storeId}, store_id=#{storeId},
clerk_id=#{clerkId}, clerk_id=#{clerkId},
send_status=#{sendStatus}, send_status=#{sendStatus},
update_time=now(), update_time=now(),
remark=#{remark}, remark=#{remark},
msgid=#{msgid} msgid=#{msgid}
where owner_log_id = #{ownerLogId} where owner_log_id = #{ownerLogId}
]]> ]]>
</update> </update>
<update id="deleteByStaffIds"> <update id="deleteByStaffIds">
update tab_haoban_group_chat_plan_owner_log set delete_flag = 1 , update_time =now() where plan_id=#{planId} update tab_haoban_group_chat_plan_owner_log set delete_flag = 1 , update_time =now() where plan_id=#{planId}
and staff_id in and staff_id in
<foreach collection="staffIdList" close=")" open="(" separator="," item="id"> <foreach collection="staffIdList" close=")" open="(" separator="," item="id">
#{id} #{id}
</foreach> </foreach>
</update> </update>
<!-- ==================更新 ========== --> <!-- ==================更新 ========== -->
<update id="updateSendCount"> <update id="updateSendCount">
<![CDATA[ <![CDATA[
UPDATE tab_haoban_group_chat_plan_owner_log SET send_count = #{sendCount} , fail_count =#{failCount} , done_flag = 1 , UPDATE tab_haoban_group_chat_plan_owner_log SET send_count = #{sendCount} , fail_count =#{failCount} , done_flag = 1 ,
send_status = 2 , send_time = #{sendTime} , send_status = 2 , send_time = #{sendTime} ,
update_time = now() where owner_log_id = #{id} update_time = now() where owner_log_id = #{id}
]]> ]]>
</update> </update>
<!-- ============ 查询=============--> <!-- ============ 查询=============-->
<select id="selectById" parameterType="long" resultMap="result-map-tabHaobanGroupChatPlanOwnerLog"> <select id="selectById" parameterType="long" resultMap="result-map-tabHaobanGroupChatPlanOwnerLog">
SELECT <include refid="Base_Column_List"/> FROM tab_haoban_group_chat_plan_owner_log WHERE owner_log_id = #{ownerLogId} and delete_flag = 0 SELECT <include refid="Base_Column_List"/> FROM tab_haoban_group_chat_plan_owner_log WHERE owner_log_id = #{ownerLogId} and delete_flag = 0
</select> </select>
<select id="listForTimer" resultType="long"> <select id="listForTimer" resultType="long">
SELECT a.owner_log_id FROM tab_haoban_group_chat_plan_owner_log a left join tab_haoban_group_chat_plan b on a.plan_id = b.plan_id SELECT a.owner_log_id FROM tab_haoban_group_chat_plan_owner_log a left join tab_haoban_group_chat_plan b on a.plan_id = b.plan_id
WHERE b.end_time >= DATE_ADD(NOW(),INTERVAL -6 hour) and a.done_flag = 0 and a.delete_flag = 0 and b.delete_flag = 0 and a.msgid is not null WHERE b.end_time >= DATE_ADD(NOW(),INTERVAL -6 hour) and a.done_flag = 0 and a.delete_flag = 0 and b.delete_flag = 0 and a.msgid is not null
<if test="null != planId and -1 != planId"> <if test="null != planId and -1 != planId">
and a.plan_id = #{planId} and a.plan_id = #{planId}
</if> </if>
</select> </select>
<select id="listForDoPlan" resultMap="result-map-tabHaobanGroupChatPlanOwnerLog"> <select id="listForDoPlan" resultMap="result-map-tabHaobanGroupChatPlanOwnerLog">
select <include refid="Base_Column_List"/> FROM tab_haoban_group_chat_plan_owner_log WHERE plan_id = #{planId} and delete_flag = 0 limit ${startItem},${pageSize} select <include refid="Base_Column_List"/> FROM tab_haoban_group_chat_plan_owner_log WHERE plan_id = #{planId} and delete_flag = 0 limit ${startItem},${pageSize}
</select> </select>
<select id="listPage" parameterType="com.gic.haoban.manage.api.dto.qdto.chat.GroupChatPlanSearchQDTO" resultType="com.gic.haoban.manage.api.dto.chat.GroupChatPlanOwnerLogDTO"> <select id="listPage" parameterType="com.gic.haoban.manage.api.dto.qdto.chat.GroupChatPlanSearchQDTO" resultType="com.gic.haoban.manage.api.dto.chat.GroupChatPlanOwnerLogDTO">
select select
a.owner_log_id ownerLogId , a.owner_log_id ownerLogId ,
a.wx_enterprise_id wxEnterpriseId , a.wx_enterprise_id wxEnterpriseId ,
a.plan_id planId , a.plan_id planId ,
b.staff_name staffName , b.staff_name staffName ,
a.staff_id staffId , a.staff_id staffId ,
a.clerk_id clerkId , a.clerk_id clerkId ,
a.store_id storeId , a.store_id storeId ,
a.send_status sendStatus , a.send_status sendStatus ,
a.send_count sendCount , a.send_count sendCount ,
a.send_time sendTime , a.send_time sendTime ,
a.create_time createTime , a.create_time createTime ,
a.done_flag doneFlag , a.done_flag doneFlag ,
a.msgid msgid a.msgid msgid
from tab_haoban_group_chat_plan_owner_log a left join tab_haoban_staff b on a.staff_id = b.staff_id from tab_haoban_group_chat_plan_owner_log a left join tab_haoban_staff b on a.staff_id = b.staff_id
where where
a.wx_enterprise_id = #{wxEnterpriseId} and a.plan_id = #{planId} and a.delete_flag = 0 a.wx_enterprise_id = #{wxEnterpriseId} and a.plan_id = #{planId} and a.delete_flag = 0
<if test="null != sendStatus"> <if test="null != sendStatus">
and send_status = #{sendStatus} and send_status = #{sendStatus}
</if> </if>
<if test="null != searchParams and ''!=searchParams"> <if test="null != searchParams and ''!=searchParams">
and b.staff_name like #{searchParams} and b.staff_name like #{searchParams}
</if> </if>
<if test="null != startDate"> <if test="null != startDate">
and a.create_time <![CDATA[>=]]> #{startDate} and a.create_time <![CDATA[<=]]> #{endDate} and a.create_time <![CDATA[>=]]> #{startDate} and a.create_time <![CDATA[<=]]> #{endDate}
</if> </if>
order by a.create_time , a.owner_log_id order by a.create_time , a.owner_log_id
</select> </select>
<select id="listOwnerLogPageForWxaTotal" parameterType="com.gic.haoban.manage.api.dto.qdto.chat.GroupChatPlanSearchQDTO" resultType="com.gic.haoban.manage.api.dto.chat.ChatOwnerTotalDTO"> <select id="listOwnerLogPageForWxaTotal" parameterType="com.gic.haoban.manage.api.dto.qdto.chat.GroupChatPlanSearchQDTO" resultType="com.gic.haoban.manage.api.dto.chat.ChatOwnerTotalDTO">
select select
b.plan_id planId , b.plan_id planId ,
b.name planName , b.name planName ,
b.start_time startTime , b.start_time startTime ,
b.end_time endTime , b.end_time endTime ,
<!-- 已发送 --> <!-- 已发送 -->
SUM(CASE a.send_status WHEN 2 THEN 1 ELSE 0 END ) sendCount, SUM(CASE a.send_status WHEN 2 THEN 1 ELSE 0 END ) sendCount,
<!-- 待发送 --> <!-- 待发送 -->
SUM(CASE a.send_status WHEN 1 THEN 1 ELSE 0 END ) notSendCount SUM(CASE a.send_status WHEN 1 THEN 1 ELSE 0 END ) notSendCount
from tab_haoban_group_chat_plan_owner_log a left join tab_haoban_group_chat_plan b on a.plan_id = b.plan_id from tab_haoban_group_chat_plan_owner_log a left join tab_haoban_group_chat_plan b on a.plan_id = b.plan_id
where where
a.wx_enterprise_id = #{wxEnterpriseId} and b.delete_flag = 0 a.wx_enterprise_id = #{wxEnterpriseId} and b.delete_flag = 0
<if test="null != storeId"> <if test="null != storeId">
and a.store_id = #{storeId} and a.store_id = #{storeId}
</if> </if>
<if test="null != clerkId"> <if test="null != clerkId">
and a.clerk_id = #{clerkId} and a.clerk_id = #{clerkId}
</if> </if>
<if test="null != sendStatus"> <if test="null != sendStatus">
and a.send_status = #{sendStatus} and a.send_status = #{sendStatus}
</if> </if>
<if test="null != searchParams"> <if test="null != searchParams">
and b.name like #{searchParams} and b.name like #{searchParams}
</if> </if>
group by b.plan_id group by b.plan_id
order by a.create_time desc , a.owner_log_id order by b.end_time desc , a.create_time desc
</select> </select>
<select id="listOwnerLogPageForWxa" parameterType="com.gic.haoban.manage.api.dto.qdto.chat.GroupChatPlanSearchQDTO" resultType="com.gic.haoban.manage.api.dto.chat.GroupChatPlanOwnerLogDTO"> <select id="listOwnerLogPageForWxa" parameterType="com.gic.haoban.manage.api.dto.qdto.chat.GroupChatPlanSearchQDTO" resultType="com.gic.haoban.manage.api.dto.chat.GroupChatPlanOwnerLogDTO">
select select
a.owner_log_id ownerLogId , a.owner_log_id ownerLogId ,
b.plan_id planId , b.plan_id planId ,
b.name planName , b.name planName ,
a.staff_id staffId , a.staff_id staffId ,
a.clerk_id clerkId , a.clerk_id clerkId ,
a.store_id storeId , a.store_id storeId ,
a.send_status sendStatus , a.send_status sendStatus ,
a.send_count sendCount , a.send_count sendCount ,
a.fail_count failCount , a.fail_count failCount ,
a.send_time sendTime , a.send_time sendTime ,
a.create_time createTime , a.create_time createTime ,
b.end_time expireDate , b.end_time expireDate ,
b.end_time endTime , b.end_time endTime ,
b.start_time startTime , b.start_time startTime ,
a.done_flag doneFlag , a.done_flag doneFlag ,
a.msgid msgid a.msgid msgid
from tab_haoban_group_chat_plan_owner_log a left join tab_haoban_group_chat_plan b on a.plan_id = b.plan_id from tab_haoban_group_chat_plan_owner_log a left join tab_haoban_group_chat_plan b on a.plan_id = b.plan_id
where a.wx_enterprise_id = #{wxEnterpriseId} and a.plan_id = #{planId} and b.delete_flag = 0 where a.wx_enterprise_id = #{wxEnterpriseId} and a.plan_id = #{planId} and b.delete_flag = 0
<if test="null != storeId"> <if test="null != storeId">
and a.store_id = #{storeId} and a.store_id = #{storeId}
</if> </if>
<if test="null != clerkId"> <if test="null != clerkId">
and a.clerk_id = #{clerkId} and a.clerk_id = #{clerkId}
</if> </if>
<if test="null != sendStatus"> <if test="null != sendStatus">
and a.send_status = #{sendStatus} and a.send_status = #{sendStatus}
</if> </if>
order by a.create_time desc , a.owner_log_id order by a.create_time desc , a.owner_log_id
</select> </select>
<select id="getOwnerInfo" resultType="com.gic.haoban.manage.api.dto.chat.GroupChatPlanOwnerLogDTO"> <select id="getOwnerInfo" resultType="com.gic.haoban.manage.api.dto.chat.GroupChatPlanOwnerLogDTO">
select select
a.owner_log_id ownerLogId , a.owner_log_id ownerLogId ,
b.plan_id planId , b.plan_id planId ,
b.name planName , b.name planName ,
a.staff_id staffId , a.staff_id staffId ,
a.clerk_id clerkId , a.clerk_id clerkId ,
a.store_id storeId , a.store_id storeId ,
a.send_status sendStatus , a.send_status sendStatus ,
a.send_count sendCount , a.send_count sendCount ,
a.fail_count failCount , a.fail_count failCount ,
a.send_time sendTime , a.send_time sendTime ,
a.create_time createTime , a.create_time createTime ,
b.end_time expireDate , b.end_time expireDate ,
b.end_time endTime , b.end_time endTime ,
b.start_time startTime , b.start_time startTime ,
a.done_flag doneFlag , a.done_flag doneFlag ,
a.msgid msgid a.msgid msgid
from tab_haoban_group_chat_plan_owner_log a left join tab_haoban_group_chat_plan b on a.plan_id = b.plan_id from tab_haoban_group_chat_plan_owner_log a left join tab_haoban_group_chat_plan b on a.plan_id = b.plan_id
where a.wx_enterprise_id = #{wxEnterpriseId} and a.plan_id = #{planId} and b.delete_flag = 0 and a.staff_id = #{staffId} where a.wx_enterprise_id = #{wxEnterpriseId} and a.plan_id = #{planId} and b.delete_flag = 0 and a.staff_id = #{staffId}
and a.clerk_id = #{clerkId} and a.clerk_id = #{clerkId}
</select> </select>
<select id="getTotalCount" resultType="java.lang.Integer"> <select id="getTotalCount" resultType="java.lang.Integer">
SELECT SELECT
count(*) count(*)
FROM FROM
tab_haoban_group_chat_plan_owner_log tab_haoban_group_chat_plan_owner_log
WHERE WHERE
enterprise_id = #{enterpriseId} enterprise_id = #{enterpriseId}
<if test="null != storeId"> <if test="null != storeId">
AND store_id = #{storeId} AND store_id = #{storeId}
</if> </if>
<if test="null != clerkId"> <if test="null != clerkId">
AND clerk_id = #{clerkId} AND clerk_id = #{clerkId}
</if> </if>
AND send_status = 1 AND send_status = 1
</select> </select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment