queryMaxOrderSeq method

Future<int> queryMaxOrderSeq(
  1. String channelID,
  2. int channelType
)

Implementation

Future<int> queryMaxOrderSeq(String channelID, int channelType) async {
  int maxOrderSeq = 0;
  if (WKDBHelper.shared.getDB() == null) {
    return maxOrderSeq;
  }
  String sql =
      "select max(order_seq) order_seq from ${WKDBConst.tableMessage} where channel_id =? and channel_type=? and type<>99 and type<>0 and is_deleted=0";
  List<Map<String, Object?>> list = await WKDBHelper.shared
      .getDB()!
      .rawQuery(sql, [channelID, channelType]);
  if (list.isNotEmpty) {
    dynamic data = list[0];
    maxOrderSeq = WKDBConst.readInt(data, 'order_seq');
  }
  return maxOrderSeq;
}