This commit is contained in:
parent
c754ef9397
commit
2a3d36a7b0
|
@ -6,15 +6,15 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@RestController
|
||||
public class NewsController {
|
||||
@Autowired
|
||||
RestTemplate restTemplate;
|
||||
@RequestMapping("getnews")
|
||||
@Anonymous
|
||||
public String getnews(){
|
||||
String url = "http://106.53.194.250:5001/newslist";
|
||||
String result = restTemplate.getForEntity(url,String.class).getBody();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
//@RestController
|
||||
//public class NewsController {
|
||||
//// @Autowired
|
||||
//// RestTemplate restTemplate;
|
||||
// @RequestMapping("getnews")
|
||||
// @Anonymous
|
||||
// public String getnews(){
|
||||
// String url = "http://106.53.194.250:5001/newslist";
|
||||
// String result = restTemplate.getForEntity(url,String.class).getBody();
|
||||
// return result;
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
package com.ruoyi.system.controller.controller;
|
||||
|
||||
import java.util.List;
|
||||
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.system.domain.Ticket;
|
||||
import com.ruoyi.system.service.ITicketService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* messageController
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/ticket")
|
||||
public class TicketController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ITicketService ticketService;
|
||||
|
||||
/**
|
||||
* 查询message列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:ticket:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Ticket ticket)
|
||||
{
|
||||
startPage();
|
||||
List<Ticket> list = ticketService.selectTicketList(ticket);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出message列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:ticket:export')")
|
||||
@Log(title = "message", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Ticket ticket)
|
||||
{
|
||||
List<Ticket> list = ticketService.selectTicketList(ticket);
|
||||
ExcelUtil<Ticket> util = new ExcelUtil<Ticket>(Ticket.class);
|
||||
util.exportExcel(response, list, "message数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取message详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:ticket:query')")
|
||||
@GetMapping(value = "/{detail}")
|
||||
public AjaxResult getInfo(@PathVariable("detail") String detail)
|
||||
{
|
||||
return success(ticketService.selectTicketByDetail(detail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增message
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:ticket:add')")
|
||||
@Log(title = "message", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Ticket ticket)
|
||||
{
|
||||
return toAjax(ticketService.insertTicket(ticket));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改message
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:ticket:edit')")
|
||||
@Log(title = "message", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Ticket ticket)
|
||||
{
|
||||
return toAjax(ticketService.updateTicket(ticket));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除message
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:ticket:remove')")
|
||||
@Log(title = "message", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{details}")
|
||||
public AjaxResult remove(@PathVariable String[] details)
|
||||
{
|
||||
return toAjax(ticketService.deleteTicketByDetails(details));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* message对象 ticket
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-29
|
||||
*/
|
||||
public class Ticket extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String detail;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Long fee;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Long people;
|
||||
|
||||
public void setDetail(String detail)
|
||||
{
|
||||
this.detail = detail;
|
||||
}
|
||||
|
||||
public String getDetail()
|
||||
{
|
||||
return detail;
|
||||
}
|
||||
public void setFee(Long fee)
|
||||
{
|
||||
this.fee = fee;
|
||||
}
|
||||
|
||||
public Long getFee()
|
||||
{
|
||||
return fee;
|
||||
}
|
||||
public void setPeople(Long people)
|
||||
{
|
||||
this.people = people;
|
||||
}
|
||||
|
||||
public Long getPeople()
|
||||
{
|
||||
return people;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("detail", getDetail())
|
||||
.append("fee", getFee())
|
||||
.append("people", getPeople())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.Ticket;
|
||||
|
||||
/**
|
||||
* messageMapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-29
|
||||
*/
|
||||
public interface TicketMapper
|
||||
{
|
||||
/**
|
||||
* 查询message
|
||||
*
|
||||
* @param detail message主键
|
||||
* @return message
|
||||
*/
|
||||
public Ticket selectTicketByDetail(String detail);
|
||||
|
||||
/**
|
||||
* 查询message列表
|
||||
*
|
||||
* @param ticket message
|
||||
* @return message集合
|
||||
*/
|
||||
public List<Ticket> selectTicketList(Ticket ticket);
|
||||
|
||||
/**
|
||||
* 新增message
|
||||
*
|
||||
* @param ticket message
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTicket(Ticket ticket);
|
||||
|
||||
/**
|
||||
* 修改message
|
||||
*
|
||||
* @param ticket message
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTicket(Ticket ticket);
|
||||
|
||||
/**
|
||||
* 删除message
|
||||
*
|
||||
* @param detail message主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTicketByDetail(String detail);
|
||||
|
||||
/**
|
||||
* 批量删除message
|
||||
*
|
||||
* @param details 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTicketByDetails(String[] details);
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.Ticket;
|
||||
|
||||
/**
|
||||
* messageService接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-29
|
||||
*/
|
||||
public interface ITicketService
|
||||
{
|
||||
/**
|
||||
* 查询message
|
||||
*
|
||||
* @param detail message主键
|
||||
* @return message
|
||||
*/
|
||||
public Ticket selectTicketByDetail(String detail);
|
||||
|
||||
/**
|
||||
* 查询message列表
|
||||
*
|
||||
* @param ticket message
|
||||
* @return message集合
|
||||
*/
|
||||
public List<Ticket> selectTicketList(Ticket ticket);
|
||||
|
||||
/**
|
||||
* 新增message
|
||||
*
|
||||
* @param ticket message
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTicket(Ticket ticket);
|
||||
|
||||
/**
|
||||
* 修改message
|
||||
*
|
||||
* @param ticket message
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTicket(Ticket ticket);
|
||||
|
||||
/**
|
||||
* 批量删除message
|
||||
*
|
||||
* @param details 需要删除的message主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTicketByDetails(String[] details);
|
||||
|
||||
/**
|
||||
* 删除message信息
|
||||
*
|
||||
* @param detail message主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTicketByDetail(String detail);
|
||||
}
|
|
@ -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.TicketMapper;
|
||||
import com.ruoyi.system.domain.Ticket;
|
||||
import com.ruoyi.system.service.ITicketService;
|
||||
|
||||
/**
|
||||
* messageService业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-11-29
|
||||
*/
|
||||
@Service
|
||||
public class TicketServiceImpl implements ITicketService
|
||||
{
|
||||
@Autowired
|
||||
private TicketMapper ticketMapper;
|
||||
|
||||
/**
|
||||
* 查询message
|
||||
*
|
||||
* @param detail message主键
|
||||
* @return message
|
||||
*/
|
||||
@Override
|
||||
public Ticket selectTicketByDetail(String detail)
|
||||
{
|
||||
return ticketMapper.selectTicketByDetail(detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询message列表
|
||||
*
|
||||
* @param ticket message
|
||||
* @return message
|
||||
*/
|
||||
@Override
|
||||
public List<Ticket> selectTicketList(Ticket ticket)
|
||||
{
|
||||
return ticketMapper.selectTicketList(ticket);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增message
|
||||
*
|
||||
* @param ticket message
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTicket(Ticket ticket)
|
||||
{
|
||||
return ticketMapper.insertTicket(ticket);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改message
|
||||
*
|
||||
* @param ticket message
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateTicket(Ticket ticket)
|
||||
{
|
||||
return ticketMapper.updateTicket(ticket);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除message
|
||||
*
|
||||
* @param details 需要删除的message主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTicketByDetails(String[] details)
|
||||
{
|
||||
return ticketMapper.deleteTicketByDetails(details);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除message信息
|
||||
*
|
||||
* @param detail message主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTicketByDetail(String detail)
|
||||
{
|
||||
return ticketMapper.deleteTicketByDetail(detail);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package 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,64 @@
|
|||
<?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.TicketMapper">
|
||||
|
||||
<resultMap type="Ticket" id="TicketResult">
|
||||
<result property="detail" column="detail" />
|
||||
<result property="fee" column="fee" />
|
||||
<result property="people" column="people" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTicketVo">
|
||||
select detail, fee, people from ticket
|
||||
</sql>
|
||||
|
||||
<select id="selectTicketList" parameterType="Ticket" resultMap="TicketResult">
|
||||
<include refid="selectTicketVo"/>
|
||||
<where>
|
||||
<if test="detail != null and detail != ''"> and detail = #{detail}</if>
|
||||
<if test="fee != null "> and fee = #{fee}</if>
|
||||
<if test="people != null "> and people = #{people}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectTicketByDetail" parameterType="String" resultMap="TicketResult">
|
||||
<include refid="selectTicketVo"/>
|
||||
where detail = #{detail}
|
||||
</select>
|
||||
|
||||
<insert id="insertTicket" parameterType="Ticket">
|
||||
insert into ticket
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="detail != null">detail,</if>
|
||||
<if test="fee != null">fee,</if>
|
||||
<if test="people != null">people,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="detail != null">#{detail},</if>
|
||||
<if test="fee != null">#{fee},</if>
|
||||
<if test="people != null">#{people},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateTicket" parameterType="Ticket">
|
||||
update ticket
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="fee != null">fee = #{fee},</if>
|
||||
<if test="people != null">people = #{people},</if>
|
||||
</trim>
|
||||
where detail = #{detail}
|
||||
</update>
|
||||
|
||||
<delete id="deleteTicketByDetail" parameterType="String">
|
||||
delete from ticket where detail = #{detail}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTicketByDetails" parameterType="String">
|
||||
delete from ticket where detail in
|
||||
<foreach item="detail" collection="array" open="(" separator="," close=")">
|
||||
#{detail}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue