基于Django的学生成绩管理系统(源码+LW+调试+讲解)

📝目录

👑项目简介

📷效果展示

📚技术栈

⌨️部分代码参考

📑MySQL表设计参考

📜项目论文

🙈为什么选择我

📩源码获取


👑项目简介

👑👑 本项目是一个基于Django的学生成绩管理系统✅✅,旨在为学校提供一个高效、便捷的成绩管理解决方案。该系统采用Django框架开发,主要功能包括学生信息录入、成绩查询、成绩分析和数据统计等。教师可以通过系统轻松录入和修改学生成绩,查看成绩单,并生成各种成绩报告。管理员可对用户权限进行管理,确保数据安全与操作便捷。系统还支持批量导入导出数据,减少人工录入错误,同时提供数据分析功能,帮助教师和管理人员实时了解学生的学习情况。通过该系统,学校可以实现成绩管理的自动化、标准化,提升管理效率,并为教学改进提供数据支持。

(具体功能以代码为准)。

📷效果展示

📚技术栈

Python

Python是一种广泛使用的高级编程语言,以其简洁的语法和强大的功能而闻名。它支持多种编程范式,包括面向对象、函数式和命令式编程,使得开发者可以根据需要选择最合适的方法。Python拥有丰富的标准库和活跃的社区,适用于数据分析、机器学习、Web开发等多个领域。

Django

Django是一个高级的Web框架,基于Python开发,旨在帮助开发者快速构建安全、可维护的Web应用。它遵循“电池全包含”的原则,提供了许多内置功能,如用户认证、数据库管理和表单处理,从而减少了开发过程中常见的重复工作。Django强调快速开发和优雅设计,是构建复杂Web应用的理想选择。

MySQL

MySQL是一种流行的开源关系数据库管理系统,以高性能和可靠性著称。它使用结构化查询语言(SQL)进行数据管理,广泛应用于各种应用程序,包括Web应用和企业级系统。MySQL支持事务处理、外键和多用户环境,能够处理大量数据和高并发请求,适合各种规模的项目。

⌨️部分代码参考

package com.controller;
 
/**
 * 用户
 * 后端接口
 */
@RestController
@RequestMapping("/yonghu")
public class YonghuController {
    @Autowired
    private YonghuService yonghuService;    
	@Autowired
	private TokenService tokenService;
	
	/**
	 * 登录
	 */
	@IgnoreAuth
	@RequestMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuming", username));
		if(u==null || !u.getMima().equals(password)) {
			return R.error("账号或密码不正确");
		}
		
		String token = tokenService.generateToken(u.getId(), username,"yonghu",  "用户" );
		return R.ok().put("token", token);
	}
 
 
	
	/**
     * 注册
     */
	@IgnoreAuth
    @RequestMapping("/register")
    public R register(@RequestBody YonghuEntity yonghu){
    	//ValidatorUtils.validateEntity(yonghu);
    	YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuming", yonghu.getYonghuming()));
		if(u!=null) {
			return R.error("注册用户已存在");
		}
		Long uId = new Date().getTime();
		yonghu.setId(uId);
        yonghuService.insert(yonghu);
        return R.ok();
    }
 
	
	/**
	 * 退出
	 */
	@RequestMapping("/logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("退出成功");
	}
	
	/**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
    	Long id = (Long)request.getSession().getAttribute("userId");
        YonghuEntity u = yonghuService.selectById(id);
        return R.ok().put("data", u);
    }
    
    /**
     * 密码重置
     */
    @IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuming", username));
    	if(u==null) {
    		return R.error("账号不存在");
    	}
        u.setMima("123456");
        yonghuService.updateById(u);
        return R.ok("密码已重置为:123456");
    }
 
 
 
    /**
     * 后台列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,YonghuEntity yonghu,
		HttpServletRequest request){
        EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
 
		PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
 
        return R.ok().put("data", page);
    }
    
    /**
     * 前台列表
     */
	@IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,YonghuEntity yonghu, 
		HttpServletRequest request){
        EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
 
		PageUtils page = yonghuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, yonghu), params), params));
        return R.ok().put("data", page);
    }
 
 
 
	/**
     * 列表
     */
    @RequestMapping("/lists")
    public R list( YonghuEntity yonghu){
       	EntityWrapper<YonghuEntity> ew = new EntityWrapper<YonghuEntity>();
      	ew.allEq(MPUtil.allEQMapPre( yonghu, "yonghu")); 
        return R.ok().put("data", yonghuService.selectListView(ew));
    }
 
	 /**
     * 查询
     */
    @RequestMapping("/query")
    public R query(YonghuEntity yonghu){
        EntityWrapper< YonghuEntity> ew = new EntityWrapper< YonghuEntity>();
 		ew.allEq(MPUtil.allEQMapPre( yonghu, "yonghu")); 
		YonghuView yonghuView =  yonghuService.selectView(ew);
		return R.ok("查询用户成功").put("data", yonghuView);
    }
	
    /**
     * 后台详情
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        YonghuEntity yonghu = yonghuService.selectById(id);
        return R.ok().put("data", yonghu);
    }
 
    /**
     * 前台详情
     */
	@IgnoreAuth
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id){
        YonghuEntity yonghu = yonghuService.selectById(id);
        return R.ok().put("data", yonghu);
    }
    
 
 
 
    /**
     * 后台保存
     */
    @RequestMapping("/save")
    @SysLog("新增用户") 
    public R save(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
        if(yonghuService.selectCount(new EntityWrapper<YonghuEntity>().eq("yonghuming", yonghu.getYonghuming()))>0) {
            return R.error("用户名已存在");
        }
    	yonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(yonghu);
    	YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuming", yonghu.getYonghuming()));
		if(u!=null) {
			return R.error("用户已存在");
		}
		yonghu.setId(new Date().getTime());
        yonghuService.insert(yonghu);
        return R.ok();
    }
    
    /**
     * 前台保存
     */
    @SysLog("新增用户")
    @RequestMapping("/add")
    public R add(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
        if(yonghuService.selectCount(new EntityWrapper<YonghuEntity>().eq("yonghuming", yonghu.getYonghuming()))>0) {
            return R.error("用户名已存在");
        }
    	yonghu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(yonghu);
    	YonghuEntity u = yonghuService.selectOne(new EntityWrapper<YonghuEntity>().eq("yonghuming", yonghu.getYonghuming()));
		if(u!=null) {
			return R.error("用户已存在");
		}
		yonghu.setId(new Date().getTime());
        yonghuService.insert(yonghu);
        return R.ok();
    }
 
 
 
    /**
     * 修改
     */
    @RequestMapping("/update")
    @Transactional
    @SysLog("修改用户")
    public R update(@RequestBody YonghuEntity yonghu, HttpServletRequest request){
        //ValidatorUtils.validateEntity(yonghu);
        if(yonghuService.selectCount(new EntityWrapper<YonghuEntity>().ne("id", yonghu.getId()).eq("yonghuming", yonghu.getYonghuming()))>0) {
            return R.error("用户名已存在");
        }
        yonghuService.updateById(yonghu);//全部更新
        return R.ok();
    }
 
 
 
    /**
     * 删除
     */
    @RequestMapping("/delete")
    @SysLog("删除用户")
    public R delete(@RequestBody Long[] ids){
        yonghuService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
    
}
 
 
package com.aspect;
 
/**
 * 系统日志,切面处理类
 */
@Aspect
@Component
public class SysLogAspect {
    @Autowired
    private SyslogService syslogService;
    
    @Pointcut("@annotation(com.annotation.SysLog)")
    public void logPointCut() { 
    }
 
    @Around("logPointCut()")
    public Object around(ProceedingJoinPoint point) throws Throwable {
        long beginTime = System.currentTimeMillis();
        //执行方法
        Object result = point.proceed();
        //执行时长(毫秒)
        long time = System.currentTimeMillis() - beginTime;
 
        //保存日志
        saveSysLog(point, time);
 
        return result;
    }
 
    private void saveSysLog(ProceedingJoinPoint joinPoint, long time) {
        MethodSignature signature = (MethodSignature) joinPoint.getSignature();
        Method method = signature.getMethod();
 
        SyslogEntity sysLog = new SyslogEntity();
        SysLog syslog = method.getAnnotation(SysLog.class);
        if(syslog != null){
            //注解上的描述
            sysLog.setOperation(syslog.value());
        }
 
        //请求的方法名
        String className = joinPoint.getTarget().getClass().getName();
        String methodName = signature.getName();
        sysLog.setMethod(className + "." + methodName + "()");
 
        //请求的参数
        Object[] args = joinPoint.getArgs();
        try{
            String params = new Gson().toJson(args[0]);
            sysLog.setParams(params);
        }catch (Exception e){
 
        }
 
        //获取request
        HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
        //设置IP地址
        sysLog.setIp(IPUtils.getIpAddr(request));
 
        //用户名
        String username = (String)request.getSession().getAttribute("username");
        sysLog.setUsername(username);
 
        sysLog.setTime(time);
        sysLog.setAddtime(new Date());
        //保存系统日志
        syslogService.insert(sysLog);
    }
}
 

📑MySQL表设计参考

列名数据类型说明
idINT唯一标识符,自动递增,主键
nameVARCHAR(255)数据项名称,可以表示数据字段的名称,不能为空
valueTEXT数据项的值,可以存储字符串、JSON、XML 等内容
created_atTIMESTAMP创建时间,默认当前时间
updated_atTIMESTAMP更新时间,自动更新为当前时间

📜项目文档

🙈为什么选择我

  • 项目可根据要求更改或定制,满足多样化需求🍰
  • 直接对接项目开发者,无中间商赚差价💰️
  • 博主自己参与项目开发,了解项目架构和细节,提供全面答疑👨‍💻
  • 提供源码、数据库、搭建环境、bug调试、技术辅导一条龙服务🐉
  • todesk、向日葵、腾讯会议、语音电话快捷交流,高效沟通📞

📩源码获取

欢迎大家点赞👍、收藏⭐️、关注 、咨询📧 下方获取👇🏻联系方式👇🏻

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值