parent
1141ecf03a
commit
08b76690e0
@ -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<TcZclb> list = tcZclbService.page(tc);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出资产列表列表
|
||||
*/
|
||||
@ApiOperation(value = " 导出资产列表列表")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, TcZclb tc) {
|
||||
List<TcZclb> list = tcZclbService.page(tc);
|
||||
ExcelUtil<TcZclb> 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<TcZclb> util = new ExcelUtil<>(TcZclb.class);
|
||||
List<TcZclb> tcZbxqList = util.importExcel(file.getInputStream());
|
||||
tcZclbService.importUser(tcZbxqList);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("通用下载excel模板")
|
||||
@PostMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
ExcelUtil<TcZclb> util = new ExcelUtil<>(TcZclb.class);
|
||||
util.importTemplateExcel(response, "资产列表详情");
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
@ -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<TcZclb> 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);
|
||||
}
|
@ -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<TcZclb> 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<TcZclb> tcZbxqList);
|
||||
}
|
@ -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<TcZclb> 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<TcZclb> tcZbxqList) {
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
if (!tcZbxqList.isEmpty()) {
|
||||
for (TcZclb items : tcZbxqList) {
|
||||
tcZclbMapper.insert(items);
|
||||
}
|
||||
successMsg.append("导入成功");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
<?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.ruoyi.tcZz.mapper.TcZclbMapper">
|
||||
|
||||
<resultMap type="TcZclb" id="TcResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="unit" column="unit" />
|
||||
<result property="zcName" column="zc_name" />
|
||||
<result property="zcAddress" column="zc_address" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectVo">
|
||||
select id,unit,zc_name,zc_address,create_by,create_time,update_by,update_time,remark from tc_zclb
|
||||
</sql>
|
||||
|
||||
<insert id="insert" parameterType="TcZclds" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into tc_zclb
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="unit != null">unit,</if>
|
||||
<if test="zcName != null">zc_name,</if>
|
||||
<if test="zcAddress != null">zc_address,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="unit != null">#{unit},</if>
|
||||
<if test="zcName != null">#{zcName},</if>
|
||||
<if test="zcAddress != null">#{zcAddress},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="update" parameterType="TcZclds">
|
||||
update tc_zclb
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="unit != null">unit = #{unit},</if>
|
||||
<if test="zcName != null">zc_name = #{zcName},</if>
|
||||
<if test="zcAddress != null">zc_address = #{zcAddress},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<delete id="deleteById">
|
||||
delete from tc_zclb where id = #{id}
|
||||
</delete>
|
||||
<delete id="deleteByIds">
|
||||
delete from tc_zclb where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<select id="getById" resultType="com.ruoyi.tcZz.domain.TcZclb" resultMap="TcResult">
|
||||
<include refid="selectVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="page" resultType="com.ruoyi.tcZz.domain.TcZclb" resultMap="TcResult">
|
||||
<include refid="selectVo"/>
|
||||
<where>
|
||||
<if test="unit != null and unit != ''"> and unit = #{unit}</if>
|
||||
<if test="zcName != null and zcName != ''"> and zc_name = #{zcName}</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in new issue