SpringBoot自写项目记录

设置静态资源映射

@Slf4j 用来打印日志

@Configuration
@Slf4j
//设置静态资源映射
public class WebMvcConfig extends WebMvcConfigurationSupport {

    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        log.info("开始静态资源配置");
        registry.addResourceHandler("/backend/**").addResourceLocations("classpath:/backend/");
        registry.addResourceHandler("/front/**").addResourceLocations("classpath:/front/");
    }
}

创建实体类

@Data
public class Employee implements Serializable {

    private static final long serialVersionUID = 1L;

    private Long id;

    private String username;

    private String name;

    private String password;

    private String phone;

    private String sex;

    private String idNumber;//身份证密码

    private Integer status;

    private LocalDateTime createTime;

    private LocalDateTime updateTime;

    @TableField(fill = FieldFill.INSERT)
    private Long createUser;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updateUser;

}

创建Mapper文件

这里是Mybatis-plus 这里已经封装 了增删改查方法

@Mapper
public interface EmployeeMapper extends BaseMapper {
}

service 文件 

public interface EmoloyeeService extends IService {
}

EmployeeServiceImpl

@Service
public class EmployeeServiceImpl extends ServiceImpl implements EmoloyeeService {
}

你可能感兴趣的:(spring,boot,java,spring)