兩表多屬性聯查

2021-09-26 07:24:59 字數 3967 閱讀 5305

一方表

@jsonignoreproperties

(value =

)public

class

cityentity

implements

serializable

/** * 獲取:城市id

*/public long getid()

/** * 設定:城市名

*/public

void

setcityname

(string cityname)

/** * 獲取:城市名

*/public string getcityname()

@override

public string tostring()

}

多方表(關聯一方表)

@jsonignoreproperties

(value =

)public

class

flightentity

implements

serializable

/** * 獲取:航班id

*/public long getid()

/** * 設定:航班編號

*/public

void

setflightno

(string flightno)

/** * 獲取:航班編號

*/public string getflightno()

/** * 設定:起飛城市id

*/public

void

setdeparturecity

(long departurecity)

/** * 獲取:起飛城市id

*/public long getdeparturecity()

/** * 設定:起飛時間

*/public

void

setdeparturetime

(date departuretime)

/** * 獲取:起飛時間

*/public date getdeparturetime()

/** * 設定:到達城市id

*/public

void

setarrivalcity

(long arrivalcity)

/** * 獲取:到達城市id

*/public long getarrivalcity()

/** * 設定:到達時間

*/public

void

setarrivaltime

(date arrivaltime)

/** * 獲取:到達時間

*/public date getarrivaltime()

@override

public string tostring()

public cityentity getstartcity()

public

void

setstartcity

(cityentity startcity)

public cityentity getendcity()

public

void

setendcity

(cityentity endcity)

}

<

!--自定義結果集--

>

"flightentity" id=

"flightmap"

>

"id" column=

"id"

/>

"flightno" column=

"flightno"

/>

"departurecity" column=

"departurecity"

/>

"departuretime" column=

"departuretime"

/>

"arrivalcity" column=

"arrivalcity"

/>

"arrivaltime" column=

"arrivaltime"

/>

<

/resultmap>

<

!--配置巢狀查詢--

>

"fightselcitymap" type=

"flightentity"

extends

="flightmap"

>

<

!--查詢起點城市--

>

"startcity" column=

"departurecity" select=

/>

<

!--查詢到達城市--

>

"endcity" column=

"arrivalcity" select=

/>

<

/resultmap>

<

!--要查詢的字段--

>

"sel_flightcolumns_list"

>

id ,

flightno ,

departurecity ,

departuretime ,

arrivalcity ,

arrivaltime

<

/sql>

<

!--根據條件(無條件)查詢多個物件--

>

"querymanybypramas" resultmap=

"flightmap"

>

select "sel_flightcolumns_list"

/> from flight "sel_flightpramas_list"

/>

<

/select>

<

!--根據條件(無條件)分頁查詢--

>

"querylistbypramas" resultmap=

"fightselcitymap"

>

select "sel_flightcolumns_list"

/> from flight "sel_flightpramas_list"

/> order by id desc

<

/select>

<

!--自定義結果集--

>

"cityentity" id=

"citymap"

>

"id" column=

"id"

/>

"cityname" column=

"cityname"

/>

<

/resultmap>

<

!--要查詢的字段--

>

"sel_citycolumns_list"

>

id ,

cityname

<

/sql>

<

!--根據主鍵id查詢單個物件--

>

"queryobjectbyid" resultmap=

"citymap"

>

select "sel_citycolumns_list"

/> from city where id = #

<

/select>

呼叫

xx.startcity.cityname

xx.endcity.cityname

ts 多屬性排序

現在有乙個學生陣列 enum inte ce student const students student 需要按照年齡 或其他屬性 來排序。在上上篇筆記裡面,提到了阮一峰的快速排序 var arr 6,2,5,1,3 function quicksort arr number number var...

oracle 兩表關聯查詢

情景描述 查詢學生表student,sname,age資訊及所在班級clazz表 select sname,age,cname from student t1 left join clazz t2 on t1.cid t2.cid select sname,age,cname from studen...

VC MFC多屬性頁的實現

vc mfc多屬性頁的實現 在插入 資源 dialog,中選擇多個從idd proppage large繼承的屬性頁,如idd prop1。這些建立的對話方塊就是屬性中的每一頁。用classwizard為你的屬性頁定義新的cpropertypage繼承類,如cprop1和idd prop1等關聯。用...