insert into cm_brand_club_user (authUserId, authId, name, mobile, password, addTime, status, delFlag)
values (#{authUserId}, #{authId}, #{name}, #{mobile}, #{password}, #{addTime}, #{status}, 0)
insert into cm_brand_club_feedback(clubUserId, content, commitTime, handleStatus)
values (#{clubUserId}, #{content}, NOW(), 0)
update cm_brand_club_user
set mobile = #{mobile}
where id = #{id}
update cm_brand_club_user set delFlag = 1 where id = #{clubUserId}
update cm_brand_club_user
set password = #{password}
where mobile = #{mobile}
and authUserId = #{authUserId}
update cm_brand_club_user set authId = #{authId}, name = (select DISTINCT authParty from cm_brand_auth where id = #{authId}) where id = #{clubUserId}
update cm_brand_club_user
set status = #{status}
where id = #{clubUserId}
update cm_brand_club_user
set password=#{password}
where id = #{clubUserId}
update cm_brand_club_user
set authId = null, name = null
where id = #{clubUserId}
select id as authId,authParty as authParty,createTime
from cm_brand_auth where authUserId = #{authUserId} and delFlag = 0
and authParty like concat('%',#{authParty},'%')
order by createTime desc
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)
and cu.name like concat('%',#{name},'%')
and cu.mobile like concat('%',#{mobile},'%')
and cu.status = #{status}
order by cu.addTime desc
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
and a.authParty like concat('%',#{authParty},'%')
and a.provinceId = #{provinceId}
and a.cityId = #{cityId}
and a.townId = #{townId}
order by distance
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 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.mobile = #{mobile}
and au.appId = #{appId}
and (au.authUserId = #{authUserId} or cu.authUserId = #{authUserId})
and cu.authId = #{authId}
and cu.id = #{clubUserId}
limit 1
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 password from cm_brand_club_user where id = #{clubUserId}
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
update cm_brand_club_user
set authId = #{authId},
name=#{authParty}
where id = #{clubUserId} and authUserId=#{authUserId}
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}