| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- package com.template.controller;
- import com.template.annotation.DESRespondSecret;
- import com.template.api.SmartSemesterControllerAPI;
- import com.template.common.utils.paramUtils;
- import com.template.model.pojo.SmartSemester;
- import com.template.model.pojo.SmartIdentity;
- import com.template.model.pojo.SmartSemester;
- import com.template.model.result.CommonResult;
- import com.template.model.result.PageUtils;
- import com.template.model.vo.SemesterVo;
- import com.template.services.SmartIdentityService;
- import com.template.services.SmartSemesterService;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.validation.BindingResult;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.stream.Collectors;
- /**
- * <p>
- * 应用管理 前端控制器
- * </p>
- *
- * @author ceshi
- * @since 2024-03-07
- */
- @RestController
- //返回参数加密注解
- @DESRespondSecret
- public class SmartSemesterController implements SmartSemesterControllerAPI {
- @Autowired
- private SmartSemesterService smartSemesterService;
- /**
- * 新增楼栋
- *
- * @param smartApply 楼栋数据
- * @param bindingResult
- * @return
- */
- @Override
- @DESRespondSecret(validated = true)
- public CommonResult insertSmartSemester(SmartSemester smartApply, BindingResult bindingResult) {
- if (bindingResult.hasErrors()) {
- String st = paramUtils.getParamError(bindingResult);
- return CommonResult.fail(st);
- }
- int result = smartSemesterService.insertSmartSemester(smartApply);
- return result > 0 ? CommonResult.ok("添加成功") : CommonResult.fail("添加失败");
- }
- /**
- * 更新楼栋
- *
- * @param sa 楼栋数据
- * @param bindingResult
- * @return
- */
- @Override
- @DESRespondSecret(validated = true)
- public CommonResult updateSmartSemesterById(SmartSemester sa, BindingResult bindingResult) {
- if (bindingResult.hasErrors()) {
- String st = paramUtils.getParamError(bindingResult);
- return CommonResult.fail(st);
- }
- int result = smartSemesterService.updateSmartSemester(sa);
- return result > 0 ? CommonResult.ok("修改成功") : CommonResult.fail("修改失败");
- }
- /**
- * 楼栋分页数据查询
- *
- * @param currentPage 当前页数
- * @param pageCount 一页数据条数
- * @param name 查询名称
- * @return
- */
- @Override
- @DESRespondSecret(validated = true)
- public CommonResult queryPageSmartSemesters(int currentPage, int pageCount, String name) {
- PageUtils<SmartSemester> result = smartSemesterService.queryPageSmartSemesters(currentPage, pageCount, name);
- return CommonResult.ok(result);
- }
- @Override
- @DESRespondSecret(validated = true)
- public CommonResult deleteSmartSemesterById(int id) {
- SmartSemester data = smartSemesterService.getSmartById(id);
- if (data == null) {
- return CommonResult.fail("当前数据不存在,删除失败!");
- }
- int result = smartSemesterService.deleteSmartSemesterById(id);
- return result > 0 ? CommonResult.ok("删除成功") : CommonResult.fail("删除失败");
- }
- }
|