Skip to content

Commit

Permalink
save1
Browse files Browse the repository at this point in the history
  • Loading branch information
markliu2013 committed May 2, 2024
1 parent 56209a2 commit a6fe02d
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 1 deletion.
31 changes: 31 additions & 0 deletions notes/data_backup.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
1. 使用phpmyadmin的导入导出功能。
2. 备份文件夹

要把存储引擎改为 MyISAM。
先把docker里面的 var/lib/mysql/moneynote 文件夹捞出来
https://docker.easydoc.net/doc/81170005/cCewZWoN/XQEqNjiu

docker run --rm --volumes-from moneynote -v .:/backup ubuntu bash -c "cd /var/lib/mysql && tar -xzvf /backup/moneynote.tar.gz"
下载moneynote.tar.gz

在目标机器运行moneynote all
运行起来之后在phpmyadmin,删掉moneynote数据库,重新创建,为了把spring boot自动建的表清空。
在包含moneynote.tar.gz的目录执行:
docker run --rm --volumes-from moneynote -v .:/backup ubuntu bash -c "cd /var/lib/mysql && mkdir m_temp && cd m_temp && tar -xzvf /backup/moneynote.tar.gz"

在phpmyadmin查看
show variables like 'secure_file_priv';
UNLOCK TABLES;

进入moneynote容器的命令行
cp /var/lib/mysql/m_temp/moneynote/*.MYI /var/lib/mysql/moneynote
cp /var/lib/mysql/m_temp/moneynote/*.MYD /var/lib/mysql/moneynote
cp /var/lib/mysql/m_temp/moneynote/*.sdi /var/lib/mysql-files
chmod -R 777 /var/lib/mysql-files

https://www.xiebruce.top/689.html

import table from '/var/lib/mysql-files/*.sdi';

如果出现table is readonly
chown -R mysql:mysql /var/lib/mysql/moneynote
2 changes: 1 addition & 1 deletion src/main/java/cn/biq/mn/TestController.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class TestController {

@RequestMapping(method = RequestMethod.GET, value = "/version")
public BaseResponse handleVersion() {
return new DataResponse<>("93.61");
return new DataResponse<>("93.62");
}

@GetMapping("/test3")
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/cn/biq/mn/account/AccountController.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,10 @@ public BaseResponse handleOverview() {
return new DataResponse<>(accountService.overview());
}

@RequestMapping(method = RequestMethod.PUT, value = "/{id}/updateNotes")
public BaseResponse handleUpdateNotes(@PathVariable("id") int id, @Valid @RequestBody AccountUpdateNotesForm form) {
accountService.updateNotes(id, form);
return new BaseResponse(true);
}

}
7 changes: 7 additions & 0 deletions src/main/java/cn/biq/mn/account/AccountService.java
Original file line number Diff line number Diff line change
Expand Up @@ -285,4 +285,11 @@ public List<Account> getDebts() {
return debtAccounts;
}

public void updateNotes(int id, AccountUpdateNotesForm form) {
Group group = sessionUtil.getCurrentGroup();
Account entity = baseService.findAccountById(id);
entity.setNotes(form.getNotes());
accountRepository.save(entity);
}

}
14 changes: 14 additions & 0 deletions src/main/java/cn/biq/mn/account/AccountUpdateNotesForm.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package cn.biq.mn.account;

import cn.biq.mn.validation.NotesField;
import lombok.Getter;
import lombok.Setter;


@Getter @Setter
public class AccountUpdateNotesForm {

@NotesField
private String notes;

}

0 comments on commit a6fe02d

Please sign in to comment.