| | |
| | | <?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.yeshi.fanli.dao.mybatis.share.UserShareGoodsRecordMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.share.UserShareGoodsRecord"> |
| | | <id column="sgr_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="sgr_uid" property="uid" jdbcType="BIGINT"/> |
| | | <result column="sgr_source" property="source" |
| | | typeHandler="com.yeshi.fanli.util.mybatishandler.ShareSourceTypeEnumHandler"/> |
| | | <result column="sgr_picture" property="picture" jdbcType="VARCHAR"/> |
| | | <result column="sgr_title" property="title" jdbcType="VARCHAR"/> |
| | | <result column="sgr_share_state" property="shareState" jdbcType="INTEGER"/> |
| | | <result column="sgr_createtime" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="sgr_updatetime" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="CountRecordMap" type="com.yeshi.fanli.entity.bus.share.UserShareGoodsRecord"> |
| | | <id column="sgr_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="totalGoods" property="totalGoods" jdbcType="INTEGER"/> |
| | | <result column="todayBrowse" property="todayBrowse" jdbcType="INTEGER"/> |
| | | <result column="totalBrowse" property="totalBrowse" jdbcType="INTEGER"/> |
| | | <result column="totalOrder" property="totalOrder" jdbcType="INTEGER"/> |
| | | <result column="totalMoney" property="totalMoney" jdbcType="DECIMAL"/> |
| | | <result column="revenueMoney" property="revenueMoney" jdbcType="DECIMAL"/> |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">sgr_id,sgr_uid,sgr_source,sgr_picture,sgr_title,sgr_share_state,sgr_createtime,sgr_updatetime</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_share_goods_record where sgr_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_share_goods_record where sgr_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.share.UserShareGoodsRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_share_goods_record (sgr_id,sgr_uid,sgr_source,sgr_picture,sgr_title,sgr_share_state,sgr_createtime,sgr_updatetime) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{source,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{sgr_title,jdbcType=VARCHAR},#{shareState,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.share.UserShareGoodsRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_share_goods_record |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">sgr_id,</if> |
| | | <if test="uid != null">sgr_uid,</if> |
| | | <if test="source != null">sgr_source,</if> |
| | | <if test="picture != null">sgr_picture,</if> |
| | | <if test="title != null">sgr_title,</if> |
| | | <if test="shareState != null">sgr_share_state,</if> |
| | | <if test="createTime != null">sgr_createtime,</if> |
| | | <if test="updateTime != null">sgr_updatetime,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if> |
| | | <if test="source != null">#{source,jdbcType=VARCHAR},</if> |
| | | <if test="picture != null">#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="title != null">#{title,jdbcType=VARCHAR},</if> |
| | | <if test="shareState != null">#{shareState,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.share.UserShareGoodsRecord">update yeshi_ec_share_goods_record set sgr_uid = #{uid,jdbcType=BIGINT},sgr_source = #{source,jdbcType=VARCHAR},sgr_picture = #{picture,jdbcType=VARCHAR},sgr_title = #{title,jdbcType=VARCHAR},sgr_share_state = #{shareState,jdbcType=INTEGER},sgr_createtime = #{createTime,jdbcType=TIMESTAMP},sgr_updatetime = #{updateTime,jdbcType=TIMESTAMP} where sgr_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.share.UserShareGoodsRecord">update yeshi_ec_share_goods_record |
| | | <set> |
| | | <if test="uid != null">sgr_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="source != null">sgr_source=#{source,jdbcType=VARCHAR},</if> |
| | | <if test="picture != null">sgr_picture=#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="title != null">sgr_title=#{title,jdbcType=VARCHAR},</if> |
| | | <if test="shareState != null">sgr_share_state=#{shareState,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">sgr_createtime=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">sgr_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where sgr_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="listQueryByUid" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_share_goods_record |
| | | WHERE sgr_uid = #{uid} AND sgr_share_state = 1 |
| | | <if test="source != null and source != '' "> |
| | | AND sgr_source = #{source} |
| | | </if> |
| | | ORDER BY sgr_updatetime DESC |
| | | LIMIT #{start},#{count} |
| | | </select> |
| | | |
| | | <select id="countQueryByUid" resultType="java.lang.Long"> |
| | | SELECT IFNULL(count(sgr_id),0) FROM yeshi_ec_share_goods_record |
| | | WHERE sgr_uid = #{uid} AND sgr_share_state = 1 |
| | | <if test="source != null and source != '' "> |
| | | AND sgr_source = #{source} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="listCountRecord" resultMap="CountRecordMap" parameterType="java.util.List"> |
| | | SELECT g.`gu_record_id`AS sgr_id, COUNT(g.`gu_id`)AS totalGoods, |
| | | IFNULL(SUM(g.`gu_total_browse`),0) AS totalBrowse, |
| | | IFNULL(SUM(g.`gu_total_order`),0)AS totalOrder, |
| | | IFNULL(CASE WHEN g.`gu_total_order` = 0 THEN SUM(g.`gu_total_money`) END, 0) AS revenueMoney , |
| | | IFNULL(SUM(CASE WHEN g.`gu_total_order` > 0 THEN g.`gu_total_money` ELSE 0 END), 0)AS totalMoney |
| | | FROM `yeshi_ec_share_goods_group` g |
| | | WHERE g.`gu_record_id` IN <foreach collection="list" item="item" open="(" close=")" |
| | | separator=",">#{item}</foreach> |
| | | GROUP BY g.`gu_record_id` |
| | | </select> |
| | | |
| | | |
| | | <select id="listCountTodayBrowse" resultMap="CountRecordMap" parameterType="java.util.List"> |
| | | SELECT g.`gu_record_id`AS sgr_id,SUM(g.`gu_today_browse`)AS todayBrowse FROM yeshi_ec_share_goods_group g |
| | | WHERE TO_DAYS(g.`gu_browse_time`) = TO_DAYS(NOW()) |
| | | AND g.`gu_record_id` IN <foreach collection="list" item="item" open="(" close=")" |
| | | separator=",">#{item}</foreach> |
| | | GROUP BY g.`gu_record_id` |
| | | </select> |
| | | |
| | | </mapper> |
| | | <?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.yeshi.fanli.dao.mybatis.share.UserShareGoodsRecordMapper">
|
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.share.UserShareGoodsRecord">
|
| | | <id column="sgr_id" property="id" jdbcType="BIGINT"/>
|
| | | <result column="sgr_uid" property="uid" jdbcType="BIGINT"/>
|
| | | <result column="sgr_source" property="source"
|
| | | typeHandler="com.yeshi.fanli.util.mybatishandler.ShareSourceTypeEnumHandler"/>
|
| | | <result column="sgr_picture" property="picture" jdbcType="VARCHAR"/>
|
| | | <result column="sgr_title" property="title" jdbcType="VARCHAR"/>
|
| | | <result column="sgr_share_state" property="shareState" jdbcType="INTEGER"/>
|
| | | <result column="sgr_createtime" property="createTime" jdbcType="TIMESTAMP"/>
|
| | | <result column="sgr_updatetime" property="updateTime" jdbcType="TIMESTAMP"/>
|
| | | </resultMap>
|
| | | |
| | | <resultMap id="CountRecordMap" type="com.yeshi.fanli.entity.bus.share.UserShareGoodsRecord">
|
| | | <id column="sgr_id" property="id" jdbcType="BIGINT"/>
|
| | | <result column="totalGoods" property="totalGoods" jdbcType="INTEGER"/>
|
| | | <result column="todayBrowse" property="todayBrowse" jdbcType="INTEGER"/>
|
| | | <result column="totalBrowse" property="totalBrowse" jdbcType="INTEGER"/>
|
| | | <result column="totalOrder" property="totalOrder" jdbcType="INTEGER"/>
|
| | | <result column="totalMoney" property="totalMoney" jdbcType="DECIMAL"/>
|
| | | <result column="revenueMoney" property="revenueMoney" jdbcType="DECIMAL"/>
|
| | | </resultMap>
|
| | | |
| | | <sql id="Base_Column_List">sgr_id,sgr_uid,sgr_source,sgr_picture,sgr_title,sgr_share_state,sgr_createtime,sgr_updatetime</sql>
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
|
| | | <include refid="Base_Column_List"/>from yeshi_ec_share_goods_record where sgr_id = #{id,jdbcType=BIGINT}
|
| | | </select>
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_share_goods_record where sgr_id = #{id,jdbcType=BIGINT}</delete>
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.share.UserShareGoodsRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_share_goods_record (sgr_id,sgr_uid,sgr_source,sgr_picture,sgr_title,sgr_share_state,sgr_createtime,sgr_updatetime) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{source,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{sgr_title,jdbcType=VARCHAR},#{shareState,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.share.UserShareGoodsRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_share_goods_record
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">sgr_id,</if>
|
| | | <if test="uid != null">sgr_uid,</if>
|
| | | <if test="source != null">sgr_source,</if>
|
| | | <if test="picture != null">sgr_picture,</if>
|
| | | <if test="title != null">sgr_title,</if>
|
| | | <if test="shareState != null">sgr_share_state,</if>
|
| | | <if test="createTime != null">sgr_createtime,</if>
|
| | | <if test="updateTime != null">sgr_updatetime,</if>
|
| | | </trim>values
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if>
|
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
|
| | | <if test="source != null">#{source,jdbcType=VARCHAR},</if>
|
| | | <if test="picture != null">#{picture,jdbcType=VARCHAR},</if>
|
| | | <if test="title != null">#{title,jdbcType=VARCHAR},</if>
|
| | | <if test="shareState != null">#{shareState,jdbcType=INTEGER},</if>
|
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | </trim>
|
| | | </insert>
|
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.share.UserShareGoodsRecord">update yeshi_ec_share_goods_record set sgr_uid = #{uid,jdbcType=BIGINT},sgr_source = #{source,jdbcType=VARCHAR},sgr_picture = #{picture,jdbcType=VARCHAR},sgr_title = #{title,jdbcType=VARCHAR},sgr_share_state = #{shareState,jdbcType=INTEGER},sgr_createtime = #{createTime,jdbcType=TIMESTAMP},sgr_updatetime = #{updateTime,jdbcType=TIMESTAMP} where sgr_id = #{id,jdbcType=BIGINT}</update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.share.UserShareGoodsRecord">update yeshi_ec_share_goods_record
|
| | | <set>
|
| | | <if test="uid != null">sgr_uid=#{uid,jdbcType=BIGINT},</if>
|
| | | <if test="source != null">sgr_source=#{source,jdbcType=VARCHAR},</if>
|
| | | <if test="picture != null">sgr_picture=#{picture,jdbcType=VARCHAR},</if>
|
| | | <if test="title != null">sgr_title=#{title,jdbcType=VARCHAR},</if>
|
| | | <if test="shareState != null">sgr_share_state=#{shareState,jdbcType=INTEGER},</if>
|
| | | <if test="createTime != null">sgr_createtime=#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">sgr_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | </set> where sgr_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | |
| | | <select id="listQueryByUid" resultMap="BaseResultMap">
|
| | | SELECT * FROM yeshi_ec_share_goods_record
|
| | | WHERE sgr_uid = #{uid} AND sgr_share_state = 1
|
| | | <if test="source != null and source != '' ">
|
| | | AND sgr_source = #{source}
|
| | | </if> |
| | | ORDER BY sgr_updatetime DESC
|
| | | LIMIT #{start},#{count}
|
| | | </select>
|
| | | |
| | | <select id="countQueryByUid" resultType="java.lang.Long">
|
| | | SELECT IFNULL(count(sgr_id),0) FROM yeshi_ec_share_goods_record |
| | | WHERE sgr_uid = #{uid} AND sgr_share_state = 1
|
| | | <if test="source != null and source != '' ">
|
| | | AND sgr_source = #{source}
|
| | | </if> |
| | | </select>
|
| | | |
| | | <select id="listCountRecord" resultMap="CountRecordMap" parameterType="java.util.List">
|
| | | SELECT g.`gu_record_id`AS sgr_id, COUNT(g.`gu_id`)AS totalGoods,
|
| | | IFNULL(SUM(g.`gu_total_browse`),0) AS totalBrowse,
|
| | | IFNULL(SUM(g.`gu_total_order`),0)AS totalOrder,
|
| | | IFNULL(CASE WHEN g.`gu_total_order` = 0 THEN SUM(g.`gu_total_money`) END, 0) AS revenueMoney ,
|
| | | IFNULL(SUM(CASE WHEN g.`gu_total_order` > 0 THEN g.`gu_total_money` ELSE 0 END), 0)AS totalMoney
|
| | | FROM `yeshi_ec_share_goods_group` g |
| | | WHERE g.`gu_record_id` IN <foreach collection="list" item="item" open="(" close=")"
|
| | | separator=",">#{item}</foreach>
|
| | | GROUP BY g.`gu_record_id`
|
| | | </select>
|
| | | |
| | | |
| | | <select id="listCountTodayBrowse" resultMap="CountRecordMap" parameterType="java.util.List">
|
| | | SELECT g.`gu_record_id`AS sgr_id, IFNULL(SUM(g.`gu_today_browse`),0)AS todayBrowse FROM yeshi_ec_share_goods_group g
|
| | | WHERE TO_DAYS(g.`gu_browse_time`) = TO_DAYS(NOW()) |
| | | AND g.`gu_record_id` IN <foreach collection="list" item="item" open="(" close=")"
|
| | | separator=",">#{item}</foreach>
|
| | | GROUP BY g.`gu_record_id`
|
| | | </select>
|
| | | |
| | | </mapper>
|