跟我一起學extjs5(38--單個模組的設計[6取得模組列表資料]),extjs538--

來源:互聯網
上載者:User

跟我一起學extjs5(38--單個模組的設計[6取得模組列表資料]),extjs538--
跟我一起學extjs5(38--單個模組的設計[6取得模組列表資料])
        上一節中做好了前背景程式,現在來看看取得資料的運行過程。在菜單中選擇 “系統管理”--“模組分組”。就可以看到,在渲染後grid後,會顯示資料。

              來看看ajax取得資料的url和資料。        url的資訊:

Remote Address:[::1]:8888Request URL:http://localhost:8888/app/rest/module/fetchdata.do?_dc=1413113401477&moduleName=_ModuleGroup&page=1&start=0&limit=20Request Method:GETStatus Code:200 OK
Query String Parametersview sourceview URL encoded_dc:1413113401477moduleName:_ModuleGrouppage:1start:0limit:20
        上面就是url裡面發送到背景參數,包括模組名稱,取得得起始行,每頁的記錄數等資訊。這些只是最基本的資訊,以後複雜了還要加入排序資訊、分組資訊、篩選資訊、導航列表資訊。        下面是伺服器返回的資料:
{"totalCount" : 8,"records" : [{"tf_moduleGroupId" : "10","tf_title" : "工程管理"}, {"tf_moduleGroupId" : "20","tf_title" : "合約管理"}, {"tf_moduleGroupId" : "30","tf_title" : "資金管理"}, {"tf_moduleGroupId" : "80","tf_title" : "編碼設定"}, {"tf_moduleGroupId" : "90","tf_title" : "系統設定"}, {"tf_moduleGroupId" : "94","tf_title" : "檔案資料彙編"}, {"tf_moduleGroupId" : "95","tf_title" : "附件管理"}, {"tf_moduleGroupId" : "99","tf_title" : "系統模組"}]}

        totalCount 表示總數,records是數組,返回了所要取得的那一頁資料。
        後台取得資料的sql語句:先計算滿足當前條件的總記錄數,再取得分頁資料
Hibernate:     select        count(*)      from        _ModuleGroup _t9901Hibernate:     select        top 8    _t9901.tf_moduleGroupId as tf_moduleGroupId ,        _t9901.tf_title as tf_title ,        _t9901.tf_description as tf_description ,        _t9901.tf_iconURL as tf_iconURL ,        _t9901.tf_remark as tf_remark        from        _ModuleGroup _t9901     order by        tf_moduleGroupId



        至此grid取得資料的功能就完成了。大家也看到了,所有的模組都是使用統一函數來取得資料,並不是一個模組就要建立一個Controller,一個Service,一個DAO。這種處理模式也是我這個軟體所要盡量達到的,所有的功能都做到可以進行配置,然後再由前台後台協同解釋執行來完成。        對於一個獨立的和其他模組沒有關聯的模組,這種解釋執行方案是比較簡單的。但是模組有了上下級,有了子模組,父模組,並且模組的層次很多時候,最後加入了許可權,這個解釋執行的處理將會非常的複雜。        最終級的目標就是要根據模組的資訊和欄位的字義,可以任選若干個有關聯的模組的若干個欄位來進行綜合查詢的功能。以上這些功能已經在我的另一個部落格裡有詳細的說明,現在正是一步步實現的時候。


08資訊綜合實訓SQL模組上機實訓試題 1-6題,每小題10分,7-8題每小題20分: 有一個[學生課程]資料庫,資料

--1
create table Student(
Sno int Not NULL PRIMARY KEY Identity (1,1),
Sname varchar(50),
Ssex varchar(2),
Sage int,
Sdept varchar(100)
)

--2
select Sno from SG where Grade<'60'

--3
update Student set Sage='22' where Sno='05001'

--4
select Avg(Grade) from SG where Cno='1'

--5
create proc getDetailByName
@P_Sname varchar(50)
as
if(select count(*) from Student where Sname = @P_Sname) > 0
select * from Student where Sname = @P_Sname
else
print '不存在此學生'

--6
select Sname,Ssex,Sage from Student where Sdept = '電腦' and Sname like '趙%' and Ssex = '男'

--7
create view [學產生績表視圖] as
select Sno,Sname,Cno,Cname,Grade from SG,Student where SG.Sno=Student.Sno

--8
insert into Student values ('05020','丁莉','女','17','電腦')
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.