yanghb
2023-04-21 0481353111afb43a2322e18530dde26f1d841ead
ManagementTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TCompanyMapper.xml
@@ -53,24 +53,18 @@
        <result column="upload" property="upload" />
        <result column="insertTime" property="insertTime" />
        <result column="detailAddress" property="detailAddress" />
        <result column="scale" property="scale" />
        <result column="companyInfo" property="companyInfo" />
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, isSpe, isTaxi, isCross, isCrossLogistics, isSameLogistics, isCharter, isSpeFixedOrProportional, isTaxiFixedOrProportional,
        isCrossLogisticsFixedOrProportional, isSameLogisticsFixedOrProportional, speMoney, taxiMoney, crossLogisticsMoney, sameLogisticsMoney,
        isNeedFerry, name, type, superiorId, principalName, principalPhone, adminName, adminPhone, urgentPhoen, setupTime, identifier, addressCode,
        businessScope, contactAddress, documentAddress, economicType, regCapital, legalName, legalId, legalPhone, legalPhotoUrl, licensingAgency, licenseTime,
        licenseStartTime, licenseEndTime, licenseNumber, carNum, driverNum, mac, state, flag, upload, insertTime, detailAddress, companyInfo, scale
        id, isSpe, isTaxi, isCross, isCrossLogistics, isSameLogistics, isCharter, isSpeFixedOrProportional, isTaxiFixedOrProportional, isCrossLogisticsFixedOrProportional, isSameLogisticsFixedOrProportional, speMoney, taxiMoney, crossLogisticsMoney, sameLogisticsMoney, isNeedFerry, name, type, superiorId, principalName, principalPhone, adminName, adminPhone, urgentPhoen, setupTime, identifier, addressCode, businessScope, contactAddress, documentAddress, economicType, regCapital, legalName, legalId, legalPhone, legalPhotoUrl, licensingAgency, licenseTime, licenseStartTime, licenseEndTime, licenseNumber, carNum, driverNum, mac, state, flag, upload, insertTime, detailAddress
    </sql>
    <!--根据条件查询分公司列表-->
    <select id="getCompanyList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
        SELECT * FROM (SELECT ui.account,IFNULL(ci.num,0) as franchiseeNum,IFNULL(ca.num,0) as carNumber,IFNULL(di.num,0) as driverNumber,
        CONCAT(case when cc.isSpe = 1 then '快车,' else '' end,
        CONCAT(case when cc.isSpe = 1 then '专车,' else '' end,
        case when cc.isTaxi = 1 then '出租车,' else '' end,
        case when cc.isCross = 1 then '跨城出行,' else '' end,
        case when cc.isCrossLogistics = 1 then '跨城小件物流,' else '' end,
@@ -129,7 +123,7 @@
    <!--根据条件查询加盟商列表-->
    <select id="getFranchiseeList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
        SELECT * FROM (SELECT ui.account,ci.`name` as companyName,IFNULL(ca.num,0) as carNumber,IFNULL(di.num,0) as driverNumber,
        CONCAT(case when cc.isSpe = 1 then '快车,' else '' end,
        CONCAT(case when cc.isSpe = 1 then '专车,' else '' end,
        case when cc.isTaxi = 1 then '出租车,' else '' end,
        case when cc.isCross = 1 then '跨城出行,' else '' end,
        case when cc.isCrossLogistics = 1 then '跨城小件物流,' else '' end,
@@ -637,43 +631,5 @@
            group by DATE_FORMAT(a.insert_time, '%Y-%m-%d')
            ) as aa group by aa.time
        ) as da order by `time` desc
    </select>
    <select id="getCompanyIncomeList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
        SELECT c.id,c.`name`,(
        SELECT IFNULL(SUM(money),0) FROM t_income WHERE userType=1 AND objectId=c.id
            <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
                AND (insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
            </if>
        ) money FROM t_company c WHERE 1=1 and c.type = 2 and c.flag != 3
            <if test="userId != null and userId != ''">
                and find_in_set(c.id, #{userId})
            </if>
    </select>
    <select id="getCompanyIncomeListEx" resultType="map">
        SELECT c.id,c.`name`,(
        SELECT IFNULL(SUM(money),0) FROM t_income WHERE userType=1 AND objectId=c.id
            <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
                AND (insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
            </if>
        ) money FROM t_company c WHERE 1=1 and c.type = 2 and c.flag != 3
            <if test="userId != null and userId != ''">
                and find_in_set(c.id, #{userId})
            </if>
    </select>
    <select id="getSumCompanyIncomeMoney" resultType="java.lang.Double">
        SELECT SUM(money) from (SELECT c.id,c.`name`,(
        SELECT IFNULL(SUM(money),0) FROM t_income WHERE userType=1 AND objectId=c.id
            <if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''">
                AND (insertTime between CONCAT(#{beginTime},' 00:00:00') and CONCAT(#{endTime},' 23:59:59'))
            </if>
        ) money FROM t_company c WHERE 1=1 and c.type = 2 and c.flag != 3
            <if test="userId != null and userId != ''">
                and find_in_set(c.id, #{userId})
            </if>
       ) o
    </select>
</mapper>