|
@@ -234,6 +234,136 @@
|
|
</where>
|
|
</where>
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
+ <select id="getProviderTeam" resultType="com.caimei365.manager.entity.caimei.providers.CmProviderTeam">
|
|
|
|
+ SELECT DISTINCT csr.leaderId,
|
|
|
|
+ csr.createdTime,
|
|
|
|
+ s.linkMan as leaderName,
|
|
|
|
+ csr.id as teamId,
|
|
|
|
+ csr.name,
|
|
|
|
+ (SELECT COUNT(teamId) FROM cm_serviceteam_group WHERE teamId = csr.id) AS groupCount
|
|
|
|
+ FROM cm_serviceteam_role csr
|
|
|
|
+ LEFT JOIN serviceprovider s ON csr.leaderId = s.serviceProviderID
|
|
|
|
+ order by csr.createdTime desc
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="findClub" resultType="com.caimei365.manager.entity.caimei.cmUser.CmClub">
|
|
|
|
+ SELECT
|
|
|
|
+ a.checkMan as "checkMan",
|
|
|
|
+ a.clubID AS "clubId",
|
|
|
|
+ a.userID AS "userId",
|
|
|
|
+ u.name AS "name",
|
|
|
|
+ a.sname AS "sname",
|
|
|
|
+ a.logo AS "logo",
|
|
|
|
+ a.legalPerson AS "legalPerson",
|
|
|
|
+ a.provinceID AS "provinceId",
|
|
|
|
+ a.cityID AS "cityId",
|
|
|
|
+ a.townID AS "townId",
|
|
|
|
+ a.flag AS "flag",
|
|
|
|
+ a.spID AS "spId",
|
|
|
|
+ a.mainServiceProviderID AS "mainServiceProviderId",
|
|
|
|
+ a.address AS "address",
|
|
|
|
+ a.linkMan AS "linkMan",
|
|
|
|
+ a.linkManIdentity AS "linkManIdentity",
|
|
|
|
+ a.contractPhone AS "contractPhone",
|
|
|
|
+ a.contractMobile AS "contractMobile",
|
|
|
|
+ a.fax AS "fax",
|
|
|
|
+ a.info AS "info",
|
|
|
|
+ a.addTime AS "addTime",
|
|
|
|
+ a.auditTime AS "auditTime",
|
|
|
|
+ a.auditNote AS "auditNote",
|
|
|
|
+ a.status AS "status",
|
|
|
|
+ a.businessLicenseImage AS "businessLicenseImage",
|
|
|
|
+ a.mainpro AS "mainpro",
|
|
|
|
+ a.scanFlag AS "scanFlag",
|
|
|
|
+ a.headpic AS "headpic",
|
|
|
|
+ a.socialCreditCode AS "socialCreditCode",
|
|
|
|
+ a.lastModify AS "lastModify",
|
|
|
|
+ a.firstClubType AS "firstClubType",
|
|
|
|
+ a.secondClubType AS "secondClubType",
|
|
|
|
+ a.department AS "department",
|
|
|
|
+ a.medicalPracticeLicenseImg AS "medicalPracticeLicenseImg",
|
|
|
|
+ a.newDeal as "newDeal",
|
|
|
|
+ case sp.status when 91 then '采美默认协销经理(官方账号)' else sp.linkMan end AS "spName",
|
|
|
|
+ d.name AS "province",
|
|
|
|
+ c.name AS "city",
|
|
|
|
+ b.name AS "town",
|
|
|
|
+ u.account AS "account",
|
|
|
|
+ u.registerTime AS "registerTime",
|
|
|
|
+ u.registerIP AS "registerIP",
|
|
|
|
+ u.userName AS "userName",
|
|
|
|
+ u.bindMobile AS "bindMobile",
|
|
|
|
+ u.email AS "email",
|
|
|
|
+ u.userOrganizeID AS "userOrganizeId",
|
|
|
|
+ u.userIdentity AS "userIdentity",
|
|
|
|
+ if(csu.delFlag = '0' and now() <![CDATA[ < ]]> csu.endTime,1,0) as svipUserFlag,
|
|
|
|
+ u.source,
|
|
|
|
+ u.loginTime
|
|
|
|
+ FROM club a
|
|
|
|
+ LEFT JOIN user u ON u.userID = a.userID
|
|
|
|
+ LEFT JOIN cm_svip_user csu ON csu.userId = u.userID
|
|
|
|
+ LEFT JOIN serviceprovider sp ON sp.serviceProviderID = a.spID
|
|
|
|
+ LEFT JOIN town b ON b.townID=a.townID
|
|
|
|
+ LEFT JOIN city c ON c.cityID=a.cityID
|
|
|
|
+ LEFT JOIN province d ON d.provinceID=a.provinceID
|
|
|
|
+ <where>
|
|
|
|
+ (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4 AND u.userIdentity != 8
|
|
|
|
+ <if test="clubId != null and clubId != ''">
|
|
|
|
+ AND a.clubID = #{clubId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="clubId == 0">
|
|
|
|
+ AND a.clubID = #{clubId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="userId != null and userId != ''">
|
|
|
|
+ AND a.userID = #{userId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="account != null and account != ''">
|
|
|
|
+ AND u.account = #{account}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="name != null and name != ''">
|
|
|
|
+ AND u.name LIKE concat('%',#{name},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="userName != null and userName != ''">
|
|
|
|
+ AND u.userName LIKE concat('%',#{userName},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="townId != null and townId != ''">
|
|
|
|
+ AND d.provinceID = #{provinceId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="cityId != null and cityId != ''">
|
|
|
|
+ AND c.cityID = #{cityId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="townId != null and townId != ''">
|
|
|
|
+ AND b.townID = #{townId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="status != null and status != ''">
|
|
|
|
+ AND a.status = #{status}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="bindMobile != null and bindMobile != ''">
|
|
|
|
+ AND u.bindMobile LIKE concat('%',#{bindMobile},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="linkMan != null and linkMan != ''">
|
|
|
|
+ AND a.linkMan LIKE concat('%',#{linkMan},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
|
+ AND u.registerTime <![CDATA[ >= ]]> #{startTime}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
|
+ AND u.registerTime <![CDATA[ <= ]]> #{endTime}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="spId != null and spId != ''">
|
|
|
|
+ AND sp.serviceProviderID = #{spId}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ ORDER BY case when a.status = 91 then 0 else 1 end desc, a.addTime DESC
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <select id="groupList" resultType="com.caimei365.manager.entity.caimei.cmUser.ServiceProviderModel">
|
|
|
|
+ SELECT csg.serviceId AS serviceProviderId, s.linkMan as name, s.contractMobile as mobile,csr.leaderId as leaderId
|
|
|
|
+ FROM cm_serviceTeam_group csg
|
|
|
|
+ LEFT JOIN serviceprovider s ON csg.serviceId = s.serviceProviderID
|
|
|
|
+ LEFT JOIN cm_serviceteam_role csr ON csg.teamId = csr.id
|
|
|
|
+ WHERE csg.teamId = #{id}
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
|
|
<insert id="addCmProviders" parameterType="CmProviders" useGeneratedKeys="true" keyProperty="id">
|
|
<insert id="addCmProviders" parameterType="CmProviders" useGeneratedKeys="true" keyProperty="id">
|
|
insert into cm_providers
|
|
insert into cm_providers
|
|
@@ -278,6 +408,7 @@
|
|
<if test="splitCode != null and splitCode != ''">#{splitCode},</if>
|
|
<if test="splitCode != null and splitCode != ''">#{splitCode},</if>
|
|
</trim>
|
|
</trim>
|
|
</insert>
|
|
</insert>
|
|
|
|
+
|
|
<insert id="addProviderProduct">
|
|
<insert id="addProviderProduct">
|
|
INSERT INTO cm_provider_product (providerId, productId)
|
|
INSERT INTO cm_provider_product (providerId, productId)
|
|
VALUES
|
|
VALUES
|
|
@@ -286,6 +417,32 @@
|
|
</foreach>
|
|
</foreach>
|
|
</insert>
|
|
</insert>
|
|
|
|
|
|
|
|
+ <insert id="addTeam" useGeneratedKeys="true" keyProperty="teamId">
|
|
|
|
+ INSERT INTO cm_serviceteam_role (name, leaderId, createdTime)
|
|
|
|
+ VALUES (#{name}, #{leaderId}, now())
|
|
|
|
+ </insert>
|
|
|
|
+
|
|
|
|
+ <insert id="addGroup">
|
|
|
|
+ INSERT INTO cm_serviceteam_group(teamId, serviceId)
|
|
|
|
+ values
|
|
|
|
+ <foreach collection="spId" item="item" separator=",">
|
|
|
|
+ (#{teamId}, #{item})
|
|
|
|
+ </foreach>
|
|
|
|
+ </insert>
|
|
|
|
+
|
|
|
|
+ <select id="addGroups" resultType="com.caimei365.manager.entity.caimei.cmUser.ServiceProviderModel">
|
|
|
|
+ SELECT s.serviceProviderID AS serviceProviderId, s.linkMan as name, s.contractMobile as mobile
|
|
|
|
+ FROM serviceprovider s
|
|
|
|
+ LEFT JOIN cm_serviceTeam_group csg ON csg.serviceId = s.serviceProviderID
|
|
|
|
+ WHERE csg.serviceId is null
|
|
|
|
+ <if test="name !=null and name !=''">
|
|
|
|
+ and s.name like concat('%', #{name}, '%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="mobile !=null and mobile !=''">
|
|
|
|
+ and s.contractMobile = #{mobile}
|
|
|
|
+ </if>
|
|
|
|
+ </select>
|
|
|
|
+
|
|
<update id="updateCmProviders" parameterType="CmProviders">
|
|
<update id="updateCmProviders" parameterType="CmProviders">
|
|
update cm_providers
|
|
update cm_providers
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
@@ -313,6 +470,24 @@
|
|
<if test="userId != null">or userId = #{userId}</if>
|
|
<if test="userId != null">or userId = #{userId}</if>
|
|
</update>
|
|
</update>
|
|
|
|
|
|
|
|
+ <update id="updatePass">
|
|
|
|
+ update user
|
|
|
|
+ set passWord = #{password}
|
|
|
|
+ where userId = #{userId}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+ <update id="updateTeam">
|
|
|
|
+ update cm_serviceteam_role
|
|
|
|
+ set name = #{name}
|
|
|
|
+ where id = #{teamId}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
|
|
+ <update id="updateLeader">
|
|
|
|
+ update cm_serviceteam_role
|
|
|
|
+ set leaderId = #{leaderId}
|
|
|
|
+ where id = ${teamId}
|
|
|
|
+ </update>
|
|
|
|
+
|
|
<delete id="delCmProvidersById" parameterType="String">
|
|
<delete id="delCmProvidersById" parameterType="String">
|
|
delete
|
|
delete
|
|
from cm_providers
|
|
from cm_providers
|
|
@@ -344,9 +519,29 @@
|
|
</delete>
|
|
</delete>
|
|
|
|
|
|
<delete id="delProviderProduct">
|
|
<delete id="delProviderProduct">
|
|
- delete from cm_provider_product
|
|
|
|
|
|
+ delete
|
|
|
|
+ from cm_provider_product
|
|
where productId = #{productId}
|
|
where productId = #{productId}
|
|
- and providerId = #{providerId}
|
|
|
|
|
|
+ and providerId = #{providerId}
|
|
|
|
+ </delete>
|
|
|
|
+
|
|
|
|
+ <delete id="delTeam">
|
|
|
|
+ delete
|
|
|
|
+ from cm_serviceteam_role
|
|
|
|
+ where id = #{id}
|
|
|
|
+ </delete>
|
|
|
|
+
|
|
|
|
+ <delete id="delTeamGroup">
|
|
|
|
+ delete
|
|
|
|
+ from cm_serviceteam_group
|
|
|
|
+ where teamId = #{id}
|
|
|
|
+ </delete>
|
|
|
|
+
|
|
|
|
+ <delete id="delGroup">
|
|
|
|
+ delete
|
|
|
|
+ from cm_serviceteam_group
|
|
|
|
+ where teamId = #{teamId}
|
|
|
|
+ and serviceId = #{spId}
|
|
</delete>
|
|
</delete>
|
|
|
|
|
|
</mapper>
|
|
</mapper>
|