CREATE DEFINER=`root`@`localhost` PROCEDURE `GL REPORT_SP`(IN con CHAR(50),IN dt CHAR(50),IN ddt CHAR(50))
BEGIN
select a.gl,
#cast((amp_tot /100) as decimal(9,2)) amp_tot,
amp_tot,
rds_tot,
(amp_tot * -1) + rds_tot as difference,
cast(((rds_tot + (amp_tot * -1)) / rds_tot) * 100 as decimal(9,2)) as variance
#(cast(rds_tot as decimal(9,2)) + cast((amp_tot /100) as decimal(9,2))) as difference
from
(
select
gl, cast(sum(totamt) as decimal(9,2)) as AMP_TOT
from avsamp a
where convert(ddate, date) = dt
#and wizco in ('082', '085')
and cocountry in (con)
group by gl
#order by wizco, cocountry, gl;
#select distinct(wizco), gl, sum(totamt) amp_tot
#, WIZco, sum(TOTAMT )
#from budamp
#where ddate = '20181101'
#group by gl
#order by gl
) a
left join
(
select
a.rdsgl, cast(sum(totamt) as decimal(9,2)) as RDS_TOT
from avsrds a
where uncntry = con
and ddate = ddt
group by a.rdsgl
#order by a.rdsgl
) b on b.rdsgl = a.gl
order by a.gl;
END
@Entity
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@Table(name = "PAYRDS")
@Primary
@NamedStoredProcedureQueries({ @NamedStoredProcedureQuery(name = "firstProcedure", procedureName = "getCountDetails"),
@NamedStoredProcedureQuery( name = "secondProcedure", procedureName = "getRDSByCountry", parameters = {
@StoredProcedureParameter(mode = ParameterMode.IN , name = "Country", type = String.class)}),
@NamedStoredProcedureQuery( name = "thirdProcedure", procedureName = "getResultByDateCountry",
resultClasses = { RDS8887.class },
parameters = {
@StoredProcedureParameter(
mode = ParameterMode.IN , name = "Country", type = String.class),
@StoredProcedureParameter(
mode = ParameterMode.IN , name = "ddate", type = String.class),
})
})
对于GL报告,我需要利用两个表来利用将与2个类映射的命名存储过程。我编写了一个存储过程,该存储过程使用了一个RDS8887
类,但是我在如何使用2个类上却遇到了困难?