mcy 1 year ago
parent 1b832d5a19
commit 9543d0b5f6

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>demay</artifactId>
<groupId>com.ssm</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mybatis_generator</artifactId>
<properties>
<!-- MyBatis Generator -->
<!-- Java接口和实体类 -->
<targetJavaProject>${basedir}/src/main/java</targetJavaProject>
<targetMapperPackage>com.ssm.manage.dao</targetMapperPackage>
<targetModelPackage>com.ssm.manage.entity</targetModelPackage>
<!-- XML生成路径 -->
<targetResourcesProject>${basedir}/src/main/resources</targetResourcesProject>
<targetXMLPackage>sqlmap</targetXMLPackage>
</properties>
<build>
<finalName>dao</finalName>
<plugins>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.6</version>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.44</version>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper</artifactId>
<version>3.4.5</version>
</dependency>
</dependencies>
<configuration>
<!--允许移动生成的文件 -->
<verbose>true</verbose>
<!-- 是否覆盖 -->
<overwrite>true</overwrite>
<!-- 自动生成的配置 -->
<configurationFile>
${basedir}/src/main/resources/generator/generatorConfig.xml</configurationFile>
</configuration>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,4 @@
spring.datasource.url=jdbc:mysql://192.168.31.40:3306/dcmy?useSSL=false&serverTimezone=UTC&characterEncoding=UTF-8
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

@ -0,0 +1,335 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<properties resource="database.properties"/>
<context id="postgres" targetRuntime="MyBatis3Simple" defaultModelType="flat">
<property name="beginningDelimiter" value="`"/>
<property name="endingDelimiter" value="`"/>
<property name="javaFileEncoding" value="UTF-8"/>
<plugin type="tk.mybatis.mapper.generator.MapperPlugin">
<property name="mappers" value="com.ssm.core.mapper.BaseMapper"/>
</plugin>
<plugin type="org.mybatis.generator.plugins.EqualsHashCodePlugin"/>
<plugin type="org.mybatis.generator.plugins.SerializablePlugin"/>
<plugin type="org.mybatis.generator.plugins.ToStringPlugin"/>
<jdbcConnection driverClass="${spring.datasource.driver-class-name}"
connectionURL="${spring.datasource.url}"
userId="${spring.datasource.username}"
password="${spring.datasource.password}">
</jdbcConnection>
<javaModelGenerator targetPackage="com.ssm.manage.entity" targetProject="E:\workPlace\demay\dm_bean\src\main\java\"/>
<sqlMapGenerator targetPackage="sqlmap" targetProject="E:\workPlace\demay\dm_dao\src\main\resources\"/>
<javaClientGenerator targetPackage="com.ssm.manage.mapper" targetProject="E:\workPlace\demay\dm_dao\src\main\java\" type="XMLMAPPER" />
<!-- <table tableName="account_trade_record" >-->
<!-- &lt;!&ndash; <property name="useActualColumnNames" value="false"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="appointment_list" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!--&lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC" identity="true"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="attendance_list" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!--&lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="base_city" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="base_collection_type" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="base_county" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="base_project" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="base_project_type" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="base_province" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="base_staff" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="negative_card_day_record" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="base_store" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="cash_account_list" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="cash_list" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="cash_signature_file" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="cash_share" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="collection_list" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="course_list" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="course_account" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="debt_list" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="doc_promotion" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="doc_promotion_project" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="member_list" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="store_member_list" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="store_member_file" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="store_member_phone" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="member_wallet" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="recharge_list" >-->
<!--&lt;!&ndash; <property name="useActualColumnNames" value="false"/>&ndash;&gt;-->
<!--&lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="pay_list" >-->
<!-- &lt;!&ndash; <property name="useActualColumnNames" value="false"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="promotion_list" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="promotion_project" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="promotion_member" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="recharge_account" >-->
<!-- &lt;!&ndash; <property name="useActualColumnNames" value="false"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="recharge_type" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="refund_cash" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="refund_course" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="refund_debt_list" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="refund_recharge" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="refund_order_list" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="repay_list" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="repay_trade_list" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="staff_salary" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="staff_works" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="store_parament" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="store_month_task" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="sys_business_parameters" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="sys_global_parameters" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="sys_menu" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="sys_role_power" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="sys_menu_power" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="sys_power" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="sys_role" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="sys_role_user" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="sys_user" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="upload_files" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="member_cs" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="member_order" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="project_progress" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="project_progress_file" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="img_maintain" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="member_init" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="modify_recharge_record" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="modify_course_record" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<table tableName="member_init_staff" >
<!--<property name="useActualColumnNames" value="true"/>-->
<!-- <generatedKey column="appointment_id" sqlStatement="JDBC"/>-->
</table>
<!-- <table tableName="card_change_in_project" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="card_change_out_project" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="staff_attendance_record" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="store_allinpay_info" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="allinpay_cash_list" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table tableName="cash_download_record" >-->
<!-- &lt;!&ndash;<property name="useActualColumnNames" value="true"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <generatedKey column="appointment_id" sqlStatement="JDBC"/>&ndash;&gt;-->
<!-- </table>-->
</context>
</generatorConfiguration>

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>demay</artifactId>
<groupId>com.ssm</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>redis</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.10</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.10</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.8</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
</build>
</project>

@ -0,0 +1,86 @@
package com.ssm.config;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.MapPropertySource;
import org.springframework.data.redis.connection.RedisClusterConfiguration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.RedisPassword;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import java.util.HashMap;
import java.util.Map;
@Configuration
@EnableCaching
@Slf4j
public class RedisConfig extends CachingConfigurerSupport {
// @Value("${redis.host}")
// private String host; // Redis服务器地址
// @Value("${redis.port}")
// private int port; // Redis服务器连接端口
@Value("${spring.redis.password}")
private String password; // Redis服务器连接密码默认为空
@Value("${spring.redis.timeout}")
private int timeout; // 连接超时时间(毫秒)
@Value("${spring.redis.database}")
private int database; //
@Value("${spring.redis.jedis.pool.max-active}")
private int maxTotal; // 连接池最大连接数(使用负值表示没有限制)
@Value("${spring.redis.jedis.pool.max-wait}")
private int maxWaitMillis; // 连接池最大阻塞等待时间(使用负值表示没有限制)
@Value("${spring.redis.jedis.pool.max-idle}")
private int maxIdle; // 连接池中的最大空闲连接
@Value("${spring.redis.jedis.pool.min-idle}")
private int minIdle; // 连接池中的最小空闲连接
/**
* RedisTemplate
* @return
*/
@Bean(name = "redisTemplate")
public RedisTemplate<Object, Object> functionDomainRedisTemplate(@Qualifier(value = "redisConnectionFactory") RedisConnectionFactory factory) {
// logger.info("初始化RedisTemplate");
RedisTemplate<Object, Object> template = new RedisTemplate<>();
template.setConnectionFactory(factory);
//使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值
Jackson2JsonRedisSerializer serializer = new Jackson2JsonRedisSerializer(Object.class);
ObjectMapper mapper = new ObjectMapper();
mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
mapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
serializer.setObjectMapper(mapper);
template.setValueSerializer(serializer);
//使用StringRedisSerializer来序列化和反序列化redis的key值
template.setKeySerializer(new StringRedisSerializer());
template.afterPropertiesSet();
return template;
}
// @Bean
// public RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory) {
// RedisMessageListenerContainer container = new RedisMessageListenerContainer();
// container.setConnectionFactory(connectionFactory);
// return container;
// }
}

@ -0,0 +1,264 @@
package com.ssm.util;
import com.google.gson.Gson;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.dao.DataAccessException;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.core.RedisOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.SessionCallback;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.data.redis.core.script.RedisScript;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.time.Duration;
import java.util.*;
import java.util.concurrent.TimeUnit;
@Component
@Slf4j
public class RedisClient<V> {
// private final long DEFAULT_EXPIRE_TIME = 1 * 24 * 60 * 60L;
public final static long EXPIRE_TIME_ONE_HOUR = 60 * 60L;
public final static long EXPIRE_TIME_ONE_MINUTE = 60L;
public final static long EXPIRE_TIME_FIVE_MINUTES = 5 * 60L;
public final static long EXPIRE_TIME_TEN_MINUTES = 10 * 60L;
public final static long EXPIRE_TIME_TEN_MINUTESTOW = 3 * 60L;
public static final long EXPIRE_TIME_HALF_HOUR = 30 * 60L;
public static final long EXPIRE_TIME_ONE_DAY = 24 * 60 * 60L;
public static final long EXPIRE_DAY_STATISTICS = 3 * 24 * 60 * 60L;
public static final long EXPIRE_MONTHLY_STATISTICS = 33 * 24 *60 *60L;
public static final String LOCK_RELEASE_SCRIPT = "if redis.call('get',KEYS[1]) == ARGV[1] then return redis.call('del',KEYS[1]) else return 0 end";
@Resource
RedisTemplate<String,V> redisTemplate;
public static final int LOCK_EXPIRE_TIME = 10; // 锁的过期时间,单位:秒
public static final String LOCKED = "locked"; // 分布式锁时, 设置的值
public RedisTemplate<String,V> getRedisTemplate(){
return redisTemplate;
}
/**
* SETNX
* @param lockKey {@code lockKey} , {@code true} ( {@code lockKey} "locked" );
* {@code lockKey} , , {@code false}.
*/
public boolean tryAcquireLock(String lockKey) {
RedisTemplate<String, String> redisTemplate = (RedisTemplate<String, String>) this.redisTemplate;
ValueOperations<String, String> stringStringValueOperations = redisTemplate.opsForValue();
// 尝试获取锁,使用 SETNX 语义
return Boolean.TRUE.equals(stringStringValueOperations.setIfAbsent(lockKey, LOCKED, Duration.ofSeconds(LOCK_EXPIRE_TIME)));
}
public void delete(String key){
log.warn("delete cache ,keys in ({})",key);
redisTemplate.delete(key);
}
public void delete(Collection<String> keys){
log.warn("delete cache ,keys in ({})", StringUtils.join(keys.toArray(),","));
redisTemplate.delete(keys);
}
public long incr(String k,long l){
return redisTemplate.opsForValue().increment(k,l);
}
public long incr(String k){
return this.incr(k,1L);
}
public Long decr(String k,long l){
return this.incr(k,-l);
}
public long decr(String k){
return this.incr(k, -1L);
}
public double incrD(String k,double d){
return redisTemplate.opsForValue().increment(k,d);
}
public double incrD(String k){
return this.incrD(k, 1D);
}
public double decrD(String k,double d){
return this.incrD(k,-d);
}
public double decrD(String k){
return this.incrD(k,-1D);
}
public void set(String k,V v,Long l){
redisTemplate.opsForValue().set(k,v,l,TimeUnit.SECONDS);
}
public void set(String k,V v){
redisTemplate.opsForValue().set(k,v);
}
public void set(String k,V v,Long l,TimeUnit timeUnit){
redisTemplate.opsForValue().set(k,v,l,timeUnit);
}
public void waitingSet(String k, V v, Long time, TimeUnit timeUnit) {
redisTemplate.execute(new SessionCallback<Boolean>() {
@Override
public <K, V> Boolean execute(RedisOperations<K, V> operations) throws DataAccessException {
operations.multi();
operations.opsForValue().set((K) k, (V) v);
operations.exec();
return true;
}
});
}
public void waitingSetValueWithExpirationAt(String key, V value, Date expiration) {
redisTemplate.execute(new SessionCallback<Boolean>() {
@Override
public <K, V> Boolean execute(RedisOperations<K, V> operations) throws DataAccessException {
operations.multi();
operations.opsForValue().set((K) key, (V) value);
operations.expireAt((K) key, expiration);
operations.exec();
return true;
}
});
}
public V get(String k){
return redisTemplate.opsForValue().get(k);
}
public void expire(String k,int seconds){
redisTemplate.expire(k, seconds, TimeUnit.SECONDS);
}
public void expire(String k,long seconds){
redisTemplate.expire(k, seconds, TimeUnit.SECONDS);
}
public List<V> pipeLine(Map<String,V> map){
List<Object> objects = redisTemplate.execute((RedisConnection redisConnection) -> {
RedisSerializer<String> serializer = redisTemplate.getStringSerializer();
Gson gson = new Gson();
redisConnection.openPipeline();
for(String key:map.keySet()){
redisConnection.lPush(serializer.serialize(key),serializer.serialize(gson.toJson(map.get(key))));
}
return redisConnection.closePipeline();
});
return (List<V>) objects;
}
public boolean hasKey(String key){
return redisTemplate.hasKey(key);
}
public boolean setnx(String key,V v){
return redisTemplate.opsForValue().setIfAbsent(key,v);
}
public Long sAdd(String key, V... v){
return redisTemplate.opsForSet().add(key,v);
}
public Long sRemove(String key, V... v){
return redisTemplate.opsForSet().remove(key,v);
}
public Long leftPush(String key,V v){
return redisTemplate.opsForList().leftPush(key,v);
}
public Long rightPush(String key,V v){
return redisTemplate.opsForList().rightPush(key, v);
}
/*
* valuecount
* LREM key count value
* count>0:valuecount
* count<0:valuecount
* count=0:value
* */
public Long lRem(String key, Long count, V v){return redisTemplate.opsForList().remove(key,count,v);}
public Long lSize(String key){
return redisTemplate.opsForList().size(key);
}
public List<V> lRange(String key,Long start,Long end){
return redisTemplate.opsForList().range(key, start, end);
}
public V lIndex(String key,Long index){
return redisTemplate.opsForList().index(key,index);
}
public void lSet(String key,Long index, V v){
redisTemplate.opsForList().set(key,index, v);
}
public V right(String key){
return redisTemplate.opsForList().rightPop(key);
}
public Set<V> sMembers(String key){
return redisTemplate.opsForSet().members(key);
}
public V sPop(String key){
return redisTemplate.opsForSet().pop(key);
}
public Set<V> sRandMember(String key, long count) {
return redisTemplate.opsForSet().distinctRandomMembers(key, count);
}
public Long sSize(String key){
return redisTemplate.opsForSet().size(key);
}
public boolean isMembers(String key,V v){
return redisTemplate.opsForSet().isMember(key,v);
}
public V getset(String key,V v){
return redisTemplate.opsForValue().getAndSet(key,v);
}
public Set<String> keys(String pattern){
return redisTemplate.keys(pattern);
}
public Long evalUnlock(String script, List<String> keys, Object...args) {
RedisScript<Long> redisScript = new DefaultRedisScript<>(script, Long.class);
return redisTemplate.execute(redisScript, keys, args);
}
}
Loading…
Cancel
Save