Merge pull request '添加功能:查询快件' (#9) from Fanyiwen_branch into dev
commit
13c0def691
@ -0,0 +1,57 @@
|
|||||||
|
package com.example.logistics.dao;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.example.logistics.entity.User;
|
||||||
|
import com.example.logistics.tools.DBOpenHelper;
|
||||||
|
import com.example.logistics.tools.MD5Utils;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class operationDao {
|
||||||
|
private static final String TAG = "operationDao";
|
||||||
|
|
||||||
|
public boolean add(String pickupcode, String phonenum){
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
|
||||||
|
Connection connection = DBOpenHelper.getConn();
|
||||||
|
try{
|
||||||
|
SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
|
||||||
|
|
||||||
|
Date date = new Date();
|
||||||
|
|
||||||
|
String time = format1.format(date);
|
||||||
|
|
||||||
|
String sql = "insert into operations(pickupcode, phonenum, time) values (?,?,?)";
|
||||||
|
|
||||||
|
if(connection != null){
|
||||||
|
PreparedStatement ps = connection.prepareStatement(sql);
|
||||||
|
|
||||||
|
if(ps != null){
|
||||||
|
ps.setString(1, pickupcode);
|
||||||
|
ps.setString(2, phonenum);
|
||||||
|
ps.setString(3, time);
|
||||||
|
|
||||||
|
int rs = ps.executeUpdate();
|
||||||
|
if(rs > 0){
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
Log.e(TAG, "异常 add operation");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.example.logistics.entity;
|
||||||
|
|
||||||
|
import android.provider.ContactsContract;
|
||||||
|
|
||||||
|
public class Operation {
|
||||||
|
private int id;
|
||||||
|
private String pickUpCode;
|
||||||
|
private String phoneNum;
|
||||||
|
private String time;
|
||||||
|
|
||||||
|
public Operation(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId(){
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id){
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPickUpCode(){
|
||||||
|
return pickUpCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPickUpCode(String PickUpCode){
|
||||||
|
this.pickUpCode = PickUpCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhoneNum(){
|
||||||
|
return phoneNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhoneNum(String PhoneNum){
|
||||||
|
this.phoneNum = PhoneNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTime(){
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTime(String time){
|
||||||
|
this.time = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in new issue