Bootstrap

SpringBoot调用mysql操作

IDEA配置SpringBoot项目

SpringBoot实现增删改查

记录功能很简单,创建Controller,然后调用Service中的SQL语句进行增删改查

用到的jar包

//Gson
implementation 'com.google.code.gson:gson:2.8.5'
//json解析
implementation 'org.json:json:20160810'

1. 创建实体类

public class TestBean {
   
    private long id;
    private String userName;
    private String password;
    private int age;
    private String phoneNumber;
    private String headPicture;
    private Date addDate;
    private Date updateDate;
    private int state;

    @Override
    public String toString() {
   
        JSONObject jsonObject = new JSONObject();
        try {
   
            jsonObject.put("id",id);
            jsonObject.put("userName",userName);
            jsonObject.put("password",password);
            jsonObject.put("age",age);
            jsonObject.put("phoneNumber",phoneNumber);
            jsonObject.put("headPicture",headPicture);
            jsonObject.put("addDate",addDate);
            jsonObject.put("updateDate",updateDate);
            jsonObject.put("state",state);
        } catch (JSONException e) 
;