dev #1
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
73
pom.xml
73
pom.xml
|
@ -14,4 +14,77 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.6.2</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.kafka</groupId>
|
||||
<artifactId>spring-kafka</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.33</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>1.3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
<version>2.0.39</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-oxm</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package com.bwie;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/11 下午9:08
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class Application {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.bwie.admin;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.deser.std.DateDeserializers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/11 下午7:33
|
||||
*/
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Pur {
|
||||
|
||||
|
||||
private String id;
|
||||
|
||||
private String xm;
|
||||
|
||||
private String age;
|
||||
|
||||
private String time;
|
||||
|
||||
private String card;
|
||||
|
||||
private String photo1;
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.bwie.admin;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/12 下午3:10
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Pur2 {
|
||||
|
||||
private String id;
|
||||
|
||||
private String xm;
|
||||
|
||||
|
||||
|
||||
private String card;
|
||||
|
||||
private String photo1;
|
||||
|
||||
private String photo2;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.bwie.admin;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/12 下午3:12
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Pur3 {
|
||||
|
||||
private String id;
|
||||
|
||||
|
||||
private String time;
|
||||
|
||||
private String plate;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package com.bwie.config;
|
||||
|
||||
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 消息发送确认配置 消息发送到交换机的确认
|
||||
*/
|
||||
@Component
|
||||
public class ConfirmCallbackConfig implements RabbitTemplate.ConfirmCallback {
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
/**
|
||||
* @PostContruct是spring框架的注解,在⽅法上加该注解会在项⽬启动的时候执⾏该⽅法,也可以理解为在spring容器初始化的时候执
|
||||
* @PostConstruct bean 被初始化的时候执行的方法的注解
|
||||
* @PreDestory bean 被销毁的时候执行的方法的注解
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
rabbitTemplate.setConfirmCallback(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 交换机不管是否收到消息的一个回调方法
|
||||
*
|
||||
* @param correlationData 消息相关数据
|
||||
* @param ack 交换机是否收到消息
|
||||
* @param cause 失败原因
|
||||
*/
|
||||
@Override
|
||||
public void confirm(CorrelationData correlationData, boolean ack, String cause) {
|
||||
if (ack) {
|
||||
// 消息投递到 broker 的状态,true表示成功
|
||||
System.out.println("消息发送成功!");
|
||||
} else {
|
||||
// 发送异常
|
||||
System.out.println("发送异常原因 = " + cause);
|
||||
// TODO 可以将消息 内容 以及 失败的原因 记录到 日志表中
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.bwie.config;
|
||||
|
||||
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
|
||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||
import org.springframework.amqp.rabbit.core.RabbitAdmin;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* RabbitAdmin是RabbitMQ的一个Java客户端库,它提供了管理RabbitMQ资源的功能。它是通过与RabbitMQ服务器进行交互来执行管理操作的。
|
||||
*/
|
||||
@Configuration
|
||||
public class RabbitAdminConfig {
|
||||
|
||||
@Value("${spring.rabbitmq.host}")
|
||||
private String host;
|
||||
@Value("${spring.rabbitmq.username}")
|
||||
private String username;
|
||||
@Value("${spring.rabbitmq.password}")
|
||||
private String password;
|
||||
@Value("${spring.rabbitmq.virtualhost}")
|
||||
private String virtualhost;
|
||||
|
||||
/**
|
||||
* 构建 RabbitMQ的连接工厂
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public ConnectionFactory connectionFactory() {
|
||||
CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
|
||||
connectionFactory.setAddresses(host);
|
||||
connectionFactory.setUsername(username);
|
||||
connectionFactory.setPassword(password);
|
||||
connectionFactory.setVirtualHost(virtualhost);
|
||||
// 配置发送确认回调时,次配置必须配置,否则即使在RabbitTemplate配置了ConfirmCallback也不会生效
|
||||
connectionFactory.setPublisherConfirmType(CachingConnectionFactory.ConfirmType.CORRELATED);
|
||||
connectionFactory.setPublisherReturns(true);
|
||||
return connectionFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自己初始化 RabbitAdmin
|
||||
* @param connectionFactory
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public RabbitAdmin rabbitAdmin(ConnectionFactory connectionFactory) {
|
||||
RabbitAdmin rabbitAdmin = new RabbitAdmin(connectionFactory);
|
||||
rabbitAdmin.setAutoStartup(true);
|
||||
return rabbitAdmin;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.bwie.config;
|
||||
|
||||
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
||||
import org.springframework.amqp.support.converter.MessageConverter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class RabbitmqConfig {
|
||||
// 消息转换配置
|
||||
@Bean
|
||||
public MessageConverter jsonMessageConverter() {
|
||||
return new Jackson2JsonMessageConverter();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.bwie.config;
|
||||
|
||||
import org.springframework.amqp.core.ReturnedMessage;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 消息发送到队列的确认 一旦消息发送到队列失败 则会执行 returnedMessage 方法
|
||||
*/
|
||||
@Component
|
||||
public class ReturnCallbackConfig implements RabbitTemplate.ReturnsCallback {
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@PostConstruct // @PostContruct是spring框架的注解,在⽅法上加该注解会在项⽬启动的时候执⾏该⽅法,也可以理解为在spring容器初始化的时候执
|
||||
public void init() {
|
||||
rabbitTemplate.setReturnsCallback(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息发送到 队列失败 执行的 方法
|
||||
* @param returnedMessage the returned message and metadata.
|
||||
*/
|
||||
@Override
|
||||
public void returnedMessage(ReturnedMessage returnedMessage) {
|
||||
System.out.println("消息" + returnedMessage.getMessage().toString() + "被交换机" + returnedMessage.getExchange() + "回退!"
|
||||
+ "退回原因为:" + returnedMessage.getReplyText());
|
||||
// 回退了所有的信息,可做补偿机制 记录到 数据库
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
//package com.bwie.consumer;
|
||||
//
|
||||
//import lombok.extern.log4j.Log4j2;
|
||||
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.jdbc.core.JdbcTemplate;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import java.sql.Timestamp;
|
||||
//
|
||||
///**
|
||||
// * @Author: wangxinyuan
|
||||
// * @Date: 2024/4/11 下午7:40
|
||||
// */
|
||||
////@Component
|
||||
//@Log4j2
|
||||
//public class ConsumeData2 {
|
||||
//
|
||||
// //@Autowired
|
||||
// private JdbcTemplate jdbcTemplate;
|
||||
//
|
||||
// //@RabbitListener(queues = "data2")
|
||||
// public void consumeData2(String message) {
|
||||
// log.info("Received data2: " + message);
|
||||
// saveDataToDatabase(message);
|
||||
// }
|
||||
//
|
||||
// private void saveDataToDatabase(String message) {
|
||||
// try {
|
||||
// String[] parts = message.split(",");
|
||||
// if (parts.length >= 9) {
|
||||
// String id = parts[0];
|
||||
// String XM = parts[1];
|
||||
// String Age = parts[2];
|
||||
// String timeStr = parts[3];
|
||||
// Timestamp Time = Timestamp.valueOf(timeStr);
|
||||
// String plate = parts[4];
|
||||
// String Card = parts[5];
|
||||
// String Photo1 = parts[7];
|
||||
// String Photo2 = parts[8];
|
||||
//
|
||||
//
|
||||
// String querySql = "SELECT * FROM pur WHERE id = ?";
|
||||
// Integer count = jdbcTemplate.queryForObject(querySql, new Object[]{id}, Integer.class);
|
||||
//
|
||||
// if (count == null || count == 0) {
|
||||
// String insertSql = "INSERT INTO pur (id, XM, Age, Time, plate, Card, Photo1, Photo2) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
// jdbcTemplate.update(insertSql, id, XM, Age, Time, plate, Card, Photo1, Photo2);
|
||||
// log.info("Data saved to database successfully.");
|
||||
// } else {
|
||||
// String updateSql = "UPDATE pur SET XM = ?, Age = ?, Time = ?, plate = ?, Card = ?, Photo1 = ?, Photo2 = ? WHERE id = ?";
|
||||
// jdbcTemplate.update(updateSql, XM, Age, Time, plate, Card, Photo1, Photo2, id);
|
||||
// log.info("Data updated in database successfully.");
|
||||
// }
|
||||
// } else {
|
||||
// log.info("Data saved to database failed.");
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("Error while saving data to database: " + e.getMessage());
|
||||
// }
|
||||
// }
|
||||
//}
|
|
@ -0,0 +1,64 @@
|
|||
//package com.bwie.consumer;
|
||||
//
|
||||
//import lombok.extern.log4j.Log4j2;
|
||||
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.jdbc.core.JdbcTemplate;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import java.sql.Timestamp;
|
||||
//
|
||||
///**
|
||||
// * @Author: wangxinyuan
|
||||
// * @Date: 2024/4/11 下午7:40
|
||||
// */
|
||||
////@Component
|
||||
//@Log4j2
|
||||
//public class ConsumeData3 {
|
||||
//
|
||||
//
|
||||
// //@Autowired
|
||||
// private JdbcTemplate jdbcTemplate;
|
||||
//
|
||||
// //@RabbitListener(queues = "data3")
|
||||
// public void consumeData3(String message) {
|
||||
// log.info("Received data3: " + message);
|
||||
// saveDataToDatabase(message);
|
||||
// }
|
||||
//
|
||||
// private void saveDataToDatabase(String message) {
|
||||
// try {
|
||||
// String[] parts = message.split(",");
|
||||
// if (parts.length >= 9) {
|
||||
// String id = parts[0];
|
||||
// String XM = parts[1];
|
||||
// String Age = parts[2];
|
||||
// String timeStr = parts[3];
|
||||
// Timestamp Time = Timestamp.valueOf(timeStr);
|
||||
// String plate = parts[4];
|
||||
// String Card = parts[5];/**/
|
||||
// String Photo1 = parts[7];
|
||||
// String Photo2 = parts[8];
|
||||
//
|
||||
//
|
||||
// String querySql = "SELECT * FROM pur WHERE id = ?";
|
||||
// Integer count = jdbcTemplate.queryForObject(querySql, new Object[]{id}, Integer.class);
|
||||
//
|
||||
//
|
||||
// if (count == null || count == 0) {
|
||||
// String insertSql = "INSERT INTO pur (id, XM, Age, Time, plate, Card, Photo1, Photo2) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
// jdbcTemplate.update(insertSql, id, XM, Age, Time, plate, Card, Photo1, Photo2);
|
||||
// log.info("Data saved to database successfully.");
|
||||
// } else {
|
||||
// String updateSql = "UPDATE pur SET XM = ?, Age = ?, Time = ?, plate = ?, Card = ?, Photo1 = ?, Photo2 = ? WHERE id = ?";
|
||||
// jdbcTemplate.update(updateSql, XM, Age, Time, plate, Card, Photo1, Photo2, id);
|
||||
// log.info("Data updated in database successfully.");
|
||||
// }
|
||||
// } else {
|
||||
// log.info("Data saved to database failed.");
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("Error while saving data to database: " + e.getMessage());
|
||||
// }
|
||||
// }
|
||||
//}
|
|
@ -0,0 +1,70 @@
|
|||
//package com.bwie.consumer;
|
||||
//
|
||||
//import com.bwie.admin.Pur;
|
||||
//import lombok.extern.log4j.Log4j2;
|
||||
//import org.junit.jupiter.api.Test;
|
||||
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.jdbc.core.JdbcTemplate;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import java.sql.Timestamp;
|
||||
//import java.util.Date;
|
||||
//
|
||||
///**
|
||||
// * @Author: wangxinyuan
|
||||
// * @Date: 2024/4/11 下午7:40
|
||||
// */
|
||||
////@Component
|
||||
//@Log4j2
|
||||
//public class ConsumerDate1 {
|
||||
//
|
||||
//
|
||||
// //@Autowired
|
||||
// private JdbcTemplate jdbcTemplate;
|
||||
//
|
||||
// //@RabbitListener(queues = "data1")
|
||||
// public void consumeData1(String message) {
|
||||
// log.info("Received data1: " + message);
|
||||
// saveDataToDatabase(message);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// private void saveDataToDatabase(String message) {
|
||||
// try {
|
||||
// String[] parts = message.split(",");
|
||||
// if (parts.length >= 9) {
|
||||
// String id = parts[0];
|
||||
// String XM = parts[1];
|
||||
// String Age = parts[2];
|
||||
// String timeStr = parts[3];
|
||||
// Timestamp Time = Timestamp.valueOf(timeStr);
|
||||
// String plate = parts[4];
|
||||
// String Card = parts[5];
|
||||
// String Photo1 = parts[7];
|
||||
// String Photo2 = parts[8];
|
||||
//
|
||||
// String querySql = "SELECT * FROM pur WHERE id = ?";
|
||||
// Integer count = jdbcTemplate.queryForObject(querySql, new Object[]{id}, Integer.class);
|
||||
//
|
||||
//
|
||||
// if (count == null || count == 0) {
|
||||
// String insertSql = "INSERT INTO pur (id, XM, Age, Time, plate, Card, Photo1, Photo2) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
// jdbcTemplate.update(insertSql, id, XM, Age, Time, plate, Card, Photo1, Photo2);
|
||||
// log.info("Data saved to database successfully.");
|
||||
// } else {
|
||||
// String updateSql = "UPDATE pur SET XM = ?, Age = ?, Time = ?, plate = ?, Card = ?, Photo1 = ?, Photo2 = ? WHERE id = ?";
|
||||
// jdbcTemplate.update(updateSql, XM, Age, Time, plate, Card, Photo1, Photo2, id);
|
||||
// log.info("Data updated in database successfully.");
|
||||
// }
|
||||
// } else {
|
||||
// log.info("Data saved to database failed.");
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// log.error("Error while saving data to database: " + e.getMessage());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//}
|
|
@ -0,0 +1,116 @@
|
|||
package com.bwie.consumer;
|
||||
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.bwie.admin.Pur;
|
||||
import com.bwie.admin.Pur2;
|
||||
import com.bwie.admin.Pur3;
|
||||
import com.bwie.controller.PurController;
|
||||
import com.bwie.mapper.PurMapper;
|
||||
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.amqp.core.Message;
|
||||
import org.springframework.amqp.rabbit.annotation.Queue;
|
||||
import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/11 下午9:24
|
||||
*/
|
||||
@Component
|
||||
@Log4j2
|
||||
public class DataConsumer {
|
||||
|
||||
|
||||
@Autowired
|
||||
private PurController purController;
|
||||
|
||||
|
||||
@Autowired
|
||||
private PurMapper purMapper;
|
||||
|
||||
|
||||
@RabbitListener(queuesToDeclare = {@Queue(name = "data1")})
|
||||
public void consumeData1(Object data, Channel channel, Message message) throws IOException {
|
||||
Pur pur = new Pur();
|
||||
if (pur != null) {
|
||||
pur = (Pur) data;
|
||||
}
|
||||
log.info("消费的数据为:{}", JSONObject.toJSONString(pur));
|
||||
List<String> list = purMapper.list();
|
||||
int count = 0;
|
||||
if (pur.getId() != null && !"".equals(pur.getId())) {
|
||||
for (String s : list) {
|
||||
if (pur.getId().equals(s)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count > 0) {
|
||||
purMapper.updateData1(pur);
|
||||
} else {
|
||||
purMapper.insertData1(pur);
|
||||
}
|
||||
}
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
}
|
||||
|
||||
@RabbitListener(queuesToDeclare = {@Queue(name = "data2")})
|
||||
public void consumeData2(Object data, Channel channel, Message message) throws IOException {
|
||||
Pur2 pur2 = new Pur2();
|
||||
if (pur2 != null) {
|
||||
pur2 = (Pur2) data;
|
||||
}
|
||||
log.info("消费的数据为:{}", JSONObject.toJSONString(pur2));
|
||||
List<String> list = purMapper.Purlist2();
|
||||
int count = 0;
|
||||
if (pur2.getId() != null && !"".equals(pur2.getId())) {
|
||||
for (String s : list) {
|
||||
if (pur2.getId().equals(s)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count > 0) {
|
||||
purMapper.updateData2(pur2);
|
||||
} else {
|
||||
purMapper.insertData2(pur2);
|
||||
}
|
||||
}
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
}
|
||||
|
||||
@RabbitListener(queuesToDeclare = {@Queue(name = "data3")})
|
||||
public void consumeData3(Object data, Channel channel, Message message) throws IOException {
|
||||
Pur3 pur3 = new Pur3();
|
||||
if (pur3 != null) {
|
||||
pur3 = (Pur3) data;
|
||||
}
|
||||
log.info("消费的数据为:{}", JSONObject.toJSONString(pur3));
|
||||
List<String> list = purMapper.Purlist3();
|
||||
int count = 0;
|
||||
if (pur3.getId() != null && !"".equals(pur3.getId())) {
|
||||
for (String s : list) {
|
||||
if (pur3.getId().equals(s)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count > 0) {
|
||||
purMapper.updateData3(pur3);
|
||||
} else {
|
||||
purMapper.insertData3(pur3);
|
||||
}
|
||||
}
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package com.bwie.controller;
|
||||
|
||||
|
||||
import com.bwie.admin.Pur;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.amqp.AmqpException;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/11 下午10:37
|
||||
*/
|
||||
@RestController
|
||||
public class PurController {
|
||||
|
||||
@Autowired
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
|
||||
|
||||
@GetMapping("/data1")
|
||||
@Transactional
|
||||
public void sendData1() throws JsonProcessingException {
|
||||
Pur pur = new Pur();
|
||||
pur.setId("593720128240812819055333");
|
||||
pur.setXm("dsc");
|
||||
pur.setCard("128963");
|
||||
pur.setAge("56");
|
||||
pur.setTime("2022-10-10 10:10:11");
|
||||
String message = objectMapper.writeValueAsString(pur);
|
||||
rabbitTemplate.convertAndSend("data1", "id", message);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.bwie.mapper;
|
||||
|
||||
import com.bwie.admin.Pur;
|
||||
import com.bwie.admin.Pur2;
|
||||
import com.bwie.admin.Pur3;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/11 下午11:34
|
||||
*/
|
||||
@Mapper
|
||||
public interface PurMapper {
|
||||
List<String> list();
|
||||
|
||||
void updateData1(Pur pur);
|
||||
|
||||
void insertData1(Pur pur);
|
||||
|
||||
|
||||
List<String> Purlist2();
|
||||
|
||||
void updateData2(Pur2 pur2);
|
||||
|
||||
void insertData2(Pur2 pur2);
|
||||
|
||||
List<String> Purlist3();
|
||||
|
||||
void updateData3(Pur3 pur3);
|
||||
|
||||
void insertData3(Pur3 pur3);
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
package com.bwie.task;
|
||||
|
||||
import com.bwie.admin.Pur;
|
||||
import com.bwie.admin.Pur2;
|
||||
import com.bwie.admin.Pur3;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/4/12 下午3:35
|
||||
*/
|
||||
@Component
|
||||
public class Task {
|
||||
|
||||
@Scheduled(cron = "0 0/1 * * * ?") // 每分钟执行一次
|
||||
public void doTask() {
|
||||
// 查询data1的全部数据,得到data1s
|
||||
List<Pur> data1s = queryPur1();
|
||||
|
||||
for (Pur data1 : data1s) {
|
||||
// 根据id去data2和data3进行查询
|
||||
Pur2 data2 = queryPur2(data1.getId());
|
||||
Pur3 data3 = queryPur3(data1.getId());
|
||||
|
||||
// 如果查询到的data2和data3有一个为空,则跳过,等待下次定时调度
|
||||
if (data2 == null || data3 == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 编写图片保存方法,将图片存储到本地路径 ,并返回图片名称
|
||||
String imageName = saveImage(data1.getPhoto1());
|
||||
|
||||
// 根据data1、2、3及返回的图片名称,拼接字符串写入到bcp文件中,并返回文件名称
|
||||
String bcpFileName = writeBcpFile(data1, data2, data3, imageName);
|
||||
|
||||
// 写入规则为字段+"\t"
|
||||
// 读取索引的模板文件(xml),并替换掉文件名称,并将新的xml内容写到文件中
|
||||
String xmlFileName = replaceXmlContent(bcpFileName);
|
||||
|
||||
// 压缩生产的三个文件为zip,压缩到其他目录
|
||||
String zipFileName = compressFiles(bcpFileName, xmlFileName, imageName);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private String compressFiles(String bcpFileName, String xmlFileName, String imageName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private String replaceXmlContent(String bcpFileName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private String writeBcpFile(Pur data1, Pur2 data2, Pur3 data3, String imageName) {
|
||||
// 实现根据data1、2、3及返回的图片名称,拼接字符串写入到bcp文件中,并返回文件名称的逻辑
|
||||
try {
|
||||
String fileName = "D:/save/files/" + data1.getId() + ".bcp";
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(fileName));
|
||||
writer.write(data1.toString() + "\t");
|
||||
writer.write(data2.toString() + "\t");
|
||||
writer.write(data3.toString() + "\t");
|
||||
writer.write(imageName);
|
||||
writer.close();
|
||||
return fileName;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String saveImage(String photo1) {
|
||||
try {
|
||||
URL url = new URL(photo1);
|
||||
String fileName = photo1.substring(photo1.lastIndexOf("/") + 1);
|
||||
InputStream inputStream = url.openStream();
|
||||
FileOutputStream outputStream = new FileOutputStream("D:/to/image/" + fileName);
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||
outputStream.write(buffer, 0, bytesRead);
|
||||
}
|
||||
inputStream.close();
|
||||
outputStream.close();
|
||||
return fileName;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Pur3 queryPur3(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Pur2 queryPur2(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<Pur> queryPur1() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
|
||||
# Tomcat
|
||||
server:
|
||||
port: 9000
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: boot-4.11z
|
||||
rabbitmq:
|
||||
host: 111.231.174.71
|
||||
port: 5672
|
||||
username: guest
|
||||
password: guest
|
||||
virtual-host: /
|
||||
publisher-confirm-type: correlated #确认消息已发送到交换机(Exchange)
|
||||
publisher-returns: true #确认消息已发送到队列(Queue)
|
||||
template:
|
||||
# 只要消息抵达Queue,就会异步发送优先回调return firm
|
||||
mandatory: true
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
datasource:
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
url: jdbc:mysql://111.231.174.71:3306/day8?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
|
||||
username: root
|
||||
password: wxy@123
|
||||
druid:
|
||||
# 下面为连接池的补充设置,应用到上面所有数据源中
|
||||
# 初始化大小,最小,最大
|
||||
initial-size: 5
|
||||
min-idle: 5
|
||||
max-active: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
max-wait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
time-between-eviction-runs-millis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
min-evictable-idle-time-millis: 300000
|
||||
validation-query: SELECT 1 FROM DUAL
|
||||
test-while-idle: true
|
||||
test-on-borrow: false
|
||||
test-on-return: false
|
||||
# 打开PSCache,并且指定每个连接上PSCache的大小
|
||||
pool-prepared-statements: true
|
||||
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
|
||||
max-pool-prepared-statement-per-connection-size: 20
|
||||
filters: stat,wall
|
||||
use-global-data-source-stat: true
|
||||
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
|
||||
connect-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
|
||||
# mybatis
|
||||
mybatis:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
mapper-locations: classpath*:mapper/*Mapper.xml
|
||||
type-aliases-package: com.bwie.admin
|
||||
global-config:
|
||||
db-config:
|
||||
id-type: auto
|
|
@ -0,0 +1,54 @@
|
|||
<?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.bwie.mapper.PurMapper">
|
||||
|
||||
<insert id="insertData1">
|
||||
INSERT INTO pur (id, xm, age, time, plate, card, photo1, photo2)
|
||||
VALUES (#{id}, #{xm}, #{age}, #{time}, #{plate}, #{card}, #{photo1}, #{photo2});
|
||||
</insert>
|
||||
|
||||
<select id="list" resultType="java.lang.String">
|
||||
-- 查询所有数据
|
||||
SELECT id , xm , age , time , plate , card , photo1 , photo2 FROM pur;
|
||||
</select>
|
||||
|
||||
<insert id="insertData2">
|
||||
INSERT INTO pur (id, xm, age, time, plate, card, photo1, photo2)
|
||||
VALUES (#{id}, #{xm}, #{age}, #{time}, #{plate}, #{card}, #{photo1}, #{photo2});
|
||||
</insert>
|
||||
|
||||
<insert id="insertData3">
|
||||
INSERT INTO pur (id, xm, age, time, plate, card, photo1, photo2)
|
||||
VALUES (#{id}, #{xm}, #{age}, #{time}, #{plate}, #{card}, #{photo1}, #{photo2});
|
||||
</insert>
|
||||
|
||||
<update id="updateData1">
|
||||
-- 更新数据
|
||||
UPDATE pur
|
||||
SET xm = #{xm}, age = #{age}, time = #{time}, plate = #{plate}, card = #{card}, photo1 = #{photo1}, photo2 = #{photo2}
|
||||
WHERE id = #{id};
|
||||
</update>
|
||||
|
||||
|
||||
<update id="updateData2">
|
||||
UPDATE pur
|
||||
SET xm = #{xm}, age = #{age}, time = #{time}, plate = #{plate}, card = #{card}, photo1 = #{photo1}, photo2 = #{photo2}
|
||||
WHERE id = #{id};
|
||||
</update>
|
||||
|
||||
|
||||
<update id="updateData3">
|
||||
UPDATE pur
|
||||
SET xm = #{xm}, age = #{age}, time = #{time}, plate = #{plate}, card = #{card}, photo1 = #{photo1}, photo2 = #{photo2}
|
||||
WHERE id = #{id};
|
||||
</update>
|
||||
|
||||
<select id="Purlist3" resultType="java.lang.String">
|
||||
SELECT id , xm , age , time , plate , card , photo1 , photo2 FROM pur;
|
||||
</select>
|
||||
|
||||
<select id="Purlist2" resultType="java.lang.String">
|
||||
SELECT id , xm , age , time , plate , card , photo1 , photo2 FROM pur;
|
||||
</select>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue