From 5bb31c5be579a6fda6664b14722630fa9a86e583 Mon Sep 17 00:00:00 2001 From: caihaohan Date: Fri, 24 Nov 2023 13:44:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=A8=BD=E6=9F=A5=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rpriseStandardInspectReportController.java | 176 ++++++++++++++++++ ...nterpriseStandardInspectReportService.java | 63 +++++++ ...priseStandardInspectReportServiceImpl.java | 94 ++++++++++ 3 files changed, 333 insertions(+) create mode 100644 laws-modules/src/main/java/com/jero/modules/laws/enterprise/controller/EnterpriseStandardInspectReportController.java diff --git a/laws-modules/src/main/java/com/jero/modules/laws/enterprise/controller/EnterpriseStandardInspectReportController.java b/laws-modules/src/main/java/com/jero/modules/laws/enterprise/controller/EnterpriseStandardInspectReportController.java new file mode 100644 index 00000000..34ff0c78 --- /dev/null +++ b/laws-modules/src/main/java/com/jero/modules/laws/enterprise/controller/EnterpriseStandardInspectReportController.java @@ -0,0 +1,176 @@ +package com.jero.modules.laws.enterprise.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import com.jero.common.api.vo.Result; +import com.jero.modules.laws.enterprise.entity.EnterpriseStandardInspectReport; +import com.jero.modules.laws.enterprise.service.EnterpriseStandardInspectReportService; +import com.baomidou.mybatisplus.core.metadata.IPage; +import lombok.extern.slf4j.Slf4j; +import com.jero.common.system.base.controller.JeroController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import com.jero.common.aspect.annotation.AutoLog; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.formula.functions.T; + + + /** + * @Description: 企标稽查报告 + * @Author: jero-boot + * @Date: 2023-11-24 + * @Version: V1.0 + */ +@Api(tags="企标稽查报告") +@RestController +@RequestMapping("/laws.enterprise/EnterpriseStandardInspectReport") +@Slf4j +public class EnterpriseStandardInspectReportController extends JeroController { + @Autowired + private EnterpriseStandardInspectReportService EnterpriseStandardInspectReportService; + + /** + * 分页列表查询 + * + * @param EnterpriseStandardInspectReport + * @param pageNo + * @param pageSize + * @param req + * @return + */ + @AutoLog(value = "企标稽查报告-分页列表查询") + @ApiOperation(value="企标稽查报告-分页列表查询", notes="企标稽查报告-分页列表查询") + @GetMapping(value = "/page") + public Result> queryPageList(EnterpriseStandardInspectReport EnterpriseStandardInspectReport, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + IPage pageList = EnterpriseStandardInspectReportService.queryPage(EnterpriseStandardInspectReport, pageNo, pageSize, req); + return Result.OK(pageList); + } + + /** + * 列表查询 + * + * @param EnterpriseStandardInspectReport + * @param req + * @return + */ + @AutoLog(value = "企标稽查报告-列表查询") + @ApiOperation(value="企标稽查报告-列表查询", notes="企标稽查报告-列表查询") + @GetMapping(value = "/list") + public Result> queryList(EnterpriseStandardInspectReport EnterpriseStandardInspectReport, HttpServletRequest req) { + List list = EnterpriseStandardInspectReportService.queryList(EnterpriseStandardInspectReport, req); + return Result.OK(list); + } + + /** + * 添加 + * + * @param EnterpriseStandardInspectReport + * @return + */ + @AutoLog(value = "企标稽查报告-添加") + @ApiOperation(value="企标稽查报告-添加", notes="企标稽查报告-添加") + @PostMapping(value = "/add") + public Result add(@Validated @RequestBody EnterpriseStandardInspectReport EnterpriseStandardInspectReport) { + EnterpriseStandardInspectReportService.add(EnterpriseStandardInspectReport); + return Result.OK("操作成功!"); + } + + /** + * 编辑 + * + * @param EnterpriseStandardInspectReport + * @return + */ + @AutoLog(value = "企标稽查报告-编辑") + @ApiOperation(value="企标稽查报告-编辑", notes="企标稽查报告-编辑") + @PostMapping(value = "/edit") + public Result edit(@Validated @RequestBody EnterpriseStandardInspectReport EnterpriseStandardInspectReport) { + EnterpriseStandardInspectReportService.editById(EnterpriseStandardInspectReport); + return Result.OK("操作成功!"); + } + + /** + * 通过id删除 + * + * @param map + * @return + */ + @AutoLog(value = "企标稽查报告-通过id删除") + @ApiOperation(value="企标稽查报告-通过id删除", notes="企标稽查报告-通过id删除") + @PostMapping(value = "/delete") + public Result delete(@RequestBody Map map) { + if(!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))){ + return Result.error("请选择数据!"); + } + EnterpriseStandardInspectReportService.deleteById(map.get("id")); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param map + * @return + */ + @AutoLog(value = "企标稽查报告-批量删除") + @ApiOperation(value="企标稽查报告-批量删除", notes="企标稽查报告-批量删除") + @PostMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestBody Map map) { + if(!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))){ + return Result.error("请选择数据!"); + } + this.EnterpriseStandardInspectReportService.deleteByIds(Arrays.asList(map.get("ids").split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @AutoLog(value = "企标稽查报告-通过id查询") + @ApiOperation(value="企标稽查报告-通过id查询", notes="企标稽查报告-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + EnterpriseStandardInspectReport EnterpriseStandardInspectReport = EnterpriseStandardInspectReportService.queryById(id); + if(EnterpriseStandardInspectReport==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(EnterpriseStandardInspectReport); + } + + /** + * 导出excel + * + * @param request + * @param EnterpriseStandardInspectReport + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, EnterpriseStandardInspectReport EnterpriseStandardInspectReport) { + return super.exportXls(request, EnterpriseStandardInspectReport, EnterpriseStandardInspectReport.class, "企标稽查报告"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, EnterpriseStandardInspectReport.class); + } + +} diff --git a/laws-modules/src/main/java/com/jero/modules/laws/enterprise/service/EnterpriseStandardInspectReportService.java b/laws-modules/src/main/java/com/jero/modules/laws/enterprise/service/EnterpriseStandardInspectReportService.java index 1c55e2fe..31b1665b 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/enterprise/service/EnterpriseStandardInspectReportService.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/enterprise/service/EnterpriseStandardInspectReportService.java @@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.jero.modules.laws.enterprise.entity.EnterpriseStandardInspectReport; import com.baomidou.mybatisplus.extension.service.IService; +import javax.servlet.http.HttpServletRequest; +import java.util.List; + /** * @author ThinkBook * @description 针对表【laws_enterprise_standard_inspect_report】的数据库操作Service @@ -20,4 +23,64 @@ public interface EnterpriseStandardInspectReportService extends IService getInspectReport(String inspectId, Integer pageNo, Integer pageSize); + + /** + * 分页查询 + * + * @param EnterpriseStandardInspectReport + * @param pageNo + * @param pageSize + * @param req + * @return + */ + IPage queryPage(EnterpriseStandardInspectReport EnterpriseStandardInspectReport, Integer pageNo, Integer pageSize, HttpServletRequest req); + + /** + * 列表查询 + * + * @param EnterpriseStandardInspectReport + * @param req + * @return + */ + List queryList(EnterpriseStandardInspectReport EnterpriseStandardInspectReport, HttpServletRequest req); + + /** + * 保存 + * + * @param EnterpriseStandardInspectReport + * @return + */ + void add(EnterpriseStandardInspectReport EnterpriseStandardInspectReport); + + /** + * 更新 + * + * @param EnterpriseStandardInspectReport + * @return + */ + void editById(EnterpriseStandardInspectReport EnterpriseStandardInspectReport); + + /** + * 通过id删除 + * + * @param id + * @return + */ + void deleteById(String id); + + /** + * 批量删除 + * + * @param ids + * @return + */ + void deleteByIds(List ids); + + /** + * 通过id查询 + * + * @param id + * @return + */ + EnterpriseStandardInspectReport queryById(String id); } diff --git a/laws-modules/src/main/java/com/jero/modules/laws/enterprise/service/impl/EnterpriseStandardInspectReportServiceImpl.java b/laws-modules/src/main/java/com/jero/modules/laws/enterprise/service/impl/EnterpriseStandardInspectReportServiceImpl.java index cd1a6f20..d5d9406b 100644 --- a/laws-modules/src/main/java/com/jero/modules/laws/enterprise/service/impl/EnterpriseStandardInspectReportServiceImpl.java +++ b/laws-modules/src/main/java/com/jero/modules/laws/enterprise/service/impl/EnterpriseStandardInspectReportServiceImpl.java @@ -1,9 +1,11 @@ package com.jero.modules.laws.enterprise.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.jero.common.exception.JeroBootException; +import com.jero.common.system.query.QueryGenerator; import com.jero.modules.laws.enterprise.entity.EnterpriseStandardInspectReport; import com.jero.modules.laws.enterprise.entity.vo.EnterpriseStandardInspectVo; import com.jero.modules.laws.enterprise.service.EnterpriseStandardInspectReportService; @@ -13,6 +15,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.Date; +import java.util.List; /** * @author ThinkBook @@ -34,6 +39,95 @@ public class EnterpriseStandardInspectReportServiceImpl extends ServiceImpl queryPage(EnterpriseStandardInspectReport EnterpriseStandardInspectReport, Integer pageNo, Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(EnterpriseStandardInspectReport, req.getParameterMap()); + Page page = new Page<>(pageNo, pageSize); + return page(page, queryWrapper); + } + + /** + * 列表查询 + * + * @param EnterpriseStandardInspectReport + * @param req + * @return + */ + @Override + public List queryList(EnterpriseStandardInspectReport EnterpriseStandardInspectReport, HttpServletRequest req) { + return list(QueryGenerator.initQueryWrapper(EnterpriseStandardInspectReport, req.getParameterMap())); + } + + /** + * 保存 + * + * @param EnterpriseStandardInspectReport + * @return + */ + @Override + public void add(EnterpriseStandardInspectReport EnterpriseStandardInspectReport) { + Date now = new Date(); + EnterpriseStandardInspectReport.setCreateTime(now); + EnterpriseStandardInspectReport.setUpdateTime(now); + save(EnterpriseStandardInspectReport); + } + + /** + * 更新 + * + * @param EnterpriseStandardInspectReport + * @return + */ + @Override + public void editById(EnterpriseStandardInspectReport EnterpriseStandardInspectReport) { + Date now = new Date(); + EnterpriseStandardInspectReport.setUpdateTime(now); + saveOrUpdate(EnterpriseStandardInspectReport); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @Override + public void deleteById(String id) { + removeById(id); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @Override + public void deleteByIds(List ids) { + removeByIds(ids); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @Override + public EnterpriseStandardInspectReport queryById(String id) { + return getById(id); + } }