`
cloudtech
  • 浏览: 4606282 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
文章分类
社区版块
存档分类
最新评论

User user=dao.findUserByCode(code);

 
阅读更多
package com.itheima.tfy.service.impl;


import java.util.UUID;


import com.itheima.tfy.dao.UserDao;
import com.itheima.tfy.dao.impl.UserDaoImpl;
import com.itheima.tfy.domain.User;


public class UserServiceImpl {
private UserDao dao=new UserDaoImpl();
//激活码由上一层传过来
public void regist(User user){
if(user.getCode()!=null &&user.getCode().equals("")){
throw new RuntimeException("激活码没有传过来");
}
user.setId(UUID.randomUUID().toString());
dao.addUser(user);

}
public void actived(String code){
User user=dao.findUserByCode(code);
if(user==null)
throw new RuntimeException("激活码有误");
user.setActived(true);
dao.update(user);
}
/**
* 登录
* @param username
* @param password
* @return 用户名或密码错误 或没有激活码都返回null
*/
public User login(String username,String password){
User user=dao.findUser(username, password);
//判断是否激活
if(user!=null){
if(!user.isActived()){
user=null;
}
}
return user;
}
}
分享到:
评论

相关推荐

    北大青鸟超市管理系统

    User user=new User(); user.setUserId(userId); user.setUserName(userName); user.setUserPassword(userPassword); user.setUserGender(userGender); user.setUserAge(userAge); user.setUserTell...

    springmybatis

    1.Configuration.xml 是 mybatis 用来建立 sessionFactory 用的,里面主要包含了数据库连接相关东西,还有 java 类所对应的别名,比如 <typeAlias alias="User" type="com.yihaomen.mybatis.model.User"/> 这个别名...

    JSF2datatable分页控件与左侧菜单

    vo.setCode(u.getCode()); vo.setDate(u.getDate()); vo.setStation(u.getStation()); vo.setUserid(u.getUserid()); vo.setText(u.getText()); dataList.add(vo); } } int size = dao....

    超市管理系统

    smbms_user 超市的工作人员 每个工作人员都有角色 smbms_role 人员的角色 3种: 系统管理员: 经理 : 普通员工: smbms_bill 超市账单 账单属于某个供应商 smbms_provider 供应商 2.项目框架...

    JSF2.xdatatable分页控件与左侧菜单最简单应用

    vo.setCode(u.getCode()); vo.setDate(u.getDate()); vo.setStation(u.getStation()); vo.setUserid(u.getUserid()); vo.setText(u.getText()); dataList.add(vo); } } int size = dao....

    Programming Excel With Vba And .net.chm

    DAO.Recordset and DAO.Recordsets Members Chapter 13. Analyzing Data with Pivot Tables Section 13.1. Quick Guide to Pivot Tables Section 13.2. Program Pivot Tables Section 13.3. PivotTable and...

    基于JavaScript的数据可视化实验室后台管理系统源码+项目说明(期末大作业).zip

    * Dao:在配置文件中的User mapper中配置具体方法实现,原始dao层只有接口. * 方法:通过查询用户名,密码和token值返回用户对象. * 业务层(service):作为User对象获取dao层数据,判断是否需要更新token,然后...

    VB编程资源大全(英文源码 数据库)

    Code example for saving and fetching the same in oracle and sql is also given.<END><br>8 , DBImpExp.zip A utility to import/export Access database from/to other application formats, e.g....

    cryptomierdas:cryptomierdas是一个NTF web3实验DAO,旨在通过专门针对西班牙语用户扩展加密世界

    cryptomierdas是一个NTF web3实验DAO,旨在扩大加密世界,并特别关注西班牙语国家。 谢谢露丝你好世界 设置 Visual Studio代码安装 Git安装 (检查默认选项) 创建Github帐户-Dani 配置Github用户$ git config --...

    Microsoft Press-Programming Microsoft Outlook And Exchange 2003 (2 of 2)

    Creating a Code-Signing Certificate 3 Reviewing the VBA Editor Interface and Options 4 Understanding Outlook 5 Outlook Profiles and Data Store 6 Outlook Sessions and Data Stores 6 Outlook Folders 6 ...

    Microsoft Press-Programming Microsoft Outlook And Exchange 2003 (1 of 2)

    Creating a Code-Signing Certificate 3 Reviewing the VBA Editor Interface and Options 4 Understanding Outlook 5 Outlook Profiles and Data Store 6 Outlook Sessions and Data Stores 6 Outlook Folders 6 ...

    java收银系统源码-MyFancyBank_v2:MyFancyBank_v2

    加了package,原本为了方便grader批改所有code都在一起。后续这个项目完全野性发展,所以加一些package方便点 v1 Description link: Project Developers: Yuqiu Lin and Xiongxin Zeng. Bank Management System ...

    VB编程资源大全(英文源码 应用)

    A417Source.zip Full original RANDOM DATA INDEXING (SY-32)METHOD)<END><br>17,LoanExpert.zip A bank loan type project that lets the user see by answering a few simple questions if the applicant is...

    Professional.MFC.with.VC6

    Source Code Files Resource Scripts ResourceView Creating New Resources Identifying Resources Dialog Boxes String Tables Accelerator Tables Menus Icons, Bitmaps and Cursors Version Resources ...

    Java学习笔记-个人整理的

    {12.18}\ttfamily user\_tables, user\_objects}{179}{section.12.18} {12.19}truncate}{179}{section.12.19} {12.20}alter}{180}{section.12.20} {12.21}constraint}{180}{section.12.21} {12.21.1}primary ...

    travel.zip

    │ │ verify_code.jpg │ │ │ ├─img │ │ └─product │ │ ├─size2 │ │ │ m20002e921ca056710da8375389bc75629.jpg │ │ │ m20055cde93431912b5a767eb0b4d2f769.jpg │ │ │ m200572bf3b...

    Report machine 2.4

    五、报表编辑器内自带ado,bde,ibx,Diamond dao,dbisam等数据访问控件,可以 通过这些控件开发独立的报表制作工具。其使用方法和delphi中的控件是一样的。 六、完全、自由自定义页面、边距、字体,标题和页眉页脚...

    Visual C++ 编程资源大全(英文源码 控件)

    (18KB)<END><br>20,dumpsome.zip DUMPSOME is a project for Visual C++ 4.x that shows how to write a CGI server extension which uses MFC and DAO. (8KB)<END><br>21,edpos.zip EDPOS is a MDI-based ...

    Visual C++ 编程资源大全(英文源码 表单)

    23.zip Dialog with Splash Screen Example Code... Splash对话框的例子(18KB)<END><br>24,24.zip Class to select directory 选择目录的类(13KB)<END><br>25,25.zip Class to select directory ...

    rm2.6正式版本

    五、报表编辑器内自带ado,bde,ibx,Diamond dao,dbisam等数据访问控件,可以 通过这些控件开发独立的报表制作工具。其使用方法和delphi中的控件是一样的。 六、完全、自由自定义页面、边距、字体,标题和...

Global site tag (gtag.js) - Google Analytics