简体   繁体   English

Java-MySQL:条形码扫描以更改数据库中的字段

[英]Java- MySQL: Barcode scan to alter field in db

I am new to Java and MySQL, and I want to build my first app.我是 Java 和 MySQL 的新手,我想构建我的第一个应用程序。 So, I run into a few problems at the start.所以,一开始我遇到了一些问题。 Two of them to be precise...其中两个准确地说...

I want to make an app (for free), to support a local Board game club, and here is the catch.我想制作一个应用程序(免费),以支持当地的棋盘游戏俱乐部,这就是问题所在。

The club wants to use Barcode scanner to read barcode in their member's membership cards.俱乐部希望使用条码扫描器读取会员会员卡上的条码。 This should alter a field in their database, which is 'bit' type, corresponding to member being in the club, or not (with 1 being active, and 0 being away).这应该改变他们数据库中的一个字段,它是“位”类型,对应于会员是否在俱乐部中(1 是活动的,0 是离开)。

Other thing is, the member should be 'active' for the whole day, and his 'activity' should reset at the end of a day.另一件事是,成员应该一整天都处于“活跃”状态,而他的“活跃”应该在一天结束时重置。 I was thinking of making it a session, but how do I make it expire at the exact time?我正在考虑将其设为会话,但如何使其在确切时间到期?

Now, I have looked for answers in other questions, but have found nothing of use...现在,我在其他问题中寻找答案,但没有发现任何有用的...

I am here for further clarifications if needed... Thank you in advance :)如果需要,我会在这里做进一步的澄清......提前谢谢你:)

The barcode scanner is, for the most part, just a keyboard replacement.大多数情况下,条码扫描器只是键盘的替代品。 Instead of typing the code by hand, the scanner will send the keystrokes for you.扫描仪不会手动输入代码,而是会为您发送按键。 You don't really need to do anything about it.你真的不需要做任何事情。

I assume the barcode represents member ID.我假设条形码代表会员 ID。 When your application reads a barcode, it should then do something like this: update members set active=1 where member_id = xxx , with xxx being the barcode.当您的应用程序读取条形码时,它应该执行以下操作: update members set active=1 where member_id = xxx xxx是条形码。

At the end of the day, you want to check all members out.在一天结束时,您想检查所有成员。 You'll do something like this: update members set active=0 where active=1 .您将执行以下操作: update members set active=0 where active=1 Depending on your situation, you can either make a button to run this action, or you can make a cron job/task schedule that will run at some fixed time.根据您的情况,您可以制作一个按钮来运行此操作,也可以制作将在某个固定时间运行的 cron 作业/任务计划。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM