greendao实现增删改查

说明:最近碰到一个需求,在安卓上使用greendao框架,实现增删改查数据

效果图:
在这里插入图片描述

step1:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {repositories {google()jcenter()mavenCentral()}dependencies {classpath "com.android.tools.build:gradle:4.1.2"classpath 'org.greenrobot:greendao-gradle-plugin:3.3.0'// NOTE: Do not place your application dependencies here; they belong// in the individual module build.gradle files}
}allprojects {repositories {google()jcenter()}
}task clean(type: Delete) {delete rootProject.buildDir
}

step2:

plugins {id 'com.android.application'id 'org.greenrobot.greendao'
}android {compileSdkVersion 32defaultConfig {applicationId "com.example.iosdialogdemo"minSdkVersion 16targetSdkVersion 32versionCode 1versionName "1.0"testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"}buildTypes {release {minifyEnabled falseproguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'}}compileOptions {sourceCompatibility JavaVersion.VERSION_1_8targetCompatibility JavaVersion.VERSION_1_8}
}greendao {schemaVersion 7daoPackage 'com.example.iosdialogdemo'targetGenDir 'src/main/java'
}dependencies {implementation 'androidx.appcompat:appcompat:1.1.0'implementation 'com.google.android.material:material:1.1.0'implementation 'androidx.constraintlayout:constraintlayout:1.1.3'testImplementation 'junit:junit:4.+'androidTestImplementation 'androidx.test.ext:junit:1.1.1'androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'implementation 'org.greenrobot:greendao:3.2.2'implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'}

step3:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"package="com.example.iosdialogdemo"><applicationandroid:name=".GreenApp"android:allowBackup="true"android:icon="@mipmap/ic_launcher"android:label="@string/app_name"android:roundIcon="@mipmap/ic_launcher_round"android:supportsRtl="true"android:theme="@style/Theme.IosDialogDemo"><activity android:name=".MainActivity"android:exported="true"><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" /></intent-filter></activity></application></manifest>

step4:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent"android:layout_margin="8dp"android:orientation="vertical"><LinearLayoutandroid:id="@+id/linearLayout2"android:layout_width="match_parent"android:layout_height="wrap_content"android:gravity="center_vertical"android:orientation="horizontal"><EditTextandroid:id="@+id/etLanguage"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_weight="1"android:paddingRight="8dp" /><Buttonandroid:id="@+id/btn_add"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_weight="3"android:backgroundTint="@android:color/holo_purple"android:text="新增"android:textColor="@android:color/white" /><Buttonandroid:id="@+id/btn_update"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_weight="3"android:backgroundTint="@android:color/holo_purple"android:text="修改"android:textColor="@android:color/white" /></LinearLayout><androidx.recyclerview.widget.RecyclerViewandroid:id="@+id/rvLanguage"android:layout_width="match_parent"android:layout_height="match_parent"tools:listitem="@layout/item" /></LinearLayout>

step5:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_marginBottom="16dp"android:gravity="center_vertical"android:orientation="horizontal"><TextViewandroid:id="@+id/tvOrderNumber"android:layout_width="100dp"android:layout_height="wrap_content"android:layout_marginEnd="16dp"android:text="1"android:textColor="@color/white"android:background="@color/purple_200"app:layout_constraintBottom_toBottomOf="@+id/tvLanguage"app:layout_constraintEnd_toStartOf="@+id/tvLanguage"app:layout_constraintHorizontal_bias="0.0"app:layout_constraintHorizontal_chainStyle="spread_inside"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="@+id/tvLanguage" /><TextViewandroid:id="@+id/tvLanguage"android:layout_width="0dp"android:layout_height="wrap_content"android:text="Bahasa"android:textColor="@color/white"android:background="@color/teal_200"app:layout_constraintBottom_toBottomOf="@+id/btnDelete"app:layout_constraintEnd_toStartOf="@+id/btnDelete"app:layout_constraintHorizontal_bias="0.5"app:layout_constraintStart_toEndOf="@+id/tvOrderNumber"app:layout_constraintTop_toTopOf="@+id/btnDelete" /><Buttonandroid:id="@+id/btnDelete"android:layout_width="50dp"android:layout_height="wrap_content"android:text="删除"android:backgroundTint="@android:color/holo_blue_dark"app:layout_constraintBottom_toBottomOf="parent"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintHorizontal_bias="0.5"app:layout_constraintStart_toEndOf="@+id/tvLanguage"app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

step6:

package com.example.iosdialogdemo;import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.util.Log;import org.greenrobot.greendao.AbstractDaoMaster;
import org.greenrobot.greendao.database.StandardDatabase;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseOpenHelper;
import org.greenrobot.greendao.identityscope.IdentityScopeType;// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/*** Master of DAO (schema version 7): knows all DAOs.*/
public class DaoMaster extends AbstractDaoMaster {public static final int SCHEMA_VERSION = 7;/** Creates underlying database table using DAOs. */public static void createAllTables(Database db, boolean ifNotExists) {UserDao.createTable(db, ifNotExists);}/** Drops underlying database table using DAOs. */public static void dropAllTables(Database db, boolean ifExists) {UserDao.dropTable(db, ifExists);}/*** WARNING: Drops all table on Upgrade! Use only during development.* Convenience method using a {@link DevOpenHelper}.*/public static DaoSession newDevSession(Context context, String name) {Database db = new DevOpenHelper(context, name).getWritableDb();DaoMaster daoMaster = new DaoMaster(db);return daoMaster.newSession();}public DaoMaster(SQLiteDatabase db) {this(new StandardDatabase(db));}public DaoMaster(Database db) {super(db, SCHEMA_VERSION);registerDaoClass(UserDao.class);}public DaoSession newSession() {return new DaoSession(db, IdentityScopeType.Session, daoConfigMap);}public DaoSession newSession(IdentityScopeType type) {return new DaoSession(db, type, daoConfigMap);}/*** Calls {@link #createAllTables(Database, boolean)} in {@link #onCreate(Database)} -*/public static abstract class OpenHelper extends DatabaseOpenHelper {public OpenHelper(Context context, String name) {super(context, name, SCHEMA_VERSION);}public OpenHelper(Context context, String name, CursorFactory factory) {super(context, name, factory, SCHEMA_VERSION);}@Overridepublic void onCreate(Database db) {Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION);createAllTables(db, false);}}/** WARNING: Drops all table on Upgrade! Use only during development. */public static class DevOpenHelper extends OpenHelper {public DevOpenHelper(Context context, String name) {super(context, name);}public DevOpenHelper(Context context, String name, CursorFactory factory) {super(context, name, factory);}@Overridepublic void onUpgrade(Database db, int oldVersion, int newVersion) {Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");dropAllTables(db, true);onCreate(db);}}}

step7:

package com.example.iosdialogdemo;import java.util.Map;import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;import com.example.iosdialogdemo.User;import com.example.iosdialogdemo.UserDao;// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT./*** {@inheritDoc}* * @see org.greenrobot.greendao.AbstractDaoSession*/
public class DaoSession extends AbstractDaoSession {private final DaoConfig userDaoConfig;private final UserDao userDao;public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>daoConfigMap) {super(db);userDaoConfig = daoConfigMap.get(UserDao.class).clone();userDaoConfig.initIdentityScope(type);userDao = new UserDao(userDaoConfig, this);registerDao(User.class, userDao);}public void clear() {userDaoConfig.clearIdentityScope();}public UserDao getUserDao() {return userDao;}}

step8:

package com.example.iosdialogdemo;import android.app.Application;
import org.greenrobot.greendao.database.Database;/*** Created by rhodel on 8/15/2017.*/public class GreenApp extends Application {private DaoSession daoSession;@Overridepublic void onCreate() {super.onCreate();DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(this, "notes-db");Database db = helper.getWritableDb();daoSession = new DaoMaster(db).newSession();}@Overridepublic void onTerminate() {super.onTerminate();daoSession.clear();}public DaoSession getDaoSession() {return daoSession;}
}

step9:

package com.example.iosdialogdemo;public interface ILanguageRecycleListener {void itemOnClick(int model,Long id,String title,int position);/* mode1 0:id,1:title,2:delete*/
}

step10:

package com.example.iosdialogdemo;import android.util.Log;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;import androidx.annotation.NonNull;import androidx.recyclerview.widget.RecyclerView;import java.util.ArrayList;import java.util.List;public class LanguageRecycleAdapter extends RecyclerView.Adapter<LanguageViewHolder> {private List<User> languageList = new ArrayList<>();private ILanguageRecycleListener listener;public LanguageRecycleAdapter(List<User> languageList, ILanguageRecycleListener listener) {this.languageList = languageList;this.listener = listener;Log.e("TAG", "LanguageRecycleAdapter " + languageList.size());}public void setData(List<User> languageList2) {this.languageList = languageList2;}@NonNull@Overridepublic LanguageViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {LanguageViewHolder holder;View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item, parent, false);holder = new LanguageViewHolder(view);return holder;}@Overridepublic void onBindViewHolder(@NonNull LanguageViewHolder holder, final int position) {holder.orderNumber.setText(String.valueOf(position));holder.language.setText(languageList.get(position).getName());holder.orderNumber.setText(String.valueOf(languageList.get(position).getId()));holder.btnDelete.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {listener.itemOnClick(2,languageList.get(position).getId(),languageList.get(position).getName(),position);}});holder.orderNumber.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {listener.itemOnClick(0,languageList.get(position).getId(),languageList.get(position).getName(),position);}});holder.language.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {listener.itemOnClick(1,languageList.get(position).getId(),languageList.get(position).getName(),position);}});}@Overridepublic int getItemCount() {return languageList.size();}}

step11:

package com.example.iosdialogdemo;import android.view.View;import android.widget.Button;import android.widget.TextView;import androidx.annotation.NonNull;import androidx.recyclerview.widget.RecyclerView;public class LanguageViewHolder extends RecyclerView.ViewHolder {TextView orderNumber;TextView language;Button btnDelete;public LanguageViewHolder(@NonNull View itemView) {super(itemView);orderNumber = itemView.findViewById(R.id.tvOrderNumber);language = itemView.findViewById(R.id.tvLanguage);btnDelete = itemView.findViewById(R.id.btnDelete);}
}

step12:

package com.example.iosdialogdemo;import androidx.appcompat.app.AppCompatActivity;import androidx.recyclerview.widget.LinearLayoutManager;import androidx.recyclerview.widget.RecyclerView;import android.os.Bundle;import android.util.Log;import android.view.View;import android.widget.Button;import android.widget.EditText;import java.util.ArrayList;import java.util.List;public class MainActivity extends AppCompatActivity implements ILanguageRecycleListener {private LanguageRecycleAdapter languageRecycleAdapter;private RecyclerView rvLanguage;
//    private List<String> languageList = new ArrayList<>();private EditText editText;private Button btn_add,btn_update;private UserDao userDao;private DaoSession daoSession;private List<User> languageList;private Long id2;private String title2;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);daoSession = ((GreenApp) getApplication()).getDaoSession();userDao = daoSession.getUserDao();languageList = new ArrayList<>();if (languageList!=null){languageList.clear();}languageList.addAll(userDao.queryBuilder().list());rvLanguage = findViewById(R.id.rvLanguage);editText= findViewById(R.id.etLanguage);btn_add= findViewById(R.id.btn_add);btn_update= findViewById(R.id.btn_update);RecyclerView.LayoutManager layoutManager = newLinearLayoutManager(this);rvLanguage.setLayoutManager(layoutManager);languageRecycleAdapter = new LanguageRecycleAdapter(languageList, this);rvLanguage.setAdapter(languageRecycleAdapter);btn_add.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {String etString = editText.getText().toString();// languageList.add(etString);User user = new User();user.setName(etString);userDao.insert(user);if (languageList!=null){languageList.clear();}languageList.addAll(userDao.queryBuilder().list());languageRecycleAdapter.setData(languageList);languageRecycleAdapter.notifyDataSetChanged();}});btn_update.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View view) {String etString = editText.getText().toString();// languageList.add(etString);Log.e("TAG", "sql_itemOnClick: " +id2+"==="+title2);User user = new User();user.setName(etString);user.setId(id2);userDao.update(user);if (languageList!=null){languageList.clear();}languageList.addAll(userDao.queryBuilder().list());languageRecycleAdapter.setData(languageList);languageRecycleAdapter.notifyDataSetChanged();}});}@Overridepublic void itemOnClick(int model,Long id, String title,int position) {Log.e("TAG", "itemOnClick: " + id + ", " + position);if (model==2){userDao.deleteByKey(id);if (languageList!=null){languageList.clear();}languageList.addAll(userDao.queryBuilder().list());Log.e("TAG", "sql_itemOnClick: " +languageList);languageRecycleAdapter.setData(languageList);languageRecycleAdapter.notifyDataSetChanged();/*  languageList.remove(position);languageRecycleAdapter.setData(languageList);languageRecycleAdapter.notifyDataSetChanged();*/}else if (model==1){editText.setText(title);id2 = id;title2=title;}}
}

step13:

package com.example.iosdialogdemo;import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Generated;/*** Created by rhodel on 8/15/2017.*/@Entity
public class User {@Id(autoincrement = true)private Long id;private String name;@Generated(hash = 873297011)public User(Long id, String name) {this.id = id;this.name = name;}@Generated(hash = 586692638)public User() {}public Long getId() {return this.id;}public void setId(Long id) {this.id = id;}public String getName() {return this.name;}public void setName(String name) {this.name = name;}
}

step14:

package com.example.iosdialogdemo;import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** * DAO for table "USER".
*/
public class UserDao extends AbstractDao<User, Long> {public static final String TABLENAME = "USER";/*** Properties of entity User.<br/>* Can be used for QueryBuilder and for referencing column names.*/public static class Properties {public final static Property Id = new Property(0, Long.class, "id", true, "_id");public final static Property Name = new Property(1, String.class, "name", false, "NAME");}public UserDao(DaoConfig config) {super(config);}public UserDao(DaoConfig config, DaoSession daoSession) {super(config, daoSession);}/** Creates the underlying database table. */public static void createTable(Database db, boolean ifNotExists) {String constraint = ifNotExists? "IF NOT EXISTS ": "";db.execSQL("CREATE TABLE " + constraint + "\"USER\" (" + //"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id"\"NAME\" TEXT);"); // 1: name}/** Drops the underlying database table. */public static void dropTable(Database db, boolean ifExists) {String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"USER\"";db.execSQL(sql);}@Overrideprotected final void bindValues(DatabaseStatement stmt, User entity) {stmt.clearBindings();Long id = entity.getId();if (id != null) {stmt.bindLong(1, id);}String name = entity.getName();if (name != null) {stmt.bindString(2, name);}}@Overrideprotected final void bindValues(SQLiteStatement stmt, User entity) {stmt.clearBindings();Long id = entity.getId();if (id != null) {stmt.bindLong(1, id);}String name = entity.getName();if (name != null) {stmt.bindString(2, name);}}@Overridepublic Long readKey(Cursor cursor, int offset) {return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);}    @Overridepublic User readEntity(Cursor cursor, int offset) {User entity = new User( //cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // idcursor.isNull(offset + 1) ? null : cursor.getString(offset + 1) // name);return entity;}@Overridepublic void readEntity(Cursor cursor, User entity, int offset) {entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));entity.setName(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));}@Overrideprotected final Long updateKeyAfterInsert(User entity, long rowId) {entity.setId(rowId);return rowId;}@Overridepublic Long getKey(User entity) {if(entity != null) {return entity.getId();} else {return null;}}@Overridepublic boolean hasKey(User entity) {return entity.getId() != null;}@Overrideprotected final boolean isEntityUpdateable() {return true;}}

end

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/17687.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Kubernetes——监听机制与调度约束

目录 前言 一、监听机制 1.Pod启动创建过程 2.调度过程 1.指定调度节点 1.1强制匹配 1.2强制约束 二、硬策略和软策略 1.键值运算关系 1.硬策略——requiredDuringSchedulingIgnoredDuringExecution 2.软策略——preferredDuringSchedulingIgnoredDuringExecution …

QTreeWidget 详解

QTreeWidget 详解 QTreeWidget 是 PyQt5 框架中的一个重要部件&#xff0c;它提供了树形结构的视图&#xff0c;可以用于显示层级数据。以下是 QTreeWidget 的详细讲解&#xff0c;包括基本用法、主要方法和属性以及如何与其他组件进行交互。 基本用法 导入模块 要使用 QTree…

基于单片机的自行车里程监测系统的设计

摘 要 &#xff1a;本设计是一种基于单片机的自行车里程监测系统&#xff0c;采用 STC89C52RC 单片机为核心处理芯片&#xff0c;液晶显示器使用 LCD1602 &#xff0c; 速度测量使用霍尔传感器&#xff0c;温度传感器使用 DS18B20 &#xff0c;时间由时钟芯片 DS1302 进行…

增强创作者能力:The Sandbox 首届 “创作者挑战” 回顾

首届 "创作者挑战" 为创作者在平台上赚取收入提供了难得机会。 我们发起 “创作者挑战” 的目的是支持创作者&#xff0c;赋予他们构建元宇宙的能力。我们提出三大行动号召&#xff1a;发布、参与和赚钱。新推出的「参与奖池」&#xff08;Engagement Pool&#xff0…

云计算-Amazon S3

亚马逊S3&#xff08;Amazon S3&#xff09; 亚马逊S3是一种云对象存储设施。我们将使用的对象将是您在个人计算机上常用的文件。亚马逊S3产品旨在可扩展到实际无限数量的对象和无限大小的对象&#xff0c;但我们在本实验室的练习中只会使用少量对象。当存储许多对象时&#xf…

OpenCV学习 基础图像操作(十四):直方图均衡化和直方图规定化

基础原理 直方图操作是基于像素统计的基础图像操作,被广泛运用于调整图像的对比度,并由此衍生出很多变种和该经的方式. 图像相直方图 直方图(Histogram)&#xff0c;又称质量分布图&#xff0c;是一种统计报告图&#xff0c;由一系列高度不等的纵向条纹或线段表示数据分布的…

【强训笔记】day24

NO.1 思路&#xff1a;递归。 代码实现&#xff1a; class Solution { public:bool IsBalanced_Solution(TreeNode* pRoot) {return dfs(pRoot)!-1;}int dfs(TreeNode* root){if(rootnullptr) return 0;int leftdfs(root->left);if(left-1) return -1;int rightdfs(root-…

Vulnhub - AI-WEB-1.0靶机教程

目录 站点信息收集 c段扫描 端口扫描 目录扫描 漏洞利用 使用 burp 抓包 查询数据库名 查询数据库下的表 查询表中的字段名 查询字段中的数据 --os-shell 上传一句话木马 下载地址&#xff1a;https://download.vulnhub.com/aiweb/AI-Web-1.0.7z 我们从站点信息收…

【哈希】闭散列的线性探测和开散列的哈希桶解决哈希冲突(C++两种方法模拟实现哈希表)(1)

&#x1f389;博主首页&#xff1a; 有趣的中国人 &#x1f389;专栏首页&#xff1a; C进阶 &#x1f389;其它专栏&#xff1a; C初阶 | Linux | 初阶数据结构 小伙伴们大家好&#xff0c;本片文章将会讲解 哈希函数与哈希 之 闭散列的线性探测解决哈希冲突 的相关内容。 如…

Echarts圆环图偏移后 中心文字居中对齐实现

像上图中这样圆环图并不在div的中间时&#xff0c;中心的文本需要居中展示 一开始用left百分比但数据一旦变长或变短就会偏移 像这样 实在是太不美观了 所以我们这里使用动态的left通过文本的长度来计算 /*** 计算文本宽度* param {String|Number} text* param {String} font*…

js之图片上传

话不多说&#xff0c;直接上干货&#xff0c;注释在代码里面 下面是效果图和代码 <!DOCTYPE html> <html lang"zh"><head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-sca…

[算法][数字][leetcode]2769.找出最大的可达成数字

题目地址 https://leetcode.cn/problems/find-the-maximum-achievable-number/description/ 题目描述 实现代码 class Solution {public int theMaximumAchievableX(int num, int t) {return num2*t;} }

第97天:权限提升-Web 权限权限划分源码后台中间件第三方数据库等

前置知识 具体有哪些权限需要我们了解掌握的 后台权限&#xff0c;网站权限&#xff0c;数据库权限&#xff0c;接口权限&#xff0c;系统权限&#xff0c;域控权限等 以上常见权限获取方法简要归类说明 后台权限&#xff1a;SQL 注入,数据库备份泄露&#xff0c;默认或弱口…

Python | Leetcode Python题解之第104题二叉树的最大深度

题目&#xff1a; 题解&#xff1a; class Solution:def maxDepth(self, root: TreeNode) -> int:if not root: return 0queue, res [root], 0while queue:tmp []for node in queue:if node.left: tmp.append(node.left)if node.right: tmp.append(node.right)queue tmp…

Mybatis入门——其他查询操作和数据库连接池(4)

目录 一、多表查询 二、#{} 和 ${} 1、#{} 和 ${} 的使用 &#xff08;1&#xff09;Integer类型的参数 #{} 的使用 ${} 的使用 &#xff08;2&#xff09;使用String类型的参数 #{} 的使用 ${} 的使用 小结&#xff1a; 2、#{} 和 ${} 的区别 &#xff08;1&#…

太阳能语音监控杆(球机LED款)有什么用

传统监控设备依赖电力支持&#xff0c;在偏远地区和没有网络地区难以发挥其作用&#xff0c;而鼎跃安全的太阳能语音监控杆&#xff08;球机LED款&#xff09;在传统监控基础上&#xff0c;进行了全面优化&#xff0c;解决了无电无网区域使用受限的问题。 太阳能语音监控杆&am…

RSC英国皇家化学学会文献查找下载

英国皇家化学学会(Royal Society of Chemistry&#xff0c;简称RSC)是以促进全球化学领域研究发展与传播为宗旨的国际权威学术机构&#xff0c;是化学信息的一个重要宣传机关和出版商。RSC出版的期刊是化学领域的核心期刊&#xff0c;大部分被SCI和MEDLINE收录&#xff0c;如An…

腾讯云联络中心ivr调用自定义接口

1&#xff0c;java代码&#xff1a;http接口 RequestMapping(value "/getMsg5", method RequestMethod.POST) public Map<String, String> index(RequestBody Map<String, String> params) {String id params.get("id");HashMap<String…

渗透测试工具Cobalt strike-1.CS介绍与配置

Cobalt Strike是一款美国Red Team开发的渗透测试神器&#xff0c;常被业界人称为CS。最近这个工具大火&#xff0c;成为了渗透测试中不可缺少的利器。其拥有多种协议主机上线方式&#xff0c;集成了提权&#xff0c;凭据导出&#xff0c;端口转发&#xff0c;socket代理&#x…

目前无法解释的6个物理问题,每一个都困扰科学家很长时间

人类已经对宇宙有了大概的认知&#xff0c;不过即便如此&#xff0c;在宇宙中还有很多我们无法解释的物理问题&#xff0c;下面我们就一起来看看。 第一个无法解释的物理问题——虫洞真的存在吗&#xff1f; 虫洞最早是1916年由奥地利物理学家路德维希.费莱姆首次提出的&#…