增加租户管理模块
This commit is contained in:
parent
a7d04d2454
commit
f63b5cfa61
@ -116,7 +116,7 @@ CREATE TABLE `xhpc_tenant`
|
|||||||
`create_time` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
|
`create_time` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
|
||||||
`update_user` BIGINT(64) NULL DEFAULT NULL COMMENT '修改人',
|
`update_user` BIGINT(64) NULL DEFAULT NULL COMMENT '修改人',
|
||||||
`update_time` DATETIME NULL DEFAULT NULL COMMENT '修改时间',
|
`update_time` DATETIME NULL DEFAULT NULL COMMENT '修改时间',
|
||||||
`status` INT(2) NULL DEFAULT NULL COMMENT '状态',
|
`status` INT(2) NULL DEFAULT NULL COMMENT '状态(0-未启用,1-正常,2-停用)',
|
||||||
`is_deleted` INT(2) NULL DEFAULT '0' COMMENT '是否已删除',
|
`is_deleted` INT(2) NULL DEFAULT '0' COMMENT '是否已删除',
|
||||||
PRIMARY KEY (`tenant_id`) USING BTREE
|
PRIMARY KEY (`tenant_id`) USING BTREE
|
||||||
) COMMENT ='租户表'
|
) COMMENT ='租户表'
|
||||||
|
|||||||
@ -22,6 +22,8 @@
|
|||||||
<module>xhpc-message-board</module>
|
<module>xhpc-message-board</module>
|
||||||
<module>xhpc-card</module>
|
<module>xhpc-card</module>
|
||||||
<module>xhpc-data-big-screen</module>
|
<module>xhpc-data-big-screen</module>
|
||||||
|
<module>xhpc-workorder</module>
|
||||||
|
<module>xhpc-tenant</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>xhpc-modules</artifactId>
|
<artifactId>xhpc-modules</artifactId>
|
||||||
|
|||||||
@ -41,6 +41,10 @@ public class AliyunTemplate {
|
|||||||
* 工单派发通知
|
* 工单派发通知
|
||||||
*/
|
*/
|
||||||
public static final String WORK_ORDER_CREATED = "SMS_232163808";
|
public static final String WORK_ORDER_CREATED = "SMS_232163808";
|
||||||
|
/**
|
||||||
|
* 租户15日即将到期通知
|
||||||
|
*/
|
||||||
|
public static final String TENANT_EXPIRING_15D = "SMS_234156819";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新计费模型失败
|
* 更新计费模型失败
|
||||||
|
|||||||
@ -44,4 +44,9 @@ public class AliyunTemplateKeyWord {
|
|||||||
* 工单派送
|
* 工单派送
|
||||||
*/
|
*/
|
||||||
public static final String WORK_ORDER_CREATED = "新的工单";
|
public static final String WORK_ORDER_CREATED = "新的工单";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户15日即将到期通知
|
||||||
|
*/
|
||||||
|
public static final String TENANT_EXPIRING_15D = "还有15天到期";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,6 +97,9 @@ public class XhpcSmsController extends BaseController {
|
|||||||
} else if(content.contains(AliyunTemplateKeyWord.WORK_ORDER_CREATED)){
|
} else if(content.contains(AliyunTemplateKeyWord.WORK_ORDER_CREATED)){
|
||||||
signatureName = AliyunTemplate.SIGNATURE_NAME;
|
signatureName = AliyunTemplate.SIGNATURE_NAME;
|
||||||
templateId = AliyunTemplate.WORK_ORDER_CREATED;
|
templateId = AliyunTemplate.WORK_ORDER_CREATED;
|
||||||
|
} else if (content.contains(AliyunTemplateKeyWord.TENANT_EXPIRING_15D)){
|
||||||
|
signatureName = AliyunTemplate.SIGNATURE_NAME;
|
||||||
|
templateId = AliyunTemplate.TENANT_EXPIRING_15D;
|
||||||
}
|
}
|
||||||
|
|
||||||
xhpcSmsService.sendNotice(phone, signatureName, templateId, paramMap);
|
xhpcSmsService.sendNotice(phone, signatureName, templateId, paramMap);
|
||||||
|
|||||||
35
xhpc-modules/xhpc-tenant/.gitignore
vendored
Normal file
35
xhpc-modules/xhpc-tenant/.gitignore
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
HELP.md
|
||||||
|
target/
|
||||||
|
.mvn/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### STS ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/
|
||||||
|
.idea
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
136
xhpc-modules/xhpc-tenant/pom.xml
Normal file
136
xhpc-modules/xhpc-tenant/pom.xml
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>xhpc-modules</artifactId>
|
||||||
|
<version>3.0.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>xhpc-tenant</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
租户服务
|
||||||
|
</description>
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis</groupId>
|
||||||
|
<artifactId>mybatis</artifactId>
|
||||||
|
<version>3.5.6</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.pagehelper</groupId>
|
||||||
|
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Nacos Config -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- SpringCloud Alibaba Sentinel -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Mysql Connector -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- RuoYi Common DataSource -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common-datasource</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- RuoYi Common Core -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>xhpc-common</artifactId>
|
||||||
|
<version>3.0.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.ant</groupId>
|
||||||
|
<artifactId>ant</artifactId>
|
||||||
|
<version>1.10.12</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.aliyun.oss</groupId>
|
||||||
|
<artifactId>aliyun-sdk-oss</artifactId>
|
||||||
|
<version>3.10.2</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-common-log</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/java</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**/*.xml</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>2.4.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.xhpc;
|
||||||
|
|
||||||
|
import com.xhpc.common.security.annotation.EnableCustomConfig;
|
||||||
|
import com.xhpc.common.security.annotation.EnableRyFeignClients;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
|
||||||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
|
|
||||||
|
@EnableConfigurationProperties
|
||||||
|
@ConfigurationPropertiesScan(basePackages = {"com.xhpc.tenant.config"})
|
||||||
|
@EnableCustomConfig
|
||||||
|
@EnableRyFeignClients
|
||||||
|
@EnableFeignClients
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableScheduling
|
||||||
|
@MapperScan("com.xhpc.tenant.mapper")
|
||||||
|
public class XhpcTenantApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
SpringApplication.run(XhpcTenantApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.xhpc.tenant.config;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付宝支付配置类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ConfigurationProperties(prefix = "oss")
|
||||||
|
public class AliOSSProperties {
|
||||||
|
|
||||||
|
private boolean enabled;
|
||||||
|
private String name;
|
||||||
|
private boolean tenantMode;
|
||||||
|
private String endpoint;
|
||||||
|
private String accessKey;
|
||||||
|
private String secretKey;
|
||||||
|
private String bucketName;
|
||||||
|
private String region;
|
||||||
|
private String domain;
|
||||||
|
}
|
||||||
@ -0,0 +1,81 @@
|
|||||||
|
package com.xhpc.tenant.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.xhpc.common.core.domain.R;
|
||||||
|
import com.xhpc.common.core.web.controller.BaseController;
|
||||||
|
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||||
|
import com.xhpc.common.log.annotation.Log;
|
||||||
|
import com.xhpc.common.log.enums.BusinessType;
|
||||||
|
import com.xhpc.tenant.domain.XhpcTenantDomain;
|
||||||
|
import com.xhpc.tenant.service.XhpcTenantService;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/tenant")
|
||||||
|
public class XhpcTenantController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
XhpcTenantService tenantService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/getPage")
|
||||||
|
public TableDataInfo getPage(String tenantId,
|
||||||
|
String tenantName,
|
||||||
|
String contactName){
|
||||||
|
|
||||||
|
startPage();
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("tenantId", tenantId);
|
||||||
|
params.put("tenantName", tenantName);
|
||||||
|
params.put("contactName", contactName);
|
||||||
|
return getDataTable(tenantService.getList(params));
|
||||||
|
}
|
||||||
|
// 到期前15填短信通知联系人
|
||||||
|
// 1点定时更新状态
|
||||||
|
//停用状态不能登陆PC,小程序正常
|
||||||
|
|
||||||
|
@GetMapping("/detail")
|
||||||
|
public R getDetail(@RequestParam("tenantId")String tenantId){
|
||||||
|
return R.ok(tenantService.getInfoByPk(tenantId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Log(title = "租户管理-新增租户", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/detail")
|
||||||
|
public R insertNewTenant(@RequestBody XhpcTenantDomain domain){
|
||||||
|
return R.ok(tenantService.insertTenant(domain));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Log(title = "租户管理-更新租户信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/detail")
|
||||||
|
public R updateTenant(@RequestBody XhpcTenantDomain domain){
|
||||||
|
return R.ok(tenantService.updateTenantInfo(domain));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Log(title = "租户管理-更新租户授权配置信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/config")
|
||||||
|
public R updateTenantConfig(@RequestBody XhpcTenantDomain domain){
|
||||||
|
return R.ok(tenantService.updateTenantConfig(domain));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Log(title = "租户管理-更新租户状态", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/status")
|
||||||
|
public R updateTenantStatus(@RequestBody XhpcTenantDomain domain){
|
||||||
|
return R.ok(tenantService.updateTenantConfig(domain));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Log(title = "租户管理-删除租户", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/detail")
|
||||||
|
public R deleteTenantByPk(@RequestParam("tenantId")String tenantId){
|
||||||
|
return R.ok(tenantService.deleteByPk(tenantId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,99 @@
|
|||||||
|
package com.xhpc.tenant.domain;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户对象
|
||||||
|
* @author
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class XhpcTenantDomain implements Serializable {
|
||||||
|
/**
|
||||||
|
* 租户ID
|
||||||
|
*/
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户名称
|
||||||
|
*/
|
||||||
|
private String tenantName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 域名地址
|
||||||
|
*/
|
||||||
|
private String domain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统背景
|
||||||
|
*/
|
||||||
|
private String backgroundUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系人
|
||||||
|
*/
|
||||||
|
private String linkman;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系电话
|
||||||
|
*/
|
||||||
|
private String contactNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系地址
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 场站限额
|
||||||
|
*/
|
||||||
|
private Integer stationQuote;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每站桩限额
|
||||||
|
*/
|
||||||
|
private Integer stationPileQuote;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 过期时间
|
||||||
|
*/
|
||||||
|
private Date expireTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
private Long createUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建部门
|
||||||
|
*/
|
||||||
|
private Long createDept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人
|
||||||
|
*/
|
||||||
|
private Long updateUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否已删除
|
||||||
|
*/
|
||||||
|
private Integer isDeleted;
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
package com.xhpc.tenant.mapper;
|
||||||
|
|
||||||
|
import com.xhpc.tenant.domain.XhpcTenantDomain;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
public interface XhpcTenantMapper {
|
||||||
|
|
||||||
|
List<XhpcTenantDomain> getList(@Param("params") Map params);
|
||||||
|
|
||||||
|
int deleteByPrimaryKey(String tenantId);
|
||||||
|
|
||||||
|
int deleteLogicByPrimaryKey(String tenantId);
|
||||||
|
|
||||||
|
int insert(XhpcTenantDomain record);
|
||||||
|
|
||||||
|
int insertSelective(XhpcTenantDomain record);
|
||||||
|
|
||||||
|
XhpcTenantDomain selectByPrimaryKey(String tenantId);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(XhpcTenantDomain record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(XhpcTenantDomain record);
|
||||||
|
|
||||||
|
int updateInfoByPrimaryKey(XhpcTenantDomain record);
|
||||||
|
|
||||||
|
int updateStatusByPrimaryKey(XhpcTenantDomain record);
|
||||||
|
|
||||||
|
int updateTenantConfigByPrimaryKey(XhpcTenantDomain record);
|
||||||
|
|
||||||
|
List<XhpcTenantDomain> selectExpiredList();
|
||||||
|
|
||||||
|
List<XhpcTenantDomain> selectExpiringList(String expireTime);
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package com.xhpc.tenant.service;
|
||||||
|
|
||||||
|
import com.xhpc.tenant.domain.XhpcTenantDomain;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface XhpcTenantService {
|
||||||
|
|
||||||
|
List<XhpcTenantDomain> getList(Map<String, Object> params);
|
||||||
|
|
||||||
|
XhpcTenantDomain getInfoByPk(String tenantId);
|
||||||
|
|
||||||
|
boolean insertTenant(XhpcTenantDomain domain);
|
||||||
|
|
||||||
|
boolean updateTenantInfo(XhpcTenantDomain domain);
|
||||||
|
|
||||||
|
boolean updateTenantStatus(XhpcTenantDomain domain);
|
||||||
|
|
||||||
|
boolean updateTenantConfig(XhpcTenantDomain domain);
|
||||||
|
|
||||||
|
boolean deleteByPk(String tenantId);
|
||||||
|
}
|
||||||
@ -0,0 +1,81 @@
|
|||||||
|
package com.xhpc.tenant.service.impl;
|
||||||
|
|
||||||
|
import com.xhpc.common.core.exception.CustomException;
|
||||||
|
import com.xhpc.common.core.utils.StringUtils;
|
||||||
|
import com.xhpc.tenant.domain.XhpcTenantDomain;
|
||||||
|
import com.xhpc.tenant.mapper.XhpcTenantMapper;
|
||||||
|
import com.xhpc.tenant.service.XhpcTenantService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class XhpcTenantServiceImpl implements XhpcTenantService {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
XhpcTenantMapper tenantMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<XhpcTenantDomain> getList(Map<String, Object> params){
|
||||||
|
return tenantMapper.getList(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public XhpcTenantDomain getInfoByPk(String tenantId){
|
||||||
|
return tenantMapper.selectByPrimaryKey(tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean insertTenant(XhpcTenantDomain domain){
|
||||||
|
if(StringUtils.isEmpty(domain.getTenantName())
|
||||||
|
|| StringUtils.isEmpty(domain.getLinkman())
|
||||||
|
|| StringUtils.isEmpty(domain.getContactNumber())){
|
||||||
|
throw new CustomException("必填字段为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
XhpcTenantDomain tenantDomain = tenantMapper.selectByPrimaryKey(domain.getTenantId());
|
||||||
|
if(tenantDomain != null){
|
||||||
|
throw new CustomException("租户ID已存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
return tenantMapper.insertSelective(domain) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateTenantInfo(XhpcTenantDomain domain){
|
||||||
|
return tenantMapper.updateInfoByPrimaryKey(domain) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateTenantStatus(XhpcTenantDomain domain){
|
||||||
|
return tenantMapper.updateStatusByPrimaryKey(domain) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateTenantConfig(XhpcTenantDomain domain){
|
||||||
|
return tenantMapper.updateTenantConfigByPrimaryKey(domain) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean deleteByPk(String tenantId){
|
||||||
|
XhpcTenantDomain tenantDomain = tenantMapper.selectByPrimaryKey(tenantId);
|
||||||
|
if(tenantDomain == null){
|
||||||
|
throw new CustomException("该租户不存在");
|
||||||
|
}
|
||||||
|
// todo 检查租户是否存在异常订单、用户余额等
|
||||||
|
// todo 暂不实现业务流程,待讨论后再实现
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,62 @@
|
|||||||
|
package com.xhpc.tenant.task;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.xhpc.common.api.SmsService;
|
||||||
|
import com.xhpc.common.core.domain.R;
|
||||||
|
import com.xhpc.common.core.utils.StringUtils;
|
||||||
|
import com.xhpc.tenant.domain.XhpcTenantDomain;
|
||||||
|
import com.xhpc.tenant.mapper.XhpcTenantMapper;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class XhpcTenantTask {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
XhpcTenantMapper tenantMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
SmsService smsService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每天一点自动清理过期租户
|
||||||
|
*/
|
||||||
|
@Scheduled(cron = "0 0 1 * * ? ")
|
||||||
|
private void ExpiredTenantStatusTask(){
|
||||||
|
|
||||||
|
List<XhpcTenantDomain> expireDomainList = tenantMapper.selectExpiredList();
|
||||||
|
for(XhpcTenantDomain domain: expireDomainList){
|
||||||
|
domain.setStatus(2);
|
||||||
|
tenantMapper.updateStatusByPrimaryKey(domain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每天一点自动清理过期租户
|
||||||
|
*/
|
||||||
|
@Scheduled(cron = "0 0 14 * * ? ")
|
||||||
|
private void ExpiringTenantSmsTask(){
|
||||||
|
|
||||||
|
String expireTime = DateUtil.formatDateTime(com.xhpc.common.util.DateUtil.addDay(new Date(), -15));
|
||||||
|
List<XhpcTenantDomain> expireDomainList = tenantMapper.selectExpiringList(expireTime);
|
||||||
|
for(XhpcTenantDomain domain: expireDomainList){
|
||||||
|
// todo 发短信提醒
|
||||||
|
if (StringUtils.isEmpty(domain.getContactNumber())){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
HashMap<String, String> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("phone", domain.getContactNumber());
|
||||||
|
paramMap.put("tenantName", domain.getTenantName());
|
||||||
|
paramMap.put("content", "【小华充电】尊敬的租户,您申请的租户(租户名称: " + domain.getTenantName() + ")还有15天到期,请联系业务人员进行续费。");
|
||||||
|
smsService.sendNotice(paramMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.xhpc.tenant.utils;
|
||||||
|
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import com.xhpc.common.core.utils.StringUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class DownloadUtil {
|
||||||
|
|
||||||
|
public static File downloadFile(String fileUrl) throws Exception {
|
||||||
|
|
||||||
|
if (StringUtils.isEmpty(fileUrl)) {
|
||||||
|
throw new Exception("文件地址为空");
|
||||||
|
}
|
||||||
|
String suffix = fileUrl.substring(fileUrl.lastIndexOf("."));
|
||||||
|
return HttpUtil.downloadFileFromUrl(fileUrl, File.createTempFile("temp_", suffix));
|
||||||
|
}
|
||||||
|
}
|
||||||
9
xhpc-modules/xhpc-tenant/src/main/resources/banner.txt
Normal file
9
xhpc-modules/xhpc-tenant/src/main/resources/banner.txt
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Spring Boot Version: ${spring-boot.version}
|
||||||
|
Spring Application Name: ${spring.application.name}
|
||||||
|
|
||||||
|
,--.
|
||||||
|
,--. ,--. | ,---. ,---. ,---.
|
||||||
|
\ `' / | .-. | | .-. | | .--'
|
||||||
|
/ /. \ | | | | | '-' ' \ `--.
|
||||||
|
'--' '--' `--' `--' | |-' `---'
|
||||||
|
`--'
|
||||||
37
xhpc-modules/xhpc-tenant/src/main/resources/bootstrap.yml
Normal file
37
xhpc-modules/xhpc-tenant/src/main/resources/bootstrap.yml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 8911
|
||||||
|
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: xhpc-tenant
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: dev
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
# 服务注册地址
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
config:
|
||||||
|
# 配置中心地址
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
# 配置文件格式
|
||||||
|
file-extension: yml
|
||||||
|
# 共享配置
|
||||||
|
shared-configs:
|
||||||
|
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||||
|
logging:
|
||||||
|
level:
|
||||||
|
root: info
|
||||||
|
com.xhpc.workorder.mapper: debug
|
||||||
|
|
||||||
|
file:
|
||||||
|
path: "d:\\logs"
|
||||||
|
|
||||||
|
pattern:
|
||||||
|
console: '%d{yyyy/MM/dd-HH:mm:ss} [%thread] %-5level %logger- %msg%n'
|
||||||
|
file: '%d{yyyy/MM/dd-HH:mm:ss} [%thread] %-5level %logger- %msg%n'
|
||||||
75
xhpc-modules/xhpc-tenant/src/main/resources/logback.xml
Normal file
75
xhpc-modules/xhpc-tenant/src/main/resources/logback.xml
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||||
|
<!-- 日志存放路径 -->
|
||||||
|
<property name="log.path" value="logs/xhpc-tenant"/>
|
||||||
|
<!-- 日志输出格式 -->
|
||||||
|
<property name="log.pattern"
|
||||||
|
value="%d{MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||||
|
|
||||||
|
<!-- 控制台输出 -->
|
||||||
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统日志输出 -->
|
||||||
|
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/info.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>INFO</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${log.path}/error.log</file>
|
||||||
|
<!-- 循环政策:基于时间创建日志文件 -->
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<!-- 日志文件名格式 -->
|
||||||
|
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||||
|
<!-- 日志最大的历史 60天 -->
|
||||||
|
<maxHistory>60</maxHistory>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder>
|
||||||
|
<pattern>${log.pattern}</pattern>
|
||||||
|
</encoder>
|
||||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||||
|
<!-- 过滤的级别 -->
|
||||||
|
<level>ERROR</level>
|
||||||
|
<!-- 匹配时的操作:接收(记录) -->
|
||||||
|
<onMatch>ACCEPT</onMatch>
|
||||||
|
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||||
|
<onMismatch>DENY</onMismatch>
|
||||||
|
</filter>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<!-- 系统模块日志级别控制 -->
|
||||||
|
<logger name="com.xhpc" level="info"/>
|
||||||
|
<!-- Spring日志级别控制 -->
|
||||||
|
<logger name="org.springframework" level="warn"/>
|
||||||
|
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="console"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
|
<!--系统操作日志-->
|
||||||
|
<root level="info">
|
||||||
|
<appender-ref ref="file_info"/>
|
||||||
|
<appender-ref ref="file_error"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
||||||
@ -0,0 +1,279 @@
|
|||||||
|
<?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.xhpc.tenant.mapper.XhpcTenantMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.xhpc.tenant.domain.XhpcTenantDomain">
|
||||||
|
<id column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
|
||||||
|
<result column="tenant_name" jdbcType="VARCHAR" property="tenantName" />
|
||||||
|
<result column="domain" jdbcType="VARCHAR" property="domain" />
|
||||||
|
<result column="background_url" jdbcType="VARCHAR" property="backgroundUrl" />
|
||||||
|
<result column="linkman" jdbcType="VARCHAR" property="linkman" />
|
||||||
|
<result column="contact_number" jdbcType="VARCHAR" property="contactNumber" />
|
||||||
|
<result column="address" jdbcType="VARCHAR" property="address" />
|
||||||
|
<result column="station_quote" jdbcType="INTEGER" property="stationQuote" />
|
||||||
|
<result column="station_pile_quote" jdbcType="INTEGER" property="stationPileQuote" />
|
||||||
|
<result column="expire_time" jdbcType="TIMESTAMP" property="expireTime" />
|
||||||
|
<result column="create_user" jdbcType="BIGINT" property="createUser" />
|
||||||
|
<result column="create_dept" jdbcType="BIGINT" property="createDept" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
<result column="update_user" jdbcType="BIGINT" property="updateUser" />
|
||||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
|
<result column="status" jdbcType="INTEGER" property="status" />
|
||||||
|
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
tenant_id, tenant_name, `domain`, background_url, linkman, contact_number, address,
|
||||||
|
station_quote, station_pile_quote, expire_time, create_user, create_dept, create_time,
|
||||||
|
update_user, update_time, `status`, is_deleted
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="getList" resultType="com.xhpc.tenant.domain.XhpcTenantDomain">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from xhpc_tenant where is_deleted=0
|
||||||
|
<if test="params.status != null and params.status != '' and params.status > -1">
|
||||||
|
and status = #{params.status}
|
||||||
|
</if>
|
||||||
|
<if test="params.tenantId != null and params.tenantId != ''">
|
||||||
|
and tenant_id like concat('%', #{params.tenantId}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="params.tenantName != null and params.tenantName != ''">
|
||||||
|
and tenant_name like concat('%', #{params.tenantName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="params.contactName != null and params.contactName != ''">
|
||||||
|
and linkman like concat('%', #{params.contactName}, '%')
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from xhpc_tenant
|
||||||
|
where tenant_id = #{tenantId,jdbcType=VARCHAR}
|
||||||
|
</select>
|
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||||
|
delete from xhpc_tenant
|
||||||
|
where tenant_id = #{tenantId,jdbcType=VARCHAR}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<update id="deleteLogicByPrimaryKey" parameterType="java.lang.String">
|
||||||
|
update xhpc_tenant set is_deleted = 2
|
||||||
|
where tenant_id = #{tenantId,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="insert" keyColumn="tenant_id" keyProperty="tenantId" parameterType="com.xhpc.tenant.domain.XhpcTenantDomain" useGeneratedKeys="true">
|
||||||
|
insert into xhpc_tenant (tenant_name, `domain`, background_url,
|
||||||
|
linkman, contact_number, address,
|
||||||
|
station_quote, station_pile_quote, expire_time,
|
||||||
|
create_user, create_dept, create_time,
|
||||||
|
update_user, update_time, `status`,
|
||||||
|
is_deleted)
|
||||||
|
values (#{tenantName,jdbcType=VARCHAR}, #{domain,jdbcType=VARCHAR}, #{backgroundUrl,jdbcType=VARCHAR},
|
||||||
|
#{linkman,jdbcType=VARCHAR}, #{contactNumber,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
|
||||||
|
#{stationQuote,jdbcType=INTEGER}, #{stationPileQuote,jdbcType=INTEGER}, #{expireTime,jdbcType=TIMESTAMP},
|
||||||
|
#{createUser,jdbcType=BIGINT}, #{createDept,jdbcType=BIGINT}, sysdate(),
|
||||||
|
#{updateUser,jdbcType=BIGINT}, sysdate(), #{status,jdbcType=INTEGER},
|
||||||
|
0)
|
||||||
|
</insert>
|
||||||
|
<insert id="insertSelective" keyColumn="tenant_id" keyProperty="tenantId" parameterType="com.xhpc.tenant.domain.XhpcTenantDomain" useGeneratedKeys="true">
|
||||||
|
insert into xhpc_tenant
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="tenantName != null">
|
||||||
|
tenant_name,
|
||||||
|
</if>
|
||||||
|
<if test="domain != null">
|
||||||
|
`domain`,
|
||||||
|
</if>
|
||||||
|
<if test="backgroundUrl != null">
|
||||||
|
background_url,
|
||||||
|
</if>
|
||||||
|
<if test="linkman != null">
|
||||||
|
linkman,
|
||||||
|
</if>
|
||||||
|
<if test="contactNumber != null">
|
||||||
|
contact_number,
|
||||||
|
</if>
|
||||||
|
<if test="address != null">
|
||||||
|
address,
|
||||||
|
</if>
|
||||||
|
<if test="stationQuote != null">
|
||||||
|
station_quote,
|
||||||
|
</if>
|
||||||
|
<if test="stationPileQuote != null">
|
||||||
|
station_pile_quote,
|
||||||
|
</if>
|
||||||
|
<if test="expireTime != null">
|
||||||
|
expire_time,
|
||||||
|
</if>
|
||||||
|
<if test="createUser != null">
|
||||||
|
create_user,
|
||||||
|
</if>
|
||||||
|
<if test="createDept != null">
|
||||||
|
create_dept,
|
||||||
|
</if>
|
||||||
|
create_time,
|
||||||
|
<if test="updateUser != null">
|
||||||
|
update_user,
|
||||||
|
</if>
|
||||||
|
update_time,
|
||||||
|
<if test="status != null">
|
||||||
|
`status`,
|
||||||
|
</if>
|
||||||
|
is_deleted
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="tenantName != null">
|
||||||
|
#{tenantName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="domain != null">
|
||||||
|
#{domain,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="backgroundUrl != null">
|
||||||
|
#{backgroundUrl,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="linkman != null">
|
||||||
|
#{linkman,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="contactNumber != null">
|
||||||
|
#{contactNumber,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="address != null">
|
||||||
|
#{address,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="stationQuote != null">
|
||||||
|
#{stationQuote,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="stationPileQuote != null">
|
||||||
|
#{stationPileQuote,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="expireTime != null">
|
||||||
|
#{expireTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="createUser != null">
|
||||||
|
#{createUser,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="createDept != null">
|
||||||
|
#{createDept,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
sysdate(),
|
||||||
|
<if test="updateUser != null">
|
||||||
|
#{updateUser,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
sysdate(),
|
||||||
|
<if test="status != null">
|
||||||
|
#{status,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
0
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.xhpc.tenant.domain.XhpcTenantDomain">
|
||||||
|
update xhpc_tenant
|
||||||
|
<set>
|
||||||
|
<if test="tenantName != null">
|
||||||
|
tenant_name = #{tenantName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="domain != null">
|
||||||
|
`domain` = #{domain,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="backgroundUrl != null">
|
||||||
|
background_url = #{backgroundUrl,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="linkman != null">
|
||||||
|
linkman = #{linkman,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="contactNumber != null">
|
||||||
|
contact_number = #{contactNumber,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="address != null">
|
||||||
|
address = #{address,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="stationQuote != null">
|
||||||
|
station_quote = #{stationQuote,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="stationPileQuote != null">
|
||||||
|
station_pile_quote = #{stationPileQuote,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="expireTime != null">
|
||||||
|
expire_time = #{expireTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="updateUser != null">
|
||||||
|
update_user = #{updateUser,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
update_time = sysdate(),
|
||||||
|
<if test="status != null">
|
||||||
|
`status` = #{status,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="isDeleted != null">
|
||||||
|
is_deleted = #{isDeleted,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where tenant_id = #{tenantId,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKey" parameterType="com.xhpc.tenant.domain.XhpcTenantDomain">
|
||||||
|
update xhpc_tenant
|
||||||
|
set tenant_name = #{tenantName,jdbcType=VARCHAR},
|
||||||
|
`domain` = #{domain,jdbcType=VARCHAR},
|
||||||
|
background_url = #{backgroundUrl,jdbcType=VARCHAR},
|
||||||
|
linkman = #{linkman,jdbcType=VARCHAR},
|
||||||
|
contact_number = #{contactNumber,jdbcType=VARCHAR},
|
||||||
|
address = #{address,jdbcType=VARCHAR},
|
||||||
|
station_quote = #{stationQuote,jdbcType=INTEGER},
|
||||||
|
station_pile_quote = #{stationPileQuote,jdbcType=INTEGER},
|
||||||
|
expire_time = #{expireTime,jdbcType=TIMESTAMP},
|
||||||
|
update_user = #{updateUser,jdbcType=BIGINT},
|
||||||
|
update_time = sysdate(),
|
||||||
|
`status` = #{status,jdbcType=INTEGER},
|
||||||
|
is_deleted = #{isDeleted,jdbcType=INTEGER}
|
||||||
|
where tenant_id = #{tenantId,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
<update id="updateInfoByPrimaryKey" parameterType="com.xhpc.tenant.domain.XhpcTenantDomain">
|
||||||
|
update xhpc_tenant
|
||||||
|
set tenant_name = #{tenantName,jdbcType=VARCHAR},
|
||||||
|
`domain` = #{domain,jdbcType=VARCHAR},
|
||||||
|
background_url = #{backgroundUrl,jdbcType=VARCHAR},
|
||||||
|
linkman = #{linkman,jdbcType=VARCHAR},
|
||||||
|
contact_number = #{contactNumber,jdbcType=VARCHAR},
|
||||||
|
address = #{address,jdbcType=VARCHAR},
|
||||||
|
update_user = #{updateUser,jdbcType=BIGINT},
|
||||||
|
update_time = sysdate()
|
||||||
|
where tenant_id = #{tenantId,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
<update id="updateStatusByPrimaryKey" parameterType="com.xhpc.tenant.domain.XhpcTenantDomain">
|
||||||
|
update xhpc_tenant
|
||||||
|
set update_user = #{updateUser,jdbcType=BIGINT},
|
||||||
|
update_time = sysdate(),
|
||||||
|
`status` = #{status,jdbcType=INTEGER}
|
||||||
|
where tenant_id = #{tenantId,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
<update id="updateTenantConfigByPrimaryKey" parameterType="com.xhpc.tenant.domain.XhpcTenantDomain">
|
||||||
|
update xhpc_tenant
|
||||||
|
set station_quote = #{stationQuote,jdbcType=INTEGER},
|
||||||
|
station_pile_quote = #{stationPileQuote,jdbcType=INTEGER},
|
||||||
|
expire_time = #{expireTime,jdbcType=TIMESTAMP},
|
||||||
|
update_user = #{updateUser,jdbcType=BIGINT},
|
||||||
|
update_time = sysdate(),
|
||||||
|
where tenant_id = #{tenantId,jdbcType=VARCHAR}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectExpiredList" resultType="com.xhpc.tenant.domain.XhpcTenantDomain">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from xhpc_tenant
|
||||||
|
where is_deleted = 0 and status = 1 and expire_time is not null and expire_time <![CDATA[ <= ]]> sysdate()
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectExpiringList" resultType="com.xhpc.tenant.domain.XhpcTenantDomain">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from xhpc_tenant
|
||||||
|
where is_deleted = 0 and status = 1 and expire_time is not null and expire_time <![CDATA[ <= ]]> #{expireTime}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
x
Reference in New Issue
Block a user