123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471 |
- <?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.NewCmShopDao">
- <sql id="newCmShopColumns">
- a.shopID AS "shopID",
- a.checkMan as "checkMan",
- a.userID AS "userID",
- a.name AS "name",
- u.userName AS "sname",
- a.logo AS "logo",
- a.legalPerson AS "legalPerson",
- a.businessLicense AS "businessLicense",
- a.businessLicenseImage AS "businessLicenseImage",
- a.taxCertificate AS "taxCertificate",
- a.taxCertificateImage AS "taxCertificateImage",
- a.townID AS "townID",
- d.provinceID AS "provinceID",
- c.cityID AS "cityID",
- a.address AS "address",
- a.registeredCapital AS "registeredCapital",
- a.nature AS "nature",
- a.turnover AS "turnover",
- a.linkMan AS "linkMan",
- a.contractPhone AS "contractPhone",
- ifnull(u.bindMobile,a.contractMobile) AS "contractMobile",
- a.contractEmail AS "contractEmail",
- a.fax AS "fax",
- a.zipCode AS "zipCode",
- a.info AS "info",
- a.productDesc AS "productDesc",
- a.website,
- a.wxOfficialAccount,
- a.wxApplets,
- a.addTime AS "addTime",
- a.auditStatus AS "auditStatus",
- a.auditTime AS "auditTime",
- a.auditNote AS "auditNote",
- a.validFlag AS "validFlag",
- a.status AS "status",
- a.maintenanceFee AS "maintenanceFee",
- a.maintenanceDate AS "maintenanceDate",
- a.businessScope AS "businessScope",
- u.account AS "account",
- u.registerTime AS "registerTime",
- a.firstShopType AS "firstShopType",
- a.secondShopType AS "secondShopType",
- a.medicalPracticeLicenseImg1 AS "medicalPracticeLicenseImg1",
- a.medicalPracticeLicenseImg2 AS "medicalPracticeLicenseImg2",
- a.medicalPracticeLicenseImg3 AS "medicalPracticeLicenseImg3",
- a.mainpro AS "mainpro",
- a.bankAccount AS "bankAccount",
- a.ableRebateAmount AS "ableRebateAmount",
- a.rebateAmount AS "rebateAmount",
- a.bankAccountName AS "bankAccountName",
- a.bankName AS "bankName",
- a.socialCreditCode AS "socialCreditCode",
- u.email,
- u.source AS "source",
- a.shopType AS "shopType",
- a.cardNumber AS "cardNumber",
- a.chargeSupport AS "chargeSupport",
- d.name AS "province",c.name AS "city",b.name AS "town"
- </sql>
- <sql id="newCmShopJoins">
- LEFT JOIN user u ON u.userID = a.userID
- 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="NewCmShop">
- SELECT
- <include refid="newCmShopColumns"/>
- FROM shop a
- <include refid="newCmShopJoins"/>
- WHERE a.shopID = #{id}
- </select>
- <select id="getShopcert" resultType="com.caimei.modules.cibe.entity.ShopCert">
- SELECT
- *
- FROM shopcert s
- WHERE s.shopID = #{shopId}
- and s.shopCertTypeID = #{type}
- </select>
- <select id="findList" resultType="NewCmShop">
- SELECT
- <include refid="newCmShopColumns"/>
- FROM shop a
- <include refid="newCmShopJoins"/>
- <where>
- <if test="name != null and name != ''">
- AND a.name LIKE concat('%',#{name},'%')
- </if>
- <if test="status != null and status != ''">
- AND a.status = #{status}
- </if>
- <if test="contractMobile != null and contractMobile != ''">
- AND a.contractMobile = #{contractMobile}
- </if>
- <if test="linkMan != null and linkMan != ''">
- AND a.linkMan LIKE concat('%',#{linkMan},'%')
- </if>
- <if test="shopType !=null">
- AND a.shopType = #{shopType}
- </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="email != null and email != ''">
- AND u.email = #{email}
- </if>
- <if test="source != null and source != ''">
- AND u.source = #{source}
- </if>
- <if test="shopID != null and shopID>0">
- AND a.shopID = #{shopID}
- </if>
- </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.shopID DESC
- </otherwise>
- </choose>
- </select>
- <select id="findAllList" resultType="NewCmShop">
- SELECT
- <include refid="newCmShopColumns"/>
- FROM shop a
- <include refid="newCmShopJoins"/>
- <where>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <select id="findSplitCode" resultType="com.caimei.modules.user.entity.SplitCode">
- select shopId,commercialCode as splitCode,codeDetail as codeRemark,email as email,weChatFlag
- from cm_shop_splitcode
- where shopId = #{shopID}
- </select>
- <insert id="saveShopcert" parameterType="com.caimei.modules.cibe.entity.ShopCert" keyProperty="shopCertID" useGeneratedKeys="true">
- INSERT INTO `shopcert` (
- `shopID`,
- `shopCertTypeID`,
- `name`,
- `image`,
- `organization`,
- `effectDate`,
- `loseEfficacyDate`
- )
- VALUES(
- #{shopID},
- #{shopCertTypeID},
- #{name},
- #{image},
- #{organization},
- #{effectDate},
- #{loseEfficacyDate}
- )
- </insert>
- <insert id="insert" parameterType="NewCmShop" keyProperty="shopID" useGeneratedKeys="true">
- INSERT INTO shop(
- userID,
- name,
- sname,
- logo,
- legalPerson,
- businessLicense,
- businessLicenseImage,
- taxCertificate,
- taxCertificateImage,
- provinceID,
- cityID,
- townID,
- address,
- registeredCapital,
- nature,
- turnover,
- linkMan,
- contractPhone,
- contractMobile,
- contractEmail,
- fax,
- zipCode,
- info,
- productDesc,
- addTime,
- auditStatus,
- auditTime,
- auditNote,
- validFlag,
- status,
- maintenanceFee,
- maintenanceDate,
- businessScope,
- firstShopType,
- secondShopType,
- medicalPracticeLicenseImg1,
- medicalPracticeLicenseImg2,
- medicalPracticeLicenseImg3,
- mainpro,
- socialCreditCode,
- shopType
- ) VALUES (
- #{userID},
- #{name},
- #{sname},
- #{logo},
- #{legalPerson},
- #{businessLicense},
- #{businessLicenseImage},
- #{taxCertificate},
- #{taxCertificateImage},
- #{provinceID},
- #{cityID},
- #{townID},
- #{address},
- #{registeredCapital},
- #{nature},
- #{turnover},
- #{linkMan},
- #{contractPhone},
- #{contractMobile},
- #{contractEmail},
- #{fax},
- #{zipCode},
- #{info},
- #{productDesc},
- #{addTime},
- #{auditStatus},
- #{auditTime},
- #{auditNote},
- #{validFlag},
- #{status},
- #{maintenanceFee},
- #{maintenanceDate},
- #{businessScope},
- #{firstShopType},
- #{secondShopType},
- #{medicalPracticeLicenseImg1},
- #{medicalPracticeLicenseImg2},
- #{medicalPracticeLicenseImg3},
- #{mainpro},
- #{socialCreditCode},
- #{shopType}
- )
- </insert>
- <insert id="insertSplitCode">
- insert into cm_shop_splitcode
- (shopId, commercialCode, codeDetail,email,weChatFlag)
- values (#{shopId},#{splitCode},#{codeRemark},#{email},#{weChatFlag})
- </insert>
- <insert id="insertSepcial" parameterType="NewCmShop" keyProperty="shopID" useGeneratedKeys="true">
- insert into shop(name,linkMan,contractMobile,status,addTime,shopType)
- VALUES (#{name},#{linkMan},#{contractMobile},#{status},now(),2)
- </insert>
- <update id="update">
- UPDATE shop
- <set>
- <if test="name != null and name != ''" >
- name = #{name},
- </if>
- website = #{website},
- wxOfficialAccount = #{wxOfficialAccount},
- wxApplets = #{wxApplets},
- <if test="chargeSupport != null" >
- chargeSupport=#{chargeSupport},
- </if>
- <if test="sname != null and sname != ''" >
- sname = #{sname},
- </if>
- <if test="logo != null and logo != ''" >
- logo = #{logo},
- </if>
- <if test="legalPerson != null and legalPerson != ''" >
- legalPerson = #{legalPerson},
- </if>
- <if test="businessLicense != null and businessLicense != ''" >
- businessLicense = #{businessLicense},
- </if>
- <if test="businessLicenseImage != null and businessLicenseImage != ''" >
- businessLicenseImage = #{businessLicenseImage},
- </if>
- <if test="taxCertificate != null and taxCertificate != ''" >
- taxCertificate = #{taxCertificate},
- </if>
- <if test="taxCertificateImage != null and taxCertificateImage != ''" >
- taxCertificateImage = #{taxCertificateImage},
- </if>
- <if test="address != null and address != ''" >
- address = #{address},
- </if>
- <if test="registeredCapital != null and registeredCapital != ''" >
- registeredCapital = #{registeredCapital},
- </if>
- <if test="nature != null and nature != ''" >
- nature = #{nature},
- </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="contractEmail != null and contractEmail != ''" >
- contractEmail = #{contractEmail},
- </if>
- <if test="fax != null and fax != ''" >
- fax = #{fax},
- </if>
- <if test="zipCode != null and zipCode != ''" >
- zipCode = #{zipCode},
- </if>
- <if test="info != null and info != ''" >
- info = #{info},
- </if>
- <if test="productDesc != null and productDesc != ''" >
- productDesc = #{productDesc},
- </if>
- <if test="status != null and status != ''" >
- status = #{status},
- </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="maintenanceFee != null and maintenanceFee != ''" >
- maintenanceFee = #{maintenanceFee},
- </if>
- <if test="maintenanceDate != null and maintenanceDate != ''" >
- maintenanceDate = #{maintenanceDate},
- </if>
- <if test="businessScope != null and businessScope != ''" >
- businessScope = #{businessScope},
- </if>
- <if test="firstShopType != null and firstShopType != ''" >
- firstShopType=#{firstShopType},
- </if>
- <if test="secondShopType != null and secondShopType != ''" >
- secondShopType=#{secondShopType},
- </if>
- <if test="medicalPracticeLicenseImg1 != null and medicalPracticeLicenseImg1 != ''" >
- medicalPracticeLicenseImg1=#{medicalPracticeLicenseImg1},
- </if>
- <if test="medicalPracticeLicenseImg2 != null and medicalPracticeLicenseImg2 != ''" >
- medicalPracticeLicenseImg2=#{medicalPracticeLicenseImg2},
- </if>
- <if test="medicalPracticeLicenseImg3 != null and medicalPracticeLicenseImg3 != ''" >
- medicalPracticeLicenseImg3=#{medicalPracticeLicenseImg3},
- </if>
- <if test="mainpro != null and mainpro != ''">
- mainpro=#{mainpro},
- </if>
- <if test="ableRebateAmount != null">
- ableRebateAmount=#{ableRebateAmount},
- </if>
- <if test="rebateAmount != null">
- rebateAmount=#{rebateAmount},
- </if>
- <if test="bankAccount != null">
- bankAccount=#{bankAccount},
- </if>
- <if test="bankAccountName != null">
- bankAccountName=#{bankAccountName},
- </if>
- <if test="bankName != null">
- bankName=#{bankName},
- </if>
- <if test="socialCreditCode != null">
- socialCreditCode = #{socialCreditCode}
- </if>
- </set>
- WHERE shopID = #{shopID}
- </update>
- <delete id="delete">
- DELETE FROM shop
- WHERE shopID = #{id}
- </delete>
- <delete id="deleteCert">
- DELETE FROM shopcert
- WHERE shopID = #{shopID}
- </delete>
- <delete id="deleteSplitCode">
- delete from cm_shop_splitcode
- where shopId = #{shopID}
- </delete>
- <update id="updateAbleRebateAmount" parameterType="NewCmShop">
- update shop set ableRebateAmount = #{ableRebateAmount} where shopID = #{shopID}
- </update>
- <update id="backAbleRebateAmount" parameterType="NewCmShop">
- update shop set ableRebateAmount = (ableRebateAmount + #{balancePayFee}) where shopID = #{shopID}
- </update>
- <update id="updateRebateAmount">
- update shop set rebateAmount = (rebateAmount - #{balancePayFee})
- where shopID = #{shopID}
- </update>
- <update id="offline">
- update shop set status = 91 where shopID = #{shopID}
- </update>
- <update id="online">
- update shop set status = 90 where shopID= #{shopID}
- </update>
- <select id="maintenanceList" resultType="CmDiscernReceipt">
- SELECT
- a.id as receiptID,a.shopID,a.receiptAmount,a.receiptDate,a.receStatct,s.linkMan
- FROM cm_discern_receipt a
- LEFT JOIN shop s ON s.shopID = a.shopID
- <where>
- AND a.shopID=#{shopID}
- AND a.newReceiptType=1
- <if test="startTime != null and startTime != ''">
- AND (a.receiptDate > #{startTime} OR a.receiptDate = #{startTime})
- </if>
- <if test="endTime != null and endTime != ''">
- AND (a.receiptDate < #{endTime} OR a.receiptDate = #{endTime})
- </if>
- or a.receStatct is not null
- ORDER BY a.receiptDate DESC
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- </choose>
- </select>
- <insert id="Removethelastfee">
- insert into cm_discern_receipt
- (shopID, receStatct, receiptDate,delFlag)
- values (#{shopID},#{receStatct}, #{receiptDate},1)
- </insert>
- <update id="Removethelast">
- update cm_discern_receipt set receStatct = 0 where id= #{receiptID}
- </update>
- </mapper>
|