| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435 |
- <?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.sqx.modules.app.dao.UserDao">
- <select id="selectUserPage" resultType="com.sqx.modules.app.entity.UserEntity">
- select * from tb_user
- where 1=1
- <if test="search!=null and search!=''">
- and (user_id=#{search} or phone = #{search} or user_name =#{search} )
- </if>
- <if test="sex!=null and sex!=0">
- and sex=#{sex}
- </if>
- <if test="platform!=null and platform!=''">
- and platform=#{platform}
- </if>
- <if test="sysPhone!=null and sysPhone!=''">
- and sys_phone=#{sysPhone}
- </if>
- <if test="type!=null and type!=''">
- <if test="type==1">
- and (open_id is not null or wx_open_id is not null)
- </if>
- <if test="type==2">
- and (rider_open_id is not null or rider_wx_open_id is not null)
- </if>
- </if>
- <if test="status!=null and status!=0">
- and status=#{status}
- </if>
- <if test="userName!=null and userName!=''">
- and user_name = #{userName}
- </if>
- <if test="nickName!=null and nickName!=''">
- and nick_name = #{nickName}
- </if>
- <if test="isVip!=null">
- and is_vip = #{isVip}
- </if>
- <if test="shopAdminFlag!=null and shopAdminFlag==1">
- and admin_user_id is not null
- </if>
- order by create_time desc
- </select>
- <select id="queryRider" resultType="com.sqx.modules.app.entity.queryRiderVo">
- select u.user_id,u.clientid,u.open_id,u.rider_open_id,u.user_name,u.phone,u.cash_deposit,u.check_certification,r.station_name
- from tb_user u
- left join rider_station r on r.id = u.rider_station_id
- where u.user_id != #{userId}
- </select>
- <select id="queryRiders" resultType="com.sqx.modules.app.entity.queryRidersVo">
- select u.user_id,u.user_name,u.phone,u.avatar,r.station_name
- from tb_user u
- left join rider_station r on r.id = u.rider_station_id
- where u.rider_open_id is not null and u.on_line_flag = 1
- and u.rider_station_id = #{riderStationId} and u.user_id != #{userId}
- <if test="keyword != null and keyword != ''">
- and (u.phone like concat('%',#{keyword},'%') or u.user_name like concat('%',#{keyword},'%'))
- </if>
- </select>
- <select id="queryInviterCount" resultType="int">
- select count(*) from tb_user
- where inviter_code=#{inviterCode}
- </select>
- <select id="queryUserCount" resultType="int">
- select count(*)from tb_user where 1=1
- <if test="type==1">
- and date_format(create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
- </if>
- <if test="type==2">
- and date_format(create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
- </if>
- <if test="type==3">
- and date_format(create_time,'%Y')=date_format(#{date},'%Y')
- </if>
- </select>
- <select id="queryPayMoney" resultType="Double">
- select sum(money) from pay_details where `state`=1
- <if test="type==1">
- and date_format(create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
- </if>
- <if test="type==2">
- and date_format(create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
- </if>
- <if test="type==3">
- and date_format(create_time,'%Y')=date_format(#{date},'%Y')
- </if>
- </select>
- <select id="queryCourseOrder" resultType="com.sqx.modules.app.response.CourseOrderResponse">
- select * from (
- select c.course_id as courseId,sum(o.pay_money) as 'coursemoney' ,count(*) as 'coursenum',any_value(c.title) as
- 'coursename' from orders o , course c where o.course_id=c.course_id and o.status=1 and o.orders_type=1
- <if test="type==1">
- and date_format(o.create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
- </if>
- <if test="type==2">
- and date_format(o.create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
- </if>
- <if test="type==3">
- and date_format(o.create_time,'%Y')=date_format(#{date},'%Y')
- </if>
- group by c.course_id
- ) a
- order by a.coursenum desc
- </select>
- <select id="userMessage" resultType="int">
- select count(*) from tb_user t ,user_vip v where t.user_id=v.user_id and is_vip=1
- <if test="type==1">
- and date_format(t.create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
- </if>
- <if test="type==2">
- and date_format(t.create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
- </if>
- <if test="type==3">
- and date_format(t.create_time,'%Y')=date_format(#{date},'%Y')
- </if>
- </select>
- <insert id="insertUser" parameterType="com.sqx.modules.app.entity.UserEntity" useGeneratedKeys="true"
- keyProperty="userId">
- INSERT INTO tb_user
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="null != userName and '' != userName">
- user_name,
- </if>
- <if test="null != phone and '' != phone">
- phone,
- </if>
- <if test="null != avatar and '' != avatar">
- avatar,
- </if>
- <if test="null != sex and '' != sex">
- sex,
- </if>
- <if test="null != age and '' != age">
- age,
- </if>
- <if test="null != openId and '' != openId">
- open_id,
- </if>
- <if test="null != wxOpenId and '' != wxOpenId">
- wx_open_id,
- </if>
- <if test="null != password and '' != password">
- password,
- </if>
- <if test="null != createTime and '' != createTime">
- create_time,
- </if>
- <if test="null != updateTime and '' != updateTime">
- update_time,
- </if>
- <if test="null != appleId and '' != appleId">
- apple_id,
- </if>
- <if test="null != sysPhone and '' != sysPhone">
- sys_phone,
- </if>
- <if test="null != status and '' != status">
- status,
- </if>
- <if test="null != platform and '' != platform">
- platform,
- </if>
- <if test="null != jifen and '' != jifen">
- jifen,
- </if>
- <if test="null != invitationCode and '' != invitationCode">
- invitation_code,
- </if>
- <if test="null != inviterCode and '' != inviterCode">
- inviter_code,
- </if>
- <if test="null != clientid and '' != clientid">
- clientid,
- </if>
- <if test="null != zhiFuBaoName and '' != zhiFuBaoName">
- zhi_fu_bao_name,
- </if>
- <if test="null != zhiFuBao and '' != zhiFuBao">
- zhi_fu_bao,
- </if>
- <if test="null != isVip">
- is_vip,
- </if>
- <if test="null != userType">
- user_type,
- </if>
- <if test="null != nickName and '' != nickName">
- nick_name,
- </if>
- <if test="null != cashDeposit">
- cash_deposit,
- </if>
- <if test="null != balance">
- balance,
- </if>
- <if test="null != riderWxOpenId and '' != riderWxOpenId">
- rider_wx_open_id,
- </if>
- <if test="null != newUserFlag">
- new_user_flag,
- </if>
- <if test="null != newUserFlagWm">
- new_user_flag_wm
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="null != userName and '' != userName">
- #{userName},
- </if>
- <if test="null != phone and '' != phone">
- #{phone},
- </if>
- <if test="null != avatar and '' != avatar">
- #{avatar},
- </if>
- <if test="null != sex and '' != sex">
- #{sex},
- </if>
- <if test="null != age and '' != age">
- #{age},
- </if>
- <if test="null != openId and '' != openId">
- #{openId},
- </if>
- <if test="null != wxOpenId and '' != wxOpenId">
- #{wxOpenId},
- </if>
- <if test="null != password and '' != password">
- #{password},
- </if>
- <if test="null != createTime and '' != createTime">
- #{createTime},
- </if>
- <if test="null != updateTime and '' != updateTime">
- #{updateTime},
- </if>
- <if test="null != appleId and '' != appleId">
- #{appleId},
- </if>
- <if test="null != sysPhone and '' != sysPhone">
- #{sysPhone},
- </if>
- <if test="null != status and '' != status">
- #{status},
- </if>
- <if test="null != platform and '' != platform">
- #{platform},
- </if>
- <if test="null != jifen and '' != jifen">
- #{jifen},
- </if>
- <if test="null != invitationCode and '' != invitationCode">
- #{invitationCode},
- </if>
- <if test="null != inviterCode and '' != inviterCode">
- #{inviterCode},
- </if>
- <if test="null != clientid and '' != clientid">
- #{clientid},
- </if>
- <if test="null != zhiFuBaoName and '' != zhiFuBaoName">
- #{zhiFuBaoName},
- </if>
- <if test="null != zhiFuBao and '' != zhiFuBao">
- #{zhiFuBao},
- </if>
- <if test="null != isVip">
- #{isVip},
- </if>
- <if test="null != userType">
- #{userType},
- </if>
- <if test="null != nickName and '' != nickName">
- #{nickName},
- </if>
- <if test="null != cashDeposit">
- #{cashDeposit},
- </if>
- <if test="null != balance">
- #{balance},
- </if>
- <if test="null != riderWxOpenId and '' != riderWxOpenId">
- #{riderWxOpenId},
- </if>
- <if test="null != newUserFlag">
- #{newUserFlag},
- </if>
- <if test="null != newUserFlagWm">
- #{newUserFlagWm}
- </if>
- </trim>
- </insert>
- <select id="takingOrdersMessage" resultType="com.sqx.modules.app.response.TakingOrderResponse">
- SELECT
- SUM( o.order_number ) AS orderNumber,
- g.game_name,
- SUM( o.pay_money ) AS payMoney
- FROM
- ( orders o LEFT JOIN order_taking t ON o.order_taking_id = t.id )
- LEFT JOIN game g ON g.id = t.game_id
- WHERE
- o.state = 1
- <if test="type==1">
- and date_format("o.create_time",'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
- </if>
- <if test="type==2">
- and date_format("o.create_time",'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
- </if>
- <if test="type==3">
- and date_format("o.create_time",'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
- </if>
- GROUP BY
- g.game_name
- </select>
- <update id="updateCashDeposit">
- update tb_user set
- cash_deposit = cash_deposit+#{cashDeposit}
- where user_id = #{userId}
- </update>
- <!--<select id="selectUserList" resultType="com.sqx.modules.app.entity.UserEntity">
- select * from tb_user
- where 1=1
- <if test="userName!=null and userName!''">
- and user_name =#{userName}
- </if>
- order by create_time desc
- </select>-->
- <select id="selectAllUser" resultType="com.sqx.modules.app.entity.UserEntity">
- select tu.*, um.sex as umSex from tb_user tu left join user_message um on tu.user_id = um.user_id where 1 = 1
- <if test="phone!=null and phone!=''">
- and phone = #{phone}
- </if>
- <if test="userType!=null">
- and type = #{userType}
- </if>
- order by tu.create_time desc
- </select>
- <select id="findUserMessage" resultType="com.sqx.modules.app.entity.UserEntity">
- select tu.*, um.birthday as birthday, um.height as height, um.weight as weight, um.occupation as occupation, um.individual_resume as individualResume,
- um.picture_list as pictureList, um.sex as umSex
- from tb_user tu left join user_message um on tu.user_id = um.user_id where tu.user_id = #{userId}
- </select>
- <select id="selectUser" resultType="com.sqx.modules.app.entity.UserEntity">
- select * from tb_user where 1 = 1
- <if test="userName!=null and userName!=''">
- and user_name like concat('%',#{userName},'%')
- </if>
- <if test="phone!=null and phone!=''">
- and phone like concat('%',#{phone},'%')
- </if>
- </select>
- <select id="selectUserById" resultType="com.sqx.modules.app.entity.UserEntity">
- select tu.*, um.money as money, ui.integral_num as integralNum
- from tb_user tu
- left join user_money um on tu.user_id = um.user_id
- left join user_integral ui on tu.user_id = ui.user_id
- where tu.user_id = #{userId}
- </select>
- <insert id="topUpMoney">
- insert into pay_details (classify, order_id, money, user_id, state, create_time, pay_time, type)
- values (#{classify}, #{orderId}, #{money}, #{userId}, #{state}, #{date}, #{date1}, #{type})
- </insert>
- <update id="certification">
- update tb_user set user_name = #{userName}, audit_time = #{format}, identity_card_number = #{identityCardNumber}, identity_card_front = #{identityCardFront},
- identity_card_verso = #{identityCardVerso}, self_identity_card = #{selfIdentityCard}, check_certification = "0", cash_deposit=#{cashDeposit}, check_number=#{checkNumber} where user_id = #{userId}
- </update>
- <insert id="userFeedback">
- insert into sys_feedback (feedback_type, user_id, user_email, feedback_score, feedback_message, feedback_time)
- values
- (#{feedbackType}, #{userId}, #{userEmail}, #{feedbackScore}, #{feedbackMessage}, #{format})
- </insert>
- <insert id="addRedPacket">
- insert into errand_user_red_packet (user_id, red_packet_type, minimum_amount, red_packet_amount, red_packet_title, expiration_time, delete_flag, create_time)
- values (#{userId}, #{redPacketType}, #{minimumAmount}, #{redPacketAmount}, #{redPacketTitle}, #{expirationTime}, "0", #{createTime})
- </insert>
- <update id="updateOldUser">
- update tb_user set new_user_flag = "2" where user_id = #{userId}
- </update>
- <select id="selectUserMessage" resultType="com.sqx.modules.app.entity.UserEntity">
- select tu.*, gs.status as shopStatus from tb_user tu left join sys_user_shop sus on tu.admin_user_id = sus.user_id
- left join goods_shop gs on sus.shop_id = gs.shop_id
- where tu.user_id = #{userId}
- </select>
- <select id="selectVipOverdue" resultType="com.sqx.modules.app.entity.UserEntity">
- select * from tb_user where is_vip = 1 and vip_expiration_time < #{date}
- </select>
- <update id="updateUserClientIdIsNull">
- update tb_user set clientid='' where clientid=#{clientid}
- </update>
- <update id="updateUserRiderClientIdIsNull">
- update tb_user set rider_clientid='' where rider_clientid=#{clientid}
- </update>
- <update id="updateUserShopClientIdIsNull">
- update tb_user set shop_client_id='' where shop_client_id=#{clientid}
- </update>
- <select id="selectRiderUserByOnLineFlag" resultType="com.sqx.modules.app.entity.UserEntity">
- select * from (select (st_distance (point (r.lng, r.lat),point(#{lng},#{lat}) ) *111195) as distance,t.*
- from rider_location r
- left join tb_user t on t.user_id=r.user_id
- where t.on_line_flag=1
- ) a where distance<=#{distance}
- </select>
- </mapper>
|