liuchen864
9 months ago
6 changed files with 336 additions and 6 deletions
@ -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<LinuxAccess> 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<LinuxAccess> list = linuxAccessService.list(queryWrapper); |
||||
|
return getDataTable(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 导出访问控制列表 |
||||
|
*/ |
||||
|
@ApiOperation("导出访问控制列表") |
||||
|
@PostMapping("/export") |
||||
|
public void export(HttpServletResponse response, LinuxAccess linuxAccess) { |
||||
|
QueryWrapper<LinuxAccess> 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<LinuxAccess> list = linuxAccessService.list(queryWrapper); |
||||
|
ExcelUtil<LinuxAccess> util = new ExcelUtil<>(LinuxAccess.class); |
||||
|
util.exportExcel(response, list, "访问控制数据"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 导入访问控制 |
||||
|
*/ |
||||
|
@ApiOperation("导入访问控制模板") |
||||
|
@PostMapping("/importTemplate") |
||||
|
public void importTemplate(HttpServletResponse response) { |
||||
|
ExcelUtil<LinuxAccess> 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())); |
||||
|
} |
||||
|
|
||||
|
} |
@ -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<LinuxAccess> { |
||||
|
|
||||
|
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; |
||||
|
|
||||
|
} |
@ -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<LinuxAccess> { |
||||
|
|
||||
|
} |
@ -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<LinuxAccessMapper, LinuxAccess> implements IService<LinuxAccess> { |
||||
|
|
||||
|
/** |
||||
|
* 批量删除【请填写功能名称】 |
||||
|
* |
||||
|
* @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; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,32 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper |
||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.win.system.mapper.LinuxAccessMapper"> |
||||
|
|
||||
|
<resultMap type="LinuxAccess" id="LinuxAccessResult"> |
||||
|
<result property="guid" column="guid" /> |
||||
|
<result property="companyCode" column="company_code" /> |
||||
|
<result property="companyName" column="company_name" /> |
||||
|
<result property="serverCode" column="server_code" /> |
||||
|
<result property="ipAddress" column="ip_address" /> |
||||
|
<result property="port" column="port" /> |
||||
|
<result property="userid" column="userid" /> |
||||
|
<result property="password" column="password" /> |
||||
|
<result property="workPath" column="work_path" /> |
||||
|
<result property="inPath" column="in_path" /> |
||||
|
<result property="outPath" column="out_path" /> |
||||
|
<result property="successPath" column="success_path" /> |
||||
|
<result property="errorPath" column="error_path" /> |
||||
|
<result property="archivePath" column="archive_path" /> |
||||
|
<result property="userId" column="user_id" /> |
||||
|
<result property="uri" column="uri" /> |
||||
|
<result property="createDatetime" column="create_datetime" /> |
||||
|
<result property="updateDatetime" column="update_datetime" /> |
||||
|
</resultMap> |
||||
|
|
||||
|
<sql id="selectLinuxAccessVo"> |
||||
|
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 |
||||
|
</sql> |
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue