springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/config/MybatisPlusConfig.java
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer; import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; import org.mybatis.spring.annotation.MapperScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -13,6 +14,7 @@ * @author: huang.hongfa weixin hhf9596 qq 959656820 * @create: 2020-11-30 16:26 **/ @MapperScan({"com.panzhihua.service_grid.dao*"}) @Configuration public class MybatisPlusConfig { springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/dao/ApplicationAppReleaseMapper.java
New file @@ -0,0 +1,19 @@ package com.panzhihua.service_grid.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.panzhihua.service_grid.model.dos.ApplicationAppRelease; import org.apache.ibatis.annotations.Param; import java.math.BigInteger; /** * 应用APP版本控制表Mapper * ClassName ApplicationAppReleaseMapper * Description * * @author manailin */ public interface ApplicationAppReleaseMapper extends BaseMapper<ApplicationAppRelease> { ApplicationAppRelease selectByRand(@Param("data") Long data); } springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/model/dos/ApplicationAppRelease.java
New file @@ -0,0 +1,32 @@ package com.panzhihua.service_grid.model.dos; import lombok.Data; import java.io.Serializable; import java.util.Date; /** * Description 应用APP版本控制表 * ClassName ApplicationAppRelease * @author manailin */ @Data public class ApplicationAppRelease implements Serializable { private static final long serialVersionUID = 1L; /**主键*/ private Long id; /**应用ID*/ private Integer productId; /**应用名称*/ private String productName; /**版本编号*/ private String releaseNumber; /**通知行为(1、强制更新2、提示更新)*/ private Integer action; /**版本地址*/ private String url; /**创建时间*/ private Date createDate; /**创建人*/ private Long createUser; } springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/java/com/panzhihua/service_grid/service/impl/ComActActivityServiceImpl.java
File was deleted springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/resources/application.yml
New file @@ -0,0 +1,105 @@ server: port: 8291 spring: application: name: grid datasource: type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.cj.jdbc.Driver url: jdbc:mysql://47.104.148.185:3306/smart_life?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: remote password: nahanMysqlPwd&&RemoteRemote2019nahan druid: # 初始连接数 initialSize: 5 # 最小连接池数量 minIdle: 10 # 最大连接池数量 maxActive: 20 # 配置获取连接等待超时的时间 maxWait: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 timeBetweenEvictionRunsMillis: 60000 # 配置一个连接在池中最小生存的时间,单位是毫秒 minEvictableIdleTimeMillis: 300000 # 配置一个连接在池中最大生存的时间,单位是毫秒 maxEvictableIdleTimeMillis: 900000 # 配置检测连接是否有效 validationQuery: SELECT 1 FROM DUAL testWhileIdle: true testOnBorrow: false testOnReturn: false webStatFilter: enabled: true statViewServlet: enabled: true # 设置白名单,不填则允许所有访问 allow: url-pattern: /monitor/druid/* filter: stat: enabled: true # 慢SQL记录 log-slow-sql: false slow-sql-millis: 1000 merge-sql: true wall: config: multi-statement-allow: true eureka: client: service-url: defaultZone: http://localhost:8192/eureka instance: prefer‐ip‐address: true #可以跨域访问 feign: hystrix: enabled: true mybatis-plus: mapper-locations: classpath:/mapper/*Mapper.xml #实体扫描,多个package用逗号或者分号分隔 typeAliasesPackage: com.panzhihua.service_grid.model #SIMPLE:该执行器类型不做特殊的事情,为每个语句的执行创建一个新的预处理语句,REUSE:该执行器类型会复用预处理语句,BATCH:该执行器类型会批量执行所有的更新语句 default-executor-type: REUSE configuration: # 是否开启自动驼峰命名规则(camel case)映射,即从经典数据库列名 A_COLUMN(下划线命名) 到经典 Java 属性名 aColumn(驼峰命名) 的类似映射 map-underscore-to-camel-case: true # 全局地开启或关闭配置文件中的所有映射器已经配置的任何缓存,默认为 true cache-enabled: false #如果查询结果中包含空值的列,则 MyBatis 在映射的时候,不会映射这个字段 call-setters-on-nulls: true # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用 log-impl: org.apache.ibatis.logging.stdout.StdOutImpl global-config: db-config: #表名下划线命名默认true table-underline: true #id类型 id-type: INPUT table-prefix: event_ #是否开启大写命名,默认不开启 #capital-mode: false #逻辑已删除值,(逻辑删除下有效) 需要注入逻辑策略LogicSqlInjector 以@Bean方式注入 logic-not-delete-value: 0 #逻辑未删除值,(逻辑删除下有效) logic-delete-value: 1 #数据库类型 db-type: mysql select-strategy: not_empty update-strategy: not_empty insert-strategy: not_empty #小程序配置 min: app: #是否设置测试支付金额为0.01 isTest: true appid: wx0cef797390444b75 payKey: 01A9CB2234D7CBD0AC61B75EB1263805 mchId: 1608439275 notifyUrl: http://lyq.limeng.fun:8999/api/applets/wx/wxNotify springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/resources/bootstrap.yml
@@ -1,21 +1,3 @@ spring: application: name: grid cloud: config: discovery: enabled: true service-id: config # 注册中心的服务名 profile: ${ENV:dev} # 指定配置文件的环境 uri: http://${CONFIG_URL:localhost}:8193/ profiles: active: ${ENV:dev} servlet: multipart: max-file-size: 10MB max-request-size: 10MB eureka: client: service-url: springcloud_k8s_panzhihuazhihuishequ/service_grid/src/main/resources/mapper/ApplicationAppReleaseMapper.xml
New file @@ -0,0 +1,25 @@ <?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.panzhihua.service_grid.dao.ApplicationAppReleaseMapper"> <resultMap id="baseResult" type="com.panzhihua.service_grid.model.dos.ApplicationAppRelease"> <id property="id" column="id" /> <result property="productId" column="product_id" /> <result property="productName" column="product_name" /> <result property="releaseNumber" column="release_number" /> <result property="action" column="action" /> <result property="url" column="url" /> <result property="createDate" column="create_date" /> <result property="createUser" column="create_user" /> </resultMap> <sql id="columns"> `id`,`product_id`,`product_name`,`release_number`,`action`,`url`,`create_date`,`create_user` </sql> <select id="selectByRand" resultType="com.panzhihua.service_grid.model.dos.ApplicationAppRelease"> select * from event_application_app_release where id=#{data} </select> </mapper> springcloud_k8s_panzhihuazhihuishequ/service_grid/src/test/java/com/panzhihua/service_grid/dao/ApplicationAppReleaseMapperTest.java
New file @@ -0,0 +1,22 @@ package com.panzhihua.service_grid.dao; import com.panzhihua.service_grid.model.dos.ApplicationAppRelease; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest class ApplicationAppReleaseMapperTest { @Autowired private ApplicationAppReleaseMapper applicationAppReleaseMapper; @Test void selectByRand() { ApplicationAppRelease result = applicationAppReleaseMapper.selectByRand(2L); System.out.println("JSONObject.toJSONString(result) = " + result.getProductName()); } }