Skip to content

Commit

Permalink
add ysz information and database support
Browse files Browse the repository at this point in the history
  • Loading branch information
xijiaxiang committed May 26, 2018
1 parent 94dbd38 commit 123ac3f
Show file tree
Hide file tree
Showing 31 changed files with 1,072 additions and 426 deletions.
12 changes: 11 additions & 1 deletion .idea/artifacts/SZFC2_war_exploded.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

885 changes: 525 additions & 360 deletions .idea/workspace.xml

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion SZFC2.iml
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,23 @@
<orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" name="Maven: us.codecraft:webmagic-extension:0.7.0" level="project" />
<orderEntry type="library" name="Maven: redis.clients:jedis:2.9.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.4.2" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.32" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi:3.16" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
<orderEntry type="library" name="Maven: me.chyxion:table-to-xls:0.0.1-RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.squareup.okhttp3:okhttp:3.8.1" level="project" />
<orderEntry type="library" name="Maven: com.squareup.okio:okio:1.13.0" level="project" />
<orderEntry type="library" name="Maven: org.jsoup:jsoup:1.8.3" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.4.5" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:1.3.1" level="project" />
<orderEntry type="library" name="Maven: org.mybatis.generator:mybatis-generator-core:1.3.5" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-dbcp2:2.1.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.4.2" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.1.0" level="project" />
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.37" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:4.1.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:4.1.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.mchange:c3p0:0.9.5.2" level="project" />
<orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.11" level="project" />
</component>
</module>
61 changes: 61 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,67 @@
<artifactId>jsoup</artifactId>
<version>1.8.3</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.5</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis-spring -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.3.1</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.mybatis.generator/mybatis-generator-core -->
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-dbcp2 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.1.1</version>
</dependency>

<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.1.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.37</version>
<!-- <scope>runtime</scope>-->
</dependency>


<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.1.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>4.1.7.RELEASE</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.mchange/c3p0 -->
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.2</version>
</dependency>

</dependencies>
<build>
<finalName>SZFC2</finalName>
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/com/xixi/controller/HelloController.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**c测试
/**路径跳转
*
* Created by xijiaxiang on 2017/11/10.
*/
Expand Down Expand Up @@ -33,4 +33,8 @@ public String toStockCanSale(){
public String toModule(){
return "Module";
}
@RequestMapping("/ysz")
public String toYSZ(){
return "ysz";
}
}
43 changes: 43 additions & 0 deletions src/main/java/com/xixi/controller/YSZController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.xixi.controller;

import com.alibaba.fastjson.JSON;
import com.xixi.mapper.PreSaleDao;
import com.xixi.pojo.PreSaleInfo;
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.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**预售证的控制器
* Created by xijiaxiang on 2018/5/26.
*/
@Controller
public class YSZController {
@Autowired
private PreSaleDao preSaleDao;

@RequestMapping(value="/queryYSZ",produces="application/json;charset=utf-8")
@ResponseBody
public String getYSZ(HttpServletRequest request){
String pageNumber=request.getParameter("page");
String limitNumber=request.getParameter("limit");
int page=1;
int limit=30;
try {
page = Integer.parseInt(pageNumber);
limit = Integer.parseInt(limitNumber);
}catch (NumberFormatException e){
System.out.println("number format error ");
}

int count=preSaleDao.queryCount();

List<PreSaleInfo> preSaleInfoList=preSaleDao.queryAll((page-1)*limit,limit);

return "{\"code\":0,\"msg\":\"ok\",\"count\":"+count+",\"data\":"+ JSON.toJSONString(preSaleInfoList)+"}";
}

}
36 changes: 36 additions & 0 deletions src/main/java/com/xixi/mapper/PreSaleDao.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.xixi.mapper;

import com.xixi.pojo.PreSaleInfo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* Created by xijiaxiang on 2018/5/22.
*/
public interface PreSaleDao {
/**
* 通过ID查询
*
* @param id
* @return
*/
PreSaleInfo queryById(String id);

/**
* 查询所有
*
* @param offset 查询起始位置
* @param limit 查询条数
* @return
*/
List<PreSaleInfo> queryAll(@Param("offset") int offset, @Param("limit") int limit);

int insertOneYSZ(PreSaleInfo preSaleInfo);

/**
* 查询所有
* @return
*/
int queryCount();
}
39 changes: 39 additions & 0 deletions src/main/java/com/xixi/mapper/PreSaleDao.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?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.xixi.mapper.PreSaleDao">
<select id="queryById" resultType="PreSaleInfo" parameterType="String">
<![CDATA[
SELECT
yszNumber,
projectName,
projectAddress,
yszStartDate
FROM
ysz
WHERE
yszNumber = #{yszNumber}]]>
</select>

<select id="queryAll" resultType="PreSaleInfo">
<![CDATA[SELECT
yszNumber,
projectName,
projectAddress,
yszStartDate
FROM
ysz
ORDER BY
str_to_date(REPLACE(REPLACE(REPLACE(yszStartDate,'年','-'),'月','-'),'日',''),'%Y-%m-%d') desc
LIMIT #{offset}, #{limit}]]>
</select>

<insert id="insertOneYSZ" parameterType="PreSaleInfo">
INSERT INTO ysz VALUES (#{yszNumber},#{projectName},#{projectAddress},#{yszStartDate})
</insert>

<select id="queryCount" resultType="Integer">
<![CDATA[ select count(*) from ysz ]]>
</select>
</mapper>
12 changes: 12 additions & 0 deletions src/main/java/com/xixi/pojo/PreSaleInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,16 @@ public class PreSaleInfo {
public String yszNumber;
public String projectName;
public String projectAddress;

public String yszStartDate;

@Override
public String toString() {
return "PreSaleInfo{" +
"yszNumber='" + yszNumber + '\'' +
", projectName='" + projectName + '\'' +
", projectAddress='" + projectAddress + '\'' +
", yszStartDate='" + yszStartDate + '\'' +
'}';
}
}
Loading

0 comments on commit 123ac3f

Please sign in to comment.