Merge pull request 'SysNotification单元测试及model代码,动态建表OperateTableServic' (#9) from wanjia9506/gitlink-notification-system:dev_gitlink_model into master

This commit is contained in:
baladiwei 2021-09-07 09:07:23 +08:00
commit 253fcd1da8
19 changed files with 779 additions and 0 deletions

View File

@ -26,5 +26,49 @@
</plugin>
</plugins>
</build>
<dependencies>
<!-- mybatis-plus begin -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<version>3.4.0</version>
</dependency>
<!-- mybatis-plus end -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${springboot.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.3.4.RELEASE</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,12 @@
package cn.org.gitlink.notification.model;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ModelApplication {
public static void main(String[] args) {
SpringApplication.run(ModelApplication.class, args);
}
}

View File

@ -0,0 +1,35 @@
package cn.org.gitlink.notification.model.config;
import cn.org.gitlink.notification.model.handler.MetaHandler;
import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableTransactionManagement
@Configuration
@MapperScan("cn.org.gitlink.notification.model.dao")
public class MyBatisPlusConfig {
/**
* 分页插件
*/
@Bean
public PaginationInterceptor paginationInterceptor() {
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
return paginationInterceptor;
}
/**
* 自动填充功能
* @return
*/
@Bean
public GlobalConfig globalConfig() {
GlobalConfig globalConfig = new GlobalConfig();
globalConfig.setMetaObjectHandler(new MetaHandler());
return globalConfig;
}
}

View File

@ -0,0 +1,69 @@
package cn.org.gitlink.notification.model.dao.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.util.Date;
public class PlatformInfo {
@TableId(type = IdType.AUTO)
private Integer id;
private String platformCode;
private String platformName;
private Date createdAt;
private Date updatedAt;
private Boolean isDelete;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPlatformCode() {
return platformCode;
}
public void setPlatformCode(String platformCode) {
this.platformCode = platformCode == null ? null : platformCode.trim();
}
public String getPlatformName() {
return platformName;
}
public void setPlatformName(String platformName) {
this.platformName = platformName == null ? null : platformName.trim();
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public Boolean getIsDelete() {
return isDelete;
}
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
}

View File

@ -0,0 +1,89 @@
package cn.org.gitlink.notification.model.dao.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.util.Date;
public class SysNotification {
@TableId(type = IdType.AUTO)
private Integer id;
private Long sender;
private Long receiver;
private String content;
private String notificationUrl;
private Date createdAt;
private Byte status;
private Boolean isDelete;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Long getSender() {
return sender;
}
public void setSender(Long sender) {
this.sender = sender;
}
public Long getReceiver() {
return receiver;
}
public void setReceiver(Long receiver) {
this.receiver = receiver;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
public String getNotificationUrl() {
return notificationUrl;
}
public void setNotificationUrl(String notificationUrl) {
this.notificationUrl = notificationUrl == null ? null : notificationUrl.trim();
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Byte getStatus() {
return status;
}
public void setStatus(Byte status) {
this.status = status;
}
public Boolean getIsDelete() {
return isDelete;
}
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
}

View File

@ -0,0 +1,10 @@
package cn.org.gitlink.notification.model.dao.mapper;
import org.apache.ibatis.annotations.Param;
public interface OperateTableMapper {
int existTable(@Param("tableName")String tableName);
int dropTable(@Param("tableName")String tableName);
int createNewTable(@Param("tableName")String tableName);
// int insert(@Param("tableName")String tableName,@Param("trackpoint")Trackpoint trackpoint);
}

View File

@ -0,0 +1,18 @@
package cn.org.gitlink.notification.model.dao.mapper;
import cn.org.gitlink.notification.model.dao.entity.PlatformInfo;
public interface PlatformInfoMapper {
int deleteByPrimaryKey(Integer id);
int insert(PlatformInfo record);
int insertSelective(PlatformInfo record);
PlatformInfo selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(PlatformInfo record);
int updateByPrimaryKey(PlatformInfo record);
}

View File

@ -0,0 +1,37 @@
package cn.org.gitlink.notification.model.dao.mapper;
import cn.org.gitlink.notification.model.dao.entity.SysNotification;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SysNotificationMapper extends BaseMapper<SysNotification> {
int deleteByPrimaryKey(@Param("platform") String platform, Integer id);
int insert(@Param("platform") String platform, SysNotification record);
int insertSelective(@Param("platform") String platform, SysNotification record);
SysNotification selectByPrimaryKey(@Param("platform") String platform, Integer id);
int updateByPrimaryKeySelective(@Param("platform") String platform, SysNotification record);
int updateByPrimaryKey(@Param("platform") String platform, SysNotification record);
int updateStatusByNotificationId(@Param("platform") String platform,
@Param("notificationId") Integer notificationId,
@Param("status") Byte status);
int getNewSysNotificationNumber(@Param("platform") String platform,
@Param("receiver") Integer receiver);
List<SysNotification> getUnreadSysNotificationsList(@Param("platform") String platform,
@Param("receiver") Integer receiver,
@Param("status") byte status);
List<SysNotification> getSysNotificationPageList(Page page, String orderBy,
@Param("platform") String platform,
@Param("receiver") Integer receiver);
}

View File

@ -0,0 +1,28 @@
package cn.org.gitlink.notification.model.handler;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;
import java.util.Date;
@Component
public class MetaHandler implements MetaObjectHandler {
/**
* 更新数据执行
* @param metaObject
*/
public void updateFill(MetaObject metaObject) {
this.setFieldValByName("updatedAt", new Date(), metaObject);
}
/**
* 新增数据执行
* @param metaObject
*/
@Override
public void insertFill(MetaObject metaObject) {
this.setFieldValByName("createdAt", new Date(), metaObject);
this.setFieldValByName("updatedAt", new Date(), metaObject);
}
}

View File

@ -0,0 +1,28 @@
package cn.org.gitlink.notification.model.service.notification;
import cn.org.gitlink.notification.model.dao.mapper.OperateTableMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
@Component
public class OperateTableService {
@Resource
private OperateTableMapper operateTableMapper;
Logger logger = LoggerFactory.getLogger(this.getClass());
@Transactional
public Boolean createTableByPlatform(String platformCode){
if(operateTableMapper.existTable(platformCode + "_sys_notification") > 0){
logger.info("该平台已存在:" + platformCode);
return false;
}
operateTableMapper.dropTable(platformCode);
operateTableMapper.createNewTable(platformCode);
return true;
}
}

View File

@ -0,0 +1,19 @@
package cn.org.gitlink.notification.model.service.notification;
import cn.org.gitlink.notification.model.dao.entity.SysNotification;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
public interface SysNotificationService extends IService<SysNotification> {
int insertSysNotification(String platform, SysNotification sysNotification);
int updateStatusByNotificationId(String platform, Integer notificationId, Byte status);
int getNewSysNotificationNumber(String platform, Integer receiver);
List<SysNotification> getUnreadSysNotificationsList(String platform, Integer receiver);
Page<SysNotification> getAllSysNotificationsPageList(int curPage, int pageSize, String orderBy, String platform, Integer receiver);
}

View File

@ -0,0 +1,45 @@
package cn.org.gitlink.notification.model.service.notification.impl;
import cn.org.gitlink.notification.model.dao.entity.SysNotification;
import cn.org.gitlink.notification.model.dao.mapper.SysNotificationMapper;
import cn.org.gitlink.notification.model.service.notification.SysNotificationService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class SysNotificationServiceImpl extends ServiceImpl<SysNotificationMapper, SysNotification> implements SysNotificationService {
@Override
public int insertSysNotification(String platform, SysNotification sysNotification) {
return baseMapper.insertSelective(platform, sysNotification);
}
@Override
public int updateStatusByNotificationId(String platform, Integer notificationId, Byte status) {
return baseMapper.updateStatusByNotificationId(platform, notificationId, status);
}
@Override
public int getNewSysNotificationNumber(String platform, Integer receiver) {
return baseMapper.getNewSysNotificationNumber(platform, receiver);
}
@Override
public List<SysNotification> getUnreadSysNotificationsList(String platform, Integer receiver) {
List<SysNotification> sysNotificationList = baseMapper.getUnreadSysNotificationsList(platform, receiver, (byte) 1);
return sysNotificationList;
}
@Override
public Page<SysNotification> getAllSysNotificationsPageList(int curPage, int pageSize, String orderBy, String platform, Integer receiver) {
Page page = new Page<SysNotification>(curPage, pageSize);
List<SysNotification> sysNotificationList = baseMapper.getSysNotificationPageList(
page, orderBy, platform, receiver
);
page.setRecords(sysNotificationList);
return page;
}
}

View File

@ -0,0 +1,7 @@
spring:
datasource:
# 配置数据源类型
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://192.168.199.117/gitlink-notification-system?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2B8&allowMultiQueries=true
username: root
password: 950611

View File

@ -0,0 +1,26 @@
<?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="cn.org.gitlink.notification.model.dao.mapper.OperateTableMapper" >
<select id="existTable" parameterType="String" resultType="Integer">
select count(*)
from information_schema.TABLES
where LCASE(table_name)= #{tableName}
</select>
<update id="dropTable">
DROP TABLE IF EXISTS ${tableName}_sys_notification
</update>
<update id="createNewTable" parameterType="String">
CREATE TABLE ${tableName}_sys_notification (
`id` int NOT NULL AUTO_INCREMENT,
`sender` int NOT NULL COMMENT '发送者id',
`receiver` int NOT NULL COMMENT '接受者id',
`content` text NOT NULL COMMENT '消息内容',
`notifacation_url` varchar(255) DEFAULT NULL COMMENT '消息跳转url',
`created_at` datetime DEFAULT NULL COMMENT '创建时间',
`status` tinyint(4) NOT NULL COMMENT '消息状态1-未读2-已读3-未删除4-已删除',
PRIMARY KEY (`id`),
KEY `index_on_receiver_and_status` (`receiver`,`status`),
KEY `index_on_status` (`status`))
</update>
</mapper>

View File

@ -0,0 +1,106 @@
<?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="cn.org.gitlink.notification.model.dao.mapper.PlatformInfoMapper" >
<resultMap id="BaseResultMap" type="cn.org.gitlink.notification.model.dao.entity.PlatformInfo" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="platform_code" property="platformCode" jdbcType="VARCHAR" />
<result column="platform_name" property="platformName" jdbcType="VARCHAR" />
<result column="created_at" property="createdAt" jdbcType="TIMESTAMP" />
<result column="updated_at" property="updatedAt" jdbcType="TIMESTAMP" />
<result column="is_delete" property="isDelete" jdbcType="BIT" />
</resultMap>
<sql id="Base_Column_List" >
id, platform_code, platform_name, created_at, updated_at, is_delete
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from gns_platform_info
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from gns_platform_info
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="cn.org.gitlink.notification.model.dao.entity.PlatformInfo" >
insert into gns_platform_info (id, platform_code, platform_name,
created_at, updated_at, is_delete
)
values (#{id,jdbcType=INTEGER}, #{platformCode,jdbcType=VARCHAR}, #{platformName,jdbcType=VARCHAR},
#{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{isDelete,jdbcType=BIT}
)
</insert>
<insert id="insertSelective" parameterType="cn.org.gitlink.notification.model.dao.entity.PlatformInfo" >
insert into gns_platform_info
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="platformCode != null" >
platform_code,
</if>
<if test="platformName != null" >
platform_name,
</if>
<if test="createdAt != null" >
created_at,
</if>
<if test="updatedAt != null" >
updated_at,
</if>
<if test="isDelete != null" >
is_delete,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="platformCode != null" >
#{platformCode,jdbcType=VARCHAR},
</if>
<if test="platformName != null" >
#{platformName,jdbcType=VARCHAR},
</if>
<if test="createdAt != null" >
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null" >
#{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="isDelete != null" >
#{isDelete,jdbcType=BIT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.org.gitlink.notification.model.dao.entity.PlatformInfo" >
update gns_platform_info
<set >
<if test="platformCode != null" >
platform_code = #{platformCode,jdbcType=VARCHAR},
</if>
<if test="platformName != null" >
platform_name = #{platformName,jdbcType=VARCHAR},
</if>
<if test="createdAt != null" >
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updatedAt != null" >
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
</if>
<if test="isDelete != null" >
is_delete = #{isDelete,jdbcType=BIT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.org.gitlink.notification.model.dao.entity.PlatformInfo" >
update gns_platform_info
set platform_code = #{platformCode,jdbcType=VARCHAR},
platform_name = #{platformName,jdbcType=VARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
updated_at = #{updatedAt,jdbcType=TIMESTAMP},
is_delete = #{isDelete,jdbcType=BIT}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

View File

@ -0,0 +1,146 @@
<?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="cn.org.gitlink.notification.model.dao.mapper.SysNotificationMapper" >
<resultMap id="BaseResultMap" type="cn.org.gitlink.notification.model.dao.entity.SysNotification" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="sender" property="sender" jdbcType="INTEGER" />
<result column="receiver" property="receiver" jdbcType="INTEGER" />
<result column="content" property="content" jdbcType="VARCHAR" />
<result column="notification_url" property="notificationUrl" jdbcType="VARCHAR" />
<result column="created_at" property="createdAt" jdbcType="TIMESTAMP" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="is_delete" property="isDelete" jdbcType="BIT" />
</resultMap>
<sql id="Base_Column_List" >
id, sender, receiver, content, notification_url, created_at, status, is_delete
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from ${platform}_sys_notification
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from ${platform}_sys_notification
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="cn.org.gitlink.notification.model.dao.entity.SysNotification" >
insert into ${platform}_sys_notification (id, sender, receiver,
content, notification_url, created_at,
status, is_delete)
values (#{id,jdbcType=INTEGER}, #{sender,jdbcType=INTEGER}, #{receiver,jdbcType=INTEGER},
#{content,jdbcType=VARCHAR}, #{notificationUrl,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP},
#{status,jdbcType=TINYINT}, #{isDelete,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="cn.org.gitlink.notification.model.dao.entity.SysNotification" >
insert into ${platform}_sys_notification
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="sender != null" >
sender,
</if>
<if test="receiver != null" >
receiver,
</if>
<if test="content != null" >
content,
</if>
<if test="notificationUrl != null" >
notification_url,
</if>
<if test="createdAt != null" >
created_at,
</if>
<if test="status != null" >
status,
</if>
<if test="isDelete != null" >
is_delete,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="sender != null" >
#{sender,jdbcType=INTEGER},
</if>
<if test="receiver != null" >
#{receiver,jdbcType=INTEGER},
</if>
<if test="content != null" >
#{content,jdbcType=VARCHAR},
</if>
<if test="notificationUrl != null" >
#{notificationUrl,jdbcType=VARCHAR},
</if>
<if test="createdAt != null" >
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="status != null" >
#{status,jdbcType=TINYINT},
</if>
<if test="isDelete != null" >
#{isDelete,jdbcType=BIT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.org.gitlink.notification.model.dao.entity.SysNotification" >
update ${platform}_sys_notification
<set >
<if test="sender != null" >
sender = #{sender,jdbcType=INTEGER},
</if>
<if test="receiver != null" >
receiver = #{receiver,jdbcType=INTEGER},
</if>
<if test="content != null" >
content = #{content,jdbcType=VARCHAR},
</if>
<if test="notificationUrl != null" >
notification_url = #{notificationUrl,jdbcType=VARCHAR},
</if>
<if test="createdAt != null" >
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="status != null" >
status = #{status,jdbcType=TINYINT},
</if>
<if test="isDelete != null" >
is_delete = #{isDelete,jdbcType=BIT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="cn.org.gitlink.notification.model.dao.entity.SysNotification" >
update ${platform}_sys_notification
set sender = #{sender,jdbcType=INTEGER},
receiver = #{receiver,jdbcType=INTEGER},
content = #{content,jdbcType=VARCHAR},
notification_url = #{notificationUrl,jdbcType=VARCHAR},
created_at = #{createdAt,jdbcType=TIMESTAMP},
status = #{status,jdbcType=TINYINT},
is_delete = #{isDelete,jdbcType=BIT}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateStatusByNotificationId">
update ${platform}_sys_notification set status = #{status} where id = #{notificationId}
</update>
<select id="getNewSysNotificationNumber" resultType="java.lang.Integer">
select count(`receiver`)
from ${platform}_sys_notification
where receiver = #{receiver} and status = 1
</select>
<select id="getUnreadSysNotificationsList" resultMap="BaseResultMap">
select * FROM ${platform}_sys_notification
where receiver = #{receiver} AND status = #{status}
ORDER BY id DESC
</select>
<select id="getSysNotificationPageList" resultMap="BaseResultMap">
select * FROM ${platform}_sys_notification
where receiver = #{receiver} AND is_delete = -1
ORDER BY id DESC
</select>
</mapper>

View File

@ -0,0 +1,12 @@
package cn.org.gitlink.notification.model;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ModelApplicationTest {
public static void main(String[] args) {
SpringApplication.run(ModelApplicationTest.class, args);
}
}

View File

@ -0,0 +1,41 @@
package cn.org.gitlink.notification.model.service.notification;
import cn.org.gitlink.notification.model.ModelApplicationTest;
import cn.org.gitlink.notification.model.dao.entity.SysNotification;
import cn.org.gitlink.notification.model.service.notification.OperateTableService;
import cn.org.gitlink.notification.model.service.notification.SysNotificationService;
import javafx.application.Application;
import junit.textui.TestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = ModelApplicationTest.class)
public class ServiceTests {
@Autowired
SysNotificationService sysNotificationService;
@Autowired
OperateTableService operateTableService;
Logger logger = LoggerFactory.getLogger(this.getClass());
@Test
public void test1(){
int i = sysNotificationService.getNewSysNotificationNumber("gitlink", 234);
logger.info("id:" + i);
}
@Test
public void test2(){
operateTableService.createTableByPlatform("trustie");
}
}

View File

@ -0,0 +1,7 @@
spring:
datasource:
# 配置数据源类型
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://192.168.199.117/gitlink-notification-system?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT%2B8&allowMultiQueries=true
username: root
password: 950611