SSM实现登录注册(考试报名、SSM框架、servlet、js,css、html、java)

一、具体功能:

                         实现简单的用户登录注册

                         使用超级管理员进入后台对用户信息进行修改

二、登录注册和后台界面

 

 

 

 

 三、实现代码


package com.so.common;

import java.util.List;

/**
 * DAO支持类实现
 * @author ThinkGem
 * @version 2014-05-16
 * @param <T>
 */
public interface CrudDao<T> {

    /**
     * 获取单条数据
     * @param id
     * @return
     */
    public T get(String id);
    
    /**
     * 获取单条数据
     * @param entity
     * @return
     */
    public T get(T entity);
    
    /**
     * 查询数据列表,如果需要分页,请设置分页对象,如:entity.setPage(new Page<T>());
     * @param entity
     * @return
     */
    public List<T> findList(T entity);
    
    /**
     * 查询所有数据列表
     * @param entity
     * @return
     */
    public List<T> findAllList(T entity);
    
    /**
     * 查询所有数据列表
     * @see public List<T> findAllList(T entity)
     * @return
     */
    @Deprecated
    public List<T> findAllList();
    
    /**
     * 插入数据
     * @param entity
     * @return
     */
    public int insert(T entity);
    
    /**
     * 更新数据
     * @param entity
     * @return
     */
    public int update(T entity);
    
    /**
     * 删除数据(一般为逻辑删除,更新del_flag字段为1)
     * @param id
     * @see public int delete(T entity)
     * @return
     */
    @Deprecated
    public int delete(String id);
    
    /**
     * 删除数据(一般为逻辑删除,更新del_flag字段为1)
     * @param entity
     * @return
     */
    public int delete(T entity);
    
}


package com.so.common;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import com.so.common.CrudDao;
import com.so.common.DataEntity;

/**
 * Service基类
 * @author ThinkGem
 * @version 2014-05-16
 */
public abstract class CrudService<D extends CrudDao<T>, T extends DataEntity<T>> {
    
    /**
     * 持久层对象
     */
    @Autowired
    protected D dao;
    
    /**
     * 获取单条数据
     * @param id
     * @return
     */
    public T get(String id) {
        return dao.get(id);
    }
    
    /**
     * 获取单条数据
     * @param entity
     * @return
     */
    public T get(T entity) {
        return dao.get(entity);
    }
    
    /**
     * 查询列表数据
     * @param entity
     * @return
     */
    public List<T> findList(T entity) {
        return dao.findList(entity);
    }
    
    /**
     * 查询分页数据
     * @param page 分页对象
     * @param entity
     * @return
     */
    /*public Page<T> findPage(Page<T> page, T entity) {
        entity.setPage(page);
        page.setList(dao.findList(entity));
        return page;
    }

    *//**
     * 保存数据(插入或更新)
     * @param entity
     *//*
    @Transactional(readOnly = false)
    public void save(T entity) {
        if (entity.getIsNewRecord()){
            entity.preInsert();
            dao.insert(entity);
        }else{
            entity.preUpdate();
            dao.update(entity);
        }
    }*/
    
    /**
     * 删除数据
     * @param entity
     */
    public void delete(T entity) {
        dao.delete(entity);
    }

}
 

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值