-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
992 changed files
with
207,018 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Manifest-Version: 1.0 | ||
Built-By: xp | ||
Created-By: IntelliJ IDEA | ||
Build-Jdk: 1.8.0_45 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Manifest-Version: 1.0 | ||
Built-By: xp | ||
Created-By: IntelliJ IDEA | ||
Build-Jdk: 1.8.0_45 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
DROP DATABASE IF EXISTS db_blog; | ||
/*创建数据库,并设置编码*/ | ||
CREATE DATABASE db_blog DEFAULT CHARACTER SET utf8; | ||
|
||
USE db_blog; | ||
|
||
CREATE TABLE `t_blogger` ( | ||
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '博主id', | ||
`username` VARCHAR(50) NOT NULL COMMENT '博主姓名', | ||
`password` VARCHAR(100) NOT NULL COMMENT '博主密码', | ||
`profile` TEXT COMMENT '博主信息', | ||
`nickname` VARCHAR(50) DEFAULT NULL COMMENT '博主昵称', | ||
`sign` VARCHAR(100) DEFAULT NULL COMMENT '博主签名', | ||
`imagename` VARCHAR(100) DEFAULT NULL COMMENT '博主头像路径', | ||
PRIMARY KEY (`id`) | ||
) ENGINE=INNODB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; | ||
|
||
|
||
CREATE TABLE `t_blogtype` ( | ||
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '博客id', | ||
`typeName` VARCHAR(30) DEFAULT NULL COMMENT '博客类别', | ||
`orderNum` INT(11) DEFAULT NULL COMMENT '博客排序', | ||
PRIMARY KEY (`id`) | ||
) ENGINE=INNODB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
log4j.rootLogger=DEBUG, Console | ||
|
||
#Console | ||
log4j.appender.Console=org.apache.log4j.ConsoleAppender | ||
log4j.appender.Console.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n | ||
|
||
log4j.logger.java.sql.ResultSet=INFO | ||
log4j.logger.org.apache=INFO | ||
log4j.logger.java.sql.Connection=DEBUG | ||
log4j.logger.java.sql.Statement=DEBUG | ||
log4j.logger.java.sql.PreparedStatement=DEBUG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?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="ssm.blog.dao.BlogDao"> | ||
|
||
<resultMap type="Blog" id="BlogResult"> | ||
<id property="id" column="id"/> | ||
<result property="title" column="title"/> | ||
<result property="summary" column="summary"/> | ||
<result property="releaseDate" column="releaseDate"/> | ||
<result property="clickHit" column="clickHit"/> | ||
<result property="replyHit" column="replyHit"/> | ||
<result property="content" column="content"/> | ||
<result property="keyWord" column="keyWord"/> | ||
|
||
<association property="blogType" column="type_id" select="ssm.blog.dao.BlogTypeDao.getById"> | ||
</association> | ||
</resultMap> | ||
|
||
|
||
|
||
<select id="listBlog" parameterType="Map" resultMap="BlogResult"> | ||
SELECT * FROM t_blog | ||
<where> | ||
<if test="title!=null and title!=''"> | ||
and title like "%"#{title}"%" | ||
</if> | ||
</where> | ||
ORDER BY releaseDate DESC | ||
<if test="start!=null and pageSize!=null"> | ||
limit #{start},#{end} | ||
</if> | ||
</select> | ||
|
||
<select id="getTotal" resultType="Long"> | ||
SELECT COUNT(*) FROM t_blog | ||
<where> | ||
<if test="_parameter!=null and _parameter!=''"> | ||
and title like "%"#{_parameter}"%" | ||
</if> | ||
</where> | ||
</select> | ||
|
||
|
||
<select id="getBlogByTypeId" parameterType="Integer" resultType="Integer"> | ||
select count(*) from t_blog where type_id=#{typeId} | ||
</select> | ||
|
||
</mapper> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?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="ssm.blog.dao.BlogTypeDao"> | ||
<resultMap id="BlogTypeResult" type="BlogType"> | ||
<id property="id" column="id" /> | ||
<result property="typeName" column="type_name"/> | ||
<result property="orderNum" column="order_num"/> | ||
<result property="blogCount" column="blogCount"/> | ||
</resultMap> | ||
|
||
<insert id="addBlogType" parameterType="BlogType" keyProperty="id" useGeneratedKeys="true"> | ||
insert into db_blog.t_blogtype | ||
<trim prefix="(" suffix=")" suffixOverrides=","> | ||
<if test="typeName!=null and typeName!=''"> | ||
type_name, | ||
</if> | ||
<if test="orderNum!=null and orderNum!=''"> | ||
order_num, | ||
</if> | ||
</trim> | ||
<trim prefix="values(" suffix=")" suffixOverrides=","> | ||
<if test="typeName!=null and typeName!=''"> | ||
#{typeName}, | ||
</if> | ||
<if test="orderNum!=null and orderNum!=''"> | ||
#{orderNum}, | ||
</if> | ||
</trim> | ||
</insert> | ||
<delete id="deleteBlogType" parameterType="java.lang.Integer"> | ||
DELETE FROM db_blog.t_blogtype where id=#{id} | ||
</delete> | ||
<update id="updateBlogType" parameterType="BlogType"> | ||
update db_blog.t_blogtype | ||
<set > | ||
<if test="typeName!=null and typeName!=''"> | ||
type_name = #{typeName}, | ||
</if> | ||
<if test="orderNum!=null and orderNum!=''"> | ||
order_num = #{orderNum}, | ||
</if> | ||
</set> | ||
WHERE id = #{id} | ||
</update> | ||
<select id="getById" parameterType="java.lang.Integer" resultMap="BlogTypeResult" > | ||
SELECT id,type_name,order_num from db_blog.t_blogtype | ||
where id = #{id} | ||
</select> | ||
<select id="listByPage" resultMap="BlogTypeResult"> | ||
SELECT id,type_name,order_num from db_blog.t_blogtype | ||
limit #{start} ,#{end} | ||
</select> | ||
<select id="getTotal" resultType="java.lang.Long"> | ||
SELECT COUNT(id) from db_blog.t_blogtype | ||
</select> | ||
<select id="getBlogTypeData" resultMap="BlogTypeResult"> | ||
SELECT | ||
t2.*, | ||
COUNT(t1.id) AS blogCount | ||
FROM | ||
t_blog t1 | ||
RIGHT JOIN t_blogtype t2 | ||
ON t1.type_id = t2.id | ||
GROUP BY t2.type_name | ||
ORDER BY t2.order_num | ||
</select> | ||
|
||
</mapper> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?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="ssm.blog.dao.BloggerDao"> | ||
<!-- | ||
返回结果映射 | ||
如果开启驼峰命名转换且命名规范该段代码可以不写 | ||
因为配置别名 所以type属性使用的是mybatis-conf中的别名 | ||
--> | ||
<resultMap type="Blogger" id="BloggerResult"> | ||
<id property="id" column="id"/> | ||
<result property="userName" column="username"/> | ||
<result property="password" column="password"/> | ||
<result property="profile" column="profile"/> | ||
<result property="nickName" column="nickname"/> | ||
<result property="sign" column="sign"/> | ||
<result property="imageName" column="imagename"/> | ||
</resultMap> | ||
<!-- 定义字段集合 --> | ||
<sql id="BloggerColumns"> | ||
id,username,password,profile,nickname,sign,imagename | ||
</sql> | ||
<!-- 接口中getBloggerData 具体实现--> | ||
<select id="getBloggerData" resultMap="BloggerResult"> | ||
select <include refid="BloggerColumns"/> from t_blogger where id = 1 | ||
</select> | ||
</mapper> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!DOCTYPE configuration | ||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN" | ||
"http://mybatis.org/dtd/mybatis-3-config.dtd"> | ||
<configuration> | ||
<!-- 别名 --> | ||
<typeAliases> | ||
<package name="ssm.blog.entity"/> | ||
</typeAliases> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans xmlns="http://www.springframework.org/schema/beans" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:context="http://www.springframework.org/schema/context" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> | ||
<!-- 开启包扫描--> | ||
<context:component-scan base-package="ssm.blog"/> | ||
<!-- 配置druid数据源 --> | ||
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"> | ||
<property name="username" value="root"/> | ||
<property name="password" value="root"/> | ||
<property name="driverClassName" value="com.mysql.jdbc.Driver"/> | ||
<property name="url" value="jdbc:mysql://localhost:3306/db_blog"/> | ||
</bean> | ||
<!-- 配置mybatis的sqlSessionFactory --> | ||
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> | ||
<property name="dataSource" ref="dataSource"/> | ||
<!-- 自动扫描mapper.xml文件--> | ||
<property name="mapperLocations" value="classpath:mapper/*.xml"/> | ||
<!-- 载入mybatis全局配置文件--> | ||
<property name="configLocation" value="classpath:mybatis-conf.xml"/> | ||
</bean> | ||
|
||
<!-- 配置mybatis dao接口扫描--> | ||
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> | ||
<property name="basePackage" value="ssm.blog.dao"/> | ||
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/> | ||
</bean> | ||
|
||
</beans> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans xmlns="http://www.springframework.org/schema/beans" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:context="http://www.springframework.org/schema/context" | ||
xmlns:mvc="http://www.springframework.org/schema/mvc" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> | ||
|
||
<!-- 扫描所有ssm.blog.controller包下面的所有controller --> | ||
<context:component-scan base-package="ssm.blog.controller"/> | ||
<!-- 开启注解配置--> | ||
<mvc:annotation-driven/> | ||
<!-- 静态资源解析,包括js,css,img... --> | ||
<mvc:resources location="/static/" mapping="/static/**"/> | ||
<!-- 配置视图解析器--> | ||
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> | ||
<!--视图前缀--> | ||
<property name="prefix" value="/"/> | ||
<!--视图后缀--> | ||
<property name="suffix" value=".jsp"/> | ||
</bean> | ||
</beans> |
Binary file added
BIN
+672 Bytes
target/Blog/WEB-INF/classes/ssm/blog/controller/BloggerController.class
Binary file not shown.
Binary file added
BIN
+2.7 KB
target/Blog/WEB-INF/classes/ssm/blog/controller/admin/BlogController.class
Binary file not shown.
Binary file added
BIN
+3.85 KB
target/Blog/WEB-INF/classes/ssm/blog/controller/admin/BlogTypeController.class
Binary file not shown.
Binary file added
BIN
+751 Bytes
target/Blog/WEB-INF/classes/ssm/blog/controller/admin/MainController.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1.91 KB
target/Blog/WEB-INF/classes/ssm/blog/service/impl/BlogServiceImpl.class
Binary file not shown.
Binary file added
BIN
+2.08 KB
target/Blog/WEB-INF/classes/ssm/blog/service/impl/BlogTypeServiceImpl.class
Binary file not shown.
Binary file added
BIN
+445 Bytes
target/Blog/WEB-INF/classes/ssm/blog/service/impl/BloggerServiceImpl.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="http://java.sun.com/xml/ns/javaee" | ||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee | ||
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" | ||
id="WebApp_ID" version="3.0"> | ||
|
||
<!--spring配置文件路径--> | ||
<context-param> | ||
<param-name>contextConfigLocation</param-name> | ||
<param-value>classpath:spring-beans.xml</param-value> | ||
</context-param> | ||
<!-- 配置spring监听器--> | ||
<listener> | ||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> | ||
</listener> | ||
<listener> | ||
<listener-class>ssm.blog.listener.InitBloggerData</listener-class> | ||
</listener> | ||
<!--spring mvc核心servlet--> | ||
<servlet> | ||
<servlet-name>dispatcherServlet</servlet-name> | ||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> | ||
<!-- 初始化参数配置 springnvc配置文件路径--> | ||
<init-param> | ||
<param-name>contextConfigLocation</param-name> | ||
<param-value>classpath:spring-mvc.xml</param-value> | ||
</init-param> | ||
<load-on-startup>1</load-on-startup> | ||
<async-supported>true</async-supported> | ||
</servlet> | ||
<servlet-mapping> | ||
<servlet-name>dispatcherServlet</servlet-name> | ||
<url-pattern>*.do</url-pattern> | ||
</servlet-mapping> | ||
<servlet-mapping> | ||
<servlet-name>dispatcherServlet</servlet-name> | ||
<url-pattern>*.html</url-pattern> | ||
</servlet-mapping> | ||
<!-- 编码过滤器 --> | ||
<filter> | ||
<filter-name>encodingFilter</filter-name> | ||
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class> | ||
<async-supported>true</async-supported> | ||
<init-param> | ||
<param-name>encoding</param-name> | ||
<param-value>UTF-8</param-value> | ||
</init-param> | ||
</filter> | ||
<filter-mapping> | ||
<filter-name>encodingFilter</filter-name> | ||
<url-pattern>/*</url-pattern> | ||
</filter-mapping> | ||
</web-app> |
Oops, something went wrong.