123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- <?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.caimei.mapper.cmMapper.ClubMapper">
- <insert id="insertClubUser">
- insert into cm_brand_club_user (authUserId, authId, name, mobile, password, addTime, status, delFlag)
- values (#{authUserId}, #{authId}, #{name}, #{mobile}, #{password}, #{addTime}, #{status}, 0)
- </insert>
- <insert id="insertFeedback">
- insert into cm_brand_club_feedback(clubUserId, content, commitTime, handleStatus)
- values (#{clubUserId}, #{content}, NOW(), 0)
- </insert>
- <update id="updateClubUser">
- update cm_brand_club_user
- set mobile = #{mobile}
- where id = #{id}
- </update>
- <update id="deleteClubUser">
- update cm_brand_club_user set delFlag = 1 where id = #{clubUserId}
- </update>
- <update id="updatePassword">
- update cm_brand_club_user
- set password = #{password}
- where mobile = #{mobile}
- and authUserId = #{authUserId}
- </update>
- <update id="bindAuthId">
- update cm_brand_club_user set authId = #{authId}, name = (select DISTINCT authParty from cm_brand_auth where id = #{authId}) where id = #{clubUserId}
- </update>
- <update id="updateStatus">
- update cm_brand_club_user
- set status = #{status}
- where id = #{clubUserId}
- </update>
- <update id="updateClubUserPassword">
- update cm_brand_club_user
- set password=#{password}
- where id = #{clubUserId}
- </update>
- <update id="unbindAuthId">
- update cm_brand_club_user
- set authId = null, name = null
- where id = #{clubUserId}
- </update>
- <select id="getClubList" resultType="com.caimei.model.vo.ClubVo">
- select id as authId,authParty as authParty,createTime
- from cm_brand_auth where authUserId = #{authUserId} and delFlag = 0
- <if test="authParty != null and authParty != ''">
- and authParty like concat('%',#{authParty},'%')
- </if>
- order by createTime desc
- </select>
- <select id="getClubUserList" resultType="com.caimei.model.vo.ClubUserVo">
- select cu.id as clubUserId,
- cu.authId,
- cu.name,
- cu.mobile,
- cu.addTime,
- cu.nickName,
- cu.openId,
- cu.status
- from cm_brand_club_user cu
- left join cm_brand_auth a on cu.authId = a.id
- where cu.authUserId = #{authUserId}
- and cu.delFlag = 0
- and (a.id is null || a.delFlag = 0)
- <if test="name != null and name != ''">
- and cu.name like concat('%',#{name},'%')
- </if>
- <if test="mobile != null and mobile != ''">
- and cu.mobile like concat('%',#{mobile},'%')
- </if>
- <if test="status != null">
- and cu.status = #{status}
- </if>
- order by cu.addTime desc
- </select>
- <select id="getWxClubList" resultType="com.caimei.model.vo.WxClubListVo">
- select id as authId, authParty as authParty,concat(ifnull(p.name,''),ifnull(c.name,''),ifnull(t.name,'')) as area,a.address,a.mobile,a.logo,
- ifnull(round(st_distance(point(a.lng,a.lat),point(#{lng},#{lat}))*111195/1000,2),99999) as distance
- from cm_brand_auth a
- left join cm_brand_auth_user au on a.authUserId = au.authUserId
- left join province p on a.provinceId = p.provinceID
- left join city c on a.cityId = c.cityID
- left join town t on a.townId = t.townID
- left join (select r.authId as authId, count(*) as productCount
- from cm_brand_auth_product p left join cm_brand_product_relation r on p.id = r.productId
- where p.status = 1 group by r.authId) pc on a.id = pc.authId
- where au.authUserId = #{authUserId}
- and a.status = 1
- and a.auditStatus = 1
- and a.delFlag = 0
- and au.status = 1
- <if test="authParty != null and authParty != ''">
- and a.authParty like concat('%',#{authParty},'%')
- </if>
- <if test="provinceId != null">
- and a.provinceId = #{provinceId}
- </if>
- <if test="cityId != null">
- and a.cityId = #{cityId}
- </if>
- <if test="townId != null">
- and a.townId = #{townId}
- </if>
- order by distance
- </select>
- <select id="checkMobile" resultType="java.lang.Integer">
- select cu.id as clubUserId from cm_brand_club_user cu
- left join cm_brand_auth a on cu.authId = a.id and a.delFlag = 0
- left join cm_brand_auth_user au on a.authUserId = au.authUserId
- where cu.mobile = #{mobile} and au.appId = #{appId} and cu.delFlag = 0 limit 1
- </select>
- <select id="getWxClubUser" resultType="com.caimei.model.vo.WxClubUserVo">
- select cu.id as clubUserId, cu.authId as authId, cu.authUserId, cu.mobile, cu.status,a.authParty,a.logo
- from cm_brand_club_user cu
- left join cm_brand_auth a on cu.authId = a.id and a.delFlag = 0
- left join cm_brand_auth_user au on a.authUserId = au.authUserId
- where cu.delFlag = 0
- <if test="mobile != null and mobile != ''">
- and cu.mobile = #{mobile}
- </if>
- <if test="appId != null and appId != ''">
- and au.appId = #{appId}
- </if>
- <if test="authUserId != null">
- and (au.authUserId = #{authUserId} or cu.authUserId = #{authUserId})
- </if>
- <if test="authId != null">
- and cu.authId = #{authId}
- </if>
- <if test="clubUserId != null">
- and cu.id = #{clubUserId}
- </if>
- limit 1
- </select>
- <select id="getClubDetails" resultType="com.caimei.model.vo.WxClubDetailsVo">
- select a.id as authId,
- a.authParty,
- concat(ifnull(p.name,''),ifnull(c.name,''),ifnull(t.name,'')) as area,
- a.address,
- a.mobile,
- a.logo,
- a.authImage,
- a.linkMan,
- a.linkMobile,
- a.medicalLicenseImage,
- a.firstClubType,
- a.secondClubType,
- a.empNum,
- concat(a.lng,',',a.lat) as lngAndLat,
- if(a.customFlag = 1,a.remarks,null) as remarks
- from cm_brand_auth a
- left join cm_brand_auth_user u on a.authUserId = u.authUserId
- left join province p on a.provinceId = p.provinceID
- left join city c on a.cityId = c.cityID
- left join town t on a.townId = t.townID
- where a.id = #{authId}
- and a.delFlag = 0
- and u.status = 1
- and a.status = 1
- and a.auditStatus = 1;
- </select>
- <select id="getDbPassword" resultType="java.lang.String">
- select password from cm_brand_club_user where id = #{clubUserId}
- </select>
- <select id="getWxStarClubList" resultType="com.caimei.model.vo.WxClubListVo">
- select id as authId, authParty as authParty,concat(ifnull(p.name,''),ifnull(c.name,''),ifnull(t.name,'')) as area,a.address,a.mobile,a.logo,
- 99999 as distance
- from cm_brand_auth a
- left join cm_brand_auth_user au on a.authUserId = au.authUserId
- left join province p on a.provinceId = p.provinceID
- left join city c on a.cityId = c.cityID
- left join town t on a.townId = t.townID
- left join (select r.authId as authId, count(*) as productCount
- from cm_brand_auth_product p left join cm_brand_product_relation r on p.id = r.productId
- where p.status = 1 group by r.authId) pc on a.id = pc.authId
- where au.authUserId = #{authUserId}
- and a.status = 1
- and a.auditStatus = 1
- and a.delFlag = 0
- and au.status = 1
- and a.starFlag = 1
- order by a.starNum is null,a.starnum,a.createTime desc
- </select>
- <update id="saveBindAuth">
- update cm_brand_club_user
- set authId = #{authId},
- name=#{authParty}
- where id = #{clubUserId} and authUserId=#{authUserId}
- </update>
- <select id="getUserInfoByToken" resultType="com.caimei.model.vo.WxClubUserVo">
- select cu.id as clubUserId, cu.authId as authId, cu.authUserId, cu.mobile, cu.status,a.authParty,a.logo
- from cm_brand_club_user cu
- left join cm_brand_auth a on cu.authId = a.id and a.delFlag = 0
- left join cm_brand_auth_user au on a.authUserId = au.authUserId
- where cu.delFlag = 0 and cu.id = #{clubUserId}
- </select>
- </mapper>
|