|
@@ -0,0 +1,128 @@
|
|
|
+<?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.kmall.admin.dao.statistics.WechatFollowersDao">
|
|
|
+
|
|
|
+ <resultMap type="com.kmall.admin.entity.WechatFollowersEntity" id="wechatFollowersMap">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="merchSn" column="merch_sn"/>
|
|
|
+ <result property="wechatFollowers" column="wechat_followers"/>
|
|
|
+ <result property="createrSn" column="creater_sn"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="moderSn" column="moder_sn"/>
|
|
|
+ <result property="modTime" column="mod_time"/>
|
|
|
+ <result property="tstm" column="tstm"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="queryObject" resultType="com.kmall.admin.entity.WechatFollowersEntity">
|
|
|
+ select
|
|
|
+ `id`,
|
|
|
+ `merch_sn`,
|
|
|
+ `wechat_followers`,
|
|
|
+ `creater_sn`,
|
|
|
+ `create_time`,
|
|
|
+ `moder_sn`,
|
|
|
+ `mod_time`,
|
|
|
+ `tstm`
|
|
|
+ from mall_wechat_followers
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryList" resultType="com.kmall.admin.entity.WechatFollowersEntity">
|
|
|
+ select
|
|
|
+ `id`,
|
|
|
+ `merch_sn`,
|
|
|
+ `wechat_followers`,
|
|
|
+ `creater_sn`,
|
|
|
+ `create_time`,
|
|
|
+ `moder_sn`,
|
|
|
+ `mod_time`,
|
|
|
+ `tstm`
|
|
|
+ from mall_wechat_followers
|
|
|
+ WHERE 1=1
|
|
|
+ <if test="name != null and name.trim() != ''">
|
|
|
+ AND name LIKE concat('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ <choose>
|
|
|
+ <when test="sidx != null and sidx.trim() != ''">
|
|
|
+ order by ${sidx} ${order}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ order by id desc
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ <if test="offset != null and limit != null">
|
|
|
+ limit #{offset}, #{limit}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryTotal" resultType="int">
|
|
|
+ select count(*) from mall_wechat_followers
|
|
|
+ WHERE 1=1
|
|
|
+ <if test="name != null and name.trim() != ''">
|
|
|
+ AND name LIKE concat('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="queryMonthlyWechatFollowers" resultType="com.kmall.admin.entity.WechatFollowersEntity">
|
|
|
+ SELECT
|
|
|
+ sum(mwf.wechat_followers) wechatFollowers,
|
|
|
+ DATE_FORMAT(mwf.create_time,'%Y-%m') as yearAndMonth
|
|
|
+ FROM
|
|
|
+ mall_wechat_followers mwf
|
|
|
+ <where>
|
|
|
+ DATE_FORMAT(mwf.create_time,'%Y-%m') >= #{startMonth}
|
|
|
+ AND DATE_FORMAT(mwf.create_time,'%Y-%m') <= #{endMonth}
|
|
|
+ <if test="merchSn != null">
|
|
|
+ and m.merch_sn = #{merchSn}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by DATE_FORMAT(mwf.create_time,'%Y-%m')
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="save" parameterType="com.kmall.admin.entity.WechatFollowersEntity">
|
|
|
+ insert into mall_wechat_followers(
|
|
|
+ `id`,
|
|
|
+ `merch_sn`,
|
|
|
+ `wechat_followers`,
|
|
|
+ `creater_sn`,
|
|
|
+ `create_time`,
|
|
|
+ `moder_sn`,
|
|
|
+ `mod_time`,
|
|
|
+ `tstm`)
|
|
|
+ values(
|
|
|
+ #{id},
|
|
|
+ #{merchSn},
|
|
|
+ #{wechatFollowers},
|
|
|
+ #{createrSn},
|
|
|
+ #{createTime},
|
|
|
+ #{moderSn},
|
|
|
+ #{modTime},
|
|
|
+ #{tstm})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="update" parameterType="com.kmall.admin.entity.WechatFollowersEntity">
|
|
|
+ update mall_wechat_followers
|
|
|
+ <set>
|
|
|
+ <if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
|
|
|
+ <if test="wechatFollowers != null">`wechat_followers` = #{wechatFollowers}, </if>
|
|
|
+ <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
|
|
|
+ <if test="createTime != null">`create_time` = #{createTime}, </if>
|
|
|
+ <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
|
|
|
+ <if test="modTime != null">`mod_time` = #{modTime}, </if>
|
|
|
+ <if test="tstm != null">`tstm` = #{tstm}</if>
|
|
|
+ </set>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="delete">
|
|
|
+ delete from mall_wechat_followers where id = #{value}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteBatch">
|
|
|
+ delete from mall_wechat_followers where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+</mapper>
|