The invention discloses a code automatic generation method used for constructing a code automatic generation device, comprising a data layer, a component layer, a process layer, a control layer and a user interface layer, wherein, the five-layer structure is divided in accordance with functions, and every layer is independent and creates a corresponding processing model to complete data processing, component extraction, flow processing, function control and user interface processing. At the same time, a code template is created based on certain rules, and different processing codes are formed for different business objects. Based on the five-layer model and the code template, a code generating engine controls and calls the model of layers and the code template, which cooperate to complete the code automatic generation process. The invention also discloses a code automatic generation device and system; by adopting the invention, the development efficiency, the reusability and the standardization of software can be enhanced and code quality is improved.