The bookkeeping book of springboot


The bookkeeping book of springboot

Yesterday, I read Rego’s tutorial and wrote a simple bookkeeping book to practice. I didn’t put my notes down on my blog. I made it up today. Let’s get to the point.

As the old rule, let’s take a look at the directory structure of the project and the login interface

I won’t go into details about what each bag meansThe bookkeeping book of springboot
login interface:
The bookkeeping book of springboot

1、 Preparatory work

Create database
The bookkeeping book of springboot

2、 Generating code

Add the corresponding POM dependency, modify the YML file, and the corresponding VO (domain), mapper, service, controller, and mapper mapping file)

3、 Import resource file

The bookkeeping book of springboot

4、 Complete login

  1. Create resultobj
public class ResultObj {

    //Service response code
    private int code;
    //Business News
    private String msg;
  1. Create logincontroller (too much code, I won’t give you more details here)
public class LoginController {

    private UserService userService;

     *Jump to landing page
    public String toLogin() {
        return "login";
  1. Create static/ index.html (there are too many codes, which will not be detailed here.)
<!DOCTYPE html>
<meta charset="UTF-8">
<title>Insert title here</title>

    <script type="text/javascript">
  1. Create templates/ login.html
  2. Create templates/ list.html

(the above two codes are too long to repeat. They will be uploaded at the same time. Please contact me if you need it urgently.)

5、 Bill list (the code is no longer given here. It is too redundant, and the code will be uploaded later)

  1. Create DataGridView
public class DataGridView {

    private Long code=0L;
    private String msg="";
    private Long count;
    private Object data;
    public DataGridView(Long count,Object data){
  1. Create mybatisplusconfig
 *Configuration class of mybatisplus (paging)
@ConditionalOnClass(value = {PaginationInterceptor.class})
public class MybatisPlusConfig {

    public PaginationInterceptor paginationInterceptor(){
        return new PaginationInterceptor();
  1. Create billscontroller
public class BillsController {

    private BillsService billsService;

    private BilltypeService billtypeService;

     *Jump to system home page
    public String toBillsList(){
        return "list";

     *Load billing data
    public DataGridView loadAllBills(BillsVo billsVo){
        //The paging plug-in is used here
        IPage<Bills> page=new Page<>(billsVo.getPage(),billsVo.getLimit());
        QueryWrapper<Bills> queryWrapper=new QueryWrapper<>();
        //Equal to
        //Greater than!=null,"billtime",billsVo.getStartDate());
        //Less than

        List<Bills> records=page.getRecords();
        for (Bills bills:records){
            Billtype billtype=this.billtypeService.getById(bills.getTypeid());
        return new DataGridView(page.getTotal(),records);

     *Add bill
    public ResultObj addBills(BillsVo billsVo){
        try {
            Return new resultobj (200, "entered successfully");
        } catch (Exception e) {
            Return new resultobj (- 1, "entry failed");
  1. Create bills
  2. Create billsvo
  3. Create billstypeserviceimpl
  4. Creating cache processing facet classes
  5. Add dependencies
  6. Create billtypecontroller
  7. establish list.html

6、 Add bill

  1. modify list.html
  2. Modify billscontroller
7、 This article talks about mapper (Dao layer), service, serviceimpl, and xxxMapper.xml The file, which is not mentioned here, is not without it. It is only operated through mybatis plus using the interface, which saves the step of writing your own code. This article will not introduce it any more, and will write a special article for recording later.

8、 Look at the effect:

The bookkeeping book of springboot
Add record:
The bookkeeping book of springboot

9、 That’s about it. By the way, the project uses mybatis plus and hutool toolkit. Many places use interfaces, so you don’t have to write your own code. After that, I will write a blog about mybatis plus and hutool toolkit. I hope you can pay attention to it! thank you!

Tianya Zhi

Recommended Today

P3120 [USACO15FEB]Cow Hopscotch G

portal ideas A simple idea is a\(O(n^2m^2)\)transfer of: \[f_{i,j}=\sum_{x=1}^{i-1}\sum_{y=1}^{j-1}f_{x,y}*[a_{i,j}!=a_{x,y}] \] There are so many constraints, thinking about using cdq divide and conquer to optimize we consider theRowdivide and conquer\([l,mid]\) Then brute force enumerationList,use\([l,mid]\)to update\((mid,r]\) enumerate columns each time\(j\)After the transfer, the\(\sum_{i=l}^{mid}f_{i,j}\)add to\(sum\), and update\(s[a_{i,j}]\)(used to subtract the contribution of the same number) The equation for […]