<?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.UserCloudOrderMapper">
|
<resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.user.cloud.UserCloudOrder">
|
<id column="crd_id" property="id" jdbcType="BIGINT"/>
|
<result column="crd_uid" property="uid" jdbcType="BIGINT"/>
|
<result column="crd_money" property="money" jdbcType="DECIMAL"/>
|
<result column="crd_state" property="state" jdbcType="BOOLEAN"/>
|
<result column="crd_desc" property="desc" jdbcType="VARCHAR"/>
|
<result column="crd_create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
<result column="crd_update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
<result column="crd_type" property="type" typeHandler="com.yeshi.fanli.util.mybatishandler.CloudOrderMenuEnumHandler"/>
|
</resultMap>
|
<sql id="Base_Column_List">crd_id,crd_uid,crd_money,crd_type,crd_state,crd_desc,crd_create_time,crd_update_time</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
|
<include refid="Base_Column_List"/>from yeshi_ec_user_cloud_order where crd_id = #{id,jdbcType=BIGINT}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_cloud_order where crd_id = #{id,jdbcType=BIGINT}</delete>
|
<insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.cloud.UserCloudOrder" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_cloud_order (crd_id,crd_uid,crd_money,crd_type,crd_state,crd_desc,crd_create_time,crd_update_time) values (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{type,jdbcType=VARCHAR},#{state,jdbcType=BOOLEAN},#{desc,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
|
<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.cloud.UserCloudOrder" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_cloud_order
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">crd_id,</if>
|
<if test="uid != null">crd_uid,</if>
|
<if test="money != null">crd_money,</if>
|
<if test="type != null">crd_type,</if>
|
<if test="state != null">crd_state,</if>
|
<if test="desc != null">crd_desc,</if>
|
<if test="createTime != null">crd_create_time,</if>
|
<if test="updateTime != null">crd_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="money != null">#{money,jdbcType=DECIMAL},</if>
|
<if test="type != null">#{type,jdbcType=VARCHAR},</if>
|
<if test="state != null">#{state,jdbcType=BOOLEAN},</if>
|
<if test="desc != null">#{desc,jdbcType=VARCHAR},</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.UserCloudOrder">update yeshi_ec_user_cloud_order set crd_uid = #{uid,jdbcType=BIGINT},crd_money = #{money,jdbcType=DECIMAL},crd_type = #{type,jdbcType=VARCHAR},crd_state = #{state,jdbcType=BOOLEAN},crd_desc = #{desc,jdbcType=VARCHAR},crd_create_time = #{createTime,jdbcType=TIMESTAMP},crd_update_time = #{updateTime,jdbcType=TIMESTAMP} where crd_id = #{id,jdbcType=BIGINT}</update>
|
<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.cloud.UserCloudOrder">update yeshi_ec_user_cloud_order
|
<set>
|
<if test="uid != null">crd_uid=#{uid,jdbcType=BIGINT},</if>
|
<if test="money != null">crd_money=#{money,jdbcType=DECIMAL},</if>
|
<if test="type != null">crd_type=#{type,jdbcType=VARCHAR},</if>
|
<if test="state != null">crd_state=#{state,jdbcType=BOOLEAN},</if>
|
<if test="desc != null">crd_desc=#{desc,jdbcType=VARCHAR},</if>
|
<if test="createTime != null">crd_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">crd_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
</set> where crd_id = #{id,jdbcType=BIGINT}
|
</update>
|
|
<select id="selectForUpdate" resultMap="BaseResultMap" parameterType="java.lang.Long">
|
SELECT * from yeshi_ec_user_cloud_order where crd_id = #{id,jdbcType=BIGINT} FOR UPDATE
|
</select>
|
|
|
<select id="getLastOrderByPayEnd" resultMap="BaseResultMap">
|
SELECT * FROM yeshi_ec_user_cloud_order d
|
WHERE d.`crd_uid` = #{uid} AND d.`crd_type` = #{type} AND crd_state = 1
|
ORDER BY d.`crd_id` DESC
|
LIMIT 1
|
</select>
|
|
<select id="getLastOrderByUnpaid" resultMap="BaseResultMap">
|
SELECT <include refid="Base_Column_List"/> FROM yeshi_ec_user_cloud_order d
|
WHERE d.`crd_uid` = #{uid} AND d.`crd_type` = #{type} AND crd_state = 0
|
ORDER BY d.`crd_id` DESC
|
LIMIT 1
|
</select>
|
|
<select id="getOrderRecord" resultMap="BaseResultMap">
|
SELECT * FROM yeshi_ec_user_cloud_order d
|
WHERE d.`crd_uid` = #{uid} <if test="state != null">and d.crd_state = #{state}</if>
|
ORDER BY d.`crd_id` DESC
|
LIMIT #{start},#{count}
|
</select>
|
|
<select id="countOrderRecord" resultType="Long">
|
SELECT count(d.`crd_id`) FROM yeshi_ec_user_cloud_order d
|
WHERE d.`crd_uid` = #{uid} <if test="state != null">and d.crd_state = #{state}</if>
|
</select>
|
|
<select id="getLasthourByUnpaid" resultMap="BaseResultMap">
|
SELECT * FROM yeshi_ec_user_cloud_order
|
WHERE crd_state = 0 AND crd_update_time > DATE_SUB(NOW(),INTERVAL 1 HOUR)
|
</select>
|
|
|
<select id="query" resultMap="BaseResultMap">
|
SELECT * FROM yeshi_ec_user_cloud_order d
|
WHERE 1=1
|
<if test="key != null and key !=''"> AND d.`crd_uid` LIKE '%#{key}%' </if>
|
<if test="state != null">AND d.crd_state = #{state}</if>
|
ORDER BY d.`crd_id` DESC
|
LIMIT #{start},#{count}
|
</select>
|
|
<select id="count" resultType="Long">
|
SELECT count(d.`crd_id`) FROM yeshi_ec_user_cloud_order d
|
WHERE 1=1
|
<if test="key != null and key !='' "> AND d.`crd_uid` LIKE '%#{key}%' </if>
|
<if test="state != null">AND d.crd_state = #{state}</if>
|
</select>
|
|
</mapper>
|