首页 > 其他分享 >11.17

11.17

时间:2023-12-18 12:34:11浏览次数:26  
标签:return 11.17 id Result logONService import public

今天实现后端代码

package com.example.controller;

import com.example.pojo.Department;
import com.example.pojo.Result;
import com.example.pojo.Staff;
import com.example.service.LogONService;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Update;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class LogONController {
    @Autowired
    private LogONService logONService;

    @GetMapping("/getByUser")
    public Result getByUser(String username, String password) {
        return Result.success(logONService.getByUser(username, password));
    }

    @GetMapping("/count")
    public ResponseEntity<Integer> count() {
        int re = logONService.count();
        return ResponseEntity.ok(re);
    }

    @GetMapping("/selectCount")
    public Result selectCount() {
        return Result.success(logONService.selectCount());
    }

    @PostMapping("/addStaff")
    public Result addStaff(@RequestBody Staff staff) {
        logONService.addStaff(staff);
        return Result.success(staff);
    }

    @PostMapping("/updateStaff")
    public Result updateStaff(@RequestBody Staff staff) {
        logONService.updateStaff(staff);
        return Result.success(staff);
    }

    @GetMapping("/getStaff")
    public Result getStaff() {
        return Result.success(logONService.getStaff());
    }

    @DeleteMapping("deleteStaff/{id}")
    public Result deleteStaff(@PathVariable("id") String id) {
        logONService.deleteStaff(id);
        return Result.success();
    }

    @GetMapping("/aDep/{id}")
    public ResponseEntity<Integer> aDep(@PathVariable("id") String id) {
        int re = logONService.aDep(id);
        return ResponseEntity.ok(re);
    }

    @GetMapping("/bDep/{name}")
    public ResponseEntity<Integer> bDep(@PathVariable("name") String name) {
        int re = logONService.bDep(name);
        return ResponseEntity.ok(re);
    }

    @GetMapping("/cDep/{id}")
    public ResponseEntity<Integer> cDep(@PathVariable("id") String id) {
        int re = logONService.cDep(id);
        return ResponseEntity.ok(re);
    }
    @GetMapping("/dDep")
    public ResponseEntity<Integer> dDep() {
        int re = logONService.dDep();
        return ResponseEntity.ok(re);
    }

    @PostMapping("/addDep")
    public Result addDep(@RequestBody Department department) {
        logONService.addDep(department);
        return Result.success(department);
    }

    @PostMapping("/updateDep")
    public Result updateDep(@RequestBody Department department) {
        logONService.updateDep(department);
        return Result.success(department);
    }

    @DeleteMapping("/deleteDep/{id}")
    public Result deleteDep(@PathVariable("id") String id) {
        logONService.deleteDep(id);
        return Result.success();
    }
    @GetMapping("/updateRole/{id}")
    public Result updateRole(@PathVariable("id") String id)
    {
        logONService.updateRole(id);
        return Result.success(logONService.selectById(id));
    }
    @GetMapping("/selectById/{id}")
    public Result selectById(@PathVariable("id") String id)
    {
        return Result.success(logONService.selectById(id));
    }
    @GetMapping("/update/{id}/{new1}")
    public Result update(@PathVariable("id") String id,@PathVariable("new1") String password)
    {
        logONService.update(id,password);
        return Result.success(selectById(id));
    }
}

StaffController

package com.example.controller;

import com.example.pojo.Attendance;
import com.example.pojo.Result;
import com.example.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/staff")
public class StaffController {
    @Autowired
    private StaffService staffService;

    @PostMapping("/add")
    public Result addStaff(@RequestBody Attendance attendance) {
        staffService.addStaff(attendance);
        return Result.success(attendance);
    }

    @GetMapping("/count")
    public ResponseEntity<Integer> count() {
        int re = staffService.count();
        return ResponseEntity.ok(re);
    }

    @GetMapping("/low")
    public Result low() {
        return Result.success(staffService.low());
    }

    @GetMapping("/approve/{name}/{type}/{i}")
    public Result approve(@PathVariable("name") String name, @PathVariable("type") String type, @PathVariable("i") String i) {
        staffService.approve(name, type, i);
        return Result.success();
    }
}

 

标签:return,11.17,id,Result,logONService,import,public
From: https://www.cnblogs.com/zzqq1314/p/17910881.html

相关文章

  • 11.17
    今日学习内容<%--CreatedbyIntelliJIDEA.TochangethistemplateuseFile|Settings|FileTemplates.--%><%@pagecontentType="text/html;charset=UTF-8"language="java"%><html><head><title>Title</ti......
  • 2023.11.17-20湖北 武汉 2023第五届全国生物医学数据挖掘与计算学术会议拟于2023年1
     2023第五届全国生物医学数据挖掘与计算学术会议拟于2023年11月17日-20日于华中科技大学举行。会议简介:     全国生物医学数据挖掘与计算学术会议是一个专注于生物医学大数据算法、软件与人工智能方法的重要学术盛会。生物医学领域的快速发展导致了大量的生物医学数据......
  • 11.13-11.17
    11.13今日任务:Java测试(完成)Java作业(完成)英语单词(完成) 11.14今日任务:数据结构上机(完成)英语单词(完成) 11.15今日任务:休息javaweb学习(完成)  11.16今日任务:乒乓球比赛(完成)英语单词(完成) 11.17今日任务:英语单词(完成)......
  • 11.17双向循环链表应用
     #include<bits/stdc++.h>usingnamespacestd;typedefstructf{intdata;f*prior;f*next;}node,*Node;voidbuild(Nodep){intn;cin>>n;while(n--){intx;cin>>x;Nodenow=newnode()......
  • 11.17~11.18暨noip2023游寄
    11.17我们DZ不负众望又干了点nt事,但是为了按时间顺序记叙,所以说放到最后再讲上午平常的起床+吃饭,然后就发手机啥的,坐大巴去德州东再坐会高铁去秦皇岛,这些简单记一下就行了重点来了先拜谢一下__int_R__在大巴上的时候tkth拉int_R回粥,然后他在自己号整了几抽出了个6星,又在tkth......
  • 11.17 复习JavaScript红宝书的笔记——
    一、原始值与引用值对于原始值和引用值的判断类型各自有对应的操作符,前者可以用typeof操作符lets="Nicholas";letb=true;leti=22;letu;letn=null;leto=newObject();console.log(typeofs);//stringconsole.log(typeofi);//numberconsole......
  • 端口号错误解决 11.17
    在大数据实验二中遇到问题:端口号错误,导致无法对hdfs中文件进行读取,解决办法:输入shell命令;hdfs getconf-confKeyfs.default.name对端口号进行查看......
  • 11.17每日总结
     今天继续学习Java,跟着B站的视频开始做maven的Javaweb项目总体感受时maven方便了我们对jar包的使用,在未来项目需要用大量jar包时maven会大大减轻我们的工作量......
  • 11.17每日总结
    本次实验属于模仿型实验,通过本次实验学生将掌握以下内容: 1、理解职责链模式的动机,掌握该模式的结构;2、能够利用职责链模式解决实际问题。[实验任务一]:财务审批某物资管理系统中物资采购需要分级审批,主任可以审批1万元及以下的采购单,部门经理可以审批5万元及以下的采购单,副总......
  • 每日总结11.17
    今天做出来了ERP模块的人事管理系统原型,学习了SpringBoot的相关知识。SpringBootStarter:他将常用的依赖分组进行了整合,将其合并到一个依赖中,这样就可以一次性添加到项目的Maven或Gradle构建中。使编码变得简单,SpringBoot采用JavaConfig的方式对Spring进行配置,并且提供了大量的......