|
@@ -0,0 +1,191 @@
|
|
|
+<?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.sooka.sponest.data.housingconstruction.mapper.CenterdataTHousingconstructionViewMapper">
|
|
|
+
|
|
|
+ <select id="getGasCylinderList" parameterType="CenterdataTHousingconstructionSteelcylinder" resultType="map">
|
|
|
+ select
|
|
|
+ sum(case when state='state_4' then 1 else 0 end) inUse,
|
|
|
+ sum(case when state!='state_4' then 1 else 0 end) toUse
|
|
|
+ from centerdata_t_housingconstruction_steelcylinder a
|
|
|
+ LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
|
|
|
+ WHERE 1=1 ${params.dataScope}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getOrderList" parameterType="CenterdataTHousingconstructionSteelcylinder" resultType="map">
|
|
|
+ SELECT concat(a.`month`,'月') `month`, IFNULL(b.num, 0) num
|
|
|
+ FROM (SELECT 1 AS `month` UNION
|
|
|
+ SELECT 2 AS `month` UNION
|
|
|
+ SELECT 3 AS `month` UNION
|
|
|
+ SELECT 4 AS `month` UNION
|
|
|
+ SELECT 5 AS `month` UNION
|
|
|
+ SELECT 6 AS `month` UNION
|
|
|
+ SELECT 7 AS `month` UNION
|
|
|
+ SELECT 8 AS `month` UNION
|
|
|
+ SELECT 9 AS `month` UNION
|
|
|
+ SELECT 10 AS `month` UNION
|
|
|
+ SELECT 11 AS `month` UNION
|
|
|
+ SELECT 12 AS `month`) a
|
|
|
+ left join
|
|
|
+ (SELECT MONTH( b.sign_time ) `month`, count( b.id ) num
|
|
|
+ FROM
|
|
|
+ centerdata_t_housingconstruction_steelcylinder a
|
|
|
+ LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
|
|
|
+ LEFT JOIN centerdata_t_housingconstruction_steelcylinder_log b ON a.id = b.steelcylinder_id
|
|
|
+ WHERE
|
|
|
+ YEAR( b.sign_time ) = YEAR( CURRENT_DATE )
|
|
|
+ ${params.dataScope}
|
|
|
+ GROUP BY
|
|
|
+ MONTH( b.sign_time )) b on a.`month` = b.`month`
|
|
|
+ ORDER BY a.`month`
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getCarList" parameterType="CenterdataTHousingconstructionCar" resultType="map">
|
|
|
+ SELECT
|
|
|
+ a.car_number carNumber,
|
|
|
+ a.manager_name managerName,
|
|
|
+ a.speed
|
|
|
+ FROM
|
|
|
+ centerdata_t_housingconstruction_car a
|
|
|
+ left join ${database_system}.sys_dept d on a.dept_id = d.dept_id
|
|
|
+ <where>
|
|
|
+ <if test="enterpriseId != null and enterpriseId != ''"> and a.enterprise_id = #{enterpriseId}</if>
|
|
|
+ <if test="carNumber != null and carNumber != ''"> and a.car_number like concat('%', #{carNumber}, '%')</if>
|
|
|
+ ${params.dataScope}
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getUserList" parameterType="CenterdataTHousingconstructionRealnameuser" resultType="map">
|
|
|
+ SELECT
|
|
|
+ 'total' type,
|
|
|
+ count( a.id ) num
|
|
|
+ FROM
|
|
|
+ centerdata_t_housingconstruction_realnameuser a
|
|
|
+ LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
|
|
|
+ where 1=1 ${params.dataScope}
|
|
|
+ UNION ALL
|
|
|
+ SELECT
|
|
|
+ 'add' type,
|
|
|
+ count( a.id ) num
|
|
|
+ FROM
|
|
|
+ centerdata_t_housingconstruction_realnameuser a
|
|
|
+ LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
|
|
|
+ WHERE a.create_time >= DATE_SUB( CURRENT_DATE, INTERVAL 30 DAY )
|
|
|
+ ${params.dataScope}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getSteelcylinderList" parameterType="CenterdataTHousingconstructionSteelcylinder" resultType="map">
|
|
|
+ SELECT
|
|
|
+ a.dict_label type,
|
|
|
+ IFNULL(b.num,0) num
|
|
|
+ from onest_system.sys_dict_data a
|
|
|
+ left join (
|
|
|
+ SELECT
|
|
|
+ a.standards,
|
|
|
+ count(a.id) num
|
|
|
+ FROM
|
|
|
+ centerdata_t_housingconstruction_steelcylinder a
|
|
|
+ LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
|
|
|
+ <where>
|
|
|
+ <if test="enterpriseId != null and enterpriseId != ''"> and a.enterprise_id = #{enterpriseId}</if>
|
|
|
+ ${params.dataScope}
|
|
|
+ </where>
|
|
|
+ GROUP BY a.standards) b on a.dict_value = b.standards
|
|
|
+ where a.dict_type = 'steelcylinder_type'
|
|
|
+ order by a.dict_code
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getThreeUserList" parameterType="CenterdataTHousingconstructionRealnameuser" resultType="map">
|
|
|
+
|
|
|
+ SELECT concat(a.`month`,'月') `month`,IFNULL(b.num,0) cyNum,IFNULL(c.num,0) psNum,IFNULL(d.num,0) smNum FROM
|
|
|
+ (SELECT 1 AS `month` UNION
|
|
|
+ SELECT 2 AS `month` UNION
|
|
|
+ SELECT 3 AS `month` UNION
|
|
|
+ SELECT 4 AS `month` UNION
|
|
|
+ SELECT 5 AS `month` UNION
|
|
|
+ SELECT 6 AS `month` UNION
|
|
|
+ SELECT 7 AS `month` UNION
|
|
|
+ SELECT 8 AS `month` UNION
|
|
|
+ SELECT 9 AS `month` UNION
|
|
|
+ SELECT 10 AS `month` UNION
|
|
|
+ SELECT 11 AS `month` UNION
|
|
|
+ SELECT 12 AS `month`) a
|
|
|
+ left join
|
|
|
+ (SELECT MONTH( a.register_time ) `month`,count( a.id ) num
|
|
|
+ FROM
|
|
|
+ centerdata_t_housingconstruction_practitioner a
|
|
|
+ LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
|
|
|
+ WHERE
|
|
|
+ YEAR ( a.register_time ) = YEAR ( CURRENT_DATE )
|
|
|
+ <if test="enterpriseId != null and enterpriseId != ''"> and a.enterprise_id = #{enterpriseId}</if>
|
|
|
+ ${params.dataScope}
|
|
|
+ group by MONTH( a.register_time )) b on a.`month` = b.`month`
|
|
|
+ left join
|
|
|
+ (SELECT MONTH( a.register_time ) `month`,
|
|
|
+ count( a.id ) num
|
|
|
+ FROM
|
|
|
+ centerdata_t_housingconstruction_delivery_personnel a
|
|
|
+ LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
|
|
|
+ WHERE
|
|
|
+ YEAR ( a.register_time ) = YEAR ( CURRENT_DATE )
|
|
|
+ <if test="enterpriseId != null and enterpriseId != ''"> and a.enterprise_id = #{enterpriseId}</if>
|
|
|
+ ${params.dataScope}
|
|
|
+ group by MONTH( a.register_time )) c on a.`month` =c.`month`
|
|
|
+
|
|
|
+ left join
|
|
|
+ (SELECT MONTH( a.account_open_time ) `month`,
|
|
|
+ count( a.id ) num
|
|
|
+ FROM
|
|
|
+ centerdata_t_housingconstruction_realnameuser a
|
|
|
+ LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
|
|
|
+ WHERE
|
|
|
+ YEAR ( a.account_open_time ) = YEAR ( CURRENT_DATE )
|
|
|
+ <if test="enterpriseId != null and enterpriseId != ''"> and a.enterprise_id = #{enterpriseId}</if>
|
|
|
+ ${params.dataScope}
|
|
|
+ group by MONTH( a.account_open_time )) d on a.`month` =d.`month`
|
|
|
+ ORDER BY a.`month`
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getRealnameuserList" parameterType="CenterdataTHousingconstructionRealnameuser" resultType="map">
|
|
|
+ SELECT a.enterprise_user_type type,
|
|
|
+ count(a.id) num
|
|
|
+ FROM centerdata_t_housingconstruction_realnameuser a
|
|
|
+ LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
|
|
|
+ <where>
|
|
|
+ <if test="enterpriseId != null and enterpriseId != ''"> and a.enterprise_id = #{enterpriseId}</if>
|
|
|
+ ${params.dataScope}
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ a.enterprise_user_type
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getDeliverymanList" parameterType="CenterdataTHousingconstructionDeliveryPersonnel" resultType="map">
|
|
|
+ SELECT
|
|
|
+ a.staff_name staffName,
|
|
|
+ a.phone,
|
|
|
+ '送货中' type
|
|
|
+ FROM
|
|
|
+ centerdata_t_housingconstruction_delivery_personnel a
|
|
|
+ LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
|
|
|
+ WHERE a.post = 'personnel_sj'
|
|
|
+ <if test="enterpriseId != null and enterpriseId != ''"> and a.enterprise_id = #{enterpriseId}</if>
|
|
|
+ ${params.dataScope}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getEnterpriseList" parameterType="CenterdataTHousingconstructionEnterprise" resultType="map">
|
|
|
+ SELECT
|
|
|
+ a.id enterpriseId,
|
|
|
+ a.enterprise_name enterpriseName,
|
|
|
+ count( b.id ) num
|
|
|
+ FROM
|
|
|
+ centerdata_t_housingconstruction_enterprise a
|
|
|
+ LEFT JOIN ${database_system}.sys_dept d ON a.dept_id = d.dept_id
|
|
|
+ LEFT JOIN centerdata_t_housingconstruction_steelcylinder b ON a.id = b.enterprise_id
|
|
|
+ <where>
|
|
|
+ ${params.dataScope}
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ a.id
|
|
|
+ </select>
|
|
|
+</mapper>
|