Android-javaee

This commit is contained in:
xs 2024-11-09 13:54:31 +08:00
parent 657e9578cb
commit f2dea2e506
5 changed files with 133 additions and 20 deletions

View File

@ -1,6 +1,7 @@
package com.xiaoshuai.c202201020323.smallcourse.controller;
import com.xiaoshuai.c202201020323.smallcourse.model.Att;
import com.xiaoshuai.c202201020323.smallcourse.model.Result;
import com.xiaoshuai.c202201020323.smallcourse.service.IAttService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
@ -23,10 +24,31 @@ public class AttController {
@Autowired
public IAttService attService;
@ResponseBody
@RequestMapping("/att")
public List att(){
public Result att() {
List<Att> list = attService.list();
return list;
return Result.ok().put("data", list);
}
@ResponseBody
@RequestMapping("/editAtt")
public Result editAtt(Att att) {
boolean edit = attService.saveOrUpdate(att);
if (edit) {
return Result.ok("修改成功");
}
return Result.error("修改失败");
}
@ResponseBody
@RequestMapping("/delAtt")
public Result delAtt(Integer id) {
boolean del = attService.removeById(id);
if (del) {
return Result.ok("删除成功");
}
return Result.error("删除失败");
}
}

View File

@ -1,5 +1,6 @@
package com.xiaoshuai.c202201020323.smallcourse.controller;
import com.xiaoshuai.c202201020323.smallcourse.model.Result;
import com.xiaoshuai.c202201020323.smallcourse.service.IFindService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
@ -21,10 +22,31 @@ import java.util.List;
public class FindController {
@Autowired
public IFindService findService;
@ResponseBody
@RequestMapping("/find")
public List find(){
public Result find() {
List<com.xiaoshuai.c202201020323.smallcourse.model.Find> list = findService.list();
return list;
return Result.ok().put("data", list);
}
@ResponseBody
@RequestMapping("/editFind")
public Result editFind(com.xiaoshuai.c202201020323.smallcourse.model.Find find) {
boolean edit = findService.saveOrUpdate(find);
if (edit) {
return Result.ok();
}
return Result.error();
}
@ResponseBody
@RequestMapping("/delFind")
public Result delFind(Integer id) {
boolean del = findService.removeById(id);
if (del) {
return Result.ok();
}
return Result.error();
}
}

View File

@ -1,6 +1,7 @@
package com.xiaoshuai.c202201020323.smallcourse.controller;
import com.xiaoshuai.c202201020323.smallcourse.model.Model;
import com.xiaoshuai.c202201020323.smallcourse.model.Result;
import com.xiaoshuai.c202201020323.smallcourse.service.IModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
@ -22,10 +23,31 @@ import java.util.List;
public class ModelController {
@Autowired
public IModelService modelService;
@ResponseBody
@RequestMapping("/model")
public List model(){
public Result model() {
List<Model> list = modelService.list();
return list;
return Result.ok().put("data", list);
}
@ResponseBody
@RequestMapping("/editModel")
public Result editModel(Model model) {
boolean edit = modelService.saveOrUpdate(model);
if (edit) {
return Result.ok("修改成功");
}
return Result.error("修改失败");
}
@ResponseBody
@RequestMapping("/delModel")
public Result delModel(Integer id) {
boolean del = modelService.removeById(id);
if (del) {
return Result.ok("删除成功");
}
return Result.error("删除失败");
}
}

View File

@ -1,5 +1,7 @@
package com.xiaoshuai.c202201020323.smallcourse.controller;
import com.xiaoshuai.c202201020323.smallcourse.model.MyselfCity;
import com.xiaoshuai.c202201020323.smallcourse.model.Result;
import com.xiaoshuai.c202201020323.smallcourse.service.IMyselfCityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
@ -21,10 +23,31 @@ import java.util.List;
public class MyselfCityController {
@Autowired
public IMyselfCityService myselfCityService;
@ResponseBody
@RequestMapping("/myselfCity")
public List myselfCity(){
public Result myselfCity() {
List<com.xiaoshuai.c202201020323.smallcourse.model.MyselfCity> list = myselfCityService.list();
return list;
return Result.ok().put("data", list);
}
@ResponseBody
@RequestMapping("/editMyselfCity")
public Result editMyselfCity(MyselfCity myselfCity) {
boolean edit = myselfCityService.saveOrUpdate(myselfCity);
if (edit) {
return Result.ok("修改成功");
}
return Result.error("修改失败");
}
@ResponseBody
@RequestMapping("/delMyselfCity")
public Result delMyselfCity(Integer id) {
boolean del = myselfCityService.removeById(id);
if (del) {
return Result.ok("删除成功");
}
return Result.error("删除失败");
}
}

View File

@ -1,5 +1,6 @@
package com.xiaoshuai.c202201020323.smallcourse.controller;
import com.xiaoshuai.c202201020323.smallcourse.model.Result;
import com.xiaoshuai.c202201020323.smallcourse.model.School;
import com.xiaoshuai.c202201020323.smallcourse.service.ISchoolService;
import org.springframework.beans.factory.annotation.Autowired;
@ -22,10 +23,33 @@ import java.util.List;
public class SchoolController {
@Autowired
public ISchoolService schoolService;
@ResponseBody
@RequestMapping("/school")
public List school(){
public Result school() {
List<School> list = schoolService.list();
return list;
return Result.ok().put("data", list);
}
@ResponseBody
@RequestMapping("/editSchool")
public Result editSchool(School school) {
boolean edit = schoolService.saveOrUpdate(school);
if (edit) {
return Result.ok();
} else {
return Result.error();
}
}
@ResponseBody
@RequestMapping("/delSchool")
public Result delSchool(Integer id) {
boolean del = schoolService.removeById(id);
if (del) {
return Result.ok();
} else {
return Result.error();
}
}
}