/**
* 费用管理修改
* @throws Exception
*/
@ResponseBody
@RequestMapping(value="/updateCharingCost")
public boolean updateCharingCost(ChargingCost chargingCost) throws Exception {
User usr = (User) this.getSession().getAttribute(Const.SESSION_USER);
String usrID = usr.getUserID();
boolean bool=false;
bool=chargingCostService.update(chargingCost, usrID);
return bool;
}
/**
* 费用管理删除
* @throws Exception
*/
@ResponseBody
@RequestMapping(value="/deleteCharingCost")
public boolean deleteChargingCost(ChargingCost chargingCost) throws Exception{
User usr = (User) this.getSession().getAttribute(Const.SESSION_USER);
String usrID = usr.getUserID();
boolean bool=chargingCostService.delete(chargingCost, usrID);
return bool;
}
}
这个是Controller,,
public boolean update(ChargingCost chargingCost, String usrID) throws Exception {
boolean bool = false;
Date date = Tools.getNowtimeTwo();
chargingCost.setUpdateUser(usrID);
chargingCost.setUpdateDTTM(date);
int ExecuteCnt = (int) this.getDaoSupport().update("ChargingCost.update", chargingCost);
if (ExecuteCnt > 0) {
bool = true;
}
return bool;
}
/**
* 删除费用
*/
public boolean delete(ChargingCost chargingCost, String usrID) throws Exception {
boolean bool = false;
Date date = Tools.getNowtimeTwo();
chargingCost.setDeleteFlag(0);
chargingCost.setUpdateUser(usrID);
chargingCost.setUpdateDTTM(date);
int ExecuteCnt = (int) this.getDaoSupport().update("ChargingCost.delete", chargingCost);
if (ExecuteCnt > 0) {
bool = true;
}
return bool;
}
这个是service,
function update_Cost() {
var len = document.getElementsByName("chk").length;
var selectCount = 0; // 判断是否一个未选
for (var i = 0; i < len; i++) {
if (document.getElementsByName("chk")[i].checked == true) {
selectCount = selectCount + 1;
userData.push(i + 1);
s=i+1;
}
}
if (selectCount == 1) {
$('#costInformationUpdate').modal('show');
// 设置弹出窗口的位置
var model=document.getElementById("costInformationUpdate");
var tb = document.getElementById("costTable");
var tr = tb.rows[s];
$("#updateChargingStationName").val(tr.cells[2].innerText);
$("#updateEffectiveDate").val(tr.cells[3].innerText);
} else if (selectCount == 0) {
showMessge("请选择要操作的数据!","model1");
} else {
showMessge("抱歉,不能选择多行!","model1");
}
}
//确认修改
function updateChargingCost(){
var updateChargePrice=$("#updateChargePrice").val();
var updateServicePrice=$("#updateServicePrice").val();
var updateMonthKWH=$("#updateMonthKWH").val();
$.ajax({
type: "POST",
url: 'updateCharingCost',
data: {
ChargePrice:updateChargePrice,
ServicePrice:updateServicePrice,
MonthKWH:updateMonthKWH,
},
dataType:'json',
success : function(data) {
if (data) {
showMessge("修改成功!","model1");
$('#update').modal('hide');
saveCharingCost();
} else {
showMessge("修改失败!","model1");
$('#update').modal('hide');
}
},
error : function(data) {
if (data.status == "403" && data.statusText == "Forbidden") {
showMessge("您没有操作权限!","model1");
} else {
showMessge("操作失败!","model1");
}
}
});
}
这个是js,,但是date一直是false,觉得是控制器写错了,,大神告诉我怎么写吧,没有一点思路