当前位置:网站首页>第3章业务功能开发(线索关联市场活动,动态搜索)
第3章业务功能开发(线索关联市场活动,动态搜索)
2022-07-29 20:38:00 【做一道光】
客户需求
用户在线索明细页面,点击"关联市场活动"按钮,弹出线索关联市场活动的模态窗口;
用户在线索关联市场活动的模态窗口,输入搜索条件,每次键盘弹起,根据名称模糊查询市场活动,把所有符合条件的市场活动显示到列表中;
用户选择要关联的市场活动,点击"关联"按钮,完成线索关联市场活动的功能.
*每次至少关联一个市场活动
*同一个市场活动只能跟同一个线索关联一次
*关联成功之后,关闭模态窗口,刷新已经关联过的市场活动列表
*关联失败,提示信息,模态窗口不关闭,已经关联过的市场活动列表也不刷新
功能实现
查询一条或多条市场活动数据,传递的参数为市场活动的名字和线索的id,这两个参数不属于同一个实体类,因此把他们封装为map集合进行传参
1. ActivityMapper接口
/**
* 根据name模糊查询市场活动,并且把已经和clueId关联过的市场活动排除
* @param map
* @return
*/
List<Activity> selectActivityForDetailByNameClueId(Map<String,Object> map);ActivityMapper.xml文件
<select id="selectActivityForDetailByNameClueId" parameterType="map" resultMap="BaseResultMap">
select a.id,a.name,a.start_date,a.end_date,u.name as owner
from tbl_activity a
join tbl_user u on a.owner=u.id
where a.name like '%' #{activityName} '%' and a.id not in (
select activity_id
from tbl_clue_activity_relation
where clue_id=#{clueId}
)
</select>2.ActivityService接口
![]()
ActivityServiceImpl类
@Override
public List<Activity> queryActivityForDetailByNameClueId(Map<String, Object> map) {
return activityMapper.selectActivityForDetailByNameClueId(map);
}3.ClueController
@RequestMapping(value = "/workbench/clue/detailClue.do")
public String detailClue(String id,HttpServletRequest request){
//调用service层方法,查询数据
Clue clue = clueService.queryClueForDetailById(id);
List<ClueRemark> clueRemarks = clueRemarkService.queryClueRemarkForDetilByClueId(id);
List<Activity> activityList = activityService.queryActivityForDetailByClueId(id);
//把数据保存到作用域中
request.setAttribute("clue",clue);
request.setAttribute("clueRemarks",clueRemarks);
request.setAttribute("activityList",activityList);
return "workbench/clue/detail";
}4.clue的detail.jsp页面
js
//给关联市场活动按钮添加单击事件
$("#bundActivityBtn").click(function () {
//初始化工作
//弹出线索关联市场活动的模态窗口
$("#bundModal").modal("show");
});
//给市场活动搜索框添加键盘弹起事件
$("#searchActivityTxt").keyup(function () {
//收集参数
var activityName=this.value;
var clueId='${clue.id}';
//发送请求
$.ajax({
url:"workbench/clue/queryActivityForDetailByNameClueId.do",
type:'post',
data:{
activityName:activityName,
clueId:clueId
},
dataType:'json',
success:function (data) {
//遍历data,显示搜索到的市场活动列表
var htmlStr="";
$.each(data,function (index,obj) {
htmlStr+="<tr>";
htmlStr+="<td><input type=\"checkbox\" value='"+obj.id+"'/></td>";
htmlStr+="<td>"+obj.name+"</td>";
htmlStr+="<td>"+obj.startDate+"</td>";
htmlStr+="<td>"+obj.endDate+"</td>";
htmlStr+="<td>"+obj.owner+"</td>";
htmlStr+="</tr>";
});
$("#tBody").html(htmlStr);
}
});
});html
<!-- 关联市场活动的模态窗口 -->
<div class="modal fade" id="bundModal" role="dialog">
<div class="modal-dialog" role="document" style="width: 80%;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">关联市场活动</h4>
</div>
<div class="modal-body">
<div class="btn-group" style="position: relative; top: 18%; left: 8px;">
<form class="form-inline" role="form">
<div class="form-group has-feedback">
<input type="text" id="searchActivityTxt" class="form-control" style="width: 300px;" placeholder="请输入市场活动名称,支持模糊查询">
<span class="glyphicon glyphicon-search form-control-feedback"></span>
</div>
</form>
</div>
<table id="activityTable" class="table table-hover" style="width: 900px; position: relative;top: 10px;">
<thead>
<tr style="color: #B3B3B3;">
<td><input type="checkbox"/></td>
<td>名称</td>
<td>开始日期</td>
<td>结束日期</td>
<td>所有者</td>
<td></td>
</tr>
</thead>
<tbody id="tBody">
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" id="saveBundActivityBtn">关联</button>
</div>
</div>
</div>
</div>功能测试
进入线索详细备注页面

点击关联市场活动按钮,弹出市场活动搜索框,根据市场活动的名称来进行搜索,并且排除已经关联过该线索的市场活动
点击ctrl键,查询所有市场活动

输入具体的值,根据输入的值查询市场活动

边栏推荐
- Cobaltstrike和BurpSuite桌面快捷配置
- LeetCode 593 Valid Squares [Math] HERODING's Road to LeetCode
- LeetCode 0144. 二叉树的前序遍历:二叉树必会题
- mos管闩锁效应理解学习
- Dry goods!Cooperative Balance in Federated Learning
- 七个易犯的 IT 管理错误—以及如何避免
- 三品牌下半年将带来多款新品,东风日产将迎来“产品大潮”
- Second Best PyTorch Beginner Course; Thesis Writing Guide; Using µGo to Develop a Mini Compiler; Super Efficient Use of Transformer's Extension Library; Frontier Papers | ShowMeAI News Daily
- SwiftUI * @State 相关问题
- 最小jvm源码分析
猜你喜欢

C#笔记 之 Oracle.ManagedDataAccess包的安装及配置

Baidu internship students late night fun: originally giant is this kind of life

南信大提出TIPCB,一个简单但有效的用于基于文本的人员搜索的基于部分的卷积baseline

诺氟沙星-DNA复合物|半乳糖化脂质体-聚阳离子-DNA复合物|注意事项

mos管闩锁效应理解学习

VR直播营销需求增加,数据模块为我们铺路

The sword refers to Offer II 097. Number of subsequences

Fully automated machine learning modeling!The effect hangs the primary alchemist!

A dish hold up valuations billions of mt. Pickled fish, can move beyond the edge food safety?
![LeetCode 593 有效的正方形[数学] HERODING的LeetCode之路](/img/c2/34624c9c7693ba40d0b3724c0db611.png)
LeetCode 593 有效的正方形[数学] HERODING的LeetCode之路
随机推荐
Permutations of a small feat: cantor
The sword refers to Offer II 097. Number of subsequences
PEG-PEI共聚物/DNA复合物|甘草次酸修饰的长循环阳离子脂质体DNA复合物|解析说明
[ACTF2020 Freshman Competition]Exec 1
MySQL数据查询 - 联合查询
Durable rules (persistent rules engine) learning notes
嵌入式分享合集24
OAuth,JWT ,OIDC你们搞得我好乱啊
4. Implementation Guide for GET_ENTITYSET Method of SAP ABAP OData Service Data Provider Class
带你刷(牛客网)C语言百题(第四天)
Analysis of Crypto in Pi 2
Panorama Tutorial丨How to shoot sunrise and sunset scenes in VR panoramic shooting?
Kotlin - Coroutine Scope CoroutineScope, Coroutine Builder CoroutineBuilder, Coroutine Scope Function CoroutineScope Functiom
The younger brother asked: Is the work of a programmer a day’s work of code?
南华早报 | 助力亚洲最具公信力报章实现AD域自动化管理
OneNote 教程,如何在 OneNote 中做笔记?
磁性层状双金属氢氧化物和酶-DNA复合物|聚乙烯亚胺-DNA复合物(PEI/DNA)|作用机理
怎么实现您的个人知识库?
conda virtual environment | install and list problems
offsetwidth111[easy to understand]