Giter Club home page Giter Club logo

durcframework's Introduction

框架介绍:
	durcframework是一个基于SpringMVC + Mybatis的框架。其设计目的在于提高开发效率,避免做重复的工作。尤其是在做管理后台时,能减少许多代码量。
 
框架用到的技术点:
	1. 采用泛型设计,对数据库的增删改查做了适度的封装。只需少量代码就能完成一个模块的CRUD操作。
	2. 使用注解来生成查询条件,mybatis文件不需要额外配置,减少了mybatis的代码量。
	3. 使用Java代码动态生成查询条件,可以根据不同场景,不同业务来组装查询条件。
	4. 可以配合前台做Ajax开发,传输JSON格式数据,也可以使用传统SpringMVC到jsp页面。
	5. 后台自动验证功能,支持JSR-303。

使用本框架可以完成的事:
	1. 少量代码完成对一张表的增删改查。
	2. 数据导出
	3. 数据校验

==============================
Controller完成对学生表的增删改查

// 继承CrudController,表示该Controller具有增删改查功能
@Controller
public class StudentCrudController extends CrudController<Student, StudentService> {
	
	@RequestMapping("/addStudent.do")
	public ModelAndView addStudent(Student student) {
		ModelAndView mav = this.save(student);
		System.out.println("添加后的主键ID:"+ student.getId());
		return mav;
	}
	
	@RequestMapping("/listStudent.do")
	public ModelAndView listStudent(SearchStudentEntity searchStudentEntity) {
		return this.queryByEntity(searchStudentEntity);
	}
	
	@RequestMapping("/updateStudent.do")
	public ModelAndView updateStudent(Student student) {
		return this.update(student);
	}
	
	// 传一个id值即可,根据主键删除
	@RequestMapping("/delStudent.do")
	public ModelAndView delStudent(Student student) {
		// 通过主键查询某一条记录
		System.out.println(this.getService().get(student.getId()));
		return this.delete(student);
	}
	
}
// 只需简单继承无需其它代码
@Service
public class StudentService extends CrudService<Student, StudentDao> {}

// 只需简单继承无需其它代码
public interface StudentDao extends BaseDao<Student> {}

durcframework's People

Contributors

thc75 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.