from hygf_power_station LEFT JOIN ( select peasant_household_id,initiate_status, contract_lock_id,stamp_status,status from hygf_household_contract where hygf_household_contract.status !='已作废'
from hygf_power_station LEFT JOIN ( select peasant_household_id,initiate_status, contract_lock_id,stamp_status,status from hygf_household_contract
) b on b.peasant_household_id=hygf_power_station.peasant_household_id
LEFT JOIN hygf_peasant_household on hygf_peasant_household.sequence_nbr=hygf_power_station.peasant_household_id
SELECT hygf_preparation_money.*,IFNULL(order_status,arrival_state) as arrivalState,IFNULL(order_status,delivery_state) as deliveryState,(select instance_id from hygf_preparation_money_auditing where preparation_money_id = hygf_preparation_money.sequence_nbr limit 1 ) as instanceId FROM hygf_preparation_money
<where>
<iftest="dto.consigneeRegion != null and dto.consigneeRegion != ''">
and hygf_preparation_money.consignee_region like concat ('%',#{dto.consigneeRegion},'%')
...
...
@@ -31,7 +31,7 @@ LEFT JOIN hygf_document_station on hygf_document_station.station_id=hygf_peasan
and hygf_preparation_money.amos_unit_id = #{dto.amosUnitId}
</if>
<iftest="dto.flag != null and dto.flag != ''">
and hygf_preparation_money.delivery_state != "已作废"
and hygf_preparation_money.delivery_state != "已作废" and hygf_preparation_money.delivery_state != "待发货"
</if>
<iftest="dto.deliveryTimeStart != null and dto.deliveryTimeEnd != ''">
and hygf_preparation_money.delivery_time between #{dto.deliveryTimeStart} and #{dto.deliveryTimeEnd}
...
...
@@ -39,4 +39,48 @@ LEFT JOIN hygf_document_station on hygf_document_station.station_id=hygf_peasan
hygf_document_station.preparation_money_id as preparationMoneyId,
hygf_power_station.process_instance_id as instanceId
from
hygf_peasant_household
LEFT JOIN hygf_document_station on hygf_peasant_household.sequence_nbr = hygf_document_station.station_id
LEFT JOIN hygf_power_station on hygf_peasant_household.sequence_nbr = hygf_power_station.peasant_household_id
<where>
<iftest=" preparationMoneyState == 0 ">
and hygf_peasant_household.preparation_money_state in ('待发货','待补货','暂存发货')
</if>
<iftest="regionalCompaniesSeq!=null and regionalCompaniesSeq !='' ">
and hygf_peasant_household.regional_companies_seq = #{regionalCompaniesSeq}
</if>
<iftest="developerId!=null and developerId !=''">
and hygf_peasant_household.developer_id = #{developerId}
</if>
<iftest="state!=null and state !=''">
and hygf_peasant_household.preparation_money_state = #{state}
</if>
<iftest="ownersName!=null and ownersName !=''">
and hygf_peasant_household.owners_name like concat ('%',#{ownersName},'%')
</if>
<iftest=" preparationMoneyState == 1 ">
and hygf_peasant_household.preparation_money_state not in ('待发货','待补货','暂存发货') and preparation_money_state is not null and preparation_money_state != ''
LEFT JOIN amos_mcb.mcb_warning_base_warning_level LEVEL ON log.EVENT_LEVEL = LEVEL.CODE and LEVEL.SEQUENCE_NBR in (1, 2, 3)
LEFT JOIN amos_mcb.mcb_warning_base_source_attribution source ON source.CODE = log.SOURCE_ATTRIBUTION
mcb_warning_warning_info log
LEFT JOIN mcb_warning_base_warning_level warnLevel ON log.EVENT_LEVEL = warnLevel.CODE and warnLevel.SEQUENCE_NBR in (1, 2, 3)
LEFT JOIN mcb_warning_base_source_attribution source1 ON source1.CODE = log.SOURCE_ATTRIBUTION
<where>
<iftest="projectOrgCodes != null and projectOrgCodes.size() > 0">
AND log.SOURCE_ATTRIBUTION IN
...
...
@@ -270,18 +270,18 @@
question.SOURCE_ATTRIBUTION,
question.CONTENT,
question.LEVEL_DESC,
source.PROVINCE
source1.PROVINCE
FROM
(SELECT
QUESTION_NUM
FROM
amos_mcb.mcb_warning_warning_info
mcb_warning_warning_info
WHERE
mcb_warning_warning_info.PROCESSING_STATUS = 2
AND QUESTION_NUM IS NOT NULL
AND mcb_warning_warning_info.WARNING_SOURCE_TYPE_CODE IN ( SELECT CODE FROM amos_mcb.mcb_data_dictionary WHERE remark = 'OVERVIEW' )
) warnNum LEFT join amos_mcb.mcb_warning_question_info question on question.NUM = warnNum.QUESTION_NUM
LEFT JOIN amos_mcb.mcb_warning_base_source_attribution source ON source.CODE = question.SOURCE_ATTRIBUTION
AND mcb_warning_warning_info.WARNING_SOURCE_TYPE_CODE IN ( SELECT CODE FROM mcb_data_dictionary WHERE remark = 'OVERVIEW' )
) warnNum LEFT join mcb_warning_question_info question on question.NUM = warnNum.QUESTION_NUM
LEFT JOIN mcb_warning_base_source_attribution source1 ON source1.CODE = question.SOURCE_ATTRIBUTION
<where>
question.COMPLETION_STATUS != 1
<iftest="projectOrgCodes != null and projectOrgCodes.size() > 0">
...
...
@@ -324,7 +324,7 @@
<iftest="completionStatus != null and completionStatus != 0">
AND question.COMPLETION_STATUS = #{completionStatus}
</if>
LEFT JOIN mcb_warning_base_source_attribution source ON source.CODE = question.SOURCE_ATTRIBUTION
LEFT JOIN mcb_warning_base_source_attribution source1 ON source1.CODE = question.SOURCE_ATTRIBUTION
<where>
<iftest="projectOrgCodes != null and projectOrgCodes.size() > 0">
AND question.SOURCE_ATTRIBUTION IN
...
...
@@ -351,16 +351,16 @@
SUM(IFNULL(RPN, 0)) AS totalRPN,
COUNT(SEQUENCE_NBR) AS todayAlarm
FROM
amos_mcb.mcb_warning_warning_info
mcb_warning_warning_info
WHERE
date(CREATE_DATE) = CURRENT_DATE and mcb_warning_warning_info.WARNING_SOURCE_TYPE_CODE in (select code FROM amos_mcb.mcb_data_dictionary WHERE remark = 'OVERVIEW')
date(CREATE_DATE) = CURRENT_DATE and mcb_warning_warning_info.WARNING_SOURCE_TYPE_CODE in (select code FROM mcb_data_dictionary WHERE remark = 'OVERVIEW')
GROUP BY
SOURCE_ATTRIBUTION
)
SELECT
a.SEQUENCE_NBR AS sequenceNbr,
COALESCE(a.NAME, '') AS `name`,
COALESCE(a.CODE, '') AS `code`,
COALESCE(a.NAME, '') AS name,
COALESCE(a.CODE, '') AS code,
COALESCE(a.PARENT_ID, '') AS parentId,
COALESCE(a.LONGITUDE, '') AS longitude,
COALESCE(a.LATITUDE, '') AS latitude,
...
...
@@ -370,11 +370,11 @@
COALESCE(sq.totalRPN / NULLIF(COUNT(b.SOURCE_ATTRIBUTION), 0), 0) AS rpn,
IFNULL(sq.todayAlarm,0) as todayAlarm
FROM
amos_mcb.mcb_warning_base_source_attribution a
mcb_warning_base_source_attribution a
LEFT JOIN
SubQuery sq ON a.CODE = sq.SOURCE_ATTRIBUTION
LEFT JOIN
amos_mcb.mcb_warning_warning_info b ON a.CODE = b.SOURCE_ATTRIBUTION AND date(b.CREATE_DATE) = CURRENT_DATE
mcb_warning_warning_info b ON a.CODE = b.SOURCE_ATTRIBUTION AND date(b.CREATE_DATE) = CURRENT_DATE
<where>
<iftest="sourceAttribution != null and sourceAttribution != ''">
a.CODE LIKE CONCAT(#{sourceAttribution}, '%')
...
...
@@ -390,8 +390,8 @@
SELECT
count( 1 ) AS yearNum
FROM
amos_mcb.mcb_warning_warning_info
Left join mcb_warning_base_source_attribution mwbsa on mwbsa.`CODE` = mcb_warning_warning_info.SOURCE_ATTRIBUTION
mcb_warning_warning_info
Left join mcb_warning_base_source_attribution mwbsa on mwbsa.CODE = mcb_warning_warning_info.SOURCE_ATTRIBUTION
WHERE
YEAR(CREATE_DATE) = YEAR(CURDATE())
<iftest="province != null and province != '' ">
...
...
@@ -400,15 +400,15 @@
<iftest="sourceAttribution != null and sourceAttribution != '' ">
and mwbsa.CODE LIKE CONCAT (#{sourceAttribution},'%')
</if>
and mcb_warning_warning_info.WARNING_SOURCE_TYPE_CODE in (select code FROM amos_mcb.mcb_data_dictionary WHERE remark = 'OVERVIEW')
and mcb_warning_warning_info.WARNING_SOURCE_TYPE_CODE in (select code FROM mcb_data_dictionary WHERE remark = 'OVERVIEW')
</select>
<selectid="getMonthTotal"resultType="integer">
SELECT
count( 1 ) AS monNum
FROM
amos_mcb.mcb_warning_warning_info
Left join mcb_warning_base_source_attribution mwbsa on mwbsa.`CODE` = mcb_warning_warning_info.SOURCE_ATTRIBUTION
mcb_warning_warning_info
Left join mcb_warning_base_source_attribution mwbsa on mwbsa.CODE = mcb_warning_warning_info.SOURCE_ATTRIBUTION
WHERE
MONTH(CREATE_DATE) = MONTH(CURDATE())
<iftest="province != null and province != '' ">
...
...
@@ -417,15 +417,15 @@
<iftest="sourceAttribution != null and sourceAttribution != '' ">
and mwbsa.CODE LIKE CONCAT (#{sourceAttribution},'%')
</if>
and mcb_warning_warning_info.WARNING_SOURCE_TYPE_CODE in (select code FROM amos_mcb.mcb_data_dictionary WHERE remark = 'OVERVIEW')
and mcb_warning_warning_info.WARNING_SOURCE_TYPE_CODE in (select code FROM mcb_data_dictionary WHERE remark = 'OVERVIEW')
</select>
<selectid="getDayTotal"resultType="integer">
SELECT
count( 1 ) AS dayNUM ,
mwbsa.PROVINCE
FROM
amos_mcb.mcb_warning_warning_info
Left join mcb_warning_base_source_attribution mwbsa on mwbsa.`CODE` = mcb_warning_warning_info.SOURCE_ATTRIBUTION
mcb_warning_warning_info
Left join mcb_warning_base_source_attribution mwbsa on mwbsa.CODE = mcb_warning_warning_info.SOURCE_ATTRIBUTION
WHERE
DATE_FORMAT(CREATE_DATE,'%Y-%m-%d') = CURDATE()
<iftest="province != null and province != '' ">
...
...
@@ -434,6 +434,6 @@
<iftest="sourceAttribution != null and sourceAttribution != '' ">
and mwbsa.CODE LIKE CONCAT (#{sourceAttribution},'%')
</if>
and mcb_warning_warning_info.WARNING_SOURCE_TYPE_CODE in (select code FROM amos_mcb.mcb_data_dictionary WHERE remark = 'OVERVIEW')
and mcb_warning_warning_info.WARNING_SOURCE_TYPE_CODE in (select code FROM mcb_data_dictionary WHERE remark = 'OVERVIEW')
@Select("select SEQUENCE_NBR as sequenceNbr,ORG_CODE as orgCode,COMPANY_NAME as companyName ,LEVEL as level from privilege_company where COMPANY_TYPE = 'region' and IS_DELETED = 0 ")
@Select("select SEQUENCE_NBR as sequenceNbr,ORG_CODE as orgCode,COMPANY_NAME as companyName ,LEVEL_ as level_ from privilege_company where COMPANY_TYPE = 'region' and IS_DELETED = 0 ")
FSB IN ( SELECT DBID FROM `sjgl_zsj_zsbtz` WHERE MACHGENRE = ( SELECT DATAID FROM `tpri_dmp_databook` WHERE DATANAME = #{DATAID} ) AND WERKS = #{WERKS} )
FSB IN ( SELECT DBID FROM sjgl_zsj_zsbtz WHERE MACHGENRE = ( SELECT DATAID FROM tpri_dmp_databook WHERE DATANAME = #{DATAID} ) AND WERKS = #{WERKS} )
FSB IN ( SELECT DBID FROM `sjgl_zsj_zsbtz` WHERE MACHGENRE = ( SELECT DATAID FROM `tpri_dmp_databook` WHERE DATANAME = #{DATAID} ) AND WERKS = #{WERKS} )
FSB IN ( SELECT DBID FROM sjgl_zsj_zsbtz WHERE MACHGENRE = ( SELECT DATAID FROM tpri_dmp_databook WHERE DATANAME = #{DATAID} ) AND WERKS = #{WERKS} )