123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626 |
- <?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.modules.user.dao.NewCmClubDao">
- <sql id="newCmClubColumns">
- a.clubID AS "clubID",
- a.userID AS "userID",
- a.clubTypeID AS "clubTypeID",
- u.name AS "name",
- a.sname AS "sname",
- a.nameEn AS "nameEn",
- a.site AS "site",
- a.logo AS "logo",
- a.level AS "level",
- a.score AS "score",
- a.subClubCount AS "subClubCount",
- a.legalPerson AS "legalPerson",
- a.provinceID AS "provinceID",
- a.cityID AS "cityID",
- a.townID AS "townID",
- a.agreement AS "agreement",
- a.flag AS "flag",
- a.inviterBindID AS "inviterBindID",
- a.inviterName AS "inviterName",
- a.spID AS "spID",
- a.mainServiceProviderID AS "mainServiceProviderID",
- a.scanTime AS "scanTime",
- a.checkTime AS "checkTime",
- a.address AS "address",
- a.registeredCapital AS "registeredCapital",
- a.mainClubID AS "mainClubID",
- a.turnover AS "turnover",
- a.linkMan AS "linkMan",
- a.contractPhone AS "contractPhone",
- a.contractMobile AS "contractMobile",
- a.fax AS "fax",
- a.zipCode AS "zipCode",
- a.linkMan1 AS "linkMan1",
- a.duty1 AS "duty1",
- a.contractPhone1 AS "contractPhone1",
- a.contractMobile1 AS "contractMobile1",
- a.contractQQ1 AS "contractQQ1",
- a.wechat1 AS "wechat1",
- a.contractEmail1 AS "contractEmail1",
- a.linkMan2 AS "linkMan2",
- a.duty2 AS "duty2",
- a.contractPhone2 AS "contractPhone2",
- a.contractMobile2 AS "contractMobile2",
- a.contractQQ2 AS "contractQQ2",
- a.wechat2 AS "wechat2",
- a.contractEmail2 AS "contractEmail2",
- a.scope AS "scope",
- a.info AS "info",
- a.lng AS "lng",
- a.lat AS "lat",
- a.addTime AS "addTime",
- a.favoriteTimes AS "favoriteTimes",
- a.payFlag1 AS "payFlag1",
- a.auditTime AS "auditTime",
- a.auditNote AS "auditNote",
- a.status AS "status",
- a.clubInvitationStatus AS "clubInvitationStatus",
- a.recAddress AS "recAddress",
- a.businessLicenseImage AS "businessLicenseImage",
- a.sortIndex AS "sortIndex",
- a.recTownID AS "recTownID",
- a.defaultServiceProviderID AS "defaultServiceProviderID",
- a.defaultServiceProviderUpdTime AS "defaultServiceProviderUpdTime",
- a.firstServiceProviderFlag AS "firstServiceProviderFlag",
- a.scale AS "scale",
- a.empnum AS "empnum",
- a.mainpro AS "mainpro",
- a.remark AS "remark",
- 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"
- </sql>
- <sql id="otherColumns">
- ,case sp.status when 91 then '采美默认协销经理(官方账号)' else sp.linkMan1 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.userLevelID AS "userLevelID",
- u.smsFlag AS "smsFlag",
- u.bindMobile AS "bindMobile",
- u.email AS "email",
- u.userOrganizeID AS "userOrganizeID",
- u.userIdentity AS "userIdentity"
- </sql>
- <sql id="newCmClubJoins">
- LEFT JOIN user u ON u.userID = a.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=b.cityID
- LEFT JOIN province d ON d.provinceID=c.provinceID
- </sql>
- <select id="get" resultType="NewCmClub">
- SELECT
- <include refid="newCmClubColumns"/>
- <include refid="otherColumns"/>
- FROM club a
- <include refid="newCmClubJoins"/>
- WHERE a.clubID = #{id}
- </select>
- <select id="getclubByUserId" resultType="NewCmClub">
- SELECT
- <include refid="newCmClubColumns"/>
- FROM club a
- <include refid="newCmClubJoins"/>
- WHERE a.userID = #{userID}
- </select>
- <select id="findList" resultType="NewCmClub">
- SELECT
- <include refid="newCmClubColumns"/>
- <include refid="otherColumns"/>,u.userPermission,u.source
- FROM club a
- <include refid="newCmClubJoins"/>
- <where>
- <if test="clubID != null and clubID != ''">
- 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="userLevelID != null and userLevelID != ''">
- AND u.userLevelID = #{userLevelID}
- </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="email != null and email != ''">
- AND u.email LIKE concat('%',#{email},'%')
- </if>
- <if test="linkMan != null and linkMan != ''">
- AND a.linkMan LIKE concat('%',#{linkMan},'%')
- </if>
- <if test="startTime != null and startTime != ''">
- AND (u.registerTime > #{startTime} OR u.registerTime = #{startTime})
- </if>
- <if test="endTime != null and endTime != ''">
- AND (u.registerTime < #{endTime} OR u.registerTime = #{endTime})
- </if>
- <if test="userIdentity != null and userIdentity != ''">
- AND u.userIdentity = #{userIdentity}
- </if>
- AND (u.userOrganizeID IN(0,1) or u.clubStatus != 92)
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY case when a.status = 91 then 0 else 1 end desc, a.addTime DESC
- </otherwise>
- </choose>
- </select>
- <select id="findAllList" resultType="NewCmClub">
- SELECT
- <include refid="newCmClubColumns"/>
- <include refid="otherColumns"/>
- FROM club a
- <include refid="newCmClubJoins"/>
- <where>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <insert id="insert" parameterType="NewCmClub" keyProperty="clubID" useGeneratedKeys="true">
- INSERT INTO club(
- userID,
- name,
- sname,
- nameEn,
- site,
- logo,
- level,
- score,
- subClubCount,
- legalPerson,
- provinceID,
- cityID,
- townID,
- agreement,
- flag,
- inviterBindID,
- inviterName,
- spID,
- mainServiceProviderID,
- scanTime,
- checkTime,
- address,
- registeredCapital,
- mainClubID,
- turnover,
- linkMan,
- contractPhone,
- contractMobile,
- fax,
- zipCode,
- linkMan1,
- duty1,
- contractPhone1,
- contractMobile1,
- contractQQ1,
- wechat1,
- contractEmail1,
- linkMan2,
- duty2,
- contractPhone2,
- contractMobile2,
- contractQQ2,
- wechat2,
- contractEmail2,
- scope,
- info,
- lng,
- lat,
- addTime,
- favoriteTimes,
- payFlag1,
- auditTime,
- auditNote,
- status,
- clubInvitationStatus,
- recAddress,
- businessLicenseImage,
- sortIndex,
- recTownID,
- defaultServiceProviderID,
- defaultServiceProviderUpdTime,
- firstServiceProviderFlag,
- scale,
- empnum,
- mainpro,
- remark,
- scanFlag,
- headpic,
- lastModify,
- firstClubType,
- socialCreditCode,
- secondClubType,
- department,
- medicalPracticeLicenseImg
- ) VALUES (
- #{userID},
- #{name},
- #{sname},
- #{nameEn},
- #{site},
- #{logo},
- #{level},
- #{score},
- #{subClubCount},
- #{legalPerson},
- #{provinceID},
- #{cityID},
- #{townID},
- #{agreement},
- #{flag},
- #{inviterBindID},
- #{inviterName},
- #{spID},
- #{mainServiceProviderID},
- #{scanTime},
- #{checkTime},
- #{address},
- #{registeredCapital},
- #{mainClubID},
- #{turnover},
- #{linkMan},
- #{contractPhone},
- #{contractMobile},
- #{fax},
- #{zipCode},
- #{linkMan1},
- #{duty1},
- #{contractPhone1},
- #{contractMobile1},
- #{contractQQ1},
- #{wechat1},
- #{contractEmail1},
- #{linkMan2},
- #{duty2},
- #{contractPhone2},
- #{contractMobile2},
- #{contractQQ2},
- #{wechat2},
- #{contractEmail2},
- #{scope},
- #{info},
- #{lng},
- #{lat},
- #{addTime},
- #{favoriteTimes},
- #{payFlag1},
- #{auditTime},
- #{auditNote},
- #{status},
- #{clubInvitationStatus},
- #{recAddress},
- #{businessLicenseImage},
- #{sortIndex},
- #{recTownID},
- #{defaultServiceProviderID},
- #{defaultServiceProviderUpdTime},
- #{firstServiceProviderFlag},
- #{scale},
- #{empnum},
- #{mainpro},
- #{remark},
- #{scanFlag},
- #{headpic},
- #{lastModify},
- #{firstClubType},
- #{socialCreditCode},
- #{secondClubType},
- #{department},
- #{medicalPracticeLicenseImg}
- )
- </insert>
- <update id="update">
- UPDATE club SET
- <if test="name != null and name != ''">
- name = #{name},
- </if>
- <if test="sname != null">
- sname = #{sname},
- </if>
- <if test="nameEn != null and nameEn != ''">
- nameEn = #{nameEn},
- </if>
- <if test="site != null and site != ''">
- site = #{site},
- </if>
- <if test="logo != null and logo != ''">
- logo = #{logo},
- </if>
- <if test="level != null and level != ''">
- level = #{level},
- </if>
- <if test="score != null and score != ''">
- score = #{score},
- </if>
- <if test="subClubCount != null and subClubCount != ''">
- subClubCount = #{subClubCount},
- </if>
- <if test="legalPerson != null and legalPerson != ''">
- legalPerson = #{legalPerson},
- </if>
- <if test="provinceID != null and provinceID != ''">
- provinceID = #{provinceID},
- </if>
- <if test="cityID != null and cityID != ''">
- cityID = #{cityID},
- </if>
- <if test="townID != null and townID != ''">
- townID = #{townID},
- </if>
- <if test="agreement != null and agreement != ''">
- agreement = #{agreement},
- </if>
- <if test="flag != null and flag != ''">
- flag = #{flag},
- </if>
- <if test="inviterBindID != null and inviterBindID != ''">
- inviterBindID = #{inviterBindID},
- </if>
- <if test="inviterName != null and inviterName != ''">
- inviterName = #{inviterName},
- </if>
- <if test="spID != null and spID != ''">
- spID = #{spID},
- </if>
- <if test="mainServiceProviderID != null and mainServiceProviderID != ''">
- mainServiceProviderID = #{mainServiceProviderID},
- </if>
- <if test="scanTime != null">
- scanTime = #{scanTime},
- </if>
- <if test="checkTime != null and checkTime != ''">
- checkTime = #{checkTime},
- </if>
- <if test="address != null and address != ''">
- address = #{address},
- </if>
- <if test="registeredCapital != null and registeredCapital != ''">
- registeredCapital = #{registeredCapital},
- </if>
- <if test="mainClubID != null and mainClubID != ''">
- mainClubID = #{mainClubID},
- </if>
- <if test="turnover != null and turnover != ''">
- turnover = #{turnover},
- </if>
- <if test="linkMan != null and linkMan != ''">
- linkMan = #{linkMan},
- </if>
- <if test="contractPhone != null and contractPhone != ''">
- contractPhone = #{contractPhone},
- </if>
- <if test="contractMobile != null and contractMobile != ''">
- contractMobile = #{contractMobile},
- </if>
- <if test="fax != null and fax != ''">
- fax = #{fax},
- </if>
- <if test="zipCode != null and zipCode != ''">
- zipCode = #{zipCode},
- </if>
- <if test="linkMan1 != null and linkMan1 != ''">
- linkMan1 = #{linkMan1},
- </if>
- <if test="duty1 != null and duty1 != ''">
- duty1 = #{duty1},
- </if>
- <if test="contractPhone1 != null and contractPhone1 != ''">
- contractPhone1 = #{contractPhone1},
- </if>
- <if test="contractMobile1 != null and contractMobile1 != ''">
- contractMobile1 = #{contractMobile1},
- </if>
- <if test="contractQQ1 != null and contractQQ1 != ''">
- contractQQ1 = #{contractQQ1},
- </if>
- <if test="wechat1 != null and wechat1 != ''">
- wechat1 = #{wechat1},
- </if>
- <if test="contractEmail1 != null and contractEmail1 != ''">
- contractEmail1 = #{contractEmail1},
- </if>
- <if test="linkMan2 != null and linkMan2 != ''">
- linkMan2 = #{linkMan2},
- </if>
- <if test="duty2 != null and duty2 != ''">
- duty2 = #{duty2},
- </if>
- <if test="contractPhone2 != null and contractPhone2 != ''">
- contractPhone2 = #{contractPhone2},
- </if>
- <if test="contractMobile2 != null and contractMobile2 != ''">
- contractMobile2 = #{contractMobile2},
- </if>
- <if test="contractQQ2 != null and contractQQ2 != ''">
- contractQQ2 = #{contractQQ2},
- </if>
- <if test="wechat2 != null and wechat2 != ''">
- wechat2 = #{wechat2},
- </if>
- <if test="contractEmail2 != null and contractEmail2 != ''">
- contractEmail2 = #{contractEmail2},
- </if>
- <if test="scope != null and scope != ''">
- scope = #{scope},
- </if>
- <if test="info != null and info != ''">
- info = #{info},
- </if>
- <if test="lng != null and lng != ''">
- lng = #{lng},
- </if>
- <if test="lat != null and lat != ''">
- lat = #{lat},
- </if>
- <if test="addTime != null">
- addTime = #{addTime},
- </if>
- <if test="favoriteTimes != null">
- favoriteTimes = #{favoriteTimes},
- </if>
- <if test="payFlag1 != null and payFlag1 != ''">
- payFlag1 = #{payFlag1},
- </if>
- <if test="auditTime != null">
- auditTime = #{auditTime},
- </if>
- <if test="auditNote != null and auditNote != ''">
- auditNote = #{auditNote},
- </if>
- <if test="status != null and status != ''">
- status = #{status},
- </if>
- <if test="clubInvitationStatus != null and clubInvitationStatus != ''">
- clubInvitationStatus = #{clubInvitationStatus},
- </if>
- <if test="recAddress != null and recAddress != ''">
- recAddress = #{recAddress},
- </if>
- <if test="businessLicenseImage != null">
- businessLicenseImage = #{businessLicenseImage},
- </if>
- <if test="socialCreditCode != null and socialCreditCode != ''">
- socialCreditCode = #{socialCreditCode},
- </if>
- <if test="sortIndex != null and sortIndex != ''">
- sortIndex = #{sortIndex},
- </if>
- <if test="recTownID != null and recTownID != ''">
- recTownID = #{recTownID},
- </if>
- <if test="defaultServiceProviderID != null and defaultServiceProviderID != ''">
- defaultServiceProviderID = #{defaultServiceProviderID},
- </if>
- <if test="defaultServiceProviderUpdTime != null and defaultServiceProviderUpdTime != ''">
- defaultServiceProviderUpdTime = #{defaultServiceProviderUpdTime},
- </if>
- <if test="firstServiceProviderFlag != null and firstServiceProviderFlag != ''">
- firstServiceProviderFlag = #{firstServiceProviderFlag},
- </if>
- <if test="scale != null and scale != ''">
- scale = #{scale},
- </if>
- <if test="empnum != null and empnum != ''">
- empnum = #{empnum},
- </if>
- <if test="mainpro != null and mainpro != ''">
- mainpro = #{mainpro},
- </if>
- <if test="remark != null and remark != ''">
- remark = #{remark},
- </if>
- <if test="scanFlag != null and scanFlag != ''">
- scanFlag = #{scanFlag},
- </if>
- <if test="headpic != null">
- headpic = #{headpic},
- </if>
- <if test="lastModify != null and lastModify != ''">
- lastModify = DATE_FORMAT(#{lastModify},'%Y-%m-%d %H:%i:%s'),
- </if>
- <if test="firstClubType != null and firstClubType != ''">
- firstClubType=#{firstClubType},
- </if>
- <if test="secondClubType != null and secondClubType != ''">
- secondClubType=#{secondClubType},
- </if>
- <if test="department != null and department != ''">
- department=#{department},
- </if>
- <if test="medicalPracticeLicenseImg != null and medicalPracticeLicenseImg != ''">
- medicalPracticeLicenseImg=#{medicalPracticeLicenseImg},
- </if>
- userID = #{userID}
- WHERE clubID = #{clubID}
- </update>
- <delete id="delete">
- DELETE FROM club
- WHERE clubID = #{clubID}
- </delete>
- <select id="findClubById" resultType="NewCmClub">
- SELECT
- <include refid="newCmClubColumns"/>
- , CONCAT(d.name,c.name ,b.name ,a.`address` ) address
- FROM club a
- LEFT JOIN user u ON u.userID = a.userID
- LEFT JOIN town b ON a.townID =b.townID
- LEFT JOIN city c ON b.cityID=c.cityID
- JOIN province d ON c.`provinceID` =d.`provinceID`
- WHERE a.clubID=#{clubID}
- </select>
- <select id="findSpId" resultType="java.lang.Integer">
- select serviceProviderID from serviceprovider where serviceProviderID = #{spID} and status = 90
- </select>
- <insert id="insertBeansHistory">
- INSERT INTO `user_beans_history` (
- `userId`, `type`, `beansType`, `orderId`,
- `num`, `pushStatus`, `addTime`, delFlag
- )
- VALUES
- (
- #{userId}, #{type}, #{beansType}, #{orderId},
- #{num}, #{pushStatus}, #{addTime}, 0
- )
- </insert>
- </mapper>
|