删除zheng-cms-service模块
This commit is contained in:
parent
d134b0e200
commit
314d441f4a
|
@ -22,7 +22,6 @@
|
||||||
<module>zheng-cms-dao</module>
|
<module>zheng-cms-dao</module>
|
||||||
<module>zheng-cms-rpc-api</module>
|
<module>zheng-cms-rpc-api</module>
|
||||||
<module>zheng-cms-rpc-service</module>
|
<module>zheng-cms-rpc-service</module>
|
||||||
<module>zheng-cms-service</module>
|
|
||||||
<module>zheng-cms-web</module>
|
<module>zheng-cms-web</module>
|
||||||
<module>zheng-cms-job</module>
|
<module>zheng-cms-job</module>
|
||||||
<module>zheng-cms-search</module>
|
<module>zheng-cms-search</module>
|
||||||
|
@ -43,12 +42,6 @@
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<type>jar</type>
|
<type>jar</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.zheng</groupId>
|
|
||||||
<artifactId>zheng-cms-service</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.zheng</groupId>
|
<groupId>com.zheng</groupId>
|
||||||
<artifactId>zheng-cms-service</artifactId>
|
<artifactId>zheng-cms-rpc-api</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.zheng</groupId>
|
<groupId>com.zheng</groupId>
|
||||||
<artifactId>zheng-cms-service</artifactId>
|
<artifactId>zheng-cms-rpc-api</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
<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>com.zheng</groupId>
|
|
||||||
<artifactId>zheng-cms</artifactId>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>zheng-cms-service</artifactId>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<name>zheng-cms-service</name>
|
|
||||||
<url>http://www.zhangshuzheng.cn</url>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.zheng</groupId>
|
|
||||||
<artifactId>zheng-cms-dao</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.servlet</groupId>
|
|
||||||
<artifactId>servlet-api</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<finalName>zheng-cms-service</finalName>
|
|
||||||
<resources>
|
|
||||||
<resource>
|
|
||||||
<directory>src/main/java</directory>
|
|
||||||
<includes>
|
|
||||||
<include>**/*.xml</include>
|
|
||||||
</includes>
|
|
||||||
<filtering>true</filtering>
|
|
||||||
</resource>
|
|
||||||
<resource>
|
|
||||||
<directory>src/main/resources</directory>
|
|
||||||
</resource>
|
|
||||||
</resources>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
<version>2.18.1</version>
|
|
||||||
<configuration>
|
|
||||||
<skipTests>true</skipTests>
|
|
||||||
<testFailureIgnore>true</testFailureIgnore>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
|
|
@ -1,9 +0,0 @@
|
||||||
package com.zheng.cms.dao.mapper;
|
|
||||||
|
|
||||||
public interface CmsArticleVOMapper {
|
|
||||||
|
|
||||||
int up(Integer articleId);
|
|
||||||
|
|
||||||
int down(Integer articleId);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
<?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.zheng.cms.dao.mapper.CmsArticleVOMapper">
|
|
||||||
|
|
||||||
<!-- 排序上移 -->
|
|
||||||
<select id="up" resultType="int" parameterType="int">
|
|
||||||
select
|
|
||||||
u.id u_id,u.username,u.password,u.nickname,u.sex,u.ctime,u.content,
|
|
||||||
b.id b_id,b.userid,b.name
|
|
||||||
from
|
|
||||||
user u
|
|
||||||
left join
|
|
||||||
book b
|
|
||||||
on
|
|
||||||
u.id=b.userid
|
|
||||||
where
|
|
||||||
u.id=#{id,jdbcType=INTEGER}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 缓存 -->
|
|
||||||
<cache type="org.mybatis.caches.ehcache.LoggingEhcache" />
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -1,9 +0,0 @@
|
||||||
package com.zheng.cms.dao.mapper;
|
|
||||||
|
|
||||||
public interface CmsCategoryVOMapper {
|
|
||||||
|
|
||||||
int up(Integer articleId);
|
|
||||||
|
|
||||||
int down(Integer articleId);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
package com.zheng.cms.dao.mapper;
|
|
||||||
|
|
||||||
public interface CmsTagVOMapper {
|
|
||||||
|
|
||||||
int up(Integer articleId);
|
|
||||||
|
|
||||||
int down(Integer articleId);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.zheng.cms.dao.mapper;
|
|
||||||
|
|
||||||
import org.springframework.stereotype.Repository;
|
|
||||||
|
|
||||||
import com.zheng.cms.dao.model.UserVO;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户mapper
|
|
||||||
* @author shuzheng
|
|
||||||
* @date 2016年7月6日 下午6:05:54
|
|
||||||
*/
|
|
||||||
@Repository
|
|
||||||
public interface UserVOMapper extends CmsUserMapper {
|
|
||||||
|
|
||||||
UserVO selectUserWithBook(int id);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
<?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.zheng.cms.dao.mapper.UserVOMapper">
|
|
||||||
|
|
||||||
<!-- 结果映射关系 -->
|
|
||||||
<resultMap id="UserResultMap" type="com.zheng.cms.dao.model.UserVO">
|
|
||||||
<id column="u_id" property="id"/>
|
|
||||||
<result column="username" property="username"/>
|
|
||||||
<result column="password" property="password"/>
|
|
||||||
<result column="nickname" property="nickname"/>
|
|
||||||
<result column="sex" property="sex"/>
|
|
||||||
<result column="ctime" property="ctime"/>
|
|
||||||
<result column="content" property="content" />
|
|
||||||
<collection column="userid" property="books" ofType="com.zheng.cms.dao.model.Book">
|
|
||||||
<id column="b_id" property="id"/>
|
|
||||||
<result column="userid" property="userid"/>
|
|
||||||
<result column="name" property="name"/>
|
|
||||||
</collection>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<!-- 查询一对多的所有记录 -->
|
|
||||||
<select id="selectUserWithBook" resultMap="UserResultMap" parameterType="int">
|
|
||||||
select
|
|
||||||
u.id u_id,u.username,u.password,u.nickname,u.sex,u.ctime,u.content,
|
|
||||||
b.id b_id,b.userid,b.name
|
|
||||||
from
|
|
||||||
user u
|
|
||||||
left join
|
|
||||||
book b
|
|
||||||
on
|
|
||||||
u.id=b.userid
|
|
||||||
where
|
|
||||||
u.id=#{id,jdbcType=INTEGER}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<!-- 缓存 -->
|
|
||||||
<cache type="org.mybatis.caches.ehcache.LoggingEhcache" />
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -1,21 +0,0 @@
|
||||||
package com.zheng.cms.dao.model;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户VO
|
|
||||||
* @author shuzheng
|
|
||||||
* @date 2016年7月6日 下午6:06:36
|
|
||||||
*/
|
|
||||||
public class UserVO extends CmsUser {
|
|
||||||
|
|
||||||
private List<CmsBook> books;
|
|
||||||
|
|
||||||
public List<CmsBook> getBooks() {
|
|
||||||
return books;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBooks(List<CmsBook> books) {
|
|
||||||
this.books = books;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.zheng.cms.service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* baseService接口
|
|
||||||
* @author shuzheng
|
|
||||||
* @date 2016年7月7日 上午9:58:23
|
|
||||||
*/
|
|
||||||
public interface BaseService<Mapper> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取基本操作mapper
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Mapper getMapper();
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
package com.zheng.cms.service;
|
|
||||||
|
|
||||||
import com.zheng.cms.dao.mapper.CmsArticleMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文章service接口
|
|
||||||
* Created by shuzheng on 2016/11/14.
|
|
||||||
*/
|
|
||||||
public interface CmsArticleService extends BaseService<CmsArticleMapper> {
|
|
||||||
|
|
||||||
// 批量删除
|
|
||||||
int deleteByPrimaryKeys(String ids);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
package com.zheng.cms.service;
|
|
||||||
|
|
||||||
import com.zheng.cms.dao.mapper.CmsCategoryMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 类目service接口
|
|
||||||
* Created by shuzheng on 2016/11/14.
|
|
||||||
*/
|
|
||||||
public interface CmsCategoryService extends BaseService<CmsCategoryMapper> {
|
|
||||||
|
|
||||||
// 批量删除
|
|
||||||
int deleteByPrimaryKeys(String ids);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
package com.zheng.cms.service;
|
|
||||||
|
|
||||||
import com.zheng.cms.dao.mapper.CmsCommentMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 评论service接口
|
|
||||||
* Created by shuzheng on 2016/11/14.
|
|
||||||
*/
|
|
||||||
public interface CmsCommentService extends BaseService<CmsCommentMapper> {
|
|
||||||
|
|
||||||
// 批量删除
|
|
||||||
int deleteByPrimaryKeys(String ids);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
package com.zheng.cms.service;
|
|
||||||
|
|
||||||
import com.zheng.cms.dao.mapper.CmsTagMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 标签service接口
|
|
||||||
* Created by shuzheng on 2016/11/14.
|
|
||||||
*/
|
|
||||||
public interface CmsTagService extends BaseService<CmsTagMapper> {
|
|
||||||
|
|
||||||
// 批量删除
|
|
||||||
int deleteByPrimaryKeys(String ids);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
package com.zheng.cms.service;
|
|
||||||
|
|
||||||
import com.zheng.cms.dao.mapper.CmsUserMapper;
|
|
||||||
import com.zheng.cms.dao.model.UserVO;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户service接口
|
|
||||||
* @author shuzheng
|
|
||||||
* @date 2016年7月6日 下午6:03:45
|
|
||||||
*/
|
|
||||||
public interface UserService extends BaseService<CmsUserMapper> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取带book数据的用户
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
UserVO selectUserWithBook(int id);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,52 +0,0 @@
|
||||||
package com.zheng.cms.service.impl;
|
|
||||||
|
|
||||||
import com.zheng.cms.dao.mapper.CmsArticleMapper;
|
|
||||||
import com.zheng.cms.service.CmsArticleService;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.util.NumberUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文章service实现
|
|
||||||
* Created by shuzheng on 2016/11/14.
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Transactional
|
|
||||||
public class CmsArticleServiceImpl implements CmsArticleService {
|
|
||||||
|
|
||||||
private static Logger _log = LoggerFactory.getLogger(CmsArticleServiceImpl.class);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CmsArticleMapper cmsArticleMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CmsArticleMapper getMapper() {
|
|
||||||
return cmsArticleMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 批量删除
|
|
||||||
@Override
|
|
||||||
public int deleteByPrimaryKeys(String ids) {
|
|
||||||
if (StringUtils.isBlank(ids)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
String[] idArray = ids.split("-");
|
|
||||||
int count = 0;
|
|
||||||
for (String id : idArray) {
|
|
||||||
if (StringUtils.isBlank(id)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
count += cmsArticleMapper.deleteByPrimaryKey(Integer.parseInt(id));
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
package com.zheng.cms.service.impl;
|
|
||||||
|
|
||||||
import com.zheng.cms.dao.mapper.CmsCategoryMapper;
|
|
||||||
import com.zheng.cms.service.CmsCategoryService;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 类目service实现
|
|
||||||
* Created by shuzheng on 2016/11/14.
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Transactional
|
|
||||||
public class CmsCategoryServiceImpl implements CmsCategoryService {
|
|
||||||
|
|
||||||
private static Logger _log = LoggerFactory.getLogger(CmsCategoryServiceImpl.class);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CmsCategoryMapper cmsCategoryMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CmsCategoryMapper getMapper() {
|
|
||||||
return cmsCategoryMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 批量删除
|
|
||||||
@Override
|
|
||||||
public int deleteByPrimaryKeys(String ids) {
|
|
||||||
if (StringUtils.isBlank(ids)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
String[] idArray = ids.split("-");
|
|
||||||
int count = 0;
|
|
||||||
for (String id : idArray) {
|
|
||||||
if (StringUtils.isBlank(id)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
count += cmsCategoryMapper.deleteByPrimaryKey(Integer.parseInt(id));
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
package com.zheng.cms.service.impl;
|
|
||||||
|
|
||||||
import com.zheng.cms.dao.mapper.CmsCommentMapper;
|
|
||||||
import com.zheng.cms.service.CmsCommentService;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 评论service实现
|
|
||||||
* Created by shuzheng on 2016/11/14.
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Transactional
|
|
||||||
public class CmsCommentServiceImpl implements CmsCommentService {
|
|
||||||
|
|
||||||
private static Logger _log = LoggerFactory.getLogger(CmsCommentServiceImpl.class);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CmsCommentMapper cmsCommentMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CmsCommentMapper getMapper() {
|
|
||||||
return cmsCommentMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 批量删除
|
|
||||||
@Override
|
|
||||||
public int deleteByPrimaryKeys(String ids) {
|
|
||||||
if (StringUtils.isBlank(ids)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
String[] idArray = ids.split("-");
|
|
||||||
int count = 0;
|
|
||||||
for (String id : idArray) {
|
|
||||||
if (StringUtils.isBlank(id)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
count += cmsCommentMapper.deleteByPrimaryKey(Integer.parseInt(id));
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
package com.zheng.cms.service.impl;
|
|
||||||
|
|
||||||
import com.zheng.cms.dao.mapper.CmsTagMapper;
|
|
||||||
import com.zheng.cms.service.CmsTagService;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 标签service实现
|
|
||||||
* Created by shuzheng on 2016/11/14.
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Transactional
|
|
||||||
public class CmsTagServiceImpl implements CmsTagService {
|
|
||||||
|
|
||||||
private static Logger _log = LoggerFactory.getLogger(CmsTagServiceImpl.class);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CmsTagMapper cmsTagMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CmsTagMapper getMapper() {
|
|
||||||
return cmsTagMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 批量删除
|
|
||||||
@Override
|
|
||||||
public int deleteByPrimaryKeys(String ids) {
|
|
||||||
if (StringUtils.isBlank(ids)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
String[] idArray = ids.split("-");
|
|
||||||
int count = 0;
|
|
||||||
for (String id : idArray) {
|
|
||||||
if (StringUtils.isBlank(id)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
count += cmsTagMapper.deleteByPrimaryKey(Integer.parseInt(id));
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
package com.zheng.cms.service.impl;
|
|
||||||
|
|
||||||
import com.zheng.cms.dao.mapper.CmsUserMapper;
|
|
||||||
import com.zheng.cms.dao.mapper.UserVOMapper;
|
|
||||||
import com.zheng.cms.dao.model.UserVO;
|
|
||||||
import com.zheng.cms.service.UserService;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户service实现
|
|
||||||
* @author shuzheng
|
|
||||||
* @date 2016年7月6日 下午6:07:58
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@Transactional
|
|
||||||
public class UserServiceImpl implements UserService {
|
|
||||||
|
|
||||||
private static Logger _log = LoggerFactory.getLogger(UserServiceImpl.class);
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CmsUserMapper userMapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private UserVOMapper userVOMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取基本操作mapper
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public CmsUserMapper getMapper() {
|
|
||||||
return userMapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取带book数据的用户
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
@Cacheable(value="ehcache")
|
|
||||||
public UserVO selectUserWithBook(int id) {
|
|
||||||
return userVOMapper.selectUserWithBook(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
package com.zheng.cms.service;
|
|
||||||
|
|
||||||
import com.zheng.cms.dao.model.CmsUser;
|
|
||||||
import com.zheng.cms.dao.model.UserVO;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
||||||
import org.springframework.test.context.transaction.TransactionConfiguration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试service
|
|
||||||
* @author shuzheng
|
|
||||||
* @date 2016年7月6日 下午6:07:43
|
|
||||||
*/
|
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
|
||||||
@ContextConfiguration({
|
|
||||||
"classpath:applicationContext.xml",
|
|
||||||
"classpath:applicationContext-jdbc.xml"
|
|
||||||
})
|
|
||||||
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)
|
|
||||||
public class UserServiceTest {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private UserService userService;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void index() {
|
|
||||||
// 自定义接口调用
|
|
||||||
UserVO userVO = userService.selectUserWithBook(1);
|
|
||||||
System.out.println(null == userVO ? "null" : userVO.getBooks().size());
|
|
||||||
// 自动生成接口调用
|
|
||||||
CmsUser user = userService.getMapper().selectByPrimaryKey(1);
|
|
||||||
System.out.println(null == user ? "null" :user.getNickname());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue