| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513 |
- <?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.goafanti.common.dao.UserLockReleaseMapper">
- <resultMap id="BaseResultMap" type="com.goafanti.common.model.UserLockRelease">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon May 07 09:56:32 CST 2018.
- -->
- <id column="id" jdbcType="VARCHAR" property="id" />
- <result column="type" jdbcType="INTEGER" property="type" />
- <result column="uid" jdbcType="VARCHAR" property="uid" />
- <result column="aid" jdbcType="VARCHAR" property="aid" />
- <result column="business_project_id" jdbcType="VARCHAR" property="businessProjectId" />
- <result column="status" jdbcType="INTEGER" property="status" />
- <result column="lock_time" jdbcType="DATE" property="lockTime" />
- <result column="release_time" jdbcType="DATE" property="releaseTime" />
- <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
- </resultMap>
- <sql id="Example_Where_Clause">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon May 07 09:56:32 CST 2018.
- -->
- <where>
- <foreach collection="oredCriteria" item="criteria" separator="or">
- <if test="criteria.valid">
- <trim prefix="(" prefixOverrides="and" suffix=")">
- <foreach collection="criteria.criteria" item="criterion">
- <choose>
- <when test="criterion.noValue">
- and ${criterion.condition}
- </when>
- <when test="criterion.singleValue">
- and ${criterion.condition} #{criterion.value}
- </when>
- <when test="criterion.betweenValue">
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
- </when>
- <when test="criterion.listValue">
- and ${criterion.condition}
- <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </when>
- </choose>
- </foreach>
- </trim>
- </if>
- </foreach>
- </where>
- </sql>
- <sql id="Update_By_Example_Where_Clause">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon May 07 09:56:32 CST 2018.
- -->
- <where>
- <foreach collection="example.oredCriteria" item="criteria" separator="or">
- <if test="criteria.valid">
- <trim prefix="(" prefixOverrides="and" suffix=")">
- <foreach collection="criteria.criteria" item="criterion">
- <choose>
- <when test="criterion.noValue">
- and ${criterion.condition}
- </when>
- <when test="criterion.singleValue">
- and ${criterion.condition} #{criterion.value}
- </when>
- <when test="criterion.betweenValue">
- and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
- </when>
- <when test="criterion.listValue">
- and ${criterion.condition}
- <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
- #{listItem}
- </foreach>
- </when>
- </choose>
- </foreach>
- </trim>
- </if>
- </foreach>
- </where>
- </sql>
- <sql id="Base_Column_List">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon May 07 09:56:32 CST 2018.
- -->
- id, type, uid, aid, business_project_id, status, lock_time, release_time, order_no
- </sql>
- <select id="selectByExample" parameterType="com.goafanti.common.model.UserLockReleaseExample" resultMap="BaseResultMap">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon May 07 09:56:32 CST 2018.
- -->
- select
- <if test="distinct">
- distinct
- </if>
- <include refid="Base_Column_List" />
- from user_lock_release
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- <if test="orderByClause != null">
- order by ${orderByClause}
- </if>
- </select>
- <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon May 07 09:56:32 CST 2018.
- -->
- select
- <include refid="Base_Column_List" />
- from user_lock_release
- where id = #{id,jdbcType=VARCHAR}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon May 07 09:56:32 CST 2018.
- -->
- delete from user_lock_release
- where id = #{id,jdbcType=VARCHAR}
- </delete>
- <delete id="deleteByExample" parameterType="com.goafanti.common.model.UserLockReleaseExample">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon May 07 09:56:32 CST 2018.
- -->
- delete from user_lock_release
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- </delete>
- <insert id="insert" parameterType="com.goafanti.common.model.UserLockRelease">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon May 07 09:56:32 CST 2018.
- -->
- insert into user_lock_release (id, type, uid,
- aid, business_project_id, status,
- lock_time, release_time, order_no
- )
- values (#{id,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{uid,jdbcType=VARCHAR},
- #{aid,jdbcType=VARCHAR}, #{businessProjectId,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
- #{lockTime,jdbcType=DATE}, #{releaseTime,jdbcType=DATE}, #{orderNo,jdbcType=VARCHAR}
- )
- </insert>
- <insert id="insertSelective" parameterType="com.goafanti.common.model.UserLockRelease">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon May 07 09:56:32 CST 2018.
- -->
- insert into user_lock_release
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">
- id,
- </if>
- <if test="type != null">
- type,
- </if>
- <if test="uid != null">
- uid,
- </if>
- <if test="aid != null">
- aid,
- </if>
- <if test="businessProjectId != null">
- business_project_id,
- </if>
- <if test="status != null">
- status,
- </if>
- <if test="lockTime != null">
- lock_time,
- </if>
- <if test="releaseTime != null">
- release_time,
- </if>
- <if test="orderNo != null">
- order_no,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">
- #{id,jdbcType=VARCHAR},
- </if>
- <if test="type != null">
- #{type,jdbcType=INTEGER},
- </if>
- <if test="uid != null">
- #{uid,jdbcType=VARCHAR},
- </if>
- <if test="aid != null">
- #{aid,jdbcType=VARCHAR},
- </if>
- <if test="businessProjectId != null">
- #{businessProjectId,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- #{status,jdbcType=INTEGER},
- </if>
- <if test="lockTime != null">
- #{lockTime,jdbcType=DATE},
- </if>
- <if test="releaseTime != null">
- #{releaseTime,jdbcType=DATE},
- </if>
- <if test="orderNo != null">
- #{orderNo,jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- <select id="countByExample" parameterType="com.goafanti.common.model.UserLockReleaseExample" resultType="java.lang.Long">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon May 07 09:56:32 CST 2018.
- -->
- select count(*) from user_lock_release
- <if test="_parameter != null">
- <include refid="Example_Where_Clause" />
- </if>
- </select>
- <update id="updateByExampleSelective" parameterType="map">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon May 07 09:56:32 CST 2018.
- -->
- update user_lock_release
- <set>
- <if test="record.id != null">
- id = #{record.id,jdbcType=VARCHAR},
- </if>
- <if test="record.type != null">
- type = #{record.type,jdbcType=INTEGER},
- </if>
- <if test="record.uid != null">
- uid = #{record.uid,jdbcType=VARCHAR},
- </if>
- <if test="record.aid != null">
- aid = #{record.aid,jdbcType=VARCHAR},
- </if>
- <if test="record.businessProjectId != null">
- business_project_id = #{record.businessProjectId,jdbcType=VARCHAR},
- </if>
- <if test="record.status != null">
- status = #{record.status,jdbcType=INTEGER},
- </if>
- <if test="record.lockTime != null">
- lock_time = #{record.lockTime,jdbcType=DATE},
- </if>
- <if test="record.releaseTime != null">
- release_time = #{record.releaseTime,jdbcType=DATE},
- </if>
- <if test="record.orderNo != null">
- order_no = #{record.orderNo,jdbcType=VARCHAR},
- </if>
- </set>
- <if test="_parameter != null">
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <update id="updateByExample" parameterType="map">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon May 07 09:56:32 CST 2018.
- -->
- update user_lock_release
- set id = #{record.id,jdbcType=VARCHAR},
- type = #{record.type,jdbcType=INTEGER},
- uid = #{record.uid,jdbcType=VARCHAR},
- aid = #{record.aid,jdbcType=VARCHAR},
- business_project_id = #{record.businessProjectId,jdbcType=VARCHAR},
- status = #{record.status,jdbcType=INTEGER},
- lock_time = #{record.lockTime,jdbcType=DATE},
- release_time = #{record.releaseTime,jdbcType=DATE},
- order_no = #{record.orderNo,jdbcType=VARCHAR}
- <if test="_parameter != null">
- <include refid="Update_By_Example_Where_Clause" />
- </if>
- </update>
- <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.UserLockRelease">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon May 07 09:56:32 CST 2018.
- -->
- update user_lock_release
- <set>
- <if test="type != null">
- type = #{type,jdbcType=INTEGER},
- </if>
- <if test="uid != null">
- uid = #{uid,jdbcType=VARCHAR},
- </if>
- <if test="aid != null">
- aid = #{aid,jdbcType=VARCHAR},
- </if>
- <if test="businessProjectId != null">
- business_project_id = #{businessProjectId,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- status = #{status,jdbcType=INTEGER},
- </if>
- <if test="lockTime != null">
- lock_time = #{lockTime,jdbcType=DATE},
- </if>
- <if test="releaseTime != null">
- release_time = #{releaseTime,jdbcType=DATE},
- </if>
- <if test="orderNo != null">
- order_no = #{orderNo,jdbcType=VARCHAR},
- </if>
- </set>
- where id = #{id,jdbcType=VARCHAR}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.UserLockRelease">
- <!--
- WARNING - @mbg.generated
- This element is automatically generated by MyBatis Generator, do not modify.
- This element was generated on Mon May 07 09:56:32 CST 2018.
- -->
- update user_lock_release
- set type = #{type,jdbcType=INTEGER},
- uid = #{uid,jdbcType=VARCHAR},
- aid = #{aid,jdbcType=VARCHAR},
- business_project_id = #{businessProjectId,jdbcType=VARCHAR},
- status = #{status,jdbcType=INTEGER},
- lock_time = #{lockTime,jdbcType=DATE},
- release_time = #{releaseTime,jdbcType=DATE},
- order_no = #{orderNo,jdbcType=VARCHAR}
- where id = #{id,jdbcType=VARCHAR}
- </update>
- <delete id="deleteLockByOrder">
- delete from user_lock_release where order_no = #{orderNo,jdbcType=VARCHAR} and business_project_id = #{businessProjectId,jdbcType=VARCHAR}
- </delete>
- <update id="updateUserLock">
- update user_lock_release set status = #{newStatus} where uid = #{uid} and aid = #{aid} and type = 0 and status = #{oldStatus}
- </update>
-
- <update id="updateUsersLock">
- update user_lock_release set status = #{newStatus}
- where aid = #{aid} and type = 0 and status = #{oldStatus}
- and uid in
- <foreach item="item" collection="uList" separator="," open="(" close=")" index="">
- #{item}
- </foreach>
- </update>
-
- <update id="updateUserTypeLock">
- update user_lock_release set status = #{newStatus} , release_time= #{date}
- where uid = #{uid} and aid = #{aid} and type = 0 and type = #{type}
- </update>
-
- <update id="updateUserTypeLockList">
- update user_lock_release set status = #{newStatus} , release_time= #{date}
- where aid = #{aid} and type = 0 and type = #{type} and uid in
- <foreach item="item" collection="list" separator="," open="(" close=")" index="">
- #{item}
- </foreach>
- </update>
-
- <select id="selectWaitReleaseCustomer" resultType="com.goafanti.customer.bo.LockingReleaseBo">
- select
- t0.id,
- t0.uid,
- t0.aid,
- t0.lock_time,
- t1.last_follow_time
- from
- (select id,uid,aid,lock_time from user_lock_release where aid = #{aid} and type = 0 and status = 0)t0
- left join
- (select uid,aid,max(create_time) as last_follow_time from user_follow where aid = #{aid} group by uid)t1
- on t0.uid = t1.uid
- where datediff(now(),if(t0.lock_time < t1.last_follow_time,t1.last_follow_time,t1.t0.lock_time))>30 or datediff(now(),t0.lock_time)>270
- </select>
-
- <select id="selectWaitReleaseBusiness" resultType="com.goafanti.customer.bo.LockingReleaseBo">
- select
- t0.id,
- t0.uid,
- t0.aid,
- t0.lock_time,
- t1.last_follow_time
- from
- (select id,uid,aid,lock_time from user_lock_release t0 where aid = #{aid} and type = 1 and status = 0)t0
- left join
- (select uid,aid,max(create_time) as last_follow_time from user_follow where aid = #{aid} group by uid)t1
- on t0.uid = t1.uid
- where datediff(t1.last_follow_time,lock_time)>360 or datediff(now(),t0.lock_time)>900
- </select>
-
- <update id="updateReleaseLock" parameterType="java.lang.String">
- update user_lock_release set status = 2,release_time = #{time} where status=1
- </update>
-
- <update id="updatePendingReleaseLock" parameterType="java.lang.String">
- update user_lock_release set status = 1 where id in (${lockIds})
- </update>
-
- <select id="selectPendinglockUserList" resultType="com.goafanti.customer.bo.LockingReleaseBo">
- select id,uid,type from user_lock_release where status=1
- </select>
-
- <update id="updateProject" parameterType="java.lang.String">
- update user_lock_release set status = 2,release_time=now()
- where uid= #{uid,jdbcType=VARCHAR}
- and aid= #{aid,jdbcType=VARCHAR}
- and business_project_id= #{businessProjectId,jdbcType=VARCHAR}
- </update>
- <select id="checkTask" resultType="com.goafanti.customer.bo.LockingReleaseBo">
- select
- id, type, uid, aid, business_project_id as businessProjectId, status
- from user_lock_release where type =1
- and status=0
- and uid=#{buyerId,jdbcType=VARCHAR}
- and business_project_id=#{commodityId,jdbcType=VARCHAR}
- </select>
- <update id="updatePrivateBusinessTransfer">
- update user_lock_release set aid=#{inputId} where uid= #{uid} and business_project_id= #{pid} and aid= #{aid};
- </update>
-
- <select id="checkUserProject" resultType="com.goafanti.customer.bo.LockingReleaseBo">
- select
- id, type, uid, aid, business_project_id as businessProjectId, status
- from user_lock_release where type =1
- and status=0
- and uid=#{uid,jdbcType=VARCHAR}
- and aid=#{aid,jdbcType=VARCHAR}
- and business_project_id=#{pid,jdbcType=VARCHAR}
- </select>
-
- <select id="selectUserDays" resultType="com.goafanti.common.bo.userDaysBo">
-
- select
- t0.uid,
- t0.aid,
- u.nickname name
- from
- (select id,uid,aid,lock_time from user_lock_release where aid = #{aid} and type = 0 and status = 0)t0
- left join
- (select uid,aid,max(create_time) as last_follow_time from user_follow where aid = #{aid} group by uid)t1
- on t0.uid = t1.uid
- left join user u on t0.uid=u.id
- where datediff(now(),if(t0.lock_time < t1.last_follow_time,t1.last_follow_time,t1.t0.lock_time))> #{x} or datediff(now(),t0.lock_time)> #{y}
-
- </select>
-
-
- <insert id="insertUserMid">
- insert into user_mid (uid,aid,last_sign_time,last_follow_time,create_time)
- values (#{uid},#{aid},#{lockTime},#{followTime},now())
- </insert>
- <update id="updateUserMid" >
- update user_mid
- set last_sign_time=#{lockTime},last_follow_time=#{followTime}
- where uid=#{uid} and aid=#{aid}
- </update>
-
- <insert id="insertList" >
- insert into user_lock_release (id, type, uid,
- aid, business_project_id, status,
- lock_time, release_time, order_no
- )
- values
- <foreach item="item" collection="list" separator="," index="">
- (#{item.id,jdbcType=VARCHAR}, #{item.type,jdbcType=INTEGER}, #{item.uid,jdbcType=VARCHAR},
- #{item.aid,jdbcType=VARCHAR}, #{item.businessProjectId,jdbcType=VARCHAR}, #{item.status,jdbcType=INTEGER},
- #{item.lockTime,jdbcType=DATE}, #{item.releaseTime,jdbcType=DATE}, #{item.orderNo,jdbcType=VARCHAR})
- </foreach>
- </insert>
-
- <select id="checkLock" resultType="java.lang.Integer">
- select count(*) from user_lock_release
- where aid= #{aid} and uid= #{uid} and business_project_id = #{pid}
- </select>
-
- <update id="updateReleaseList" >
- update user_lock_release
- set release_time =now(),status =2
- where id in
- <foreach item="item" collection="list" separator="," open="(" close=")" index="">
- #{item}
- </foreach>
- </update>
- <select id="selectByUidGetCount" resultType="java.lang.Integer">
- select count(*) from user_lock_release
- where `type` =1 and aid = #{aid} and uid= #{uid}
- </select>
- <update id="updateReleaseUser">
- update t_order_new a ,user b ,user_business c
- set b.share_type =1,b.transfer_time =now(),
- c.customer_status =6,c.follow_situation =8
- where a.order_no = #{orderNo} and a.buyer_id =b.id
- and a.buyer_id =c.uid and a.salesman_id =c.aid and c.follow_situation =5
- </update>
- </mapper>
|