3.1日javaweb

  今天继续进行项目的编写

package com.example.service;

import com.example.mapper.UserMapper;
import com.example.pojo.Application;
import com.example.pojo.Plan;
import com.example.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;

    public User getByUser(String username, String password) {
        return userMapper.getByUser(username,password);
    }

    public void add(Plan plan) {
         String name=plan.getName();
         int num=plan.getNumber();
         String sum=plan.getSum();
        String idea=plan.getIdea();
        String english=plan.getEnglish();
         String math=plan.getMath();
         LocalDateTime time=plan.getTime();
         userMapper.add(name,num,sum,idea,english,math,time);
    }

    public Plan decline(String type) {
        return userMapper.decline(type);
    }

    public List<Application> zizhi() {
        return userMapper.zizhi();
    }
}
package com.example.service;

import com.example.mapper.StudentMapper;
import com.example.pojo.Application;
import com.example.pojo.Plan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Random;

@Service
public class StudentService {
    @Autowired
    private StudentMapper studentMapper;

    public void addStudent(Application application) {
        String name = application.getName();
        String nameId = application.getNameId();
        String type = application.getType();
        int sum = application.getSum();
        int idea = application.getIdea();
        int english = application.getEnglish();
        int math = application.getMath();
        int major = application.getMajor();
        int status =application.getStatus();
        String username=application.getUsername();
        studentMapper.addStudent(name, nameId, type, sum, idea, english, math, major,status,username);
    }

    public Application select(String username) {
        return  studentMapper.select(username);
    }

    public List<Plan> getAll() {
        return  studentMapper.getAll();
    }
}

 

posted @ 2024-03-05 10:13  new菜鸟  阅读(11)  评论(0)    收藏  举报