From 29058cb911cd8f670d714b1c8a12d5a0f2cb45d8 Mon Sep 17 00:00:00 2001 From: liuchen864 <23082234@qq.com> Date: Tue, 12 Mar 2024 14:50:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AE=BF=E9=97=AE=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=A2=9E=E5=88=A0=E6=94=B9=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/LinuxAccessController.java | 147 ++++++++++++++++++ .../src/main/resources/application-dev.yml | 27 +++- .../com/win/system/domain/LinuxAccess.java | 79 ++++++++++ .../win/system/mapper/LinuxAccessMapper.java | 16 ++ .../system/service/LinuxAccessService.java | 41 +++++ .../mapper/system/LinuxAccessMapper.xml | 32 ++++ 6 files changed, 336 insertions(+), 6 deletions(-) create mode 100644 win-admin/src/main/java/com/win/web/controller/base/LinuxAccessController.java create mode 100644 win-system/src/main/java/com/win/system/domain/LinuxAccess.java create mode 100644 win-system/src/main/java/com/win/system/mapper/LinuxAccessMapper.java create mode 100644 win-system/src/main/java/com/win/system/service/LinuxAccessService.java create mode 100644 win-system/src/main/resources/mapper/system/LinuxAccessMapper.xml diff --git a/win-admin/src/main/java/com/win/web/controller/base/LinuxAccessController.java b/win-admin/src/main/java/com/win/web/controller/base/LinuxAccessController.java new file mode 100644 index 0000000..84a870a --- /dev/null +++ b/win-admin/src/main/java/com/win/web/controller/base/LinuxAccessController.java @@ -0,0 +1,147 @@ +package com.win.web.controller.base; + +import java.time.LocalDateTime; +import java.util.List; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.win.common.annotation.Log; +import com.win.common.core.controller.BaseController; +import com.win.common.core.domain.AjaxResult; +import com.win.common.core.page.TableDataInfo; +import com.win.common.enums.BusinessType; +import com.win.common.utils.bean.BeanValidators; +import com.win.common.utils.poi.ExcelUtil; +import com.win.system.domain.LinuxAccess; +import com.win.system.service.LinuxAccessService; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import javax.validation.Validator; + +/** + * 访问控制Controller + * + * @author win + * @date 2024-03-12 + */ +@RestController +@RequestMapping("/base/linuxAccess") +public class LinuxAccessController extends BaseController { + + @Autowired + protected Validator validator; + @Autowired + private LinuxAccessService linuxAccessService; + + /** + * 查询访问控制列表 + */ + @ApiOperation("查询访问控制列表") + @GetMapping("/list") + public TableDataInfo list(LinuxAccess linuxaccess) { + startPage(); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.isNull("delete_time"); + if(linuxaccess.getCompanyCode() != null && !linuxaccess.getCompanyCode().isEmpty()) { + queryWrapper.eq("company_code", linuxaccess.getCompanyCode()); + } + if(linuxaccess.getCompanyName() != null && !linuxaccess.getCompanyName().isEmpty()) { + queryWrapper.like("company_name", linuxaccess.getCompanyName()); + } + if(linuxaccess.getUri() != null && !linuxaccess.getUri().isEmpty()) { + queryWrapper.eq("uri", linuxaccess.getUri()); + } + List list = linuxAccessService.list(queryWrapper); + return getDataTable(list); + } + + /** + * 导出访问控制列表 + */ + @ApiOperation("导出访问控制列表") + @PostMapping("/export") + public void export(HttpServletResponse response, LinuxAccess linuxAccess) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.isNull("delete_time"); + if(linuxAccess.getCompanyCode() != null && !linuxAccess.getCompanyCode().isEmpty()) { + queryWrapper.eq("company_code", linuxAccess.getCompanyCode()); + } + if(linuxAccess.getCompanyName() != null && !linuxAccess.getCompanyName().isEmpty()) { + queryWrapper.like("company_name", linuxAccess.getCompanyName()); + } + if(linuxAccess.getUri() != null && !linuxAccess.getUri().isEmpty()) { + queryWrapper.eq("uri", linuxAccess.getUri()); + } + List list = linuxAccessService.list(queryWrapper); + ExcelUtil util = new ExcelUtil<>(LinuxAccess.class); + util.exportExcel(response, list, "访问控制数据"); + } + + /** + * 导入访问控制 + */ + @ApiOperation("导入访问控制模板") + @PostMapping("/importTemplate") + public void importTemplate(HttpServletResponse response) { + ExcelUtil util = new ExcelUtil<>(LinuxAccess.class); + util.importTemplateExcel(response, "访问控制数据"); + } + + /** + * 获取访问控制详细信息 + */ + @ApiOperation("获取访问控制详细信息") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return AjaxResult.success(linuxAccessService.getById(id)); + } + + /** + * 新增访问控制 + */ + @ApiOperation("新增访问控制") + @Log(title = "访问控制", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Valid @RequestBody LinuxAccess linuxAccess) { + BeanValidators.validateWithException(validator, linuxAccess); + linuxAccess.setDeptId(getDeptId()); + linuxAccess.setUserId(getUserId()); + linuxAccess.setCreateBy(getUserId()); + linuxAccess.setCreateTime(LocalDateTime.now()); + return toAjax(linuxAccessService.save(linuxAccess)); + } + + /** + * 修改访问控制 + */ + @ApiOperation("修改访问控制") + @Log(title = "访问控制", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Valid @RequestBody LinuxAccess linuxAccess) { + BeanValidators.validateWithException(validator, linuxAccess); + linuxAccess.setUpdateBy(getUserId()); + linuxAccess.setUpdateTime(LocalDateTime.now()); + return toAjax(linuxAccessService.updateById(linuxAccess)); + } + + /** + * 批量删除访问控制 + */ + @ApiOperation("批量删除访问控制") + @Log(title = "访问控制", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult batchRemove(@PathVariable Long[] ids) { + return toAjax(linuxAccessService.deleteLinuxAccessByGuids(ids, getUserId())); + } + +} diff --git a/win-admin/src/main/resources/application-dev.yml b/win-admin/src/main/resources/application-dev.yml index 44b12c6..f189818 100644 --- a/win-admin/src/main/resources/application-dev.yml +++ b/win-admin/src/main/resources/application-dev.yml @@ -149,9 +149,24 @@ swagger: # 请求前缀 pathMapping: / -# flowable相关表 -flowable: - # true 会对数据库中所有表进行更新操作。如果表不存在,则自动创建(建议开发时使用) - database-schema-update: false - # 关闭定时任务JOB - async-executor-activate: false +shell: + jlht: + qad-domain: JLHT + company-code: CCWININ + server-id: master + ip: 222.169.228.163 + port: 6122 + linux-id: mfg + linux-password: mfgpro + qad-user: mfg + qad-password: Qadwin1 + jlht2: + qad-domain: JLHT2 + company-code: CCWININ + server-id: master + ip: 222.169.228.163 + port: 6122 + linux-id: mfg + linux-password: mfgpro + qad-user: mfg + qad-password: Qadwin1 diff --git a/win-system/src/main/java/com/win/system/domain/LinuxAccess.java b/win-system/src/main/java/com/win/system/domain/LinuxAccess.java new file mode 100644 index 0000000..09423b6 --- /dev/null +++ b/win-system/src/main/java/com/win/system/domain/LinuxAccess.java @@ -0,0 +1,79 @@ +package com.win.system.domain; + +import com.win.common.annotation.Excel; +import com.win.common.core.domain.BaseEntity; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +/** + * 访问控制对象 linuxaccess + * + * @author win + * @date 2024-03-12 + */ + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +public class LinuxAccess extends BaseEntity { + + private static final long serialVersionUID = 1L; + + @Excel(name = "公司编码") + private String companyCode; + + @Excel(name = "公司名称") + private String companyName; + + @Excel(name = "服务器编码") + private String serverCode; + + @Excel(name = "ip地址") + private String ipAddress; + + @Excel(name = "端口") + private String port; + + @Excel(name = "用户") + private String userName; + + @Excel(name = "密码") + private String password; + + @Excel(name = "工作目录") + private String workPath; + + @Excel(name = "输入目录") + private String inPath; + + @Excel(name = "输出目录") + private String outPath; + + @Excel(name = "处理成功目录") + private String successPath; + + @Excel(name = "处理错误目录") + private String errorPath; + + @Excel(name = "存档目录") + private String archivePath; + + @Excel(name = "uri") + private String uri; + + @Excel(name = "qad程序编码") + private String qadProgramCode; + + @Excel(name = "脚本路径") + private String scriptPath; + + @Excel(name = "程序名") + private String scriptName; + + @Excel(name = "程序") + private String scriptProgram; + +} \ No newline at end of file diff --git a/win-system/src/main/java/com/win/system/mapper/LinuxAccessMapper.java b/win-system/src/main/java/com/win/system/mapper/LinuxAccessMapper.java new file mode 100644 index 0000000..e7107e5 --- /dev/null +++ b/win-system/src/main/java/com/win/system/mapper/LinuxAccessMapper.java @@ -0,0 +1,16 @@ +package com.win.system.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.win.system.domain.LinuxAccess; + +/** + * 【请填写功能名称】Mapper接口 + * + * @author win + * @date 2024-03-12 + */ + @InterceptorIgnore(tenantLine = "true") +public interface LinuxAccessMapper extends BaseMapper { + +} diff --git a/win-system/src/main/java/com/win/system/service/LinuxAccessService.java b/win-system/src/main/java/com/win/system/service/LinuxAccessService.java new file mode 100644 index 0000000..33c4211 --- /dev/null +++ b/win-system/src/main/java/com/win/system/service/LinuxAccessService.java @@ -0,0 +1,41 @@ +package com.win.system.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import com.win.system.mapper.LinuxAccessMapper; +import com.win.system.domain.LinuxAccess; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; + +/** + * 【请填写功能名称】Service业务层处理 + * + * @author win + * @date 2024-03-12 + */ +@Slf4j +@Service +public class LinuxAccessService extends ServiceImpl implements IService { + + /** + * 批量删除【请填写功能名称】 + * + * @param ids 需要删除的【请填写功能名称】主键 + * @return 删除的数量 + */ + @Transactional + public int deleteLinuxAccessByGuids(Long[] ids, Long userId) { + int result = 0; + for(Long id : ids) { + LinuxAccess linuxaccess = baseMapper.selectById(id); + linuxaccess.setDeleteBy(userId); + linuxaccess.setDeleteTime(LocalDateTime.now()); + result += baseMapper.updateById(linuxaccess); + } + return result; + } + +} \ No newline at end of file diff --git a/win-system/src/main/resources/mapper/system/LinuxAccessMapper.xml b/win-system/src/main/resources/mapper/system/LinuxAccessMapper.xml new file mode 100644 index 0000000..694746e --- /dev/null +++ b/win-system/src/main/resources/mapper/system/LinuxAccessMapper.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + select guid, company_code, company_name, server_code, ip_address, port, userid, password, work_path, in_path, out_path, success_path, error_path, archive_path, user_id, uri, create_datetime, update_datetime from linuxaccess + + + \ No newline at end of file