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
SELECT hygf_preparation_money.*,IFNULL(order_status,arrival_state) as orderStatus,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},'%')
...
...
@@ -24,8 +24,8 @@ LEFT JOIN hygf_document_station on hygf_document_station.station_id=hygf_peasan
<iftest="dto.oddNumbers != null and dto.oddNumbers != ''">
and hygf_preparation_money.odd_numbers like concat ('%',#{dto.oddNumbers},'%')
</if>
<iftest="dto.deliveryState != null and dto.deliveryState != ''">
and hygf_preparation_money.delivery_state = #{dto.deliveryState}
<iftest="dto.orderStatus != null and dto.orderStatus != ''">
and hygf_preparation_money.order_status = #{dto.orderStatus}
</if>
<iftest="dto.amosUnitId != null and dto.amosUnitId != ''">
and hygf_preparation_money.amos_unit_id = #{dto.amosUnitId}
...
...
@@ -37,11 +37,11 @@ LEFT JOIN hygf_document_station on hygf_document_station.station_id=hygf_peasan
and hygf_preparation_money.delivery_time between #{dto.deliveryTimeStart} and #{dto.deliveryTimeEnd}
hygf_document_station.preparation_money_id as preparationMoneyId,
hygf_preparation_money.delivery_time as deliveryTime,
hygf_preparation_money.arrival_time as arrivalTime,
(select instance_id from hygf_preparation_money_auditing where hygf_document_station.preparation_money_id = hygf_preparation_money_auditing.preparation_money_id limit 1) 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
LEFT JOIN hygf_preparation_money on hygf_preparation_money.sequence_nbr = hygf_document_station.preparation_money_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}
and hygf_peasant_household.regional_companies_code like concat('%',#{regionalCompaniesSeq},'%')
</if>
<iftest="developerId!=null and developerId !=''">
and hygf_peasant_household.developer_id = #{developerId}
and hygf_peasant_household.developer_code like concat('%',#{developerId},'%')
</if>
<iftest="state!=null and state !=''">
and hygf_peasant_household.preparation_money_state = #{state}
...
...
@@ -79,6 +82,7 @@ LEFT JOIN hygf_document_station on hygf_document_station.station_id=hygf_peasan
</if>
</where>
GROUP BY hygf_peasant_household.sequence_nbr
order by hygf_peasant_household.sequence_nbr DESC
order by hygf_peasant_household.sequence_nbr DESC ) b