电子商务型网站建设免费自建网站

news/2025/10/4 19:13:12/文章来源:
电子商务型网站建设,免费自建网站,怎么改网站上的logo,wordpress短链Java Web项目的层次结构及常见分包 Web项目中的层次 ControllerServiceDaoController层#xff1a;表现层#xff08;视图#xff09;层。用来显示数据和接收用户数据Service层#xff1a;业务逻辑层#xff0c;用来处理页面。先写接口#xff0c;后写实现类Dao层#…Java Web项目的层次结构及常见分包 Web项目中的层次 ControllerServiceDaoController层表现层视图层。用来显示数据和接收用户数据Service层业务逻辑层用来处理页面。先写接口后写实现类Dao层持久层数据访问层。用来操作数据库 项目中常见的分包 1.controller包 向用户展现的功能实现用户交互。 public class UserController {public UserService userService;/*** 用户管理列表页*/RequestMapping(value/list,methodRequestMethod.GET)public ModelAndView list(ModelAndView model){model.setViewName(user/user_list);return model;}/*** 获取用户列表*/RequestMapping(value/get_list,methodRequestMethod.POST)ResponseBodypublic MapString, Object getList(RequestParam(valueusername,requiredfalse,defaultValue) String username,Page page){MapString, Object ret new HashMapString, Object();MapString, Object queryMap new HashMapString, Object();queryMap.put(username, %username%);queryMap.put(offset, page.getOffset());queryMap.put(pageSize, page.getRows());ret.put(rows, userService.findList(queryMap));ret.put(total, userService.getTotal(queryMap));return ret;}/*** 编辑用户操作*/RequestMapping(value/delete,methodRequestMethod.POST)ResponseBodypublic MapString, String delete(RequestParam(valueids[],requiredtrue) Long[] ids){MapString, String ret new HashMapString, String();if(ids null){ret.put(type, error);ret.put(msg, 请选择要删除的数据!);return ret;}String idsString ;for(Long id:ids){idsString id ,;}idsString idsString.substring(0,idsString.length()-1);if(userService.delete(idsString) 0){ret.put(type, error);ret.put(msg, 删除失败!);return ret;}ret.put(type, success);ret.put(msg, 修改成功!);return ret;}/*** 编辑用户操作*/RequestMapping(value/edit,methodRequestMethod.POST)ResponseBodypublic MapString, String edit(User user){MapString, String ret new HashMapString, String();if(user null){ret.put(type, error);ret.put(msg, 数据出错);return ret;}if(StringUtils.isEmpty(user.getUsername())){ret.put(type, error);ret.put(msg, 用户名不能为空!);return ret;}if(StringUtils.isEmpty(user.getPassword())){ret.put(type, error);ret.put(msg, 密码不能为空!);return ret;}User existUser userService.findByUserName(user.getUsername());if(existUser ! null){if(user.getId() ! existUser.getId()){ret.put(type, error);ret.put(msg, 该用户名已经存在!);return ret;}}if(userService.edit(user) 0){ret.put(type, error);ret.put(msg, 修改失败!);return ret;}ret.put(type, success);ret.put(msg, 修改成功!);return ret;}/*** 添加用户操作*/RequestMapping(value/add,methodRequestMethod.POST)ResponseBodypublic MapString, String add(User user){MapString, String ret new HashMapString, String();if(user null){ret.put(type, error);ret.put(msg, 数据出错);return ret;}if(StringUtils.isEmpty(user.getUsername())){ret.put(type, error);ret.put(msg, 用户名不能为空!);return ret;}if(StringUtils.isEmpty(user.getPassword())){ret.put(type, error);ret.put(msg, 密码不能为空!);return ret;}User existUser userService.findByUserName(user.getUsername());if(existUser ! null){ret.put(type, error);ret.put(msg, 该用户名已经存在!);return ret;}if(userService.add(user) 0){ret.put(type, error);ret.put(msg, 添加失败!);return ret;}ret.put(type, success);ret.put(msg, 添加成功!);return ret;}} 2.service包 用来处理页面。先写接口后写实现类用service.impl包 接口 public interface UserService {public User findByUserName(String username);public int add(User user);public int edit(User user);public int delete(String ids);public ListUser findList(MapString,Object queryMap);public int getTotal(MapString,Object queryMap); }实现类 public class UserServiceImpl implements UserService{Autowiredprivate UserDao userDao;Overridepublic User findByUserName(String username) {// TODO Auto-generated method stubreturn userDao.findByUserName(username);}Overridepublic int add(User user) {// TODO Auto-generated method stubreturn userDao.add(user);}Overridepublic ListUser findList(MapString,Object queryMap) {// TODO Auto-generated method stubreturn userDao.findList(queryMap);}Overridepublic int getTotal(MapString, Object queryMap) {// TODO Auto-generated method stubreturn userDao.getTotal(queryMap);}Overridepublic int edit(User user) {// TODO Auto-generated method stubreturn userDao.edit(user);}Overridepublic int delete(String ids) {// TODO Auto-generated method stubreturn userDao.delete(ids);}} 3.dao包 操作数据库实现数据的增删改查 public interface UserDao {public User findByUserName(String username);public int add(User user);public int edit(User user);public int delete(String ids);public ListUser findList(MapString,Object queryMap);public int getTotal(MapString,Object queryMap); }4.entity包 用来编写实体类模型entity包中类的数据类型变量名必须和数据库表的数据类型属性名相对应。 public class User {private Long id;//用户id主键、自增private String username;//用户名private String password;//密码public Long getId() {return id;}public void setId(Long id) {this.id id;}public String getUsername() {return username;}public void setUsername(String username) {this.username username;}public String getPassword() {return password;}public void setPassword(String password) {this.password password;}} 5.util包 用来存放工具类。 如字符串的处理日期类的处理 public class StringUtil {/*** 将给定的list按照指定的分隔符分割成字符串返回*/public static String joinString(ListLong list,String split){String ret ;for(Long l:list){ret l split;}if(!.equals(ret)){ret ret.substring(0,ret.length() - split.length());}return ret;}public static String generateSn(String prefix,String suffix){return prefix new Date().getTime() suffix;} }

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/927460.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

如何网上快速接网站开发订单手机网站进不去怎么办

场景介绍 小明接到学校老师安排的任务,需要批量将班级里同学们拍的普通照片转换为素描图,供课堂游戏使用,于是求助到程序员老爸,机智的程序员老爸分分钟用几行Python代码解决:在阿里云Serverless函数计算服务中部署普…

临安市住房和建设局网站深圳市网站推广公司

一. 背景 距离上一篇JS文章已经20天,经重新总结发现,上一篇概况的有点浅显,适合初学js的入门了解,但对于已经学习js一段时间的人,或者是想系统的了解JS体系,接下来的文章可能会更有帮助。 该系列博客的书写…

荣县住房和城乡建设厅网站wordpress收费缓存插件

文章目录 一、实验背景与目的二、实验拓扑三、实验需求四、实验解法1. PC 配置 IP 地址2. PC3 属于 Vlan10,PC4 属于 Vlan20,配置单臂路由实现 Vlan10 和 Vlan20 三层互通3. 测试在 PC3 上 Ping PC4 ,可以 Ping 通 PC4 摘要: 本文…

【自然语言处理】文本规范化知识点梳理与习题总结 - 教程

【自然语言处理】文本规范化知识点梳理与习题总结 - 教程pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: "Consolas…

Rocky Linux 8 远程管理配置指南(宿主机 VNC + KVM 虚拟机 VNC) - 指南

pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: "Consolas", "Monaco", "Courier New", …

公司做网站能抵扣进项税吗西安便宜做网站

思路:无论vue还是react打包都会有dist文件夹,内部有index.html。我是想根据index.html中的script src地址是否改变,判断项目是否有新内容。 具体代码如下 首先先拿到生产环境中index.html文本,由于是单页面应用使用fetch(/?_st…

西安企业网站制作公司wordpress 前端优化

接上一篇:企业实战_04_MyCat常用配置文件详解 https://gblfy.blog.csdn.net/article/details/100112080 文章目录1. 加密简述2. 加密目录3. 执行加密4. 添加加密属性5. 添加密文6. 测试是否可用声明:需要提前安装mysql Linux centos7 安装 MySQL5.7.x 1. 加密简述 …

网站云空间大小flatsome wordpress

MySQL 删除操作和连接类型详细讲解和案例示范 DDL(Data Definition Language,数据定义语言)是用于创建和修改数据库结构的语句,包括创建表、索引、视图,以及修改这些结构。本文将详细介绍MySQL DDL语句的常见用法&…

邮票收集问题正推证明

参考文献。 (题目:有一个 \(n\) 面的骰子,扔到各面的概率相等。求期望扔几次可以使每一面都被扔到。) 设 \(f_i\) 表示已经扔到过 \(i\) 个不同的面时,期望的扔的次数。 称事件 \(A\) 为扔到了已经扔过的面,事件…

深入解析:Playwright MCP浏览器自动化详解指南

深入解析:Playwright MCP浏览器自动化详解指南2025-10-04 18:59 tlnshuju 阅读(0) 评论(0) 收藏 举报pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display:…

分布式加载网站的静态seo搜索引擎优化内容

外卖系统源码解读:校园外卖APP开发全攻略 今天,小编将深入解读外卖系统的源码,详细介绍如何开发一款功能齐全的校园外卖APP,帮助开发者快速上手,打造出高质量的外卖应用。 一、需求分析 应具备以下基本功能&#xff…

大作设计网站好玩的网页传奇游戏

标题:Redis缓存一致性难题:如何让数据库和缓存不“打架”?(附程序员脱发指南) 导言:当数据库和缓存成了“异地恋” 想象一下:你刚在美团下单了一份麻辣小龙虾,付款后刷新页面&#…

2025多校冲刺CSP模拟赛2 2025.10.4 模拟炸

rt:炸了 T1 查询 题面 赛时 疯狂排序!!疯狂贪心!!疯狂分讨!!疯狂星期四六!!(大雾) 无果。死了。 打了暴力32pts遗憾离场 正解 二分答案!闪亮登场! 考虑比较元素为\(a_i+b_i*c_j\)形如一次函数\(y=kx+b\), …

算法乱谈

1.图与树最短路所谓最短路,在图上确定序列长度为 \(n\) 的序列 \(A\) 为 \({P_1,P_2,...P_n}\),其中总有 \(P_i \rightarrow P_{i+1} \in E\),并且最小化 \(\sum_{i=1}^n W_{(P_i,P_{i+1})}\) 。 算法 1.dijkstra 其…

2025 年 9 月习题集

2025年9月习题集P5933 [清华集训 2012] 串珠子。简单的图计数。 P8329 [ZJOI2022] 树。DP。 P6646 [CCO 2020] Shopping Plans。堆,最优化。 P7470 [NOI Online 2021 提高组] 岛屿探险。分治,01-Trie。 P4809 [CCC 2…

实用指南:Linux整个系统权限玩坏了怎么办

pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: "Consolas", "Monaco", "Courier New", …

工业云网站建设为什么网站打开是空白

题意 给定两个人相互打电话,如果a打给b,b打给c,c打给a,则说a,b,c在同一电话圈中。给出n个人的m次通话,输出所有的电话圈 思路 用graph[u][v]1表示u和v之间有打电话。在使用floyd算法计算所有的点对之间的值。graph[u][v]1表示u,v之间有直接…

asp.net 网站开发 教程网页翻译器在线翻译

Amundsen 是一个用于数据发现和元数据管理的开源平台。Amundsen是一个用于提高数据分析师、数据科学家和工程师在与数据交互时的生产力的数据发现和元数据引擎。目前,它通过索引数据资源(表、仪表板、流等)并基于使用模式(例如,高频查询的表会比低频查询的表更早显示)提供…

做足球采集软件和预测软件的网站网站建设新闻发布注意什么

无向图概念时间戳\(dfn[x]\),在深度优先遍历中&#xff0c;按照每个节点第一次被访问的顺序&#xff0c;依次做整数标记追溯值\(low[x]\),通过非搜索边能到达的最小时间戳割边判定法则无向边\((x,y)\)是割边/桥&#xff0c;当且仅当存在x的一个子节点满足\(dfn[x] < low[y]\…

阐述网站建设的步骤过程网站首页成品

身为程序员哪一个瞬间让你最奔溃&#xff1f; 有一次我面临一个挑战&#xff0c;由于后续开发的需要&#xff0c;本来不需要同步块运行的部分突然需要进行同步块处理。为了避免重新设计同步块的耗时&#xff0c;我考虑使用一个资源占用标志代替。然而&#xff0c;事情并没有按…