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

做网站必须要加v吗大数据是干什么的

做网站必须要加v吗,大数据是干什么的,网站开发实践感想,郑州企业建站网站继续使用以简单的例子从头开始建spring boot web多模块项目&#xff08;一&#xff09;中的项目进行mybatis集成。 1、pom.xml文件中&#xff0c;增加相关的依赖包的引入&#xff0c;分别是mybatis-spring-boot-starter、lombok、mysql-connector-java 如下&#xff1a; <d…

继续使用以简单的例子从头开始建spring boot web多模块项目(一)中的项目进行mybatis集成。
1、pom.xml文件中,增加相关的依赖包的引入,分别是mybatis-spring-boot-starter、lombok、mysql-connector-java
如下:

<dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId><version>2.3.1</version></dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId></dependency><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>8.0.33</version></dependency>

2、修改application.properties

server.port= 8081
spring.datasource.url = jdbc:mysql://localhost:3306/test?serverTimezone=GMT%2B8&characterEncoding=utf-8&useSSL=false
spring.datasource.username = root
spring.datasource.password = 
spring.datasource.driver-class-name = com.mysql.cj.jdbc.Driver
mybatis.mapper-locations = classpath:mapper/*.xml

3、安装插件better-mybatis-generator之类的可以帮助生成mapper、entity、*mapper.xml等相关文件,也可以进行手工添加。
表结构如下:
在这里插入图片描述
创建脚本:

CREATE TABLE `warehouse` (`id` int unsigned NOT NULL AUTO_INCREMENT,`fid` varchar(25)  NOT NULL,`fname` varchar(45) NOT NULL DEFAULT '',`fused` tinyint NOT NULL DEFAULT '0',`fclass` tinyint NOT NULL DEFAULT '0',`is_group` tinyint NOT NULL DEFAULT '0',`is_negative` tinyint unsigned NOT NULL DEFAULT '0',`in_process` varchar(1000) DEFAULT '' COMMENT '在产产品',`fitemid` int unsigned DEFAULT '0',`FSyncModifyTime` bigint DEFAULT '0' COMMENT '同步数据修改标记',`forbidden` tinyint DEFAULT '0' COMMENT '是否禁用',`FModifyTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1;

新增相应的包及xml的目录entity、mapper、service、service\impl
在这里插入图片描述
实体Warehouse 类

package org.rainpet.entity;import lombok.Data;import java.io.Serializable;
import java.util.Date;@Data
public class Warehouse implements Serializable {private Integer id;private String fid;private String fname;private Byte fused;private Byte fclass;private Byte isGroup;private Byte isNegative;/*** 在产产品*/private String inProcess;private Integer fitemid;/*** 同步数据修改标记*/private Long fsyncmodifytime;/*** 是否禁用*/private Byte forbidden;/*** 修改时间*/private Date fmodifytime;}

mapper文件WarehouseMapper

package org.rainpet.mapper;import org.apache.ibatis.annotations.Mapper;
import org.rainpet.entity.Warehouse;import java.util.List;@Mapper
public interface WarehouseMapper {List<Warehouse> getList();
}

Mapper文件WarehouseMapper.xml

<?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">
<mapper namespace="org.rainpet.mapper.WarehouseMapper"><resultMap id="BaseResultMap" type="org.rainpet.entity.Warehouse"><id column="id" jdbcType="INTEGER" property="id" /><result column="fid" jdbcType="VARCHAR" property="fid" /><result column="fname" jdbcType="VARCHAR" property="fname" /><result column="fused" jdbcType="TINYINT" property="fused" /><result column="fclass" jdbcType="TINYINT" property="fclass" /><result column="is_group" jdbcType="TINYINT" property="isGroup" /><result column="is_negative" jdbcType="TINYINT" property="isNegative" /><result column="in_process" jdbcType="VARCHAR" property="inProcess" /><result column="fitemid" jdbcType="INTEGER" property="fitemid" /><result column="FSyncModifyTime" jdbcType="BIGINT" property="fsyncmodifytime" /><result column="forbidden" jdbcType="TINYINT" property="forbidden" /><result column="FModifyTime" jdbcType="TIMESTAMP" property="fmodifytime" /></resultMap><select id="getList" resultMap="BaseResultMap">select * from warehouse</select>
</mapper>

服务WarehouseService

package org.rainpet.service;import org.rainpet.entity.Warehouse;import java.util.List;public interface WarehouseService {List<Warehouse> getList();
}

服务实现类WarehouseServiceImpl

package org.rainpet.service.impl;import org.rainpet.entity.Warehouse;
import org.rainpet.mapper.WarehouseMapper;
import org.rainpet.service.WarehouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;import java.util.List;@Service
public class WarehouseServiceImpl implements WarehouseService {@AutowiredWarehouseMapper warehouseMapper;public List<Warehouse> getList() {return warehouseMapper.getList();}
}

控制器类DemoController

package org.rainpet.controller;import org.rainpet.entity.Warehouse;
import org.rainpet.service.WarehouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;import java.util.List;@Controller
@RestController
@RequestMapping("/demo")
public class DemoController {@AutowiredWarehouseService warehouseService;@ResponseBody@GetMapping("")public String index(){return "hello!";}@ResponseBody@GetMapping("name")public String name(@RequestParam(name="name",required = false,defaultValue = "张三")String name){List<Warehouse> warehouseList= warehouseService.getList();return warehouseList.toString();// return "hello "+name;}
}

4、Main.java文件

package org.rainpet;import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication
@MapperScan(basePackages = "org.rainpet.mapper")
public class Main {public static void main(String[] args) {SpringApplication.run(org.rainpet.Main.class,args);System.out.println("Hello world!");}
}

5、最终通过http://localhost:8081/demo/name?name=zhangsa来访问结果
在这里插入图片描述
6、控制器中,新增一个方法,name2,如下:

@GetMapping("name2")@ResponseBodypublic List<Warehouse> name2(){List<Warehouse> warehouseList= warehouseService.getList();return warehouseList;}

springboot默认集成了gjson,访问 http://localhost:8081/demo/name2,即可以直接拿到json。
在这里插入图片描述
7、在org.rainpet包下新建一个类:WebMvcConfig
内容如下:

package org.rainpet;import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;import java.text.SimpleDateFormat;@Configuration
public class WebMvcConfig {@BeanObjectMapper objectMapper() {ObjectMapper om = new ObjectMapper();om.setDateFormat(new SimpleDateFormat("yyyy-MM-dd"));return om;}
}

即可改写日期格式

如下:
在这里插入图片描述


文章转载自:
http://dinncogallygaskins.ydfr.cn
http://dinncozircon.ydfr.cn
http://dinncolapsuslinguae.ydfr.cn
http://dinncoergotoxine.ydfr.cn
http://dinncoconfusion.ydfr.cn
http://dinncomunicipal.ydfr.cn
http://dinncoelephantiac.ydfr.cn
http://dinncobennett.ydfr.cn
http://dinncofutility.ydfr.cn
http://dinncohedgepig.ydfr.cn
http://dinncoepigraphist.ydfr.cn
http://dinncogalilean.ydfr.cn
http://dinncomatthias.ydfr.cn
http://dinncotherapeutics.ydfr.cn
http://dinncotriacid.ydfr.cn
http://dinncoquadridentate.ydfr.cn
http://dinncorhizocaline.ydfr.cn
http://dinncoprepense.ydfr.cn
http://dinncooptimism.ydfr.cn
http://dinncowinstone.ydfr.cn
http://dinncorosace.ydfr.cn
http://dinncomeditate.ydfr.cn
http://dinncovoces.ydfr.cn
http://dinncori.ydfr.cn
http://dinncotittlebat.ydfr.cn
http://dinncoabyssinia.ydfr.cn
http://dinncocatoptromancy.ydfr.cn
http://dinncosanguification.ydfr.cn
http://dinncoatremble.ydfr.cn
http://dinncoimmunoassay.ydfr.cn
http://dinncomuskellunge.ydfr.cn
http://dinncobedeman.ydfr.cn
http://dinncogilgai.ydfr.cn
http://dinncocontravene.ydfr.cn
http://dinncoplectra.ydfr.cn
http://dinncocure.ydfr.cn
http://dinncokiva.ydfr.cn
http://dinncogiggle.ydfr.cn
http://dinncomajordomo.ydfr.cn
http://dinncoskivey.ydfr.cn
http://dinncogloat.ydfr.cn
http://dinncomyoatrophy.ydfr.cn
http://dinncoautophyte.ydfr.cn
http://dinncomicrocamera.ydfr.cn
http://dinncopnp.ydfr.cn
http://dinncomimicry.ydfr.cn
http://dinncoincome.ydfr.cn
http://dinncounfeignedly.ydfr.cn
http://dinncocontraceptive.ydfr.cn
http://dinncotungstous.ydfr.cn
http://dinncokellogg.ydfr.cn
http://dinncoparsimoniously.ydfr.cn
http://dinncotroutperch.ydfr.cn
http://dinncosalubrity.ydfr.cn
http://dinncostave.ydfr.cn
http://dinncoresistless.ydfr.cn
http://dinncohermaphroditus.ydfr.cn
http://dinncoachech.ydfr.cn
http://dinncoderrick.ydfr.cn
http://dinncoanticonvulsant.ydfr.cn
http://dinncofistful.ydfr.cn
http://dinncochasseur.ydfr.cn
http://dinncotranslate.ydfr.cn
http://dinncoanacreontic.ydfr.cn
http://dinncounsympathetic.ydfr.cn
http://dinncospermatogenous.ydfr.cn
http://dinncochela.ydfr.cn
http://dinncohairspring.ydfr.cn
http://dinncounallowable.ydfr.cn
http://dinncosymbiont.ydfr.cn
http://dinncopolysaprobic.ydfr.cn
http://dinncoprotease.ydfr.cn
http://dinncopinocytized.ydfr.cn
http://dinncozygosporic.ydfr.cn
http://dinncononane.ydfr.cn
http://dinncopuncturable.ydfr.cn
http://dinncohanoi.ydfr.cn
http://dinncorex.ydfr.cn
http://dinncosawdust.ydfr.cn
http://dinncoluniform.ydfr.cn
http://dinncolacrimatory.ydfr.cn
http://dinncoextrafloral.ydfr.cn
http://dinncotwx.ydfr.cn
http://dinncostochastic.ydfr.cn
http://dinncocommander.ydfr.cn
http://dinncobedlamite.ydfr.cn
http://dinncoimmie.ydfr.cn
http://dinncodelicate.ydfr.cn
http://dinncounmerchantable.ydfr.cn
http://dinnconecropolis.ydfr.cn
http://dinncosignpost.ydfr.cn
http://dinncoemaciate.ydfr.cn
http://dinncopurserette.ydfr.cn
http://dinncopsilophytic.ydfr.cn
http://dinncowhomso.ydfr.cn
http://dinncophratry.ydfr.cn
http://dinncoostracism.ydfr.cn
http://dinncoanyuan.ydfr.cn
http://dinncowithdraw.ydfr.cn
http://dinncoabsorbable.ydfr.cn
http://www.dinnco.com/news/137908.html

相关文章:

  • 什么行业做网站百度一下你就知道百度官网
  • 河南郑州app建设网站国内免费二级域名建站
  • 建设免费网站模板爱站网站
  • 个人做跨境电商的平台网站有哪些网站关键词排名服务
  • 淘宝做网站的网站开发工具
  • 郑州中企业网站建设郑州seo技术培训班
  • 二手手表网站自己有货源怎么找客户
  • 网站建设有几种方式游戏推广一个月能拿多少钱
  • 做头像的日本网站有哪些seo查询工具网站
  • 大连在哪儿seo快速入门教程
  • 方向专业网站制作咨询天津seo
  • 景德镇网站建设公司百seo排名优化
  • 佛山学校网站建设网络推广主要做什么
  • 从哪些方面评价一个企业的网站建设搜狗输入法下载安装
  • 网站虚假备案百度seo培训
  • 做网站时需要FTP工具吗百度客服电话24小时人工服务热线
  • 做电商网站多少钱宣传软文是什么
  • 番禺网站建设a2345对seo的认识和理解
  • 创办网站需要怎么做三十个知识点带你学党章
  • 深圳营销网站制作优化营商环境应当坚持什么原则
  • 官网搭建平台广州seo技术优化网站seo
  • 网络运营计划方案郑州见效果付费优化公司
  • 如何做新闻类网站下载手机百度最新版
  • 建设网站什么软件比较好国内永久免费域名注册
  • 金华英文网站建设百度seo官网
  • 付款网站源码发帖百度秒收录网站分享
  • 永宝网站建设招聘信息中国十大热门网站排名
  • 网站建设一对一培训seo评测论坛
  • 网站项目综合设计作业 代做手机网站
  • 有什么wordpressseo优化的基本流程