一、注册时姓名去重和符合汉字格式:

// 新用户申请加入
public void NewHuman() {
System.out.println("========新会员申请加入页面========");
Scanner sc = new Scanner(System.in);
String Pname = "";
while (true) {
System.out.println("请输入您的游戏名字:");
Pname = sc.next();
// 验证是否重名
int count = newHumanController.selectPname(Pname);
// 验证是否符合汉字格式
String reg = "^[\u4e00-\u9fa5]{0,}$";
boolean flag = Pname.matches(reg);
if (count == 0 && flag) {
System.out.println("您的游戏名字可用!!");
break;
} else {
System.out.println("抱歉,您的游戏名字不正确或已被注册,请重新输入汉字!!");
}
}
System.out.println("请输入您的职业:");
String Pprofession = sc.next();
// 调用NewHumanController层的申请加入公会join的方法
int count1 = newHumanController.join(Pname, Pprofession);
if (count1 > 0) {
System.out.println("您已申请完成,已通知相关人员,请您稍等!");
} else {
System.out.println("抱歉!您的输入有误!请重新输入:");
}
}

二、修改密码:

// 改密码
public void updatepwd() {
System.out.println("请您输入您的游戏名字:");
Scanner sc = new Scanner(System.in);
String Pname = sc.next();
System.out.println("请您输入要修改后的密码:");
String pwd1 = sc.next();
System.out.println("请您再次输入您要修改后的密码:");
String pwd2 = sc.next();
while (!pwd1.equals(pwd2)) {
System.out.println("对不起,两次输入的密码不一致,请重新输入");
System.out.println("请重新输入您的密码");
pwd1 = sc.next();
System.out.println("请再次确认您的密码");
pwd2 = sc.next();
}
int row = newHumanController.updatePwd(pwd2, Pname);
if (row > 0) {
System.out.println("修改成功!");
} else {
System.out.println("修改失败!");
}
}

三、分等级继而进入各自界面

// 公会成员登录
public void login() {
System.out.println("========公会成员登录页面========");
System.out.println("请输入您的游戏名称:");
Scanner sc = new Scanner(System.in);
String Pname = sc.next();
System.out.println("请输入您的密码:");
String Pwd = sc.next();
// 调用UserController的login方法进行登录
int count = userController.login(Pname, Pwd);
if (count > 0) {
System.out.println("登录成功!");
// 针对会员的名称搜索其等级进行判断并继而进入下个界面
int pcount = userController.plogin(Pname);
if (pcount == 1) {
// 会长级别
masterView.show1();
} else if (pcount == 2) {
// 团长级别
leaderView.show2();
} else if (pcount == 3) {
// 职业导师级别
mentorView.show3();
} else if (pcount == 4) {
// DKP管理者级别
dkperView.show4();
} else if (pcount == 5) {
// 正式团员级别
regularView.show5();
} else if (pcount == 6) {
// 替补队员级别
alternateView.show6();
} else if (pcount == 7) {
// 新会员级别
memberView.show7();
}
} else {
System.out.println("用户名或密码错误,请重新登录!");
}
}

四、将表1查询结果添加到表2

// 将状态为1的申请表中的装备的名称、获取人的ID及花费的积分添加到装备分配表
// 1.查询
public ArrayList<ApplyforClo> applyforClo() throws SQLException {
// 获取连接对象
Connection conn = JDBCUtils.getConn();
// 获取语句执行平台
String sql = "select Cclothes,Pid,Cscore from ApplyforClo where Astate=1 ";
PreparedStatement pst = conn.prepareStatement(sql);
// 执行sql
ResultSet rs = pst.executeQuery();
// 处理结果集
ArrayList<ApplyforClo> arr = new ArrayList<ApplyforClo>();
while (rs.next()) {
ApplyforClo applyforClo = new ApplyforClo();
applyforClo.setCclothes(rs.getString("Cclothes"));
applyforClo.setPid(rs.getInt("pid"));
applyforClo.setCscore(rs.getInt("cscore"));
arr.add(applyforClo);
}
// 释放资源
JDBCUtils.close(conn, pst, rs);
return arr;
} // 2.增加
public int addClothes(String Cclothes, int Pid, int Cscore) throws SQLException {
// 获取连接对象
Connection conn = JDBCUtils.getConn();
// 获取语句执行平台
String sql = "insert into Clothes (Cclothes,Pid,Cscore) values (?,?,?)";
PreparedStatement pst = conn.prepareStatement(sql);
// 执行sql
pst.setString(1, Cclothes);
pst.setInt(2, Pid);
pst.setInt(3, Cscore);
int rs = pst.executeUpdate();
// 释放资源
JDBCUtils.close(conn, pst);
return rs;
}
// 将申请表中的查询结果(遍历)添加到成员信息表:
public int addClothes() {
ArrayList<ApplyforClo> arr = null;
int row = 0;
try {
arr = getClothesDao.applyforClo();
for (ApplyforClo a : arr) {
row = getClothesDao.addClothes(a.getCclothes(), a.getPid(), a.getCscore());
}
} catch (SQLException e) {
e.printStackTrace();
}
return row;
}

JAVA分包下项目部分代码存储的更多相关文章

  1. HDFS的Java客户端操作代码(查看HDFS下所有的文件存储位置信息)

    1.查看HDFS下所有的文件存储位置信息 package Hdfs; import java.net.URI; import org.apache.hadoop.conf.Configuration; ...

  2. 工程代码不编译src的java目录下的xml文件问题及解决

    IDEA的maven项目中,默认源代码目录下(src/main/java目录)的xml等资源文件并不会在编译的时候一块打包进classes文件夹,而是直接舍弃掉.如果使用的是Eclipse,Eclip ...

  3. 记录下项目中常用到的JavaScript/JQuery代码二(大量实例)

    记录下项目中常用到的JavaScript/JQuery代码一(大量实例) 1.input输入框监听变化 <input type="text" style="widt ...

  4. Java 银联支付官网demo测试及项目整合代码

    注:原文来源与 < Java 银联支付官网demo测试及项目整合代码  > 银联支付(网关支付B2C) 一.测试官网demo a)下载官网开发包,导入eclipse等待修改(下载的开发包没 ...

  5. Java电商项目-1.构建数据库,搭建项目环境

    目录 到Github获取源码请点击此处 一. 数据库还原 二. Mybatis逆向生成工具的使用 三. 搭建项目环境 四. 在linux虚拟机上部署zookeeper, 搭建Dubbo服务. linu ...

  6. Java使用阿里云OSS对象存储上传图片

    原 Java使用阿里云OSS对象存储上传图片 2017年03月27日 10:47:28 陌上桑花开花 阅读数 26804更多 分类专栏: 工作案例总结 版权声明:本文为博主原创文章,遵循CC 4.0 ...

  7. JavaSE 基础知识(常识概念 + 基础语法)问答总结/面试题 —— 讲给应届生的 Java 开源知识项目

    写在最前面 这个项目是从20年末就立好的 flag,经过几年的学习,回过头再去看很多知识点又有新的理解.所以趁着找实习的准备,结合以前的学习储备,创建一个主要针对应届生和初学者的 Java 开源知识项 ...

  8. NLPIR分词工具的使用(java环境下)

    一.NLPIR是什么? NLPIR(汉语分词系统)由中科大张华平博士团队开发,主要功能包括:中文分词,词性标注,命名实体识别,用户词典功能,详情见官网:http://ictclas.nlpir.org ...

  9. 在Java中直接调用js代码(转载)

    http://blog.csdn.net/xzyxuanyuan/article/details/8062887 JDK1.6版添加了新的ScriptEngine类,允许用户直接执行js代码. 在Ja ...

随机推荐

  1. MySQL5.6中新增特性、不推荐使用的功能以及废弃的功能

    虽然已经使用MySQL5.6版本有一段时间了,但由于没有和之前的版本作过详细比较,所以对于哪些重要的或者不太重要的特性是在新版本中引入的,还有哪些特性已经或者将要从旧版本中移除的并没有一个十分全面的了 ...

  2. ogg日常运维命令

    1.查看历史记录.快捷执行历史中的一条命令 GGSCI (11g) 32> h 23: view param exta24: info all25: lag exta.... GGSCI (11 ...

  3. Python 静态方法和类方法的区别

    python staticmethod and classmethod Though classmethod and staticmethod are quite similar, there’s a ...

  4. 连续4个小时ping不通远端主机,则本机关机

    #!/bin/bash #连续4个小时ping不通远端主机,则本机关机. begin_time=$(date "+%s") while true;do sleep 2 ping - ...

  5. 【机器学习】k近邻算法(kNN)

    一.写在前面 本系列是对之前机器学习笔记的一个总结,这里只针对最基础的经典机器学习算法,对其本身的要点进行笔记总结,具体到算法的详细过程可以参见其他参考资料和书籍,这里顺便推荐一下Machine Le ...

  6. Spring入门第十五课

    泛型依赖注入 看代码: package logan.spring.study.generic.di; public class BaseRepository<T> { } package ...

  7. lung 分割论文

    <4D Lung Tumor Segmentation via Shape Prior and Motion Cues > Abstract— Lung tumor segmentatio ...

  8. ZOJ - 4104 Sequence in the Pocket(思维+元素移至列首排序)

    Sequence in the Pocket Time Limit: 1 Second      Memory Limit: 65536 KB DreamGrid has just found an ...

  9. 开源:基于Android的室内定位WiFi,iBeacon数据采集和定位脚本

    最近有同学联系我,也在一些群里看到有新手同学挣扎在怎么获取定位数据,不知从何下手.所以整理并开源这个基于Android的数据采集软件和基于python的KNN定位demo,算是为新手同学建立一个Bas ...

  10. Linux之常用命令简析

    ls cd mkdir rmdir touch ln cp rm mv 1.ls   显示当前目录下的文件及文件夹(不显示隐藏的) -l   显示详细信息 --all  显示隐藏的文件及文件夹(就是显 ...