Compare commits
No commits in common. "24724b76fe6acbdb8161f8087dfd42520127eab5" and "6f7057ba06b1df8e1a146262c90571f556af9902" have entirely different histories.
24724b76fe
...
6f7057ba06
@ -1,17 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
|
||||||
<data-source source="LOCAL" name="@122.152.201.90" uuid="a3d85aef-f993-4fcd-8b75-c4caadf67022">
|
|
||||||
<driver-ref>mysql.8</driver-ref>
|
|
||||||
<synchronize>true</synchronize>
|
|
||||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
|
||||||
<jdbc-url>jdbc:mysql://122.152.201.90:9912</jdbc-url>
|
|
||||||
<jdbc-additional-properties>
|
|
||||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
|
||||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
|
||||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
|
||||||
</jdbc-additional-properties>
|
|
||||||
<working-dir>$ProjectFileDir$</working-dir>
|
|
||||||
</data-source>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="SqlDialectMappings">
|
|
||||||
<file url="file://$PROJECT_DIR$/src/main/resources/db/data.sql" dialect="MySQL" />
|
|
||||||
<file url="file://$PROJECT_DIR$/src/main/resources/db/schema.sql" dialect="MySQL" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
10
pom.xml
10
pom.xml
@ -43,16 +43,6 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-mail</artifactId>
|
<artifactId>spring-boot-starter-mail</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.mybatis.spring.boot</groupId>
|
|
||||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
|
||||||
<version>3.0.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.mysql</groupId>
|
|
||||||
<artifactId>mysql-connector-j</artifactId>
|
|
||||||
<version>8.3.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||||
|
|||||||
@ -1,77 +0,0 @@
|
|||||||
package asia.yulinling.workflow.entity;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 用户实体类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author yulinling
|
|
||||||
* @since 2025/6/4
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Builder
|
|
||||||
public class User {
|
|
||||||
/**
|
|
||||||
* 主键id
|
|
||||||
*/
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户名
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 加密后的密码
|
|
||||||
*/
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 加密使用盐
|
|
||||||
*/
|
|
||||||
private String salt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 邮箱
|
|
||||||
*/
|
|
||||||
private String email;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 手机号
|
|
||||||
*/
|
|
||||||
private String phone;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 状态 -1:删除 0:警用 1:启用
|
|
||||||
*/
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建时间
|
|
||||||
*/
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新时间
|
|
||||||
*/
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上次登录时间
|
|
||||||
*/
|
|
||||||
private Date lastLoginTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上次更新时间
|
|
||||||
*/
|
|
||||||
private Date lastUpdateTime;
|
|
||||||
}
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
package asia.yulinling.workflow.mapper;
|
|
||||||
|
|
||||||
import asia.yulinling.workflow.entity.User;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 用户Mapper
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author yulinling
|
|
||||||
* @since 2025/6/4
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
@Component
|
|
||||||
public interface UserMapper {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询所有用户
|
|
||||||
*
|
|
||||||
* @return 用户列表
|
|
||||||
*/
|
|
||||||
@Select("SELECT * FROM orm_user")
|
|
||||||
List<User> selectAllUser();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据id查询用户
|
|
||||||
*
|
|
||||||
* @param id 主键id
|
|
||||||
* @return 当前id的用户,不存在则是{@code null}
|
|
||||||
*/
|
|
||||||
@Select("SELECT * FROM orm_user WHERE id = #{id}")
|
|
||||||
User selectUserById(@Param("id")Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存用户
|
|
||||||
*
|
|
||||||
* @param user 用户
|
|
||||||
* @return 成功 - {@code 1} 失败 - {@code 0}
|
|
||||||
*/
|
|
||||||
int saveUser(@Param("user") User user);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除用户
|
|
||||||
*
|
|
||||||
* @param id 主键id
|
|
||||||
* @return 成功 - {@code 1} 失败 - {@code 0}
|
|
||||||
*/
|
|
||||||
int deleteById(@Param("id")Long id);
|
|
||||||
}
|
|
||||||
@ -8,7 +8,7 @@ import jakarta.mail.MessagingException;
|
|||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author yulinling
|
* @author yulinling
|
||||||
* @since Create in 2025/6/3 22:49
|
* @date Create in 2025/6/3 22:49
|
||||||
*/
|
*/
|
||||||
public interface MailService {
|
public interface MailService {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -20,7 +20,7 @@ import java.io.File;
|
|||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author yulinling
|
* @author yulinling
|
||||||
* @since Create in 2025/6/3 22:49
|
* @date Create in 2025/6/3 22:49
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
|||||||
@ -1,33 +1,3 @@
|
|||||||
|
|
||||||
# mysql??
|
|
||||||
spring.datasource.url=jdbc:mysql://122.152.201.90:9912/workflow?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2B8
|
|
||||||
spring.datasource.username=root
|
|
||||||
spring.datasource.password=0andrx
|
|
||||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
|
||||||
spring.sql.init.mode=always
|
|
||||||
spring.sql.init.continue-on-error=true
|
|
||||||
spring.sql.init.schema-locations=classpath:db/schema.sql
|
|
||||||
spring.sql.init.data-locations=classpath:db/data.sql
|
|
||||||
# ?????
|
|
||||||
spring.datasource.hikari.minimum-idle=5
|
|
||||||
spring.datasource.hikari.connection-test-query=SELECT 1
|
|
||||||
spring.datasource.hikari.maximum-pool-size=20
|
|
||||||
spring.datasource.hikari.auto-commit=true
|
|
||||||
spring.datasource.hikari.idle-timeout=30000
|
|
||||||
spring.datasource.hikari.pool-name=MyAppHikariCP
|
|
||||||
spring.datasource.hikari.max-lifetime=300000
|
|
||||||
spring.datasource.hikari.connection-timeout=30000
|
|
||||||
|
|
||||||
# mybatis??
|
|
||||||
mybatis.configuration.map-underscore-to-camel-case=true
|
|
||||||
mybatis.mapper-locations=classpath:mapper/*.xml
|
|
||||||
mybatis.type-aliases-package=asia/yulinling/workflow/entity
|
|
||||||
|
|
||||||
# log??
|
|
||||||
logging.level.asia.yulinling=debug
|
|
||||||
logging.level.asia.yulinling.workflow.mapper=trace
|
|
||||||
|
|
||||||
# mail??
|
|
||||||
spring.mail.host=smtp.qq.com
|
spring.mail.host=smtp.qq.com
|
||||||
spring.mail.port=587
|
spring.mail.port=587
|
||||||
spring.mail.username=2712495353@qq.com
|
spring.mail.username=2712495353@qq.com
|
||||||
|
|||||||
@ -1,2 +0,0 @@
|
|||||||
INSERT INTO `orm_user`(`id`,`name`,`password`,`salt`,`email`,`phone`) VALUES (1, 'user_1', 'ff342e862e7c3285cdc07e56d6b8973b', '412365a109674b2dbb1981ed561a4c70', 'user1@xkcoding.com', '17300000001');
|
|
||||||
INSERT INTO `orm_user`(`id`,`name`,`password`,`salt`,`email`,`phone`) VALUES (2, 'user_2', '6c6bf02c8d5d3d128f34b1700cb1e32c', 'fcbdd0e8a9404a5585ea4e01d0e4d7a0', 'user2@xkcoding.com', '17300000002');
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
DROP TABLE IF EXISTS `orm_user`;
|
|
||||||
CREATE TABLE `orm_user` (
|
|
||||||
`id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT '主键',
|
|
||||||
`name` VARCHAR(32) NOT NULL UNIQUE COMMENT '用户名',
|
|
||||||
`password` VARCHAR(32) NOT NULL COMMENT '加密后的密码',
|
|
||||||
`salt` VARCHAR(32) NOT NULL COMMENT '加密使用的盐',
|
|
||||||
`email` VARCHAR(32) NOT NULL UNIQUE COMMENT '邮箱',
|
|
||||||
`phone` VARCHAR(15) NOT NULL UNIQUE COMMENT '手机号码',
|
|
||||||
`status` INT(2) NOT NULL DEFAULT 1 COMMENT '状态,-1:逻辑删除,0:禁用,1:启用',
|
|
||||||
`create_time` DATETIME NOT NULL DEFAULT NOW() COMMENT '创建时间',
|
|
||||||
`last_login_time` DATETIME DEFAULT NULL COMMENT '上次登录时间',
|
|
||||||
`last_update_time` DATETIME NOT NULL DEFAULT NOW() COMMENT '上次更新时间'
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Spring Boot Demo Orm 系列示例表';
|
|
||||||
@ -1,28 +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="asia.yulinling.workflow.mapper.UserMapper">
|
|
||||||
<insert id="saveUser">
|
|
||||||
INSERT INTO `orm_user` (`name`,
|
|
||||||
`password`,
|
|
||||||
`salt`,
|
|
||||||
`email`,
|
|
||||||
`phone`,
|
|
||||||
`status`,
|
|
||||||
`create_time`,
|
|
||||||
`last_login_time`,
|
|
||||||
`last_update_time`)
|
|
||||||
VALUES (#{user.name},
|
|
||||||
#{user.password},
|
|
||||||
#{user.salt},
|
|
||||||
#{user.email},
|
|
||||||
#{user.phone},
|
|
||||||
#{user.status},
|
|
||||||
#{user.createTime},
|
|
||||||
#{user.lastLoginTime},
|
|
||||||
#{user.lastUpdateTime})
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<delete id="deleteById">
|
|
||||||
DELETE FROM `orm_user` WHERE id = #{id}
|
|
||||||
</delete>
|
|
||||||
</mapper>
|
|
||||||
@ -1,73 +0,0 @@
|
|||||||
package asia.yulinling.workflow.mapper;
|
|
||||||
|
|
||||||
import asia.yulinling.workflow.WorkFlowMainTests;
|
|
||||||
import asia.yulinling.workflow.entity.User;
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.date.DateTime;
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
|
||||||
import cn.hutool.crypto.SecureUtil;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.test.annotation.Rollback;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 用户Mapper测试
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author yulinling
|
|
||||||
* @since 2025/6/4
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
public class UserMapperTest extends WorkFlowMainTests {
|
|
||||||
@Autowired
|
|
||||||
private UserMapper userMapper;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void selectAllUser() {
|
|
||||||
List<User> users = userMapper.selectAllUser();
|
|
||||||
Assert.assertTrue(CollUtil.isNotEmpty(users));
|
|
||||||
log.info("users={}", users);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void selectUserById() {
|
|
||||||
User user = userMapper.selectUserById(1L);
|
|
||||||
Assert.assertNotNull(user);
|
|
||||||
log.info("user={}", user);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@Transactional
|
|
||||||
@Rollback
|
|
||||||
public void saveUser() {
|
|
||||||
String salt = IdUtil.simpleUUID();
|
|
||||||
User user = User.builder()
|
|
||||||
.name("yulinling_test")
|
|
||||||
.password(SecureUtil.md5("123456" + salt))
|
|
||||||
.salt(salt)
|
|
||||||
.email("2712495353@qq.com")
|
|
||||||
.phone("17770898274")
|
|
||||||
.status(1)
|
|
||||||
.lastLoginTime(new DateTime())
|
|
||||||
.createTime(new DateTime())
|
|
||||||
.lastUpdateTime(new DateTime())
|
|
||||||
.build();
|
|
||||||
|
|
||||||
int i = userMapper.saveUser(user);
|
|
||||||
Assert.assertEquals(1, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@Transactional
|
|
||||||
@Rollback
|
|
||||||
public void deleteById() {
|
|
||||||
int i = userMapper.deleteById(1L);
|
|
||||||
Assert.assertEquals(1, i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -18,7 +18,7 @@ import java.net.URL;
|
|||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @author yulinling
|
* @author yulinling
|
||||||
* @since 2025/6/4
|
* @date 2025/6/4
|
||||||
*/
|
*/
|
||||||
public class EmailServiceTest extends WorkFlowMainTests {
|
public class EmailServiceTest extends WorkFlowMainTests {
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -82,7 +82,7 @@ public class EmailServiceTest extends WorkFlowMainTests {
|
|||||||
/**
|
/**
|
||||||
* 测试附件邮件
|
* 测试附件邮件
|
||||||
*
|
*
|
||||||
* @throws MessagingException 邮件异常
|
* @throws MessagingException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void sendAttachmentsMail() throws MessagingException {
|
public void sendAttachmentsMail() throws MessagingException {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user