This commit is contained in:
parent
b783415ab7
commit
1a4ea0be53
|
@ -0,0 +1,101 @@
|
|||
package com.ruoyi.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
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.system.domain.Item2;
|
||||
import com.ruoyi.system.service.IItem2Service;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 记录疫情信息表Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-29
|
||||
*/
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
@RequestMapping("/system/item2")
|
||||
public class Item2Controller extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IItem2Service item2Service;
|
||||
|
||||
/**
|
||||
* 查询记录疫情信息表列表
|
||||
*/
|
||||
@Anonymous
|
||||
/* @PreAuthorize("@ss.hasPermi('system:item2:list')")*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Item2 item2)
|
||||
{
|
||||
startPage();
|
||||
List<Item2> list = item2Service.selectItem2List(item2);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出记录疫情信息表列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:item2:export')")
|
||||
@Log(title = "记录疫情信息表", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Item2 item2)
|
||||
{
|
||||
List<Item2> list = item2Service.selectItem2List(item2);
|
||||
ExcelUtil<Item2> util = new ExcelUtil<Item2>(Item2.class);
|
||||
util.exportExcel(response, list, "记录疫情信息表数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取记录疫情信息表详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:item2:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(item2Service.selectItem2ById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增记录疫情信息表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:item2:add')")
|
||||
@Log(title = "记录疫情信息表", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Item2 item2)
|
||||
{
|
||||
return toAjax(item2Service.insertItem2(item2));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改记录疫情信息表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:item2:edit')")
|
||||
@Log(title = "记录疫情信息表", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Item2 item2)
|
||||
{
|
||||
return toAjax(item2Service.updateItem2(item2));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除记录疫情信息表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:item2:remove')")
|
||||
@Log(title = "记录疫情信息表", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(item2Service.deleteItem2ByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.ruoyi.system.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.system.utils.RestTemplateConfiguration;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@RestController
|
||||
public class NewController {
|
||||
@Autowired
|
||||
RestTemplate restTemplate;
|
||||
@RequestMapping("getnews")
|
||||
@Anonymous
|
||||
public String getNews(int page) {
|
||||
String url = "http://106.53.194.250:5001/newslist?page"+page;
|
||||
String result = restTemplate.getForEntity(url, String.class).getBody();
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 记录疫情信息表对象 item2
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-29
|
||||
*/
|
||||
public class Item2 extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** id */
|
||||
private Long id;
|
||||
|
||||
/** name */
|
||||
@Excel(name = "name")
|
||||
private String name;
|
||||
|
||||
/** idcard */
|
||||
@Excel(name = "idcard")
|
||||
private String idcard;
|
||||
|
||||
/** telephone */
|
||||
@Excel(name = "telephone")
|
||||
private String telephone;
|
||||
|
||||
/** yiqing */
|
||||
@Excel(name = "yiqing")
|
||||
private String yiqing;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setIdcard(String idcard)
|
||||
{
|
||||
this.idcard = idcard;
|
||||
}
|
||||
|
||||
public String getIdcard()
|
||||
{
|
||||
return idcard;
|
||||
}
|
||||
public void setTelephone(String telephone)
|
||||
{
|
||||
this.telephone = telephone;
|
||||
}
|
||||
|
||||
public String getTelephone()
|
||||
{
|
||||
return telephone;
|
||||
}
|
||||
public void setYiqing(String yiqing)
|
||||
{
|
||||
this.yiqing = yiqing;
|
||||
}
|
||||
|
||||
public String getYiqing()
|
||||
{
|
||||
return yiqing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("idcard", getIdcard())
|
||||
.append("telephone", getTelephone())
|
||||
.append("yiqing", getYiqing())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.Item2;
|
||||
|
||||
/**
|
||||
* 记录疫情信息表Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-29
|
||||
*/
|
||||
public interface Item2Mapper
|
||||
{
|
||||
/**
|
||||
* 查询记录疫情信息表
|
||||
*
|
||||
* @param id 记录疫情信息表主键
|
||||
* @return 记录疫情信息表
|
||||
*/
|
||||
public Item2 selectItem2ById(Long id);
|
||||
|
||||
/**
|
||||
* 查询记录疫情信息表列表
|
||||
*
|
||||
* @param item2 记录疫情信息表
|
||||
* @return 记录疫情信息表集合
|
||||
*/
|
||||
public List<Item2> selectItem2List(Item2 item2);
|
||||
|
||||
/**
|
||||
* 新增记录疫情信息表
|
||||
*
|
||||
* @param item2 记录疫情信息表
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertItem2(Item2 item2);
|
||||
|
||||
/**
|
||||
* 修改记录疫情信息表
|
||||
*
|
||||
* @param item2 记录疫情信息表
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateItem2(Item2 item2);
|
||||
|
||||
/**
|
||||
* 删除记录疫情信息表
|
||||
*
|
||||
* @param id 记录疫情信息表主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteItem2ById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除记录疫情信息表
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteItem2ByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.Item2;
|
||||
|
||||
/**
|
||||
* 记录疫情信息表Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-29
|
||||
*/
|
||||
public interface IItem2Service
|
||||
{
|
||||
/**
|
||||
* 查询记录疫情信息表
|
||||
*
|
||||
* @param id 记录疫情信息表主键
|
||||
* @return 记录疫情信息表
|
||||
*/
|
||||
public Item2 selectItem2ById(Long id);
|
||||
|
||||
/**
|
||||
* 查询记录疫情信息表列表
|
||||
*
|
||||
* @param item2 记录疫情信息表
|
||||
* @return 记录疫情信息表集合
|
||||
*/
|
||||
public List<Item2> selectItem2List(Item2 item2);
|
||||
|
||||
/**
|
||||
* 新增记录疫情信息表
|
||||
*
|
||||
* @param item2 记录疫情信息表
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertItem2(Item2 item2);
|
||||
|
||||
/**
|
||||
* 修改记录疫情信息表
|
||||
*
|
||||
* @param item2 记录疫情信息表
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateItem2(Item2 item2);
|
||||
|
||||
/**
|
||||
* 批量删除记录疫情信息表
|
||||
*
|
||||
* @param ids 需要删除的记录疫情信息表主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteItem2ByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除记录疫情信息表信息
|
||||
*
|
||||
* @param id 记录疫情信息表主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteItem2ById(Long id);
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.Item2Mapper;
|
||||
import com.ruoyi.system.domain.Item2;
|
||||
import com.ruoyi.system.service.IItem2Service;
|
||||
|
||||
/**
|
||||
* 记录疫情信息表Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-29
|
||||
*/
|
||||
@Service
|
||||
public class Item2ServiceImpl implements IItem2Service
|
||||
{
|
||||
@Autowired
|
||||
private Item2Mapper item2Mapper;
|
||||
|
||||
/**
|
||||
* 查询记录疫情信息表
|
||||
*
|
||||
* @param id 记录疫情信息表主键
|
||||
* @return 记录疫情信息表
|
||||
*/
|
||||
@Override
|
||||
public Item2 selectItem2ById(Long id)
|
||||
{
|
||||
return item2Mapper.selectItem2ById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询记录疫情信息表列表
|
||||
*
|
||||
* @param item2 记录疫情信息表
|
||||
* @return 记录疫情信息表
|
||||
*/
|
||||
@Override
|
||||
public List<Item2> selectItem2List(Item2 item2)
|
||||
{
|
||||
return item2Mapper.selectItem2List(item2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增记录疫情信息表
|
||||
*
|
||||
* @param item2 记录疫情信息表
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertItem2(Item2 item2)
|
||||
{
|
||||
return item2Mapper.insertItem2(item2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改记录疫情信息表
|
||||
*
|
||||
* @param item2 记录疫情信息表
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateItem2(Item2 item2)
|
||||
{
|
||||
return item2Mapper.updateItem2(item2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除记录疫情信息表
|
||||
*
|
||||
* @param ids 需要删除的记录疫情信息表主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteItem2ByIds(Long[] ids)
|
||||
{
|
||||
return item2Mapper.deleteItem2ByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除记录疫情信息表信息
|
||||
*
|
||||
* @param id 记录疫情信息表主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteItem2ById(Long id)
|
||||
{
|
||||
return item2Mapper.deleteItem2ById(id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.ruoyi.system.utils;
|
||||
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
@Configuration
|
||||
public class RestTemplateConfiguration {
|
||||
|
||||
@Bean
|
||||
public RestTemplate restTemplate(){
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
// 设置中文乱码问题方式一
|
||||
restTemplate.getMessageConverters().add(1,new StringHttpMessageConverter(Charset.forName("UTF-8")));
|
||||
// 设置中文乱码问题方式二
|
||||
// restTemplate.getMessageConverters().set(1,new StringHttpMessageConverter(StandardCharsets.UTF_8)); // 支持中文编码
|
||||
// return new RestTemplate();
|
||||
return restTemplate;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
<?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.system.mapper.Item2Mapper">
|
||||
|
||||
<resultMap type="Item2" id="Item2Result">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="idcard" column="idcard" />
|
||||
<result property="telephone" column="telephone" />
|
||||
<result property="yiqing" column="yiqing" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectItem2Vo">
|
||||
select id, name, idcard, telephone, yiqing from item2
|
||||
</sql>
|
||||
|
||||
<select id="selectItem2List" parameterType="Item2" resultMap="Item2Result">
|
||||
<include refid="selectItem2Vo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="idcard != null and idcard != ''"> and idcard = #{idcard}</if>
|
||||
<if test="telephone != null "> and telephone = #{telephone}</if>
|
||||
<if test="yiqing != null and yiqing != ''"> and yiqing = #{yiqing}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectItem2ById" parameterType="Long" resultMap="Item2Result">
|
||||
<include refid="selectItem2Vo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertItem2" parameterType="Item2" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into item2
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">name,</if>
|
||||
<if test="idcard != null">idcard,</if>
|
||||
<if test="telephone != null">telephone,</if>
|
||||
<if test="yiqing != null">yiqing,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="idcard != null">#{idcard},</if>
|
||||
<if test="telephone != null">#{telephone},</if>
|
||||
<if test="yiqing != null">#{yiqing},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateItem2" parameterType="Item2">
|
||||
update item2
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="idcard != null">idcard = #{idcard},</if>
|
||||
<if test="telephone != null">telephone = #{telephone},</if>
|
||||
<if test="yiqing != null">yiqing = #{yiqing},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteItem2ById" parameterType="Long">
|
||||
delete from item2 where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteItem2ByIds" parameterType="String">
|
||||
delete from item2 where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue