The invention provides a code generator which is integrated based on a Spring MVC framework, an Apache Shiro framework and a MyBatis framework. The code generator comprises a service table configuring module, a generating scheme configuring module, a code generating engine, a data persistence layer generating module, a service layer generating module, a controller generating module, and a Jsp generating module, wherein codes are generated by the code generator based on integration of the Spring MVC framework, the Apache Shiro framework and the MyBatis framework, common single tables, multiple tables, tree form structure tables and various service related logic in an active system can be treated, and automatic generation of user access control and MyBatis mapper map files based on roles and right is realized; generated codes can be used when being unpacked, and convenience is provided for subsequent secondary development and expansion, and the development efficiency and the code quality of the system are improved.