<?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.user.cloud.UserCloudMapper">
|
<resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.cloud.UserCloud">
|
<id column="uc_id" property="id" jdbcType="BIGINT"/>
|
<result column="uc_uid" property="uid" jdbcType="BIGINT"/>
|
<result column="uc_order_id" property="orderId" jdbcType="BIGINT"/>
|
<result column="uc_group_num" property="groupNum" jdbcType="INTEGER"/>
|
<result column="uc_start_time" property="startTime" jdbcType="TIMESTAMP"/>
|
<result column="uc_end_time" property="endTime" jdbcType="TIMESTAMP"/>
|
<result column="uc_wx_id" property="wxId" jdbcType="VARCHAR"/>
|
<result column="uc_wx_name" property="wxName" jdbcType="VARCHAR"/>
|
<result column="uc_wx_portrait" property="wxPortrait" jdbcType="VARCHAR"/>
|
<result column="uc_robot_id" property="robotId" jdbcType="INTEGER"/>
|
<result column="uc_robot_type" property="robotType" jdbcType="INTEGER"/>
|
<result column="uc_create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
<result column="uc_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
</resultMap>
|
<sql id="Base_Column_List">uc_id,uc_uid,uc_order_id,uc_group_num,uc_start_time,uc_end_time,uc_wx_id,uc_wx_name,uc_wx_portrait,uc_robot_id,uc_robot_type,uc_create_time,uc_update_time</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
|
<include refid="Base_Column_List"/>from yeshi_ec_user_cloud where uc_id = #{id,jdbcType=BIGINT}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_cloud where uc_id = #{id,jdbcType=BIGINT}</delete>
|
<insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.cloud.UserCloud" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_cloud (uc_id,uc_uid,uc_order_id,uc_group_num,uc_start_time,uc_end_time,uc_wx_id,uc_wx_name,uc_wx_portrait,uc_robot_id,uc_robot_type,uc_create_time,uc_update_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{orderId,jdbcType=BIGINT},#{groupNum,jdbcType=INTEGER},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{wxId,jdbcType=VARCHAR},#{wxName,jdbcType=VARCHAR},#{wxPortrait,jdbcType=VARCHAR},#{robotId,jdbcType=INTEGER},#{robotType,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
|
<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.cloud.UserCloud" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_cloud
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">uc_id,</if>
|
<if test="uid != null">uc_uid,</if>
|
<if test="orderId != null">uc_order_id,</if>
|
<if test="groupNum != null">uc_group_num,</if>
|
<if test="startTime != null">uc_start_time,</if>
|
<if test="endTime != null">uc_end_time,</if>
|
<if test="wxId != null">uc_wx_id,</if>
|
<if test="wxName != null">uc_wx_name,</if>
|
<if test="wxPortrait != null">uc_wx_portrait,</if>
|
<if test="robotId != null">uc_robot_id,</if>
|
<if test="robotType != null">uc_robot_type,</if>
|
<if test="createTime != null">uc_create_time,</if>
|
<if test="updateTime != null">uc_update_time,</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="orderId != null">#{orderId,jdbcType=BIGINT},</if>
|
<if test="groupNum != null">#{groupNum,jdbcType=INTEGER},</if>
|
<if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if>
|
<if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if>
|
<if test="wxId != null">#{wxId,jdbcType=VARCHAR},</if>
|
<if test="wxName != null">#{wxName,jdbcType=VARCHAR},</if>
|
<if test="wxPortrait != null">#{wxPortrait,jdbcType=VARCHAR},</if>
|
<if test="robotId != null">#{robotId,jdbcType=INTEGER},</if>
|
<if test="robotType != null">#{robotType,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.user.cloud.UserCloud">update yeshi_ec_user_cloud set uc_uid = #{uid,jdbcType=BIGINT},uc_order_id = #{orderId,jdbcType=BIGINT},uc_group_num = #{groupNum,jdbcType=INTEGER},uc_start_time = #{startTime,jdbcType=TIMESTAMP},uc_end_time = #{endTime,jdbcType=TIMESTAMP},uc_wx_id = #{wxId,jdbcType=VARCHAR},uc_wx_name = #{wxName,jdbcType=VARCHAR},uc_wx_portrait = #{wxPortrait,jdbcType=VARCHAR},uc_robot_id = #{robotId,jdbcType=INTEGER},uc_robot_type = #{robotType,jdbcType=INTEGER},uc_create_time = #{createTime,jdbcType=TIMESTAMP},uc_update_time = #{updateTime,jdbcType=TIMESTAMP} where uc_id = #{id,jdbcType=BIGINT}</update>
|
<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.cloud.UserCloud">update yeshi_ec_user_cloud
|
<set>
|
<if test="uid != null">uc_uid=#{uid,jdbcType=BIGINT},</if>
|
<if test="orderId != null">uc_order_id=#{orderId,jdbcType=BIGINT},</if>
|
<if test="groupNum != null">uc_group_num=#{groupNum,jdbcType=INTEGER},</if>
|
<if test="startTime != null">uc_start_time=#{startTime,jdbcType=TIMESTAMP},</if>
|
<if test="endTime != null">uc_end_time=#{endTime,jdbcType=TIMESTAMP},</if>
|
<if test="wxId != null">uc_wx_id=#{wxId,jdbcType=VARCHAR},</if>
|
<if test="wxName != null">uc_wx_name=#{wxName,jdbcType=VARCHAR},</if>
|
<if test="wxPortrait != null">uc_wx_portrait=#{wxPortrait,jdbcType=VARCHAR},</if>
|
<if test="robotId != null">uc_robot_id=#{robotId,jdbcType=INTEGER},</if>
|
<if test="robotType != null">uc_robot_type=#{robotType,jdbcType=INTEGER},</if>
|
<if test="createTime != null">uc_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">uc_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
</set> where uc_id = #{id,jdbcType=BIGINT}
|
</update>
|
|
<select id="getLastByUid" resultMap="BaseResultMap">
|
SELECT * FROM yeshi_ec_user_cloud d
|
WHERE d.`uc_uid` = #{uid}
|
ORDER BY d.uc_id DESC
|
LIMIT 1
|
</select>
|
|
<select id="getValidByUid" resultMap="BaseResultMap">
|
SELECT * FROM yeshi_ec_user_cloud d
|
WHERE d.`uc_uid` = #{uid} AND d.`uc_end_time` > NOW()
|
LIMIT 1
|
</select>
|
|
<select id="countByUid" resultType="Long">
|
SELECT COUNT(uc_id) FROM yeshi_ec_user_cloud d
|
WHERE d.`uc_uid` = #{uid}
|
</select>
|
|
<select id="getByOrderId" resultMap="BaseResultMap">
|
SELECT * FROM yeshi_ec_user_cloud d
|
WHERE d.`uc_order_id` = #{orderId}
|
</select>
|
|
|
<select id="listValidUid" resultType="Long">
|
SELECT * FROM (SELECT DISTINCT d.`uc_uid` FROM yeshi_ec_user_cloud d
|
WHERE d.`uc_end_time` > NOW() AND d.uc_wx_id IS NOT NULL)A
|
LIMIT #{start},{count}
|
</select>
|
|
<select id="query" resultMap="BaseResultMap">
|
SELECT * FROM yeshi_ec_user_cloud d
|
WHERE 1=1
|
<if test="key != null and key !=''"> AND d.`uc_uid` LIKE '%#{key}%' </if>
|
<if test="state == 0">AND d.`uc_end_time`<![CDATA[<=]]>NOW()</if>
|
<if test="state == 1">AND d.`uc_end_time` > NOW()</if>
|
ORDER BY d.`uc_id` DESC
|
LIMIT #{start},#{count}
|
</select>
|
|
<select id="count" resultType="Long">
|
SELECT count(d.`uc_id`) FROM yeshi_ec_user_cloud d
|
WHERE 1=1
|
<if test="key != null and key !=''"> AND d.`uc_uid` LIKE '%#{key}%' </if>
|
<if test="state == 0">AND d.`uc_end_time`<![CDATA[<=]]>NOW()</if>
|
<if test="state == 1">AND d.`uc_end_time` > NOW()</if>
|
</select>
|
|
|
</mapper>
|