zhh1996075 2016-09-14 07:47 采纳率: 0%
浏览 1933
已采纳

这个Controller控制器怎么写

    /**
     * 费用管理修改
     * @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,觉得是控制器写错了,,大神告诉我怎么写吧,没有一点思路

  • 写回答

3条回答 默认 最新

  • cr135810 2016-09-14 10:16
    关注

    自己在逐步排查一下把,应该很简单的问题。看看方法执行成功没,打断点调一下,全搞定了就行

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧