<?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.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferCompanyMapper">

    <select id="listPowerTransferCompanyZHDto" resultType="com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyZHDto">
    SELECT
	g.sequence_nbr sequenceNbr,
	g.rec_date recDate,
	g.dispatch_type dispatchType,
	g.address,
	g.is_distribution_agencies isDistributionAgencies,
	g.company_name companyName,
	group_concat( DISTINCT concat( g.resources_name, "(车牌:", g.resources_num, ")" ) ) AS submissionContent
FROM
	(
	SELECT
		a.sequence_nbr,
		a.dispatch_type,
		a.rec_date,
		a.address,
		b.company_name,
		b.is_distribution_agencies,
		c.resources_name,
		c.resources_num
	FROM
		jc_power_transfer a
		LEFT JOIN jc_power_transfer_company b ON a.sequence_nbr = b.power_transfer_id
		LEFT JOIN jc_power_transfer_company_resources c ON b.sequence_nbr = c.power_transfer_company_id
	WHERE
		a.alert_called_id = ${id}
	) g
GROUP BY
	g.company_name,
	g.rec_date,
	g.dispatch_type,
	g.address,
	g.is_distribution_agencies,
	g.sequence_nbr;
    </select>


	<select id="getTodayPowerTransferCompany" resultType="com.yeejoin.amos.boot.module.jcs.api.dto.PowerTodayData">
	select
	jc_power_transfer_company.company_name companyName ,
	jc_power_transfer_company_resources.resources_name carName,
	jc_power_transfer_company.rec_date time

	from jc_power_transfer_company  LEFT JOIN jc_power_transfer_company_resources   on jc_power_transfer_company.sequence_nbr= jc_power_transfer_company_resources.power_transfer_company_id  where jc_power_transfer_company.is_delete=0

	and to_days(jc_power_transfer_company.rec_date) = to_days(now())  ORDER BY jc_power_transfer_company.rec_date DESC
    </select>
</mapper>
