This commit is contained in:
xiangwbs
2018-06-21 20:27:07 +08:00
parent 88d0c70c94
commit 51f1bd7750
39 changed files with 177 additions and 211 deletions
+7 -2
View File
@@ -56,12 +56,17 @@
<dependency> <!-- mybatis -->
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.0</version>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper-spring-boot-starter</artifactId>
<version>1.2.4</version>
</dependency>
<dependency> <!-- 分页插件 -->
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.1.2</version>
<version>1.2.3</version>
</dependency>
<!-- lombok:实体类自动生成getting和setting方法,以及equals,hashCode,toString等 -->
<dependency>
@@ -111,8 +111,8 @@ TO_CHAR
SELECT TO_CHAR(SYSDATE,'YYYY-MM-DD HH24:MI:SS') FROM DUAL;
SELECT TO_DATE('1992-9-1 23:22:11','RR-mm-dd hh24:mi:ss') FROM dual;
SELECT TO_CHAR(TO_DATE('99-09-01','RR-MM-DD'),'YYYY-MM-DD') FROM DUAL;
SELECT date_format(now(),'%Y-%m-%d %h:%i:%s');//mysql--------------------------------------
SELECT str_to_date('2016-01-02 11:11:11','%Y-%m-%d %h:%i:%s');//mysql--------------------------------------
SELECT date_format(now(),'%Y-%m-%d %H:%i:%s');//mysql--------------------------------------
SELECT str_to_date('2016-01-02 11:11:11','%Y-%m-%d %H:%i:%s');//mysql--------------------------------------
LAST_DAY(date) 该函数返回给定日期所在月的最后一天
查看当月月底?
@@ -1,19 +1,16 @@
package com.xwbing.domain.entity.rest;
import com.xwbing.domain.entity.sys.JpaBaseEntity;
import com.xwbing.domain.entity.sys.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.persistence.Entity;
/**
* @author xiangwb
* @version $Id: FilesUpload.java, v 0.1 2018年06月13日 17:23 wb-xwb402636 Exp $
*/
@EqualsAndHashCode(callSuper = true)
@Data
@Entity(name = "file_upload")
public class FilesUpload extends JpaBaseEntity {
public class FilesUpload extends BaseEntity {
private static final long serialVersionUID = 3284231281346882055L;
public static String table = "file_upload";
private String name;
@@ -16,9 +16,8 @@ import javax.persistence.Entity;
@EqualsAndHashCode(callSuper = true)
@Data
@Entity(name = "data_dict")
public class DataDictionary extends BaseEntity {
public class DataDictionary extends JpaBaseEntity {
private static final long serialVersionUID = -3409347240188002427L;
public static String table = "data_dict";
@ApiModelProperty(value = "编码", required = true)
private String code;
@ApiModelProperty(value = "名称", required = true)
@@ -13,6 +13,7 @@ import javax.persistence.Entity;
* 创建时间: 2017/5/10 16:36
* 作者: xiangwb
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class SysAuthority extends BaseEntity {
private static final long serialVersionUID = -6469518352117371987L;
@@ -19,10 +19,9 @@ import javax.validation.constraints.Pattern;
@EqualsAndHashCode(callSuper = true)
@Data
@Entity(name = "system_config")
@ApiModel//swagger
@ApiModel
public class SysConfig extends BaseEntity {
private static final long serialVersionUID = -7587016038432881980L;
public static String table = "system_config";
@ApiModelProperty(value = "配置项的code",example = "email_config",required = true)
@NotBlank(message = "配置项的code不能为空")
@Length(min = 1, max = 50, message = "code长度为1-50")
@@ -12,6 +12,7 @@ import javax.persistence.Entity;
* 创建时间: 2017/5/10 16:36
* 作者: xiangwb
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class SysRole extends BaseEntity {
private static final long serialVersionUID = -3048021197170624143L;
@@ -12,6 +12,7 @@ import javax.persistence.Entity;
* 创建时间: 2017/5/10 16:36
* 作者: xiangwb
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class SysRoleAuthority extends BaseEntity {
private static final long serialVersionUID = 1241064470335852429L;
@@ -19,6 +19,7 @@ import java.util.List;
* 创建时间: 2017/5/10 16:36
* 作者: xiangwb
*/
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel
public class SysUser extends BaseEntity {
@@ -12,6 +12,7 @@ import javax.persistence.Entity;
* 作者: xiangwb
* 说明: 用户登录登出信息
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class SysUserLoginInOut extends BaseEntity {
private static final long serialVersionUID = -2719103095945780275L;
@@ -12,6 +12,7 @@ import javax.persistence.Entity;
* 创建时间: 2017/5/10 16:36
* 作者: xiangwb
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class SysUserRole extends BaseEntity {
private static final long serialVersionUID = 7340808603856635810L;
@@ -0,0 +1,17 @@
package com.xwbing.domain.mapper.rest;
import com.xwbing.domain.entity.rest.FilesUpload;
import com.xwbing.domain.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 项目名称: boot-module-demo
* 创建时间: 2018/6/1 21:50
* 作者: xiangwb
* 说明:
*/
public interface FilesUploadMapper extends BaseMapper<FilesUpload> {
List<FilesUpload> findByName(@Param("name") String name, @Param("type") String type);
}
@@ -1,4 +1,4 @@
package com.xwbing.domain.repository.sys;
package com.xwbing.domain.repository;
import com.xwbing.domain.entity.sys.DataDictionary;
import org.springframework.data.jpa.repository.JpaRepository;
@@ -1,19 +0,0 @@
package com.xwbing.domain.repository;
import com.xwbing.domain.entity.rest.FilesUpload;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
/**
* @author xiangwb
* @version $Id: FilesUploadRepository.java, v 0.1 2018年06月13日 17:25 wb-xwb402636 Exp $
*/
public interface FilesUploadRepository extends JpaRepository<FilesUpload, String> {
List<FilesUpload> getByName(String name, Sort sort);
List<FilesUpload> getByTypeOrderByCreateTime(String type);
List<FilesUpload> getByIdIn(List<String> ids);
}
@@ -1,4 +1,4 @@
package com.xwbing.domain.repository.sys;
package com.xwbing.domain.repository;
import com.xwbing.domain.entity.sys.SysConfig;
import org.springframework.data.jpa.repository.JpaRepository;
@@ -1,28 +0,0 @@
package com.xwbing.domain.repository.sys;
import com.xwbing.domain.entity.sys.SysAuthority;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
/**
* 说明:
* 项目名称: boot-module-demo
* 创建时间: 2017/5/5 16:44
* 作者: xiangwb
*/
public interface SysAuthorityRepository extends JpaRepository<SysAuthority, String> {
SysAuthority getByCode(String code);
List<SysAuthority> getByEnableOrderBySort(String enable);
List<SysAuthority> getByParentIdAndEnableOrderBySort(String parentId, String enable);
List<SysAuthority> getByParentIdOrderBySort(String parentId);
List<SysAuthority> getByEnableAndIdInOrderBySort(String enable, List<String> ids);
List<SysAuthority> getByIdInOrderBySort(List<String> ids);
SysAuthority getBySort(int sort);
}
@@ -1,16 +0,0 @@
package com.xwbing.domain.repository.sys;
import com.xwbing.domain.entity.sys.SysRoleAuthority;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
/**
* 项目名称: boot-module-demo
* 创建时间: 2017/11/14 15:13
* 作者: xiangwb
* 说明:
*/
public interface SysRoleAuthorityRepository extends JpaRepository<SysRoleAuthority, String> {
List<SysRoleAuthority> getByRoleId(String roleId);
}
@@ -1,22 +0,0 @@
package com.xwbing.domain.repository.sys;
import com.xwbing.domain.entity.sys.SysRole;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
/**
* 说明:
* 项目名称: boot-module-demo
* 创建时间: 2017/5/5 16:44
* 作者: xiangwb
*/
public interface SysRoleRepository extends JpaRepository<SysRole, String> {
List<SysRole> getByEnable(String enable);
SysRole getByCode(String code);
List<SysRole> getByEnableAndIdIn(String enable, List<String> ids);
List<SysRole> getByIdIn(List<String> ids);
}
@@ -1,16 +0,0 @@
package com.xwbing.domain.repository.sys;
import com.xwbing.domain.entity.sys.SysUserLoginInOut;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
/**
* 项目名称: boot-module-demo
* 创建时间: 2017/11/7 9:58
* 作者: xiangwb
* 说明:
*/
public interface SysUserLoginInOutRepository extends JpaRepository<SysUserLoginInOut, String> {
List<SysUserLoginInOut> getByInoutType(int inout);
}
@@ -1,13 +0,0 @@
package com.xwbing.domain.repository.sys;
import com.xwbing.domain.entity.sys.SysUser;
import org.springframework.data.jpa.repository.JpaRepository;
/**
* 说明:
* 项目名称: boot-module-demo
* 创建时间: 2017/5/5 16:44
* 作者: xiangwb
*/
public interface SysUserRepository extends JpaRepository<SysUser, String> {
SysUser getByUserName(String name);
}
@@ -1,16 +0,0 @@
package com.xwbing.domain.repository.sys;
import com.xwbing.domain.entity.sys.SysUserRole;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
/**
* 项目名称: boot-module-demo
* 创建时间: 2017/11/14 14:13
* 作者: xiangwb
* 说明:
*/
public interface SysUserRoleRepository extends JpaRepository<SysUserRole, String> {
List<SysUserRole> getByUserId(String userId);
}
@@ -24,10 +24,6 @@ public class Sender {
private RabbitTemplate rabbitTemplate;
private final Logger logger = LoggerFactory.getLogger(Sender.class);
public void sendM(String[] msg) {
send(msg, RabbitConstant.CONTROL_EXCHANGE, "aa");
}
/**
* 发送信息到email队列
*
@@ -1,12 +1,12 @@
package com.xwbing.service.rest;
import com.xwbing.domain.entity.rest.FilesUpload;
import com.xwbing.domain.repository.FilesUploadRepository;
import com.xwbing.domain.mapper.rest.FilesUploadMapper;
import com.xwbing.exception.BusinessException;
import com.xwbing.util.DigestsUtil;
import com.xwbing.util.RestMessage;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -14,7 +14,6 @@ import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.InputStream;
import java.util.Base64;
import java.util.Date;
/**
* 项目名称: boot-module-demo
@@ -25,7 +24,7 @@ import java.util.Date;
@Service
public class CommonService {
@Resource
private FilesUploadRepository uploadRepository;
private FilesUploadMapper uploadMapper;
/**
* 保存信息表单提交时获取校验签名
@@ -46,7 +45,7 @@ public class CommonService {
* @param file
* @return
*/
public RestMessage upload(CommonsMultipartFile file) {
public RestMessage upload(MultipartFile file) {
RestMessage result = new RestMessage();
if (file == null) {
throw new BusinessException("请选择文件");
@@ -70,11 +69,9 @@ public class CommonService {
//对数据字节进行base64编码
String base64 = Base64.getEncoder().encodeToString(data);
filesUpload.setData(base64);
filesUpload.setCreateTime(new Date());
FilesUpload save = uploadRepository.save(filesUpload);
if (save != null) {
int save = uploadMapper.insert(filesUpload);
if (save == 1) {
result.setSuccess(true);
result.setId(save.getId());
result.setMessage("保存文件成功");
} else {
result.setMessage("保存文件失败");
@@ -2,7 +2,7 @@ package com.xwbing.service.sys;
import com.xwbing.constant.CommonConstant;
import com.xwbing.domain.entity.sys.DataDictionary;
import com.xwbing.domain.repository.sys.DataDictionaryRepository;
import com.xwbing.domain.repository.DataDictionaryRepository;
import com.xwbing.exception.BusinessException;
import com.xwbing.util.PassWordUtil;
import com.xwbing.util.RestMessage;
@@ -32,18 +32,13 @@ public class DataDictionaryService {
if (!b) {
throw new BusinessException("该编码已存在");
}
//添加必要参数
String id = PassWordUtil.createId();
dictionary.setId(id);
dictionary.setCreateTime(new Date());
if (StringUtils.isEmpty(dictionary.getParentId())) {
dictionary.setParentId(CommonConstant.ROOT);
}
//保存
DataDictionary save = dataDictionaryRepository.save(dictionary);
if (save != null) {
result.setSuccess(true);
result.setId(id);
result.setMessage("保存数据字典成功");
} else {
result.setMessage("保存数据字典失败");
@@ -6,6 +6,7 @@ import com.xwbing.domain.entity.sys.SysRoleAuthority;
import com.xwbing.domain.entity.vo.SysAuthVo;
import com.xwbing.domain.mapper.sys.SysAuthorityMapper;
import com.xwbing.exception.BusinessException;
import com.xwbing.util.PassWordUtil;
import com.xwbing.util.RestMessage;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@@ -55,9 +56,12 @@ public class SysAuthorityService {
if (StringUtils.isEmpty(sysAuthority.getParentId())) {
sysAuthority.setParentId(CommonConstant.ROOT);
}
String id = PassWordUtil.createId();
sysAuthority.setId(id);
int save = authorityMapper.insert(sysAuthority);
if (save == 1) {
result.setSuccess(true);
result.setId(id);
result.setMessage("保存权限成功");
} else {
result.setMessage("保存权限失败");
@@ -2,7 +2,7 @@ package com.xwbing.service.sys;
import com.xwbing.domain.entity.sys.SysConfig;
import com.xwbing.exception.BusinessException;
import com.xwbing.domain.repository.sys.SysConfigRepository;
import com.xwbing.domain.repository.SysConfigRepository;
import com.xwbing.util.PassWordUtil;
import com.xwbing.util.RestMessage;
import org.slf4j.Logger;
@@ -32,7 +32,6 @@ public class SysConfigService {
* @return
*/
public RestMessage save(SysConfig sysConfig) {
logger.info("保存配置信息");
RestMessage result = new RestMessage();
if (sysConfig == null) {
throw new BusinessException("配置数据不能为空");
@@ -42,7 +41,6 @@ public class SysConfigService {
if (old != null) {
throw new BusinessException(sysConfig.getCode() + "已存在");
}
sysConfig.setId(PassWordUtil.createId());
sysConfig.setCreateTime(new Date());
SysConfig one = sysConfigRepository.save(sysConfig);
if (one != null) {
@@ -61,7 +59,6 @@ public class SysConfigService {
* @return
*/
public RestMessage removeByCode(String code) {
logger.info("删除配置信息");
RestMessage result = new RestMessage();
SysConfig old = getByCode(code);
if (old == null) {
@@ -6,6 +6,7 @@ import com.xwbing.domain.entity.sys.SysRoleAuthority;
import com.xwbing.domain.entity.sys.SysUserRole;
import com.xwbing.domain.mapper.sys.SysRoleMapper;
import com.xwbing.exception.BusinessException;
import com.xwbing.util.PassWordUtil;
import com.xwbing.util.RestMessage;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@@ -47,9 +48,12 @@ public class SysRoleService {
if (!b) {
throw new BusinessException("该编码已存在");
}
String id = PassWordUtil.createId();
sysRole.setId(id);
int save = roleMapper.insert(sysRole);
if (save == 1) {
result.setSuccess(true);
result.setId(id);
result.setMessage("保存角色成功");
} else {
result.setMessage("保存角色失败");
@@ -70,6 +70,8 @@ public class SysUserService {
sysUser.setPassword(res[2]);
// 设置为非管理员
sysUser.setIsAdmin(CommonEnum.YesOrNoEnum.NO.getCode());
String id = PassWordUtil.createId();
sysUser.setId(id);
int save = userMapper.insert(sysUser);
if (save == 0) {
throw new BusinessException("新增用户失败");
@@ -77,6 +79,7 @@ public class SysUserService {
String[] msg = {sysUser.getMail(), userName, res[0]};
//使用mq发送邮件
sender.sendEmail(msg);
result.setId(id);
result.setSuccess(true);
return result;
}
@@ -0,0 +1,78 @@
<?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.xwbing.domain.mapper.rest.FilesUploadMapper">
<resultMap id="resultMap" type="filesUpload">
<id column="id" property="id"/>
<result column="create_time" property="createTime"/>
<result column="modified_time" property="modifiedTime"/>
</resultMap>
<sql id="table">
file_upload
</sql>
<sql id="columns">
id,
creator,
modifier,
create_time,
modified_time,
name,
type,
data
</sql>
<!-- 插入 -->
<insert id="insert">
<selectKey keyProperty="id" resultType="string" order="BEFORE">
SELECT REPLACE(UUID(), '-', '')
</selectKey>
INSERT INTO
<include refid="table"/>(
id,
creator,
create_time,
name,
type,
data
)
VALUES(
#{id},
#{creator},
now(),
#{name},
#{type},
#{data}
)
</insert>
<!-- 批量插入 -->
<insert id="insertBatch">
INSERT INTO
<include refid="table"/>(
id,
creator,
create_time,
name,
type,
data
)
VALUES
<foreach collection="list" item="obj" separator=",">(
(SELECT REPLACE(UUID(), '-', '') AS id),
#{obj.creator},
now(),
#{obj.name},
#{obj.type},
#{obj.data}
)
</foreach>
</insert>
<select id="findByName" resultMap="resultMap">
SELECT
<include refid="columns"/>
FROM
<include refid="table"/>
where name=#{name}
<if test="type!=null">
and type=#{type}
</if>
ORDER BY create_time DESC
</select>
</mapper>
@@ -51,9 +51,6 @@
</sql>
<!-- 插入 -->
<insert id="insert">
<selectKey keyProperty="id" resultType="string" order="BEFORE">
SELECT REPLACE(UUID(), '-', '')
</selectKey>
INSERT INTO
<include refid="table"/>(
id,
@@ -15,8 +15,8 @@
id,
creator,
modifier,
date_format(create_time,'%Y-%m-%d %h:%i:%s') created,
date_format(modified_time,'%Y-%m-%d %h:%i:%s') modified,
date_format(create_time,'%Y-%m-%d %H:%i:%s') created,
date_format(modified_time,'%Y-%m-%d %H:%i:%s') modified,
user_name,
name,
sex,
@@ -31,9 +31,6 @@
</sql>
<!-- 插入 -->
<insert id="insert">
<selectKey keyProperty="id" resultType="string" order="BEFORE">
SELECT REPLACE(UUID(), '-', '')
</selectKey>
INSERT INTO
<include refid="table"/>(
id,
@@ -49,7 +49,7 @@
)
</insert>
<select id="findByInoutType" resultMap="resultMap">
SELECT a.inout_type,a.ip,date_format(a.create_time,'%Y-%m-%d %h:%i:%s') recordTime,b.name userIdName
SELECT a.inout_type,a.ip,date_format(a.create_time,'%Y-%m-%d %H:%i:%s') recordTime,b.name userIdName
FROM sys_user_login_in_out a left join sys_user_info b on
(a.user_id=b.id)
where a.inout_type=#{inout}
@@ -41,9 +41,9 @@
</sql>
<!-- 插入 -->
<insert id="insert">
<selectKey keyProperty="id" resultType="string" order="BEFORE">
SELECT REPLACE(UUID(), '-', '')
</selectKey>
<!--<selectKey keyProperty="id" resultType="string" order="BEFORE">-->
<!--SELECT REPLACE(UUID(), '-', '')-->
<!--</selectKey>-->
INSERT INTO
<include refid="table"/>(
id,
@@ -1,12 +1,11 @@
host: 192.168.11.202
port: 6379
password:
timeout: 10000
host=192.168.11.202
port=6379
password=
timeout=10000
#最大连接数
maxTotal: 8
maxTotal=8
#最大空闲连接数
maxIdle: 8
maxIdle=8
#最小空闲连接数
minIdle: 0
minIdle=0
redisCode=springboot:
@@ -3,13 +3,14 @@ package com.xwbing.controller.rest;
import com.alibaba.fastjson.JSONObject;
import com.xwbing.annotation.LogInfo;
import com.xwbing.domain.entity.rest.FilesUpload;
import com.xwbing.domain.repository.FilesUploadRepository;
import com.xwbing.domain.mapper.rest.FilesUploadMapper;
import com.xwbing.service.rest.CookieSessionService;
import com.xwbing.service.rest.QRCodeZipService;
import com.xwbing.util.EncodeUtils;
import com.xwbing.util.JsonResult;
import com.xwbing.util.RestMessage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@@ -42,7 +43,7 @@ public class TestControl {
@Resource
private CookieSessionService cookieSessionService;
@Resource
private FilesUploadRepository uploadRepository;
private FilesUploadMapper uploadMapper;
@LogInfo("导出zip")
@GetMapping("batchGetImage")
@@ -56,9 +57,10 @@ public class TestControl {
@LogInfo("获取数据库图片")
@GetMapping("getDbPic")
public void getDbPic(HttpServletResponse response, @RequestParam String name) throws IOException {
@ApiImplicitParam(name = "type", value = "图片类型", paramType = "query", dataType = "string")
public void getDbPic(HttpServletResponse response, @RequestParam String name, String type) throws IOException {
if (StringUtils.isNotEmpty(name)) {
List<FilesUpload> files = uploadRepository.getByName(name, new Sort(Sort.Direction.DESC, "createTime"));
List<FilesUpload> files = uploadMapper.findByName(name, type);
if (CollectionUtils.isNotEmpty(files)) {
String data = files.get(0).getData();
byte[] bytes = EncodeUtils.base64Decode(data);
@@ -8,7 +8,9 @@ import com.xwbing.util.JsonResult;
import com.xwbing.util.RestMessage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import javax.annotation.Resource;
@@ -37,7 +39,7 @@ public class CommonControl {
@LogInfo("上传文件")
@PostMapping("upload")
public JSONObject upload(@RequestParam(required = false) CommonsMultipartFile file) {
public JSONObject upload(@ApiParam(value = "文件",required = true) MultipartFile file) {
RestMessage restMessage = commonService.upload(file);
return JsonResult.toJSONObj(restMessage);
}
@@ -21,7 +21,7 @@ public class FormRepeatFilter implements Filter {
private String[] types;
@Override
public void init(FilterConfig filterConfig) throws ServletException {
public void init(FilterConfig filterConfig) {
String excludePath = filterConfig.getInitParameter("excludePath");
paths = excludePath.split(",");
String excludeType = filterConfig.getInitParameter("excludeType");
@@ -1,6 +1,6 @@
formSaveFilterEnable:false
loginInterceptorEnable:false
urlPermissionsInterceptorEnable:false
#表单重复提交过滤器
formSaveFilterEnable=false
#登录拦截器
loginInterceptorEnable=false
#权限拦截器
urlPermissionsInterceptorEnable=false
@@ -3,13 +3,14 @@ package com.xwbing.service;
import com.alibaba.fastjson.JSONObject;
import com.xwbing.BaseTest;
import com.xwbing.domain.entity.ExpressInfo;
import com.xwbing.domain.entity.sys.DataDictionary;
import com.xwbing.domain.entity.sys.SysRole;
import com.xwbing.domain.entity.vo.ExpressInfoVo;
import com.xwbing.domain.mapper.sys.SysRoleMapper;
import com.xwbing.rabbit.Sender;
import com.xwbing.redis.RedisService;
import com.xwbing.service.rest.ExpressDeliveryService;
import com.xwbing.service.rest.QRCodeZipService;
import com.xwbing.service.sys.DataDictionaryService;
import com.xwbing.service.sys.SysRoleService;
import com.xwbing.util.RSAUtil;
import com.xwbing.util.RestMessage;
@@ -44,18 +45,20 @@ public class ServiceTest extends BaseTest {
@Resource
private SysRoleService sysRoleService;
@Resource
private SysRoleMapper sysRoleMapper;
private DataDictionaryService dictionaryService;
@Transactional("jpaTransactionManager")
@Test
public void jpaTransactionTest() {
log.info("jpa数据源事务回滚");
SysRole sysRole = new SysRole();
sysRole.setName("serviceTest");
sysRole.setCode("serviceTest");
sysRole.setEnable("Y");
sysRole.setRemark("serviceTest");
Assert.assertTrue(sysRoleService.save(sysRole).isSuccess());
DataDictionary dictionary=new DataDictionary();
dictionary.setDescription("serviceTest");
dictionary.setEnable("Y");
dictionary.setCode("serviceTest");
dictionary.setName("serviceTest");
dictionary.setParentId("root");
RestMessage save = dictionaryService.save(dictionary);
Assert.assertTrue(save.isSuccess());
}
@Transactional
@@ -67,8 +70,8 @@ public class ServiceTest extends BaseTest {
sysRole.setCode("serviceTest");
sysRole.setEnable("Y");
sysRole.setRemark("serviceTest");
int insert = sysRoleMapper.insert(sysRole);
Assert.assertEquals(1, insert);
RestMessage save = sysRoleService.save(sysRole);
Assert.assertTrue(save.isSuccess());
}
@Test
@@ -125,4 +128,3 @@ public class ServiceTest extends BaseTest {
Assert.assertEquals("xwbing", s);
}
}