当前位置:网站首页>第3章业务功能开发(添加线索备注,自动刷新添加内容)
第3章业务功能开发(添加线索备注,自动刷新添加内容)
2022-07-27 12:54:00 【做一道光】
1.添加线索备注,返回类型为int,通过判断Int是否大于0来确定语句是否执行成功。
因为添加的内容同属于一个实体类,所以封装成一个实体类,下面是具体实施
2.ClueRemarkMapper接口

ClueRemarkMapper.xml文件
<insert id="insertClueRemark" parameterType="com.it.crm.workbench.entity.ClueRemark">
insert into tbl_clue_remark(id, note_content, create_by, create_time, edit_flag, clue_id)
values (#{id},#{noteContent} ,#{createBy} , #{createTime}, #{editFlag}, #{clueId})
</insert>3.ClueRemarkService接口
![]()
ClueRemarkServiceImpl

4.ClueRemarkController
@RequestMapping(value = "/workbench/clue/saveCreateClueRemark.do")
@ResponseBody
public Object saveCreateClueRemark(ClueRemark clueRemark, HttpSession httpSession){
ReturnObject returnObject=new ReturnObject();
User user = (User) httpSession.getAttribute(Contants.SESSION_USER);
//封装参数
clueRemark.setId(UUIDUtils.getUUID());
clueRemark.setCreateBy(user.getId());
clueRemark.setCreateTime(DateUtils.formateDateTime(new Date()));
clueRemark.setEditFlag(Contants.REMARK_EDIT_FLAG_NO_EDITED);
try{
//调用service层方法,返回结果
int i = clueRemarkService.saveCreateClueRemark(clueRemark);
//根据返回结果,生成响应信息
if (i>0){
returnObject.setCode(Contants.RETURN_OBJECT_CODE_SUCCESS);
returnObject.setReturnData(clueRemark);
}else {
returnObject.setCode(Contants.RETURN_OBJECT_CODE_FAIL);
returnObject.setMessage("系统忙,请稍后重试!");
}
}catch (Exception e){
e.printStackTrace();
returnObject.setCode(Contants.RETURN_OBJECT_CODE_FAIL);
returnObject.setMessage("系统忙,请稍后重试!");
}
return returnObject;
}5.clue的deatil.jsp页面
js
//给保存按钮添加单击事件
$("#saveCreateClueRemarkBtn").click(function () {
//收集参数
var noteContent=$.trim($("#remark").val());
var clueId='${clue.id}';
//验证表单
if (noteContent==""){
alert("备注内容不能为空!");
return;
}
//发送请求
$.ajax({
url:"workbench/clue/saveCreateClueRemark.do",
type:'post',
data:{
noteContent:noteContent,
clueId:clueId
},
dataType:'json',
success:function (data) {
if (data.code=="1"){
//清空填写的表单
$("#remark").val("");
//拼接数据
var htmlStr="";
htmlStr+="<div class=\"remarkDiv\" id=\"div_"+data.returnData.id+"\" style=\"height: 60px;\">";
htmlStr+="<img title=\"${sessionScope.sessionUser.name}\" src=\"image/user-thumbnail.png\" style=\"width: 30px; height:30px;\">";
htmlStr+="<div style=\"position: relative; top: -40px; left: 40px;\" >";
htmlStr+="<h5>"+data.returnData.noteContent+"</h5>";
htmlStr+="<font color=\"gray\">线索</font> <font color=\"gray\">-</font> <b>${clue.fullname}${clue.appellation}-${clue.company}</b> <small style=\"color: gray;\">\""+data.returnData.createTime+"由${sessionScope.sessionUser.name}创建\"</small>";
htmlStr+="<div style=\"position: relative; left: 500px; top: -30px; height: 30px; width: 100px; display: none;\">";
htmlStr+="<a class=\"myHref\" name=\"editA\" remarkId=\""+data.returnData.id+"\" href=\"javascript:void(0);\"><span class=\"glyphicon glyphicon-edit\" style=\"font-size: 20px; color: #E6E6E6;\"></span></a>";
htmlStr+=" ";
htmlStr+="<a class=\"myHref\" name=\"deleteA\" remarkId=\""+data.returnData.id+"\" href=\"javascript:void(0);\"><span class=\"glyphicon glyphicon-remove\" style=\"font-size: 20px; color: #E6E6E6;\"></span></a>";
htmlStr+="</div></div></div>";
$("#remarkDiv").before(htmlStr);
} else {
alert(data.message);
}
}
});
});html
<!-- 备注 -->
<div style="position: relative; top: 40px; left: 40px;">
<div class="page-header">
<h4>备注</h4>
</div>
<c:forEach items="${clueRemarks}" var="remark">
<div class="remarkDiv" id="div_${remark.id}" style="height: 60px;">
<img title="${remark.createBy}" src="image/user-thumbnail.png" style="width: 30px; height:30px;">
<div style="position: relative; top: -40px; left: 40px;" >
<h5>${remark.noteContent}</h5>
<font color="gray">线索</font> <font color="gray">-</font> <b>${clue.fullname}${clue.appellation}-${clue.company}</b> <small style="color: gray;"> ${remark.editFlag=='0'?remark.createTime:remark.editTime} 由${remark.editFlag=='0'?remark.createBy:remark.editBy}${remark.editFlag=='0'?"创建":"修改"}</small>
<div style="position: relative; left: 500px; top: -30px; height: 30px; width: 100px; display: none;">
<a class="myHref" name="editA" remarkId="${remark.id}" href="javascript:void(0);"><span class="glyphicon glyphicon-edit" style="font-size: 20px; color: #E6E6E6;"></span></a>
<a class="myHref" name="deleteA" remarkId="${remark.id}" href="javascript:void(0);"><span class="glyphicon glyphicon-remove" style="font-size: 20px; color: #E6E6E6;"></span></a>
</div>
</div>
</div>
</c:forEach>
<div id="remarkDiv" style="background-color: #E6E6E6; width: 870px; height: 90px;">
<form role="form" style="position: relative;top: 10px; left: 10px;">
<textarea id="remark" class="form-control" style="width: 850px; resize : none;" rows="2" placeholder="添加备注..."></textarea>
<p id="cancelAndSaveBtn" style="position: relative;left: 737px; top: 10px; display: none;">
<button id="cancelBtn" type="button" class="btn btn-default">取消</button>
<button type="button" class="btn btn-primary" id="saveCreateClueRemarkBtn">保存</button>
</p>
</form>
</div>
</div>功能测试
在线索备注页面,点击备注保存按钮

输入内容后点击保存按钮,自动添加到数据库,并在页面自动刷新显示


边栏推荐
- Swiftui map encyclopedia use mapkit to search
- 井贤栋等蚂蚁集团高管不再担任阿里合伙人 确保独立决策
- Deep confidence network (DBN) [the classical DBN network structure is a deep neural network composed of several layers of RBM (restricted Boltzmann machine) and one layer of BP]
- English grammar_ Definite article the_ Small details
- 小程序毕设作品之微信校园洗衣小程序毕业设计成品(7)中期检查报告
- 看看有没有你,各赛区入围名单
- [daily question] 1206. Design jump table
- idea Gradle7.0+ :Could not find method compile()
- See if you are on the shortlist of each division
- 592. Fraction addition and subtraction
猜你喜欢

使用RecyclerView,实现列表左滑菜单
![[training day3] delete [simulation]](/img/7b/217d4a9fa1426107eb7d6890dc9dc5.png)
[training day3] delete [simulation]

在“元宇宙空间”UTONMOS将打开虚实结合的数字世界

Interview secrets are widely distributed, and the exclusive secrets of editing, testing and learning are leaked?!

小程序毕设作品之微信校园洗衣小程序毕业设计成品(7)中期检查报告
![[training day4] card game [greed]](/img/02/88af03ca5e137eba6cdd778f827f2b.png)
[training day4] card game [greed]

Figure 8 shows you how to configure SNMP

在灯塔工厂点亮5G,宁德时代抢先探路中国智造

13. User web layer services (I)

RSS tutorial: aggregate your own information collection channels, rshub, freshrss, NetNewsWire
随机推荐
[x for x in list_a if not np.isnan(x)]和[x if not np.isnan(x) else None for x in list_a]的区别
【图论】负环
Zoom, translation and rotation of OpenCV image
将目标检测大尺寸图片裁剪成固定尺寸图片
Gains and losses of desensitization project
Chapter3 data analysis of the U.S. general election gold offering project
MySQL high availability practical solution MHA
Interview secrets are widely distributed, and the exclusive secrets of editing, testing and learning are leaked?!
NoSQL -- three theoretical cornerstones of NoSQL -- cap -- Base -- final consistency
我们要学会查看技术细节点的文档化说明
592. 分数加减运算
GoPro接入 - 根据GoPro官方文档/Demo,实现对GoPro的控制和预览
看看有没有你,各赛区入围名单
JS module, closure application
期货开户的条件和流程
微策生物IPO过会:年营收12.6亿 睿泓投资与耀合医药是股东
Structural thinking
基于C语言的LR1编译器设计
使用RecyclerView,实现列表左滑菜单
opencv图像的缩放平移及旋转