通过实体类操作数据库
保存
创建实体类
import com.litongjava.jfinal.plugin.annotation.ATableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@ATableName("rumi_rmp_professor_rating_tag")
public class RmpProfessorRatingTag {
private Integer id;
private String tagName;
}
使用 Db 类保存数据
RmpProfessorRatingTag bean = new RmpProfessorRatingTag(id, tagName);
boolean save = Db.save(Record.fromBean(bean));