Commit 94e2fcbe by 王家辉

first commit

parents
/target/
!.mvn/wrapper/maven-wrapper.jar
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
/build/
<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.freemud</groupId>
<artifactId>smalltools</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>smalltools</name>
<description>smalltools for quanjia</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
<!--集成logstash-->
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>4.8</version>
</dependency>
<!--集成druid连接池-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.10</version>
</dependency>
<!--lombok依赖-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<!-- 热部署 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<!-- lombok 快速框架-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.0</version>
</dependency>
<!-- Swagger2 ui-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<!-- mysql驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.13</version>
</dependency>
<!-- alibaba druid数据源 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.5</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.1.41</version>
</dependency>
<!--分页插件 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.yml</include>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.yml</include>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: OrdersController
* @Package com.freemud.Controller
* @Description: 简单描述下这个类是做什么用的
* @author: jiahui.wang
* @date: 2019/1/26 9:59
* @version V1.0
* @Copyright: 2019 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目的
*/
package com.freemud.Controller;
import com.alibaba.fastjson.JSON;
import com.freemud.Service.OrdersService;
import com.freemud.dto.OrderProductDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Controller
public class OrdersController {
@Autowired
private OrdersService ordersService;
@RequestMapping("index")
public String index(){
return "index";
}
@PostMapping("/getOrder/{orderId}")
@ResponseBody
public String getOrder(@PathVariable("orderId") String orderId){
List<OrderProductDTO> list = ordersService.getOrderProductDTOByOrderId(orderId);
return JSON.toJSONString(list);
}
}
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: OrderProductMapper
* @Package com.freemud.Mapper
* @Description: 简单描述下这个类是做什么用的
* @author: jiahui.wang
* @date: 2019/1/26 10:19
* @version V1.0
* @Copyright: 2019 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目的
*/
package com.freemud.Mapper;
import com.freemud.dto.OrderProductDTO;
import java.util.List;
public interface OrderProductMapper {
List<OrderProductDTO> getOrderProductDTOByOrderId(String orderId);
}
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: OrdersService
* @Package com.freemud.Service.Impl
* @Description: 简单描述下这个类是做什么用的
* @author: jiahui.wang
* @date: 2019/1/26 9:50
* @version V1.0
* @Copyright: 2019 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目的
*/
package com.freemud.Service.Impl;
import com.freemud.Mapper.OrderProductMapper;
import com.freemud.Service.OrdersService;
import com.freemud.dto.OrderProductDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class OrdersServiceImpl implements OrdersService {
@Autowired
private OrderProductMapper orderProductMapper;
@Override
public List<OrderProductDTO> getOrderProductDTOByOrderId(String orderId) {
return orderProductMapper.getOrderProductDTOByOrderId(orderId);
}
}
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: OrdersService
* @Package com.freemud.Service
* @Description: 简单描述下这个类是做什么用的
* @author: jiahui.wang
* @date: 2019/1/26 9:50
* @version V1.0
* @Copyright: 2019 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目的
*/
package com.freemud.Service;
import com.freemud.dto.OrderProductDTO;
import java.util.List;
public interface OrdersService {
/**
* 根据订单号去查询订单的商品信息
* @param orderId
* @return
*/
List<OrderProductDTO> getOrderProductDTOByOrderId(String orderId);
}
package com.freemud;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@MapperScan(basePackages = "com.freemud.Mapper")
public class SmalltoolsApplication {
public static void main(String[] args) {
SpringApplication.run(SmalltoolsApplication.class, args);
}
}
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: orderProductDTO
* @Package com.freemud.dto
* @Description: 简单描述下这个类是做什么用的
* @author: jiahui.wang
* @date: 2019/1/26 10:25
* @version V1.0
* @Copyright: 2019 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目的
*/
package com.freemud.dto;
import lombok.Data;
@Data
public class OrderProductDTO {
// 商品编号
private Long id;
// 订单主键
private String orderId;
// 订单号
private String orderCode;
// 商品名称
private String name;
// 商品 sku
private String sku;
}
<?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="com.freemud.Mapper.OrderProductMapper">
<resultMap id="OrderProductDTO" type="com.freemud.dto.OrderProductDTO">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="order_id" property="orderId" jdbcType="BIGINT" />
<result column="order_code" property="orderCode" jdbcType="VARCHAR"/>
<result column="name" property="name" jdbcType="VARCHAR"/>
<result column="sku" property="sku" jdbcType="VARCHAR" />
</resultMap>
<select id="getOrderProductDTOByOrderId" resultMap="OrderProductDTO">
select
op.id,
op.order_id,
o.order_id as order_code,
op.name,
op.sku
from orders o
left join order_product op on o.id = op.order_id
where o.order_id = #{orderId}
</select>
</mapper>
\ No newline at end of file
server.port=9999
spring.datasource.druid.url=jdbc:mysql://118.89.106.32:6630/fm_mg_order?useUnicode=true&characterEncoding=utf8
spring.datasource.druid.driver-class=com.mysql.jdbc.Driver
spring.datasource.druid.username=allfamily
spring.datasource.druid.password=4VWJ1hKDb.zi0gJb
spring.datasource.druid.initial-size=1
spring.datasource.druid.min-idle=1
spring.datasource.druid.max-active=100
spring.datasource.druid.maxWait=60000
spring.datasource.druid.timeBetweenEvictionRunsMillis=60000
spring.datasource.druid.minEvictableIdleTimeMillis=300000
spring.datasource.druid.validationQuery=SELECT 'x'
spring.datasource.druid.testWhileIdle=true
spring.datasource.druid.testOnReturn=false
spring.datasource.druid.testOnBorrow=true
mybatis.mapper-locations=classpath:mapper/*.xml
spring.profiles.active=dev
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.cache=false
spring.resources.chain.strategy.content.enabled=true
spring.resources.chain.strategy.content.paths=/**
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- %m输出的信息,%p日志级别,%t线程名,%d日期,%c类的全名,,,, -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<charset>UTF-8</charset>
<pattern>%d %p (%file:%line\)- %m%n</pattern>
</encoder>
</appender>
<appender name="FREEMUD_API" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/data/log/familymart/takeoutjob/takeout-job.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>/data/log/familymart/takeoutjob/takeout-job-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxFileSize>20MB</maxFileSize>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{5} - %msg%n</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="STDOUT"/>
<appender-ref ref="FREEMUD_API"/>
</root>
</configuration>
\ No newline at end of file
function getOrder() {
var orderId = document.getElementById(orderid);
$ajax.
}
\ No newline at end of file
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" >
<head>
<title>Getting Started: Serving Web Content</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script th:src="@{js/jquery-3.3.1.min.js}"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#btn2").click(function () {
var orderId = $("#orderid").val();
$.ajax({
type: "POST",
dataType: "json",
url: "/getOrder/" + orderId,
success: function (result) {
console.log(result);//打印服务端返回的数据(调试用)
},
error : function() {
alert("异常!");
}
})
})
})
</script>
</head>
<body>
<div class="div1" style="text-align:center">
<span class="center" align="center">订单sku修复补推小工具</span>
<br />
<br />
<label>订单号:</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" id="orderid" />
<br />
<button id="btn2">查询</button>
<br />
<br />
<textarea id="txta1" style="width:1120px;height:250px;"></textarea>
</div>
</body>
</html>
\ No newline at end of file
package com.freemud.smalltools;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class SmalltoolsApplicationTests {
@Test
public void contextLoads() {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment