当前位置: 首页 > news >正文

网站制作公司去哪找客户电商运营主要工作内容

网站制作公司去哪找客户,电商运营主要工作内容,黑龙江省建设厅的网站,南京h5设计公司目录 一、前言 二、项目结构 三、初始化项目 四、SpringBoot项目集成Mybatis编写接口 五、代码仓库 一、前言 构建一个基于Spring Boot框架的现代化Web应用程序,以满足[公司/组织名称]对于[业务需求描述]的需求。通过利用Spring Boot简化企业级应用开发的优势&…

目录

一、前言

二、项目结构

三、初始化项目

四、SpringBoot项目集成Mybatis编写接口

五、代码仓库


一、前言

   构建一个基于Spring Boot框架的现代化Web应用程序,以满足[公司/组织名称]对于[业务需求描述]的需求。通过利用Spring Boot简化企业级应用开发的优势,实现一个高效、可扩展且易于维护的应用系统。

  • 提高效率:通过集成微服务架构模式,减少系统的复杂度,并加速开发周期。
  • 增强用户体验:提供一个响应迅速、界面友好且功能齐全的用户交互平台。
  • 确保数据安全:实施严格的数据保护措施,保障用户信息安全。
  • 支持跨平台访问:设计RESTful API接口,确保应用程序可以在多种设备上无缝运行。

二、项目结构

项目遵循Maven标准目录布局,主要分为以下几个模块:

  • core:包含业务逻辑层代码。

  • exception:包含各个异常捕捉类。

  • mapper:定义了数据访问对象,用于与数据库交互。

  • service:提供了对外的服务接口。

  • entity:项目实体类

  • controller:处理HTTP请求并调用相应的服务方法。

  • config:存放所有配置文件。

  • test:单元测试及集成测试代码。

  • common:公共类,统一包装。

三、初始化项目

点击新建项目

根据以下图片创建

选择框架依赖

设置文件编码统一为UTF-8

检查Maven构建项目的目录

以下pom.xml文件已经加载,如果没有出现xml文件则需右键点击构建Maven项目即可

application配置文件,因为框架中选择了数据库,使用需要配置数据库,mybatis依赖在后续集成时,可添加以下配置。

# 应用服务 WEB 访问端口
server:port: 9090
#数据库配置
spring:datasource:driver-class-name: com.mysql.cj.jdbc.Driverusername:  rootpassword: 123456//(本机数据库密码)url: jdbc:mysql://localhost:3306/userdb//(本机数据库)
//#mybatis依赖
//# mybatis:
//# MyBatis Configuration确保在 application.properties 或 application.yml 文件中指定了正确的映射文件路径// mapper-locations: classpath:mapper/*.xml// configuration://   log-impl: org.apache.ibatis.logging.stdout.StdOutImpl//   map-underscore-to-camel-case: true

到此项目配置成功! 

四、SpringBoot项目集成Mybatis编写接口

接下来我们将实现一个简单的用户列表获取接口,以下是具体的分层结构

Result类

package com.example.springboot.common;
//统一设置包装类,返回数据的类型
public class Result {private Integer code;  // 状态码private String message;  // 消息private Object data;  // 数据// 默认成功的构造方法// 成功但没有数据时的静态方法public static Result success() {Result result =new Result();result.setCode(200);result.setMessage("请求成功");return result;}public static Result success(Object data) {Result result =success();result.setData(data);return result;}// 静态方法用于快速构建结果对象public static Result error() {Result result =new Result();result.setCode(500);result.setMessage("请求成功");return result;}// Getters and Setterspublic Integer getCode() {return code;}public void setCode(Integer code) {this.code = code;}public String getMessage() {return message;}public void setMessage(String message) {this.message = message;}public Object getData() {return data;}public void setData(Object data) {this.data = data;}// 打印结果对象信息的方法(可选)@Overridepublic String toString() {return "Result{" +"code=" + code +", message='" + message + '\'' +", data=" + (data != null ? data.toString() : "null") +'}';}
}

UserController控制层提供访问接口localhost:9090/user/selectAll

package com.example.springboot.controller;import com.example.springboot.common.Result;
import com.example.springboot.service.UserService;
import com.example.springboot.entity.user;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;import java.util.List;@RestController
@RequestMapping("/user")
public class UserController {
@Resourceprivate UserService userservice;
//查询所有用户@GetMapping("/selectAll")public Result selectAll(){List<user>list=userservice.selectAll();return  Result.success(list);}
}

User类实体类,需要对应相应数据库

package com.example.springboot.entity;import org.apache.ibatis.annotations.Mapper;//entity包里面装着实体类
public class user {private  String userID;private  String userName;private  String userPassword;private  Integer userAge;public String getUserID() {return userID;}public void setUserID(String userID) {this.userID = userID;}public String getUserName() {return userName;}public void setUserName(String userName) {this.userName = userName;}public String getUserPassword() {return userPassword;}public void setUserPassword(String userPassword) {this.userPassword = userPassword;}public Integer getUserAge() {return userAge;}public void setUserAge(Integer userAge) {this.userAge = userAge;}}

UserMapper接口连接数据库操作,在对应的Mybastis映射文件下,上文中的application配置文件中的路径一致,添加UserMapper.xml文件

package com.example.springboot.mapper;import com.example.springboot.entity.user;import java.util.List;//数据库userBean层
public interface UserMapper {List<user> selectAll();
}

安装插件MyBatisX可快速查看映射方法

 userMapper.xml配置文件

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="com.example.springboot.mapper.UserMapper"><!-- SQL 映射语句将在此处定义 --><select id="selectAll" resultType="com.example.springboot.entity.user">SELECT * FROM user_list</select>
</mapper>

UserService类,提供项目业务逻辑层

package com.example.springboot.service;import com.example.springboot.mapper.UserMapper;
import com.example.springboot.entity.user;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;import java.util.List;//业务逻辑层
@Service
public class UserService {@Resourceprivate UserMapper userMapper;public List<user> selectAll() {List<user> list = userMapper.selectAll();return list;}
}

 在启动文件中添加扫描路径

@MapperScan("com.example.springboot.mapper")

 

点击运行即可!欢迎大家一起学习讨论,批评指正~

五、代码仓库

具体代码仓库

200K/SpringBooticon-default.png?t=O83Ahttps://gitee.com/tanzero/spring-boot.git

http://www.hkea.cn/news/980217/

相关文章:

  • 成都有实力的网站建设网络培训心得
  • 中企高呈建设网站在百度怎么创建自己的网站
  • 女的和女的做那个视频网站怎么在网上做网络营销
  • 网站开发需要什么软件百度怎样发布作品
  • 专门做宠物食品的网站市场调研怎么做
  • 兰州网站建设q.479185700棒成年s8视频加密线路
  • 付费网站推广seo关键词排名优化怎么收费
  • 网站由那些组成google网页搜索
  • 对一个网站做性能测试谷歌paypal官网入口
  • 北京住房投资建设中心网站首页快速排名怎么做
  • 中国网站制作 第一个佛山网站优化
  • thinkphp做的教育网站微商引流推广
  • 做特卖网站手机版电商最好卖的十大产品
  • 怎样做网站平叿trinseo公司
  • 北京大兴最专业的网站建设公司如何推广一个项目
  • 网页设计最牛的网站建设宁波网站优化公司哪家好
  • 建设通查询如何做网站推广及优化
  • 城乡建设网站首页百度seo收录软件
  • 永久免费建个人网站培训网站建设
  • 如何使用jq做弹幕网站好用的磁力搜索引擎
  • 南充营销型网站建设高端品牌网站建设
  • 制作小程序和网站的公司搜狗收录提交入口网址
  • 手机站电影基础建站如何提升和优化
  • 江苏 网站备案百度贴吧官网app下载
  • 网站制作三站湖南网站seo公司
  • 简单做任务赚钱网站企业管理培训课程报名
  • 零点研究咨询集团官方网站建设相似图片在线查找
  • 网站开发需要什么软件关键词app
  • 360全景网站建设做了5天游戏推广被抓了
  • 政府网站建设经验典型材料河源今日头条新闻最新