PushManageTaskInfo实体类
package cn.com.domain;
import java.io.Serializable;
public class PushManageTaskInfo implements Serializable
{
/**
* 注释内容
*/
private static final long serialVersionUID = 5945348321524885293L;
private String taskId;
private String pushType;
private int state;
private String product;
private int sendTotal;
private int arrivalTotal;
private int clickTotal;
private String platform;
public String getTaskId()
{
return taskId;
}
public void setTaskId(String taskId)
{
this.taskId = taskId;
}
public String getPushType()
{
return pushType;
}
public void setPushType(String pushType)
{
this.pushType = pushType;
}
public int getState()
{
return state;
}
public void setState(int state)
{
this.state = state;
}
public String getProduct()
{
return product;
}
public void setProduct(String product)
{
this.product = product;
}
public int getSendTotal()
{
return sendTotal;
}
public void setSendTotal(int sendTotal)
{
this.sendTotal = sendTotal;
}
public int getArrivalTotal()
{
return arrivalTotal;
}
public void setArrivalTotal(int arrivalTotal)
{
this.arrivalTotal = arrivalTotal;
}
public int getClickTotal()
{
return clickTotal;
}
public void setClickTotal(int clickTotal)
{
this.clickTotal = clickTotal;
}
public String getPlatform()
{
return platform;
}
public void setPlatform(String platform)
{
this.platform = platform;
}
}
请求参数类PushManageTaskRequest
package cn.com.vo;
public class PushManageTaskRequest
{
private Long page;
private Long pageSize;
private String taskId;
public String getTaskId()
{
return taskId;
}
public void setTaskId(String taskId)
{
this.taskId = taskId;
}
public Long getPage()
{
return page;
}
public void setPage(Long page)
{
this.page = page;
}
public Long getPageSize()
{
return pageSize;
}
public void setPageSize(Long pageSize)
{
this.pageSize = pageSize;
}
}
响应参数类PushManageTaskResponse
package cn.com.vo;
import java.util.List;
public class PushManageTaskResponse
{
/**
* 总条数
*/
private Long totalResults;
private List<PushManageTaskVo> pushManageResult;
public Long getTotalResults()
{
return totalResults;
}
public void setTotalResults(Long totalResults)
{
this.totalResults = totalResults;
}
public List<PushManageTaskVo> getPushManageResult()
{
return pushManageResult;
}
public void setPushManageResult(List<PushManageTaskVo> pushManageResult)
{
this.pushManageResult = pushManageResult;
}
}
响应参数返回参数类PushManageTaskVo
package cn.com.vo;
import java.io.Serializable;
public class PushManageTaskVo implements Serializable
{
/**
* 注释内容
*/
private static final long serialVersionUID = 7532416244563204769L;
private String taskId;
private String pushType;
private int state;
private String product;
private int sendTotal;
private int arrivalTotal;
private int clickTotal;
private String platform;
public String getTaskId()
{
return taskId;
}
public void setTaskId(String taskId)
{
this.taskId = taskId;
}
public String getPushType()
{
return pushType;
}
public void setPushType(String pushType)
{
this.pushType = pushType;
}
public int getState()
{
return state;
}
public void setState(int state)
{
this.state = state;
}
public String getProduct()
{
return product;
}
public void setProduct(String product)
{
this.product = product;
}
public int getSendTotal()
{
return sendTotal;
}
public void setSendTotal(int sendTotal)
{
this.sendTotal = sendTotal;
}
public int getArrivalTotal()
{
return arrivalTotal;
}
public void setArrivalTotal(int arrivalTotal)
{
this.arrivalTotal = arrivalTotal;
}
public int getClickTotal()
{
return clickTotal;
}
public void setClickTotal(int clickTotal)
{
this.clickTotal = clickTotal;
}
public String getPlatform()
{
return platform;
}
public void setPlatform(String platform)
{
this.platform = platform;
}
}
PushManageTaskDao类
package cn.com.dao;
import java.util.List;
import cn.com.domain.PushManageTaskInfo;
import cn.com.vo.PushManageTaskRequest;
public interface PushManageTaskDao
{
public List<PushManageTaskInfo> queryPushManageInfoList();
public List<PushManageTaskInfo> queryPushManageInfo(PushManageTaskRequest request);
}
IPushManageTaskService类
package cn.com.service;
import java.util.List;
import cn.com.domain.PushManageTaskInfo;
import cn.com.vo.PushManageTaskRequest;
import cn.com.vo.PushManageTaskResponse;
public interface IPushManageTaskService
{
public List<PushManageTaskInfo> queryPushManageInfoList();
public PushManageTaskResponse selectPushManageInfo(PushManageTaskRequest request);
}
PushManageTaskService实现类
package cn.com.service;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import cn.com.dao.PushManageTaskDao;
import cn.com.domain.PushManageTaskInfo;
import cn.com.vo.PushManageTaskRequest;
import cn.com.vo.PushManageTaskResponse;
import cn.com.vo.PushManageTaskVo;
@Service("pushManageTaskService")
public class PushManageTaskService implements IPushManageTaskService
{
@Autowired
private PushManageTaskDao pushManageTaskDao;
@Override
public List<PushManageTaskInfo> queryPushManageInfoList()
{
return pushManageTaskDao.queryPushManageInfoList();
}
@Override
public PushManageTaskResponse selectPushManageInfo(PushManageTaskRequest request)
{
PushManageTaskResponse response = new PushManageTaskResponse();
List<PushManageTaskVo> pushManageResult=new ArrayList<PushManageTaskVo>();
PageHelper.startPage(request.getPage().intValue(), request.getPageSize().intValue());
List<PushManageTaskInfo> retList=pushManageTaskDao.queryPushManageInfo(request);
PageInfo<PushManageTaskInfo> pageQuery=new PageInfo<PushManageTaskInfo>(retList);
for(PushManageTaskInfo pushInfo : retList)
{
PushManageTaskVo resVo = new PushManageTaskVo();
BeanUtils.copyProperties(pushInfo, resVo);
pushManageResult.add(resVo);
}
response.setPushManageResult(pushManageResult);
response.setTotalResults(pageQuery.getTotal());
return response;
}
}
PushManageController类
package cn.com.web;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import cn.com.domain.PushManageTaskInfo;
import cn.com.service.IPushManageTaskService;
import cn.com.vo.PushManageTaskRequest;
import cn.com.vo.PushManageTaskResponse;
@Controller
@RequestMapping(value = "/push")
public class PushManageController
{
@Autowired
private IPushManageTaskService pushManageTaskService;
/**
* 返回页面数据
* @return [参数说明]
* @return ModelAndView [返回类型说明]
* @exception throws [违例类型] [违例说明]
*/
@RequestMapping(value="/pushList",method={RequestMethod.POST,RequestMethod.GET})
public ModelAndView pushManageList(@RequestParam(required=true,defaultValue="1")Integer page)
{
PageHelper.startPage(page, 2);
List<PushManageTaskInfo> pushList = pushManageTaskService.queryPushManageInfoList();
PageInfo<PushManageTaskInfo> pageQuery=new PageInfo<PushManageTaskInfo>(pushList);
ModelAndView mview=new ModelAndView("pushList");
mview.addObject("page",pageQuery);
mview.addObject("pushList", pushList);
return mview;
}
/**
* 返回JSON数据格式
* @return [参数说明]
* @return PushManageTaskResponse [返回类型说明]
* @exception throws [违例类型] [违例说明]
*/
@RequestMapping(value = "/pushInfo", method = {RequestMethod.POST,RequestMethod.GET})
@ResponseBody
public PushManageTaskResponse pushManageInfo()
{
PushManageTaskRequest request=new PushManageTaskRequest();
request.setPage(1L);
request.setPageSize(20L);
PushManageTaskResponse response=pushManageTaskService.selectPushManageInfo(request);
String resJson=JSONObject.toJSONString(response);
System.out.println("=====resJson:"+resJson);
return response;
}
}
pushManageTaskMapper.xml文件
[size=medium<?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="cn.com.dao.PushManageTaskDao">
<resultMap id="pushListResultMap" type="cn.com.domain.PushManageTaskInfo">
<result column="task_id" property="taskId" jdbcType="VARCHAR" />
<result column="push_type" property="pushType" jdbcType="VARCHAR" />
<result column="state" property="state" jdbcType="VARCHAR" />
<result column="product" property="product" jdbcType="VARCHAR" />
<result column="send_total" property="sendTotal" jdbcType="INTEGER" />
<result column="arrival_total" property="arrivalTotal" jdbcType="INTEGER" />
<result column="click_total" property="clickTotal" jdbcType="INTEGER" />
<result column="platform" property="platform" jdbcType="VARCHAR" />
</resultMap>
<select id="queryPushManageInfoList" resultMap="pushListResultMap">
SELECT task_id,
push_type,
state,
product,
send_total,
arrival_total,
click_total,
platform
FROM wifi_push_manage_task
</select>
<select id="queryPushManageInfo" resultMap="pushListResultMap" parameterType="cn.com.vo.PushManageTaskRequest">
SELECT task_id,
push_type,
state,
product,
send_total,
arrival_total,
click_total,
platform
FROM wifi_push_manage_task AS pushtask
</select>
</mapper>[/size]
application.properties属性文件
#指定访问页面路径
spring.mvc.view.prefix=/WEB-INF/view/
spring.mvc.view.suffix=.jsp
###切换环境###
##spring.profiles.active=dev
spring.datasource.url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=libingbing
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
mybatis.mapperLocations=classpath:mapper/*.xml
######设置服务启动端口号#######
server.port=8010
pom文件
[size=medium<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.com.demo.springboot</groupId>
<artifactId>springboot-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.10.RELEASE</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>6.0.6</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<version>8.5.27</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.6</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.2</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.47</version>
</dependency>
</dependencies>
<build>
<finalName>springboot-demo</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
</project> [/size]
springboot启动类ApplicationTest
package cn.com;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
@SpringBootApplication
//扫描Mapper的Dao层
@MapperScan(basePackages={"cn.com.dao"})
public class ApplicationTest extends SpringBootServletInitializer
{
public static void main(String[] args)
{
SpringApplication.run(ApplicationTest.class, args);
System.out.println("======ApplicationTest start success======");
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(this.getClass());
}
}
JSP页面
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!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>pushList</title>
</head>
<body>
<table border="1" cellpadding="0" cellspacing="0">
<tr height="30">
<td>任务ID</td>
<td>推送类型</td>
<td>推送状态</td>
<td>产品类型</td>
<td>发送总量</td>
<td>到达总量</td>
<td>点击总量</td>
<td>推送平台</td>
</tr>
<c:forEach items="${pushList}" var="push">
<tr height="30">
<td>${push.taskId}</td>
<td>${push.pushType}</td>
<td>${push.state}</td>
<td>${push.product}</td>
<td>${push.sendTotal}</td>
<td>${push.arrivalTotal}</td>
<td>${push.clickTotal}</td>
<td>${push.platform}</td>
</tr>
</c:forEach>
</table>
<p>一共${page.pages}页</p>
<a href="pushList?page=${page.firstPage}">第一页</a>
<a href="pushList?page=${page.nextPage}">下一页</a>
<a href="pushList?page=${page.prePage}">上一页</a>
<a href="pushList?page=${page.lastPage}">最后页</a>
</body>
</html>
项目结构目录截图
最后浏览器打开地址 http://localhost:8010/push/pushList ,就可以访问了
package cn.com.domain;
import java.io.Serializable;
public class PushManageTaskInfo implements Serializable
{
/**
* 注释内容
*/
private static final long serialVersionUID = 5945348321524885293L;
private String taskId;
private String pushType;
private int state;
private String product;
private int sendTotal;
private int arrivalTotal;
private int clickTotal;
private String platform;
public String getTaskId()
{
return taskId;
}
public void setTaskId(String taskId)
{
this.taskId = taskId;
}
public String getPushType()
{
return pushType;
}
public void setPushType(String pushType)
{
this.pushType = pushType;
}
public int getState()
{
return state;
}
public void setState(int state)
{
this.state = state;
}
public String getProduct()
{
return product;
}
public void setProduct(String product)
{
this.product = product;
}
public int getSendTotal()
{
return sendTotal;
}
public void setSendTotal(int sendTotal)
{
this.sendTotal = sendTotal;
}
public int getArrivalTotal()
{
return arrivalTotal;
}
public void setArrivalTotal(int arrivalTotal)
{
this.arrivalTotal = arrivalTotal;
}
public int getClickTotal()
{
return clickTotal;
}
public void setClickTotal(int clickTotal)
{
this.clickTotal = clickTotal;
}
public String getPlatform()
{
return platform;
}
public void setPlatform(String platform)
{
this.platform = platform;
}
}
请求参数类PushManageTaskRequest
package cn.com.vo;
public class PushManageTaskRequest
{
private Long page;
private Long pageSize;
private String taskId;
public String getTaskId()
{
return taskId;
}
public void setTaskId(String taskId)
{
this.taskId = taskId;
}
public Long getPage()
{
return page;
}
public void setPage(Long page)
{
this.page = page;
}
public Long getPageSize()
{
return pageSize;
}
public void setPageSize(Long pageSize)
{
this.pageSize = pageSize;
}
}
响应参数类PushManageTaskResponse
package cn.com.vo;
import java.util.List;
public class PushManageTaskResponse
{
/**
* 总条数
*/
private Long totalResults;
private List<PushManageTaskVo> pushManageResult;
public Long getTotalResults()
{
return totalResults;
}
public void setTotalResults(Long totalResults)
{
this.totalResults = totalResults;
}
public List<PushManageTaskVo> getPushManageResult()
{
return pushManageResult;
}
public void setPushManageResult(List<PushManageTaskVo> pushManageResult)
{
this.pushManageResult = pushManageResult;
}
}
响应参数返回参数类PushManageTaskVo
package cn.com.vo;
import java.io.Serializable;
public class PushManageTaskVo implements Serializable
{
/**
* 注释内容
*/
private static final long serialVersionUID = 7532416244563204769L;
private String taskId;
private String pushType;
private int state;
private String product;
private int sendTotal;
private int arrivalTotal;
private int clickTotal;
private String platform;
public String getTaskId()
{
return taskId;
}
public void setTaskId(String taskId)
{
this.taskId = taskId;
}
public String getPushType()
{
return pushType;
}
public void setPushType(String pushType)
{
this.pushType = pushType;
}
public int getState()
{
return state;
}
public void setState(int state)
{
this.state = state;
}
public String getProduct()
{
return product;
}
public void setProduct(String product)
{
this.product = product;
}
public int getSendTotal()
{
return sendTotal;
}
public void setSendTotal(int sendTotal)
{
this.sendTotal = sendTotal;
}
public int getArrivalTotal()
{
return arrivalTotal;
}
public void setArrivalTotal(int arrivalTotal)
{
this.arrivalTotal = arrivalTotal;
}
public int getClickTotal()
{
return clickTotal;
}
public void setClickTotal(int clickTotal)
{
this.clickTotal = clickTotal;
}
public String getPlatform()
{
return platform;
}
public void setPlatform(String platform)
{
this.platform = platform;
}
}
PushManageTaskDao类
package cn.com.dao;
import java.util.List;
import cn.com.domain.PushManageTaskInfo;
import cn.com.vo.PushManageTaskRequest;
public interface PushManageTaskDao
{
public List<PushManageTaskInfo> queryPushManageInfoList();
public List<PushManageTaskInfo> queryPushManageInfo(PushManageTaskRequest request);
}
IPushManageTaskService类
package cn.com.service;
import java.util.List;
import cn.com.domain.PushManageTaskInfo;
import cn.com.vo.PushManageTaskRequest;
import cn.com.vo.PushManageTaskResponse;
public interface IPushManageTaskService
{
public List<PushManageTaskInfo> queryPushManageInfoList();
public PushManageTaskResponse selectPushManageInfo(PushManageTaskRequest request);
}
PushManageTaskService实现类
package cn.com.service;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import cn.com.dao.PushManageTaskDao;
import cn.com.domain.PushManageTaskInfo;
import cn.com.vo.PushManageTaskRequest;
import cn.com.vo.PushManageTaskResponse;
import cn.com.vo.PushManageTaskVo;
@Service("pushManageTaskService")
public class PushManageTaskService implements IPushManageTaskService
{
@Autowired
private PushManageTaskDao pushManageTaskDao;
@Override
public List<PushManageTaskInfo> queryPushManageInfoList()
{
return pushManageTaskDao.queryPushManageInfoList();
}
@Override
public PushManageTaskResponse selectPushManageInfo(PushManageTaskRequest request)
{
PushManageTaskResponse response = new PushManageTaskResponse();
List<PushManageTaskVo> pushManageResult=new ArrayList<PushManageTaskVo>();
PageHelper.startPage(request.getPage().intValue(), request.getPageSize().intValue());
List<PushManageTaskInfo> retList=pushManageTaskDao.queryPushManageInfo(request);
PageInfo<PushManageTaskInfo> pageQuery=new PageInfo<PushManageTaskInfo>(retList);
for(PushManageTaskInfo pushInfo : retList)
{
PushManageTaskVo resVo = new PushManageTaskVo();
BeanUtils.copyProperties(pushInfo, resVo);
pushManageResult.add(resVo);
}
response.setPushManageResult(pushManageResult);
response.setTotalResults(pageQuery.getTotal());
return response;
}
}
PushManageController类
package cn.com.web;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import cn.com.domain.PushManageTaskInfo;
import cn.com.service.IPushManageTaskService;
import cn.com.vo.PushManageTaskRequest;
import cn.com.vo.PushManageTaskResponse;
@Controller
@RequestMapping(value = "/push")
public class PushManageController
{
@Autowired
private IPushManageTaskService pushManageTaskService;
/**
* 返回页面数据
* @return [参数说明]
* @return ModelAndView [返回类型说明]
* @exception throws [违例类型] [违例说明]
*/
@RequestMapping(value="/pushList",method={RequestMethod.POST,RequestMethod.GET})
public ModelAndView pushManageList(@RequestParam(required=true,defaultValue="1")Integer page)
{
PageHelper.startPage(page, 2);
List<PushManageTaskInfo> pushList = pushManageTaskService.queryPushManageInfoList();
PageInfo<PushManageTaskInfo> pageQuery=new PageInfo<PushManageTaskInfo>(pushList);
ModelAndView mview=new ModelAndView("pushList");
mview.addObject("page",pageQuery);
mview.addObject("pushList", pushList);
return mview;
}
/**
* 返回JSON数据格式
* @return [参数说明]
* @return PushManageTaskResponse [返回类型说明]
* @exception throws [违例类型] [违例说明]
*/
@RequestMapping(value = "/pushInfo", method = {RequestMethod.POST,RequestMethod.GET})
@ResponseBody
public PushManageTaskResponse pushManageInfo()
{
PushManageTaskRequest request=new PushManageTaskRequest();
request.setPage(1L);
request.setPageSize(20L);
PushManageTaskResponse response=pushManageTaskService.selectPushManageInfo(request);
String resJson=JSONObject.toJSONString(response);
System.out.println("=====resJson:"+resJson);
return response;
}
}
pushManageTaskMapper.xml文件
[size=medium<?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="cn.com.dao.PushManageTaskDao">
<resultMap id="pushListResultMap" type="cn.com.domain.PushManageTaskInfo">
<result column="task_id" property="taskId" jdbcType="VARCHAR" />
<result column="push_type" property="pushType" jdbcType="VARCHAR" />
<result column="state" property="state" jdbcType="VARCHAR" />
<result column="product" property="product" jdbcType="VARCHAR" />
<result column="send_total" property="sendTotal" jdbcType="INTEGER" />
<result column="arrival_total" property="arrivalTotal" jdbcType="INTEGER" />
<result column="click_total" property="clickTotal" jdbcType="INTEGER" />
<result column="platform" property="platform" jdbcType="VARCHAR" />
</resultMap>
<select id="queryPushManageInfoList" resultMap="pushListResultMap">
SELECT task_id,
push_type,
state,
product,
send_total,
arrival_total,
click_total,
platform
FROM wifi_push_manage_task
</select>
<select id="queryPushManageInfo" resultMap="pushListResultMap" parameterType="cn.com.vo.PushManageTaskRequest">
SELECT task_id,
push_type,
state,
product,
send_total,
arrival_total,
click_total,
platform
FROM wifi_push_manage_task AS pushtask
</select>
</mapper>[/size]
application.properties属性文件
#指定访问页面路径
spring.mvc.view.prefix=/WEB-INF/view/
spring.mvc.view.suffix=.jsp
###切换环境###
##spring.profiles.active=dev
spring.datasource.url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=libingbing
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
mybatis.mapperLocations=classpath:mapper/*.xml
######设置服务启动端口号#######
server.port=8010
pom文件
[size=medium<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.com.demo.springboot</groupId>
<artifactId>springboot-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.10.RELEASE</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>6.0.6</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<version>8.5.27</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.6</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.1.2</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.47</version>
</dependency>
</dependencies>
<build>
<finalName>springboot-demo</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
</project> [/size]
springboot启动类ApplicationTest
package cn.com;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
@SpringBootApplication
//扫描Mapper的Dao层
@MapperScan(basePackages={"cn.com.dao"})
public class ApplicationTest extends SpringBootServletInitializer
{
public static void main(String[] args)
{
SpringApplication.run(ApplicationTest.class, args);
System.out.println("======ApplicationTest start success======");
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(this.getClass());
}
}
JSP页面
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!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>pushList</title>
</head>
<body>
<table border="1" cellpadding="0" cellspacing="0">
<tr height="30">
<td>任务ID</td>
<td>推送类型</td>
<td>推送状态</td>
<td>产品类型</td>
<td>发送总量</td>
<td>到达总量</td>
<td>点击总量</td>
<td>推送平台</td>
</tr>
<c:forEach items="${pushList}" var="push">
<tr height="30">
<td>${push.taskId}</td>
<td>${push.pushType}</td>
<td>${push.state}</td>
<td>${push.product}</td>
<td>${push.sendTotal}</td>
<td>${push.arrivalTotal}</td>
<td>${push.clickTotal}</td>
<td>${push.platform}</td>
</tr>
</c:forEach>
</table>
<p>一共${page.pages}页</p>
<a href="pushList?page=${page.firstPage}">第一页</a>
<a href="pushList?page=${page.nextPage}">下一页</a>
<a href="pushList?page=${page.prePage}">上一页</a>
<a href="pushList?page=${page.lastPage}">最后页</a>
</body>
</html>
项目结构目录截图
最后浏览器打开地址 http://localhost:8010/push/pushList ,就可以访问了
发表评论
-
springboot assembly打ZIP包
2018-12-01 16:10 9051、修改pom文件 <plugin> &l ... -
springboot添加PageHelper分页查询插件
2018-07-26 17:38 1425springboot添加PageHelper分页查询插件 1 ... -
springboot微服务打WAR包部署
2018-07-03 13:45 11691、修改项目的POM文件 修改项目的打包形式为 WAR包 去 ... -
springboot微服务打包JAR包部署
2018-06-29 15:52 2780Springboot微服务打包JAR操作如下: Main方法 ... -
springboot+dubbo+zookeeper+mybatis
2018-02-08 15:27 557注:实体类和JSP页面省略 服务提供方相关代码如下: sp ...
相关推荐
1,mybatis-plus可以看成是mybatis的一种升华,即保留了完整的mybatis的功能,又有新的提高,可以简化编码,将...3,本资源中是源码,完整的演示了springboot集成mybatis-plus 的全过程,简单易懂易上手,强烈推荐。
SpringBoot 集成 MyBatis-Plus 实现国产数据库适配 MyBatis-Plus 是一款在 MyBatis 的基础上进行扩展的开源工具包,只做增强不做改变,引入 MyBatis-Plus 不会对您现有的 Mybatis 构架产生任何影响。MyBatis-Plus ...
SpringBoot 集成 Mybatis-Plus 代码生成工具 SpringBoot 是一个基于 Java 的框架,它提供了快速构建生产级别的应用程序的能力。Mybatis-Plus 是一个基于 Mybatis 框架的增强工具,它提供了代码生成、分页、查询等...
编译器版本:IntelliJ IDEA 2020.3.2 x64 JDK版本:java 1.8.0_111 SpringBoot集成MyBatis-Plus快速入门Demo,包括CRUD操作、多条件查询、性能分析等代码实现。
**SpringBoot集成MyBatis** 1. **添加依赖**:首先,在`pom.xml`文件中引入SpringBoot的`spring-boot-starter-web`和`mybatis-spring-boot-starter`依赖,确保项目能够支持Web开发和MyBatis的自动配置。 2. **配置...
在本文中,我们将深入探讨如何将MyBatis与SpringBoot框架进行集成,特别是采用XML配置的方式。SpringBoot因其简化配置和快速开发的能力而备受青睐,而MyBatis作为一款轻量级的持久层框架,提供了灵活的SQL映射功能。...
本文将深入探讨如何在 Spring Boot 项目中集成 MyBatis,以便充分利用这两个框架的优势。 首先,我们需要在项目的 `pom.xml` 文件中添加 Spring Boot 和 MyBatis 的依赖。Spring Boot 的父依赖可以提供许多默认配置...
当我们谈论"springboot集成Mybatis和quartz"时,意味着我们要将这三个组件结合在一起,创建一个具有数据库操作和定时任务功能的项目。下面我们将详细讨论如何实现这个集成。 首先,集成Spring Boot和MyBatis。...
集成Spring Boot和MyBatis的步骤如下: 1. **添加依赖**:在`pom.xml`文件中,我们需要引入Spring Boot的Web起步依赖和MyBatis的起步依赖。这样,Spring Boot会自动配置所需的依赖项。 ```xml <groupId>org....
springboot+mybatis+mybatisplus+swagger redis框架整合springboot+mybatis+mybatisplus+swagger redis框架整合springboot+mybatis+mybatisplus+swagger redis框架整合springboot+mybatis+mybatisplus+swagger redis...
springboot集成mybatis简单demo实例,实现excel表格与mysql数据库的数据交互(test测试实现),springboot+mybatis项目的简单操作(注解+mybatisxml文件配置)
在本项目中,"springboot集成mybatis_redis和Junit.zip" 提供了一个基于Spring Boot的集成开发案例,其中包含了Spring Boot与MyBatis、Redis和JUnit的整合。以下是关于这些技术及其集成的关键知识点的详细解释: 1....
SpringBoot集成MyBatis-Plus是一个常见的开发场景,它极大地简化了数据库操作并提升了开发效率。MyBatis-Plus(简称MP)是一个MyBatis的扩展插件,它在MyBatis的基础上做了很多自动化的工作,比如自动填充CRUD操作、...
在SpringBoot集成MyBatis的过程中,我们需要做以下几步: 1. 添加依赖:在pom.xml文件中,引入Spring Boot的starter-web、starter-data-jpa以及MyBatis的相关依赖。 2. 配置MyBatis:创建mybatis-config.xml文件,...
springboot与mybatis集成,注解版与配置版,下载可运行。集成过程可参考博客https://blog.csdn.net/m0_37984249/article/details/80923212
项目描述 在上家公司自己集成的一套系统,用了两个多月的时间完成的:Springboot+Mybatis-plus+ SpringMvc+Shiro+Redis企业级开发系统 Springboot作为容器,使用mybatis作为持久层框架 使用官方推荐的thymeleaf做为...
3. **SpringBoot集成MyBatis** 集成MyBatis到SpringBoot项目中,首先需要在`pom.xml`中添加MyBatis和相关依赖,例如`mybatis-spring-boot-starter`。然后配置`mybatis-config.xml`,定义数据源、事务管理器等,或者...
接下来,为了集成MyBatis,我们需要在`pom.xml`中添加MyBatis和其Spring Boot starter的依赖。同时,也要添加MySQL驱动的依赖,以便连接到MySQL数据库。例如: ```xml <groupId>org.mybatis.spring.boot ...
在本项目"springboot集成mybatis的demo"中,我们将探讨如何将流行的Java框架Spring Boot与数据持久化库MyBatis结合使用。Spring Boot以其简洁的配置和开箱即用的功能,大大简化了Spring应用程序的开发流程,而...
本人的搭载软件为eclipse的spring-tool-suite-3.9.5版本(官网上直接能下到),数据库为mysql,导入程序直接可以运行,增删改查每个模块都很详细,适合刚进入公司的新人或者毕业生进行简单业务处理,有很强的参考...