阿西吧、自从学会使用框架。再看以前写的。我真的是要死了、项目用的还不是maven、整理项目能给我搞死。更要命的是这个项目还是用eclipse写的、数据库还是SQL server。阿西吧
这个系统代码不完整、只是提供一种思路。
我觉得值得借鉴的地方:Ajax的使用、json的使用、layui的使用、mvc三层的思想、iframe的使用。
完整的授权操作看这里:一个用户对应几个角色、角色对应多个权限。实现一个用户拥有多个权限。
https://blog.csdn.net/weixin_43304253/article/details/121124431
逻辑删除:这里有详细的例子:https://blog.csdn.net/weixin_43304253/article/details/121167858
课程名称:企业项目实训Ⅰ
设计题目:服装库存管理系统
已知技术参数和设计要求:
1.问题描述(功能要求):
服装库存管理系统主要包括:
(1)注册登录:只有注册后正常登录用户才能使用该系统,若系统20分钟未操作将自动退出,重新登录。
(2)权限管理:用户注册后通过管理员授权,授权包括是否对模块(如用户管理、货号管理、入库管理、出库管理),具有增加、删除、修改和查找的权限;
(3)用户管理和货号管理
系统管理包括用户管理和货号管理,能进行增加、删除、修改和查找的操作。
(4)库存管理
库存管理包括入库单管理和出库单管理。入库单管理包括入库单基本信息管理和入库单明细管理,并能分别对入库单和入库单明细进行增加、删除、修改和查找的操作。出库单管理包括出库单基本信息管理和出库单明细管理,并能分别对出库单和出库单明细进行增加、删除、修改和查找的操作。
(5)辅助管理
辅助管理包括修改密码。
运行环境要求:
(1)客户端:
Windows操作系统
IE浏览器
(2)服务器:
windows server 版操作系统
Tomcat web 服务器
My SQL 数据库服务器技术要求:
强调软件工程过程文档的规范化。
需求分析规格说明书与用例规约
系统数据库设计,时序图,类图,MVC架构
采用JSP、Servlet、MyBatis技术,系统完整编码
所有删除均采用逻辑删除
我就直接贴代码算了。反正你们也是白嫖、哈哈哈哈哈、里边的一些思想还是可以借鉴的
效果:
这个iframe界面默认是可以加载其页面的、可以做个好看的页面。登录进来后就没这样丑了。iframe标签中使用src=“默认的地址”
再次提示、代码不完整。但是已经给出一条完整的从前台都后端的路线。几乎所有的操作都差不多
引用的jar包
web.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>ManagerClass</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<!--
<filter>
<filter-name>login</filter-name>
<filter-class>com.zheng.filter.LoginFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>login</filter-name>
<url-pattern>/pages/index.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>login1</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>login1</filter-name>
<filter-class>com.zheng.filter.PremissionFilter</filter-class>
</filter>
-->
<!-- 配置格式过滤器 -->
<!--
<filter>
<filter-name>encoding</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
-->
<!--
<servlet>
<servlet-name>login</servlet-name>
<servlet-class>com.zheng.Contraller.LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>register</servlet-name>
<servlet-class>com.zheng.Contraller.RegisterServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>register</servlet-name>
<url-pattern>/register</url-pattern>
</servlet-mapping>
-->
</web-app>
mybatis.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<!--MyBatis配置-->
<configuration>
<plugins>
<!-- 让mybatis兼容pageHtlper -->
<plugin interceptor="com.github.pagehelper.PageInterceptor">
<property name="helperDialect" value="mysql"/>
</plugin>
</plugins>
<!--JDBC环境配置、选中默认环境-->
<environments default="MySqlDB">
<!--MySql数据库环境配置-->
<environment id="MySqlDB">
<!--事务管理-->
<transactionManager type="JDBC"/>
<!--连接池-->
<dataSource
type="org.apache.ibatis.datasource.pooled.PooledDataSourceFactory">
<property name="driver" value="com.mysql.jdbc.Driver"/>
<!-- &转义& -->
<property name="url" value="jdbc:mysql://localhost:3306/cmanager"/>
<property name="username" value="root"/>
<property name="password" value="root"/>
</dataSource>
</environment>
</environments>
<!--Mapper注册-->
<mappers>
<!--注册Mapper文件的所在位置-->
<mapper resource="com/zheng/mapper/LogMapper.xml"/>
<mapper resource="com/zheng/mapper/userMapper.xml"/>
<mapper resource="com/zheng/mapper/PremissionMapper.xml"/>
<mapper resource="com/zheng/mapper/shopMapper.xml"/>
<mapper resource="com/zheng/mapper/typeMapper.xml"/>
<mapper resource="com/zheng/mapper/GrantMapper.xml"/>
</mappers>
</configuration>
前台页面
login.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>login</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/login.css">
</head>
<body >
<div id="loginDiv">
<form action="" id="form">
<h1 style="text-align: center;color: pink;">服装库存管理系统登录</h1>
<p style="color: pink;">用户名:<input id="userNname" type="text"><label id="name_trip"></label></p>
<p style="color: pink;">密  码: <input id="password" type="password"><label id="password_trip"></label></p>
<div style="text-align: center;margin-top: 30px;">
<input type="button" style="color: pink;" onclick="login()" class="button" value="登录">
<input type="reset" style="color: pink;" class="button" value="重置">
<a href="Register.jsp" style="color: pink;text-decoration:none;">注册</a>
</div>
</form>
</div>
</body>
<script type="text/javascript" charset="utf-8" src="js/jquery-3.6.0.min.js" ></script>
<script type="text/javascript">
function login(){
var name=$("#userNname").val();
var pwd=$("#password").val();
var login="login";
$.ajax({
url:"${pageContext.request.contextPath}/user?method=login",
type:"post",//请求地址
data:{
name:name,
pwd:pwd,
login:login
},
dataType:"json",
success:function(result){
if(result.status==true){
location.href="pages/index.jsp";
}else{
alert(result.message);
}
}
});
}
</script>
</html>
register.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>register</title>
<link rel="stylesheet" href="css/register.css" />
<style>
</style>
</head>
<script type="text/javascript" src="js/jquery-3.6.0.min.js" ></script>
<script type="text/javascript">
function register(){
var username=$("#userName").val();
var pwd1=$("#password").val();
var pwd=$("#surePassword").val();
var name=$("#name").val();
var tel=$("#tel").val() ;
var address=$("#address").val() ;
var type=$("#type").val() ;
//验证用户名只能是英文字母
var patrn=/^[a-zA-Z]{1,20}$/;
if (!patrn.exec(username)) {
alert("用户名:必须是英文长度1-20");
return;
}
//校验密码:只能输入6-20个字母、数字、下划线
var patrn=/^(\w){6,20}$/;
if(pwd1==""){
alert("密码不能为空");
return;
}else if(!patrn.exec(pwd1)){
alert("密码:只能输入6-20个字母、数字、下划线 ");
return;
}
if(pwd1!=pwd){
alert("两次输入的密码不一致");
return;
}
//验证用户名是否为空
if(name==""){
alert("用户名不能为空");
return;
}
//验证电话号码
var patrn = /^1[0-9]{10}$/;
if(!patrn.exec(tel)){
alert("请输入正确的电话格式");
return;
}
//验证地址
if(address==""){
alert("地址不能为空");
return;
}
//验证用户类型^[1-9]\d*$ //匹配正整数
//var patrn=/^[0-2]{1}$/;
var patrn=/^[0-2]\d*$/;
if(!patrn.exec(type)){
alert("请选择用户类型");
return ;
}
$.ajax({
url:"${pageContext.request.contextPath}/user?method=register",
type:"post",//请求地址
data:{
username:username,
pwd:pwd,
name:name,
tel:tel,
address:address,
type:type
},
dataType:"json",
success:function(result){
if(result.status==true){
location.href="login.jsp";
}else{
alert(result.message);
}
}
});
}
</script>
<body>
<div id="loginDiv">
<form >
<h1 style="color: pink;">服装库存管理新用户注册</h1>
<p style="color: pink;">
账号信息:<input id="userName" type="text" autofocus required placeholder="请输入账号"><label
id="name_trip"></label>
</p>
<p style="color: pink;">
用户密码:<input id="password" type="password" required placeholder="请输入密码"><label
id="password_trip"></label>
</p>
<p style="color: pink;">
确认密码:<input id="surePassword" type="password" required placeholder="请输入密码"><label
id="surePassword_trip"></label>
</p>
<p style="color: pink;">
用户姓名:<input id="name" type="text" required placeholder="请输入姓名"> <label
id="name_trip"></label>
</p>
<p style="color: pink;">
电话号码:<input id="tel" type="text"required placeholder="请输入电话号码"> <label
id="tel_trip"></label>
</p>
<p style="color: pink;">
家庭地址:<input id="address" type="text" required placeholder="请输入家庭地址"> <label
id="address_trip"></label>
</p>
<p style="color: pink;">
用户类型:<select id="type" >
<option value="5">请选择</option>
<!--<option value="0">管理员</option> -->
<option value="1">商家</option>
<option value="2">客户</option>
</select> <label id="type_trip"></label>
</p>
<p style="text-align: center;">
<input type="button" style="color: pink;" onclick="register()" class="button" value="注册">
<input type="reset" style="color: pink;" class="button" value="重置">
</p>
<a style="color: pink; text-decoration:none;" href="login.jsp">登录</a>
</form>
</div>
</body>
</html>
<!--
$(function(){
$("#login").click(function(){
//验证密码
var pwd1=$("#password").val();
var pwd2=$("#surePassword").val();
if(pwd1!=pwd2){
alert("两次输入的密码不一致");
}
//验证文本框
var uName=$("#userName").val();
if (uName.length < 1 || uName.length > 10) {
alert(" 账号长度为1-10位");
}
//验证用户姓名
var name=$("#birthday").val();
if (name.length < 1 || name.length > 10) {
alert(" 姓名长度为1-6位");
}
//验证电话号码
var tel=$("#tel").val();
if(tel.length!=11){
alert("电话号码格式不正确");
}
//验证家庭住址
var address=$("#address").val();
if(address.length<1||address.length>15){
alert(" 家庭住址长度为1-15位");
}
});
}) -->
进入系统的主界面
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="com.zheng.bean.User" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title> 服装系统管理</title>
<link rel="stylesheet" href="../layui/css/layui.css">
</head>
<body>
<div class="layui-layout layui-layout-admin">
<!-- 头部导航开始 -->
<div class="layui-header">
<div class="layui-logo layui-hide-xs layui-bg-black">服装管理</div>
<!-- 头部区域(可配合layui 已有的水平导航) -->
<ul class="layui-nav layui-layout-right">
<%
User user = (User)session.getAttribute("user");
String name="";
if(user!=null){
name = user.getName();
}
%>
<li class="layui-nav-item layui-hide layui-show-md-inline-block">
用户名:<%=name %>
</li>
<li class="layui-nav-item layui-hide layui-show-md-inline-block">
<a href="${pageContext.request.contextPath}/user?method=logout">注销</a>
</li>
</ul>
</div>
<!-- 头部导航结束 -->
<!-- 左导航栏开始 -->
<div class="layui-side layui-bg-black">
<div class="layui-side-scroll">
<!-- 左侧导航区域(可配合layui已有的垂直导航) -->
<ul class="layui-nav layui-nav-tree" lay-filter="test">
<li class="layui-nav-item layui-nav-itemed">
<dl class="layui-nav-child">
<dd><a href="userManager.jsp" target="tbody">用户管理</a></dd>
<dd><a href="shopType.jsp" target="tbody">服装种类管理</a></dd>
<dd><a href="permission.jsp" target="tbody">权限管理</a></dd>
<dd><a href="rolepermission.jsp" target="tbody">角色权限管理</a></dd>
<dd><a href="shop.jsp" target="tbody">商品管理</a></dd>
</dl>
</li>
<li class="layui-nav-item">
<a target="tbody">库存日志管理</a>
<dl class="layui-nav-child">
<dd><a href="Wcount.jsp" target="tbody">入库单管理</a></dd>
<dd><a href="Deliveroutput.jsp" target="tbody">出库单管理</a></dd>
<dd><a href="Delivery.jsp" target="tbody">出库单详细信息管理</a></dd>
<dd><a href="Warehousing.jsp" target="tbody">入库单详细信息管理</a></dd>
</dl>
<dd><a href="updatepassword.jsp" target="tbody">辅助管理</a></dd>
</li>
</ul>
</div>
</div>
<!-- 左导航栏结束 -->
<div class="layui-body">
<!-- 内容主体区域 --> <!-- 540px -->
<iframe name="tbody" src="indexshow.jsp" style="width:100%;height:100%;border:none;">
</iframe>
</div>
</div>
<script src="../layui/layui.js"></script>
<script>
//JS
layui.use(['element', 'layer', 'util'], function(){
var element = layui.element
,layer = layui.layer
,util = layui.util
,$ = layui.$;
//头部事件
util.event('lay-header-event', {
//左侧菜单事件
menuLeft: function(othis){
layer.msg('展开左侧菜单的操作', {icon: 0});
}
,menuRight: function(){
layer.open({
type: 1
,content: '<div style="padding: 15px;">处理右侧面板的操作</div>'
,area: ['260px', '100%']
,offset: 'rt' //右上角
,anim: 5
,shadeClose: true
});
}
});
});
</script>
</body>
</html>
后台的controller层
baseController
package com.zheng.Contraller;
import java.io.IOException;
import java.lang.reflect.Method;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class BaseServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// TODO Auto-generated method stub
doPost(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// 设置响应编码
String methodStr = req.getParameter("method");
// 获得当前对象子类的类类型
Class<? extends BaseServlet> clazz = this.getClass();// clazz代表UserController
try {
// 利用反射机制,取得此类中的方法
Method method = clazz.getMethod(methodStr, HttpServletRequest.class, HttpServletResponse.class);
// 执行此方法
Object result = method.invoke(this, req, resp);
// 4、集中处理返回值响应
if (result != null) {
// 转发重定向 返回字符
String str = (String) result;
if (str.startsWith("jump")) {
req.getRequestDispatcher("login.jsp").forward(req, resp);
} else {
// 给前端返回json格式的数据
resp.getWriter().println(str);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
UserController
package com.zheng.Contraller;
import java.util.List;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zheng.bean.Moudler;
import com.zheng.bean.User;
import com.zheng.service.UserService;
import com.zheng.util.ResultMap;
@WebServlet("/user")
public class UserContrall extends BaseServlet {
UserService us = new UserService();
ResultMap<User> rs = new ResultMap<User>();
// 注册
public String register(HttpServletRequest req, HttpServletResponse resp) {
try {
String username = req.getParameter("username");
String pwd = req.getParameter("pwd");
String name = req.getParameter("name");
String tel = req.getParameter("tel");
String typeStr = req.getParameter("type");
int type = Integer.valueOf(typeStr);
String address = req.getParameter("address");
User user = new User(username, pwd, name, tel, address, type);
us.register(user);
rs.setStatus(true);
} catch (Exception e) {
rs.setStatus(false);
rs.setMessage(e.getMessage());
}
String jsonStr = JSON.toJSONString(rs);
return jsonStr;
}
// 登录验证
public String login(HttpServletRequest req, HttpServletResponse resp) {
try {
String name = req.getParameter("name");
String pwd = req.getParameter("pwd");
User user = us.login(name, pwd);
// 设置session 响应时间
HttpSession session = req.getSession();
session.setMaxInactiveInterval(20 * 60);// 设置session的会话时间长短
session.setAttribute("user", user);
// 返回给前端响应的类型
rs.setStatus(true);
} catch (Exception e) {
rs.setStatus(false);
rs.setMessage(e.getMessage());
}
String jsonStr = JSON.toJSONString(rs);// 设置json格式
return jsonStr;// 后台响应给前台的success
}
// 查询所有的客户信息
public String selectAllUser(HttpServletRequest req, HttpServletResponse resp) {
// 前端传来参数: page当前页码 limits每页显示多少条数据
// sql: select * from user limit 0,5
/*
* page limits sql第一个参数 1 5 0 2 5 5 3 5 10 (page-1)*5
*/
String pageStr = req.getParameter("page");
String limitStr = req.getParameter("limit");
int page = Integer.valueOf(pageStr);
int limit = Integer.valueOf(limitStr);
// 开启分页
PageHelper.startPage(page, limit);
List<User> list = us.selectAllUser();
// 将查询到的所有数据,进行分割处理
PageInfo<User> userList = new PageInfo<User>(list);
list = userList.getList();
rs.setStatus(true);
rs.setList(list);
rs.setCount(userList.getTotal());
String jsonStr = JSON.toJSONString(rs);
return jsonStr;
}
/*
* 删除一条记录根据用户的用户名
*/
public String deleteUserByUsername(HttpServletRequest req, HttpServletResponse resp) {
try {
String username = req.getParameter("username");
us.deleteUserByUsername(username);
rs.setStatus(true);
} catch (Exception e) {
rs.setStatus(false);
rs.setMessage(e.getMessage());
}
String jsonStr = JSON.toJSONString(rs);// 设置json格式
return jsonStr;// 后台响应给前台的success
}
/*
* 增加一条客户的记录
*/
public String insertUser(HttpServletRequest req, HttpServletResponse resp) {
try {
String userStr = req.getParameter("userStr");
us.insertUser(userStr);
rs.setStatus(true);
} catch (Exception e) {
rs.setStatus(false);
rs.setMessage(e.getMessage());
}
String jsonStr = JSON.toJSONString(rs);
return jsonStr;
}
/*
* 辅助管理修改密码
*/
public String updatepassword1(HttpServletRequest req, HttpServletResponse resp) {
try {
User user = (User) req.getSession().getAttribute("user");// 获得当前商家的用户名
String user2 = user.getUsername();
// 1、查询该密码是否和数据库里该用户密码是否一致
String password1 = req.getParameter("prepassword");
User user3 = us.login(user2, password1);
if (user3 != null) {
try {
// 修改密码
String password = req.getParameter("surepassword");
us.updatepassword(user2, password);
rs.setStatus(true);
} catch (Exception e) {
rs.setStatus(false);
rs.setMessage(e.getMessage());
}
} else {
rs.setStatus(false);
rs.setMessage("输入密码有误");
}
} catch (Exception e) {
rs.setStatus(false);
rs.setMessage(e.getMessage());
}
String jsonStr = JSON.toJSONString(rs);
return jsonStr;
}
/*
* 修改客户信息
*/
public String updateUser(HttpServletRequest req, HttpServletResponse resp) {
try {
String userStr = req.getParameter("userStr");// 得到json格式的字符串
String username = req.getParameter("username");
User user = (User) req.getSession().getAttribute("user");// 获得当前商家的用户名
String user2 = user.getUsername();
if (user2.equals(username)) {
us.updateUser(userStr);
rs.setStatus(true);
} else {
rs.setStatus(false);
rs.setMessage("无权限修改!!!");
}
} catch (Exception e) {
rs.setStatus(false);
rs.setMessage(e.getMessage());
}
String jsonStr = JSON.toJSONString(rs);
return jsonStr;
}
/*
* 注销用户信息,结束一个会会话
*/
public String logout(HttpServletRequest req, HttpServletResponse resp) {
HttpSession session = req.getSession();
session.invalidate();// 清空session
return "jump:login";
}
}
///*
// * 修改用户密码updatepassword
// */
//
//public String updatepassword(HttpServletRequest req, HttpServletResponse resp) {
// try {
//
// // 修改当前用户,通过查询user集合
// String username = req.getParameter("username");
// User user = (User) req.getSession().getAttribute("user");// 获得当前商家的用户名
// String user2 = user.getUsername();
// if (user2.equals(username)) { // 当前登录的商家和要修改的商家信息一致
//
// // 1、查询该密码是否和数据库里该用户密码是否一致
// String password1 = req.getParameter("prepassword");
//
// User user3 = us.login(username, password1);
//
// if (user3 != null) {
// try {
//
// // 修改密码
// String password = req.getParameter("surepassword");
// if (password != "") {
// us.updatepassword(username, password);
// rs.setStatus(true);
// } else {
// rs.setStatus(false);
// rs.setMessage("输入的密码不能 为空");
// }
//
// } catch (Exception e) {
// rs.setStatus(false);
// rs.setMessage(e.getMessage());
//
// }
//
// } else {
// rs.setStatus(false);
// rs.setMessage("输入密码有误");
// }
//
// } else {
// rs.setStatus(false);
// rs.setMessage("无权限修改!!!");
//
// }
//
// } catch (Exception e) {
// rs.setStatus(false);
// rs.setMessage(e.getMessage());
// }
// String jsonStr = JSON.toJSONString(rs);
// return jsonStr;
//
//}
LogController
package com.zheng.Contraller;
import java.util.List;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zheng.bean.Log;
import com.zheng.bean.User;
import com.zheng.service.LogService;
import com.zheng.util.ResultMap;
@WebServlet("/log")
public class LogContrall extends BaseServlet{
ResultMap<Log> rs = new ResultMap<Log>();
LogService logService=new LogService();
/**
* 查询当前的ddid getDdid
*/
public String getDdid(HttpServletRequest req, HttpServletResponse resp) {
try {
String ddid = req.getParameter("ddid");
//将当前账单的wwid放入session
HttpSession session = req.getSession();
session.setAttribute("countddid", ddid);
rs.setStatus(true);
} catch (Exception e) {
rs.setStatus(false);
rs.setMessage(e.getMessage());
}
String jsonStr = JSON.toJSONString(rs);// 设置json格式
return jsonStr;// 后台响应给前台的success
}
/**
* 查询当前账单的wwid getWwid
*/
public String getWwid(HttpServletRequest req, HttpServletResponse resp) {
try {
String wwid = req.getParameter("wwid");
//将当前账单的wwid放入session
HttpSession session = req.getSession();
session.setAttribute("countwwid", wwid);
rs.setStatus(true);
} catch (Exception e) {
rs.setStatus(false);
rs.setMessage(e.getMessage());
}
String jsonStr = JSON.toJSONString(rs);// 设置json格式
return jsonStr;// 后台响应给前台的success
}
/**
* 改变账单的可插入状态changeStatus
*/
public String changeStatus(HttpServletRequest req, HttpServletResponse resp) {
try {
String wwid = req.getParameter("wwid");
logService.changeStatus(wwid);
rs.setStatus(true);
} catch (Exception e) {
rs.setStatus(false);
rs.setMessage(e.getMessage());
}
String jsonStr = JSON.toJSONString(rs);// 设置json格式
return jsonStr;// 后台响应给前台的success
}
/**
* 删除入库账单信息
*/
public String deleteWcount(HttpServletRequest req, HttpServletResponse resp) {
try {
String wwid = req.getParameter("wwid");
logService.deleteWcount(wwid);
rs.setStatus(true);
} catch (Exception e) {
rs.setStatus(false);
rs.setMessage(e.getMessage());
}
String jsonStr = JSON.toJSONString(rs);// 设置json格式
return jsonStr;// 后台响应给前台的success
}
/**
*
* @param req
* @param resp
* @return 查询所有的入库单
*/
public String selectAllTWcount(HttpServletRequest req, HttpServletResponse resp) {
// 前端传来参数: page当前页码 limits每页显示多少条数据
// sql: select * from user limit 0,5
/*
* page limits sql第一个参数 1 5 0 2 5 5 3 5 10 (page-1)*5
*/
String pageStr = req.getParameter("page");
String limitStr = req.getParameter("limit");
int page = Integer.valueOf(pageStr);
int limit = Integer.valueOf(limitStr);
// 开启分页
PageHelper.startPage(page, limit);
List<Log> list = logService.selectAllTWcount();
// 将查询到的所有数据,进行分割处理
PageInfo<Log> logList = new PageInfo<Log>(list);
list = logList.getList();
rs.setStatus(true);
rs.setList(list);
rs.setCount(logList.getTotal());
String jsonStr = JSON.toJSONString(rs);
return jsonStr;
}
//查询一条账单对应的多条记录selectOneWLog
public String selectOneWLog(HttpServletRequest req, HttpServletResponse resp) {
// 前端传来参数: page当前页码 limits每页显示多少条数据
// sql: select * from user limit 0,5
/*
* page limits sql第一个参数 1 5 0 2 5 5 3 5 10 (page-1)*5
*/
String pageStr = req.getParameter("page");
String limitStr = req.getParameter("limit");
int page = Integer.valueOf(pageStr);
int limit = Integer.valueOf(limitStr);
// 开启分页
PageHelper.startPage(page, limit);
String wwid = (String) req.getSession().getAttribute("countwwid");
System.out.print(wwid);
List<Log> list = logService.selectOneWLog(wwid);
// 将查询到的所有数据,进行分割处理
PageInfo<Log> logList = new PageInfo<Log>(list);
list = logList.getList();
rs.setStatus(true);
rs.setList(list);
rs.setCount(logList.getTotal());
String jsonStr = JSON.toJSONString(rs);
return jsonStr;
}
/**
* 根据一条出库账单查询数据 selectOneDLog
*/
public String selectOneDLog(HttpServletRequest req, HttpServletResponse resp) {
// 前端传来参数: page当前页码 limits每页显示多少条数据
// sql: select * from user limit 0,5
/*
* page limits sql第一个参数 1 5 0 2 5 5 3 5 10 (page-1)*5
*/
String pageStr = req.getParameter("page");
String limitStr = req.getParameter("limit");
int page = Integer.valueOf(pageStr);
int limit = Integer.valueOf(limitStr);
// 开启分页
PageHelper.startPage(page, limit);
String ddid = (String) req.getSession().getAttribute("countddid");
List<Log> list = logService.selectOneDLog(ddid);
// 将查询到的所有数据,进行分割处理
PageInfo<Log> logList = new PageInfo<Log>(list);
list = logList.getList();
rs.setStatus(true);
rs.setList(list);
rs.setCount(logList.getTotal());
String jsonStr = JSON.toJSONString(rs);
return jsonStr;
}
/*
* 查询所有的入库记录
*
*/
public String selectAllWLog(HttpServletRequest req, HttpServletResponse resp) {
// 前端传来参数: page当前页码 limits每页显示多少条数据
// sql: select * from user limit 0,5
/*
* page limits sql第一个参数 1 5 0 2 5 5 3 5 10 (page-1)*5
*/
String pageStr = req.getParameter("page");
String limitStr = req.getParameter("limit");
int page = Integer.valueOf(pageStr);
int limit = Integer.valueOf(limitStr);
// 开启分页
PageHelper.startPage(page, limit);
List<Log> list = logService.selectAllWLog();
// 将查询到的所有数据,进行分割处理
PageInfo<Log> logList = new PageInfo<Log>(list);
list = logList.getList();
rs.setStatus(true);
rs.setList(list);
rs.setCount(logList.getTotal());
String jsonStr = JSON.toJSONString(rs);
return jsonStr;
}
/*
* 删除一条入库历史记录
*
*
*/
public String deleteWarehousing(HttpServletRequest req, HttpServletResponse resp) {
try {
String wid = req.getParameter("wid");
logService.deleteWarehousing(wid);
rs.setStatus(true);
} catch (Exception e) {
rs.setStatus(false);
rs.setMessage(e.getMessage());
}
String jsonStr = JSON.toJSONString(rs);// 设置json格式
return jsonStr;// 后台响应给前台的success
}
/*
* 查询所有的出库记录
*
*/
public String selectAllDLog(HttpServletRequest req, HttpServletResponse resp) {
// 前端传来参数: page当前页码 limits每页显示多少条数据
// sql: select * from user limit 0,5
/*
* page limits sql第一个参数 1 5 0 2 5 5 3 5 10 (page-1)*5
*/
String pageStr = req.getParameter("page");
String limitStr = req.getParameter("limit");
int page = Integer.valueOf(pageStr);
int limit = Integer.valueOf(limitStr);
// 开启分页
PageHelper.startPage(page, limit);
List<Log> list = logService.selectAllDLog();
// 将查询到的所有数据,进行分割处理
PageInfo<Log> logList = new PageInfo<Log>(list);
list = logList.getList();
rs.setStatus(true);
rs.setList(list);
rs.setCount(logList.getTotal());
String jsonStr = JSON.toJSONString(rs);
return jsonStr;
}
/*
* 删除一条出库历史记录
*
*
*/
public String deleteDelivery(HttpServletRequest req, HttpServletResponse resp) {
try {
String did = req.getParameter("did");
logService.deleteDelivery(did);
rs.setStatus(true);
} catch (Exception e) {
rs.setStatus(false);
rs.setMessage(e.getMessage());
}
String jsonStr = JSON.toJSONString(rs);// 设置json格式
return jsonStr;// 后台响应给前台的success
}
/**
*
* 修改出库账单状态changeStatusD
*/
public String changeStatusD(HttpServletRequest req, HttpServletResponse resp) {
try {
String ddid = req.getParameter("ddid");
logService.changeStatusD(ddid);
rs.setStatus(true);
} catch (Exception e) {
rs.setStatus(false);
rs.setMessage(e.getMessage());
}
String jsonStr = JSON.toJSONString(rs);// 设置json格式
return jsonStr;// 后台响应给前台的success
}
/**
* 删除一条出库单deleteDcount
*
*/
public String deleteDcount(HttpServletRequest req, HttpServletResponse resp) {
try {
String ddid = req.getParameter("ddid");
logService.deleteDcount(ddid);
rs.setStatus(true);
} catch (Exception e) {
rs.setStatus(false);
rs.setMessage(e.getMessage());
}
String jsonStr = JSON.toJSONString(rs);// 设置json格式
return jsonStr;// 后台响应给前台的success
}
/**
*
* 修改出库单状态changeStatus
*/
/**
* 查询所有的出库单号selectAllTDcount
*/
public String selectAllTDcount(HttpServletRequest req, HttpServletResponse resp) {
// 前端传来参数: page当前页码 limits每页显示多少条数据
// sql: select * from user limit 0,5
/*
* page limits sql第一个参数 1 5 0 2 5 5 3 5 10 (page-1)*5
*/
String pageStr = req.getParameter("page");
String limitStr = req.getParameter("limit");
int page = Integer.valueOf(pageStr);
int limit = Integer.valueOf(limitStr);
// 开启分页
PageHelper.startPage(page, limit);
List<Log> list = logService.selectAllTDcount();
// 将查询到的所有数据,进行分割处理
PageInfo<Log> logList = new PageInfo<Log>(list);
list = logList.getList();
rs.setStatus(true);
rs.setList(list);
rs.setCount(logList.getTotal());
String jsonStr = JSON.toJSONString(rs);
return jsonStr;
}
}
ShopController
package com.zheng.Contraller;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zheng.bean.Shop;
import com.zheng.bean.Type;
import com.zheng.bean.User;
import com.zheng.service.ShopService;
import com.zheng.util.ResultMap;
@WebServlet("/shop")
public class ShopContrall extends BaseServlet {
/**
*
*/
private static final long serialVersionUID = 1L;
ShopService shopservice=new ShopService();
ResultMap<Shop> rs=new ResultMap<Shop>();
//增加新的商品信息
public String insertShopByUsername(HttpServletRequest req,HttpServletResponse resp) {
try {
String shopStr=req.getParameter("shopStr");
User user=(User) req.getSession().getAttribute("user");//获得当前商家的用户名
System.out.print(user.getUsername());
shopservice.insertShopByUsername(shopStr,user.getUsername());
rs.setStatus(true);
}catch(Exception e) {
rs.setStatus(false);
rs.setMessage(e.getMessage());
}
String jsonstr=JSON.toJSONString(rs);
return jsonstr;
}
//出库
public String updateDelivery(HttpServletRequest req, HttpServletResponse resp) {
try {
String shopStr=req.getParameter("shopStr");//获得表单提交的json格式的字符串
String sid=req.getParameter("sid");
User user=(User) req.getSession().getAttribute("user");//获得当前商家的用户名
shopservice.updateDelivery(shopStr,sid,user.getUsername());
rs.setStatus(true);
}catch(Exception e) {
rs.setMessage(e.getMessage());
rs.setStatus(false);
}
String jsonstr=JSON.toJSONString(rs);
return jsonstr;
}
/*
* 入库
*/
public String updateWarehousing(HttpServletRequest req, HttpServletResponse resp) {
try {
String shopStr=req.getParameter("shopStr");//获得表单提交的json格式的字符串
String sid=req.getParameter("sid");
String tname=req.getParameter("tname");
User user=(User) req.getSession().getAttribute("user");//获得当前商家的用户名
shopservice.updateWarehousing(shopStr, sid,tname, user.getUsername());
rs.setStatus(true);
}catch(Exception e) {
rs.setMessage(e.getMessage());
rs.setStatus(false);
}
String jsonstr=JSON.toJSONString(rs);
return jsonstr;
}
// 查询所有的客户信息
public String selectAllShop(HttpServletRequest req, HttpServletResponse resp) {
try {
String pageStr = req.getParameter("page");
String limitStr = req.getParameter("limit");
int page = Integer.valueOf(pageStr);
int limit = Integer.valueOf(limitStr);
// 开启分页
PageHelper.startPage(page, limit);
List<Shop> list = shopservice.selectAllShop();
// 将查询到的所有数据,进行分割处理
PageInfo<Shop> typeList = new PageInfo<Shop>(list);
list = typeList.getList();
rs.setCount(typeList.getTotal());
rs.setList(list);
rs.setStatus(true);
}catch(Exception e) {
rs.setStatus(false);
rs.setMessage(e.getMessage());
}
String jsonStr = JSON.toJSONString(rs);
return jsonStr;
}
}
Service层
UserService
package com.zheng.service;
import java.util.List;
import java.util.UUID;
import org.apache.ibatis.session.SqlSession;
import com.alibaba.fastjson.JSON;
import com.zheng.bean.Type;
import com.zheng.bean.User;
import com.zheng.dao.RoleDao;
import com.zheng.dao.UserDao;
import com.zheng.util.MybatisUtil;
public class UserService {
MybatisUtil mybatisUtil = new MybatisUtil();
SqlSession sqlSession = mybatisUtil.getConnect();// 获得sqlSession对象,用来操作数据库
UserDao ud = sqlSession.getMapper(UserDao.class);// 获得User对象、通过反射机制操作
// 登录查询
public User login(String username, String password) {
User user = new User(username, password);// 向实体类构造方法注入数据
user = ud.login(user);
if (user == null) {
throw new RuntimeException("用户名或者密码错误!!!");
}
return user;
}
// 查询所有用户信息
public List<User> selectAllUser() {
List<User> list = ud.selectAllUser();
return list;
}
/*
* 修改密码
*/
public int updatepassword(String username, String password) {
// Type type = JSON.parseObject(typeStr, Type.class);//json格式转化为字符串的形式
User user = new User(username, password);
int num = ud.updatePassword(user);
if (num == 0) {
throw new RuntimeException("修改失败");
} else {
sqlSession.commit();// 提交事务
}
return num;
}
// 删除用户信心通过用户名
public int deleteUserByUsername(String username) {
int num = ud.deleteUserByUsername(username);
if (num == 0) { // num代表修改数据库受影响的行数,0:代表删除失败
throw new RuntimeException("此用户不存在,请联系管理员");
} else {
sqlSession.commit();// 提交事务
}
return num;
}
/*
* 注册
*/
public int register(User user) {
// 插入用户表
int num = ud.insertUser(user);
if (num == 0) {
throw new RuntimeException("此用户已经在,请联系管理员");
}
// 插入用户角色表
String urid = UUID.randomUUID().toString();// 随机生成用户和角色id
user.setUrid(urid);
// 判断注册的是用户还是商家
int type1 = user.getType();// 从注册提交的对象取得类型
if (type1 == 2) {// 普通用户
user.setRid("R003");
RoleDao rd = sqlSession.getMapper(RoleDao.class);// 获得Role对象、通过反射机制操作
num = rd.insertUserRole(user);
if (num == 0) {
throw new RuntimeException("注册失败,请联系管理员");
}
} else if (type1 == 1) {// 商家注册
user.setRid("R002");
RoleDao rd = sqlSession.getMapper(RoleDao.class);// 获得Role对象、通过反射机制操作
num = rd.insertUserRole(user);
if (num == 0) {
throw new RuntimeException("注册失败,请联系管理员");
}
}
sqlSession.commit();// 提交事务
return num;
}
/*
* 增加客户记录
*/
public int insertUser(String userStr) {
User user = JSON.parseObject(userStr, User.class);// json格式转化为字符串的形式
// 插入用户角色表
String urid = UUID.randomUUID().toString();// 随机生成用户和角色id
user.setUrid(urid);
int num = -1;
// 判断注册的是用户还是商家
int type1 = user.getType();
if (type1 == 2) {// 普通用户
user.setRid("R003");
RoleDao rd = sqlSession.getMapper(RoleDao.class);// 获得Role对象、通过反射机制操作
num = rd.insertUserRole(user);
if (num == 0) {
throw new RuntimeException("注册失败,请联系管理员");
}
} else if (type1 == 0) {// 管理员
user.setRid("R001");
RoleDao rd = sqlSession.getMapper(RoleDao.class);// 获得Role对象、通过反射机制操作
num = rd.insertUserRole(user);
if (num == 0) {
throw new RuntimeException("注册失败,请联系管理员");
}
} else if (type1 == 1) {// 商家
user.setRid("R002");
RoleDao rd = sqlSession.getMapper(RoleDao.class);// 获得Role对象、通过反射机制操作
num = rd.insertUserRole(user);
if (num == 0) {
throw new RuntimeException("注册失败,请联系管理员");
}
}
num = ud.insertUser(user);
if (num == 0) {
throw new RuntimeException("此用户已经在,请联系管理员");
} else {
sqlSession.commit();// 提交事务
}
return num;
}
/*
* 修改客户信息
*/
public int updateUser(String userStr) {
User user = JSON.parseObject(userStr, User.class);// json格式转化为字符串的形式
int num = ud.updateUser(user);
if (num == 0) {
throw new RuntimeException("用户不存在");
} else {
sqlSession.commit();// 提交事务
}
return num;
}
}
LogService
package com.zheng.service;
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import com.alibaba.fastjson.JSON;
import com.zheng.bean.Log;
import com.zheng.bean.Type;
import com.zheng.bean.User;
import com.zheng.dao.LogDao;
import com.zheng.util.MybatisUtil;
public class LogService {
/**
* 改变入库账单的可插入状态changeStatus
*/
public int changeStatus(String wwid) {
// Type type = JSON.parseObject(typeStr, Type.class);//json格式转化为字符串的形式
MybatisUtil mybatisUtil = new MybatisUtil();
SqlSession sqlSession = mybatisUtil.getConnect();
LogDao logDao = sqlSession.getMapper(LogDao.class);
Log log = new Log();
log.setStatus(1);// 设置提交的状态
log.setWwid(wwid);
int num = logDao.changeStatus(log);
if (num == 0) {
throw new RuntimeException("商品种类不存在");
} else {
sqlSession.commit();// 提交事务
}
return num;
}
/**
* 删除入库账单信息deleteWcount
*/
public int deleteWcount(String wwid) {
MybatisUtil mybatisUtil = new MybatisUtil();
SqlSession sqlSession = mybatisUtil.getConnect();
LogDao logDao = sqlSession.getMapper(LogDao.class);
int num = logDao.deleteWcount(wwid);
if (num == 0) {
throw new RuntimeException("此条账单信息不存在");
}
// 删除出库账单包含的商品详情
num = logDao.deleteWdetail(wwid);
if (num == 0) {
throw new RuntimeException("此条账单信息不存在");
}
sqlSession.commit();// 提交事务
return num;
}
/**
* 查询入库单号
*
* @return
*/
public List<Log> selectAllTWcount() {
MybatisUtil mybatisUtil = new MybatisUtil();
SqlSession sqlSession = mybatisUtil.getConnect();// 获得sqlSession对象,用来操作数据库
LogDao logDao = sqlSession.getMapper(LogDao.class);
List<Log> list = logDao.selectAllTWcount();
if (list == null || list.size() == 0) {
throw new RuntimeException("入库商品不存在AA");
}
return list;
}
/**
*
* 查询出库单包含的多条记录selectOneDLog
*/
public List<Log> selectOneDLog(String ddid) {
MybatisUtil mybatisUtil = new MybatisUtil();
SqlSession sqlSession = mybatisUtil.getConnect();// 获得sqlSession对象,用来操作数据库
LogDao logDao = sqlSession.getMapper(LogDao.class);
List<Log> list = logDao.selectOneDLog(ddid);
System.out.print(list.size());
if (list == null || list.size() == 0) {
throw new RuntimeException("入库商品不存在aaa");
}
return list;
}
/**
*
* 查询一条账单对应的详细信息selectOneWLog
*
* @return
*/
public List<Log> selectOneWLog(String wwid) {
MybatisUtil mybatisUtil = new MybatisUtil();
SqlSession sqlSession = mybatisUtil.getConnect();// 获得sqlSession对象,用来操作数据库
LogDao logDao = sqlSession.getMapper(LogDao.class);
List<Log> list = logDao.selectOneWLog(wwid);
if (list == null || list.size() == 0) {
throw new RuntimeException("入库商品不存在");
}
return list;
}
/*
* 查询所有入库表商品
*/
public List<Log> selectAllWLog() {
MybatisUtil mybatisUtil = new MybatisUtil();
SqlSession sqlSession = mybatisUtil.getConnect();// 获得sqlSession对象,用来操作数据库
LogDao logDao = sqlSession.getMapper(LogDao.class);
List<Log> list = logDao.selectAllWLog();
if (list == null || list.size() == 0) {
throw new RuntimeException("入库商品不存在");
}
return list;
}
/*
* 删除入库商品信息
*
*/
public int deleteWarehousing(String wid) {
MybatisUtil mybatisUtil = new MybatisUtil();
SqlSession sqlSession = mybatisUtil.getConnect();
LogDao logDao = sqlSession.getMapper(LogDao.class);
int num = logDao.deleteWarehousing(wid);
if (num == 0) {
throw new RuntimeException("此条记录不存在,请联系管理员");
}
sqlSession.commit();// 提交事务
return num;
}
/*
* 查询所有出库表商品
*/
public List<Log> selectAllDLog() {
MybatisUtil mybatisUtil = new MybatisUtil();
SqlSession sqlSession = mybatisUtil.getConnect();// 获得sqlSession对象,用来操作数据库
LogDao logDao = sqlSession.getMapper(LogDao.class);
List<Log> list = logDao.selectAllDLog();
if (list == null || list.size() == 0) {
throw new RuntimeException("入库商品不存在");
}
return list;
}
/**
* 修改出库账单插入状态changeStatusD
*/
public int changeStatusD(String ddid) {
// Type type = JSON.parseObject(typeStr, Type.class);//json格式转化为字符串的形式
MybatisUtil mybatisUtil = new MybatisUtil();
SqlSession sqlSession = mybatisUtil.getConnect();
LogDao logDao = sqlSession.getMapper(LogDao.class);
Log log = new Log();
log.setStatus(1);// 设置提交的状态
log.setDdid(ddid);
int num = logDao.changeStatusD(log);
if (num == 0) {
throw new RuntimeException("商品种类不存在");
} else {
sqlSession.commit();// 提交事务
}
return num;
}
/**
* 删除一条出库账单数据deleteDcount
*
*/
public int deleteDcount(String ddid) {
MybatisUtil mybatisUtil = new MybatisUtil();
SqlSession sqlSession = mybatisUtil.getConnect();
LogDao logDao = sqlSession.getMapper(LogDao.class);
int num = logDao.deleteDcount(ddid);
if (num == 0) {
throw new RuntimeException("此条账单信息不存在");
}
num=logDao.deleteDDetail(ddid);
if (num == 0) {
throw new RuntimeException("此条账单信息不存在");
}
sqlSession.commit();// 提交事务
return num;
}
/**
* 查询所有的出库单详情selectAllTDcount
*
*
*/
public List<Log> selectAllTDcount() {
MybatisUtil mybatisUtil = new MybatisUtil();
SqlSession sqlSession = mybatisUtil.getConnect();// 获得sqlSession对象,用来操作数据库
LogDao logDao = sqlSession.getMapper(LogDao.class);
List<Log> list = logDao.selectAllTDcount();
if (list == null || list.size() == 0) {
throw new RuntimeException("入库商品不存在");
}
return list;
}
/*
* 删除出库商品信息
*
*/
public int deleteDelivery(String did) {
MybatisUtil mybatisUtil = new MybatisUtil();
SqlSession sqlSession = mybatisUtil.getConnect();
LogDao logDao = sqlSession.getMapper(LogDao.class);
int num = logDao.deleteDelivery(did);
if (num == 0) {
throw new RuntimeException("此条记录不存在,请联系管理员");
} else {
sqlSession.commit();// 提交事务
}
return num;
}
}
Dao层
package com.zheng.dao;
import java.util.List;
import com.zheng.bean.Shop;
import com.zheng.bean.Type;
import com.zheng.bean.User;
public interface UserDao {
//增加商品种类
public int insertUserShop(Shop type);
//登录查询
public User login(User user);
//修改商品种类信息
public int updatePassword(User user);
//查询用户信息
public List<User> selectAllUser();
//删除用户根据用户名
public int deleteUserByUsername(String username);
//增加用户信息addUser
public int insertUser(User user);
//修改用户信息
public int updateUser(User user);
}
mapper
```
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
select from usermanager where username=#{username} and password=#{password}
select from usermanager
delete from usermanager where username = #{username}
insert into usermanager value (#{username},#{password},#{name},#{tel},#{address},#{type})
update usermanager set
password = #{password}
where
username = #{username}
update usermanager set
name = #{name},tel = #{tel},address = #{address}, type = #{type}
where
username = #{username}
insert into user_shop (usid,username,sid) value (#{usid},#{username},#{sid})