Skip to content

Commit

Permalink
Dev (#303)
Browse files Browse the repository at this point in the history
* Refactor/replace deprecated usage (#236)

* chore: 修正README锚点不跳转的问题

* fix:#190

* fix:#184

* chore(deps-dev): bump freemarker from 2.3.30 to 2.3.31

Bumps freemarker from 2.3.30 to 2.3.31.

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps): bump lin-cms-spring-boot-starter

Bumps [lin-cms-spring-boot-starter](https://github.com/TaleLin/lin-cms-java-core) from 0.2.0-RC2 to 0.2.0-RELEASE.
- [Release notes](https://github.com/TaleLin/lin-cms-java-core/releases)
- [Commits](https://github.com/TaleLin/lin-cms-java-core/commits)

Signed-off-by: dependabot[bot] <[email protected]>

* Chore/upgrade version (#200)

* chore: 修正README锚点不跳转的问题

* fix:#190

* fix:#184

* chore: 升级主工程以及核心库版本号

Co-authored-by: ToWeLong <[email protected]>

* chore(deps): bump spring-boot-starter-parent from 2.4.3 to 2.5.0

Bumps [spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 2.4.3 to 2.5.0.
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](spring-projects/spring-boot@v2.4.3...v2.5.0)

Signed-off-by: dependabot[bot] <[email protected]>

* Dev (#226)

* chore(deps): bump spring-boot-starter-parent from 2.5.0 to 2.5.2 (#220)

Bumps [spring-boot-starter-parent](https://github.com/spring-projects/spring-boot) from 2.5.0 to 2.5.2.
- [Release notes](https://github.com/spring-projects/spring-boot/releases)
- [Commits](spring-projects/spring-boot@v2.5.0...v2.5.2)

---
updated-dependencies:
- dependency-name: org.springframework.boot:spring-boot-starter-parent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* refactor: optimize ci action config

* Update maven.yml

* Update maven.yml

* fix issue #131

* chore(deps): bump qiniu-java-sdk from 7.4.0 to 7.8.0

Bumps [qiniu-java-sdk](https://github.com/qiniu/java-sdk) from 7.4.0 to 7.8.0.
- [Release notes](https://github.com/qiniu/java-sdk/releases)
- [Changelog](https://github.com/qiniu/java-sdk/blob/master/CHANGELOG.md)
- [Commits](qiniu/java-sdk@v7.4.0...v7.8.0)

---
updated-dependencies:
- dependency-name: com.qiniu:qiniu-java-sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Chore/replace expired configurations (#222)

* chore: 修正README锚点不跳转的问题

* fix:#190

* fix:#184

* chore: 替换过期的配置项

* test: 临时解决 CI 单元测试异常(原因未明)

Co-authored-by: ToWeLong <[email protected]>
Co-authored-by: 华钦 <[email protected]>

* Docs/upgrade readme (#225)

* chore: 修正README锚点不跳转的问题

* fix:#190

* fix:#184

* docs: 更新 readme 中 springboot 版本号

Co-authored-by: ToWeLong <[email protected]>
Co-authored-by: 华钦 <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dengliming <[email protected]>
Co-authored-by: fuhao <[email protected]>
Co-authored-by: ToWeLong <[email protected]>
Co-authored-by: 华钦 <[email protected]>

* refactor: 替换jackson已过期的配置引用

Co-authored-by: ToWeLong <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: 华钦 <[email protected]>
Co-authored-by: dengliming <[email protected]>
Co-authored-by: fuhao <[email protected]>

* chore(pom.xml): 升级框架版本为0.2.1-RELEASE

* fix #223 & test去除deprecated api等问题修复

* fix: #247

* fix: 反代后IP获取错误

* feat: 登录验证码

* fix: 无用字段

* fix: 不开启验证码时要求header的错误

* fix: sout clean

* fix: aes192 to 256

* fix: 修复错误修改的配置

* fix: 增加aes配置校验,避免输入参数不合法

* fix: 部分情况下fileMap.size()不可靠&校验信息不需要${}

* fix: 属性前缀

* fix: fix #264

配置文件中未配置字段时,spring不会调用set方法

* chore(application-dev.yml): 默认关闭验证码

* refactor: 数据库新增 is_deleted 字段,作为删除标识

Co-authored-by: ToWeLong <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: 华钦 <[email protected]>
Co-authored-by: dengliming <[email protected]>
Co-authored-by: fuhao <[email protected]>
Co-authored-by: Gadfly <[email protected]>
  • Loading branch information
7 people authored Nov 20, 2022
1 parent faccb4b commit 417a3e4
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,17 @@ public class LoginCaptchaProperties {
/**
* aes 密钥
*/
private String secret;
private String secret = CaptchaUtil.getRandomString(32);
/**
* aes 偏移量
*/
private String iv;
private String iv = CaptchaUtil.getRandomString(16);
/**
* 启用验证码
*/
private Boolean enabled = Boolean.FALSE;

public void setSecret(String secret) {
this.secret = CaptchaUtil.getRandomString(32);
if (StringUtils.hasText(secret)) {
byte[] bytes = secret.getBytes();
if (bytes.length == 16 || bytes.length == 24 || bytes.length == 32) {
Expand All @@ -43,7 +42,6 @@ public void setSecret(String secret) {
}

public void setIv(String iv) {
this.iv = CaptchaUtil.getRandomString(16);
if (StringUtils.hasText(iv)) {
byte[] bytes = iv.getBytes();
if (bytes.length == 16) {
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/io/github/talelin/latticy/model/BaseModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ public class BaseModel {
@JsonIgnore
private Date updateTime;

@TableLogic
@JsonIgnore
private Date deleteTime;

@TableLogic
@JsonIgnore
private Boolean isDeleted;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger;

/**
* 文件上传类的基类
Expand Down Expand Up @@ -128,7 +129,13 @@ protected void checkFileMap(MultiValueMap<String, MultipartFile> fileMap) {
throw new NotFoundException(10026);
}
int nums = getFileProperties().getNums();
if (fileMap.size() > nums) {
AtomicInteger sizes = new AtomicInteger();
fileMap.keySet().forEach(key -> fileMap.get(key).forEach(file -> {
if (!file.isEmpty()) {
sizes.getAndIncrement();
}
}));
if (sizes.get() > nums) {
throw new FileTooManyException(10121);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/ValidationMessages.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# \u901A\u7528\u5F02\u5E38\u4FE1\u606F
id.positive=id\u5FC5\u987B\u4E3A\u6B63\u6574\u6570
page.count.min=\u5206\u9875\u6570\u91CF\u5FC5\u987B\u4E3A\u6B63\u6574\u6570
page.count.max=\u5206\u9875\u6570\u91CF\u5FC5\u987B\u5C0F\u4E8E${value}
page.count.max=\u5206\u9875\u6570\u91CF\u5FC5\u987B\u5C0F\u4E8E{value}
page.number.min=\u5206\u9875\u9875\u7801\u5FC5\u987B\u4E3A\u6B63\u6574\u6570
# \u5206\u7EC4\u5F02\u5E38\u4FE1\u606F
group.id.positive=\u5206\u7EC4id\u5FC5\u987B\u4E3A\u6B63\u6574\u6570
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ auth:

# 开启登录要求验证码
login-captcha:
enabled: true
enabled: false
secret: "m49CPM5ak@MDXTzbbT_ZEyMM3KBsBn!h"

# 开启http请求日志记录
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ mybatis-plus:
banner: false
db-config:
# 逻辑删除(软删除)
logic-delete-value: NOW()
logic-not-delete-value: 'NULL'
logic-delete-value: 1
logic-not-delete-value: 0
# mapper路径位置
mapper-locations: classpath:mapper/*.xml

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/code-message.properties
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ code-message[10080]=\u8BF7\u6C42\u65B9\u6CD5\u4E0D\u5141\u8BB8
code-message[10100]=\u5237\u65B0\u4EE4\u724C\u83B7\u53D6\u5931\u8D25
code-message[10110]=\u6587\u4EF6\u4F53\u79EF\u8FC7\u5927
code-message[10120]=\u6587\u4EF6\u6570\u91CF\u8FC7\u591A
code-message[10121]=\u6587\u4EF6\u592A\u591A\uFF0C\u6587\u4EF6\u603B\u6570\u4E0D\u53EF\u8D85\u8FC7${file.nums}
code-message[10121]=\u6587\u4EF6\u592A\u591A\uFF0C\u6587\u4EF6\u603B\u6570\u4E0D\u53EF\u8D85\u8FC7${lin.file.nums}
code-message[10130]=\u6587\u4EF6\u6269\u5C55\u540D\u4E0D\u7B26\u5408\u89C4\u8303
code-message[10140]=\u8BF7\u6C42\u8FC7\u4E8E\u9891\u7E41\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5
code-message[10150]=\u4E22\u5931\u53C2\u6570
Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/mapper/BookMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="delete_time" jdbcType="TIMESTAMP" property="deleteTime"/>
<result column="is_deleted" property="isDeleted"/>
</resultMap>

<!--CONCAT("%",#{q},"%")-->
Expand All @@ -20,14 +21,14 @@
WHERE
b.title LIKE #{q}
AND
b.delete_time IS NULL
b.is_deleted = 0
</select>

<select id="selectByTitle" resultMap="BaseResultMap">
SELECT *
FROM book b
WHERE b.title=#{title}
AND
b.delete_time IS NULL
b.is_deleted = 0
</select>
</mapper>
5 changes: 3 additions & 2 deletions src/main/resources/mapper/FileMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,23 @@
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="delete_time" property="deleteTime"/>
<result column="is_deleted" property="isDeleted"/>
</resultMap>

<select id="selectByMd5" parameterType="java.lang.String" resultMap="BaseResultMap">
SELECT *
FROM lin_file f
WHERE
f.md5 = #{md5}
AND f.delete_time IS NULL
AND f.is_deleted = 0
</select>

<select id="selectCountByMd5" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM lin_file f
WHERE
f.md5 = #{md5}
AND f.delete_time IS NULL
AND f.is_deleted = 0
</select>

</mapper>
14 changes: 7 additions & 7 deletions src/main/resources/mapper/GroupMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<result column="level" property="level" typeHandler="com.baomidou.mybatisplus.core.handlers.MybatisEnumTypeHandler"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="delete_time" property="deleteTime"/>
<result column="is_deleted" property="isDeleted"/>
</resultMap>


Expand All @@ -19,7 +19,7 @@
g.create_time,g.update_time,g.delete_time
from lin_group AS g
WHERE
g.delete_time IS NULL
g.is_deleted = 0
AND
g.id IN
(
Expand All @@ -28,15 +28,15 @@
LEFT JOIN lin_user_group as ug
ON ug.user_id = u.id
WHERE u.id = #{userId}
AND u.delete_time IS NULL
AND u.is_deleted = 0
)
</select>

<select id="selectUserGroupIds" parameterType="java.lang.Integer" resultType="java.lang.Integer">
SELECT g.id
from lin_group AS g
WHERE
g.delete_time IS NULL
g.is_deleted = 0
AND
g.id IN
(
Expand All @@ -45,12 +45,12 @@
LEFT JOIN lin_user_group as ug
ON ug.user_id = u.id
WHERE u.id = #{userId}
AND u.delete_time IS NULL
AND u.is_deleted = 0
)
</select>

<select id="selectCountById" parameterType="java.lang.Integer" resultType="java.lang.Integer">
SELECT COUNT(*) AS count FROM lin_group WHERE delete_time IS NULL AND id = #{id}
SELECT COUNT(*) AS count FROM lin_group WHERE is_deleted = 0 AND id = #{id}
</select>

<select id="selectCountUserByUserIdAndGroupName" resultType="java.lang.Integer">
Expand All @@ -60,7 +60,7 @@
ug.user_id = #{userId}
AND
ug.group_id =
(SELECT g.id FROM lin_group AS g WHERE g.name = #{groupName} AND g.delete_time IS NULL)
(SELECT g.id FROM lin_group AS g WHERE g.name = #{groupName} AND g.is_deleted = 0)
</select>

</mapper>
7 changes: 4 additions & 3 deletions src/main/resources/mapper/LogMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="delete_time" property="deleteTime"/>
<result column="is_deleted" property="isDeleted"/>
</resultMap>

<select id="findLogsByUsernameAndRange" resultType="io.github.talelin.latticy.model.LogDO">
SELECT l.* FROM lin_log l
WHERE l.delete_time IS NULL
WHERE l.is_deleted = 0
<if test="name != null">
AND l.username=#{name}
</if>
Expand All @@ -31,7 +32,7 @@

<select id="searchLogsByUsernameAndKeywordAndRange" resultType="io.github.talelin.latticy.model.LogDO">
SELECT l.* FROM lin_log l
WHERE l.delete_time IS NULL
WHERE l.is_deleted = 0
<if test="name != ''">
AND l.username=#{name}
</if>
Expand All @@ -47,7 +48,7 @@
<select id="getUserNames" resultType="java.lang.String">
SELECT l.username
FROM lin_log l
WHERE l.delete_time IS NULL
WHERE l.is_deleted = 0
GROUP BY l.username
HAVING COUNT(l.username) > 0
</select>
Expand Down
7 changes: 4 additions & 3 deletions src/main/resources/mapper/PermissionMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="delete_time" property="deleteTime"/>
<result column="is_deleted" property="isDeleted"/>
</resultMap>

<select id="selectPermissionsByGroupIds" parameterType="java.util.List"
resultMap="BaseResultMap">
SELECT p.id, p.name, p.module, p.mount,
p.create_time, p.update_time, p.delete_time
FROM lin_permission AS p
WHERE p.delete_time IS NULL
WHERE p.is_deleted = 0
AND p.mount = true
AND p.id IN (
SELECT gp.permission_id
Expand All @@ -36,7 +37,7 @@
SELECT p.id, p.name, p.module, p.mount,
p.create_time, p.update_time, p.delete_time
FROM lin_permission AS p
WHERE p.delete_time IS NULL
WHERE p.is_deleted = 0
AND p.module = #{module}
AND p.mount = true
AND p.id IN (
Expand All @@ -55,7 +56,7 @@
SELECT p.id, p.name, p.module, p.mount,
p.create_time, p.update_time, p.delete_time
FROM lin_permission AS p
WHERE p.delete_time IS NULL
WHERE p.is_deleted = 0
AND p.mount = true
AND p.id IN (
SELECT gp.permission_id
Expand Down
7 changes: 4 additions & 3 deletions src/main/resources/mapper/UserMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="delete_time" property="deleteTime"/>
<result column="is_deleted" property="isDeleted"/>
</resultMap>

<select id="selectCountByUsername" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT COUNT(*) FROM lin_user as u WHERE u.username = #{username} AND u.delete_time IS NULL
SELECT COUNT(*) FROM lin_user as u WHERE u.username = #{username} AND u.is_deleted = 0
</select>

<select id="selectCountById" parameterType="java.lang.Integer" resultType="java.lang.Integer">
SELECT COUNT(*) FROM lin_user as u WHERE u.id = #{id} AND u.delete_time IS NULL
SELECT COUNT(*) FROM lin_user as u WHERE u.id = #{id} AND u.is_deleted = 0
</select>

<select id="selectPageByGroupId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
Expand All @@ -34,7 +35,7 @@
WHERE ug.group_id = #{groupId}
AND ug.group_id != #{rootGroupId}
)
AND u.delete_time IS NULL
AND u.is_deleted = 0
</select>

</mapper>
19 changes: 13 additions & 6 deletions src/main/resources/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ CREATE TABLE lin_file
create_time datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
update_time datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
delete_time datetime(3) DEFAULT NULL,
is_deleted tinyint(1) DEFAULT 0,
PRIMARY KEY (id),
UNIQUE KEY md5_del (md5, delete_time)
) ENGINE = InnoDB
Expand All @@ -40,6 +41,7 @@ CREATE TABLE lin_log
create_time datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
update_time datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
delete_time datetime(3) DEFAULT NULL,
is_deleted tinyint(1) DEFAULT 0,
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
Expand All @@ -57,7 +59,8 @@ CREATE TABLE lin_permission
mount tinyint(1) NOT NULL DEFAULT 1 COMMENT '0:关闭 1:开启',
create_time datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
update_time datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
delete_time datetime(3) DEFAULT NULL,
delete_time datetime(3) DEFAULT NULL,
is_deleted tinyint(1) DEFAULT 0,
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
Expand All @@ -76,6 +79,7 @@ CREATE TABLE lin_group
create_time datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
update_time datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
delete_time datetime(3) DEFAULT NULL,
is_deleted tinyint(1) DEFAULT 0,
PRIMARY KEY (id),
UNIQUE KEY name_del (name, delete_time)
) ENGINE = InnoDB
Expand Down Expand Up @@ -111,6 +115,7 @@ CREATE TABLE lin_user
create_time datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
update_time datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
delete_time datetime(3) DEFAULT NULL,
is_deleted tinyint(1) DEFAULT 0,
PRIMARY KEY (id),
UNIQUE KEY username_del (username, delete_time),
UNIQUE KEY email_del (email, delete_time)
Expand All @@ -120,11 +125,11 @@ CREATE TABLE lin_user

-- ----------------------------
-- 用户授权信息表
# id
# user_id
# identity_type 登录类型(手机号 邮箱 用户名)或第三方应用名称(微信 微博等)
# identifier 标识(手机号 邮箱 用户名或第三方应用的唯一标识)
# credential 密码凭证(站内的保存密码,站外的不保存或保存token)
-- id
-- user_id
-- identity_type 登录类型(手机号 邮箱 用户名)或第三方应用名称(微信 微博等)
-- identifier 标识(手机号 邮箱 用户名或第三方应用的唯一标识)
-- credential 密码凭证(站内的保存密码,站外的不保存或保存token)
-- ----------------------------
DROP TABLE IF EXISTS lin_user_identity;
CREATE TABLE lin_user_identity
Expand All @@ -137,6 +142,7 @@ CREATE TABLE lin_user_identity
create_time datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
update_time datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
delete_time datetime(3) DEFAULT NULL,
is_deleted tinyint(1) DEFAULT 0,
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
Expand Down Expand Up @@ -172,6 +178,7 @@ CREATE TABLE book
create_time datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
update_time datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
delete_time datetime(3) DEFAULT NULL,
is_deleted tinyint(1) DEFAULT 0,
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
Expand Down
Loading

0 comments on commit 417a3e4

Please sign in to comment.