9.CRM销售机会的修改和删除
来源:互联网 发布:华南理工大学 知乎 编辑:程序博客网 时间:2024/06/06 00:46
1.dao层
public interface SaleChanceDao{ /** * 修改销售机会 * @param saleChance * @return */ public int update(SaleChance saleChance); /** * 删除销售机会 * @param id * @return */ public int delete(Integer id);}
2.service层复制dao层代码
public interface SaleChanceService { /** * 修改销售机会 * @param saleChance * @return */ public int update(SaleChance saleChance); /** * 删除销售机会 * @param id * @return */ public int delete(Integer id);}
3.serviceImpl的实现类
@Service("saleChanceService")public class SaleChanceServiceImpl implements SaleChanceService{ @Resource private SaleChanceDao saleChanceDao; @Override public int update(SaleChance saleChance) { return saleChanceDao.update(saleChance); } @Override public int delete(Integer id) { return saleChanceDao.delete(id); }}
4.Controller层的方法
@Controller@RequestMapping("/saleChance")public class SaleChanceController { @Resource private SaleChanceService saleChanceService; /** * 删除销售机会 * @param ids * @param response * @return * @throws Exception */ @RequestMapping("/delete") public String delete(@RequestParam(value="ids")String ids,HttpServletResponse response)throws Exception{ String []idsStr=ids.split(","); for(int i=0;i<idsStr.length;i++){ saleChanceService.delete(Integer.parseInt(idsStr[i])); } JSONObject result=new JSONObject(); result.put("success", true); ResponseUtil.write(response, result); return null; }}
5.Mapper,xml配置查询数据库的方法
<update id="update" parameterType="SaleChance"> update t_sale_chance <set> <if test="chanceSource!=null and chanceSource!='' "> chanceSource = #{chanceSource}, </if> <if test="customerName!=null and customerName!='' "> customerName = #{customerName}, </if> <if test="cgjl!=0"> cgjl = #{cgjl}, </if> <if test="overView!=null and overView!='' "> overView = #{overView}, </if> <if test="linkMan!=null and linkMan!='' "> linkMan = #{linkMan}, </if> <if test="linkPhone!=null and linkPhone!='' "> linkPhone = #{linkPhone}, </if> <if test="description!=null and description!='' "> description = #{description}, </if> <if test="createMan!=null and createMan!='' "> createMan = #{createMan}, </if> <if test="createTime!=null"> createTime = #{createTime}, </if> <if test="assignMan!=null and assignMan!='' "> assignMan = #{assignMan}, </if> <if test="assignTime!=null"> assignTime = #{assignTime}, </if> <if test="state!=null"> state = #{state}, </if> <if test="devResult!=null"> devResult = #{devResult}, </if> </set> where id=#{id} </update> <delete id="delete" parameterType="Integer"> delete from t_sale_chance where id=#{id} </delete>
6.编写jsp页面
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><script type="text/javascript"> var url; $(function(){ $("#assignMan").combobox({ onSelect:function(record){ if(record.trueName!=''){ $("#assignTime").val(getCurrentDateTime()); }else{ $("#assignTime").val(""); } } }); }); function searchSaleChance(){ $("#dg").datagrid('load',{ "customerName":$("#s_customerName").val(), "overView":$("#s_overView").val(), "createMan":$("#s_createMan").val(), "state":$("#s_state").combobox("getValue") }); } function formatState(val,row){ if(val==1){ return "已分配"; }else{ return "未分配"; } } function openSaleChanceAddDialog(){ $("#dlg").dialog("open").dialog("setTitle","添加销售机会信息"); $("#createMan").val('${currentUser.trueName}'); $("#createTime").val(getCurrentDateTime()); url="${pageContext.request.contextPath}/saleChance/save.do"; } function openSaleChanceModifyDialog(){ var selectedRows=$("#dg").datagrid("getSelections"); if(selectedRows.length!=1){ $.messager.alert("系统提示","请选择一条要编辑的数据!"); return; } var row=selectedRows[0]; $("#dlg").dialog("open").dialog("setTitle","编辑销售机会信息"); $("#fm").form("load",row); url="${pageContext.request.contextPath}/saleChance/save.do?id="+row.id; } function saveSaleChance(){ $("#fm").form("submit",{ url:url, onSubmit:function(){ return $(this).form("validate"); }, success:function(result){ var result=eval('('+result+')'); if(result.success){ $.messager.alert("系统提示","保存成功!"); resetValue(); $("#dlg").dialog("close"); $("#dg").datagrid("reload"); }else{ $.messager.alert("系统提示","保存失败!"); return; } } }); } function resetValue(){ $("#customerName").val(""); $("#chanceSource").val(""); $("#linkMan").val(""); $("#linkPhone").val(""); $("#cgjl").numberbox('setValue',""); $("#overView").val(""); $("#description").val(""); $("#createMan").val(""); $("#createTime").val(""); $("#assignMan").combobox("setValue",""); $("#assignTime").val(""); } function closeSaleChanceDialog(){ $("#dlg").dialog("close"); resetValue(); } function deleteSaleChance(){ var selectedRows=$("#dg").datagrid("getSelections"); if(selectedRows.length==0){ $.messager.alert("系统提示","请选择要删除的数据!"); return; } var strIds=[]; for(var i=0;i<selectedRows.length;i++){ strIds.push(selectedRows[i].id); } var ids=strIds.join(","); $.messager.confirm("系统提示","您确定要删除这<font color=red>"+selectedRows.length+"</font>条数据吗?",function(r){ if(r){ $.post("${pageContext.request.contextPath}/saleChance/delete.do",{ids:ids},function(result){ if(result.success){ $.messager.alert("系统提示","数据已成功删除!"); $("#dg").datagrid("reload"); }else{ $.messager.alert("系统提示","数据删除失败,请联系系统管理员!"); } },"json"); } }); }</script><title>Insert title here</title></head><body style="margin: 1px"> <table id="dg" title="销售机会信息管理" class="easyui-datagrid" fitColumns="true" pagination="true" rownumbers="true" url="${pageContext.request.contextPath}/saleChance/list.do" fit="true" toolbar="#tb"> <thead> <tr> <th field="cb" checkbox="true" align="center"></th> <th field="id" width="50" align="center">编号</th> <th field="chanceSource" width="200" align="center" hidden="true">机会来源</th> <th field="customerName" width="50" align="center">客户名称</th> <th field="cgjl" width="50" align="center" hidden="true">成功几率</th> <th field="overView" width="200" align="center">概要</th> <th field="linkMan" width="100" align="center">联系人</th> <th field="linkPhone" width="100" align="center">联系电话</th> <th field="description" width="200" align="center" hidden="true">机会描述</th> <th field="createMan" width="100" align="center">创建人</th> <th field="createTime" width="100" align="center">创建时间</th> <th field="assignMan" width="200" align="center" hidden="true">指派人</th> <th field="assignTime" width="200" align="center" hidden="true">指派时间</th> <th field="state" width="100" align="center" formatter="formatState">状态</th> <th field="devResult" width="200" align="center" hidden="true">客户开发状态</th> </tr> </thead> </table> <div id="tb"> <div> <a href="javascript:openSaleChanceAddDialog()" class="easyui-linkbutton" iconCls="icon-add" plain="true">创建</a> <a href="javascript:openSaleChanceModifyDialog()" class="easyui-linkbutton" iconCls="icon-edit" plain="true">修改</a> <a href="javascript:deleteSaleChance()" class="easyui-linkbutton" iconCls="icon-remove" plain="true">删除</a> </div> <div> 客户名称: <input type="text" id="s_customerName" size="20" onkeydown="if(event.keyCode==13) searchSaleChance()"/> 概要: <input type="text" id="s_overView" size="20" onkeydown="if(event.keyCode==13) searchSaleChance()"/> 创建人: <input type="text" id="s_createMan" size="20" onkeydown="if(event.keyCode==13) searchSaleChance()"/> 分配状态: <select class="easyui-combobox" id="s_state" editable="false" panelHeight="auto" > <option value="">请选择...</option> <option value="0">未分配</option> <option value="1">已分配</option> </select> <a href="javascript:searchSaleChance()" class="easyui-linkbutton" iconCls="icon-search" plain="true">搜索</a> </div> </div> <div id="dlg" class="easyui-dialog" style="width:700px;height:450px;padding: 10px 20px" closed="true" buttons="#dlg-buttons"> <form id="fm" method="post"> <table cellspacing="8px"> <tr> <td>客户名称:</td> <td><input type="text" id="customerName" name="customerName" class="easyui-validatebox" required="true"/> <font color="red">*</font></td> <td> </td> <td>机会来源</td> <td><input type="text" id="chanceSource" name="chanceSource" /></td> </tr> <tr> <td>联系人:</td> <td><input type="text" id="linkMan" name="linkMan" /></td> <td> </td> <td>联系电话:</td> <td><input type="text" id="linkPhone" name="linkPhone" /></td> </tr> <tr> <td>成功几率(%):</td> <td><input type="text" id="cgjl" name="cgjl" class="easyui-numberbox" data-options="min:0,max:100" required="true"/> <font color="red">*</font></td> <td colspan="3"> </td> </tr> <tr> <td>概要:</td> <td colspan="4"><input type="text" id="overView" name="overView" style="width: 420px"/></td> </tr> <tr> <td>机会描述:</td> <td colspan="4"> <textarea rows="5" cols="50" id="description" name="description"></textarea> </td> </tr> <tr> <td>创建人:</td> <td><input type="text" readonly="readonly" id="createMan" name="createMan" class="easyui-validatebox" required="true"/> <font color="red">*</font></td> <td> </td> <td>创建时间:</td> <td><input type="text" id="createTime" name="createTime" readonly="readonly"/> <font color="red">*</font></td> </tr> <tr> <td>指派给:</td> <td><input class="easyui-combobox" id="assignMan" name="assignMan" data-options="panelHeight:'auto',editable:false,valueField:'trueName',textField:'trueName',url:'${pageContext.request.contextPath}/user/customerManagerComboList.do'"/></td> <td> </td> <td>指派时间:</td> <td><input type="text" id="assignTime" name="assignTime" readonly="readonly"/></td> </tr> </table> </form> </div> <div id="dlg-buttons"> <a href="javascript:saveSaleChance()" class="easyui-linkbutton" iconCls="icon-ok">保存</a> <a href="javascript:closeSaleChanceDialog()" class="easyui-linkbutton" iconCls="icon-cancel">关闭</a> </div></body></html>
0 0
- 9.CRM销售机会的修改和删除
- 8.CRM销售机会的添加
- CRM销售机会管理难点解析
- 7.CRM分页查询销售机会
- ORACLE的CRM如何销售?
- crm message 的删除 和显示
- 3.CRM实现用户的添加,修改,删除
- 销售CRM就销售“买卖市场的管理思想”
- CRM:销售人员的利器还是枷锁?
- 巧用“销售漏斗”提高CRM的实用性
- 巧用“销售漏斗”提高CRM的实用性!
- CRM三大功能支柱:销售 市场营销和客户服务
- crm企业销售管理软件
- 修改crm的登录页面
- 修改crm的登录页面
- 《知客CRM》 客户、销售、管理的领跑者
- 客户关系管理(CRM)销售的好帮手
- CRM是销售人员的“利器”or“枷锁”?
- Annotation
- POJ 3169 图论 差分约束系统
- 编译带有IORT表的UEFI
- 如何快速替换mysql数据库的某个字段的数据改为**
- CentOS 6.x 安装Google Chrome
- 9.CRM销售机会的修改和删除
- Scanner的使用
- combobox绑定datasource的问题,selectvalue的奇怪表现
- PHP中文乱码的常见解决方法总结
- JavaScript中的对象
- 手拉手游戏经典算法(包含面向对象)
- 安卓通过Linux Deploy安装linux系统
- 5-12 How Long Does It Take (25分)
- WIN32、MFC、VC、INI文件读写API