SSM项目实战之二十一:客户信息修改
客户信息修改
- 实现步骤
- customer.jsp
- CustomerServiceImpl
- CustomerMapper.xml
- customerUpdate.jsp
- CustomerController
- ICustomerService
- CustomerServiceImpl
- 测试
- 业务员操作效果
- 管理员登录效果
实现步骤
customer.jsp
改变修改按钮的地址信息
CustomerServiceImpl
/*** 新增客户* 查询 所有的角色是业务员的用户* 查询 常用区间 基础数据* 修改客户* 查询 所有的角色是业务员的用户* 查询 常用区间 基础数据* 根据客户ID 查询详细信息*/
@Override
public void getUpdateInfo(Integer id, Model m) {// 1.查询所有具有业务员角色的用户信息List<User> users = userService.queryUserByRoleName(Constant.ROLE_SALESMAN);// 2.查询 常用区间的基础数据List<BasicData> intervals = basicService.getBasicDataByParentName(Constant.BASIC_COMMON_INTERVAL);if(id!=null && id > 0){Customer customer = new Customer();customer.setCustomerId(id);// 查询更新需要的数据List<CustomerDto> list = customerMapper.queryView(customer);if(list != null&& list.size()==1){m.addAttribute("dto", list.get(0));}}m.addAttribute("users", users);m.addAttribute("intervals", intervals);
}
CustomerMapper.xml
添加查询条件
<select id="queryView" resultMap="baseCustomerDto" parameterType="com.yjn.pojo.Customer" >select t1.customer_id,t1.customer_name,t1.address,t1.c_sex,t1.email,t1.base_id,t1.id_card,t1.mobile_phone,t1.order_id,t1.remark,t1.user_id,t1.user_name,t1.real_name,t1.base_name from v_customer t1<where><if test="userId !=null and userId > 0">user_id = #{userId}</if><if test="customerId !=null and customerId > 0 ">customer_id = #{customerId}</if></where></select>
customerUpdate.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="/css/style.css" rel="stylesheet" type="text/css" />
<link href="/css/select.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/jquery.idTabs.min.js"></script>
<script type="text/javascript" src="/js/select-ui.min.js"></script>
<script type="text/javascript">
$(document).ready(function(e) {$(".select1").uedSelect({width : 345 });$(".select2").uedSelect({width : 167 });$(".select3").uedSelect({width : 100});
});
</script>
</head>
<body><div class="place"><span>位置:</span><ul class="placeul"><li><a href="/">首页</a></li><li><a href="/user/query">客户管理</a></li></ul></div><div class="formbody"><div class="formtitle"><span>新增客户信息</span></div><form action="/customer/saveOrUpdate"><ul class="forminfo"><input type="hidden" name="customerId" value="${dto.customer.customerId}"><li><label>客户姓名</label><input name="customerName" type="text" value="${dto.customer.customerName}" class="dfinput" /><i></i></li><li><label>客户电话</label><input name="mobilePhone" type="text" value="${dto.customer.mobilePhone}" class="dfinput" /></li><li><label>性别 ${dto.customer.cSex}</label><input type="radio" name="cSex" value="0" ${dto.customer.cSex eq true?"checked":"" }> 男 <input type="radio" name="cSex" value="1" ${dto.customer.cSex eq false?"checked":"" }> 女</li><li><label>电子邮箱</label><input name="email" type="text" class="dfinput" value="${dto.customer.email}"/><i></i></li><li><label>通讯地址</label><input name="address" type="text" class="dfinput" value="${dto.customer.address}"/><i></i></li><li><label>身份证号码</label><input name="idCard" type="text" class="dfinput" value="${dto.customer.idCard}"/><i></i></li><li><label>业务员</label><div class="vocation"><select class="select1" name="userId"><!-- 和新增客户区分开 --><c:if test="${empty dto}"><c:forEach items="${ users}" var="user"><option value="${user.userId }" >${user.realName }</option></c:forEach></c:if><c:if test="${not empty dto }"><shiro:hasAnyRoles name="业务员,操作员"><option value="${dto.customer.userId }" >${dto.salesMan }</option></shiro:hasAnyRoles><shiro:hasRole name="管理员"><c:forEach items="${ users}" var="user"><option value="${user.userId }" ${user.userId eq dto.customer.userId?"selected":"" } >${user.realName }</option></c:forEach></shiro:hasRole></c:if></select></div><i></i></li><li><label>常用区间</label><div class="vocation"><select class="select1" name="baseId"><c:forEach items="${ intervals}" var="it"><option value="${it.baseId }" ${it.baseId eq dto.customer.baseId?"selected":"" }>${it.baseName }</option></c:forEach></select></div><i></i></li><li><label>备注</label><textarea name="remark" cols="" rows="" class="textinput" >${dto.customer.remark }</textarea></li><li><label> </label><input name="" type="submit"class="btn" value="确认保存" /></li></ul></form></div><div style="display: none"><script src='http://v7.cnzz.com/stat.php?id=155540&web_id=155540'language='JavaScript' charset='gb2312'></script></div>
</body>
</html>
CustomerController
@RequestMapping("/saveOrUpdate")
public String saveOrUpdate(Customer customer) throws IOException{if(customer.getCustomerId()!=null && !"".equals(customer.getCustomerId())){// 更新customerService.updateCustomer(customer);}else{// 添加customerService.addCustomer(customer);}return "success";
}
ICustomerService
public void updateCustomer(Customer customer);
CustomerServiceImpl
@Override
public void updateCustomer(Customer customer) {// TODO Auto-generated method stubcustomerMapper.updateByPrimaryKey(customer);
}
测试
业务员操作效果
业务员只能选择自己
管理员登录效果
可以选择业务员
SSM项目实战之二十一:客户信息修改相关推荐
- Vue + Spring Boot 项目实战(二十一):缓存的应用
重要链接: 「系列文章目录」 「项目源码(GitHub)」 本篇目录 前言 一.缓存:工程思想的产物 二.Web 中的缓存 1.缓存的工作模式 2.缓存的常见问题 三.缓存应用实战 1.Redis 与 ...
- Vue + Spring Boot 项目实战(二十一):缓存的应用(转载)
重要链接: 「系列文章目录」 「项目源码(GitHub)」 本篇目录 前言 一.缓存:工程思想的产物 二.Web 中的缓存 1.缓存的工作模式 2.缓存的常见问题 三.缓存应用实战 1.Redis 与 ...
- SSM项目实战之二十四:表单数据校验
表单数据校验 前言 前端页面 测试 前言 在前面的文章中我们并没有对表单提交的数据做校验,本文主要以添加用户为例介绍如何对表单数据添加校验. 前端页面 首先把原先的提交按钮换掉,设置一个点击函数 为表 ...
- (转载)Android项目实战(二十七):数据交互(信息编辑)填写总结
Android项目实战(二十七):数据交互(信息编辑)填写总结 前言: 项目中必定用到的数据填写需求.比如修改用户名的文字编辑对话框,修改生日的日期选择对话框等等.现总结一下,方便以后使用. 注: 先 ...
- (转载)Android项目实战(二十八):使用Zxing实现二维码及优化实例
Android项目实战(二十八):使用Zxing实现二维码及优化实例 作者:听着music睡 字体:[增加 减小] 类型:转载 时间:2016-11-21 我要评论 这篇文章主要介绍了Android项 ...
- Vue2+VueRouter2+webpack 构建项目实战(二)目录以及文件结构
Vue2+VueRouter2+webpack 构建项目实战(二)目录以及文件结构 2017年8月补充 2016年,我写了一系列的 VUE 入门教程,当时写这一系列博文的时候,我也只是一个菜鸟,甚至在 ...
- MPAndroidChart项目实战(二)——双平滑曲线(双折线图)和MarkView实现
Demo补充中(UpDating):https://github.com/JinBoy23520/MPAndroidChartDemoByJin 本文出自:http://blog.csdn.net/d ...
- Android项目实战(二十二):启动另一个APP or 重启本APP
Android项目实战(二十二):启动另一个APP or 重启本APP 原文:Android项目实战(二十二):启动另一个APP or 重启本APP 一.启动另一个APP 目前公司项目需求,一个主AP ...
- Oracle数据库12cR2(项目实战之二):Linux系统安装Oracle12.2
oracle数据库12cR2(项目实战之二):linux系统安装Oracle12.2 一.课程主题: 风哥Oracle数据库教程12cR2(项目实战之二):在linux操作系统安装Oracle12.2 ...
最新文章
- access“idno”字段改为文本型_结构化文本计算示例(一)
- ThumbProcess.exe错误的解决方法
- Python之迭代器和生成器(Day17)
- 【bzoj2751】[HAOI2012]容易题(easy) 数论,简单题
- Matlab弹出窗口
- BZOJ1856[Scoi2010]字符串——组合数学+容斥
- 诛仙服务器显示横线,诛仙手游聊天颜色字体代码发送带颜色的字
- Taro+react开发(8)--控制跳转
- 卡尔曼滤波估算车辆质量——matab simulink仿真
- Jscript 控制程序的流程
- android关于okhttp中对于onFailure回调的异常捕获
- 行内元素与块状元素 行内替换元素与行内非替换元素的区别
- Iocomp Ultra Pack ActiveX 5.12
- wireshark学习笔记(MAC地址欺骗)
- 写给自己 NOI2012流水帐
- 【高效复习】计算机网络重要概念总结
- java 数值越界的判断_java 中int 范围越界校验算法
- apachecn归档下载
- r3 2200g参数 r3 2200g功耗 酷睿r32200g核显相当于什么显卡
- 相机的针孔模型及其内参数,外参数的理解