请问怎么才能把gr_totalfee的和在控制台输出出来
代码1:
select sum(gr_totalfee) as gr_totalfeevalue
from core_bill
代码2:
public interface BillMapper {
int deleteByPrimaryKey(String id);
int insert(Bill record);
int insertSelective(Bill record);
Bill selectByPrimaryKey(String id);
Bill selectByPrimaryKey1();
代码3:
@Autowired
BillMapper billMapper;
@RequestMapping("/toBill")
public String toBill() {
//Bill admin = billMapper.selectByPrimaryKey1();
Bill a = billMapper.selectByPrimaryKey1();
//System.out.println("自费:"+admin.getGrTotalfee());
//System.out.println("a:"+a);
System.out.println("a的值:"+a);
return "index";
}
输出的结果:
INFO impl.AbstractPoolBackedDataSource - Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1bqub5u9k1r7py4mnnjruz|7441cf0d, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1bqub5u9k1r7py4mnnjruz|7441cf0d, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://rdsw49x2tpph3bfc8ldvo.mysql.rds.aliyuncs.com/ykf_test_yufabu?useUnicode=true&characterEncoding=utf-8, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 10, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 2, numHelperThreads -> 3, preferredTestQuery -> SELECT 1 FROM dual, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
com.dabay.service.web.manager.persistence.dao.BillMapper.selectByPrimaryKey1:select sum(gr_totalfee) as gr_totalfeevalue from core_bill:1458ms
a的值:null
09-Dec-2016 21:44:51.292 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory E:\tomcat\webapps\manager
09-Dec-2016 21:44:51.336 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory E:\tomcat\webapps\manager has finished in 43 ms
com.dabay.service.web.manager.persistence.dao.BillMapper.selectByPrimaryKey1:select sum(gr_totalfee) as gr_totalfeevalue from core_bill:97ms
a的值:null
com.dabay.service.web.manager.persistence.dao.BillMapper.selectByPrimaryKey1:select sum(gr_totalfee) as gr_totalfeevalue from core_bill:124ms
a的值:null