Commit 27732b86 by 宁斌

拆分database模塊

parent e75ec7a3
...@@ -3,7 +3,6 @@ apply from: rootProject.file("cc-settings.gradle") ...@@ -3,7 +3,6 @@ apply from: rootProject.file("cc-settings.gradle")
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.jakewharton.butterknife' apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'org.greenrobot.greendao'
apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-kapt'
android { android {
...@@ -47,22 +46,6 @@ android { ...@@ -47,22 +46,6 @@ android {
proguardFiles 'proguard.cfg' proguardFiles 'proguard.cfg'
} }
} }
greendao {
/**
* 版本号
*/
schemaVersion 20
/**
* greendao输出dao的数据库操作实体类文件夹(相对路径 包名+自定义路径名称,包将创建于包名的直接路径下)
*/
daoPackage 'com.gingersoft.gsa.cloud.database.greendao'
/**
* greenDao实体类包文件夹
*/
targetGenDir 'src/main/java'
generateTests false //设置为true以自动生成单元测试。
}
sourceSets { sourceSets {
main { main {
...@@ -109,9 +92,6 @@ dependencies { ...@@ -109,9 +92,6 @@ dependencies {
androidTestImplementation 'androidx.test:runner:1.2.0' androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.android.support:design:28.0.0' implementation 'com.android.support:design:28.0.0'
// 數據庫
implementation 'org.greenrobot:greendao:3.2.2'
implementation 'org.greenrobot:greendao-generator:3.2.2'
implementation 'com.gcssloop.recyclerview:pagerlayoutmanager:2.3.8' implementation 'com.gcssloop.recyclerview:pagerlayoutmanager:2.3.8'
//陰影背景 //陰影背景
api 'com.github.lihangleo2:ShadowLayout:2.1.6' api 'com.github.lihangleo2:ShadowLayout:2.1.6'
...@@ -130,10 +110,10 @@ dependencies { ...@@ -130,10 +110,10 @@ dependencies {
implementation 'cn.bingoogolapple:bga-baseadapter:1.2.9@aar' implementation 'cn.bingoogolapple:bga-baseadapter:1.2.9@aar'
implementation 'cn.bingoogolapple:bga-flowlayout:1.0.0@aar' implementation 'cn.bingoogolapple:bga-flowlayout:1.0.0@aar'
api 'androidx.core:core-ktx:+'
implementation 'org.projectlombok:lombok:1.18.8' implementation 'org.projectlombok:lombok:1.18.8'
annotationProcessor 'org.projectlombok:lombok:1.18.8' annotationProcessor 'org.projectlombok:lombok:1.18.8'
api 'androidx.core:core-ktx:+'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
api 'com.github.huangyanbin:SmartTable:2.2.0' api 'com.github.huangyanbin:SmartTable:2.2.0'
api rootProject.ext.dependencies["permissionx"] api rootProject.ext.dependencies["permissionx"]
......
package com.gingersoft.gsa.cloud.aspectj;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Created by Wyh on 2020/2/29.
* 雙擊檢測
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface SingleClick {
/* 点击间隔时间 */
long value() default 1000;
}
package com.gingersoft.gsa.cloud.aspectj;
import android.util.Log;
import android.view.View;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import java.lang.reflect.Method;
/**
* Created by Wyh on 2020/2/29.
*/
@Aspect
public class SingleClickAspect {
private static final long DEFAULT_TIME_INTERVAL = 5000;
/**
* 定义切点,标记切点为所有被@SingleClick注解的方法
* 注意:这里me.baron.test.annotation.SingleClick需要替换成
* 你自己项目中SingleClick这个类的全路径哦
*/
@Pointcut("execution(@com.gingersoft.gsa.cloud.aspectj.SingleClick * *(..))")
public void methodAnnotated() {
}
/**
* 定义一个切面方法,包裹切点方法
*/
@Around("methodAnnotated()")
public void aroundJoinPoint(ProceedingJoinPoint joinPoint) throws Throwable {
// 取出方法的参数
View view = null;
for (Object arg : joinPoint.getArgs()) {
if (arg instanceof View) {
view = (View) arg;
break;
}
}
if (view == null) {
return;
}
// 取出方法的注解
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
Method method = methodSignature.getMethod();
if (!method.isAnnotationPresent(SingleClick.class)) {
return;
}
SingleClick singleClick = method.getAnnotation(SingleClick.class);
// 判断是否快速点击
if (!XClickUtil.isFastDoubleClick(view, singleClick.value())) {
// 不是快速点击,执行原方法
joinPoint.proceed();
}
}
}
package com.gingersoft.gsa.cloud.aspectj;
import android.app.Dialog;
import android.view.View;
import com.gingersoft.gsa.cloud.base.R;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
import com.gingersoft.gsa.cloud.base.widget.DialogUtils;
import com.gingersoft.gsa.cloud.constans.PrintConstans;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
/**
* Created by Wyh on 2020/3/2.
* 組件化使用Aspect有問題。
*/
@Aspect
public class SwitchPrintAspect {
/**
* 定义切点,标记切点为所有被@SwitchPrintMethod注解的方法
*/
@Pointcut("execution(@com.gingersoft.gsa.cloud.aspectj.SwitchPrintMethod * *(..))")
public void methodAnnotated() {
}
/**
* 定义一个切面方法,包裹切点方法
*/
@Around("methodAnnotated()")
public void aroundJoinPoint(ProceedingJoinPoint joinPoint) {
// 取出方法的参数
View view = null;
for (Object arg : joinPoint.getArgs()) {
if (arg instanceof View) {
view = (View) arg;
break;
}
}
if (view == null || view.getContext() == null) {
return;
}
// 顯示切換打印方式的彈窗
new DialogUtils(view.getContext(), R.layout.print_select_print_method) {
@Override
public void initLayout(ViewHepler hepler, Dialog dialog) {
hepler.setViewClick(R.id.local_print, v -> {
SPUtils.put(dialog.getContext(), PrintConstans.DEFAULT_PRINT_METHOD, PrintConstans.LOCAL_PRINT);
dialog.dismiss();
});
hepler.setViewClick(R.id.internet_print, v -> {
SPUtils.put(dialog.getContext(), PrintConstans.DEFAULT_PRINT_METHOD, PrintConstans.IP_PRINT);
dialog.dismiss();
});
}
}.show();
}
}
package com.gingersoft.gsa.cloud.aspectj;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Created by Wyh on 2020/3/2.
* 切換默認打印方式
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface SwitchPrintMethod {
}
package com.gingersoft.gsa.cloud.base.common.bean; package com.gingersoft.gsa.cloud.base.common.bean;
import com.gingersoft.gsa.cloud.database.bean.Food; import com.gingersoft.gsa.cloud.database.bean.Food;
import java.util.List; import java.util.List;
/** /**
......
...@@ -2,7 +2,6 @@ package com.gingersoft.gsa.cloud.base.common.bean.PrinterManger; ...@@ -2,7 +2,6 @@ package com.gingersoft.gsa.cloud.base.common.bean.PrinterManger;
import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean; import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean;
import java.util.List; import java.util.List;
/** /**
......
...@@ -46,7 +46,7 @@ public class ExpandInfoSetting { ...@@ -46,7 +46,7 @@ public class ExpandInfoSetting {
/** /**
* 數據類型 1:整形,2:字符型,3:布爾型,4:日期類型 * 數據類型 1:整形,2:字符型,3:布爾型,4:日期類型
*/ */
private byte dataType; private int dataType;
private int sort; private int sort;
private String showName; private String showName;
private String remark; private String remark;
......
package com.gingersoft.gsa.cloud.greendao;
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;
import com.gingersoft.gsa.cloud.database.bean.ColorBean;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "COLOR_BEAN".
*/
public class ColorBeanDao extends AbstractDao<ColorBean, Void> {
public static final String TABLENAME = "COLOR_BEAN";
/**
* Properties of entity ColorBean.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public static class Properties {
public final static Property ColorId = new Property(0, int.class, "colorId", false, "COLOR_ID");
public final static Property ColorStart = new Property(1, String.class, "colorStart", false, "COLOR_START");
public final static Property ColorStop = new Property(2, String.class, "colorStop", false, "COLOR_STOP");
public final static Property FontColor = new Property(3, String.class, "fontColor", false, "FONT_COLOR");
public final static Property AndroidColor = new Property(4, String.class, "androidColor", false, "ANDROID_COLOR");
public final static Property AndroidFontColor = new Property(5, String.class, "androidFontColor", false, "ANDROID_FONT_COLOR");
public final static Property CreateTime = new Property(6, String.class, "createTime", false, "CREATE_TIME");
public final static Property EditTime = new Property(7, String.class, "editTime", false, "EDIT_TIME");
}
public ColorBeanDao(DaoConfig config) {
super(config);
}
public ColorBeanDao(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 + "\"COLOR_BEAN\" (" + //
"\"COLOR_ID\" INTEGER NOT NULL ," + // 0: colorId
"\"COLOR_START\" TEXT," + // 1: colorStart
"\"COLOR_STOP\" TEXT," + // 2: colorStop
"\"FONT_COLOR\" TEXT," + // 3: fontColor
"\"ANDROID_COLOR\" TEXT," + // 4: androidColor
"\"ANDROID_FONT_COLOR\" TEXT," + // 5: androidFontColor
"\"CREATE_TIME\" TEXT," + // 6: createTime
"\"EDIT_TIME\" TEXT);"); // 7: editTime
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"COLOR_BEAN\"";
db.execSQL(sql);
}
@Override
protected final void bindValues(DatabaseStatement stmt, ColorBean entity) {
stmt.clearBindings();
stmt.bindLong(1, entity.getColorId());
String colorStart = entity.getColorStart();
if (colorStart != null) {
stmt.bindString(2, colorStart);
}
String colorStop = entity.getColorStop();
if (colorStop != null) {
stmt.bindString(3, colorStop);
}
String fontColor = entity.getFontColor();
if (fontColor != null) {
stmt.bindString(4, fontColor);
}
String androidColor = entity.getAndroidColor();
if (androidColor != null) {
stmt.bindString(5, androidColor);
}
String androidFontColor = entity.getAndroidFontColor();
if (androidFontColor != null) {
stmt.bindString(6, androidFontColor);
}
String createTime = entity.getCreateTime();
if (createTime != null) {
stmt.bindString(7, createTime);
}
String editTime = entity.getEditTime();
if (editTime != null) {
stmt.bindString(8, editTime);
}
}
@Override
protected final void bindValues(SQLiteStatement stmt, ColorBean entity) {
stmt.clearBindings();
stmt.bindLong(1, entity.getColorId());
String colorStart = entity.getColorStart();
if (colorStart != null) {
stmt.bindString(2, colorStart);
}
String colorStop = entity.getColorStop();
if (colorStop != null) {
stmt.bindString(3, colorStop);
}
String fontColor = entity.getFontColor();
if (fontColor != null) {
stmt.bindString(4, fontColor);
}
String androidColor = entity.getAndroidColor();
if (androidColor != null) {
stmt.bindString(5, androidColor);
}
String androidFontColor = entity.getAndroidFontColor();
if (androidFontColor != null) {
stmt.bindString(6, androidFontColor);
}
String createTime = entity.getCreateTime();
if (createTime != null) {
stmt.bindString(7, createTime);
}
String editTime = entity.getEditTime();
if (editTime != null) {
stmt.bindString(8, editTime);
}
}
@Override
public Void readKey(Cursor cursor, int offset) {
return null;
}
@Override
public ColorBean readEntity(Cursor cursor, int offset) {
ColorBean entity = new ColorBean( //
cursor.getInt(offset + 0), // colorId
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // colorStart
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // colorStop
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // fontColor
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // androidColor
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // androidFontColor
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // createTime
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7) // editTime
);
return entity;
}
@Override
public void readEntity(Cursor cursor, ColorBean entity, int offset) {
entity.setColorId(cursor.getInt(offset + 0));
entity.setColorStart(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
entity.setColorStop(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setFontColor(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
entity.setAndroidColor(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
entity.setAndroidFontColor(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
entity.setCreateTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
entity.setEditTime(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
}
@Override
protected final Void updateKeyAfterInsert(ColorBean entity, long rowId) {
// Unsupported or missing PK type
return null;
}
@Override
public Void getKey(ColorBean entity) {
return null;
}
@Override
public boolean hasKey(ColorBean entity) {
// TODO
return false;
}
@Override
protected final boolean isEntityUpdateable() {
return true;
}
}
package com.gingersoft.gsa.cloud.greendao;
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 20): knows all DAOs.
*/
public class DaoMaster extends AbstractDaoMaster {
public static final int SCHEMA_VERSION = 20;
/** Creates underlying database table using DAOs. */
public static void createAllTables(Database db, boolean ifNotExists) {
ColorBeanDao.createTable(db, ifNotExists);
ComboItemDao.createTable(db, ifNotExists);
DiscountDao.createTable(db, ifNotExists);
ExpandInfoDao.createTable(db, ifNotExists);
FoodDao.createTable(db, ifNotExists);
FoodComboDao.createTable(db, ifNotExists);
FoodModifierDao.createTable(db, ifNotExists);
FunctionDao.createTable(db, ifNotExists);
LanguageDao.createTable(db, ifNotExists);
ModifierDao.createTable(db, ifNotExists);
PrintCurrencyBeanDao.createTable(db, ifNotExists);
PrintModelBeanDao.createTable(db, ifNotExists);
PrinterDeviceBeanDao.createTable(db, ifNotExists);
}
/** Drops underlying database table using DAOs. */
public static void dropAllTables(Database db, boolean ifExists) {
ColorBeanDao.dropTable(db, ifExists);
ComboItemDao.dropTable(db, ifExists);
DiscountDao.dropTable(db, ifExists);
ExpandInfoDao.dropTable(db, ifExists);
FoodDao.dropTable(db, ifExists);
FoodComboDao.dropTable(db, ifExists);
FoodModifierDao.dropTable(db, ifExists);
FunctionDao.dropTable(db, ifExists);
LanguageDao.dropTable(db, ifExists);
ModifierDao.dropTable(db, ifExists);
PrintCurrencyBeanDao.dropTable(db, ifExists);
PrintModelBeanDao.dropTable(db, ifExists);
PrinterDeviceBeanDao.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(ColorBeanDao.class);
registerDaoClass(ComboItemDao.class);
registerDaoClass(DiscountDao.class);
registerDaoClass(ExpandInfoDao.class);
registerDaoClass(FoodDao.class);
registerDaoClass(FoodComboDao.class);
registerDaoClass(FoodModifierDao.class);
registerDaoClass(FunctionDao.class);
registerDaoClass(LanguageDao.class);
registerDaoClass(ModifierDao.class);
registerDaoClass(PrintCurrencyBeanDao.class);
registerDaoClass(PrintModelBeanDao.class);
registerDaoClass(PrinterDeviceBeanDao.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);
}
@Override
public 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);
}
@Override
public 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);
}
}
}
package com.gingersoft.gsa.cloud.greendao;
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.gingersoft.gsa.cloud.database.bean.ColorBean;
import com.gingersoft.gsa.cloud.database.bean.ComboItem;
import com.gingersoft.gsa.cloud.database.bean.Discount;
import com.gingersoft.gsa.cloud.database.bean.ExpandInfo;
import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.database.bean.FoodCombo;
import com.gingersoft.gsa.cloud.database.bean.FoodModifier;
import com.gingersoft.gsa.cloud.database.bean.Function;
import com.gingersoft.gsa.cloud.database.bean.Language;
import com.gingersoft.gsa.cloud.database.bean.Modifier;
import com.gingersoft.gsa.cloud.database.bean.PrintCurrencyBean;
import com.gingersoft.gsa.cloud.database.bean.PrintModelBean;
import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean;
import com.gingersoft.gsa.cloud.greendao.ColorBeanDao;
import com.gingersoft.gsa.cloud.greendao.ComboItemDao;
import com.gingersoft.gsa.cloud.greendao.DiscountDao;
import com.gingersoft.gsa.cloud.greendao.ExpandInfoDao;
import com.gingersoft.gsa.cloud.greendao.FoodDao;
import com.gingersoft.gsa.cloud.greendao.FoodComboDao;
import com.gingersoft.gsa.cloud.greendao.FoodModifierDao;
import com.gingersoft.gsa.cloud.greendao.FunctionDao;
import com.gingersoft.gsa.cloud.greendao.LanguageDao;
import com.gingersoft.gsa.cloud.greendao.ModifierDao;
import com.gingersoft.gsa.cloud.greendao.PrintCurrencyBeanDao;
import com.gingersoft.gsa.cloud.greendao.PrintModelBeanDao;
import com.gingersoft.gsa.cloud.greendao.PrinterDeviceBeanDao;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* {@inheritDoc}
*
* @see org.greenrobot.greendao.AbstractDaoSession
*/
public class DaoSession extends AbstractDaoSession {
private final DaoConfig colorBeanDaoConfig;
private final DaoConfig comboItemDaoConfig;
private final DaoConfig discountDaoConfig;
private final DaoConfig expandInfoDaoConfig;
private final DaoConfig foodDaoConfig;
private final DaoConfig foodComboDaoConfig;
private final DaoConfig foodModifierDaoConfig;
private final DaoConfig functionDaoConfig;
private final DaoConfig languageDaoConfig;
private final DaoConfig modifierDaoConfig;
private final DaoConfig printCurrencyBeanDaoConfig;
private final DaoConfig printModelBeanDaoConfig;
private final DaoConfig printerDeviceBeanDaoConfig;
private final ColorBeanDao colorBeanDao;
private final ComboItemDao comboItemDao;
private final DiscountDao discountDao;
private final ExpandInfoDao expandInfoDao;
private final FoodDao foodDao;
private final FoodComboDao foodComboDao;
private final FoodModifierDao foodModifierDao;
private final FunctionDao functionDao;
private final LanguageDao languageDao;
private final ModifierDao modifierDao;
private final PrintCurrencyBeanDao printCurrencyBeanDao;
private final PrintModelBeanDao printModelBeanDao;
private final PrinterDeviceBeanDao printerDeviceBeanDao;
public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
daoConfigMap) {
super(db);
colorBeanDaoConfig = daoConfigMap.get(ColorBeanDao.class).clone();
colorBeanDaoConfig.initIdentityScope(type);
comboItemDaoConfig = daoConfigMap.get(ComboItemDao.class).clone();
comboItemDaoConfig.initIdentityScope(type);
discountDaoConfig = daoConfigMap.get(DiscountDao.class).clone();
discountDaoConfig.initIdentityScope(type);
expandInfoDaoConfig = daoConfigMap.get(ExpandInfoDao.class).clone();
expandInfoDaoConfig.initIdentityScope(type);
foodDaoConfig = daoConfigMap.get(FoodDao.class).clone();
foodDaoConfig.initIdentityScope(type);
foodComboDaoConfig = daoConfigMap.get(FoodComboDao.class).clone();
foodComboDaoConfig.initIdentityScope(type);
foodModifierDaoConfig = daoConfigMap.get(FoodModifierDao.class).clone();
foodModifierDaoConfig.initIdentityScope(type);
functionDaoConfig = daoConfigMap.get(FunctionDao.class).clone();
functionDaoConfig.initIdentityScope(type);
languageDaoConfig = daoConfigMap.get(LanguageDao.class).clone();
languageDaoConfig.initIdentityScope(type);
modifierDaoConfig = daoConfigMap.get(ModifierDao.class).clone();
modifierDaoConfig.initIdentityScope(type);
printCurrencyBeanDaoConfig = daoConfigMap.get(PrintCurrencyBeanDao.class).clone();
printCurrencyBeanDaoConfig.initIdentityScope(type);
printModelBeanDaoConfig = daoConfigMap.get(PrintModelBeanDao.class).clone();
printModelBeanDaoConfig.initIdentityScope(type);
printerDeviceBeanDaoConfig = daoConfigMap.get(PrinterDeviceBeanDao.class).clone();
printerDeviceBeanDaoConfig.initIdentityScope(type);
colorBeanDao = new ColorBeanDao(colorBeanDaoConfig, this);
comboItemDao = new ComboItemDao(comboItemDaoConfig, this);
discountDao = new DiscountDao(discountDaoConfig, this);
expandInfoDao = new ExpandInfoDao(expandInfoDaoConfig, this);
foodDao = new FoodDao(foodDaoConfig, this);
foodComboDao = new FoodComboDao(foodComboDaoConfig, this);
foodModifierDao = new FoodModifierDao(foodModifierDaoConfig, this);
functionDao = new FunctionDao(functionDaoConfig, this);
languageDao = new LanguageDao(languageDaoConfig, this);
modifierDao = new ModifierDao(modifierDaoConfig, this);
printCurrencyBeanDao = new PrintCurrencyBeanDao(printCurrencyBeanDaoConfig, this);
printModelBeanDao = new PrintModelBeanDao(printModelBeanDaoConfig, this);
printerDeviceBeanDao = new PrinterDeviceBeanDao(printerDeviceBeanDaoConfig, this);
registerDao(ColorBean.class, colorBeanDao);
registerDao(ComboItem.class, comboItemDao);
registerDao(Discount.class, discountDao);
registerDao(ExpandInfo.class, expandInfoDao);
registerDao(Food.class, foodDao);
registerDao(FoodCombo.class, foodComboDao);
registerDao(FoodModifier.class, foodModifierDao);
registerDao(Function.class, functionDao);
registerDao(Language.class, languageDao);
registerDao(Modifier.class, modifierDao);
registerDao(PrintCurrencyBean.class, printCurrencyBeanDao);
registerDao(PrintModelBean.class, printModelBeanDao);
registerDao(PrinterDeviceBean.class, printerDeviceBeanDao);
}
public void clear() {
colorBeanDaoConfig.clearIdentityScope();
comboItemDaoConfig.clearIdentityScope();
discountDaoConfig.clearIdentityScope();
expandInfoDaoConfig.clearIdentityScope();
foodDaoConfig.clearIdentityScope();
foodComboDaoConfig.clearIdentityScope();
foodModifierDaoConfig.clearIdentityScope();
functionDaoConfig.clearIdentityScope();
languageDaoConfig.clearIdentityScope();
modifierDaoConfig.clearIdentityScope();
printCurrencyBeanDaoConfig.clearIdentityScope();
printModelBeanDaoConfig.clearIdentityScope();
printerDeviceBeanDaoConfig.clearIdentityScope();
}
public ColorBeanDao getColorBeanDao() {
return colorBeanDao;
}
public ComboItemDao getComboItemDao() {
return comboItemDao;
}
public DiscountDao getDiscountDao() {
return discountDao;
}
public ExpandInfoDao getExpandInfoDao() {
return expandInfoDao;
}
public FoodDao getFoodDao() {
return foodDao;
}
public FoodComboDao getFoodComboDao() {
return foodComboDao;
}
public FoodModifierDao getFoodModifierDao() {
return foodModifierDao;
}
public FunctionDao getFunctionDao() {
return functionDao;
}
public LanguageDao getLanguageDao() {
return languageDao;
}
public ModifierDao getModifierDao() {
return modifierDao;
}
public PrintCurrencyBeanDao getPrintCurrencyBeanDao() {
return printCurrencyBeanDao;
}
public PrintModelBeanDao getPrintModelBeanDao() {
return printModelBeanDao;
}
public PrinterDeviceBeanDao getPrinterDeviceBeanDao() {
return printerDeviceBeanDao;
}
}
package com.gingersoft.gsa.cloud.greendao;
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;
import com.gingersoft.gsa.cloud.database.bean.Discount;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "DISCOUNT".
*/
public class DiscountDao extends AbstractDao<Discount, Long> {
public static final String TABLENAME = "DISCOUNT";
/**
* Properties of entity Discount.<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 Restaurant_id = new Property(1, int.class, "restaurant_id", false, "RESTAURANT_ID");
public final static Property Amount = new Property(2, double.class, "amount", false, "AMOUNT");
public final static Property Discount_value = new Property(3, double.class, "discount_value", false, "DISCOUNT_VALUE");
public final static Property Type = new Property(4, int.class, "type", false, "TYPE");
public final static Property DiscountType = new Property(5, String.class, "discountType", false, "DISCOUNT_TYPE");
public final static Property Status = new Property(6, int.class, "status", false, "STATUS");
public final static Property Remark = new Property(7, String.class, "remark", false, "REMARK");
public final static Property Begin_time = new Property(8, String.class, "begin_time", false, "BEGIN_TIME");
public final static Property End_time = new Property(9, String.class, "end_time", false, "END_TIME");
}
public DiscountDao(DaoConfig config) {
super(config);
}
public DiscountDao(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 + "\"DISCOUNT\" (" + //
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
"\"RESTAURANT_ID\" INTEGER NOT NULL ," + // 1: restaurant_id
"\"AMOUNT\" REAL NOT NULL ," + // 2: amount
"\"DISCOUNT_VALUE\" REAL NOT NULL ," + // 3: discount_value
"\"TYPE\" INTEGER NOT NULL ," + // 4: type
"\"DISCOUNT_TYPE\" TEXT," + // 5: discountType
"\"STATUS\" INTEGER NOT NULL ," + // 6: status
"\"REMARK\" TEXT," + // 7: remark
"\"BEGIN_TIME\" TEXT," + // 8: begin_time
"\"END_TIME\" TEXT);"); // 9: end_time
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"DISCOUNT\"";
db.execSQL(sql);
}
@Override
protected final void bindValues(DatabaseStatement stmt, Discount entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
stmt.bindLong(2, entity.getRestaurant_id());
stmt.bindDouble(3, entity.getAmount());
stmt.bindDouble(4, entity.getDiscount_value());
stmt.bindLong(5, entity.getType());
String discountType = entity.getDiscountType();
if (discountType != null) {
stmt.bindString(6, discountType);
}
stmt.bindLong(7, entity.getStatus());
String remark = entity.getRemark();
if (remark != null) {
stmt.bindString(8, remark);
}
String begin_time = entity.getBegin_time();
if (begin_time != null) {
stmt.bindString(9, begin_time);
}
String end_time = entity.getEnd_time();
if (end_time != null) {
stmt.bindString(10, end_time);
}
}
@Override
protected final void bindValues(SQLiteStatement stmt, Discount entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
stmt.bindLong(2, entity.getRestaurant_id());
stmt.bindDouble(3, entity.getAmount());
stmt.bindDouble(4, entity.getDiscount_value());
stmt.bindLong(5, entity.getType());
String discountType = entity.getDiscountType();
if (discountType != null) {
stmt.bindString(6, discountType);
}
stmt.bindLong(7, entity.getStatus());
String remark = entity.getRemark();
if (remark != null) {
stmt.bindString(8, remark);
}
String begin_time = entity.getBegin_time();
if (begin_time != null) {
stmt.bindString(9, begin_time);
}
String end_time = entity.getEnd_time();
if (end_time != null) {
stmt.bindString(10, end_time);
}
}
@Override
public Long readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
}
@Override
public Discount readEntity(Cursor cursor, int offset) {
Discount entity = new Discount( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.getInt(offset + 1), // restaurant_id
cursor.getDouble(offset + 2), // amount
cursor.getDouble(offset + 3), // discount_value
cursor.getInt(offset + 4), // type
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // discountType
cursor.getInt(offset + 6), // status
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // remark
cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // begin_time
cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // end_time
);
return entity;
}
@Override
public void readEntity(Cursor cursor, Discount entity, int offset) {
entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setRestaurant_id(cursor.getInt(offset + 1));
entity.setAmount(cursor.getDouble(offset + 2));
entity.setDiscount_value(cursor.getDouble(offset + 3));
entity.setType(cursor.getInt(offset + 4));
entity.setDiscountType(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
entity.setStatus(cursor.getInt(offset + 6));
entity.setRemark(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
entity.setBegin_time(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
entity.setEnd_time(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
}
@Override
protected final Long updateKeyAfterInsert(Discount entity, long rowId) {
entity.setId(rowId);
return rowId;
}
@Override
public Long getKey(Discount entity) {
if(entity != null) {
return entity.getId();
} else {
return null;
}
}
@Override
public boolean hasKey(Discount entity) {
return entity.getId() != null;
}
@Override
protected final boolean isEntityUpdateable() {
return true;
}
}
package com.gingersoft.gsa.cloud.greendao;
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;
import com.gingersoft.gsa.cloud.database.bean.ExpandInfo;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "EXPAND_INFO".
*/
public class ExpandInfoDao extends AbstractDao<ExpandInfo, Long> {
public static final String TABLENAME = "EXPAND_INFO";
/**
* Properties of entity ExpandInfo.<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 RestaurantId = new Property(1, Integer.class, "restaurantId", false, "RESTAURANT_ID");
public final static Property SettingName = new Property(2, String.class, "settingName", false, "SETTING_NAME");
public final static Property ValueInt = new Property(3, Integer.class, "valueInt", false, "VALUE_INT");
public final static Property ValueChar = new Property(4, String.class, "valueChar", false, "VALUE_CHAR");
public final static Property ValueBoolean = new Property(5, Boolean.class, "valueBoolean", false, "VALUE_BOOLEAN");
public final static Property ValueDatetime = new Property(6, String.class, "valueDatetime", false, "VALUE_DATETIME");
public final static Property Remark = new Property(7, String.class, "remark", false, "REMARK");
public final static Property DataType = new Property(8, int.class, "dataType", false, "DATA_TYPE");
public final static Property ShowName = new Property(9, String.class, "showName", false, "SHOW_NAME");
}
public ExpandInfoDao(DaoConfig config) {
super(config);
}
public ExpandInfoDao(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 + "\"EXPAND_INFO\" (" + //
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
"\"RESTAURANT_ID\" INTEGER," + // 1: restaurantId
"\"SETTING_NAME\" TEXT," + // 2: settingName
"\"VALUE_INT\" INTEGER," + // 3: valueInt
"\"VALUE_CHAR\" TEXT," + // 4: valueChar
"\"VALUE_BOOLEAN\" INTEGER," + // 5: valueBoolean
"\"VALUE_DATETIME\" TEXT," + // 6: valueDatetime
"\"REMARK\" TEXT," + // 7: remark
"\"DATA_TYPE\" INTEGER NOT NULL ," + // 8: dataType
"\"SHOW_NAME\" TEXT);"); // 9: showName
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"EXPAND_INFO\"";
db.execSQL(sql);
}
@Override
protected final void bindValues(DatabaseStatement stmt, ExpandInfo entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
Integer restaurantId = entity.getRestaurantId();
if (restaurantId != null) {
stmt.bindLong(2, restaurantId);
}
String settingName = entity.getSettingName();
if (settingName != null) {
stmt.bindString(3, settingName);
}
Integer valueInt = entity.getValueInt();
if (valueInt != null) {
stmt.bindLong(4, valueInt);
}
String valueChar = entity.getValueChar();
if (valueChar != null) {
stmt.bindString(5, valueChar);
}
Boolean valueBoolean = entity.getValueBoolean();
if (valueBoolean != null) {
stmt.bindLong(6, valueBoolean ? 1L: 0L);
}
String valueDatetime = entity.getValueDatetime();
if (valueDatetime != null) {
stmt.bindString(7, valueDatetime);
}
String remark = entity.getRemark();
if (remark != null) {
stmt.bindString(8, remark);
}
stmt.bindLong(9, entity.getDataType());
String showName = entity.getShowName();
if (showName != null) {
stmt.bindString(10, showName);
}
}
@Override
protected final void bindValues(SQLiteStatement stmt, ExpandInfo entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
Integer restaurantId = entity.getRestaurantId();
if (restaurantId != null) {
stmt.bindLong(2, restaurantId);
}
String settingName = entity.getSettingName();
if (settingName != null) {
stmt.bindString(3, settingName);
}
Integer valueInt = entity.getValueInt();
if (valueInt != null) {
stmt.bindLong(4, valueInt);
}
String valueChar = entity.getValueChar();
if (valueChar != null) {
stmt.bindString(5, valueChar);
}
Boolean valueBoolean = entity.getValueBoolean();
if (valueBoolean != null) {
stmt.bindLong(6, valueBoolean ? 1L: 0L);
}
String valueDatetime = entity.getValueDatetime();
if (valueDatetime != null) {
stmt.bindString(7, valueDatetime);
}
String remark = entity.getRemark();
if (remark != null) {
stmt.bindString(8, remark);
}
stmt.bindLong(9, entity.getDataType());
String showName = entity.getShowName();
if (showName != null) {
stmt.bindString(10, showName);
}
}
@Override
public Long readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
}
@Override
public ExpandInfo readEntity(Cursor cursor, int offset) {
ExpandInfo entity = new ExpandInfo( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.isNull(offset + 1) ? null : cursor.getInt(offset + 1), // restaurantId
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // settingName
cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3), // valueInt
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // valueChar
cursor.isNull(offset + 5) ? null : cursor.getShort(offset + 5) != 0, // valueBoolean
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // valueDatetime
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // remark
cursor.getInt(offset + 8), // dataType
cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9) // showName
);
return entity;
}
@Override
public void readEntity(Cursor cursor, ExpandInfo entity, int offset) {
entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setRestaurantId(cursor.isNull(offset + 1) ? null : cursor.getInt(offset + 1));
entity.setSettingName(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setValueInt(cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3));
entity.setValueChar(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
entity.setValueBoolean(cursor.isNull(offset + 5) ? null : cursor.getShort(offset + 5) != 0);
entity.setValueDatetime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
entity.setRemark(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
entity.setDataType(cursor.getInt(offset + 8));
entity.setShowName(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
}
@Override
protected final Long updateKeyAfterInsert(ExpandInfo entity, long rowId) {
entity.setId(rowId);
return rowId;
}
@Override
public Long getKey(ExpandInfo entity) {
if(entity != null) {
return entity.getId();
} else {
return null;
}
}
@Override
public boolean hasKey(ExpandInfo entity) {
return entity.getId() != null;
}
@Override
protected final boolean isEntityUpdateable() {
return true;
}
}
package com.gingersoft.gsa.cloud.greendao;
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;
import com.gingersoft.gsa.cloud.database.bean.Function;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "FUNCTION".
*/
public class FunctionDao extends AbstractDao<Function, Long> {
public static final String TABLENAME = "FUNCTION";
/**
* Properties of entity Function.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public static class Properties {
public final static Property Dbid = new Property(0, Long.class, "dbid", true, "_id");
public final static Property Id = new Property(1, Long.class, "id", false, "ID");
public final static Property ParentId = new Property(2, int.class, "parentId", false, "PARENT_ID");
public final static Property GroupId = new Property(3, int.class, "groupId", false, "GROUP_ID");
public final static Property EffectiveTime = new Property(4, long.class, "effectiveTime", false, "EFFECTIVE_TIME");
public final static Property ResName = new Property(5, String.class, "resName", false, "RES_NAME");
public final static Property ResUrl = new Property(6, String.class, "resUrl", false, "RES_URL");
public final static Property ImageURL = new Property(7, String.class, "imageURL", false, "IMAGE_URL");
public final static Property IcRes = new Property(8, int.class, "icRes", false, "IC_RES");
public final static Property Status = new Property(9, int.class, "status", false, "STATUS");
}
public FunctionDao(DaoConfig config) {
super(config);
}
public FunctionDao(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 + "\"FUNCTION\" (" + //
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: dbid
"\"ID\" INTEGER NOT NULL ," + // 1: id
"\"PARENT_ID\" INTEGER NOT NULL ," + // 2: parentId
"\"GROUP_ID\" INTEGER NOT NULL ," + // 3: groupId
"\"EFFECTIVE_TIME\" INTEGER NOT NULL ," + // 4: effectiveTime
"\"RES_NAME\" TEXT," + // 5: resName
"\"RES_URL\" TEXT," + // 6: resUrl
"\"IMAGE_URL\" TEXT," + // 7: imageURL
"\"IC_RES\" INTEGER NOT NULL ," + // 8: icRes
"\"STATUS\" INTEGER NOT NULL );"); // 9: status
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"FUNCTION\"";
db.execSQL(sql);
}
@Override
protected final void bindValues(DatabaseStatement stmt, Function entity) {
stmt.clearBindings();
Long dbid = entity.getDbid();
if (dbid != null) {
stmt.bindLong(1, dbid);
}
stmt.bindLong(2, entity.getId());
stmt.bindLong(3, entity.getParentId());
stmt.bindLong(4, entity.getGroupId());
stmt.bindLong(5, entity.getEffectiveTime());
String resName = entity.getResName();
if (resName != null) {
stmt.bindString(6, resName);
}
String resUrl = entity.getResUrl();
if (resUrl != null) {
stmt.bindString(7, resUrl);
}
String imageURL = entity.getImageURL();
if (imageURL != null) {
stmt.bindString(8, imageURL);
}
stmt.bindLong(9, entity.getIcRes());
stmt.bindLong(10, entity.getStatus());
}
@Override
protected final void bindValues(SQLiteStatement stmt, Function entity) {
stmt.clearBindings();
Long dbid = entity.getDbid();
if (dbid != null) {
stmt.bindLong(1, dbid);
}
stmt.bindLong(2, entity.getId());
stmt.bindLong(3, entity.getParentId());
stmt.bindLong(4, entity.getGroupId());
stmt.bindLong(5, entity.getEffectiveTime());
String resName = entity.getResName();
if (resName != null) {
stmt.bindString(6, resName);
}
String resUrl = entity.getResUrl();
if (resUrl != null) {
stmt.bindString(7, resUrl);
}
String imageURL = entity.getImageURL();
if (imageURL != null) {
stmt.bindString(8, imageURL);
}
stmt.bindLong(9, entity.getIcRes());
stmt.bindLong(10, entity.getStatus());
}
@Override
public Long readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
}
@Override
public Function readEntity(Cursor cursor, int offset) {
Function entity = new Function( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // dbid
cursor.getLong(offset + 1), // id
cursor.getInt(offset + 2), // parentId
cursor.getInt(offset + 3), // groupId
cursor.getLong(offset + 4), // effectiveTime
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // resName
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // resUrl
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // imageURL
cursor.getInt(offset + 8), // icRes
cursor.getInt(offset + 9) // status
);
return entity;
}
@Override
public void readEntity(Cursor cursor, Function entity, int offset) {
entity.setDbid(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setId(cursor.getLong(offset + 1));
entity.setParentId(cursor.getInt(offset + 2));
entity.setGroupId(cursor.getInt(offset + 3));
entity.setEffectiveTime(cursor.getLong(offset + 4));
entity.setResName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
entity.setResUrl(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
entity.setImageURL(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
entity.setIcRes(cursor.getInt(offset + 8));
entity.setStatus(cursor.getInt(offset + 9));
}
@Override
protected final Long updateKeyAfterInsert(Function entity, long rowId) {
entity.setDbid(rowId);
return rowId;
}
@Override
public Long getKey(Function entity) {
if(entity != null) {
return entity.getDbid();
} else {
return null;
}
}
@Override
public boolean hasKey(Function entity) {
return entity.getDbid() != null;
}
@Override
protected final boolean isEntityUpdateable() {
return true;
}
}
package com.gingersoft.gsa.cloud.greendao;
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;
import com.gingersoft.gsa.cloud.database.bean.Language;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "LANGUAGE".
*/
public class LanguageDao extends AbstractDao<Language, Long> {
public static final String TABLENAME = "LANGUAGE";
/**
* Properties of entity Language.<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 FunctionName = new Property(1, String.class, "functionName", false, "FUNCTION_NAME");
public final static Property LanguageName = new Property(2, String.class, "languageName", false, "LANGUAGE_NAME");
}
public LanguageDao(DaoConfig config) {
super(config);
}
public LanguageDao(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 + "\"LANGUAGE\" (" + //
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
"\"FUNCTION_NAME\" TEXT NOT NULL ," + // 1: functionName
"\"LANGUAGE_NAME\" TEXT);"); // 2: languageName
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LANGUAGE\"";
db.execSQL(sql);
}
@Override
protected final void bindValues(DatabaseStatement stmt, Language entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
stmt.bindString(2, entity.getFunctionName());
String languageName = entity.getLanguageName();
if (languageName != null) {
stmt.bindString(3, languageName);
}
}
@Override
protected final void bindValues(SQLiteStatement stmt, Language entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
stmt.bindString(2, entity.getFunctionName());
String languageName = entity.getLanguageName();
if (languageName != null) {
stmt.bindString(3, languageName);
}
}
@Override
public Long readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
}
@Override
public Language readEntity(Cursor cursor, int offset) {
Language entity = new Language( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.getString(offset + 1), // functionName
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2) // languageName
);
return entity;
}
@Override
public void readEntity(Cursor cursor, Language entity, int offset) {
entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setFunctionName(cursor.getString(offset + 1));
entity.setLanguageName(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
}
@Override
protected final Long updateKeyAfterInsert(Language entity, long rowId) {
entity.setId(rowId);
return rowId;
}
@Override
public Long getKey(Language entity) {
if(entity != null) {
return entity.getId();
} else {
return null;
}
}
@Override
public boolean hasKey(Language entity) {
return entity.getId() != null;
}
@Override
protected final boolean isEntityUpdateable() {
return true;
}
}
package com.gingersoft.gsa.cloud.greendao;
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;
import com.gingersoft.gsa.cloud.database.bean.PrintModelBean;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "PRINT_MODEL_BEAN".
*/
public class PrintModelBeanDao extends AbstractDao<PrintModelBean, Long> {
public static final String TABLENAME = "PRINT_MODEL_BEAN";
/**
* Properties of entity PrintModelBean.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public static class Properties {
public final static Property Dbid = new Property(0, Long.class, "dbid", true, "_id");
public final static Property Id = new Property(1, int.class, "id", false, "ID");
public final static Property PaperSpecification = new Property(2, String.class, "paperSpecification", false, "PAPER_SPECIFICATION");
public final static Property PrinterName = new Property(3, String.class, "printerName", false, "PRINTER_NAME");
public final static Property Model = new Property(4, String.class, "model", false, "MODEL");
}
public PrintModelBeanDao(DaoConfig config) {
super(config);
}
public PrintModelBeanDao(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 + "\"PRINT_MODEL_BEAN\" (" + //
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: dbid
"\"ID\" INTEGER NOT NULL ," + // 1: id
"\"PAPER_SPECIFICATION\" TEXT," + // 2: paperSpecification
"\"PRINTER_NAME\" TEXT," + // 3: printerName
"\"MODEL\" TEXT);"); // 4: model
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"PRINT_MODEL_BEAN\"";
db.execSQL(sql);
}
@Override
protected final void bindValues(DatabaseStatement stmt, PrintModelBean entity) {
stmt.clearBindings();
Long dbid = entity.getDbid();
if (dbid != null) {
stmt.bindLong(1, dbid);
}
stmt.bindLong(2, entity.getId());
String paperSpecification = entity.getPaperSpecification();
if (paperSpecification != null) {
stmt.bindString(3, paperSpecification);
}
String printerName = entity.getPrinterName();
if (printerName != null) {
stmt.bindString(4, printerName);
}
String model = entity.getModel();
if (model != null) {
stmt.bindString(5, model);
}
}
@Override
protected final void bindValues(SQLiteStatement stmt, PrintModelBean entity) {
stmt.clearBindings();
Long dbid = entity.getDbid();
if (dbid != null) {
stmt.bindLong(1, dbid);
}
stmt.bindLong(2, entity.getId());
String paperSpecification = entity.getPaperSpecification();
if (paperSpecification != null) {
stmt.bindString(3, paperSpecification);
}
String printerName = entity.getPrinterName();
if (printerName != null) {
stmt.bindString(4, printerName);
}
String model = entity.getModel();
if (model != null) {
stmt.bindString(5, model);
}
}
@Override
public Long readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
}
@Override
public PrintModelBean readEntity(Cursor cursor, int offset) {
PrintModelBean entity = new PrintModelBean( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // dbid
cursor.getInt(offset + 1), // id
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // paperSpecification
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // printerName
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4) // model
);
return entity;
}
@Override
public void readEntity(Cursor cursor, PrintModelBean entity, int offset) {
entity.setDbid(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setId(cursor.getInt(offset + 1));
entity.setPaperSpecification(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setPrinterName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
entity.setModel(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
}
@Override
protected final Long updateKeyAfterInsert(PrintModelBean entity, long rowId) {
entity.setDbid(rowId);
return rowId;
}
@Override
public Long getKey(PrintModelBean entity) {
if(entity != null) {
return entity.getDbid();
} else {
return null;
}
}
@Override
public boolean hasKey(PrintModelBean entity) {
return entity.getDbid() != null;
}
@Override
protected final boolean isEntityUpdateable() {
return true;
}
}
...@@ -9,7 +9,7 @@ project.dependencies.add('api', project(':cc')) //用最新版 ...@@ -9,7 +9,7 @@ project.dependencies.add('api', project(':cc')) //用最新版
//project.dependencies.add('api', "com.billy.android:cc:2.1.6") //用最新版 //project.dependencies.add('api', "com.billy.android:cc:2.1.6") //用最新版
dependencies { dependencies {
if (project.name != 'base-module' && project.name != 'arms' && project.name != 'fragmentation_core' && project.name != 'qm-qmui' && project.name != 'qm-arch' && project.name != 'qm-skin-maker') { if (project.name != 'base-module' && project.name != 'database-module' &&project.name != 'arms' && project.name != 'fragmentation_core' && project.name != 'qm-qmui' && project.name != 'qm-arch' && project.name != 'qm-skin-maker') {
api project(':base-module') api project(':base-module')
} }
if (project.name != 'base-module' && project.name != 'table-base' && (project.name == 'table-module' || project.name == 'manager-module' || project.name == 'order-base')) { if (project.name != 'base-module' && project.name != 'table-base' && (project.name == 'table-module' || project.name == 'manager-module' || project.name == 'order-base')) {
...@@ -22,6 +22,10 @@ dependencies { ...@@ -22,6 +22,10 @@ dependencies {
if (project.name == 'table-module' ) { if (project.name == 'table-module' ) {
api project(':pay-module') api project(':pay-module')
} }
if (project.name != 'database-module' && project.name != 'arms' && project.name != 'fragmentation_core'
&& project.name != 'qm-qmui' && project.name != 'qm-arch' && project.name != 'qm-skin-maker') {
api project(':database-module')
}
if (project.name != 'arms' && project.name != 'fragmentation_core' && project.name != 'qm-qmui' && project.name != 'qm-arch' && project.name != 'qm-skin-maker') { if (project.name != 'arms' && project.name != 'fragmentation_core' && project.name != 'qm-qmui' && project.name != 'qm-arch' && project.name != 'qm-skin-maker') {
api project(':arms') api project(':arms')
} }
......
ext.alwaysLib = true //虽然apply了cc-settings-2.gradle,但一直作为library编译,否则别的组件依赖此module时会报错
apply from: rootProject.file("cc-settings.gradle")
apply plugin: 'org.greenrobot.greendao'
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
// 避免 lint 检测出错时停止构建
lintOptions {
abortOnError false
}
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
versionCode rootProject.ext.android["versionCode"]
versionName rootProject.ext.android["versionName"]
multiDexEnabled true
//配置注解处理器
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
}
resourcePrefix "database"
buildTypes {
debug {
buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "boolean", "USE_CANARY", "true"
minifyEnabled false
proguardFiles 'proguard.cfg'
}
release {
buildConfigField "boolean", "LOG_DEBUG", "false"
buildConfigField "boolean", "USE_CANARY", "false"
minifyEnabled false
shrinkResources false
zipAlignEnabled false
proguardFiles 'proguard.cfg'
}
}
greendao {
/**
* 版本号
*/
schemaVersion 20
/**
* greendao输出dao的数据库操作实体类文件夹(相对路径 包名+自定义路径名称,包将创建于包名的直接路径下)
*/
daoPackage 'com.gingersoft.gsa.cloud.database.greendao'
/**
* greenDao实体类包文件夹
*/
targetGenDir 'src/main/java'
generateTests false //设置为true以自动生成单元测试。
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
debugImplementation rootProject.ext.dependencies["canary-debug"]
releaseImplementation rootProject.ext.dependencies["canary-release"]
testImplementation rootProject.ext.dependencies["canary-release"]
testImplementation rootProject.ext.dependencies["junit"]
// 數據庫
implementation 'org.greenrobot:greendao:3.2.2'
implementation 'org.greenrobot:greendao-generator:3.2.2'
implementation 'org.projectlombok:lombok:1.18.10'
annotationProcessor 'org.projectlombok:lombok:1.18.10'
}
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gingersoft.gsa.cloud.database" />
package com.gingersoft.gsa.cloud.database; package com.gingersoft.gsa.cloud.database;
import android.content.Context; import android.content.Context;
import com.gingersoft.gsa.cloud.base.BuildConfig;
import com.gingersoft.gsa.cloud.database.greendao.DaoMaster; import com.gingersoft.gsa.cloud.database.greendao.DaoMaster;
import com.gingersoft.gsa.cloud.database.greendao.DaoSession; import com.gingersoft.gsa.cloud.database.greendao.DaoSession;
import org.greenrobot.greendao.query.QueryBuilder; import org.greenrobot.greendao.query.QueryBuilder;
......
...@@ -230,8 +230,6 @@ public class ComboItem { ...@@ -230,8 +230,6 @@ public class ComboItem {
public ComboItem() { public ComboItem() {
} }
public boolean isSold() { public boolean isSold() {
if(!TextUtils.isEmpty(currentMaxNumber) && ("售罄".equals(currentMaxNumber) || "暫停".equals(currentMaxNumber))){ if(!TextUtils.isEmpty(currentMaxNumber) && ("售罄".equals(currentMaxNumber) || "暫停".equals(currentMaxNumber))){
return true; return true;
...@@ -247,341 +245,140 @@ public class ComboItem { ...@@ -247,341 +245,140 @@ public class ComboItem {
return foodCombo; return foodCombo;
} }
public Long getId() { public Long getId() {
return this.id; return this.id;
} }
public void setId(Long id) { public void setId(Long id) {
this.id = id; this.id = id;
} }
public Long getComId() { public Long getComId() {
return this.comId; return this.comId;
} }
public void setComId(Long comId) { public void setComId(Long comId) {
this.comId = comId; this.comId = comId;
} }
public Long getFid() { public Long getFid() {
return this.fid; return this.fid;
} }
public void setFid(Long fid) { public void setFid(Long fid) {
this.fid = fid; this.fid = fid;
} }
public long getQty() { public long getQty() {
return this.qty; return this.qty;
} }
public void setQty(long qty) { public void setQty(long qty) {
this.qty = qty; this.qty = qty;
} }
public double getDiffAmt() { public double getDiffAmt() {
return this.diffAmt; return this.diffAmt;
} }
public void setDiffAmt(double diffAmt) { public void setDiffAmt(double diffAmt) {
this.diffAmt = diffAmt; this.diffAmt = diffAmt;
} }
public long getSeqNo() { public long getSeqNo() {
return this.seqNo; return this.seqNo;
} }
public void setSeqNo(long seqNo) { public void setSeqNo(long seqNo) {
this.seqNo = seqNo; this.seqNo = seqNo;
} }
public long getVisible() { public long getVisible() {
return this.visible; return this.visible;
} }
public void setVisible(long visible) { public void setVisible(long visible) {
this.visible = visible; this.visible = visible;
} }
public Date getCreateTime() { public Date getCreateTime() {
return this.createTime; return this.createTime;
} }
public void setCreateTime(Date createTime) { public void setCreateTime(Date createTime) {
this.createTime = createTime; this.createTime = createTime;
} }
public String getCreateBy() { public String getCreateBy() {
return this.createBy; return this.createBy;
} }
public void setCreateBy(String createBy) { public void setCreateBy(String createBy) {
this.createBy = createBy; this.createBy = createBy;
} }
public Date getUpdateTime() { public Date getUpdateTime() {
return this.updateTime; return this.updateTime;
} }
public void setUpdateTime(Date updateTime) { public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
public long getConditions() { public long getConditions() {
return this.conditions; return this.conditions;
} }
public void setConditions(long conditions) { public void setConditions(long conditions) {
this.conditions = conditions; this.conditions = conditions;
} }
public long getIsRT() { public long getIsRT() {
return this.isRT; return this.isRT;
} }
public void setIsRT(long isRT) { public void setIsRT(long isRT) {
this.isRT = isRT; this.isRT = isRT;
} }
public byte getDeletes() { public byte getDeletes() {
return this.deletes; return this.deletes;
} }
public void setDeletes(byte deletes) { public void setDeletes(byte deletes) {
this.deletes = deletes; this.deletes = deletes;
} }
public long getPosId() { public long getPosId() {
return this.posId; return this.posId;
} }
public void setPosId(long posId) { public void setPosId(long posId) {
this.posId = posId; this.posId = posId;
} }
public long getRestaurant_id() { public long getRestaurant_id() {
return this.restaurant_id; return this.restaurant_id;
} }
public void setRestaurant_id(long restaurant_id) { public void setRestaurant_id(long restaurant_id) {
this.restaurant_id = restaurant_id; this.restaurant_id = restaurant_id;
} }
public byte getIsMainAccount() { public byte getIsMainAccount() {
return this.isMainAccount; return this.isMainAccount;
} }
public void setIsMainAccount(byte isMainAccount) { public void setIsMainAccount(byte isMainAccount) {
this.isMainAccount = isMainAccount; this.isMainAccount = isMainAccount;
} }
public String getPrintSeting() { public String getPrintSeting() {
return this.printSeting; return this.printSeting;
} }
public void setPrintSeting(String printSeting) { public void setPrintSeting(String printSeting) {
this.printSeting = printSeting; this.printSeting = printSeting;
} }
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getName1() {
return name1;
}
public void setName1(String name1) {
this.name1 = name1;
}
public String getName2() {
return name2;
}
public void setName2(String name2) {
this.name2 = name2;
}
public long getParentId() {
return parentId;
}
public void setParentId(long parentId) {
this.parentId = parentId;
}
public int getSelectQty() {
return selectQty;
}
public void setSelectQty(int selectQty) {
this.selectQty = selectQty;
}
public String getDefmodifier() {
return defmodifier;
}
public void setDefmodifier(String defmodifier) {
this.defmodifier = defmodifier;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public long getAblediscount() {
return ablediscount;
}
public void setAblediscount(long ablediscount) {
this.ablediscount = ablediscount;
}
public int getServiceCharge() {
return serviceCharge;
}
public void setServiceCharge(int serviceCharge) {
this.serviceCharge = serviceCharge;
}
public int getAutoMode() {
return autoMode;
}
public void setAutoMode(int autoMode) {
this.autoMode = autoMode;
}
public boolean isModifier() {
return isModifier;
}
public void setModifier(boolean modifier) {
isModifier = modifier;
}
public long getInvisible() {
return invisible;
}
public void setInvisible(long invisible) {
this.invisible = invisible;
}
public String getMaxNumber() {
return maxNumber;
}
public void setMaxNumber(String maxNumber) {
this.maxNumber = maxNumber;
}
public String getCurrentMaxNumber() {
return currentMaxNumber;
}
public void setCurrentMaxNumber(String currentMaxNumber) {
this.currentMaxNumber = currentMaxNumber;
}
public int getBgColor() {
return bgColor;
}
public void setBgColor(int bgColor) {
this.bgColor = bgColor;
}
public int getFontColor() {
return fontColor;
}
public void setFontColor(int fontColor) {
this.fontColor = fontColor;
}
public Modifier getModifier() {
return modifier;
}
public void setModifier(Modifier modifier) {
this.modifier = modifier;
}
public double getPointsAdd() {
return pointsAdd;
}
public void setPointsAdd(double pointsAdd) {
this.pointsAdd = pointsAdd;
}
public long getPointsRatio() {
return pointsRatio;
}
public void setPointsRatio(long pointsRatio) {
this.pointsRatio = pointsRatio;
}
public double getPointsRedeem() {
return pointsRedeem;
}
public void setPointsRedeem(double pointsRedeem) {
this.pointsRedeem = pointsRedeem;
}
public String getFoodSummary() {
return foodSummary;
}
public void setFoodSummary(String foodSummary) {
this.foodSummary = foodSummary;
}
} }
package com.gingersoft.gsa.cloud.database.bean; package com.gingersoft.gsa.cloud.database.bean;
import com.gingersoft.gsa.cloud.base.utils.MoneyUtil;
import org.greenrobot.greendao.annotation.Entity; import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated; import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id; import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Property; import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.Transient; import org.greenrobot.greendao.annotation.Transient;
import lombok.Data; import lombok.Data;
/** /**
...@@ -93,44 +90,6 @@ public class Discount { ...@@ -93,44 +90,6 @@ public class Discount {
this.memberId = memberId; this.memberId = memberId;
} }
/**
* 計算折扣金額
*
* @param discount
* @param sourcePrice
* @return
*/
public static double calculationDiscount(Discount discount, double sourcePrice) {
double discountPrice;
if (discount.getType() == 0) {
//金額折扣
discountPrice = discount.getAmount();
} else {
//百分比折扣
discountPrice = MoneyUtil.divide(MoneyUtil.multiply(sourcePrice, discount.getDiscount_value()), 100).doubleValue();
}
if (sourcePrice < discountPrice) {
//折扣金額不能超出總額
discountPrice = sourcePrice;
}
// else {
// discountPrice = sourcePrice - discountPrice;
// }
return -MoneyUtil.get_ItemDecimals_money(Math.abs(discountPrice));
}
public static double calculationMemberDiscount(int discountRate, double sourcePrice) {
double discountPrice = MoneyUtil.divide(MoneyUtil.multiply(sourcePrice, discountRate), 100).doubleValue();
if (sourcePrice < discountPrice) {
//折扣金額不能超出總額
discountPrice = sourcePrice;
}
// else {
// discountPrice = sourcePrice - discountPrice;
// }
return -MoneyUtil.get_ItemDecimals_money(Math.abs(discountPrice));
}
public Long getId() { public Long getId() {
return this.id; return this.id;
......
...@@ -2,7 +2,6 @@ package com.gingersoft.gsa.cloud.database.utils; ...@@ -2,7 +2,6 @@ package com.gingersoft.gsa.cloud.database.utils;
import android.content.Context; import android.content.Context;
import android.util.Log; import android.util.Log;
import com.gingersoft.gsa.cloud.database.DaoManager; import com.gingersoft.gsa.cloud.database.DaoManager;
import com.gingersoft.gsa.cloud.database.bean.ColorBean; import com.gingersoft.gsa.cloud.database.bean.ColorBean;
import com.gingersoft.gsa.cloud.database.greendao.ColorBeanDao; import com.gingersoft.gsa.cloud.database.greendao.ColorBeanDao;
......
package com.gingersoft.gsa.cloud.download.mvp.contract; package com.gingersoft.gsa.cloud.download.mvp.contract;
import android.content.Context;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult; import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.base.common.bean.FoodBean; import com.gingersoft.gsa.cloud.base.common.bean.FoodBean;
import com.gingersoft.gsa.cloud.database.bean.Food; import com.gingersoft.gsa.cloud.database.bean.Food;
...@@ -14,8 +12,6 @@ import com.jess.arms.base.DefaultAdapter; ...@@ -14,8 +12,6 @@ import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.mvp.IView; import com.jess.arms.mvp.IView;
import com.jess.arms.mvp.IModel; import com.jess.arms.mvp.IModel;
import java.util.List;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import io.reactivex.Observable; import io.reactivex.Observable;
......
package com.gingersoft.gsa.cloud.download.mvp.model; package com.gingersoft.gsa.cloud.download.mvp.model;
import android.app.Application; import android.app.Application;
import android.content.Context;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult; import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.base.common.bean.FoodBean; import com.gingersoft.gsa.cloud.base.common.bean.FoodBean;
...@@ -21,8 +20,6 @@ import com.jess.arms.di.scope.ActivityScope; ...@@ -21,8 +20,6 @@ import com.jess.arms.di.scope.ActivityScope;
import javax.inject.Inject; import javax.inject.Inject;
import com.gingersoft.gsa.cloud.download.mvp.contract.DownloadContract; import com.gingersoft.gsa.cloud.download.mvp.contract.DownloadContract;
import java.util.List;
import io.reactivex.Observable; import io.reactivex.Observable;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager; import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
......
...@@ -3,7 +3,6 @@ package com.gingersoft.gsa.cloud.download.mvp.presenter; ...@@ -3,7 +3,6 @@ package com.gingersoft.gsa.cloud.download.mvp.presenter;
import android.app.Application; import android.app.Application;
import com.billy.cc.core.component.CC; import com.billy.cc.core.component.CC;
import com.bumptech.glide.Glide;
import com.gingersoft.gsa.cloud.base.Api; import com.gingersoft.gsa.cloud.base.Api;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication; import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult; import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
......
package com.gingersoft.gsa.cloud.manager.mvp.model.service; package com.gingersoft.gsa.cloud.manager.mvp.model.service;
import com.gingersoft.gsa.cloud.base.Api;
import com.gingersoft.gsa.cloud.base.common.bean.BaseResult; import com.gingersoft.gsa.cloud.base.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.base.common.bean.FoodBean; import com.gingersoft.gsa.cloud.base.common.bean.FoodBean;
...@@ -8,10 +7,7 @@ import io.reactivex.Observable; ...@@ -8,10 +7,7 @@ import io.reactivex.Observable;
import me.jessyan.retrofiturlmanager.RetrofitUrlManager; import me.jessyan.retrofiturlmanager.RetrofitUrlManager;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import retrofit2.http.Body; import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET; import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST; import retrofit2.http.POST;
import retrofit2.http.Query; import retrofit2.http.Query;
......
package com.gingersoft.gsa.cloud.base.order.bean.discount; package com.gingersoft.gsa.cloud.base.order.bean.discount;
import com.gingersoft.gsa.cloud.base.order.bean.BillOrderMoney; import com.gingersoft.gsa.cloud.base.order.bean.BillOrderMoney;
import com.gingersoft.gsa.cloud.base.utils.MoneyUtil;
import com.gingersoft.gsa.cloud.database.bean.Discount;
import java.io.Serializable; import java.io.Serializable;
...@@ -241,4 +243,42 @@ public class OrderDiscount { ...@@ -241,4 +243,42 @@ public class OrderDiscount {
} }
} }
/**
* 計算折扣金額
*
* @param discount
* @param sourcePrice
* @return
*/
public static double calculationDiscount(Discount discount, double sourcePrice) {
double discountPrice;
if (discount.getType() == 0) {
//金額折扣
discountPrice = discount.getAmount();
} else {
//百分比折扣
discountPrice = MoneyUtil.divide(MoneyUtil.multiply(sourcePrice, discount.getDiscount_value()), 100).doubleValue();
}
if (sourcePrice < discountPrice) {
//折扣金額不能超出總額
discountPrice = sourcePrice;
}
// else {
// discountPrice = sourcePrice - discountPrice;
// }
return -MoneyUtil.get_ItemDecimals_money(Math.abs(discountPrice));
}
public static double calculationMemberDiscount(int discountRate, double sourcePrice) {
double discountPrice = MoneyUtil.divide(MoneyUtil.multiply(sourcePrice, discountRate), 100).doubleValue();
if (sourcePrice < discountPrice) {
//折扣金額不能超出總額
discountPrice = sourcePrice;
}
// else {
// discountPrice = sourcePrice - discountPrice;
// }
return -MoneyUtil.get_ItemDecimals_money(Math.abs(discountPrice));
}
} }
...@@ -17,16 +17,6 @@ import com.jess.arms.integration.AppManager; ...@@ -17,16 +17,6 @@ import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter; import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.RxLifecycleUtils; import com.jess.arms.utils.RxLifecycleUtils;
import com.joe.print.mvp.contract.PrintContract; import com.joe.print.mvp.contract.PrintContract;
import com.joe.print.mvp.print.PrintBill;
import com.joe.print.mvp.print.PrintCleanMachine;
import com.joe.print.mvp.print.PrintInstruction;
import com.joe.print.mvp.print.PrintOtherOrder;
import com.joe.print.mvp.print.PrintOtherOrderClosing;
import com.joe.print.mvp.print.PrintPrjKitchen;
import com.joe.print.mvp.print.PrintServe;
import com.joe.print.mvp.print.PrintSlip;
import com.joe.print.mvp.print.PrintTest;
import com.joe.print.mvp.print.PrinterRoot;
import java.util.List; import java.util.List;
......
...@@ -12,6 +12,7 @@ include 'cc-register', ...@@ -12,6 +12,7 @@ include 'cc-register',
'updateApk', 'updateApk',
'base-module', 'base-module',
'database-module',
'pay-module', 'pay-module',
'table-base', 'table-base',
'order-base', 'order-base',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment