123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- <?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.caimei365.user.mapper.ClubMapper">
- <insert id="insertRemarks" parameterType="com.caimei365.user.model.po.ClubRemarksPo" keyProperty="remarksId" useGeneratedKeys="true">
- insert into cm_club_remarks(clubId, serviceProviderId, remarks, addTime)
- values (#{clubId}, #{serviceProviderId}, #{remarks}, now())
- </insert>
- <insert id="insertRemarksImage">
- insert into cm_club_remarks_file(remarksId, fileType, imageUrl)
- values (#{remarksId}, 1, #{imageUrl})
- </insert>
- <insert id="insertRemarksFile">
- insert into cm_club_remarks_file(remarksId, fileType, fileName, ossName)
- values (#{remarksId}, 2, #{fileName}, #{ossName})
- </insert>
- <update id="updateClubUserByUpdateInfo">
- update user set
- <if test="name != null and name != ''">
- name = #{name},
- </if>
- <if test="email != null and email != ''">
- email = #{email},
- </if>
- userName = #{userName}
- where userID = #{userId}
- </update>
- <update id="updateClubByUpdateInfo">
- update club set
- <if test="name != null and name != ''">
- name = #{name},
- </if>
- <if test="shortName != null and shortName != ''">
- sname = #{shortName},
- </if>
- <if test="contractEmail != null and contractEmail != ''">
- contractEmail1 = #{contractEmail},
- </if>
- contractPhone = #{contractPhone},
- <if test="linkMan != null and linkMan != ''">
- linkMan = #{linkMan},
- </if>
- <if test="townId != null and townId != ''">
- provinceID = #{provinceId}, cityID = #{cityId}, townID = #{townId}, address = #{address},
- </if>
- <if test="shopPhoto != null and shopPhoto != 'null' and shopPhoto != ''">
- headpic = #{shopPhoto},
- </if>
- <if test="businessLicense != null and businessLicense != ''">
- businessLicenseImage = #{businessLicense},
- </if>
- <if test="socialCreditCode != null and socialCreditCode != ''">
- socialCreditCode = #{socialCreditCode},
- </if>
- <if test="firstClubType != null and firstClubType != ''">
- firstClubType = #{firstClubType},
- </if>
- <if test="firstClubType == 1 or firstClubType == 2">
- secondClubType = #{secondClubType}, department = #{department}, medicalPracticeLicenseImg = #{medicalPracticeLicense},
- </if>
- <if test="mainProduct != null and mainProduct != ''">
- mainpro = #{mainProduct},
- </if>
- fax = #{fax},
- info = #{profile},
- lastModify = NOW()
- where clubID = #{clubId}
- </update>
- <delete id="clearRemarksFiles">
- delete from cm_club_remarks_file where id = #{remarksId}
- </delete>
- <delete id="deleteRemarks">
- delete from cm_club_remarks where id = #{remarksId}
- </delete>
- <delete id="deleteRemarksFiles">
- delete from cm_club_remarks_file where remarksId = #{remarksId}
- </delete>
- <select id="getClubById" resultType="com.caimei365.user.model.vo.ClubVo">
- select clubID as clubId, userID as userId, name, sname as shortName, contractMobile, contractEmail1 as contractEmail,
- contractPhone, linkMan, provinceID as proviceId, cityID as cityId, townID as townId,
- address, headpic as shopPhoto, businessLicenseImage as businessLicense, socialCreditCode,
- firstClubType, secondClubType, department, medicalPracticeLicenseImg as medicalPracticeLicense,
- mainpro as mainProduct, fax, info as profile, spID as serviceProviderId, addTime, status
- from club
- where clubID = #{clubId}
- </select>
- <select id="getOrderCount" resultType="com.caimei365.user.model.vo.OrderCountVo">
- select userID as userId,
- (select COUNT(*) from cm_order where userID = #{userId} and delFlag = '0') as orderCount,
- (select COUNT(*) from cm_order where userID = #{userId} and delFlag = '0' and status = '0') as confirmedCount,
- (select COUNT(*) from cm_order where userID = #{userId} and delFlag = '0' and status in(11,12,13,21,22,23)) as paymentCount,
- (select COUNT(*) from cm_order where userID = #{userId} and delFlag = '0' and status in(11,12,21,22,31,32)) as waitShipmentsCount,
- (select COUNT(*) from cm_order where userID = #{userId} and delFlag = '0' and status in(12,13,22,23,32,33)) as shipmentsCount,
- (select COUNT(*) from cm_order where userID = #{userId} and delFlag = '0' and status in(1,2)) as salesReturnCount
- from cm_order
- where userID = #{userId} and delFlag = '0'
- limit 1
- </select>
- <select id="findBeansHistoryByType" resultType="integer">
- SELECT id FROM user_beans_history WHERE userId = #{userId} AND beansType = #{beansType} AND delFlag = 0
- </select>
- <update id="updateUserBeans">
- UPDATE USER SET userBeans = #{userBeans} WHERE userID = #{userId}
- </update>
- <select id="findBeansHistory" resultType="com.caimei365.user.model.vo.BeansHistoryVo">
- SELECT
- beansType,
- num
- FROM
- user_beans_history
- WHERE
- pushStatus = 0
- AND beansType IN (1, 2, 3, 4, 8, 12)
- AND delFlag = 0
- AND userId = #{userId}
- ORDER BY
- ADDTIME DESC
- LIMIT
- 1
- </select>
- <select id="findByBeansType" resultType="integer">
- SELECT
- SUM(num)
- FROM
- user_beans_history
- WHERE
- userId = #{userId}
- AND beansType = #{beansType}
- AND pushStatus = 0
- AND delFlag = 0
- </select>
- <update id="updatePushStatus">
- UPDATE user_beans_history SET pushStatus = 1 WHERE userId = #{userId}
- </update>
- <update id="updateRemarks">
- update cm_club_remarks
- set remarks = #{remarks}
- where id = #{remarksId}
- </update>
- <select id="findAllBeansHistory" resultType="com.caimei365.user.model.vo.BeansHistoryVo">
- SELECT
- type,
- beansType,
- num,
- addTime
- FROM
- user_beans_history
- WHERE
- userId = #{userId}
- AND addTime <![CDATA[ >= ]]> #{startTime}
- AND addTime <![CDATA[ <= ]]> #{endTime}
- AND delFlag = 0
- <if test="type != null and type != 0">
- AND type = #{type}
- </if>
- ORDER BY addTime DESC
- </select>
- <select id="findLoginBeans" resultType="integer">
- SELECT
- id
- FROM
- user_beans_history
- WHERE
- beansType IN (1,12)
- AND DATE_FORMAT(addTime, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')
- AND userId = #{userId}
- </select>
- <select id="findCountCoupon" resultType="integer">
- SELECT
- COUNT(a.id)
- FROM
- cm_coupon_club a
- LEFT JOIN cm_coupon cc ON a.couponId = cc.id
- WHERE
- cc.delFlag = 0
- AND a.delFlag = 0
- AND a.userId = #{userId}
- AND a.status = 1
- AND NOW() BETWEEN cc.startDate
- AND cc.endDate
- AND cc.status != 2
- </select>
- <select id="findBeansHistoryByArchiveId" resultType="java.lang.Integer">
- select id from user_beans_history where userId = #{userId} and archiveId = #{archiveId}
- </select>
- <select id="getBeansNumByUserId" resultType="java.lang.Integer">
- select userBeans
- from user
- where userID = #{userId}
- </select>
- <select id="getRemarksList" resultType="com.caimei365.user.model.vo.RemarksVo">
- select id as remarksId, remarks, addTime
- from cm_club_remarks
- where clubId = #{clubId}
- order by addTime desc
- </select>
- <select id="getRemarks" resultType="com.caimei365.user.model.vo.RemarksVo">
- select id as remarksId, remarks, addTime
- from cm_club_remarks
- where id = #{remarksId}
- </select>
- <select id="getRemarksImageList" resultType="java.lang.String">
- select imageUrl
- from cm_club_remarks_file
- where remarksId = #{remarksId}
- and fileType = 1
- </select>
- <select id="getRemarksFileList" resultType="com.caimei365.user.model.vo.RemarksFileVo">
- select fileName, ossName
- from cm_club_remarks_file
- where remarksId = #{remarksId}
- and fileType = 2
- </select>
- </mapper>
|