parent
320ffee9af
commit
a48bea1b37
@ -0,0 +1,106 @@
|
||||
package com.ruoyi.zongzhi.controller;
|
||||
|
||||
import java.util.List;
|
||||
import io.swagger.annotations.Api;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
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 com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.zongzhi.domain.TcAttack;
|
||||
import com.ruoyi.zongzhi.service.ITcAttackService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 地区受攻击Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-08-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/zongzhi/attack")
|
||||
@Api(tags = " 地区受攻击")
|
||||
public class TcAttackController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ITcAttackService tcAttackService;
|
||||
|
||||
/**
|
||||
* 查询地区受攻击列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('zongzhi:attack:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(TcAttack tcAttack)
|
||||
{
|
||||
startPage();
|
||||
List<TcAttack> list = tcAttackService.selectTcAttackList(tcAttack);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出地区受攻击列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('zongzhi:attack:export')")
|
||||
@Log(title = "地区受攻击", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, TcAttack tcAttack)
|
||||
{
|
||||
List<TcAttack> list = tcAttackService.selectTcAttackList(tcAttack);
|
||||
ExcelUtil<TcAttack> util = new ExcelUtil<TcAttack>(TcAttack.class);
|
||||
util.exportExcel(response, list, "地区受攻击数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取地区受攻击详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('zongzhi:attack:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(tcAttackService.selectTcAttackById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增地区受攻击
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('zongzhi:attack:add')")
|
||||
@Log(title = "地区受攻击", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody TcAttack tcAttack)
|
||||
{
|
||||
return toAjax(tcAttackService.insertTcAttack(tcAttack));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改地区受攻击
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('zongzhi:attack:edit')")
|
||||
@Log(title = "地区受攻击", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody TcAttack tcAttack)
|
||||
{
|
||||
return toAjax(tcAttackService.updateTcAttack(tcAttack));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除地区受攻击
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('zongzhi:attack:remove')")
|
||||
@Log(title = "地区受攻击", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(tcAttackService.deleteTcAttackByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.ruoyi.zongzhi.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 地区受攻击对象 tc_attack
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-08-21
|
||||
*/
|
||||
@Data
|
||||
public class TcAttack extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* $column.columnComment
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 地区名称
|
||||
*/
|
||||
@Excel(name = "地区名称")
|
||||
@ApiModelProperty(value = "地区名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 攻击次数
|
||||
*/
|
||||
@Excel(name = "攻击次数")
|
||||
@ApiModelProperty(value = "攻击次数")
|
||||
private Long attackCount;
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.zongzhi.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.zongzhi.domain.TcAttack;
|
||||
|
||||
/**
|
||||
* 地区受攻击Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-08-21
|
||||
*/
|
||||
public interface TcAttackMapper
|
||||
{
|
||||
/**
|
||||
* 查询地区受攻击
|
||||
*
|
||||
* @param id 地区受攻击主键
|
||||
* @return 地区受攻击
|
||||
*/
|
||||
public TcAttack selectTcAttackById(Long id);
|
||||
|
||||
/**
|
||||
* 查询地区受攻击列表
|
||||
*
|
||||
* @param tcAttack 地区受攻击
|
||||
* @return 地区受攻击集合
|
||||
*/
|
||||
public List<TcAttack> selectTcAttackList(TcAttack tcAttack);
|
||||
|
||||
/**
|
||||
* 新增地区受攻击
|
||||
*
|
||||
* @param tcAttack 地区受攻击
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTcAttack(TcAttack tcAttack);
|
||||
|
||||
/**
|
||||
* 修改地区受攻击
|
||||
*
|
||||
* @param tcAttack 地区受攻击
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTcAttack(TcAttack tcAttack);
|
||||
|
||||
/**
|
||||
* 删除地区受攻击
|
||||
*
|
||||
* @param id 地区受攻击主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTcAttackById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除地区受攻击
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTcAttackByIds(Long[] ids);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.zongzhi.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.zongzhi.domain.TcAttack;
|
||||
|
||||
/**
|
||||
* 地区受攻击Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-08-21
|
||||
*/
|
||||
public interface ITcAttackService
|
||||
{
|
||||
/**
|
||||
* 查询地区受攻击
|
||||
*
|
||||
* @param id 地区受攻击主键
|
||||
* @return 地区受攻击
|
||||
*/
|
||||
public TcAttack selectTcAttackById(Long id);
|
||||
|
||||
/**
|
||||
* 查询地区受攻击列表
|
||||
*
|
||||
* @param tcAttack 地区受攻击
|
||||
* @return 地区受攻击集合
|
||||
*/
|
||||
public List<TcAttack> selectTcAttackList(TcAttack tcAttack);
|
||||
|
||||
/**
|
||||
* 新增地区受攻击
|
||||
*
|
||||
* @param tcAttack 地区受攻击
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTcAttack(TcAttack tcAttack);
|
||||
|
||||
/**
|
||||
* 修改地区受攻击
|
||||
*
|
||||
* @param tcAttack 地区受攻击
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTcAttack(TcAttack tcAttack);
|
||||
|
||||
/**
|
||||
* 批量删除地区受攻击
|
||||
*
|
||||
* @param ids 需要删除的地区受攻击主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTcAttackByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除地区受攻击信息
|
||||
*
|
||||
* @param id 地区受攻击主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTcAttackById(Long id);
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package com.ruoyi.zongzhi.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.zongzhi.mapper.TcAttackMapper;
|
||||
import com.ruoyi.zongzhi.domain.TcAttack;
|
||||
import com.ruoyi.zongzhi.service.ITcAttackService;
|
||||
|
||||
/**
|
||||
* 地区受攻击Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2023-08-21
|
||||
*/
|
||||
@Service
|
||||
public class TcAttackServiceImpl implements ITcAttackService
|
||||
{
|
||||
@Autowired
|
||||
private TcAttackMapper tcAttackMapper;
|
||||
|
||||
/**
|
||||
* 查询地区受攻击
|
||||
*
|
||||
* @param id 地区受攻击主键
|
||||
* @return 地区受攻击
|
||||
*/
|
||||
@Override
|
||||
public TcAttack selectTcAttackById(Long id)
|
||||
{
|
||||
return tcAttackMapper.selectTcAttackById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询地区受攻击列表
|
||||
*
|
||||
* @param tcAttack 地区受攻击
|
||||
* @return 地区受攻击
|
||||
*/
|
||||
@Override
|
||||
public List<TcAttack> selectTcAttackList(TcAttack tcAttack)
|
||||
{
|
||||
return tcAttackMapper.selectTcAttackList(tcAttack);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增地区受攻击
|
||||
*
|
||||
* @param tcAttack 地区受攻击
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTcAttack(TcAttack tcAttack)
|
||||
{
|
||||
return tcAttackMapper.insertTcAttack(tcAttack);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改地区受攻击
|
||||
*
|
||||
* @param tcAttack 地区受攻击
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateTcAttack(TcAttack tcAttack)
|
||||
{
|
||||
return tcAttackMapper.updateTcAttack(tcAttack);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除地区受攻击
|
||||
*
|
||||
* @param ids 需要删除的地区受攻击主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTcAttackByIds(Long[] ids)
|
||||
{
|
||||
return tcAttackMapper.deleteTcAttackByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除地区受攻击信息
|
||||
*
|
||||
* @param id 地区受攻击主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTcAttackById(Long id)
|
||||
{
|
||||
return tcAttackMapper.deleteTcAttackById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
<?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.zongzhi.mapper.TcAttackMapper">
|
||||
|
||||
<resultMap type="TcAttack" id="TcAttackResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="attackCount" column="attack_count" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTcAttackVo">
|
||||
select id, name, attack_count from tc_attack
|
||||
</sql>
|
||||
|
||||
<select id="selectTcAttackList" parameterType="TcAttack" resultMap="TcAttackResult">
|
||||
<include refid="selectTcAttackVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="attackCount != null "> and attack_count = #{attackCount}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectTcAttackById" parameterType="Long" resultMap="TcAttackResult">
|
||||
<include refid="selectTcAttackVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertTcAttack" parameterType="TcAttack">
|
||||
insert into tc_attack
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="name != null">name,</if>
|
||||
<if test="attackCount != null">attack_count,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="attackCount != null">#{attackCount},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateTcAttack" parameterType="TcAttack">
|
||||
update tc_attack
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="attackCount != null">attack_count = #{attackCount},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteTcAttackById" parameterType="Long">
|
||||
delete from tc_attack where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTcAttackByIds" parameterType="String">
|
||||
delete from tc_attack where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in new issue