[Author]: Kwu
Based on reflection to implement their own proactive restful development, the general only need to write query database SQL. and increase the corresponding javabean realization of high-speed restful service development.
1, write the database query SQL. corresponding sql.properties
Daily = Dailyreport;select T.day,t.cnt,t.type from (select Day,cnt,type from Dailyreport where type=? ORDER BY day Desc Li Mit?) t order by T.day; String,integer
SQL properties file to ";" Separated.
Description
1) PV is the label for the SQL.
2) The first number of parameters is. Dailyreport the class name for the corresponding JavaBean
3) The second parameter is the SQL for the query, with the "?" placeholder
4) The third parameter is the type of the parameter, separated by ","
2, write the corresponding Pojo class
Import Com.hexun.bean.base.chartsdata;public class Dailyreport implements Chartsdata {private String day, Type;private Integer cnt;public String GetDay () {return day;} public void Setday (String day) {this.day = day;} Public String GetType () {return type;} public void SetType (String type) {this.type = type;} Public Integer getcnt () {return CNT;} public void setcnt (Integer cnt) {this.cnt = cnt;}}
3. Start a RESTful service interview
Http://localhost:9088/restful?tag=pv&args=3
Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /center "alt=" "/>
With Reflection DAO Implementations:
< slightly ....>
Self-proactive restful development based on reflection