diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcZclbController.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcZclbController.java new file mode 100644 index 00000000..d6306296 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/TcZclbController.java @@ -0,0 +1,109 @@ +package com.ruoyi.tcZz.controller; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.tcZz.domain.TcZclb; +import com.ruoyi.tcZz.service.ITcZclbService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 资产列表(tc_zclb)表控制层 + * @author du + * @since 2024/8/5 13:16 + */ +@RestController +@Api(tags = "资产列表") +@RequestMapping("/tcZz/networkSecurity/zclb") +public class TcZclbController extends BaseController { + @Autowired + private ITcZclbService tcZclbService; + + /** + * 查询资产列表列表 + */ + @ApiOperation(value = "查询资产列表列表", response = TcZclb.class) + @GetMapping("/list") + public TableDataInfo list(TcZclb tc) { + startPage(); + List list = tcZclbService.page(tc); + return getDataTable(list); + } + + /** + * 导出资产列表列表 + */ + @ApiOperation(value = " 导出资产列表列表") + @PostMapping("/export") + public void export(HttpServletResponse response, TcZclb tc) { + List list = tcZclbService.page(tc); + ExcelUtil util = new ExcelUtil<>(TcZclb.class); + util.exportExcel(response, list, "资产列表详情数据"); + } + + /** + * 获取资产列表信息 + */ + @ApiOperation(value = " 获取资产列表信息") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return success(tcZclbService.getById(id)); + } + + /** + * 新增资产列表 + */ + @ApiOperation(value = "新增资产列表") + @PostMapping + public AjaxResult add(@RequestBody TcZclb tc) { + return toAjax(tcZclbService.insert(tc)); + } + + /** + * 修改资产列表 + */ + @ApiOperation(value = "修改资产列表") + @PutMapping + public AjaxResult edit(@RequestBody TcZclb tc) { + return toAjax(tcZclbService.update(tc)); + } + + /** + * 删除资产列表 + */ + @ApiOperation(value = "删除资产列表") + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(tcZclbService.deleteByIds(ids)); + } + + + /** + * 导入 + */ + @ApiOperation("通用导入excel信息") + @PostMapping("/common/importExcel") + public AjaxResult importExcel(MultipartFile file) throws Exception { + ExcelUtil util = new ExcelUtil<>(TcZclb.class); + List tcZbxqList = util.importExcel(file.getInputStream()); + tcZclbService.importUser(tcZbxqList); + return AjaxResult.success(); + } + + + @ApiOperation("通用下载excel模板") + @PostMapping("/importTemplate") + public void importTemplate(HttpServletResponse response) { + ExcelUtil util = new ExcelUtil<>(TcZclb.class); + util.importTemplateExcel(response, "资产列表详情"); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/domain/TcZclb.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/domain/TcZclb.java new file mode 100644 index 00000000..b9648713 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/domain/TcZclb.java @@ -0,0 +1,38 @@ +package com.ruoyi.tcZz.domain; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 资产列表(tc_zclb)表实体类 + * @author du + * @since 2024/8/5 13:20 + */ +@Data +@ApiModel("资产列表") +public class TcZclb extends BaseEntity { + + /** $column.columnComment */ + @ApiModelProperty(value = "id") + private Long id; + + + + /** 所属单位 */ + @Excel(name = "所属单位") + @ApiModelProperty(value = "所属单位") + private String unit; + + /** 资产名称 */ + @Excel(name = "资产名称") + @ApiModelProperty(value = "资产名称") + private String zcName; + + /** 资产地址 */ + @Excel(name = "资产地址") + @ApiModelProperty(value = "资产地址") + private String zcAddress; +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/mapper/TcZclbMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/mapper/TcZclbMapper.java new file mode 100644 index 00000000..3f85990b --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/mapper/TcZclbMapper.java @@ -0,0 +1,62 @@ +package com.ruoyi.tcZz.mapper; + +import com.ruoyi.tcZz.domain.TcZclb; + +import java.util.List; + +/** + * 资产列表(tc_zclds)表数据处理层 + * + * @author ruoyi + * @date 2023-10-12 + */ +public interface TcZclbMapper +{ + /** + * 查询资产列表排名 + * + * @param id 资产列表排名主键 + * @return 资产列表排名 + */ + public TcZclb getById(Long id); + + /** + * 查询资产列表排名列表 + * + * @param tcBmtb 资产列表排名 + * @return 资产列表排名集合 + */ + public List page(TcZclb tcBmtb); + + /** + * 新增资产列表排名 + * + * @param tcBmtb 资产列表排名 + * @return 结果 + */ + public int insert(TcZclb tcBmtb); + + /** + * 修改资产列表排名 + * + * @param tcBmtb 资产列表排名 + * @return 结果 + */ + public int update(TcZclb tcBmtb); + + /** + * 删除资产列表排名 + * + * @param id 资产列表排名主键 + * @return 结果 + */ + public int deleteById(Long id); + + /** + * 批量删除资产列表排名 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteByIds(Long[] ids); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/ITcZclbService.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/ITcZclbService.java new file mode 100644 index 00000000..f086875b --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/ITcZclbService.java @@ -0,0 +1,64 @@ +package com.ruoyi.tcZz.service; + +import com.ruoyi.tcZz.domain.TcZclb; +import com.ruoyi.tcZz.domain.TcZczccg; + +import java.util.List; + +/** + * 资产列表(tc_zclb)表业务层 + * + * @author ruoyi + * @date 2023-10-13 + */ +public interface ITcZclbService { + /** + * 查询资产列表 + * + * @param id 众测资产成果主键 + * @return 众测资产成果 + */ + TcZclb getById(Long id); + + /** + * 查询资产列表 + * + * @param tc 众测资产成果 + * @return 众测资产成果集合 + */ + List page(TcZclb tc); + + /** + * 新增资产列表 + * + * @param tc 众测资产成果 + * @return 结果 + */ + int insert(TcZclb tc); + + /** + * 修改资产列表 + * + * @param tc 众测资产成果 + * @return 结果 + */ + int update(TcZclb tc); + + /** + * 批量删除资产列表 + * + * @param ids 需要删除的众测资产成果主键集合 + * @return 结果 + */ + int deleteByIds(Long[] ids); + + /** + * 删除资产列表 + * + * @param id 众测资产成果主键 + * @return 结果 + */ + int deleteById(Long id); + + String importUser(List tcZbxqList); +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcZclbServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcZclbServiceImpl.java new file mode 100644 index 00000000..f4326455 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/service/impl/TcZclbServiceImpl.java @@ -0,0 +1,100 @@ +package com.ruoyi.tcZz.service.impl; + +import com.ruoyi.tcZz.domain.TcZclb; +import com.ruoyi.tcZz.mapper.TcZclbMapper; +import com.ruoyi.tcZz.service.ITcZclbService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 资产列表(tc_zclb)表业务处理层 + * + * @author ruoyi + * @date 2023-10-13 + */ +@Service +public class TcZclbServiceImpl implements ITcZclbService +{ + @Resource + private TcZclbMapper tcZclbMapper; + + /** + * 查询资产列表 + * + * @param id 资产列表主键 + * @return 资产列表 + */ + @Override + public TcZclb getById(Long id) { + return tcZclbMapper.getById(id); + } + + /** + * 查询资产列表列表 + * + * @param tc 资产列表 + * @return 资产列表集合 + */ + @Override + public List page(TcZclb tc) { + return tcZclbMapper.page(tc); + } + + /** + * 新增资产列表 + * + * @param tc 资产列表 + * @return 结果 + */ + @Override + public int insert(TcZclb tc) { + return tcZclbMapper.insert(tc); + } + + /** + * 修改资产列表 + * + * @param tc 资产列表 + * @return 结果 + */ + @Override + public int update(TcZclb tc) { + return tcZclbMapper.update(tc); + } + + /** + * 批量删除资产列表 + * + * @param ids 需要删除的资产列表主键集合 + * @return 结果 + */ + @Override + public int deleteByIds(Long[] ids) { + return tcZclbMapper.deleteByIds(ids); + } + + /** + * 删除资产列表信息 + * + * @param id 资产列表主键 + * @return 结果 + */ + @Override + public int deleteById(Long id) { + return tcZclbMapper.deleteById(id); + } + + @Override + public String importUser(List tcZbxqList) { + StringBuilder successMsg = new StringBuilder(); + if (!tcZbxqList.isEmpty()) { + for (TcZclb items : tcZbxqList) { + tcZclbMapper.insert(items); + } + successMsg.append("导入成功"); + } + return successMsg.toString(); + } +} diff --git a/ruoyi-admin/src/main/resources/mapper/tcZz/netManage/TcZclbMapper.xml b/ruoyi-admin/src/main/resources/mapper/tcZz/netManage/TcZclbMapper.xml new file mode 100644 index 00000000..a4fed7a5 --- /dev/null +++ b/ruoyi-admin/src/main/resources/mapper/tcZz/netManage/TcZclbMapper.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + select id,unit,zc_name,zc_address,create_by,create_time,update_by,update_time,remark from tc_zclb + + + + insert into tc_zclb + + unit, + zc_name, + zc_address, + create_by, + create_time, + update_by, + update_time, + remark, + + + #{unit}, + #{zcName}, + #{zcAddress}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + + + + update tc_zclb + + unit = #{unit}, + zc_name = #{zcName}, + zc_address = #{zcAddress}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + + where id = #{id} + + + delete from tc_zclb where id = #{id} + + + delete from tc_zclb where id in + + #{id} + + + + + \ No newline at end of file