关于spring

    xiaoxiao2021-03-25  83

    首先是结构,分为5大块

    1.WEB    用来写前台(画面)代码(一个Layout.js和一个.js)

    2.BackstageWEB   用来写控制层和业务层(里面有Controller、IService、Service、Config等)

    3.Batch   用来写Batch的入口(这里的Batch,就相当于画面)

    4.BackstageBatch   用来写Batch的内容(相当于BackstageWEB)

    5.UnitTest    工具包

    下面来具体说一下执行流程

    每一个页面  都有一套文件 分别是

    ①Layout.js:只负责话页面,例如页面的文本框,单选框,下拉列表,按钮等

    id: 'btnUpdate', text: '登录', handler: cls.btnRegistClick xtype: 'ps_container', margin: '0 0 5 0', items: [{ xtype: 'ps_smartfield', ps_windowTitle: '部署检索', id: 'smtKeijyoBushoCd', vtype: 'halfCharNum', ps_sql: 'SmartField.T_ZZ_KAIKEISHOUTANI.Select', ps_code: { name: 'businessSectionCode', name2: 'KAIKEISYOUTANI_CD', labelWidth: 120, fieldLabel: '部署CODE', width: 40, fieldLabel2: '部署CODE', vtype: 'halfCharNum', allowBlank:cls._InitData.MODE == 'Normal' ? false : true, maxByteLength: 4, enforceMaxLength: true }, ps_text: { name: 'businessSectionName', name2: 'BUSYO_MEI_GAMEN', labelWidth: 120, width: 320, readOnly:true, fieldLabel2: '部署名称', maxByteLength: 50 }, //网格 ps_sorters: ['KAIKEISYOUTANI_CD', 'BUSYO_MEI_GAMEN'], ps_gridColumns: [ { text: '部署CODE', dataIndex: 'KAIKEISYOUTANI_CD', width: 160 }, { text: '部署名称', dataIndex: 'BUSYO_MEI_GAMEN', width: 320 } ], ps_condExt: { GYOSEKI_KANRI_KAISO_CD: cls._InitData.LIKE_CLAUSE }, }]上面第一个是一个按钮,第二个是一个文本框( 好像不对,有机会问问

    ②.js  处理前台触发的事件,例如点击登录按钮,需要做一些前台check,必须入力项是否入力、格式是否正确等

    后台:

    ExcelTemplate是出力的模板,文件格式为Excel

    Controller.xml负责调用Service.xml里的代码

    <object id="KG.KG09G001Controller" type="NewMINT.Web.KG.Controller.KG09G001Controller, NewMINT.Web" singleton="false"> <property name="Service" ref="KG.KG09G001Service" /> </object>通过ref,去查找对应的Service

    Service.xml

    调用具体的Service

    <object id="KG.KG09G001Service" type="NewMINT.Web.KG.Service.KG09G001Service, NewMINT.Web"> <property name="Dao" ref="NewMINT.BaseDao"/> </object>

    View.xml

    调用web中的指定页面

    <object id="KG.KG09G001View" parent="NewMINT.BaseView"> <property name="FormID" value="KG09G001" /> <property name="Title" value="啦啦啦啦啦啦マスタ(啦啦啦)" /> <property name="Footer"> <list> <value>/NewMINT/KG/KG09G001/KG09G001.js</value> <value>/NewMINT/KG/KG09G001/KG09G001Layout.js</value> </list> </property> </object>Index.xml  索引文件 将上述的Controller Service View

    <objects xmlns="http://www.springframework.net"> <import resource="Controller.xml"/> <import resource="Service.xml"/> <import resource="View.xml"/> </objects>

    ③Controller.cs

    后台的控制层,负责接收画面传过来的值,并且进行操作,例如,将值传递给SQL中,进行检索,或者将值传递给Service,进行其他操作;做一些逻辑check等等

    //接收数据传入SQL进行检索 public ActionResult Search() { Dictionary<string, object> para = new Dictionary<string, object>(); para["Start"] = RequestParams.Start; para["Limit"] = RequestParams.Limit; para["Sort"] = RequestParams.Sort; string strSQLID = "T_KG_SOKURI_RINGI_MST.Search.Select"; .......................... DataTable dt = null; JsonModelGrid dataModel = new JsonModelGrid(Request.Params["__FormID"]); dataModel.Results = this.Service.Search(strSQLID, para, out dt); dt.TableName = "grdSearchList"; return this.PS_Json(dataModel); }

    ④IService.cs

    ⑤Service.cs

    首先要先实现自己的接口(IService.cs)

    接收Controller.cs(控制层)传过来的信息(例如传过来的参数),对DB进行操作

    //控制层传参数A 并且给控制层返回一个Bool型的返回值 public bool FlagExist(string A) { Dictionary<string, object> para = new Dictionary<string, object>(); para.Add("A", A); para.Add("YUKO_FLG", "0"); DataTable dt = Dao.Select("T_KG_SOKURI_RINGI_MST.CheckFlagExist.Select", para); return dt.Rows.Count > 0; }(有空接着写)

    转载请注明原文地址: https://ju.6miu.com/read-34862.html

    最新回复(0)