項目修改模塊
1.在ProjectDao接口中添加修改及根據(jù)id查詢的方法
int updateObject(Project entity);
Project findObjectById(Integer id);
2.在projectMapper.xml文件中添加修改及查詢元素
<update id="updateObject" parameterType="cn.xxx.ttms.product.entity.Project">
update tms_projects set? code=#{code} name=#{name}
......modifiedTime=now(),modifiedUser=#{modifiedUser},where id=#{id}
</update>
<select id="findObjectById" parameterType="integer" resultType="cn.tedu.ttms.product.entity.Project">
select * from tms_projects where id=#{id}
</select>
3.在ProjectService接口及實現(xiàn)類中添加業(yè)務(wù)方法
void updateObject(Project entity){.......}
Project findObjectById(Integer id){.....}
4.在TestProjectService 添加單元測試.
5.在ProjectController中添加修改,查詢方法
@RequestMapping("doFindObjectById")
@ResponseBody
public JsonResult doFindObjectById(Integer id){....}
@RequestMapping("doUpdateObject")
@ResponseBody
public JsonResult doUpdateObject(Project entity){...........}
6.修改project_list.js添加修改業(yè)務(wù)的實現(xiàn).
1)修改按鈕注冊事件
$(document).ready(function(){
$("#queryFormId")
.on("click",".btn-update",doLoadEditPage)
});
2)執(zhí)行修改動作時,模態(tài)框上綁定值....
if($(this).hasClass("btn-update")){
title="...";
var id=$(this).parent().parent().data("id");
$("#modal-dialog").data("idKey",id);
}
.....
7.修改project_edit.js添加修改頁面實現(xiàn)
1)頁面加載完成根據(jù)id的值查詢數(shù)據(jù),初始化頁面...
var id=$("#modal-dialog").data("idKey");
if(id)doFindObjectById(id);
...
function doFindObjectById(id){
var url="";
var params={"id":id};
$.getJSON(url,params,function(result)){
console.log(result);
if(result.state==1){
doInitFormData(result.data);
}else{
alert(result.message);
}
}
}
function doInitFormData(data){
......
}
2)點擊模態(tài)框保存按鈕獲取表單數(shù)據(jù)更新到數(shù)據(jù)庫.
.....
var params=getEditFormData();
var insertUrl=...
var updateUrl=...
var id=$("#modal-dialog").data("idKey");
var url=id?updateUrl:insertUrl;
if(id) params.id=id;
$.post(url,params,function(result){....})
3)模態(tài)框隱藏完成移除綁定的id值.
$("#modal-dialog").removeData("idKey");
商品管理概述
1.團(tuán)購商品管理需求描述.
在這個團(tuán)購管理業(yè)務(wù)系統(tǒng)中,具體團(tuán)購商品依托于項目信息.一個項目可以對應(yīng)多個團(tuán)購商品,例如將環(huán)球游看成是一個項目,那可以基于此項目創(chuàng)建環(huán)球游30日商品,環(huán)球游40日商品.
2.團(tuán)購商品管理基本功能實現(xiàn):
1)團(tuán)購商品信息的查詢
2)團(tuán)購商品信息的修改
3)團(tuán)購商品信息的添加
4)..............
3.團(tuán)購商品管理相關(guān)模塊實現(xiàn):
1)根據(jù)表的定義創(chuàng)建Team實體對象
2)根據(jù)實體的描述創(chuàng)建TeamDao對象
3)根據(jù)TeamDao中的描述創(chuàng)建TeamMapper文件
4)根據(jù)具體業(yè)務(wù)創(chuàng)建TeamService接口及實現(xiàn)
5)根據(jù)用戶請求創(chuàng)建控制層TeamController對象.
6)創(chuàng)建team_list.js處理客戶端的用戶交互操作.