diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/Item2Controller.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/Item2Controller.java new file mode 100644 index 0000000..4a94ff0 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/Item2Controller.java @@ -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 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 list = item2Service.selectItem2List(item2); + ExcelUtil util = new ExcelUtil(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)); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/controller/NewController.java b/ruoyi-system/src/main/java/com/ruoyi/system/controller/NewController.java new file mode 100644 index 0000000..d6ddc6d --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/controller/NewController.java @@ -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; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/Item2.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/Item2.java new file mode 100644 index 0000000..ff1e0b0 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/Item2.java @@ -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(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/Item2Mapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/Item2Mapper.java new file mode 100644 index 0000000..5f69a13 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/Item2Mapper.java @@ -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 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); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IItem2Service.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IItem2Service.java new file mode 100644 index 0000000..c87a8b3 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IItem2Service.java @@ -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 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); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/Item2ServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/Item2ServiceImpl.java new file mode 100644 index 0000000..0931149 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/Item2ServiceImpl.java @@ -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 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); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/utils/RestTemplateConfiguration.java b/ruoyi-system/src/main/java/com/ruoyi/system/utils/RestTemplateConfiguration.java new file mode 100644 index 0000000..0d76b73 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/utils/RestTemplateConfiguration.java @@ -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; + } + +} \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/system/Item2Mapper.xml b/ruoyi-system/src/main/resources/mapper/system/Item2Mapper.xml new file mode 100644 index 0000000..ac3dd51 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/system/Item2Mapper.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + select id, name, idcard, telephone, yiqing from item2 + + + + + + + + insert into item2 + + name, + idcard, + telephone, + yiqing, + + + #{name}, + #{idcard}, + #{telephone}, + #{yiqing}, + + + + + update item2 + + name = #{name}, + idcard = #{idcard}, + telephone = #{telephone}, + yiqing = #{yiqing}, + + where id = #{id} + + + + delete from item2 where id = #{id} + + + + delete from item2 where id in + + #{id} + + + \ No newline at end of file