zoukankan      html  css  js  c++  java
  • 新手程序员 工作日志 2017.5.1 关于修改

    现在讲一下修改

    我也给大家说的详细点

    function updateUserTheme() {                                        这就是修改的 Ajax  $("#uThemeForm").serialize();的意思是说 将#uThemeForm的表单进行 序列化 
        var data = $("#uThemeForm").serialize();
        var _ctx = $("#ctx").val();
        var url = _ctx + "/theme/updateUserTheme.action";         这是themeaction中的 updateUserTheme函数
         $("#themeS_loading").show();// Loading...
        jQuery.ajax({
            type : "POST",
            url : url,
            data : data,
            dataType : 'json',
            success : function(msg) {
                /**
                 * 根据具体的业务执行不同的函数<br>
                 * 每一个业务都需要有自己的回调函数,通过执行不同的回调函数的方式来达到不同的效果
                 */
                if(typeof callBackAfterSave == 'function'){
                    try{
                        callBackAfterSave(msg);
                    } catch(e){
                        callBackAfterSave(msg);
                    }
                }
                toastr.success("试题修改成功!");
                scrollTop(0);
                //initAnswerList();    初始化页面 就是清空当前页面内容 。
                
            },
            error : function(msg) {
                Modal.warning('提示','试题修改失败!');
                removeSaveThemeCss();
                return false;
            }
        });
    }

    *******************************************************************************************

    updateUserTheme 的函数如下

    在这里

    是 在这里写的一个函数 他的功能是获取各个位置的值 将他 们传到后台

        /**
         * 用户上传试题VO set值。
         * @param grade 年级
         * @param areaid 区域
         * @param year 年份
         * @param title 试题题干
         * @param objective 试题主客观
         * @param department 是否有子题
         * @param date 日期
         * @param childid 子题id
         * @param isPublic 是否公开
         * @param result 答案
         * @param hint 解析
         * @param option_num 选项个数
         * @param titletype 试题题型
         * @param ken_ids 试题知识点
         * @param difficulty 试题难易度
         * @param type 试题类型
         * @return
         */
        private ThemeVO getUserThemeVo() {
            //处理html 标签
            title = MakeHtml.checkTable(title);
            answer = MakeHtml.checkTable(answer);
            hint = MakeHtml.checkTable(hint);
            //地区编码
            int local_areaid = StringUtil.parseIntNumber(curr_user_info
                    .getUserSchools().get(0).getArea_code());
            
            Date date = new Date();        
            Calendar calendar=Calendar.getInstance();
              
            ThemeVO userThemeVo = new ThemeVO();
            userThemeVo.setId(theme_id);   // 试题 的 id   由试题id向数据库 servlet 传输信息 。
            userThemeVo.setSubject_id(subject_id);//学科
            userThemeVo.setType(6);//试题类别 6-原创题
            userThemeVo.setGread(grade);//年级
            if (areaid > -1) {
                userThemeVo.setAreaid(areaid);//地区
            }else {
                userThemeVo.setAreaid(local_areaid);//地区
            }
            userThemeVo.setYear(calendar.get(Calendar.YEAR));//试题年份
            userThemeVo.setDifficulty(difficulty);//试题难易程度
            userThemeVo.setTitletype(titletype);//试题类型
            userThemeVo.setTitle(title);//自己上传试题内容,题干
            userThemeVo.setResult(answer);//试题答案
            userThemeVo.setHint1(hint);//试题解析
            userThemeVo.setIsdelete(IConstantsTheme.ISDELETE_TRUE);//删除标记 1为删除 2为正常
            userThemeVo.setAuditing(IConstantsTheme.AUDITING_PASS);//审核状态 1没有审核2审核没有通过3审核通过
            userThemeVo.setUser_id(curr_user_info.getUserPO().getUser_id());//创建者用户ID
            userThemeVo.setParentid(0);//父题ID,默认值为0,当此题为子题时,需要重新设置-------
            userThemeVo.setDepartment(0);//是否有子题  0没有子题 1 有子题
            userThemeVo.setCreate_date(date);//上传日期
            if (titletype == EnumThemeTitleType.DAN_XUAN_TI.toCode()) {
                userThemeVo.setObjective(IConstantsBase.THEME_OBJECTIVE);//主客观题 1为客观, 2为主观    
            }else {
                userThemeVo.setObjective(IConstantsBase.THEME_SUBJECTIVE);//主客观题 1为客观, 2为主观    
            }
            userThemeVo.setUpdate_date(date);//修改日期
            userThemeVo.setUpdater_id(curr_user_info.getUserPO().getUser_id());//修改者
            userThemeVo.setIs_public(0);//是否公开0私有,1公开
            userThemeVo.setIs_norm(IConstantsTheme.USER_UNNORMAL_THEME);//是否是规则试题(1规则的,2非规则的
            userThemeVo.setOption_num(0);//选项个数(主观题选项个数为0)
            userThemeVo.setChildid(0);//子题序号(无子题为0,有子题为用户设置的具体题号)
            userThemeVo.setAllken_ids(allken_ids);//试题知识点
            userThemeVo.setAuditing(IConstantsTheme.AUDITING_PASS);// 默认审核状态为3:审核通过
            userThemeVo.setTheme_system(IConstantsTheme.USER_UNNORMAL_THEME);
            userThemeVo.setTheme_department(department);//文理科属性文理科(0为通用1为文科 2为理科)
            
            //试题录入添加业务合作方 id wangzs 2017-04-02
            long cooperation_id = getCurrentCooperationId();
            if (cooperation_id > 0) {
                userThemeVo.setCooperation_id((int) cooperation_id);// 业务合作方表编号
            }
            return userThemeVo;
        }

     这里是我自己写的 了 updateUserTheme(theme)

    然后在中写

     然后 其实现类

     

     

     以上的方法多余 不简洁 但是说实话我别的 汉真不会

    下面的这是对应的 数据库操作 返回的 结果集对应的 ID 是我所花的。

  • 相关阅读:
    《观止》读后感
    读产品经理相关书籍有感
    windows phone 7基础点随手记
    Windows phone 7画图画字
    《CLR via C#》读书笔记
    《Beginning C# Objcets》学习笔记
    ASP.NET 使用alert弹出对话框后,CSS样式失效,字体变大的解决方法
    .NET COOKIE /SESSION/CACHE操作类
    【原创】VS2005 Web应用程序打包并安装数据库
    存储过程实现多条件查询
  • 原文地址:https://www.cnblogs.com/dushutai/p/6796345.html
Copyright © 2011-2022 走看看