@@ -2,15 +2,15 @@ | |||
<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"> | |||
<modelVersion>4.0.0</modelVersion> | |||
<modelVersion>4.0.0</modelVersion> | |||
<groupId>com.ruoyi</groupId> | |||
<artifactId>ruoyi</artifactId> | |||
<version>3.8.5</version> | |||
<name></name> | |||
<description>管理系统</description> | |||
<properties> | |||
<ruoyi.version>3.8.5</ruoyi.version> | |||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |||
@@ -31,7 +31,7 @@ | |||
<velocity.version>2.3</velocity.version> | |||
<jwt.version>0.9.1</jwt.version> | |||
</properties> | |||
<!-- 依赖声明 --> | |||
<dependencyManagement> | |||
<dependencies> | |||
@@ -197,7 +197,6 @@ | |||
<version>3.4.2</version> | |||
</dependency> | |||
</dependencies> | |||
</dependencyManagement> | |||
@@ -1,14 +1,36 @@ | |||
# 数据源配置 | |||
# Spring配置 数据源配置 | |||
spring: | |||
# redis 配置 | |||
redis: | |||
# 地址 | |||
host: 192.168.10.136 | |||
# 端口,默认为6379 | |||
port: 6379 | |||
# 数据库索引 | |||
database: 13 | |||
# 密码 | |||
password: wjcy@123456 | |||
# 连接超时时间 | |||
timeout: 10s | |||
lettuce: | |||
pool: | |||
# 连接池中的最小空闲连接 | |||
min-idle: 0 | |||
# 连接池中的最大空闲连接 | |||
max-idle: 8 | |||
# 连接池的最大数据库连接数 | |||
max-active: 8 | |||
# #连接池最大阻塞等待时间(使用负值表示没有限制) | |||
max-wait: -1ms | |||
datasource: | |||
type: com.alibaba.druid.pool.DruidDataSource | |||
driverClassName: com.mysql.cj.jdbc.Driver | |||
druid: | |||
# 主库数据源 | |||
master: | |||
url: jdbc:mysql://192.168.124.67:3306/dba?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 | |||
username: dba | |||
password: 123456 | |||
url: jdbc:mysql://192.168.10.136:3306/wjcy_new?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 | |||
username: root | |||
password: wjcy@123456 | |||
# 从库数据源 | |||
slave: | |||
# 从数据源开关/默认关闭 |
@@ -0,0 +1,79 @@ | |||
# Spring配置 数据源配置 | |||
spring: | |||
# redis 配置 | |||
redis: | |||
# 地址 | |||
host: 192.168.10.136 | |||
# 端口,默认为6379 | |||
port: 6379 | |||
# 数据库索引 | |||
database: 13 | |||
# 密码 | |||
password: wjcy@123456 | |||
# 连接超时时间 | |||
timeout: 10s | |||
lettuce: | |||
pool: | |||
# 连接池中的最小空闲连接 | |||
min-idle: 0 | |||
# 连接池中的最大空闲连接 | |||
max-idle: 8 | |||
# 连接池的最大数据库连接数 | |||
max-active: 8 | |||
# #连接池最大阻塞等待时间(使用负值表示没有限制) | |||
max-wait: -1ms | |||
datasource: | |||
type: com.alibaba.druid.pool.DruidDataSource | |||
driverClassName: com.mysql.cj.jdbc.Driver | |||
druid: | |||
# 主库数据源 | |||
master: | |||
url: jdbc:mysql://192.168.10.136:3306/wjcy_new?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 | |||
username: root | |||
password: wjcy@123456 | |||
# 从库数据源 | |||
slave: | |||
# 从数据源开关/默认关闭 | |||
enabled: false | |||
url: | |||
username: | |||
password: | |||
# 初始连接数 | |||
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: /druid/* | |||
# 控制台管理用户名和密码 | |||
login-username: ruoyi | |||
login-password: 123456 | |||
filter: | |||
stat: | |||
enabled: true | |||
# 慢SQL记录 | |||
log-slow-sql: true | |||
slow-sql-millis: 1000 | |||
merge-sql: true | |||
wall: | |||
config: | |||
multi-statement-allow: true |
@@ -0,0 +1,79 @@ | |||
# Spring配置 数据源配置 | |||
spring: | |||
# redis 配置 | |||
redis: | |||
# 地址 | |||
host: 192.168.10.136 | |||
# 端口,默认为6379 | |||
port: 6379 | |||
# 数据库索引 | |||
database: 13 | |||
# 密码 | |||
password: wjcy@123456 | |||
# 连接超时时间 | |||
timeout: 10s | |||
lettuce: | |||
pool: | |||
# 连接池中的最小空闲连接 | |||
min-idle: 0 | |||
# 连接池中的最大空闲连接 | |||
max-idle: 8 | |||
# 连接池的最大数据库连接数 | |||
max-active: 8 | |||
# #连接池最大阻塞等待时间(使用负值表示没有限制) | |||
max-wait: -1ms | |||
datasource: | |||
type: com.alibaba.druid.pool.DruidDataSource | |||
driverClassName: com.mysql.cj.jdbc.Driver | |||
druid: | |||
# 主库数据源 | |||
master: | |||
url: jdbc:mysql://192.168.10.136:3306/wjcy_new?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 | |||
username: root | |||
password: wjcy@123456 | |||
# 从库数据源 | |||
slave: | |||
# 从数据源开关/默认关闭 | |||
enabled: false | |||
url: | |||
username: | |||
password: | |||
# 初始连接数 | |||
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: /druid/* | |||
# 控制台管理用户名和密码 | |||
login-username: ruoyi | |||
login-password: 123456 | |||
filter: | |||
stat: | |||
enabled: true | |||
# 慢SQL记录 | |||
log-slow-sql: true | |||
slow-sql-millis: 1000 | |||
merge-sql: true | |||
wall: | |||
config: | |||
multi-statement-allow: true |
@@ -54,7 +54,7 @@ spring: | |||
# 国际化资源文件路径 | |||
basename: i18n/messages | |||
profiles: | |||
active: druid | |||
active: dev | |||
# 文件上传 | |||
servlet: | |||
multipart: | |||
@@ -70,13 +70,13 @@ spring: | |||
# redis 配置 | |||
redis: | |||
# 地址 | |||
host: 192.168.124.67 | |||
host: 192.168.10.136 | |||
# 端口,默认为6379 | |||
port: 6379 | |||
# 数据库索引 | |||
database: 0 | |||
database: 13 | |||
# 密码 | |||
password: 123456 | |||
password: wjcy@123456 | |||
# 连接超时时间 | |||
timeout: 10s | |||
lettuce: | |||
@@ -23,6 +23,24 @@ | |||
<artifactId>ruoyi-common</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>io.springfox</groupId> | |||
<artifactId>springfox-swagger-ui</artifactId> | |||
<version>2.9.2</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>io.springfox</groupId> | |||
<artifactId>springfox-swagger2</artifactId> | |||
<version>2.9.2</version> | |||
<exclusions> | |||
<exclusion> | |||
<groupId>org.slf4j</groupId> | |||
<artifactId>slf4j-api</artifactId> | |||
</exclusion> | |||
</exclusions> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -0,0 +1,116 @@ | |||
package com.ruoyi.business.controller; | |||
import java.util.List; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.util.Arrays; | |||
import com.ruoyi.business.domain.Rebot; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiImplicitParam; | |||
import io.swagger.annotations.ApiImplicitParams; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.springframework.security.access.prepost.PreAuthorize; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.PutMapping; | |||
import org.springframework.web.bind.annotation.DeleteMapping; | |||
import org.springframework.web.bind.annotation.PathVariable; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import com.ruoyi.common.annotation.Log; | |||
import com.ruoyi.common.core.controller.BaseController; | |||
import com.ruoyi.common.core.domain.AjaxResult; | |||
import com.ruoyi.common.enums.BusinessType; | |||
import com.ruoyi.business.domain.Apply; | |||
import com.ruoyi.business.service.IApplyService; | |||
import com.ruoyi.common.utils.poi.ExcelUtil; | |||
import com.ruoyi.common.core.page.TableDataInfo; | |||
/** | |||
* 应用信息管理Controller | |||
* | |||
* @author LiuChengRan | |||
* @date 2024-06-13 | |||
*/ | |||
@Api(tags = "应用信息管理接口") | |||
@RestController | |||
@RequestMapping("/business/ctApply") | |||
public class ApplyController extends BaseController { | |||
@Autowired | |||
private IApplyService applyService; | |||
/** | |||
* 同步应用数据 | |||
*/ | |||
@ApiOperation(value = "同步应用数据", httpMethod = "POST", response = Rebot.class) | |||
@PostMapping("/syn") | |||
public AjaxResult syn(Apply apply) { | |||
applyService.syn(apply); | |||
return AjaxResult.success(); | |||
} | |||
/** | |||
* 查询应用信息管理列表 | |||
*/ | |||
@ApiOperation(value = "查询应用信息管理列表", httpMethod = "GET", response = Apply.class) | |||
@GetMapping("/list") | |||
public TableDataInfo list(Apply apply) { | |||
startPage(); | |||
List<Apply> list = applyService.list(apply); | |||
return getDataTable(list); | |||
} | |||
/** | |||
* 导出应用信息管理列表 | |||
*/ | |||
@ApiOperation(value = "导出应用信息管理列表", httpMethod = "POST") | |||
@Log(title = "应用信息管理", businessType = BusinessType.EXPORT) | |||
@PostMapping("/export") | |||
public void export(HttpServletResponse response, Apply apply) { | |||
List<Apply> list = applyService.list(apply); | |||
ExcelUtil<Apply> util = new ExcelUtil<Apply>(Apply.class); | |||
util.exportExcel(response, list, "应用信息管理数据"); | |||
} | |||
/** | |||
* 获取应用信息管理详细信息 | |||
*/ | |||
@ApiOperation(value = "获取应用信息管理详细信息", httpMethod = "GET", response = Apply.class) | |||
@GetMapping(value = "/{id}") | |||
public AjaxResult getInfo(@PathVariable("id") Long id) { | |||
return success(applyService.getById(id)); | |||
} | |||
/** | |||
* 新增应用信息管理 | |||
*/ | |||
@ApiOperation(value = "新增应用信息管理", httpMethod = "POST") | |||
@Log(title = "应用信息管理", businessType = BusinessType.INSERT) | |||
@PostMapping | |||
public AjaxResult add(@RequestBody Apply apply) { | |||
return toAjax(applyService.save(apply)); | |||
} | |||
/** | |||
* 修改应用信息管理 | |||
*/ | |||
@ApiOperation(value = "修改应用信息管理", httpMethod = "PUT") | |||
@Log(title = "应用信息管理", businessType = BusinessType.UPDATE) | |||
@PutMapping | |||
public AjaxResult edit(@RequestBody Apply apply) { | |||
return toAjax(applyService.updateById(apply)); | |||
} | |||
/** | |||
* 删除应用信息管理 | |||
*/ | |||
@ApiOperation(value = "删除应用信息管理", httpMethod = "DELETE") | |||
@Log(title = "应用信息管理", businessType = BusinessType.DELETE) | |||
@DeleteMapping("/{ids}") | |||
public AjaxResult remove(@PathVariable Long[] ids) { | |||
return toAjax(applyService.removeByIds(Arrays.asList(ids))); | |||
} | |||
} |
@@ -1,138 +0,0 @@ | |||
package com.ruoyi.business.controller; | |||
import java.util.List; | |||
import javax.servlet.http.HttpServletResponse; | |||
import com.alibaba.fastjson2.JSONArray; | |||
import com.alibaba.fastjson2.JSONObject; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.ruoyi.business.domain.BusinessTemplate; | |||
import com.ruoyi.business.domain.BusinessTemplateProp; | |||
import com.ruoyi.business.domain.BusinessTemplatePropValue; | |||
import com.ruoyi.business.service.IBusinessTemplatePropService; | |||
import com.ruoyi.business.service.IBusinessTemplateService; | |||
import com.ruoyi.common.utils.SecurityUtils; | |||
import com.ruoyi.common.utils.StringUtils; | |||
import org.springframework.security.access.prepost.PreAuthorize; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.PutMapping; | |||
import org.springframework.web.bind.annotation.DeleteMapping; | |||
import org.springframework.web.bind.annotation.PathVariable; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import com.ruoyi.common.annotation.Log; | |||
import com.ruoyi.common.core.controller.BaseController; | |||
import com.ruoyi.common.core.domain.AjaxResult; | |||
import com.ruoyi.common.enums.BusinessType; | |||
import com.ruoyi.business.domain.BusinessSurvey; | |||
import com.ruoyi.business.service.IBusinessSurveyService; | |||
import com.ruoyi.common.utils.poi.ExcelUtil; | |||
import java.util.Arrays; | |||
import java.util.Optional; | |||
import java.util.stream.Collectors; | |||
import java.util.stream.Stream; | |||
import com.ruoyi.common.core.page.TableDataInfo; | |||
/** | |||
* 调查问卷管理Controller | |||
* | |||
* @author ruoyi | |||
* @date 2024-04-01 | |||
*/ | |||
@RestController | |||
@RequestMapping("/business/survey") | |||
public class BusinessSurveyController extends BaseController | |||
{ | |||
@Autowired | |||
private IBusinessSurveyService businessSurveyService; | |||
/** | |||
* 获取问卷属性 | |||
*/ | |||
@GetMapping("/listBySurveyId") | |||
public AjaxResult listBySurveyId(String surveyId) { | |||
return businessSurveyService.listBySurveyId(surveyId); | |||
} | |||
/** | |||
* 查询调查问卷管理列表 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:survey:list')") | |||
@GetMapping("/list") | |||
public TableDataInfo list(BusinessSurvey businessSurvey) | |||
{ | |||
startPage(); | |||
List<BusinessSurvey> list = businessSurveyService.lambdaQuery() | |||
.eq(StringUtils.isNotEmpty(businessSurvey.getTitle()),BusinessSurvey::getTitle,businessSurvey.getTitle()) | |||
.eq(StringUtils.isNotBlank(businessSurvey.getOpen()),BusinessSurvey::getOpen,businessSurvey.getOpen()).list(); | |||
return getDataTable(list); | |||
} | |||
/** | |||
* 导出调查问卷管理列表 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:survey:export')") | |||
@Log(title = "调查问卷管理", businessType = BusinessType.EXPORT) | |||
@PostMapping("/export") | |||
public void export(HttpServletResponse response, BusinessSurvey businessSurvey) | |||
{ | |||
List<BusinessSurvey> list = businessSurveyService.list(); | |||
ExcelUtil<BusinessSurvey> util = new ExcelUtil<BusinessSurvey>(BusinessSurvey.class); | |||
util.exportExcel(response, list, "调查问卷管理数据"); | |||
} | |||
/** | |||
* 获取调查问卷管理详细信息 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:survey:query')") | |||
@GetMapping(value = "/{id}") | |||
public AjaxResult getInfo(@PathVariable("id") Long id) | |||
{ | |||
return success(businessSurveyService.getById(id)); | |||
} | |||
@Autowired | |||
private IBusinessTemplateService businessTemplateService; | |||
/** | |||
* 新增调查问卷管理 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:survey:add')") | |||
@Log(title = "调查问卷管理", businessType = BusinessType.INSERT) | |||
@PostMapping | |||
public AjaxResult add(@RequestBody BusinessSurvey businessSurvey) | |||
{ | |||
BusinessTemplate one = businessTemplateService.lambdaQuery().eq(BusinessTemplate::getId, businessSurvey.getTempId()).one(); | |||
businessSurvey.setTempName(one.getTitle()); | |||
return toAjax(businessSurveyService.save(businessSurvey)); | |||
} | |||
/** | |||
* 修改调查问卷管理 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:survey:edit')") | |||
@Log(title = "调查问卷管理", businessType = BusinessType.UPDATE) | |||
@PutMapping | |||
public AjaxResult edit(@RequestBody BusinessSurvey businessSurvey) | |||
{ | |||
BusinessTemplate one = businessTemplateService.lambdaQuery().eq(BusinessTemplate::getId, businessSurvey.getTempId()).one(); | |||
businessSurvey.setTempName(one.getTitle()); | |||
return toAjax(businessSurveyService.updateById(businessSurvey)); | |||
} | |||
/** | |||
* 删除调查问卷管理 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:survey:remove')") | |||
@Log(title = "调查问卷管理", businessType = BusinessType.DELETE) | |||
@DeleteMapping("/{ids}") | |||
public AjaxResult remove(@PathVariable Long[] ids) | |||
{ | |||
return toAjax(businessSurveyService.removeByIds(Arrays.asList(ids))); | |||
} | |||
} |
@@ -1,138 +0,0 @@ | |||
package com.ruoyi.business.controller; | |||
import java.util.List; | |||
import javax.servlet.http.HttpServletResponse; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.ruoyi.business.domain.BusinessSurvey; | |||
import com.ruoyi.business.service.IBusinessSurveyService; | |||
import com.ruoyi.common.utils.SecurityUtils; | |||
import com.ruoyi.common.utils.StringUtils; | |||
import org.springframework.security.access.prepost.PreAuthorize; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.PutMapping; | |||
import org.springframework.web.bind.annotation.DeleteMapping; | |||
import org.springframework.web.bind.annotation.PathVariable; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import com.ruoyi.common.annotation.Log; | |||
import com.ruoyi.common.core.controller.BaseController; | |||
import com.ruoyi.common.core.domain.AjaxResult; | |||
import com.ruoyi.common.enums.BusinessType; | |||
import com.ruoyi.business.domain.BusinessTemplate; | |||
import com.ruoyi.business.service.IBusinessTemplateService; | |||
import com.ruoyi.common.utils.poi.ExcelUtil; | |||
import java.util.Arrays; | |||
import com.ruoyi.common.core.page.TableDataInfo; | |||
/** | |||
* 模版管理Controller | |||
* | |||
* @author ruoyi | |||
* @date 2024-03-31 | |||
*/ | |||
@RestController | |||
@RequestMapping("/business/template") | |||
public class BusinessTemplateController extends BaseController | |||
{ | |||
@Autowired | |||
private IBusinessTemplateService businessTemplateService; | |||
/** | |||
* 查询模版管理列表 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:template:list')") | |||
@GetMapping("/list") | |||
public TableDataInfo list(BusinessTemplate businessTemplate) | |||
{ | |||
startPage(); | |||
LambdaQueryWrapper<BusinessTemplate> like = new LambdaQueryWrapper<BusinessTemplate>() | |||
.eq(StringUtils.isNotBlank( businessTemplate.getOpen()),BusinessTemplate::getOpen, businessTemplate.getOpen()) | |||
.like(StringUtils.isNotBlank(businessTemplate.getTitle()), BusinessTemplate::getTitle, businessTemplate.getTitle()); | |||
if(businessTemplate.getCreateBy() != null){ | |||
logger.debug("SecurityUtils.getUsername():{}",SecurityUtils.getUsername()); | |||
like.eq(BusinessTemplate::getCreateBy, SecurityUtils.getUsername()); | |||
} | |||
List<BusinessTemplate> list = businessTemplateService.list(like); | |||
return getDataTable(list); | |||
} | |||
/** | |||
* 查询模版管理列表 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:template:list')") | |||
@GetMapping("/listAll") | |||
public AjaxResult listAll(BusinessTemplate businessTemplate) | |||
{ | |||
List<BusinessTemplate> list = businessTemplateService.list( | |||
new LambdaQueryWrapper<BusinessTemplate>().eq(BusinessTemplate::getCreateBy,SecurityUtils.getUsername()) | |||
.eq(StringUtils.isNotBlank(businessTemplate.getId()),BusinessTemplate::getId,businessTemplate.getId()) | |||
); | |||
return AjaxResult.success(list); | |||
} | |||
/** | |||
* 导出模版管理列表 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:template:export')") | |||
@Log(title = "模版管理", businessType = BusinessType.EXPORT) | |||
@PostMapping("/export") | |||
public void export(HttpServletResponse response, BusinessTemplate businessTemplate) | |||
{ | |||
List<BusinessTemplate> list = businessTemplateService.list(); | |||
ExcelUtil<BusinessTemplate> util = new ExcelUtil<BusinessTemplate>(BusinessTemplate.class); | |||
util.exportExcel(response, list, "模版管理数据"); | |||
} | |||
/** | |||
* 获取模版管理详细信息 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:template:query')") | |||
@GetMapping(value = "/{id}") | |||
public AjaxResult getInfo(@PathVariable("id") Long id) | |||
{ | |||
return success(businessTemplateService.getById(id)); | |||
} | |||
/** | |||
* 新增模版管理 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:template:add')") | |||
@Log(title = "模版管理", businessType = BusinessType.INSERT) | |||
@PostMapping | |||
public AjaxResult add(@RequestBody BusinessTemplate businessTemplate) | |||
{ | |||
return toAjax(businessTemplateService.save(businessTemplate)); | |||
} | |||
@Autowired | |||
private IBusinessSurveyService businessSurveyService; | |||
/** | |||
* 修改模版管理 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:template:edit')") | |||
@Log(title = "模版管理", businessType = BusinessType.UPDATE) | |||
@PutMapping | |||
public AjaxResult edit(@RequestBody BusinessTemplate businessTemplate) | |||
{ | |||
BusinessSurvey businessSurvey = new BusinessSurvey(); | |||
businessSurvey.setTempName(businessTemplate.getTitle()); | |||
businessSurveyService.lambdaUpdate().eq(BusinessSurvey::getTempId, businessTemplate.getId()).update(businessSurvey); | |||
return toAjax(businessTemplateService.updateById(businessTemplate)); | |||
} | |||
/** | |||
* 删除模版管理 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:template:remove')") | |||
@Log(title = "模版管理", businessType = BusinessType.DELETE) | |||
@DeleteMapping("/{ids}") | |||
public AjaxResult remove(@PathVariable Long[] ids) | |||
{ | |||
return toAjax(businessTemplateService.removeByIds(Arrays.asList(ids))); | |||
} | |||
} |
@@ -1,121 +0,0 @@ | |||
package com.ruoyi.business.controller; | |||
import java.util.List; | |||
import javax.servlet.http.HttpServletResponse; | |||
import com.alibaba.fastjson2.JSON; | |||
import com.alibaba.fastjson2.JSONArray; | |||
import com.alibaba.fastjson2.JSONObject; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.ruoyi.business.domain.BusinessTemplatePropValue; | |||
import com.ruoyi.business.service.IBusinessTemplatePropValueService; | |||
import com.ruoyi.common.utils.SecurityUtils; | |||
import com.ruoyi.common.utils.StringUtils; | |||
import org.springframework.security.access.prepost.PreAuthorize; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.PutMapping; | |||
import org.springframework.web.bind.annotation.DeleteMapping; | |||
import org.springframework.web.bind.annotation.PathVariable; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import com.ruoyi.common.annotation.Log; | |||
import com.ruoyi.common.core.controller.BaseController; | |||
import com.ruoyi.common.core.domain.AjaxResult; | |||
import com.ruoyi.common.enums.BusinessType; | |||
import com.ruoyi.business.domain.BusinessTemplateProp; | |||
import com.ruoyi.business.service.IBusinessTemplatePropService; | |||
import com.ruoyi.common.utils.poi.ExcelUtil; | |||
import java.util.Arrays; | |||
import java.util.Optional; | |||
import java.util.stream.Collectors; | |||
import java.util.stream.Stream; | |||
import com.ruoyi.common.core.page.TableDataInfo; | |||
/** | |||
* 模版属性Controller | |||
* | |||
* @author ruoyi | |||
* @date 2024-03-31 | |||
*/ | |||
@RestController | |||
@RequestMapping("/business/templateProp") | |||
public class BusinessTemplatePropController extends BaseController { | |||
@Autowired | |||
private IBusinessTemplatePropService businessTemplatePropService; | |||
@Autowired | |||
private IBusinessTemplatePropValueService businessTemplatePropValueService; | |||
/** | |||
* 查询模版属性列表 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:templateProp:list')") | |||
@GetMapping("/list") | |||
public TableDataInfo list(BusinessTemplateProp businessTemplateProp) { | |||
startPage(); | |||
List<BusinessTemplateProp> list = businessTemplatePropService.list(new LambdaQueryWrapper<BusinessTemplateProp>() | |||
.eq(StringUtils.isNotBlank(businessTemplateProp.getCompType()),BusinessTemplateProp::getCompType,businessTemplateProp.getCompType()) | |||
.eq(StringUtils.isNotBlank(businessTemplateProp.getFieldName()),BusinessTemplateProp::getFieldName,businessTemplateProp.getFieldName()) | |||
.eq(StringUtils.isNotBlank(businessTemplateProp.getId()),BusinessTemplateProp::getId,businessTemplateProp.getId()) | |||
.eq(BusinessTemplateProp::getTempId,businessTemplateProp.getTempId()) | |||
); | |||
return getDataTable(list); | |||
} | |||
/** | |||
* 导出模版属性列表 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:templateProp:export')") | |||
@Log(title = "模版属性" , businessType = BusinessType.EXPORT) | |||
@PostMapping("/export") | |||
public void export(HttpServletResponse response, BusinessTemplateProp businessTemplateProp) { | |||
List<BusinessTemplateProp> list = businessTemplatePropService.list(); | |||
ExcelUtil<BusinessTemplateProp> util = new ExcelUtil<BusinessTemplateProp>(BusinessTemplateProp.class); | |||
util.exportExcel(response, list, "模版属性数据"); | |||
} | |||
/** | |||
* 获取模版属性详细信息 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:templateProp:query')") | |||
@GetMapping(value = "/{id}") | |||
public AjaxResult getInfo(@PathVariable("id") Long id) { | |||
return success(businessTemplatePropService.getById(id)); | |||
} | |||
/** | |||
* 新增模版属性 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:templateProp:add')") | |||
@Log(title = "模版属性" , businessType = BusinessType.INSERT) | |||
@PostMapping | |||
public AjaxResult add(@RequestBody BusinessTemplateProp businessTemplateProp) { | |||
return toAjax(businessTemplatePropService.save(businessTemplateProp)); | |||
} | |||
/** | |||
* 修改模版属性 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:templateProp:edit')") | |||
@Log(title = "模版属性" , businessType = BusinessType.UPDATE) | |||
@PutMapping | |||
public AjaxResult edit(@RequestBody BusinessTemplateProp businessTemplateProp) { | |||
return toAjax(businessTemplatePropService.updateById(businessTemplateProp)); | |||
} | |||
/** | |||
* 删除模版属性 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:templateProp:remove')") | |||
@Log(title = "模版属性" , businessType = BusinessType.DELETE) | |||
@DeleteMapping("/{ids}") | |||
public AjaxResult remove(@PathVariable Long[] ids) { | |||
return toAjax(businessTemplatePropService.removeByIds(Arrays.asList(ids))); | |||
} | |||
} |
@@ -1,128 +0,0 @@ | |||
package com.ruoyi.business.controller; | |||
import java.util.List; | |||
import javax.servlet.http.HttpServletResponse; | |||
import org.springframework.security.access.prepost.PreAuthorize; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.PutMapping; | |||
import org.springframework.web.bind.annotation.DeleteMapping; | |||
import org.springframework.web.bind.annotation.PathVariable; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import com.ruoyi.common.annotation.Log; | |||
import com.ruoyi.common.core.controller.BaseController; | |||
import com.ruoyi.common.core.domain.AjaxResult; | |||
import com.ruoyi.common.enums.BusinessType; | |||
import com.ruoyi.business.domain.BusinessTemplatePropValue; | |||
import com.ruoyi.business.service.IBusinessTemplatePropValueService; | |||
import com.ruoyi.common.utils.poi.ExcelUtil; | |||
import java.util.Arrays; | |||
import java.util.Map; | |||
import com.ruoyi.common.core.page.TableDataInfo; | |||
/** | |||
* 模版属性值Controller | |||
* | |||
* @author ruoyi | |||
* @date 2024-03-31 | |||
*/ | |||
@RestController | |||
@RequestMapping("/business/templatePropValue") | |||
public class BusinessTemplatePropValueController extends BaseController | |||
{ | |||
@Autowired | |||
private IBusinessTemplatePropValueService businessTemplatePropValueService; | |||
/** | |||
* 查询模版属性值列表 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:templatePropValue:list')") | |||
@GetMapping("/list") | |||
public TableDataInfo list(BusinessTemplatePropValue businessTemplatePropValue) | |||
{ | |||
startPage(); | |||
List<BusinessTemplatePropValue> list = businessTemplatePropValueService.list(); | |||
return getDataTable(list); | |||
} | |||
/** | |||
* 统计问卷 | |||
*/ | |||
@GetMapping("/countGroup") | |||
public AjaxResult countGroup(String surveyId) | |||
{ | |||
Object o = businessTemplatePropValueService.countGroup(surveyId); | |||
return AjaxResult.success(o); | |||
} | |||
/** | |||
* 导出模版属性值列表 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:templatePropValue:export')") | |||
@Log(title = "模版属性值", businessType = BusinessType.EXPORT) | |||
@PostMapping("/export") | |||
public void export(HttpServletResponse response, BusinessTemplatePropValue businessTemplatePropValue) | |||
{ | |||
List<BusinessTemplatePropValue> list = businessTemplatePropValueService.list(); | |||
ExcelUtil<BusinessTemplatePropValue> util = new ExcelUtil<BusinessTemplatePropValue>(BusinessTemplatePropValue.class); | |||
util.exportExcel(response, list, "模版属性值数据"); | |||
} | |||
/** | |||
* 获取模版属性值详细信息 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:templatePropValue:query')") | |||
@GetMapping(value = "/{id}") | |||
public AjaxResult getInfo(@PathVariable("id") Long id) | |||
{ | |||
return success(businessTemplatePropValueService.getById(id)); | |||
} | |||
/** | |||
* 新增模版属性值 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:templatePropValue:add')") | |||
@Log(title = "模版属性值", businessType = BusinessType.INSERT) | |||
@PostMapping | |||
public AjaxResult add(@RequestBody BusinessTemplatePropValue businessTemplatePropValue) | |||
{ | |||
return toAjax(businessTemplatePropValueService.save(businessTemplatePropValue)); | |||
} | |||
/** | |||
* 新增模版属性值 | |||
*/ | |||
@Log(title = "模版属性值", businessType = BusinessType.INSERT) | |||
@PostMapping("/addList") | |||
public AjaxResult addList(@RequestBody Map<String,Object> data) | |||
{ | |||
return toAjax(businessTemplatePropValueService.addList(data)); | |||
} | |||
/** | |||
* 修改模版属性值 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:templatePropValue:edit')") | |||
@Log(title = "模版属性值", businessType = BusinessType.UPDATE) | |||
@PutMapping | |||
public AjaxResult edit(@RequestBody BusinessTemplatePropValue businessTemplatePropValue) | |||
{ | |||
return toAjax(businessTemplatePropValueService.updateById(businessTemplatePropValue)); | |||
} | |||
/** | |||
* 删除模版属性值 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('business:templatePropValue:remove')") | |||
@Log(title = "模版属性值", businessType = BusinessType.DELETE) | |||
@DeleteMapping("/{ids}") | |||
public AjaxResult remove(@PathVariable Long[] ids) | |||
{ | |||
return toAjax(businessTemplatePropValueService.removeByIds(Arrays.asList(ids))); | |||
} | |||
} |
@@ -0,0 +1,114 @@ | |||
package com.ruoyi.business.controller; | |||
import java.util.List; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.util.Arrays; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiImplicitParam; | |||
import io.swagger.annotations.ApiImplicitParams; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.springframework.security.access.prepost.PreAuthorize; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.PutMapping; | |||
import org.springframework.web.bind.annotation.DeleteMapping; | |||
import org.springframework.web.bind.annotation.PathVariable; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import com.ruoyi.common.annotation.Log; | |||
import com.ruoyi.common.core.controller.BaseController; | |||
import com.ruoyi.common.core.domain.AjaxResult; | |||
import com.ruoyi.common.enums.BusinessType; | |||
import com.ruoyi.business.domain.Rebot; | |||
import com.ruoyi.business.service.IRebotService; | |||
import com.ruoyi.common.utils.poi.ExcelUtil; | |||
import com.ruoyi.common.core.page.TableDataInfo; | |||
/** | |||
* 机器人管理Controller | |||
* | |||
* @author LiuChengRan | |||
* @date 2024-06-13 | |||
*/ | |||
@Api(tags = "机器人管理接口") | |||
@RestController | |||
@RequestMapping("/business/ctRebot") | |||
public class RebotController extends BaseController { | |||
@Autowired | |||
private IRebotService rebotService; | |||
/** | |||
* 同步机器人数据 | |||
*/ | |||
@ApiOperation(value = "同步机器人数据", httpMethod = "POST", response = Rebot.class) | |||
@PostMapping("/syn") | |||
public AjaxResult syn(Rebot rebot) { | |||
rebotService.syn(rebot); | |||
return AjaxResult.success(); | |||
} | |||
/** | |||
* 查询机器人管理列表 | |||
*/ | |||
@ApiOperation(value = "查询机器人管理列表", httpMethod = "GET", response = Rebot.class) | |||
@GetMapping("/list") | |||
public TableDataInfo list(Rebot rebot) { | |||
startPage(); | |||
List<Rebot> list = rebotService.list(rebot); | |||
return getDataTable(list); | |||
} | |||
/** | |||
* 导出机器人管理列表 | |||
*/ | |||
@ApiOperation(value = "导出机器人管理列表", httpMethod = "POST") | |||
@Log(title = "机器人管理", businessType = BusinessType.EXPORT) | |||
@PostMapping("/export") | |||
public void export(HttpServletResponse response, Rebot rebot) { | |||
List<Rebot> list = rebotService.list(rebot); | |||
ExcelUtil<Rebot> util = new ExcelUtil<Rebot>(Rebot.class); | |||
util.exportExcel(response, list, "机器人管理数据"); | |||
} | |||
/** | |||
* 获取机器人管理详细信息 | |||
*/ | |||
@ApiOperation(value = "获取机器人管理详细信息", httpMethod = "GET", response = Rebot.class) | |||
@GetMapping(value = "/{id}") | |||
public AjaxResult getInfo(@PathVariable("id") Long id) { | |||
return success(rebotService.getById(id)); | |||
} | |||
/** | |||
* 新增机器人管理 | |||
*/ | |||
@ApiOperation(value = "新增机器人管理", httpMethod = "POST") | |||
@Log(title = "机器人管理", businessType = BusinessType.INSERT) | |||
@PostMapping | |||
public AjaxResult add(@RequestBody Rebot rebot) { | |||
return toAjax(rebotService.save(rebot)); | |||
} | |||
/** | |||
* 修改机器人管理 | |||
*/ | |||
@ApiOperation(value = "修改机器人管理", httpMethod = "PUT") | |||
@Log(title = "机器人管理", businessType = BusinessType.UPDATE) | |||
@PutMapping | |||
public AjaxResult edit(@RequestBody Rebot rebot) { | |||
return toAjax(rebotService.updateById(rebot)); | |||
} | |||
/** | |||
* 删除机器人管理 | |||
*/ | |||
@ApiOperation(value = "删除机器人管理", httpMethod = "DELETE") | |||
@Log(title = "机器人管理", businessType = BusinessType.DELETE) | |||
@DeleteMapping("/{ids}") | |||
public AjaxResult remove(@PathVariable Long[] ids) { | |||
return toAjax(rebotService.removeByIds(Arrays.asList(ids))); | |||
} | |||
} |
@@ -0,0 +1,120 @@ | |||
package com.ruoyi.business.domain; | |||
import java.util.Date; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.baomidou.mybatisplus.annotation.*; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.ruoyi.common.annotation.Excel; | |||
import lombok.Data; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Builder; | |||
import lombok.NoArgsConstructor; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.ruoyi.common.core.domain.BaseEntity; | |||
/** | |||
* 应用信息管理对象 ct_apply | |||
* | |||
* @author LiuChengRan | |||
* @date 2024-06-13 | |||
*/ | |||
@Data | |||
@Builder(toBuilder = true) | |||
@NoArgsConstructor | |||
@AllArgsConstructor | |||
@ApiModel(value="Apply",description = "应用信息管理") | |||
@TableName(value = "ct_apply") | |||
public class Apply extends BaseEntity | |||
{ | |||
@TableField(exist = false) | |||
private static final long serialVersionUID = 1L; | |||
/** 应用所有者名称 */ | |||
@Excel(name = "应用所有者名称") | |||
@ApiModelProperty(name="ownerName",value = "应用所有者名称") | |||
private String ownerName; | |||
/** 应用所有者账号 */ | |||
@Excel(name = "应用所有者账号") | |||
@ApiModelProperty(name="ownerAccount",value = "应用所有者账号") | |||
private String ownerAccount; | |||
/** 所有者id */ | |||
@Excel(name = "所有者id") | |||
@ApiModelProperty(name="ownerId",value = "所有者id") | |||
private String ownerId; | |||
/** appid */ | |||
@Excel(name = "appid") | |||
@ApiModelProperty(name="appId",value = "appid") | |||
private String appId; | |||
/** 应用名称 */ | |||
@Excel(name = "应用名称") | |||
@ApiModelProperty(name="appName",value = "应用名称") | |||
private String appName; | |||
/** 应用类型名称 */ | |||
@Excel(name = "应用类型名称") | |||
@ApiModelProperty(name="appTypeName",value = "应用类型名称") | |||
private String appTypeName; | |||
/** 应用类型枚举(app:应用 activity:指令) */ | |||
@Excel(name = "应用类型枚举", readConverterExp = "a=pp:应用,a=ctivity:指令") | |||
@ApiModelProperty(name="appType",value = "应用类型枚举") | |||
private String appType; | |||
/** 应用创建时间 */ | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
@Excel(name = "应用创建时间", width = 30, dateFormat = "yyyy-MM-dd") | |||
@ApiModelProperty(name="appCreateTime",value = "应用创建时间") | |||
private Date appCreateTime; | |||
/** 应用修改时间 */ | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
@Excel(name = "应用修改时间", width = 30, dateFormat = "yyyy-MM-dd") | |||
@ApiModelProperty(name="appUpdateTime",value = "应用修改时间") | |||
private Date appUpdateTime; | |||
/** 版本,值内容:未发版、版本 */ | |||
@Excel(name = "版本,值内容:未发版、版本") | |||
@ApiModelProperty(name="version",value = "版本,值内容:未发版、版本") | |||
private String version; | |||
/** 是否支持应用参数 */ | |||
@Excel(name = "是否支持应用参数") | |||
@ApiModelProperty(name="supportParam",value = "是否支持应用参数") | |||
private Integer supportParam; | |||
/** icon图下载地址 */ | |||
@Excel(name = "icon图下载地址") | |||
@ApiModelProperty(name="icon",value = "icon图下载地址") | |||
private String icon; | |||
/** 预计人工耗时 */ | |||
@Excel(name = "预计人工耗时") | |||
@ApiModelProperty(name="manualTime",value = "预计人工耗时") | |||
private String manualTime; | |||
/** 所属公司 */ | |||
@Excel(name = "所属公司") | |||
@ApiModelProperty(name="deptId",value = "所属公司") | |||
private Long deptId; | |||
@Override | |||
public String toString() { | |||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | |||
.append("id", getId()) | |||
.append("ownerName", getOwnerName()) | |||
.append("ownerAccount", getOwnerAccount()) | |||
.append("ownerId", getOwnerId()) | |||
.append("appId", getAppId()) | |||
.append("appName", getAppName()) | |||
.append("appTypeName", getAppTypeName()) | |||
.append("appType", getAppType()) | |||
.append("appCreateTime", getAppCreateTime()) | |||
.append("appUpdateTime", getAppUpdateTime()) | |||
.append("version", getVersion()) | |||
.append("supportParam", getSupportParam()) | |||
.append("icon", getIcon()) | |||
.append("manualTime", getManualTime()) | |||
.append("createBy", getCreateBy()) | |||
.append("createTime", getCreateTime()) | |||
.append("updateBy", getUpdateBy()) | |||
.append("updateTime", getUpdateTime()) | |||
.append("remark", getRemark()) | |||
.append("deleted", getDeleted()) | |||
.toString(); | |||
} | |||
} |
@@ -1,64 +0,0 @@ | |||
package com.ruoyi.business.domain; | |||
import lombok.Data; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.ruoyi.common.annotation.Excel; | |||
import com.ruoyi.common.core.domain.BaseEntity; | |||
import java.util.ArrayList; | |||
/** | |||
* 调查问卷管理对象 business_survey | |||
* | |||
* @author ruoyi | |||
* @date 2024-04-01 | |||
*/ | |||
@Data | |||
public class BusinessSurvey extends BaseEntity | |||
{ | |||
private static final long serialVersionUID = 1L; | |||
/** 问卷名称 */ | |||
@Excel(name = "问卷名称") | |||
private String title; | |||
/** 问卷描述 */ | |||
@Excel(name = "问卷描述") | |||
private String context; | |||
/** 模板id */ | |||
@Excel(name = "模板id") | |||
private String tempId; | |||
/** 模板名称 */ | |||
@Excel(name = "模板名称") | |||
private String tempName; | |||
/** 是否开放 */ | |||
@Excel(name = "是否开放") | |||
private String open; | |||
@Override | |||
public String toString() { | |||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | |||
.append("id", getId()) | |||
.append("title", getTitle()) | |||
.append("context", getContext()) | |||
.append("tempId", getTempId()) | |||
.append("open", getOpen()) | |||
.append("createBy", getCreateBy()) | |||
.append("createTime", getCreateTime()) | |||
.append("updateBy", getUpdateBy()) | |||
.append("updateTime", getUpdateTime()) | |||
.append("deleted", getDeleted()) | |||
.append("remark", getRemark()) | |||
.toString(); | |||
} | |||
} |
@@ -1,73 +0,0 @@ | |||
package com.ruoyi.business.domain; | |||
import lombok.Data; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.ruoyi.common.annotation.Excel; | |||
import com.ruoyi.common.core.domain.BaseEntity; | |||
/** | |||
* 模版管理对象 business_template | |||
* | |||
* @author ruoyi | |||
* @date 2024-03-31 | |||
*/ | |||
@Data | |||
public class BusinessTemplate extends BaseEntity | |||
{ | |||
private static final long serialVersionUID = 1L; | |||
/** 标题 */ | |||
@Excel(name = "标题") | |||
private String title; | |||
/** 内容 */ | |||
@Excel(name = "内容") | |||
private String context; | |||
/** 是否开放 */ | |||
@Excel(name = "是否开放") | |||
private String open; | |||
public void setTitle(String title) | |||
{ | |||
this.title = title; | |||
} | |||
public String getTitle() | |||
{ | |||
return title; | |||
} | |||
public void setContext(String context) | |||
{ | |||
this.context = context; | |||
} | |||
public String getContext() | |||
{ | |||
return context; | |||
} | |||
public void setOpen(String open) | |||
{ | |||
this.open = open; | |||
} | |||
@Override | |||
public String toString() { | |||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | |||
.append("id", getId()) | |||
.append("title", getTitle()) | |||
.append("context", getContext()) | |||
.append("open", getOpen()) | |||
.append("createBy", getCreateBy()) | |||
.append("createTime", getCreateTime()) | |||
.append("updateBy", getUpdateBy()) | |||
.append("updateTime", getUpdateTime()) | |||
.append("remark", getRemark()) | |||
.toString(); | |||
} | |||
} |
@@ -1,182 +0,0 @@ | |||
package com.ruoyi.business.domain; | |||
import com.alibaba.fastjson2.JSON; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import lombok.Data; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.ruoyi.common.annotation.Excel; | |||
import com.ruoyi.common.core.domain.BaseEntity; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* 模版属性对象 business_template_prop | |||
* | |||
* @author ruoyi | |||
* @date 2024-03-31 | |||
*/ | |||
@Data | |||
public class BusinessTemplateProp extends BaseEntity | |||
{ | |||
private static final long serialVersionUID = 1L; | |||
/** 标题 */ | |||
@Excel(name = "标题") | |||
private String title; | |||
/** 组件类型(0单选框 1多选框) */ | |||
@Excel(name = "组件类型", readConverterExp = "0=单选框,1=多选框") | |||
private String compType; | |||
/** 字段名 */ | |||
@Excel(name = "字段名") | |||
private String fieldName; | |||
/** 占位提示 */ | |||
@Excel(name = "占位提示") | |||
private String placPrompt; | |||
/** 默认值 */ | |||
@Excel(name = "默认值") | |||
private String defaultValue; | |||
/** 可选值 */ | |||
@Excel(name = "可选值") | |||
private String optionalValue; | |||
/** 可选值数组 */ | |||
@Excel(name = "可选值数组") | |||
@TableField(exist = false) | |||
private List<Map<String,Object>> optionalValues = new ArrayList<Map<String,Object>>(); | |||
/** 是否开放 */ | |||
@Excel(name = "是否开放") | |||
private String open; | |||
/** 模版id */ | |||
@Excel(name = "模版id") | |||
private Long tempId; | |||
/** 排序 */ | |||
@Excel(name = "排序") | |||
private Integer sort; | |||
public void setTitle(String title) | |||
{ | |||
this.title = title; | |||
} | |||
public String getTitle() | |||
{ | |||
return title; | |||
} | |||
public void setCompType(String compType) | |||
{ | |||
this.compType = compType; | |||
} | |||
public String getCompType() | |||
{ | |||
return compType; | |||
} | |||
public void setFieldName(String fieldName) | |||
{ | |||
this.fieldName = fieldName; | |||
} | |||
public String getFieldName() | |||
{ | |||
return fieldName; | |||
} | |||
public void setPlacPrompt(String placPrompt) | |||
{ | |||
this.placPrompt = placPrompt; | |||
} | |||
public String getPlacPrompt() | |||
{ | |||
return placPrompt; | |||
} | |||
public void setDefaultValue(String defaultValue) | |||
{ | |||
this.defaultValue = defaultValue; | |||
} | |||
public String getDefaultValue() | |||
{ | |||
return defaultValue; | |||
} | |||
public void setOptionalValue(String optionalValue) | |||
{ | |||
if(StringUtils.isNotBlank(optionalValue)){ | |||
String[] split = optionalValue.split("\\|"); | |||
for (String s : split) { | |||
Map<String, Object> dataMap = new HashMap<>(); | |||
String[] value = s.split(","); | |||
dataMap.put("key",value[0]); | |||
dataMap.put("value",value[1]); | |||
this.optionalValues.add(dataMap); | |||
} | |||
} | |||
this.optionalValue = optionalValue; | |||
} | |||
public String getOptionalValue() | |||
{ | |||
return optionalValue; | |||
} | |||
public void setOpen(String open) | |||
{ | |||
this.open = open; | |||
} | |||
public String getOpen() | |||
{ | |||
return open; | |||
} | |||
public void setTempId(Long tempId) | |||
{ | |||
this.tempId = tempId; | |||
} | |||
public Long getTempId() | |||
{ | |||
return tempId; | |||
} | |||
@Override | |||
public String toString() { | |||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | |||
.append("id", getId()) | |||
.append("title", getTitle()) | |||
.append("compType", getCompType()) | |||
.append("fieldName", getFieldName()) | |||
.append("placPrompt", getPlacPrompt()) | |||
.append("defaultValue", getDefaultValue()) | |||
.append("optionalValue", getOptionalValue()) | |||
.append("open", getOpen()) | |||
.append("tempId", getTempId()) | |||
.append("createBy", getCreateBy()) | |||
.append("createTime", getCreateTime()) | |||
.append("updateBy", getUpdateBy()) | |||
.append("updateTime", getUpdateTime()) | |||
.append("deleted", getDeleted()) | |||
.append("remark", getRemark()) | |||
.toString(); | |||
} | |||
} |
@@ -1,111 +0,0 @@ | |||
package com.ruoyi.business.domain; | |||
import lombok.Data; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.ruoyi.common.annotation.Excel; | |||
import com.ruoyi.common.core.domain.BaseEntity; | |||
/** | |||
* 模版属性值对象 business_template_prop_value | |||
* | |||
* @author ruoyi | |||
* @date 2024-03-31 | |||
*/ | |||
@Data | |||
public class BusinessTemplatePropValue extends BaseEntity | |||
{ | |||
private static final long serialVersionUID = 1L; | |||
/** 字段id */ | |||
@Excel(name = "字段id") | |||
private String propId; | |||
/** 字段名称 */ | |||
@Excel(name = "字段名称") | |||
private String propName; | |||
/** 字段类型 */ | |||
@Excel(name = "字段类型") | |||
private String propType; | |||
/** 值键 */ | |||
@Excel(name = "值键") | |||
private String valueKey; | |||
/** 值描述 */ | |||
@Excel(name = "值描述") | |||
private String valueText; | |||
/** 原值对象 */ | |||
@Excel(name = "原值对象") | |||
private String valueSources; | |||
/** 试卷id */ | |||
@Excel(name = "试卷id") | |||
private String surveyId; | |||
public void setPropId(String propId) | |||
{ | |||
this.propId = propId; | |||
} | |||
public String getPropId() | |||
{ | |||
return propId; | |||
} | |||
public void setPropName(String propName) | |||
{ | |||
this.propName = propName; | |||
} | |||
public String getPropName() | |||
{ | |||
return propName; | |||
} | |||
public void setValueKey(String valueKey) | |||
{ | |||
this.valueKey = valueKey; | |||
} | |||
public String getValueKey() | |||
{ | |||
return valueKey; | |||
} | |||
public void setValueText(String valueText) | |||
{ | |||
this.valueText = valueText; | |||
} | |||
public String getValueText() | |||
{ | |||
return valueText; | |||
} | |||
@Override | |||
public String toString() { | |||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | |||
.append("id", getId()) | |||
.append("propId", getPropId()) | |||
.append("propName", getPropName()) | |||
.append("valueKey", getValueKey()) | |||
.append("valueText", getValueText()) | |||
.append("createBy", getCreateBy()) | |||
.append("createTime", getCreateTime()) | |||
.append("updateBy", getUpdateBy()) | |||
.append("updateTime", getUpdateTime()) | |||
.append("deleted", getDeleted()) | |||
.append("remark", getRemark()) | |||
.toString(); | |||
} | |||
} |
@@ -0,0 +1,95 @@ | |||
package com.ruoyi.business.domain; | |||
import com.baomidou.mybatisplus.annotation.*; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.ruoyi.common.annotation.Excel; | |||
import lombok.Data; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Builder; | |||
import lombok.NoArgsConstructor; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.ruoyi.common.core.domain.BaseEntity; | |||
/** | |||
* 机器人管理对象 ct_rebot | |||
* | |||
* @author LiuChengRan | |||
* @date 2024-06-14 | |||
*/ | |||
@Data | |||
@Builder(toBuilder = true) | |||
@NoArgsConstructor | |||
@AllArgsConstructor | |||
@ApiModel(value="Rebot",description = "机器人管理") | |||
@TableName(value = "ct_rebot") | |||
public class Rebot extends BaseEntity | |||
{ | |||
@TableField(exist = false) | |||
private static final long serialVersionUID = 1L; | |||
/** 机器人名称 */ | |||
@Excel(name = "机器人名称") | |||
@ApiModelProperty(name="robotClientName",value = "机器人名称") | |||
private String robotClientName; | |||
/** 机器人Uuid信息 */ | |||
@Excel(name = "机器人Uuid信息") | |||
@ApiModelProperty(name="robotClientUuid",value = "机器人Uuid信息") | |||
private String robotClientUuid; | |||
/** 运行状态(waiting:等待调度 running:任务运行中 finish:任务运行结束 stopping:任务正在停止 stopped:已结束 error:异常) */ | |||
@Excel(name = "运行状态", readConverterExp = "w=aiting:等待调度,r=unning:任务运行中,f=inish:任务运行结束,s=topping:任务正在停止,s=topped:已结束,e=rror:异常") | |||
@ApiModelProperty(name="status",value = "运行状态") | |||
private String status; | |||
/** 描述 */ | |||
@Excel(name = "描述") | |||
@ApiModelProperty(name="description",value = "描述") | |||
private String description; | |||
/** 客户端系统账号 */ | |||
@Excel(name = "客户端系统账号") | |||
@ApiModelProperty(name="windowsAccount",value = "客户端系统账号") | |||
private String windowsAccount; | |||
/** 客户端ip */ | |||
@Excel(name = "客户端ip") | |||
@ApiModelProperty(name="clientIp",value = "客户端ip") | |||
private String clientIp; | |||
/** 部门id */ | |||
@Excel(name = "部门id") | |||
@ApiModelProperty(name="deptId",value = "部门id") | |||
private Long deptId; | |||
@Override | |||
public String toString() { | |||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | |||
.append("id", getId()) | |||
.append("robotClientName", getRobotClientName()) | |||
.append("robotClientUuid", getRobotClientUuid()) | |||
.append("status", getStatus()) | |||
.append("description", getDescription()) | |||
.append("windowsAccount", getWindowsAccount()) | |||
.append("clientIp", getClientIp()) | |||
.append("deptId", getDeptId()) | |||
.append("createBy", getCreateBy()) | |||
.append("createTime", getCreateTime()) | |||
.append("updateBy", getUpdateBy()) | |||
.append("updateTime", getUpdateTime()) | |||
.append("remark", getRemark()) | |||
.append("deleted", getDeleted()) | |||
.toString(); | |||
} | |||
} |
@@ -0,0 +1,121 @@ | |||
package com.ruoyi.business.domain.bo; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.ruoyi.common.annotation.Excel; | |||
import com.ruoyi.common.core.domain.BaseEntity; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Builder; | |||
import lombok.Data; | |||
import lombok.NoArgsConstructor; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.util.Date; | |||
/** | |||
* 应用信息管理对象 ct_apply | |||
* | |||
* @author LiuChengRan | |||
* @date 2024-06-13 | |||
*/ | |||
@Data | |||
@Builder(toBuilder = true) | |||
@NoArgsConstructor | |||
@AllArgsConstructor | |||
@ApiModel(value="ListApplyVO",description = "应用信息管理") | |||
public class ListApplyBO extends BaseEntity | |||
{ | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty(name = "page", value = "第几页") | |||
private Integer page; | |||
@ApiModelProperty(name = "size", value = "页大小") | |||
private Integer size; | |||
/** 应用所有者名称 */ | |||
@Excel(name = "应用所有者名称") | |||
@ApiModelProperty(name="ownerName",value = "应用所有者名称") | |||
private String ownerName; | |||
/** 应用所有者账号 */ | |||
@Excel(name = "应用所有者账号") | |||
@ApiModelProperty(name="ownerAccount",value = "应用所有者账号") | |||
private String ownerAccount; | |||
/** 所有者id */ | |||
@Excel(name = "所有者id") | |||
@ApiModelProperty(name="ownerId",value = "所有者id") | |||
private String ownerId; | |||
/** appid */ | |||
@Excel(name = "appid") | |||
@ApiModelProperty(name="appId",value = "appid") | |||
private String appId; | |||
/** 应用名称 */ | |||
@Excel(name = "应用名称") | |||
@ApiModelProperty(name="appName",value = "应用名称") | |||
private String appName; | |||
/** 应用类型名称 */ | |||
@Excel(name = "应用类型名称") | |||
@ApiModelProperty(name="appTypeName",value = "应用类型名称") | |||
private String appTypeName; | |||
/** 应用类型枚举(app:应用 activity:指令) */ | |||
@Excel(name = "应用类型枚举", readConverterExp = "a=pp:应用,a=ctivity:指令") | |||
@ApiModelProperty(name="appType",value = "应用类型枚举") | |||
private String appType; | |||
/** 应用创建时间 */ | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
@Excel(name = "应用创建时间", width = 30, dateFormat = "yyyy-MM-dd") | |||
@ApiModelProperty(name="appCreateTime",value = "应用创建时间") | |||
private Date appCreateTime; | |||
/** 应用修改时间 */ | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
@Excel(name = "应用修改时间", width = 30, dateFormat = "yyyy-MM-dd") | |||
@ApiModelProperty(name="appUpdateTime",value = "应用修改时间") | |||
private Date appUpdateTime; | |||
/** 版本,值内容:未发版、版本 */ | |||
@Excel(name = "版本,值内容:未发版、版本") | |||
@ApiModelProperty(name="version",value = "版本,值内容:未发版、版本") | |||
private String version; | |||
/** 是否支持应用参数 */ | |||
@Excel(name = "是否支持应用参数") | |||
@ApiModelProperty(name="supportParam",value = "是否支持应用参数") | |||
private Integer supportParam; | |||
/** icon图下载地址 */ | |||
@Excel(name = "icon图下载地址") | |||
@ApiModelProperty(name="icon",value = "icon图下载地址") | |||
private String icon; | |||
/** 预计人工耗时 */ | |||
@Excel(name = "预计人工耗时") | |||
@ApiModelProperty(name="manualTime",value = "预计人工耗时") | |||
private String manualTime; | |||
/** 所属公司 */ | |||
@Excel(name = "所属公司") | |||
@ApiModelProperty(name="deptId",value = "所属公司") | |||
private Long deptId; | |||
@Override | |||
public String toString() { | |||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | |||
.append("id", getId()) | |||
.append("ownerName", getOwnerName()) | |||
.append("ownerAccount", getOwnerAccount()) | |||
.append("ownerId", getOwnerId()) | |||
.append("appId", getAppId()) | |||
.append("appName", getAppName()) | |||
.append("appTypeName", getAppTypeName()) | |||
.append("appType", getAppType()) | |||
.append("appCreateTime", getAppCreateTime()) | |||
.append("appUpdateTime", getAppUpdateTime()) | |||
.append("version", getVersion()) | |||
.append("supportParam", getSupportParam()) | |||
.append("icon", getIcon()) | |||
.append("manualTime", getManualTime()) | |||
.append("createBy", getCreateBy()) | |||
.append("createTime", getCreateTime()) | |||
.append("updateBy", getUpdateBy()) | |||
.append("updateTime", getUpdateTime()) | |||
.append("remark", getRemark()) | |||
.append("deleted", getDeleted()) | |||
.toString(); | |||
} | |||
} |
@@ -0,0 +1,47 @@ | |||
package com.ruoyi.business.domain.bo; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.ruoyi.common.annotation.Excel; | |||
import com.ruoyi.common.core.domain.BaseEntity; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Builder; | |||
import lombok.Data; | |||
import lombok.NoArgsConstructor; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.io.Serializable; | |||
/** | |||
* 机器人查询参数 | |||
* | |||
* @author LiuChengRan | |||
* @date 2024-06-13 | |||
*/ | |||
@Data | |||
@Builder(toBuilder = true) | |||
@NoArgsConstructor | |||
@AllArgsConstructor | |||
@ApiModel(value = "ListRebotBO", description = "机器人查询参数") | |||
public class ListRebotBO implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
@ApiModelProperty(name = "status", value = "机器人状态") | |||
private String status; | |||
@ApiModelProperty(name = "key", value = "关键字模糊搜索") | |||
private String key; | |||
@ApiModelProperty(name = "robotClientGroupUuid", value = "robotClientGroupUuid") | |||
private String robotClientGroupUuid; | |||
@ApiModelProperty(name = "page", value = "第几页") | |||
private Integer page; | |||
@ApiModelProperty(name = "size", value = "页大小") | |||
private Integer size; | |||
} |
@@ -0,0 +1,116 @@ | |||
package com.ruoyi.business.domain.vo; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.ruoyi.common.annotation.Excel; | |||
import com.ruoyi.common.core.domain.BaseEntity; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Builder; | |||
import lombok.Data; | |||
import lombok.NoArgsConstructor; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import java.util.Date; | |||
/** | |||
* 应用信息管理对象 ct_apply | |||
* | |||
* @author LiuChengRan | |||
* @date 2024-06-13 | |||
*/ | |||
@Data | |||
@Builder(toBuilder = true) | |||
@NoArgsConstructor | |||
@AllArgsConstructor | |||
@ApiModel(value="ListApplyVO",description = "应用信息管理") | |||
public class ListApplyVO extends BaseEntity | |||
{ | |||
private static final long serialVersionUID = 1L; | |||
/** 应用所有者名称 */ | |||
@Excel(name = "应用所有者名称") | |||
@ApiModelProperty(name="ownerName",value = "应用所有者名称") | |||
private String ownerName; | |||
/** 应用所有者账号 */ | |||
@Excel(name = "应用所有者账号") | |||
@ApiModelProperty(name="ownerAccount",value = "应用所有者账号") | |||
private String ownerAccount; | |||
/** 所有者id */ | |||
@Excel(name = "所有者id") | |||
@ApiModelProperty(name="ownerId",value = "所有者id") | |||
private String ownerId; | |||
/** appid */ | |||
@Excel(name = "appid") | |||
@ApiModelProperty(name="appId",value = "appid") | |||
private String appId; | |||
/** 应用名称 */ | |||
@Excel(name = "应用名称") | |||
@ApiModelProperty(name="appName",value = "应用名称") | |||
private String appName; | |||
/** 应用类型名称 */ | |||
@Excel(name = "应用类型名称") | |||
@ApiModelProperty(name="appTypeName",value = "应用类型名称") | |||
private String appTypeName; | |||
/** 应用类型枚举(app:应用 activity:指令) */ | |||
@Excel(name = "应用类型枚举", readConverterExp = "a=pp:应用,a=ctivity:指令") | |||
@ApiModelProperty(name="appType",value = "应用类型枚举") | |||
private String appType; | |||
/** 应用创建时间 */ | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
@Excel(name = "应用创建时间", width = 30, dateFormat = "yyyy-MM-dd") | |||
@ApiModelProperty(name="appCreateTime",value = "应用创建时间") | |||
private Date appCreateTime; | |||
/** 应用修改时间 */ | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
@Excel(name = "应用修改时间", width = 30, dateFormat = "yyyy-MM-dd") | |||
@ApiModelProperty(name="appUpdateTime",value = "应用修改时间") | |||
private Date appUpdateTime; | |||
/** 版本,值内容:未发版、版本 */ | |||
@Excel(name = "版本,值内容:未发版、版本") | |||
@ApiModelProperty(name="version",value = "版本,值内容:未发版、版本") | |||
private String version; | |||
/** 是否支持应用参数 */ | |||
@Excel(name = "是否支持应用参数") | |||
@ApiModelProperty(name="supportParam",value = "是否支持应用参数") | |||
private Integer supportParam; | |||
/** icon图下载地址 */ | |||
@Excel(name = "icon图下载地址") | |||
@ApiModelProperty(name="icon",value = "icon图下载地址") | |||
private String icon; | |||
/** 预计人工耗时 */ | |||
@Excel(name = "预计人工耗时") | |||
@ApiModelProperty(name="manualTime",value = "预计人工耗时") | |||
private String manualTime; | |||
/** 所属公司 */ | |||
@Excel(name = "所属公司") | |||
@ApiModelProperty(name="deptId",value = "所属公司") | |||
private Long deptId; | |||
@Override | |||
public String toString() { | |||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | |||
.append("id", getId()) | |||
.append("ownerName", getOwnerName()) | |||
.append("ownerAccount", getOwnerAccount()) | |||
.append("ownerId", getOwnerId()) | |||
.append("appId", getAppId()) | |||
.append("appName", getAppName()) | |||
.append("appTypeName", getAppTypeName()) | |||
.append("appType", getAppType()) | |||
.append("appCreateTime", getAppCreateTime()) | |||
.append("appUpdateTime", getAppUpdateTime()) | |||
.append("version", getVersion()) | |||
.append("supportParam", getSupportParam()) | |||
.append("icon", getIcon()) | |||
.append("manualTime", getManualTime()) | |||
.append("createBy", getCreateBy()) | |||
.append("createTime", getCreateTime()) | |||
.append("updateBy", getUpdateBy()) | |||
.append("updateTime", getUpdateTime()) | |||
.append("remark", getRemark()) | |||
.append("deleted", getDeleted()) | |||
.toString(); | |||
} | |||
} |
@@ -0,0 +1,83 @@ | |||
package com.ruoyi.business.domain.vo; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.ruoyi.common.annotation.Excel; | |||
import com.ruoyi.common.core.domain.BaseEntity; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Builder; | |||
import lombok.Data; | |||
import lombok.NoArgsConstructor; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
/** | |||
* 机器人管理对象 ct_rebot | |||
* | |||
* @author LiuChengRan | |||
* @date 2024-06-13 | |||
*/ | |||
@Data | |||
@Builder(toBuilder = true) | |||
@NoArgsConstructor | |||
@AllArgsConstructor | |||
@ApiModel(value = "ListRebotVo", description = "机器人管理") | |||
public class ListRebotVO extends BaseEntity { | |||
private static final long serialVersionUID = 1L; | |||
/** 机器人名称 */ | |||
@Excel(name = "机器人名称") | |||
@ApiModelProperty(name="robotClientName",value = "机器人名称") | |||
private String robotClientName; | |||
/** 机器人Uuid信息 */ | |||
@Excel(name = "机器人Uuid信息") | |||
@ApiModelProperty(name="robotClientUuid",value = "机器人Uuid信息") | |||
private String robotClientUuid; | |||
/** 运行状态(waiting:等待调度 running:任务运行中 finish:任务运行结束 stopping:任务正在停止 stopped:已结束 error:异常) */ | |||
@Excel(name = "运行状态", readConverterExp = "w=aiting:等待调度,r=unning:任务运行中,f=inish:任务运行结束,s=topping:任务正在停止,s=topped:已结束,e=rror:异常") | |||
@ApiModelProperty(name="status",value = "运行状态") | |||
private String status; | |||
/** 描述 */ | |||
@Excel(name = "描述") | |||
@ApiModelProperty(name="description",value = "描述") | |||
private String description; | |||
/** 客户端系统账号 */ | |||
@Excel(name = "客户端系统账号") | |||
@ApiModelProperty(name="windowsAccount",value = "客户端系统账号") | |||
private String windowsAccount; | |||
/** 客户端ip */ | |||
@Excel(name = "客户端ip") | |||
@ApiModelProperty(name="clientIp",value = "客户端ip") | |||
private String clientIp; | |||
/** 部门id */ | |||
@Excel(name = "部门id") | |||
@ApiModelProperty(name="deptId",value = "部门id") | |||
private Long deptId; | |||
@Override | |||
public String toString() { | |||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) | |||
.append("id", getId()) | |||
.append("robotClientUuid", getRobotClientUuid()) | |||
.append("status", getStatus()) | |||
.append("description", getDescription()) | |||
.append("clientIp", getClientIp()) | |||
.append("createBy", getCreateBy()) | |||
.append("createTime", getCreateTime()) | |||
.append("updateBy", getUpdateBy()) | |||
.append("updateTime", getUpdateTime()) | |||
.append("remark", getRemark()) | |||
.append("deleted", getDeleted()) | |||
.toString(); | |||
} | |||
} |
@@ -0,0 +1,24 @@ | |||
package com.ruoyi.business.mapper; | |||
import java.util.List; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.ruoyi.business.domain.Apply; | |||
/** | |||
* 应用信息管理Mapper接口 | |||
* | |||
* @author LiuChengRan | |||
* @date 2024-06-13 | |||
*/ | |||
public interface ApplyMapper extends BaseMapper<Apply> | |||
{ | |||
/** | |||
* 查询应用信息管理列表 | |||
* | |||
* @param apply 应用信息管理 | |||
* @return 应用信息管理集合 | |||
*/ | |||
List<Apply> selectApplyList(Apply apply); | |||
} |
@@ -1,16 +0,0 @@ | |||
package com.ruoyi.business.mapper; | |||
import java.util.List; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.ruoyi.business.domain.BusinessSurvey; | |||
/** | |||
* 调查问卷管理Mapper接口 | |||
* | |||
* @author ruoyi | |||
* @date 2024-04-01 | |||
*/ | |||
public interface BusinessSurveyMapper extends BaseMapper<BusinessSurvey> | |||
{ | |||
} |
@@ -1,16 +0,0 @@ | |||
package com.ruoyi.business.mapper; | |||
import java.util.List; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.ruoyi.business.domain.BusinessTemplate; | |||
/** | |||
* 模版管理Mapper接口 | |||
* | |||
* @author ruoyi | |||
* @date 2024-03-31 | |||
*/ | |||
public interface BusinessTemplateMapper extends BaseMapper<BusinessTemplate> | |||
{ | |||
} |
@@ -1,16 +0,0 @@ | |||
package com.ruoyi.business.mapper; | |||
import java.util.List; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.ruoyi.business.domain.BusinessTemplateProp; | |||
/** | |||
* 模版属性Mapper接口 | |||
* | |||
* @author ruoyi | |||
* @date 2024-03-31 | |||
*/ | |||
public interface BusinessTemplatePropMapper extends BaseMapper<BusinessTemplateProp> | |||
{ | |||
} |
@@ -1,23 +0,0 @@ | |||
package com.ruoyi.business.mapper; | |||
import java.util.List; | |||
import java.util.Map; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.ruoyi.business.domain.BusinessTemplatePropValue; | |||
import org.apache.ibatis.annotations.Param; | |||
/** | |||
* 模版属性值Mapper接口 | |||
* | |||
* @author ruoyi | |||
* @date 2024-03-31 | |||
*/ | |||
public interface BusinessTemplatePropValueMapper extends BaseMapper<BusinessTemplatePropValue> | |||
{ | |||
/** | |||
* 获取统计数据 | |||
* @param surveyId | |||
*/ | |||
List<Map<String,Object>> countGroup(@Param("surveyId") String surveyId, @Param("propId") String propId); | |||
} |
@@ -0,0 +1,25 @@ | |||
package com.ruoyi.business.mapper; | |||
import java.util.List; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.ruoyi.business.domain.Rebot; | |||
/** | |||
* 机器人管理Mapper接口 | |||
* | |||
* @author LiuChengRan | |||
* @date 2024-06-13 | |||
*/ | |||
public interface RebotMapper extends BaseMapper<Rebot> | |||
{ | |||
/** | |||
* 查询机器人管理列表 | |||
* | |||
* @param rebot 机器人管理 | |||
* @return 机器人管理集合 | |||
*/ | |||
List<Rebot> selectRebotList(Rebot rebot); | |||
} |
@@ -0,0 +1,29 @@ | |||
package com.ruoyi.business.service; | |||
import java.util.List; | |||
import com.ruoyi.business.domain.Apply; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.ruoyi.business.domain.Rebot; | |||
/** | |||
* 应用信息管理Service接口 | |||
* | |||
* @author LiuChengRan | |||
* @date 2024-06-13 | |||
*/ | |||
public interface IApplyService extends IService<Apply> | |||
{ | |||
/** | |||
* 同步机器人数据 | |||
* @return | |||
*/ | |||
void syn(Apply apply); | |||
/** | |||
* 查询应用信息管理列表 | |||
* | |||
* @param apply 应用信息管理 | |||
* @return 应用信息管理集合 | |||
*/ | |||
List<Apply> list(Apply apply); | |||
} |
@@ -1,22 +0,0 @@ | |||
package com.ruoyi.business.service; | |||
import java.util.List; | |||
import com.ruoyi.business.domain.BusinessSurvey; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
import com.ruoyi.common.core.domain.AjaxResult; | |||
/** | |||
* 调查问卷管理Service接口 | |||
* | |||
* @author ruoyi | |||
* @date 2024-04-01 | |||
*/ | |||
public interface IBusinessSurveyService extends IService<BusinessSurvey> | |||
{ | |||
/** | |||
* 根据试卷获取题目 | |||
* @param surveyId | |||
*/ | |||
AjaxResult listBySurveyId(String surveyId); | |||
} |
@@ -1,15 +0,0 @@ | |||
package com.ruoyi.business.service; | |||
import java.util.List; | |||
import com.ruoyi.business.domain.BusinessTemplateProp; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
/** | |||
* 模版属性Service接口 | |||
* | |||
* @author ruoyi | |||
* @date 2024-03-31 | |||
*/ | |||
public interface IBusinessTemplatePropService extends IService<BusinessTemplateProp> | |||
{ | |||
} |
@@ -1,28 +0,0 @@ | |||
package com.ruoyi.business.service; | |||
import java.util.List; | |||
import java.util.Map; | |||
import com.ruoyi.business.domain.BusinessTemplatePropValue; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
/** | |||
* 模版属性值Service接口 | |||
* | |||
* @author ruoyi | |||
* @date 2024-03-31 | |||
*/ | |||
public interface IBusinessTemplatePropValueService extends IService<BusinessTemplatePropValue> | |||
{ | |||
/** | |||
*获取统计数据 | |||
* @param tempId | |||
*/ | |||
Object countGroup(String tempId); | |||
/** | |||
* 批量写入值 | |||
* @param data | |||
* @return | |||
*/ | |||
boolean addList(Map<String, Object> data); | |||
} |
@@ -1,15 +0,0 @@ | |||
package com.ruoyi.business.service; | |||
import java.util.List; | |||
import com.ruoyi.business.domain.BusinessTemplate; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
/** | |||
* 模版管理Service接口 | |||
* | |||
* @author ruoyi | |||
* @date 2024-03-31 | |||
*/ | |||
public interface IBusinessTemplateService extends IService<BusinessTemplate> | |||
{ | |||
} |
@@ -0,0 +1,29 @@ | |||
package com.ruoyi.business.service; | |||
import java.util.List; | |||
import com.ruoyi.business.domain.Rebot; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
/** | |||
* 机器人管理Service接口 | |||
* | |||
* @author LiuChengRan | |||
* @date 2024-06-13 | |||
*/ | |||
public interface IRebotService extends IService<Rebot> | |||
{ | |||
/** | |||
* 同步机器人数据 | |||
* @return | |||
*/ | |||
void syn(Rebot rebot); | |||
/** | |||
* 查询机器人管理列表 | |||
* | |||
* @param rebot 机器人管理 | |||
* @return 机器人管理集合 | |||
*/ | |||
List<Rebot> list(Rebot rebot); | |||
} |
@@ -0,0 +1,89 @@ | |||
package com.ruoyi.business.service.impl; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.stream.Collectors; | |||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||
import com.ruoyi.business.domain.Rebot; | |||
import com.ruoyi.business.domain.bo.ListApplyBO; | |||
import com.ruoyi.business.domain.bo.ListRebotBO; | |||
import com.ruoyi.business.domain.vo.ListApplyVO; | |||
import com.ruoyi.business.domain.vo.ListRebotVO; | |||
import com.ruoyi.business.util.YinDaoHttpUtils; | |||
import com.ruoyi.common.annotation.DataScope; | |||
import com.ruoyi.common.utils.DateUtils; | |||
import com.ruoyi.common.utils.SecurityUtils; | |||
import com.ruoyi.common.utils.bean.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import com.ruoyi.business.mapper.ApplyMapper; | |||
import com.ruoyi.business.domain.Apply; | |||
import com.ruoyi.business.service.IApplyService; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import org.springframework.transaction.annotation.Transactional; | |||
/** | |||
* 应用信息管理Service业务层处理 | |||
* | |||
* @author LiuChengRan | |||
* @date 2024-06-13 | |||
*/ | |||
@Service | |||
public class ApplyServiceImpl extends ServiceImpl<ApplyMapper, Apply> implements IApplyService | |||
{ | |||
/** | |||
* 同步机器人数据 | |||
* | |||
* @return | |||
*/ | |||
@Override | |||
@DataScope(deptAlias = "d", userAlias = "u") | |||
@Transactional | |||
public void syn(Apply entity) { | |||
ListApplyBO listApplyBO = new ListApplyBO(); | |||
listApplyBO.setPage(1); | |||
listApplyBO.setSize(10000); | |||
List<Apply> applyList = baseMapper.selectApplyList(new Apply()); | |||
Map<String, List<Apply>> applyMap = applyList.stream().collect(Collectors.groupingBy(Apply::getAppId)); | |||
List<ListApplyVO> listApplyVOList = YinDaoHttpUtils.listApp(listApplyBO); | |||
// 获取客户端名称集合 | |||
List<String> appIdList = listApplyVOList.stream().map(ListApplyVO::getAppId).collect(Collectors.toList()); | |||
this.remove(new LambdaUpdateWrapper<Apply>().notIn(Apply::getAppId, appIdList).eq(Apply::getDeptId, SecurityUtils.getDeptId())); | |||
listApplyVOList.forEach(listRebotVO -> { | |||
// 数据库里是否存在 | |||
List<Apply> applys = applyMap.get(listRebotVO.getAppId()); | |||
if (null == applys) { | |||
Apply newApply = new Apply(); | |||
BeanUtils.copyBeanProp(newApply, listRebotVO); | |||
newApply.setAppCreateTime(listRebotVO.getAppCreateTime()); | |||
newApply.setAppUpdateTime(listRebotVO.getAppUpdateTime()); | |||
newApply.setDeptId(SecurityUtils.getDeptId()); | |||
save(newApply); | |||
} else { | |||
Apply apply = applys.get(0); | |||
Apply newApply =new Apply(); | |||
BeanUtils.copyBeanProp(newApply, listRebotVO); | |||
newApply.setAppCreateTime(listRebotVO.getAppCreateTime()); | |||
newApply.setAppUpdateTime(listRebotVO.getAppUpdateTime()); | |||
newApply.setId(apply.getId()); | |||
newApply.setDeptId(SecurityUtils.getDeptId()); | |||
updateById(newApply); | |||
} | |||
}); | |||
} | |||
/** | |||
* 查询应用信息管理列表 | |||
* | |||
* @param apply 应用信息管理 | |||
* @return 应用信息管理 | |||
*/ | |||
@Override | |||
public List<Apply> list(Apply apply) | |||
{ | |||
return baseMapper.selectApplyList(apply); | |||
} | |||
} |
@@ -1,102 +0,0 @@ | |||
package com.ruoyi.business.service.impl; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Optional; | |||
import java.util.stream.Collectors; | |||
import java.util.stream.Stream; | |||
import com.alibaba.fastjson2.JSONArray; | |||
import com.alibaba.fastjson2.JSONObject; | |||
import com.ruoyi.business.domain.BusinessTemplateProp; | |||
import com.ruoyi.business.domain.BusinessTemplatePropValue; | |||
import com.ruoyi.business.mapper.BusinessTemplatePropMapper; | |||
import com.ruoyi.business.mapper.BusinessTemplatePropValueMapper; | |||
import com.ruoyi.common.core.domain.AjaxResult; | |||
import com.ruoyi.common.utils.DateUtils; | |||
import com.ruoyi.common.utils.SecurityUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import com.ruoyi.business.mapper.BusinessSurveyMapper; | |||
import com.ruoyi.business.domain.BusinessSurvey; | |||
import com.ruoyi.business.service.IBusinessSurveyService; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
/** | |||
* 调查问卷管理Service业务层处理 | |||
* | |||
* @author ruoyi | |||
* @date 2024-04-01 | |||
*/ | |||
@Service | |||
public class BusinessSurveyServiceImpl extends ServiceImpl<BusinessSurveyMapper, BusinessSurvey> implements IBusinessSurveyService | |||
{ | |||
@Autowired | |||
private BusinessTemplatePropMapper businessTemplatePropMapper; | |||
@Autowired | |||
private BusinessTemplatePropValueMapper businessTemplatePropValueMapper; | |||
/** | |||
* 根据试卷获取题目 | |||
* @param surveyId | |||
* @return | |||
*/ | |||
@Override | |||
public AjaxResult listBySurveyId(String surveyId) { | |||
BusinessSurvey businessSurvey = baseMapper.selectOne(new LambdaQueryWrapper<BusinessSurvey>().eq(BusinessSurvey::getId, surveyId)); | |||
List<BusinessTemplateProp> list = businessTemplatePropMapper.selectList(new LambdaQueryWrapper<BusinessTemplateProp>() | |||
.eq(BusinessTemplateProp::getTempId, businessSurvey.getTempId()) | |||
.orderByDesc(BusinessTemplateProp::getSort)); | |||
JSONObject jsonObject = new JSONObject(); | |||
list.forEach(e -> { | |||
BusinessTemplatePropValue one = businessTemplatePropValueMapper.selectOne(new LambdaQueryWrapper<BusinessTemplatePropValue>() | |||
.eq(BusinessTemplatePropValue::getPropId, e.getId()) | |||
.eq(BusinessTemplatePropValue::getSurveyId, surveyId) | |||
.eq(BusinessTemplatePropValue::getCreateBy, SecurityUtils.getUsername())); | |||
if (e.getCompType().equals("0")) { | |||
jsonObject.put(e.getId(), Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources()); | |||
} | |||
if (e.getCompType().equals("1")) { | |||
String valueSources = Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources(); | |||
if(null != valueSources){ | |||
List<String> collect = Stream.of(valueSources.substring(1, valueSources.length() - 1).split(", ")).collect(Collectors.toList()); | |||
jsonObject.put(e.getId(),collect); | |||
}else{ | |||
jsonObject.put(e.getId(),new ArrayList<>()); | |||
} | |||
} | |||
if (e.getCompType().equals("2")) { | |||
jsonObject.put(e.getId(), Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources()); | |||
} | |||
if (e.getCompType().equals("3")) { | |||
jsonObject.put(e.getId(), Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources()); | |||
} | |||
if (e.getCompType().equals("4")) { | |||
jsonObject.put(e.getId(), Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources()); | |||
} | |||
if (e.getCompType().equals("5")) { | |||
jsonObject.put(e.getId(), Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources()); | |||
} | |||
if (e.getCompType().equals("6")) { | |||
jsonObject.put(e.getId(), Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources()); | |||
} | |||
if (e.getCompType().equals("7")) { | |||
jsonObject.put(e.getId(), Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources()); | |||
} | |||
if (e.getCompType().equals("8")) { | |||
jsonObject.put(e.getId(), Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources()); | |||
} | |||
if (e.getCompType().equals("9")) { | |||
jsonObject.put(e.getId(), Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources() == null ? new JSONArray() : Optional.ofNullable(one).orElse(new BusinessTemplatePropValue()).getValueSources()); | |||
} | |||
}); | |||
AjaxResult success = AjaxResult.success(list); | |||
success.put("form" , jsonObject); | |||
return success; | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
package com.ruoyi.business.service.impl; | |||
import java.util.List; | |||
import com.ruoyi.common.utils.DateUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import com.ruoyi.business.mapper.BusinessTemplatePropMapper; | |||
import com.ruoyi.business.domain.BusinessTemplateProp; | |||
import com.ruoyi.business.service.IBusinessTemplatePropService; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
/** | |||
* 模版属性Service业务层处理 | |||
* | |||
* @author ruoyi | |||
* @date 2024-03-31 | |||
*/ | |||
@Service | |||
public class BusinessTemplatePropServiceImpl extends ServiceImpl<BusinessTemplatePropMapper, BusinessTemplateProp> implements IBusinessTemplatePropService | |||
{ | |||
@Autowired | |||
private BusinessTemplatePropMapper businessTemplatePropMapper; | |||
} |
@@ -1,149 +0,0 @@ | |||
package com.ruoyi.business.service.impl; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.concurrent.atomic.AtomicReference; | |||
import com.alibaba.fastjson2.JSONArray; | |||
import com.alibaba.fastjson2.JSONObject; | |||
import com.ruoyi.business.domain.BusinessSurvey; | |||
import com.ruoyi.business.domain.BusinessTemplate; | |||
import com.ruoyi.business.domain.BusinessTemplateProp; | |||
import com.ruoyi.business.mapper.BusinessSurveyMapper; | |||
import com.ruoyi.business.mapper.BusinessTemplatePropMapper; | |||
import com.ruoyi.business.service.IBusinessSurveyService; | |||
import com.ruoyi.business.service.IBusinessTemplatePropService; | |||
import com.ruoyi.business.service.IBusinessTemplateService; | |||
import com.ruoyi.common.utils.SecurityUtils; | |||
import com.ruoyi.common.utils.StringUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import com.ruoyi.business.mapper.BusinessTemplatePropValueMapper; | |||
import com.ruoyi.business.domain.BusinessTemplatePropValue; | |||
import com.ruoyi.business.service.IBusinessTemplatePropValueService; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
/** | |||
* 模版属性值Service业务层处理 | |||
* | |||
* @author ruoyi | |||
* @date 2024-03-31 | |||
*/ | |||
@Service | |||
public class BusinessTemplatePropValueServiceImpl extends ServiceImpl<BusinessTemplatePropValueMapper, BusinessTemplatePropValue> implements IBusinessTemplatePropValueService { | |||
@Autowired | |||
private BusinessTemplatePropValueMapper businessTemplatePropValueMapper; | |||
@Autowired | |||
private IBusinessTemplateService businessTemplateService; | |||
@Autowired | |||
private IBusinessTemplatePropService businessTemplatePropService; | |||
@Autowired | |||
private IBusinessSurveyService businessSurveyService; | |||
/** | |||
* 获取统计数据 | |||
* | |||
* @param surveyId | |||
* @return | |||
*/ | |||
@Override | |||
public Object countGroup(String surveyId) { | |||
BusinessSurvey businessSurvey = businessSurveyService.lambdaQuery().eq(BusinessSurvey::getId, surveyId).one(); | |||
BusinessTemplate businessTemplate = businessTemplateService.lambdaQuery().eq(BusinessTemplate::getId, businessSurvey.getTempId()).one(); | |||
List<BusinessTemplateProp> businessTemplateProps = businessTemplatePropService.lambdaQuery() | |||
.eq(BusinessTemplateProp::getTempId, businessTemplate.getId()).in(BusinessTemplateProp::getCompType, new String[]{"0" , "1" , "6"}).list(); | |||
JSONObject map = new JSONObject(); | |||
List<Map<String, Object>> list = new ArrayList<>(); | |||
businessTemplateProps.forEach(e -> { | |||
List<Map<String, Object>> countList = businessTemplatePropValueMapper.countGroup(surveyId, e.getId()); | |||
map.put(e.getTitle(), countList); | |||
}); | |||
return map; | |||
} | |||
/** | |||
* 批量写入值 | |||
* | |||
* @param data | |||
* @return | |||
*/ | |||
@Override | |||
public boolean addList(Map<String, Object> data) { | |||
// 试卷id | |||
String surveyId = data.get("surveyId").toString(); | |||
data.remove("surveyId"); | |||
List<BusinessTemplatePropValue> datas = new ArrayList<>(); | |||
data.forEach((k, v) -> { | |||
BusinessTemplatePropValue businessTemplatePropValue = new BusinessTemplatePropValue(); | |||
BusinessTemplateProp businessTemplateProp = businessTemplatePropService.getById(k); | |||
List<BusinessTemplatePropValue> businessTemplatePropValues = businessTemplatePropValueMapper.selectList(new LambdaQueryWrapper<BusinessTemplatePropValue>() | |||
.eq(BusinessTemplatePropValue::getPropId, k).eq(BusinessTemplatePropValue::getCreateBy, SecurityUtils.getUsername())); | |||
businessTemplatePropValues.forEach(e -> { | |||
if (e.getPropId().equals(k)) { | |||
businessTemplatePropValue.setId(e.getId()); | |||
} | |||
}); | |||
businessTemplatePropValue.setPropName(businessTemplateProp.getFieldName()); | |||
businessTemplatePropValue.setPropType(businessTemplateProp.getCompType()); | |||
businessTemplatePropValue.setPropId(k); | |||
businessTemplatePropValue.setValueKey(v.toString()); | |||
if (businessTemplateProp.getCompType().equals("0")) { | |||
String optionalValue = businessTemplateProp.getOptionalValue(); | |||
String[] split = optionalValue.split("\\|"); | |||
for (String v1 : split) { | |||
String[] v2 = v1.split(","); | |||
if (v2[0].equals(v)) { | |||
businessTemplatePropValue.setValueText(v2[1]); | |||
} | |||
} | |||
businessTemplatePropValue.setValueSources(v.toString()); | |||
} else if (businessTemplateProp.getCompType().equals("1")) { | |||
String optionalValue = businessTemplateProp.getOptionalValue(); | |||
String[] split = optionalValue.split("\\|"); | |||
StringBuilder sb = new StringBuilder(); | |||
for (String v1 : split) { | |||
String[] v2 = v1.split(","); | |||
if (((ArrayList) v).contains(v2[0])) { | |||
sb.append(v2[1]).append(","); | |||
} | |||
} | |||
businessTemplatePropValue.setValueText(sb.substring(0, sb.length() - 1)); | |||
businessTemplatePropValue.setValueSources(v.toString()); | |||
} else if (businessTemplateProp.getCompType().equals("6")) { | |||
String optionalValue = businessTemplateProp.getOptionalValue(); | |||
String[] split = optionalValue.split("\\|"); | |||
StringBuilder sb = new StringBuilder(); | |||
for (String v1 : split) { | |||
String[] v2 = v1.split(","); | |||
if (v.equals(v2[0])) { | |||
sb.append(v2[1]).append(","); | |||
} | |||
} | |||
businessTemplatePropValue.setValueText(sb.substring(0, sb.length() - 1)); | |||
businessTemplatePropValue.setValueSources(v.toString()); | |||
} else { | |||
businessTemplatePropValue.setValueText(v.toString()); | |||
businessTemplatePropValue.setValueSources(v.toString()); | |||
} | |||
businessTemplatePropValue.setSurveyId(surveyId); | |||
datas.add(businessTemplatePropValue); | |||
}); | |||
return saveOrUpdateBatch(datas); | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
package com.ruoyi.business.service.impl; | |||
import java.util.List; | |||
import com.ruoyi.common.utils.DateUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import com.ruoyi.business.mapper.BusinessTemplateMapper; | |||
import com.ruoyi.business.domain.BusinessTemplate; | |||
import com.ruoyi.business.service.IBusinessTemplateService; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
/** | |||
* 模版管理Service业务层处理 | |||
* | |||
* @author ruoyi | |||
* @date 2024-03-31 | |||
*/ | |||
@Service | |||
public class BusinessTemplateServiceImpl extends ServiceImpl<BusinessTemplateMapper, BusinessTemplate> implements IBusinessTemplateService | |||
{ | |||
@Autowired | |||
private BusinessTemplateMapper businessTemplateMapper; | |||
} |
@@ -0,0 +1,84 @@ | |||
package com.ruoyi.business.service.impl; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.stream.Collectors; | |||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||
import com.ruoyi.business.domain.bo.ListRebotBO; | |||
import com.ruoyi.business.domain.vo.ListRebotVO; | |||
import com.ruoyi.business.util.YinDaoHttpUtils; | |||
import com.ruoyi.common.annotation.DataScope; | |||
import com.ruoyi.common.utils.SecurityUtils; | |||
import org.springframework.stereotype.Service; | |||
import com.ruoyi.business.mapper.RebotMapper; | |||
import com.ruoyi.business.domain.Rebot; | |||
import com.ruoyi.business.service.IRebotService; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import org.springframework.transaction.annotation.Transactional; | |||
/** | |||
* 机器人管理Service业务层处理 | |||
* | |||
* @author LiuChengRan | |||
* @date 2024-06-13 | |||
*/ | |||
@Service | |||
public class RebotServiceImpl extends ServiceImpl<RebotMapper, Rebot> implements IRebotService { | |||
/** | |||
* 同步机器人数据 | |||
* | |||
* @return | |||
*/ | |||
@Override | |||
@DataScope(deptAlias = "d", userAlias = "u") | |||
@Transactional | |||
public void syn(Rebot entity) { | |||
ListRebotBO listRebotBO = new ListRebotBO(); | |||
listRebotBO.setPage(1); | |||
listRebotBO.setSize(10000); | |||
List<Rebot> rebotsList = baseMapper.selectRebotList(new Rebot()); | |||
Map<String, List<Rebot>> rebotMap = rebotsList.stream().collect(Collectors.groupingBy(Rebot::getRobotClientName)); | |||
List<ListRebotVO> listRebotVoList = YinDaoHttpUtils.listRebot(listRebotBO); | |||
// 获取客户端名称集合 | |||
List<String> clientNameList = listRebotVoList.stream().map(ListRebotVO::getRobotClientName).collect(Collectors.toList()); | |||
this.remove(new LambdaUpdateWrapper<Rebot>().notIn(Rebot::getRobotClientName, clientNameList).eq(Rebot::getDeptId, SecurityUtils.getDeptId())); | |||
listRebotVoList.forEach(listRebotVO -> { | |||
// 数据库里是否存在 | |||
List<Rebot> rebots = rebotMap.get(listRebotVO.getRobotClientName()); | |||
if (null == rebots) { | |||
Rebot rebot = new Rebot(); | |||
rebot.setStatus(listRebotVO.getStatus()); | |||
rebot.setRobotClientUuid(listRebotVO.getRobotClientUuid()); | |||
rebot.setRobotClientName(listRebotVO.getRobotClientName()); | |||
rebot.setWindowsAccount(listRebotVO.getWindowsAccount()); | |||
rebot.setClientIp(listRebotVO.getClientIp()); | |||
rebot.setDeptId(SecurityUtils.getDeptId()); | |||
save(rebot); | |||
} else { | |||
Rebot rebot = rebots.get(0); | |||
rebot.setStatus(listRebotVO.getStatus()); | |||
rebot.setRobotClientUuid(listRebotVO.getRobotClientUuid()); | |||
rebot.setRobotClientName(listRebotVO.getRobotClientName()); | |||
rebot.setWindowsAccount(listRebotVO.getWindowsAccount()); | |||
rebot.setClientIp(listRebotVO.getClientIp()); | |||
rebot.setDeptId(SecurityUtils.getDeptId()); | |||
updateById(rebot); | |||
} | |||
}); | |||
} | |||
/** | |||
* 查询机器人管理列表 | |||
* | |||
* @param rebot 机器人管理 | |||
* @return 机器人管理 | |||
*/ | |||
@Override | |||
public List<Rebot> list(Rebot rebot) { | |||
return baseMapper.selectRebotList(rebot); | |||
} | |||
} |
@@ -0,0 +1,130 @@ | |||
package com.ruoyi.business.util; | |||
import cn.hutool.json.JSONUtil; | |||
import com.alibaba.fastjson2.JSON; | |||
import com.ruoyi.business.domain.bo.ListApplyBO; | |||
import com.ruoyi.business.domain.bo.ListRebotBO; | |||
import com.ruoyi.business.domain.vo.ListApplyVO; | |||
import com.ruoyi.business.domain.vo.ListRebotVO; | |||
import com.ruoyi.business.yddoman.BaseDTO; | |||
import com.ruoyi.business.yddoman.CreateTokenDTO; | |||
import com.ruoyi.common.exception.ServiceException; | |||
import com.ruoyi.common.utils.StringUtils; | |||
import com.ruoyi.common.utils.http.HttpClientUtil; | |||
import lombok.extern.slf4j.Slf4j; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* 影刀请求工具类 | |||
* | |||
* @author #author# | |||
*/ | |||
@Slf4j | |||
public class YinDaoHttpUtils { | |||
// 请求前缀 | |||
private static final String REQUEST_PREFIX = "https://api.winrobot360.com/oapi"; | |||
// 获取token | |||
private static final String CREATE_TOKEN = REQUEST_PREFIX + "/token/v2/token/create"; | |||
// 查询机器人列表 | |||
private static final String CLIENT_LIST = REQUEST_PREFIX + "/dispatch/v2/client/list"; | |||
// 查询应用列表 | |||
private static final String APP_LIST = REQUEST_PREFIX + "/app/open/query/list"; | |||
/** | |||
* 查询机器人列表 | |||
*/ | |||
public static List<ListApplyVO> listApp(ListApplyBO ListApplyBO) { | |||
Map<String, Object> data = new HashMap<>(); | |||
data.put("page", ListApplyBO.getPage().toString()); | |||
data.put("size", ListApplyBO.getSize().toString()); | |||
BaseDTO baseDTO = sendPost(APP_LIST, data); | |||
return JSON.parseArray(baseDTO.getData().toString(), ListApplyVO.class); | |||
} | |||
/** | |||
* 查询机器人列表 | |||
*/ | |||
public static List<ListRebotVO> listRebot(ListRebotBO listRebotBO) { | |||
Map<String, Object> data = new HashMap<>(); | |||
data.put("page", listRebotBO.getPage().toString()); | |||
data.put("size", listRebotBO.getSize().toString()); | |||
// data.put("status", listRebotBO.getStatus()); | |||
// data.put("key", listRebotBO.getKey()); | |||
// data.put("robotClientUuid", "176befff-0dc4-4df1-badf-346305c28ae8"); | |||
BaseDTO baseDTO = sendGet(CLIENT_LIST, data); | |||
return JSON.parseArray(baseDTO.getData().toString(), ListRebotVO.class); | |||
} | |||
/** | |||
* 统一get请求 | |||
* | |||
* @param map | |||
*/ | |||
private static BaseDTO sendGet(String url, Map<String, Object> map) { | |||
Map<String, Object> newMap = new HashMap<>(); | |||
// 写死 | |||
newMap.put("accessKeyId", "hVYUk1yCZ3RX6f9q@platform"); | |||
newMap.put("accessKeySecret", "CKaVmug0TcPYhf1nGUjASyveN2s6dpFR"); | |||
Map<String, Object> headMap = new HashMap<>(); | |||
headMap.put("Authorization", "Bearer " + getToken(newMap)); | |||
headMap.put("Content-Type", "application/json"); | |||
String returnStr = HttpClientUtil.postJson(url, headMap, JSONUtil.toJsonStr(map), "utf-8"); | |||
BaseDTO baseDTO = JSON.parseObject(returnStr, BaseDTO.class); | |||
if (!baseDTO.getSuccess()) { | |||
throw new ServiceException("请求影刀接口失败,状态码为" + baseDTO.getCode() + "原因是:" + baseDTO.getMsg()); | |||
} | |||
return baseDTO; | |||
} | |||
/** | |||
* 统一post请求 | |||
* | |||
* @param map | |||
*/ | |||
private static BaseDTO sendPost(String url, Map<String, Object> map) { | |||
Map<String, Object> tokenMap = new HashMap<>(); | |||
// 写死 | |||
tokenMap.put("accessKeyId", "hVYUk1yCZ3RX6f9q@platform"); | |||
tokenMap.put("accessKeySecret", "CKaVmug0TcPYhf1nGUjASyveN2s6dpFR"); | |||
Map<String, Object> headMap = new HashMap<>(); | |||
headMap.put("Accept", "application/json"); | |||
headMap.put("Content-Type", "application/json;charset=utf-8"); | |||
headMap.put("authorization", "Bearer " + getToken(tokenMap)); | |||
String returnStr = HttpClientUtil.postJson(url, headMap, JSONUtil.toJsonStr(map), "utf-8"); | |||
if (StringUtils.isEmpty(returnStr)) { | |||
throw new ServiceException("请求影刀接口失败"); | |||
} | |||
BaseDTO baseDTO = JSON.parseObject(returnStr, BaseDTO.class); | |||
if (!baseDTO.getSuccess()) { | |||
throw new ServiceException("请求影刀接口失败,状态码为" + baseDTO.getCode() + "原因是:" + baseDTO.getMsg()); | |||
} | |||
return baseDTO; | |||
} | |||
/** | |||
* 获取token | |||
* | |||
* @param map accessKeyId accessKeySecret | |||
* @return | |||
*/ | |||
private static String getToken(Map<String, Object> map) { | |||
String s = HttpClientUtil.getHttp(CREATE_TOKEN, map); | |||
BaseDTO baseDTO = JSON.parseObject(s, BaseDTO.class); | |||
if (!baseDTO.getSuccess()) { | |||
throw new ServiceException("获取影刀token失败!"); | |||
} | |||
Object data = baseDTO.getData(); | |||
CreateTokenDTO createTokenDTO = JSON.parseObject(data.toString(), CreateTokenDTO.class); | |||
return createTokenDTO.getAccessToken(); | |||
} | |||
} |
@@ -0,0 +1,19 @@ | |||
package com.ruoyi.business.yddoman; | |||
import lombok.Data; | |||
/** | |||
* 影刀统一响应父类 | |||
* | |||
* @author #author# | |||
*/ | |||
@Data | |||
public class BaseDTO | |||
{ | |||
private Integer code; | |||
private Boolean success; | |||
private String msg; | |||
private Object data; | |||
} |
@@ -0,0 +1,17 @@ | |||
package com.ruoyi.business.yddoman; | |||
import lombok.Data; | |||
/** | |||
* 创建token | |||
* | |||
* @author #author# | |||
*/ | |||
@Data | |||
public class CreateTokenDTO | |||
{ | |||
private String accessToken; | |||
private String expiresIn; | |||
} |
@@ -0,0 +1,86 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.ruoyi.business.mapper.ApplyMapper"> | |||
<!--应用信息管理对象 ct_apply--> | |||
<resultMap type="Apply" id="ApplyResult"> | |||
<!-- 主键 --> | |||
<result property="id" column="id" /> | |||
<!-- 应用所有者名称 --> | |||
<result property="ownerName" column="owner_name" /> | |||
<!-- 应用所有者账号 --> | |||
<result property="ownerAccount" column="owner_account" /> | |||
<!-- 所有者id --> | |||
<result property="ownerId" column="owner_id" /> | |||
<!-- appid --> | |||
<result property="appId" column="app_id" /> | |||
<!-- 应用名称 --> | |||
<result property="appName" column="app_name" /> | |||
<!-- 应用类型名称 --> | |||
<result property="appTypeName" column="app_type_name" /> | |||
<!-- 应用类型枚举(app:应用 activity:指令) --> | |||
<result property="appType" column="app_type" /> | |||
<!-- 应用创建时间 --> | |||
<result property="appCreateTime" column="app_create_time" /> | |||
<!-- 应用修改时间 --> | |||
<result property="appUpdateTime" column="app_update_time" /> | |||
<!-- 版本,值内容:未发版、版本 --> | |||
<result property="version" column="version" /> | |||
<!-- 是否支持应用参数 --> | |||
<result property="supportParam" column="support_param" /> | |||
<!-- icon图下载地址 --> | |||
<result property="icon" column="icon" /> | |||
<!-- 预计人工耗时 --> | |||
<result property="manualTime" column="manual_time" /> | |||
<!-- 创建者 --> | |||
<result property="createBy" column="create_by" /> | |||
<!-- 创建时间 --> | |||
<result property="createTime" column="create_time" /> | |||
<!-- 更新者 --> | |||
<result property="updateBy" column="update_by" /> | |||
<!-- 更新时间 --> | |||
<result property="updateTime" column="update_time" /> | |||
<!-- 备注 --> | |||
<result property="remark" column="remark" /> | |||
<!-- 是否删除 --> | |||
<result property="deleted" column="deleted" /> | |||
</resultMap> | |||
<sql id="selectApplyVo"> | |||
select | |||
id,<!-- 主键 --> | |||
owner_name,<!-- 应用所有者名称 --> | |||
owner_account,<!-- 应用所有者账号 --> | |||
owner_id,<!-- 所有者id --> | |||
app_id,<!-- appid --> | |||
app_name,<!-- 应用名称 --> | |||
app_type_name,<!-- 应用类型名称 --> | |||
app_type,<!-- 应用类型枚举(app:应用 activity:指令) --> | |||
app_create_time,<!-- 应用创建时间 --> | |||
app_update_time,<!-- 应用修改时间 --> | |||
version,<!-- 版本,值内容:未发版、版本 --> | |||
support_param,<!-- 是否支持应用参数 --> | |||
icon,<!-- icon图下载地址 --> | |||
manual_time,<!-- 预计人工耗时 --> | |||
create_by,<!-- 创建者 --> | |||
create_time,<!-- 创建时间 --> | |||
update_by,<!-- 更新者 --> | |||
update_time,<!-- 更新时间 --> | |||
remark,<!-- 备注 --> | |||
deleted </sql> | |||
<select id="selectApplyList" parameterType="Apply" resultMap="ApplyResult"> | |||
<include refid="selectApplyVo"/> | |||
from ct_apply | |||
<where> | |||
deleted = 0 | |||
<if test="ownerName != null and ownerName != ''"> and owner_name like concat(#{ownerName}, '%')</if> | |||
<if test="ownerAccount != null and ownerAccount != ''"> and owner_account like concat(#{ownerAccount}, '%')</if> | |||
<if test="appName != null and appName != ''"> and app_name like concat(#{appName}, '%')</if> | |||
<if test="appTypeName != null and appTypeName != ''"> and app_type_name like concat(#{appTypeName}, '%')</if> | |||
<if test="appType != null and appType != ''"> and app_type = #{appType}</if> | |||
<if test="supportParam != null "> and support_param = #{supportParam}</if> | |||
</where> | |||
</select> | |||
</mapper> |
@@ -1,95 +0,0 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.ruoyi.business.mapper.BusinessSurveyMapper"> | |||
<resultMap type="BusinessSurvey" id="BusinessSurveyResult"> | |||
<result property="id" column="id" /> | |||
<result property="title" column="title" /> | |||
<result property="context" column="context" /> | |||
<result property="tempId" column="temp_id" /> | |||
<result property="open" column="open" /> | |||
<result property="createBy" column="create_by" /> | |||
<result property="createTime" column="create_time" /> | |||
<result property="updateBy" column="update_by" /> | |||
<result property="updateTime" column="update_time" /> | |||
<result property="deleted" column="deleted" /> | |||
<result property="remark" column="remark" /> | |||
</resultMap> | |||
<sql id="selectBusinessSurveyVo"> | |||
select id, title, context, temp_id, open, create_by, create_time, update_by, update_time, deleted, remark from business_survey | |||
</sql> | |||
<select id="selectBusinessSurveyList" parameterType="BusinessSurvey" resultMap="BusinessSurveyResult"> | |||
<include refid="selectBusinessSurveyVo"/> | |||
<where> | |||
<if test="title != null and title != ''"> and title = #{title}</if> | |||
<if test="context != null and context != ''"> and context = #{context}</if> | |||
<if test="tempId != null "> and temp_id = #{tempId}</if> | |||
<if test="open != null and open != ''"> and open = #{open}</if> | |||
</where> | |||
</select> | |||
<select id="selectBusinessSurveyById" parameterType="Long" resultMap="BusinessSurveyResult"> | |||
<include refid="selectBusinessSurveyVo"/> | |||
where id = #{id} | |||
</select> | |||
<insert id="insertBusinessSurvey" parameterType="BusinessSurvey" useGeneratedKeys="true" keyProperty="id"> | |||
insert into business_survey | |||
<trim prefix="(" suffix=")" suffixOverrides=","> | |||
<if test="title != null">title,</if> | |||
<if test="context != null">context,</if> | |||
<if test="tempId != null">temp_id,</if> | |||
<if test="open != null">open,</if> | |||
<if test="createBy != null">create_by,</if> | |||
<if test="createTime != null">create_time,</if> | |||
<if test="updateBy != null">update_by,</if> | |||
<if test="updateTime != null">update_time,</if> | |||
<if test="deleted != null">deleted,</if> | |||
<if test="remark != null">remark,</if> | |||
</trim> | |||
<trim prefix="values (" suffix=")" suffixOverrides=","> | |||
<if test="title != null">#{title},</if> | |||
<if test="context != null">#{context},</if> | |||
<if test="tempId != null">#{tempId},</if> | |||
<if test="open != null">#{open},</if> | |||
<if test="createBy != null">#{createBy},</if> | |||
<if test="createTime != null">#{createTime},</if> | |||
<if test="updateBy != null">#{updateBy},</if> | |||
<if test="updateTime != null">#{updateTime},</if> | |||
<if test="deleted != null">#{deleted},</if> | |||
<if test="remark != null">#{remark},</if> | |||
</trim> | |||
</insert> | |||
<update id="updateBusinessSurvey" parameterType="BusinessSurvey"> | |||
update business_survey | |||
<trim prefix="SET" suffixOverrides=","> | |||
<if test="title != null">title = #{title},</if> | |||
<if test="context != null">context = #{context},</if> | |||
<if test="tempId != null">temp_id = #{tempId},</if> | |||
<if test="open != null">open = #{open},</if> | |||
<if test="createBy != null">create_by = #{createBy},</if> | |||
<if test="createTime != null">create_time = #{createTime},</if> | |||
<if test="updateBy != null">update_by = #{updateBy},</if> | |||
<if test="updateTime != null">update_time = #{updateTime},</if> | |||
<if test="deleted != null">deleted = #{deleted},</if> | |||
<if test="remark != null">remark = #{remark},</if> | |||
</trim> | |||
where id = #{id} | |||
</update> | |||
<delete id="deleteBusinessSurveyById" parameterType="Long"> | |||
delete from business_survey where id = #{id} | |||
</delete> | |||
<delete id="deleteBusinessSurveyByIds" parameterType="String"> | |||
delete from business_survey where id in | |||
<foreach item="id" collection="array" open="(" separator="," close=")"> | |||
#{id} | |||
</foreach> | |||
</delete> | |||
</mapper> |
@@ -1,90 +0,0 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.ruoyi.business.mapper.BusinessTemplateMapper"> | |||
<resultMap type="BusinessTemplate" id="BusinessTemplateResult"> | |||
<result property="id" column="id" /> | |||
<result property="title" column="title" /> | |||
<result property="context" column="context" /> | |||
<result property="open" column="open" /> | |||
<result property="createBy" column="create_by" /> | |||
<result property="createTime" column="create_time" /> | |||
<result property="updateBy" column="update_by" /> | |||
<result property="updateTime" column="update_time" /> | |||
<result property="deleted" column="deleted" /> | |||
<result property="remark" column="remark" /> | |||
</resultMap> | |||
<sql id="selectBusinessTemplateVo"> | |||
select id, title, context, open, create_by, create_time, update_by, update_time, deleted, remark from business_template | |||
</sql> | |||
<select id="selectBusinessTemplateList" parameterType="BusinessTemplate" resultMap="BusinessTemplateResult"> | |||
<include refid="selectBusinessTemplateVo"/> | |||
<where> | |||
<if test="title != null and title != ''"> and title = #{title}</if> | |||
<if test="context != null and context != ''"> and context = #{context}</if> | |||
<if test="open != null and open != ''"> and open = #{open}</if> | |||
</where> | |||
</select> | |||
<select id="selectBusinessTemplateById" parameterType="Long" resultMap="BusinessTemplateResult"> | |||
<include refid="selectBusinessTemplateVo"/> | |||
where id = #{id} | |||
</select> | |||
<insert id="insertBusinessTemplate" parameterType="BusinessTemplate" useGeneratedKeys="true" keyProperty="id"> | |||
insert into business_template | |||
<trim prefix="(" suffix=")" suffixOverrides=","> | |||
<if test="title != null">title,</if> | |||
<if test="context != null">context,</if> | |||
<if test="open != null">open,</if> | |||
<if test="createBy != null">create_by,</if> | |||
<if test="createTime != null">create_time,</if> | |||
<if test="updateBy != null">update_by,</if> | |||
<if test="updateTime != null">update_time,</if> | |||
<if test="deleted != null">deleted,</if> | |||
<if test="remark != null">remark,</if> | |||
</trim> | |||
<trim prefix="values (" suffix=")" suffixOverrides=","> | |||
<if test="title != null">#{title},</if> | |||
<if test="context != null">#{context},</if> | |||
<if test="open != null">#{open},</if> | |||
<if test="createBy != null">#{createBy},</if> | |||
<if test="createTime != null">#{createTime},</if> | |||
<if test="updateBy != null">#{updateBy},</if> | |||
<if test="updateTime != null">#{updateTime},</if> | |||
<if test="deleted != null">#{deleted},</if> | |||
<if test="remark != null">#{remark},</if> | |||
</trim> | |||
</insert> | |||
<update id="updateBusinessTemplate" parameterType="BusinessTemplate"> | |||
update business_template | |||
<trim prefix="SET" suffixOverrides=","> | |||
<if test="title != null">title = #{title},</if> | |||
<if test="context != null">context = #{context},</if> | |||
<if test="open != null">open = #{open},</if> | |||
<if test="createBy != null">create_by = #{createBy},</if> | |||
<if test="createTime != null">create_time = #{createTime},</if> | |||
<if test="updateBy != null">update_by = #{updateBy},</if> | |||
<if test="updateTime != null">update_time = #{updateTime},</if> | |||
<if test="deleted != null">deleted = #{deleted},</if> | |||
<if test="remark != null">remark = #{remark},</if> | |||
</trim> | |||
where id = #{id} | |||
</update> | |||
<delete id="deleteBusinessTemplateById" parameterType="Long"> | |||
delete from business_template where id = #{id} | |||
</delete> | |||
<delete id="deleteBusinessTemplateByIds" parameterType="String"> | |||
delete from business_template where id in | |||
<foreach item="id" collection="array" open="(" separator="," close=")"> | |||
#{id} | |||
</foreach> | |||
</delete> | |||
</mapper> |
@@ -1,115 +0,0 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.ruoyi.business.mapper.BusinessTemplatePropMapper"> | |||
<resultMap type="BusinessTemplateProp" id="BusinessTemplatePropResult"> | |||
<result property="id" column="id" /> | |||
<result property="title" column="title" /> | |||
<result property="compType" column="comp_type" /> | |||
<result property="fieldName" column="field_name" /> | |||
<result property="placPrompt" column="plac_prompt" /> | |||
<result property="defaultValue" column="default_value" /> | |||
<result property="optionalValue" column="optional_value" /> | |||
<result property="open" column="open" /> | |||
<result property="tempId" column="temp_id" /> | |||
<result property="createBy" column="create_by" /> | |||
<result property="createTime" column="create_time" /> | |||
<result property="updateBy" column="update_by" /> | |||
<result property="updateTime" column="update_time" /> | |||
<result property="deleted" column="deleted" /> | |||
<result property="remark" column="remark" /> | |||
</resultMap> | |||
<sql id="selectBusinessTemplatePropVo"> | |||
select id, title, comp_type, field_name, plac_prompt, default_value, optional_value, open, temp_id, create_by, create_time, update_by, update_time, deleted, remark from business_template_prop | |||
</sql> | |||
<select id="selectBusinessTemplatePropList" parameterType="BusinessTemplateProp" resultMap="BusinessTemplatePropResult"> | |||
<include refid="selectBusinessTemplatePropVo"/> | |||
<where> | |||
<if test="title != null and title != ''"> and title = #{title}</if> | |||
<if test="compType != null and compType != ''"> and comp_type = #{compType}</if> | |||
<if test="fieldName != null and fieldName != ''"> and field_name like concat('%', #{fieldName}, '%')</if> | |||
<if test="placPrompt != null and placPrompt != ''"> and plac_prompt = #{placPrompt}</if> | |||
<if test="defaultValue != null and defaultValue != ''"> and default_value = #{defaultValue}</if> | |||
<if test="optionalValue != null and optionalValue != ''"> and optional_value = #{optionalValue}</if> | |||
<if test="open != null and open != ''"> and open = #{open}</if> | |||
<if test="tempId != null "> and temp_id = #{tempId}</if> | |||
</where> | |||
</select> | |||
<select id="selectBusinessTemplatePropById" parameterType="Long" resultMap="BusinessTemplatePropResult"> | |||
<include refid="selectBusinessTemplatePropVo"/> | |||
where id = #{id} | |||
</select> | |||
<insert id="insertBusinessTemplateProp" parameterType="BusinessTemplateProp" useGeneratedKeys="true" keyProperty="id"> | |||
insert into business_template_prop | |||
<trim prefix="(" suffix=")" suffixOverrides=","> | |||
<if test="title != null and title != ''">title,</if> | |||
<if test="compType != null and compType != ''">comp_type,</if> | |||
<if test="fieldName != null and fieldName != ''">field_name,</if> | |||
<if test="placPrompt != null">plac_prompt,</if> | |||
<if test="defaultValue != null">default_value,</if> | |||
<if test="optionalValue != null">optional_value,</if> | |||
<if test="open != null">open,</if> | |||
<if test="tempId != null">temp_id,</if> | |||
<if test="createBy != null">create_by,</if> | |||
<if test="createTime != null">create_time,</if> | |||
<if test="updateBy != null">update_by,</if> | |||
<if test="updateTime != null">update_time,</if> | |||
<if test="deleted != null">deleted,</if> | |||
<if test="remark != null">remark,</if> | |||
</trim> | |||
<trim prefix="values (" suffix=")" suffixOverrides=","> | |||
<if test="title != null and title != ''">#{title},</if> | |||
<if test="compType != null and compType != ''">#{compType},</if> | |||
<if test="fieldName != null and fieldName != ''">#{fieldName},</if> | |||
<if test="placPrompt != null">#{placPrompt},</if> | |||
<if test="defaultValue != null">#{defaultValue},</if> | |||
<if test="optionalValue != null">#{optionalValue},</if> | |||
<if test="open != null">#{open},</if> | |||
<if test="tempId != null">#{tempId},</if> | |||
<if test="createBy != null">#{createBy},</if> | |||
<if test="createTime != null">#{createTime},</if> | |||
<if test="updateBy != null">#{updateBy},</if> | |||
<if test="updateTime != null">#{updateTime},</if> | |||
<if test="deleted != null">#{deleted},</if> | |||
<if test="remark != null">#{remark},</if> | |||
</trim> | |||
</insert> | |||
<update id="updateBusinessTemplateProp" parameterType="BusinessTemplateProp"> | |||
update business_template_prop | |||
<trim prefix="SET" suffixOverrides=","> | |||
<if test="title != null and title != ''">title = #{title},</if> | |||
<if test="compType != null and compType != ''">comp_type = #{compType},</if> | |||
<if test="fieldName != null and fieldName != ''">field_name = #{fieldName},</if> | |||
<if test="placPrompt != null">plac_prompt = #{placPrompt},</if> | |||
<if test="defaultValue != null">default_value = #{defaultValue},</if> | |||
<if test="optionalValue != null">optional_value = #{optionalValue},</if> | |||
<if test="open != null">open = #{open},</if> | |||
<if test="tempId != null">temp_id = #{tempId},</if> | |||
<if test="createBy != null">create_by = #{createBy},</if> | |||
<if test="createTime != null">create_time = #{createTime},</if> | |||
<if test="updateBy != null">update_by = #{updateBy},</if> | |||
<if test="updateTime != null">update_time = #{updateTime},</if> | |||
<if test="deleted != null">deleted = #{deleted},</if> | |||
<if test="remark != null">remark = #{remark},</if> | |||
</trim> | |||
where id = #{id} | |||
</update> | |||
<delete id="deleteBusinessTemplatePropById" parameterType="Long"> | |||
delete from business_template_prop where id = #{id} | |||
</delete> | |||
<delete id="deleteBusinessTemplatePropByIds" parameterType="String"> | |||
delete from business_template_prop where id in | |||
<foreach item="id" collection="array" open="(" separator="," close=")"> | |||
#{id} | |||
</foreach> | |||
</delete> | |||
</mapper> |
@@ -1,113 +0,0 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.ruoyi.business.mapper.BusinessTemplatePropValueMapper"> | |||
<resultMap type="BusinessTemplatePropValue" id="BusinessTemplatePropValueResult"> | |||
<result property="id" column="id" /> | |||
<result property="propId" column="prop_id" /> | |||
<result property="propName" column="prop_name" /> | |||
<result property="valueKey" column="value_key" /> | |||
<result property="valueText" column="value_text" /> | |||
<result property="tempId" column="temp_id" /> | |||
<result property="createBy" column="create_by" /> | |||
<result property="createTime" column="create_time" /> | |||
<result property="updateBy" column="update_by" /> | |||
<result property="updateTime" column="update_time" /> | |||
<result property="deleted" column="deleted" /> | |||
<result property="remark" column="remark" /> | |||
</resultMap> | |||
<sql id="selectBusinessTemplatePropValueVo"> | |||
select id, prop_id, prop_name, value_key, value_text, temp_id, create_by, create_time, update_by, update_time, deleted, remark from business_template_prop_value | |||
</sql> | |||
<select id="selectBusinessTemplatePropValueList" parameterType="BusinessTemplatePropValue" resultMap="BusinessTemplatePropValueResult"> | |||
<include refid="selectBusinessTemplatePropValueVo"/> | |||
<where> | |||
<if test="propId != null and propId != ''"> and prop_id = #{propId}</if> | |||
<if test="propName != null and propName != ''"> and prop_name like concat('%', #{propName}, '%')</if> | |||
<if test="valueKey != null and valueKey != ''"> and value_key = #{valueKey}</if> | |||
<if test="valueText != null and valueText != ''"> and value_text = #{valueText}</if> | |||
<if test="tempId != null "> and temp_id = #{tempId}</if> | |||
</where> | |||
</select> | |||
<select id="selectBusinessTemplatePropValueById" parameterType="Long" resultMap="BusinessTemplatePropValueResult"> | |||
<include refid="selectBusinessTemplatePropValueVo"/> | |||
where id = #{id} | |||
</select> | |||
<!--获取统计数据--> | |||
<select id="countGroup" resultType="map"> | |||
select | |||
count(1) as value, | |||
value_text as name | |||
from business_template_prop_value | |||
where survey_id = #{surveyId} | |||
and prop_type in ('0','1','6') | |||
and prop_id = #{propId} | |||
and deleted = '0' | |||
group by value_key | |||
</select> | |||
<insert id="insertBusinessTemplatePropValue" parameterType="BusinessTemplatePropValue" useGeneratedKeys="true" keyProperty="id"> | |||
insert into business_template_prop_value | |||
<trim prefix="(" suffix=")" suffixOverrides=","> | |||
<if test="propId != null">prop_id,</if> | |||
<if test="propName != null">prop_name,</if> | |||
<if test="valueKey != null">value_key,</if> | |||
<if test="valueText != null">value_text,</if> | |||
<if test="tempId != null">temp_id,</if> | |||
<if test="createBy != null">create_by,</if> | |||
<if test="createTime != null">create_time,</if> | |||
<if test="updateBy != null">update_by,</if> | |||
<if test="updateTime != null">update_time,</if> | |||
<if test="deleted != null">deleted,</if> | |||
<if test="remark != null">remark,</if> | |||
</trim> | |||
<trim prefix="values (" suffix=")" suffixOverrides=","> | |||
<if test="propId != null">#{propId},</if> | |||
<if test="propName != null">#{propName},</if> | |||
<if test="valueKey != null">#{valueKey},</if> | |||
<if test="valueText != null">#{valueText},</if> | |||
<if test="tempId != null">#{tempId},</if> | |||
<if test="createBy != null">#{createBy},</if> | |||
<if test="createTime != null">#{createTime},</if> | |||
<if test="updateBy != null">#{updateBy},</if> | |||
<if test="updateTime != null">#{updateTime},</if> | |||
<if test="deleted != null">#{deleted},</if> | |||
<if test="remark != null">#{remark},</if> | |||
</trim> | |||
</insert> | |||
<update id="updateBusinessTemplatePropValue" parameterType="BusinessTemplatePropValue"> | |||
update business_template_prop_value | |||
<trim prefix="SET" suffixOverrides=","> | |||
<if test="propId != null">prop_id = #{propId},</if> | |||
<if test="propName != null">prop_name = #{propName},</if> | |||
<if test="valueKey != null">value_key = #{valueKey},</if> | |||
<if test="valueText != null">value_text = #{valueText},</if> | |||
<if test="tempId != null">temp_id = #{tempId},</if> | |||
<if test="createBy != null">create_by = #{createBy},</if> | |||
<if test="createTime != null">create_time = #{createTime},</if> | |||
<if test="updateBy != null">update_by = #{updateBy},</if> | |||
<if test="updateTime != null">update_time = #{updateTime},</if> | |||
<if test="deleted != null">deleted = #{deleted},</if> | |||
<if test="remark != null">remark = #{remark},</if> | |||
</trim> | |||
where id = #{id} | |||
</update> | |||
<delete id="deleteBusinessTemplatePropValueById" parameterType="Long"> | |||
delete from business_template_prop_value where id = #{id} | |||
</delete> | |||
<delete id="deleteBusinessTemplatePropValueByIds" parameterType="String"> | |||
delete from business_template_prop_value where id in | |||
<foreach item="id" collection="array" open="(" separator="," close=")"> | |||
#{id} | |||
</foreach> | |||
</delete> | |||
</mapper> |
@@ -0,0 +1,75 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.ruoyi.business.mapper.RebotMapper"> | |||
<!--机器人管理对象 ct_rebot--> | |||
<resultMap type="Rebot" id="RebotResult"> | |||
<!-- 主键 --> | |||
<result property="id" column="id" /> | |||
<!-- 机器人名称 --> | |||
<result property="robotClientName" column="robot_client_name" /> | |||
<!-- 机器人Uuid信息 --> | |||
<result property="robotClientUuid" column="robot_client_uuid" /> | |||
<!-- 运行状态(waiting:等待调度 running:任务运行中 finish:任务运行结束 stopping:任务正在停止 stopped:已结束 error:异常) --> | |||
<result property="status" column="status" /> | |||
<!-- 描述 --> | |||
<result property="description" column="description" /> | |||
<!-- 客户端系统账号 --> | |||
<result property="windowsAccount" column="windows_account" /> | |||
<!-- 客户端ip --> | |||
<result property="clientIp" column="client_ip" /> | |||
<!-- 部门id --> | |||
<result property="deptId" column="dept_id" /> | |||
<!-- 创建者 --> | |||
<result property="createBy" column="create_by" /> | |||
<!-- 创建时间 --> | |||
<result property="createTime" column="create_time" /> | |||
<!-- 更新者 --> | |||
<result property="updateBy" column="update_by" /> | |||
<!-- 更新时间 --> | |||
<result property="updateTime" column="update_time" /> | |||
<!-- 备注 --> | |||
<result property="remark" column="remark" /> | |||
<!-- 是否删除 --> | |||
<result property="deleted" column="deleted" /> | |||
</resultMap> | |||
<sql id="selectRebotVo"> | |||
select | |||
rebot.id,<!-- 主键 --> | |||
rebot.robot_client_name,<!-- 机器人名称 --> | |||
rebot.robot_client_uuid,<!-- 机器人Uuid信息 --> | |||
rebot.status,<!-- 运行状态(waiting:等待调度 running:任务运行中 finish:任务运行结束 stopping:任务正在停止 stopped:已结束 error:异常) --> | |||
rebot.description,<!-- 描述 --> | |||
rebot.windows_account,<!-- 客户端系统账号 --> | |||
rebot.client_ip,<!-- 客户端ip --> | |||
rebot.dept_id,<!-- 部门id --> | |||
rebot.create_by,<!-- 创建者 --> | |||
rebot.create_time,<!-- 创建时间 --> | |||
rebot.update_by,<!-- 更新者 --> | |||
rebot.update_time,<!-- 更新时间 --> | |||
rebot.remark,<!-- 备注 --> | |||
rebot.deleted | |||
</sql> | |||
<select id="selectRebotList" parameterType="Rebot" resultMap="RebotResult"> | |||
<include refid="selectRebotVo"/> | |||
from ct_rebot rebot | |||
left JOIN sys_user u ON rebot.create_by = u.user_name | |||
left join sys_dept d on u.dept_id = d.dept_id | |||
<where> | |||
rebot.deleted = 0 | |||
<if test="robotClientName != null and robotClientName != ''"> and robot_client_name like concat(#{robotClientName}, '%')</if> | |||
<if test="robotClientUuid != null and robotClientUuid != ''"> and robot_client_uuid = #{robotClientUuid}</if> | |||
<if test="status != null and status != ''"> and status = #{status}</if> | |||
<if test="description != null and description != ''"> and description = #{description}</if> | |||
<if test="windowsAccount != null and windowsAccount != ''"> and windows_account = #{windowsAccount}</if> | |||
<if test="clientIp != null and clientIp != ''"> and client_ip = #{clientIp}</if> | |||
<if test="deptId != null "> and dept_id = #{deptId}</if> | |||
</where> | |||
<!-- 数据范围过滤 --> | |||
${params.dataScope} | |||
</select> | |||
</mapper> |
@@ -132,17 +132,38 @@ | |||
<artifactId>javax.servlet-api</artifactId> | |||
</dependency> | |||
<!--工具包--> | |||
<dependency> | |||
<groupId>cn.hutool</groupId> | |||
<artifactId>hutool-all</artifactId> | |||
<version>5.3.4</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.httpcomponents</groupId> | |||
<artifactId>httpclient</artifactId> | |||
<version>4.5.12</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.jodd</groupId> | |||
<artifactId>jodd-core</artifactId> | |||
<version>3.7.1</version> | |||
</dependency> | |||
<!-- mybatis-plus 增强CRUD --> | |||
<dependency> | |||
<groupId>com.baomidou</groupId> | |||
<artifactId>mybatis-plus-boot-starter</artifactId> | |||
<version>3.4.2</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.projectlombok</groupId> | |||
<artifactId>lombok</artifactId> | |||
<version>1.18.10</version> | |||
</dependency> | |||
</dependencies> | |||
</project> |
@@ -1,9 +1,13 @@ | |||
package com.ruoyi.common.constant; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
import java.util.stream.Stream; | |||
/** | |||
* 代码生成通用常量 | |||
* | |||
* @author #author# | |||
* @author | |||
*/ | |||
public class GenConstants | |||
{ | |||
@@ -45,15 +49,20 @@ public class GenConstants | |||
"bit", "bigint", "float", "double", "decimal" }; | |||
/** 页面不需要编辑字段 */ | |||
public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" }; | |||
public static final String[] COLUMNNAME_NOT_EDIT = { "id","uuid", "create_by", "create_time","update_by","update_time", "deleted" }; | |||
/** 页面不需要新增字段 */ | |||
public static final String[] COLUMNNAME_NOT_INSERT = { "id","uuid", "create_by", "create_time","update_by","update_time", "deleted" }; | |||
/** 页面不需要显示的列表字段 */ | |||
public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by", | |||
"update_time" }; | |||
public static final String[] COLUMNNAME_NOT_LIST = { "id","uuid", "deleted" }; | |||
/** 页面不需要查询字段 */ | |||
public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by", | |||
"update_time", "remark" }; | |||
public static final String[] COLUMNNAME_NOT_QUERY = { "id","uuid", "create_by", "create_time", "update_by", | |||
"update_time", "remark" , "deleted"}; | |||
// 排除固定字段cud默认选中状态 | |||
// private final static List<String> NOT_CRUD_COLUMN = Stream.of("id","uuid","create_by","create_time","update_by","update_time","deleted").collect(Collectors.toList()); | |||
/** Entity基类字段 */ | |||
public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" }; | |||
@@ -114,4 +123,7 @@ public class GenConstants | |||
/** 需要 */ | |||
public static final String REQUIRE = "1"; | |||
/** 不需要 */ | |||
public static final String NO_REQUIRE = "0"; | |||
} |
@@ -20,7 +20,6 @@ public class MyMetaObjectHandler implements MetaObjectHandler { | |||
@Override | |||
public void insertFill(MetaObject metaObject) { | |||
log.info("start insert fill ...."); | |||
Object createBy = metaObject.getValue("createBy"); | |||
// String uuid = UUID.randomUUID().toString(); | |||
// this.strictInsertFill(metaObject, "id", String.class, uuid); // 起始版本 3.3.0(推荐使用) | |||
@@ -38,7 +37,6 @@ public class MyMetaObjectHandler implements MetaObjectHandler { | |||
@Override | |||
public void updateFill(MetaObject metaObject) { | |||
log.info("start update fill ...."); | |||
Object updateBy = metaObject.getValue("updateBy"); | |||
if (StringUtils.isNull(updateBy) || updateBy.equals("")) { | |||
this.strictInsertFill(metaObject, "updateBy", String.class, SecurityUtils.getUsername()); | |||
@@ -0,0 +1,358 @@ | |||
package com.ruoyi.common.utils.http; | |||
import cn.hutool.core.convert.Convert; | |||
import cn.hutool.core.map.MapUtil; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import cn.hutool.core.util.StrUtil; | |||
import cn.hutool.json.JSONUtil; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.apache.http.HttpEntity; | |||
import org.apache.http.HttpResponse; | |||
import org.apache.http.NameValuePair; | |||
import org.apache.http.client.config.RequestConfig; | |||
import org.apache.http.client.entity.UrlEncodedFormEntity; | |||
import org.apache.http.client.methods.CloseableHttpResponse; | |||
import org.apache.http.client.methods.HttpGet; | |||
import org.apache.http.client.methods.HttpPost; | |||
import org.apache.http.entity.StringEntity; | |||
import org.apache.http.impl.client.CloseableHttpClient; | |||
import org.apache.http.impl.client.HttpClients; | |||
import org.apache.http.message.BasicNameValuePair; | |||
import org.apache.http.util.EntityUtils; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import java.io.IOException; | |||
import java.nio.charset.Charset; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Map.Entry; | |||
/** | |||
* @author rch | |||
* @date 2022-06-22 | |||
*/ | |||
public class HttpClientUtil { | |||
private static final Logger log = LoggerFactory.getLogger(HttpClientUtil.class); | |||
public static String postJson(String url, String body, String charset) { | |||
String result = null; | |||
if (null == charset) { | |||
charset = "UTF-8"; | |||
} | |||
CloseableHttpClient httpClient = null; | |||
HttpPost httpPost = null; | |||
try { | |||
httpClient = HttpConnectionManager.getInstance().getHttpClient(); | |||
httpPost = new HttpPost(url); | |||
// 设置连接超时,设置读取超时 | |||
RequestConfig requestConfig = RequestConfig.custom() | |||
.setConnectTimeout(3000) | |||
.setSocketTimeout(3000) | |||
.build(); | |||
httpPost.setConfig(requestConfig); | |||
httpPost.setHeader("Accept", "application/json"); | |||
httpPost.setHeader("Content-Type", "application/json;charset=utf-8"); | |||
// 设置参数 | |||
StringEntity se = new StringEntity(body, "UTF-8"); | |||
httpPost.setEntity(se); | |||
HttpResponse response = httpClient.execute(httpPost); | |||
if (response != null) { | |||
HttpEntity resEntity = response.getEntity(); | |||
if (resEntity != null) { | |||
result = EntityUtils.toString(resEntity, charset); | |||
} | |||
} | |||
} catch (Exception ex) { | |||
ex.printStackTrace(); | |||
log.error(ex.getMessage()); | |||
} | |||
return result; | |||
} | |||
public static String postJson(String url, Map<String, Object> heards, String body, String charset) { | |||
String result = null; | |||
if (null == charset) { | |||
charset = "UTF-8"; | |||
} | |||
CloseableHttpClient httpClient = null; | |||
HttpPost httpPost = null; | |||
try { | |||
httpClient = HttpConnectionManager.getInstance().getHttpClient(); | |||
httpPost = new HttpPost(url); | |||
// 设置连接超时,设置读取超时 | |||
RequestConfig requestConfig = RequestConfig.custom() | |||
.setConnectTimeout(3000) | |||
.setSocketTimeout(3000) | |||
.build(); | |||
httpPost.setConfig(requestConfig); | |||
for (Map.Entry<String, Object> heard:heards.entrySet()) { | |||
httpPost.setHeader(heard.getKey(), heard.getValue().toString()); | |||
} | |||
// 设置参数 | |||
StringEntity se = new StringEntity(body, "UTF-8"); | |||
httpPost.setEntity(se); | |||
HttpResponse response = httpClient.execute(httpPost); | |||
if (response != null) { | |||
HttpEntity resEntity = response.getEntity(); | |||
if (resEntity != null) { | |||
result = EntityUtils.toString(resEntity, charset); | |||
} | |||
} | |||
} catch (Exception ex) { | |||
ex.printStackTrace(); | |||
log.error(ex.getMessage()); | |||
} | |||
return result; | |||
} | |||
/** | |||
* 发送 POST 请求(HTTP),K-V形式 | |||
* | |||
* @param apiUrl | |||
* API接口URL | |||
* @param params | |||
* 参数map | |||
* @return | |||
*/ | |||
public static String doPostHttp(String apiUrl, Map<String, Object> params) { | |||
CloseableHttpClient httpClient = HttpClients.createDefault(); | |||
String httpStr = null; | |||
HttpPost httpPost = new HttpPost(apiUrl); | |||
CloseableHttpResponse response = null; | |||
try { | |||
// 设置连接超时,设置读取超时 | |||
RequestConfig requestConfig = RequestConfig.custom() | |||
.setConnectTimeout(10000) | |||
.setSocketTimeout(10000) | |||
.build(); | |||
httpPost.setConfig(requestConfig); | |||
httpPost.setHeader("Accept", "application/json"); | |||
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded"); | |||
List<NameValuePair> pairList = new ArrayList<>(params.size()); | |||
for (Entry<String, Object> entry : params.entrySet()) { | |||
NameValuePair pair = new BasicNameValuePair(entry.getKey(), Convert.toStr(entry.getValue())); | |||
pairList.add(pair); | |||
} | |||
httpPost.setEntity(new UrlEncodedFormEntity(pairList, Charset.forName("UTF-8"))); | |||
response = httpClient.execute(httpPost); | |||
// System.out.println("http==response.toString():" + response.toString()); | |||
HttpEntity entity = response.getEntity(); | |||
httpStr = EntityUtils.toString(entity, "UTF-8"); | |||
} catch (IOException e) { | |||
e.printStackTrace(); | |||
log.error(e.getMessage()); | |||
} finally { | |||
if (response != null) { | |||
try { | |||
EntityUtils.consume(response.getEntity()); | |||
} catch (IOException e) { | |||
e.printStackTrace(); | |||
log.error(e.getMessage()); | |||
} | |||
} | |||
} | |||
return httpStr; | |||
} | |||
/** | |||
* 发送 GET 请求(HTTP),K-V形式 | |||
* | |||
* @param apiUrl | |||
* API接口URL | |||
* @param params | |||
* 参数map | |||
* @return | |||
*/ | |||
public static String getHttp(String apiUrl,Map<String,Object> params){ | |||
CloseableHttpClient httpClient = null; | |||
CloseableHttpResponse response = null; | |||
String result = ""; | |||
try { | |||
String url = apiUrl; | |||
if(MapUtil.isNotEmpty(params)){ | |||
String paramsStr = ""; | |||
for (String key : params.keySet()) { | |||
if(ObjectUtil.isNotEmpty(params.get(key))){ | |||
if(StrUtil.isNotEmpty(paramsStr)){ | |||
paramsStr += "&" + key + "=" + params.get(key); | |||
}else{ | |||
paramsStr += key + "=" + params.get(key); | |||
} | |||
} | |||
} | |||
if(StrUtil.isNotEmpty(paramsStr)){ | |||
url += "?" + paramsStr; | |||
} | |||
} | |||
httpClient = HttpClients.createDefault(); | |||
System.out.println("url:" + url); | |||
HttpGet httpGet = new HttpGet(url); | |||
// 设置连接超时,设置读取超时 | |||
RequestConfig requestConfig = RequestConfig.custom() | |||
.setConnectTimeout(5000) | |||
.setSocketTimeout(5000) | |||
.build(); | |||
httpGet.setConfig(requestConfig); | |||
response = httpClient.execute(httpGet); | |||
HttpEntity entity = response.getEntity(); | |||
result = EntityUtils.toString(entity, "UTF-8"); | |||
} catch (IOException e) { | |||
e.printStackTrace(); | |||
log.error(e.getMessage()); | |||
} finally { | |||
if (response != null) { | |||
try { | |||
response.close(); | |||
} catch (IOException e) { | |||
e.printStackTrace(); | |||
log.error(e.getMessage()); | |||
} | |||
} | |||
if (httpClient != null) { | |||
try { | |||
httpClient.close(); | |||
} catch (IOException e) { | |||
e.printStackTrace(); | |||
log.error(e.getMessage()); | |||
} | |||
} | |||
} | |||
return result; | |||
} | |||
/** | |||
* 发送 GET 请求(HTTP) | |||
* | |||
* @param apiUrl | |||
* API接口URL | |||
* @return | |||
*/ | |||
public static String getUrlHttp(String apiUrl){ | |||
CloseableHttpClient httpClient = null; | |||
CloseableHttpResponse response = null; | |||
String result = ""; | |||
try { | |||
String url = apiUrl; | |||
httpClient = HttpClients.createDefault(); | |||
System.out.println("url:" + url); | |||
HttpGet httpGet = new HttpGet(url); | |||
// 设置连接超时,设置读取超时 | |||
RequestConfig requestConfig = RequestConfig.custom() | |||
.setConnectTimeout(5000) | |||
.setSocketTimeout(5000) | |||
.build(); | |||
httpGet.setConfig(requestConfig); | |||
response = httpClient.execute(httpGet); | |||
HttpEntity entity = response.getEntity(); | |||
result = EntityUtils.toString(entity, "UTF-8"); | |||
} catch (IOException e) { | |||
e.printStackTrace(); | |||
log.error(e.getMessage()); | |||
} finally { | |||
if (response != null) { | |||
try { | |||
response.close(); | |||
} catch (IOException e) { | |||
e.printStackTrace(); | |||
log.error(e.getMessage()); | |||
} | |||
} | |||
if (httpClient != null) { | |||
try { | |||
httpClient.close(); | |||
} catch (IOException e) { | |||
e.printStackTrace(); | |||
log.error(e.getMessage()); | |||
} | |||
} | |||
} | |||
return result; | |||
} | |||
/** | |||
* 发送 POST 请求(HTTP),K-V形式 | |||
* | |||
* @param apiUrl | |||
* API接口URL | |||
* @param params | |||
* 参数map | |||
* @return | |||
*/ | |||
public static String postHttp(String apiUrl,Map<String,Object> params){ | |||
CloseableHttpClient httpClient = null; | |||
CloseableHttpResponse response = null; | |||
String result = ""; | |||
try { | |||
String url = apiUrl; | |||
httpClient = HttpClients.createDefault(); | |||
HttpPost httpPost = new HttpPost(url); | |||
// 设置连接超时,设置读取超时 | |||
RequestConfig requestConfig = RequestConfig.custom() | |||
.setConnectTimeout(5000) | |||
.setSocketTimeout(5000) | |||
.build(); | |||
httpPost.setConfig(requestConfig); | |||
if(MapUtil.isNotEmpty(params)){ | |||
StringEntity se = new StringEntity(JSONUtil.toJsonStr(params), "UTF-8"); | |||
se.setContentType("application/json"); | |||
httpPost.setEntity(se); | |||
} | |||
response = httpClient.execute(httpPost); | |||
HttpEntity entity = response.getEntity(); | |||
result = EntityUtils.toString(entity, "UTF-8"); | |||
} catch (IOException e) { | |||
e.printStackTrace(); | |||
log.error(e.getMessage()); | |||
} finally { | |||
if (response != null) { | |||
try { | |||
EntityUtils.consume(response.getEntity()); | |||
} catch (IOException e) { | |||
e.printStackTrace(); | |||
log.error(e.getMessage()); | |||
} | |||
} | |||
if (httpClient != null) { | |||
try { | |||
httpClient.close(); | |||
} catch (IOException e) { | |||
e.printStackTrace(); | |||
log.error(e.getMessage()); | |||
} | |||
} | |||
} | |||
return result; | |||
} | |||
public static void main(String[] args) { | |||
String url = "http://kjw.utest6.com/forcol/a"; | |||
Map<String,Object> params = new HashMap<>(16); | |||
params.put("page",1); | |||
params.put("pageSize",10000); | |||
params.put("beginTime","2022-04-01 21:00:00"); | |||
String result = postHttp(url,params); | |||
System.out.println(result); | |||
} | |||
} |
@@ -0,0 +1,57 @@ | |||
package com.ruoyi.common.utils.http; | |||
import org.apache.http.config.Registry; | |||
import org.apache.http.config.RegistryBuilder; | |||
import org.apache.http.conn.socket.ConnectionSocketFactory; | |||
import org.apache.http.conn.socket.LayeredConnectionSocketFactory; | |||
import org.apache.http.conn.socket.PlainConnectionSocketFactory; | |||
import org.apache.http.conn.ssl.SSLConnectionSocketFactory; | |||
import org.apache.http.impl.client.CloseableHttpClient; | |||
import org.apache.http.impl.client.HttpClients; | |||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; | |||
import org.springframework.stereotype.Component; | |||
import javax.net.ssl.SSLContext; | |||
import java.security.NoSuchAlgorithmException; | |||
@Component | |||
public class HttpConnectionManager { | |||
private PoolingHttpClientConnectionManager cm = null; | |||
private static HttpConnectionManager connectionManager; | |||
public static HttpConnectionManager getInstance() { | |||
if (connectionManager == null) { | |||
synchronized (HttpConnectionManager.class) { | |||
if (connectionManager == null) { | |||
connectionManager = new HttpConnectionManager(); | |||
connectionManager.init(); | |||
} | |||
} | |||
} | |||
return connectionManager; | |||
} | |||
private void init() { | |||
LayeredConnectionSocketFactory sslsf = null; | |||
try { | |||
sslsf = new SSLConnectionSocketFactory(SSLContext.getDefault()); | |||
} catch (NoSuchAlgorithmException e) { | |||
e.printStackTrace(); | |||
} | |||
Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder.<ConnectionSocketFactory> create() | |||
.register("https", sslsf).register("http", new PlainConnectionSocketFactory()).build(); | |||
cm = new PoolingHttpClientConnectionManager(socketFactoryRegistry); | |||
cm.setMaxTotal(200); | |||
cm.setDefaultMaxPerRoute(20); | |||
} | |||
public CloseableHttpClient getHttpClient() { | |||
CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm).build(); | |||
return httpClient; | |||
} | |||
} |
@@ -1,6 +1,7 @@ | |||
package com.ruoyi.generator.util; | |||
import java.util.Arrays; | |||
import org.apache.commons.lang3.RegExUtils; | |||
import com.ruoyi.common.constant.GenConstants; | |||
import com.ruoyi.common.utils.StringUtils; | |||
@@ -10,21 +11,19 @@ import com.ruoyi.generator.domain.GenTableColumn; | |||
/** | |||
* 代码生成器 工具类 | |||
* | |||
* | |||
* @author zhihuiwuliu | |||
*/ | |||
public class GenUtils | |||
{ | |||
public class GenUtils { | |||
/** | |||
* 初始化表信息 | |||
*/ | |||
public static void initTable(GenTable genTable, String operName) | |||
{ | |||
public static void initTable(GenTable genTable, String operName) { | |||
genTable.setClassName(convertClassName(genTable.getTableName())); | |||
genTable.setPackageName(GenConfig.getPackageName()); | |||
genTable.setModuleName(getModuleName(GenConfig.getPackageName())); | |||
genTable.setBusinessName(getBusinessName(genTable.getTableName())); | |||
genTable.setFunctionName(replaceText(genTable.getTableComment())); | |||
genTable.setBusinessName(StringUtils.toCamelCase(genTable.getTableName())); | |||
genTable.setFunctionName(replaceText(genTable.getTableComment()).concat("管理")); | |||
genTable.setFunctionAuthor(GenConfig.getAuthor()); | |||
genTable.setCreateBy(operName); | |||
} | |||
@@ -32,8 +31,7 @@ public class GenUtils | |||
/** | |||
* 初始化列属性字段 | |||
*/ | |||
public static void initColumnField(GenTableColumn column, GenTable table) | |||
{ | |||
public static void initColumnField(GenTableColumn column, GenTable table) { | |||
String dataType = getDbType(column.getColumnType()); | |||
String columnName = column.getColumnName(); | |||
column.setTableId(table.getTableId()); | |||
@@ -44,112 +42,102 @@ public class GenUtils | |||
column.setJavaType(GenConstants.TYPE_STRING); | |||
column.setQueryType(GenConstants.QUERY_EQ); | |||
if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType)) | |||
{ | |||
if (arraysContains(GenConstants.COLUMNTYPE_STR, dataType) || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType)) { | |||
// 字符串长度超过500设置为文本域 | |||
Integer columnLength = getColumnLength(column.getColumnType()); | |||
String htmlType = columnLength >= 500 || arraysContains(GenConstants.COLUMNTYPE_TEXT, dataType) ? GenConstants.HTML_TEXTAREA : GenConstants.HTML_INPUT; | |||
column.setHtmlType(htmlType); | |||
} | |||
else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType)) | |||
{ | |||
} else if (arraysContains(GenConstants.COLUMNTYPE_TIME, dataType)) { | |||
column.setJavaType(GenConstants.TYPE_DATE); | |||
column.setHtmlType(GenConstants.HTML_DATETIME); | |||
} | |||
else if (arraysContains(GenConstants.COLUMNTYPE_NUMBER, dataType)) | |||
{ | |||
} else if (arraysContains(GenConstants.COLUMNTYPE_NUMBER, dataType)) { | |||
column.setHtmlType(GenConstants.HTML_INPUT); | |||
// 如果是浮点型 统一用BigDecimal | |||
String[] str = StringUtils.split(StringUtils.substringBetween(column.getColumnType(), "(", ")"), ","); | |||
if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0) | |||
{ | |||
if (str != null && str.length == 2 && Integer.parseInt(str[1]) > 0) { | |||
column.setJavaType(GenConstants.TYPE_BIGDECIMAL); | |||
} | |||
// 如果是整形 | |||
else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10) | |||
{ | |||
else if (str != null && str.length == 1 && Integer.parseInt(str[0]) <= 10) { | |||
column.setJavaType(GenConstants.TYPE_INTEGER); | |||
} | |||
// 长整形 | |||
else | |||
{ | |||
else { | |||
column.setJavaType(GenConstants.TYPE_LONG); | |||
} | |||
} | |||
// 插入字段(默认所有字段都需要插入) | |||
column.setIsInsert(GenConstants.REQUIRE); | |||
// 插入字段 | |||
if (!arraysContains(GenConstants.COLUMNNAME_NOT_INSERT, columnName)) { | |||
column.setIsInsert(GenConstants.REQUIRE); | |||
}else{ | |||
column.setIsInsert(GenConstants.NO_REQUIRE); | |||
} | |||
// 编辑字段 | |||
if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName) && !column.isPk()) | |||
{ | |||
if (!arraysContains(GenConstants.COLUMNNAME_NOT_EDIT, columnName)) { | |||
column.setIsEdit(GenConstants.REQUIRE); | |||
}else{ | |||
column.setIsEdit(GenConstants.NO_REQUIRE); | |||
} | |||
// 列表字段 | |||
if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName) && !column.isPk()) | |||
{ | |||
if (!arraysContains(GenConstants.COLUMNNAME_NOT_LIST, columnName)) { | |||
column.setIsList(GenConstants.REQUIRE); | |||
}else{ | |||
column.setIsList(GenConstants.NO_REQUIRE); | |||
} | |||
// 查询字段 | |||
if (!arraysContains(GenConstants.COLUMNNAME_NOT_QUERY, columnName) && !column.isPk()) | |||
{ | |||
if (!arraysContains(GenConstants.COLUMNNAME_NOT_QUERY, columnName)) { | |||
column.setIsQuery(GenConstants.REQUIRE); | |||
}else{ | |||
column.setIsQuery(GenConstants.NO_REQUIRE); | |||
} | |||
// 查询字段类型 | |||
if (StringUtils.endsWithIgnoreCase(columnName, "name")) | |||
{ | |||
if (StringUtils.endsWithIgnoreCase(columnName, "name")) { | |||
column.setQueryType(GenConstants.QUERY_LIKE); | |||
} | |||
// 状态字段设置单选框 | |||
if (StringUtils.endsWithIgnoreCase(columnName, "status")) | |||
{ | |||
if (StringUtils.endsWithIgnoreCase(columnName, "status")) { | |||
column.setHtmlType(GenConstants.HTML_RADIO); | |||
} | |||
// 类型&性别字段设置下拉框 | |||
else if (StringUtils.endsWithIgnoreCase(columnName, "type") | |||
|| StringUtils.endsWithIgnoreCase(columnName, "sex")) | |||
{ | |||
|| StringUtils.endsWithIgnoreCase(columnName, "sex")) { | |||
column.setHtmlType(GenConstants.HTML_SELECT); | |||
} | |||
// 图片字段设置图片上传控件 | |||
else if (StringUtils.endsWithIgnoreCase(columnName, "image")) | |||
{ | |||
else if (StringUtils.endsWithIgnoreCase(columnName, "image")) { | |||
column.setHtmlType(GenConstants.HTML_IMAGE_UPLOAD); | |||
} | |||
// 文件字段设置文件上传控件 | |||
else if (StringUtils.endsWithIgnoreCase(columnName, "file")) | |||
{ | |||
else if (StringUtils.endsWithIgnoreCase(columnName, "file")) { | |||
column.setHtmlType(GenConstants.HTML_FILE_UPLOAD); | |||
} | |||
// 内容字段设置富文本控件 | |||
else if (StringUtils.endsWithIgnoreCase(columnName, "content")) | |||
{ | |||
else if (StringUtils.endsWithIgnoreCase(columnName, "content")) { | |||
column.setHtmlType(GenConstants.HTML_EDITOR); | |||
} | |||
} | |||
/** | |||
* 校验数组是否包含指定值 | |||
* | |||
* @param arr 数组 | |||
* | |||
* @param arr 数组 | |||
* @param targetValue 值 | |||
* @return 是否包含 | |||
*/ | |||
public static boolean arraysContains(String[] arr, String targetValue) | |||
{ | |||
public static boolean arraysContains(String[] arr, String targetValue) { | |||
return Arrays.asList(arr).contains(targetValue); | |||
} | |||
/** | |||
* 获取模块名 | |||
* | |||
* | |||
* @param packageName 包名 | |||
* @return 模块名 | |||
*/ | |||
public static String getModuleName(String packageName) | |||
{ | |||
public static String getModuleName(String packageName) { | |||
int lastIndex = packageName.lastIndexOf("."); | |||
int nameLength = packageName.length(); | |||
return StringUtils.substring(packageName, lastIndex + 1, nameLength); | |||
@@ -157,12 +145,11 @@ public class GenUtils | |||
/** | |||
* 获取业务名 | |||
* | |||
* | |||
* @param tableName 表名 | |||
* @return 业务名 | |||
*/ | |||
public static String getBusinessName(String tableName) | |||
{ | |||
public static String getBusinessName(String tableName) { | |||
int lastIndex = tableName.lastIndexOf("_"); | |||
int nameLength = tableName.length(); | |||
return StringUtils.substring(tableName, lastIndex + 1, nameLength); | |||
@@ -170,16 +157,14 @@ public class GenUtils | |||
/** | |||
* 表名转换成Java类名 | |||
* | |||
* | |||
* @param tableName 表名称 | |||
* @return 类名 | |||
*/ | |||
public static String convertClassName(String tableName) | |||
{ | |||
public static String convertClassName(String tableName) { | |||
boolean autoRemovePre = GenConfig.getAutoRemovePre(); | |||
String tablePrefix = GenConfig.getTablePrefix(); | |||
if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) | |||
{ | |||
if (autoRemovePre && StringUtils.isNotEmpty(tablePrefix)) { | |||
String[] searchList = StringUtils.split(tablePrefix, ","); | |||
tableName = replaceFirst(tableName, searchList); | |||
} | |||
@@ -188,18 +173,15 @@ public class GenUtils | |||
/** | |||
* 批量替换前缀 | |||
* | |||
* | |||
* @param replacementm 替换值 | |||
* @param searchList 替换列表 | |||
* @param searchList 替换列表 | |||
* @return | |||
*/ | |||
public static String replaceFirst(String replacementm, String[] searchList) | |||
{ | |||
public static String replaceFirst(String replacementm, String[] searchList) { | |||
String text = replacementm; | |||
for (String searchString : searchList) | |||
{ | |||
if (replacementm.startsWith(searchString)) | |||
{ | |||
for (String searchString : searchList) { | |||
if (replacementm.startsWith(searchString)) { | |||
text = replacementm.replaceFirst(searchString, ""); | |||
break; | |||
} | |||
@@ -209,48 +191,39 @@ public class GenUtils | |||
/** | |||
* 关键字替换 | |||
* | |||
* | |||
* @param text 需要被替换的名字 | |||
* @return 替换后的名字 | |||
*/ | |||
public static String replaceText(String text) | |||
{ | |||
public static String replaceText(String text) { | |||
return RegExUtils.replaceAll(text, "(?:表|智慧物流数据中心)", ""); | |||
} | |||
/** | |||
* 获取数据库类型字段 | |||
* | |||
* | |||
* @param columnType 列类型 | |||
* @return 截取后的列类型 | |||
*/ | |||
public static String getDbType(String columnType) | |||
{ | |||
if (StringUtils.indexOf(columnType, "(") > 0) | |||
{ | |||
public static String getDbType(String columnType) { | |||
if (StringUtils.indexOf(columnType, "(") > 0) { | |||
return StringUtils.substringBefore(columnType, "("); | |||
} | |||
else | |||
{ | |||
} else { | |||
return columnType; | |||
} | |||
} | |||
/** | |||
* 获取字段长度 | |||
* | |||
* | |||
* @param columnType 列类型 | |||
* @return 截取后的列类型 | |||
*/ | |||
public static Integer getColumnLength(String columnType) | |||
{ | |||
if (StringUtils.indexOf(columnType, "(") > 0) | |||
{ | |||
public static Integer getColumnLength(String columnType) { | |||
if (StringUtils.indexOf(columnType, "(") > 0) { | |||
String length = StringUtils.substringBetween(columnType, "(", ")"); | |||
return Integer.valueOf(length); | |||
} | |||
else | |||
{ | |||
} else { | |||
return 0; | |||
} | |||
} | |||
@@ -1,10 +1,10 @@ | |||
# 代码生成 | |||
gen: | |||
gen: | |||
# 作者 | |||
author: ruoyi | |||
author: LiuChengRan | |||
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool | |||
packageName: com.ruoyi.business | |||
# 自动去除表前缀,默认是false | |||
autoRemovePre: false | |||
autoRemovePre: true | |||
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔) | |||
tablePrefix: sys_ | |||
tablePrefix: sys_,ct_ |
@@ -3,7 +3,7 @@ | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.ruoyi.generator.mapper.GenTableColumnMapper"> | |||
<resultMap type="GenTableColumn" id="GenTableColumnResult"> | |||
<id property="columnId" column="column_id" /> | |||
<result property="tableId" column="table_id" /> | |||
@@ -28,23 +28,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
<result property="updateBy" column="update_by" /> | |||
<result property="updateTime" column="update_time" /> | |||
</resultMap> | |||
<sql id="selectGenTableColumnVo"> | |||
select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column | |||
</sql> | |||
<select id="selectGenTableColumnListByTableId" parameterType="Long" resultMap="GenTableColumnResult"> | |||
<include refid="selectGenTableColumnVo"/> | |||
where table_id = #{tableId} | |||
order by sort | |||
</select> | |||
<select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult"> | |||
select column_name, (case when (is_nullable = 'no' <![CDATA[ && ]]> column_key != 'PRI') then '1' else null end) as is_required, (case when column_key = 'PRI' then '1' else '0' end) as is_pk, ordinal_position as sort, column_comment, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type | |||
from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName}) | |||
order by ordinal_position | |||
</select> | |||
<insert id="insertGenTableColumn" parameterType="GenTableColumn" useGeneratedKeys="true" keyProperty="columnId"> | |||
insert into gen_table_column ( | |||
<if test="tableId != null and tableId != ''">table_id,</if> | |||
@@ -88,7 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
sysdate() | |||
) | |||
</insert> | |||
<update id="updateGenTableColumn" parameterType="GenTableColumn"> | |||
update gen_table_column | |||
<set> | |||
@@ -111,14 +111,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
</update> | |||
<delete id="deleteGenTableColumnByIds" parameterType="Long"> | |||
delete from gen_table_column where table_id in | |||
delete from gen_table_column where table_id in | |||
<foreach collection="array" item="tableId" open="(" separator="," close=")"> | |||
#{tableId} | |||
</foreach> | |||
</delete> | |||
<delete id="deleteGenTableColumns"> | |||
delete from gen_table_column where column_id in | |||
delete from gen_table_column where column_id in | |||
<foreach collection="list" item="item" open="(" separator="," close=")"> | |||
#{item.columnId} | |||
</foreach> | |||
@@ -73,6 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
AND date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') | |||
</if> | |||
</where> | |||
order by create_time desc | |||
</select> | |||
<select id="selectDbTableList" parameterType="GenTable" resultMap="GenTableResult"> | |||
@@ -2,6 +2,11 @@ package ${packageName}.controller; | |||
import java.util.List; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.util.Arrays; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiImplicitParam; | |||
import io.swagger.annotations.ApiImplicitParams; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.springframework.security.access.prepost.PreAuthorize; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
@@ -19,7 +24,6 @@ import com.ruoyi.common.enums.BusinessType; | |||
import ${packageName}.domain.${ClassName}; | |||
import ${packageName}.service.I${ClassName}Service; | |||
import com.ruoyi.common.utils.poi.ExcelUtil; | |||
import java.util.Arrays; | |||
#if($table.crud || $table.sub) | |||
import com.ruoyi.common.core.page.TableDataInfo; | |||
#elseif($table.tree) | |||
@@ -27,10 +31,11 @@ import com.ruoyi.common.core.page.TableDataInfo; | |||
/** | |||
* ${functionName}Controller | |||
* | |||
* | |||
* @author ${author} | |||
* @date ${datetime} | |||
*/ | |||
@Api(tags = "${functionName}接口") | |||
@RestController | |||
@RequestMapping("/${moduleName}/${businessName}") | |||
public class ${ClassName}Controller extends BaseController | |||
@@ -41,19 +46,20 @@ public class ${ClassName}Controller extends BaseController | |||
/** | |||
* 查询${functionName}列表 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')") | |||
## @PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')") | |||
@ApiOperation(value="查询${functionName}列表", httpMethod = "GET", response = ${ClassName}.class) | |||
@GetMapping("/list") | |||
#if($table.crud || $table.sub) | |||
public TableDataInfo list(${ClassName} ${className}) | |||
{ | |||
startPage(); | |||
List<${ClassName}> list = ${className}Service.list(); | |||
List<${ClassName}> list = ${className}Service.list(${className}); | |||
return getDataTable(list); | |||
} | |||
#elseif($table.tree) | |||
public AjaxResult list(${ClassName} ${className}) | |||
{ | |||
List<${ClassName}> list = ${className}Service.list(); | |||
List<${ClassName}> list = ${className}Service.list(${className}); | |||
return success(list); | |||
} | |||
#end | |||
@@ -61,12 +67,13 @@ public class ${ClassName}Controller extends BaseController | |||
/** | |||
* 导出${functionName}列表 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')") | |||
## @PreAuthorize("@ss.hasPermi('${permissionPrefix}:export')") | |||
@ApiOperation(value="导出${functionName}列表", httpMethod = "POST") | |||
@Log(title = "${functionName}", businessType = BusinessType.EXPORT) | |||
@PostMapping("/export") | |||
public void export(HttpServletResponse response, ${ClassName} ${className}) | |||
{ | |||
List<${ClassName}> list = ${className}Service.list(); | |||
List<${ClassName}> list = ${className}Service.list(${className}); | |||
ExcelUtil<${ClassName}> util = new ExcelUtil<${ClassName}>(${ClassName}.class); | |||
util.exportExcel(response, list, "${functionName}数据"); | |||
} | |||
@@ -74,7 +81,8 @@ public class ${ClassName}Controller extends BaseController | |||
/** | |||
* 获取${functionName}详细信息 | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')") | |||
## @PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')") | |||
@ApiOperation(value="获取${functionName}详细信息", httpMethod = "GET", response = ${ClassName}.class) | |||
@GetMapping(value = "/{${pkColumn.javaField}}") | |||
public AjaxResult getInfo(@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) | |||
{ | |||
@@ -84,7 +92,8 @@ public class ${ClassName}Controller extends BaseController | |||
/** | |||
* 新增${functionName} | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')") | |||
## @PreAuthorize("@ss.hasPermi('${permissionPrefix}:add')") | |||
@ApiOperation(value="新增${functionName}", httpMethod = "POST") | |||
@Log(title = "${functionName}", businessType = BusinessType.INSERT) | |||
@PostMapping | |||
public AjaxResult add(@RequestBody ${ClassName} ${className}) | |||
@@ -95,7 +104,8 @@ public class ${ClassName}Controller extends BaseController | |||
/** | |||
* 修改${functionName} | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')") | |||
## @PreAuthorize("@ss.hasPermi('${permissionPrefix}:edit')") | |||
@ApiOperation(value="修改${functionName}", httpMethod = "PUT") | |||
@Log(title = "${functionName}", businessType = BusinessType.UPDATE) | |||
@PutMapping | |||
public AjaxResult edit(@RequestBody ${ClassName} ${className}) | |||
@@ -106,7 +116,8 @@ public class ${ClassName}Controller extends BaseController | |||
/** | |||
* 删除${functionName} | |||
*/ | |||
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')") | |||
## @PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')") | |||
@ApiOperation(value="删除${functionName}", httpMethod = "DELETE") | |||
@Log(title = "${functionName}", businessType = BusinessType.DELETE) | |||
@DeleteMapping("/{${pkColumn.javaField}s}") | |||
public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) | |||
@@ -3,20 +3,31 @@ package ${packageName}.domain; | |||
#foreach ($import in $importList) | |||
import ${import}; | |||
#end | |||
import lombok.Data; | |||
import com.baomidou.mybatisplus.annotation.*; | |||
import org.apache.commons.lang3.builder.ToStringBuilder; | |||
import org.apache.commons.lang3.builder.ToStringStyle; | |||
import com.ruoyi.common.annotation.Excel; | |||
import java.util.ArrayList; | |||
import lombok.Data; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Builder; | |||
import lombok.NoArgsConstructor; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
#if($table.crud || $table.sub) | |||
import com.ruoyi.common.core.domain.BaseEntity; | |||
#elseif($table.tree) | |||
import com.ruoyi.common.core.domain.TreeEntity; | |||
#end | |||
/** | |||
* ${functionName}对象 ${tableName} | |||
* | |||
* | |||
* @author ${author} | |||
* @date ${datetime} | |||
*/ | |||
@@ -26,14 +37,19 @@ import com.ruoyi.common.core.domain.TreeEntity; | |||
#set($Entity="TreeEntity") | |||
#end | |||
@Data | |||
public class ${ClassName} extends ${Entity} | |||
@Builder(toBuilder = true) | |||
@NoArgsConstructor | |||
@AllArgsConstructor | |||
@ApiModel(value="${ClassName}",description = "${functionName}") | |||
@TableName(value = "${tableName}") | |||
public class ${ClassName} extends BaseEntity | |||
{ | |||
@TableField(exist = false) | |||
private static final long serialVersionUID = 1L; | |||
#foreach ($column in $columns) | |||
#if(!$table.isSuperColumn($column.javaField)) | |||
/** $column.columnComment */ | |||
#if($column.list) | |||
#set($parentheseIndex=$column.columnComment.indexOf("(")) | |||
#if($parentheseIndex != -1) | |||
@@ -41,31 +57,48 @@ public class ${ClassName} extends ${Entity} | |||
#else | |||
#set($comment=$column.columnComment) | |||
#end | |||
#if($parentheseIndex != -1) | |||
#if($column.javaField == 'id' || $column.javaField == 'deleted') | |||
#elseif($parentheseIndex != -1) | |||
/** $column.columnComment */ | |||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") | |||
#elseif($column.javaType == 'Date') | |||
/** $column.columnComment */ | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") | |||
#else | |||
/** $column.columnComment */ | |||
@Excel(name = "${comment}") | |||
#end | |||
#end | |||
#if($column.isPk == 1) | |||
## @TableId(type = IdType.AUTO) | |||
## @ApiModelProperty(name="$column.javaField",value = "${comment}") | |||
## private $column.javaType $column.javaField; | |||
#elseif($column.javaField == 'uuid' || $column.javaField == 'deleted') | |||
## @ApiModelProperty(name="$column.javaField",value = "${comment}") | |||
## @TableField(fill = FieldFill.INSERT) | |||
## private $column.javaType $column.javaField; | |||
#else | |||
@ApiModelProperty(name="$column.javaField",value = "${comment}") | |||
private $column.javaType $column.javaField; | |||
#end | |||
#end | |||
#end | |||
#if($table.sub) | |||
/** $table.subTable.functionName信息 */ | |||
private List<${subClassName}> ${subclassName}List = new ArrayList<${subClassName}>(); | |||
private List<${subClassName}> ${subclassName}List; | |||
#end | |||
###foreach ($column in $columns) | |||
###if(!$table.isSuperColumn($column.javaField)) | |||
###if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) | |||
###set($AttrName=$column.javaField) | |||
###else | |||
###set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) | |||
###end | |||
#foreach ($column in $columns) | |||
#if(!$table.isSuperColumn($column.javaField)) | |||
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) | |||
#set($AttrName=$column.javaField) | |||
#else | |||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) | |||
#end | |||
## public void set${AttrName}($column.javaType $column.javaField) | |||
## { | |||
## this.$column.javaField = $column.javaField; | |||
@@ -75,8 +108,8 @@ public class ${ClassName} extends ${Entity} | |||
## { | |||
## return $column.javaField; | |||
## } | |||
###end | |||
###end | |||
#end | |||
#end | |||
###if($table.sub) | |||
## public List<${subClassName}> get${subClassName}List() | |||
@@ -90,20 +123,20 @@ public class ${ClassName} extends ${Entity} | |||
## } | |||
## | |||
###end | |||
## @Override | |||
## public String toString() { | |||
## return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | |||
###foreach ($column in $columns) | |||
###if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) | |||
###set($AttrName=$column.javaField) | |||
###else | |||
###set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) | |||
###end | |||
## .append("${column.javaField}", get${AttrName}()) | |||
###end | |||
###if($table.sub) | |||
## .append("${subclassName}List", get${subClassName}List()) | |||
###end | |||
## .toString(); | |||
## } | |||
@Override | |||
public String toString() { | |||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | |||
#foreach ($column in $columns) | |||
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) | |||
#set($AttrName=$column.javaField) | |||
#else | |||
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) | |||
#end | |||
.append("${column.javaField}", get${AttrName}()) | |||
#end | |||
#if($table.sub) | |||
.append("${subclassName}List", get${subClassName}List()) | |||
#end | |||
.toString(); | |||
} | |||
} |
@@ -13,7 +13,80 @@ import ${packageName}.domain.${subClassName}; | |||
* @author ${author} | |||
* @date ${datetime} | |||
*/ | |||
public interface ${ClassName}Mapper extends BaseMapper<${ClassName}> | |||
public interface ${ClassName}Mapper extends BaseMapper<${ClassName}> | |||
{ | |||
## /** | |||
## * 查询${functionName} | |||
## * | |||
## * @param ${pkColumn.javaField} ${functionName}主键 | |||
## * @return ${functionName} | |||
## */ | |||
## public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); | |||
/** | |||
* 查询${functionName}列表 | |||
* | |||
* @param ${className} ${functionName} | |||
* @return ${functionName}集合 | |||
*/ | |||
List<${ClassName}> select${ClassName}List(${ClassName} ${className}); | |||
## /** | |||
## * 新增${functionName} | |||
## * | |||
## * @param ${className} ${functionName} | |||
## * @return 结果 | |||
## */ | |||
## public int insert${ClassName}(${ClassName} ${className}); | |||
## | |||
## /** | |||
## * 修改${functionName} | |||
## * | |||
## * @param ${className} ${functionName} | |||
## * @return 结果 | |||
## */ | |||
## public int update${ClassName}(${ClassName} ${className}); | |||
## | |||
## /** | |||
## * 删除${functionName} | |||
## * | |||
## * @param ${pkColumn.javaField} ${functionName}主键 | |||
## * @return 结果 | |||
## */ | |||
## public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); | |||
## | |||
## /** | |||
## * 批量删除${functionName} | |||
## * | |||
## * @param ${pkColumn.javaField}s 需要删除的数据主键集合 | |||
## * @return 结果 | |||
## */ | |||
## public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); | |||
###if($table.sub) | |||
## | |||
## /** | |||
## * 批量删除${subTable.functionName} | |||
## * | |||
## * @param ${pkColumn.javaField}s 需要删除的数据主键集合 | |||
## * @return 结果 | |||
## */ | |||
## public int delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); | |||
## | |||
## /** | |||
## * 批量新增${subTable.functionName} | |||
## * | |||
## * @param ${subclassName}List ${subTable.functionName}列表 | |||
## * @return 结果 | |||
## */ | |||
## public int batch${subClassName}(List<${subClassName}> ${subclassName}List); | |||
## | |||
## | |||
## /** | |||
## * 通过${functionName}主键删除${subTable.functionName}信息 | |||
## * | |||
## * @param ${pkColumn.javaField} ${functionName}ID | |||
## * @return 结果 | |||
## */ | |||
## public int delete${subClassName}By${subTableFkClassName}(${pkColumn.javaType} ${pkColumn.javaField}); | |||
###end | |||
} |
@@ -3,6 +3,7 @@ package ${packageName}.service; | |||
import java.util.List; | |||
import ${packageName}.domain.${ClassName}; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
/** | |||
* ${functionName}Service接口 | |||
* | |||
@@ -11,5 +12,51 @@ import com.baomidou.mybatisplus.extension.service.IService; | |||
*/ | |||
public interface I${ClassName}Service extends IService<${ClassName}> | |||
{ | |||
## /** | |||
## * 查询${functionName} | |||
## * | |||
## * @param ${pkColumn.javaField} ${functionName}主键 | |||
## * @return ${functionName} | |||
## */ | |||
## public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); | |||
/** | |||
* 查询${functionName}列表 | |||
* | |||
* @param ${className} ${functionName} | |||
* @return ${functionName}集合 | |||
*/ | |||
List<${ClassName}> list(${ClassName} ${className}); | |||
## /** | |||
## * 新增${functionName} | |||
## * | |||
## * @param ${className} ${functionName} | |||
## * @return 结果 | |||
## */ | |||
## public int insert${ClassName}(${ClassName} ${className}); | |||
## | |||
## /** | |||
## * 修改${functionName} | |||
## * | |||
## * @param ${className} ${functionName} | |||
## * @return 结果 | |||
## */ | |||
## public int update${ClassName}(${ClassName} ${className}); | |||
## | |||
## /** | |||
## * 批量删除${functionName} | |||
## * | |||
## * @param ${pkColumn.javaField}s 需要删除的${functionName}主键集合 | |||
## * @return 结果 | |||
## */ | |||
## public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s); | |||
## | |||
## /** | |||
## * 删除${functionName}信息 | |||
## * | |||
## * @param ${pkColumn.javaField} ${functionName}主键 | |||
## * @return 结果 | |||
## */ | |||
## public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}); | |||
} |
@@ -18,8 +18,6 @@ import ${packageName}.domain.${subClassName}; | |||
import ${packageName}.mapper.${ClassName}Mapper; | |||
import ${packageName}.domain.${ClassName}; | |||
import ${packageName}.service.I${ClassName}Service; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
/** | |||
@@ -29,7 +27,144 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
* @date ${datetime} | |||
*/ | |||
@Service | |||
public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}> implements I${ClassName}Service | |||
public class ${ClassName}ServiceImpl extends ServiceImpl<${ClassName}Mapper, ${ClassName}> implements I${ClassName}Service | |||
{ | |||
## @Autowired | |||
## private ${ClassName}Mapper ${className}Mapper; | |||
## /** | |||
## * 查询${functionName} | |||
## * | |||
## * @param ${pkColumn.javaField} ${functionName}主键 | |||
## * @return ${functionName} | |||
## */ | |||
## @Override | |||
## public ${ClassName} select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}) | |||
## { | |||
## return ${className}Mapper.select${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}); | |||
## } | |||
/** | |||
* 查询${functionName}列表 | |||
* | |||
* @param ${className} ${functionName} | |||
* @return ${functionName} | |||
*/ | |||
@Override | |||
public List<${ClassName}> list(${ClassName} ${className}) | |||
{ | |||
return baseMapper.select${ClassName}List(${className}); | |||
} | |||
## | |||
## /** | |||
## * 新增${functionName} | |||
## * | |||
## * @param ${className} ${functionName} | |||
## * @return 结果 | |||
## */ | |||
###if($table.sub) | |||
## @Transactional | |||
###end | |||
## @Override | |||
## public int insert${ClassName}(${ClassName} ${className}) | |||
## { | |||
###foreach ($column in $columns) | |||
###if($column.javaField == 'createTime') | |||
## ${className}.setCreateTime(DateUtils.getNowDate()); | |||
###end | |||
###end | |||
###if($table.sub) | |||
## int rows = ${className}Mapper.insert${ClassName}(${className}); | |||
## insert${subClassName}(${className}); | |||
## return rows; | |||
###else | |||
## return ${className}Mapper.insert${ClassName}(${className}); | |||
###end | |||
## } | |||
## | |||
## /** | |||
## * 修改${functionName} | |||
## * | |||
## * @param ${className} ${functionName} | |||
## * @return 结果 | |||
## */ | |||
###if($table.sub) | |||
## @Transactional | |||
###end | |||
## @Override | |||
## public int update${ClassName}(${ClassName} ${className}) | |||
## { | |||
###foreach ($column in $columns) | |||
###if($column.javaField == 'updateTime') | |||
## ${className}.setUpdateTime(DateUtils.getNowDate()); | |||
###end | |||
###end | |||
###if($table.sub) | |||
## ${className}Mapper.delete${subClassName}By${subTableFkClassName}(${className}.get${pkColumn.capJavaField}()); | |||
## insert${subClassName}(${className}); | |||
###end | |||
## return ${className}Mapper.update${ClassName}(${className}); | |||
## } | |||
## | |||
## /** | |||
## * 批量删除${functionName} | |||
## * | |||
## * @param ${pkColumn.javaField}s 需要删除的${functionName}主键 | |||
## * @return 结果 | |||
## */ | |||
###if($table.sub) | |||
## @Transactional | |||
###end | |||
## @Override | |||
## public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s) | |||
## { | |||
###if($table.sub) | |||
## ${className}Mapper.delete${subClassName}By${subTableFkClassName}s(${pkColumn.javaField}s); | |||
###end | |||
## return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s); | |||
## } | |||
## | |||
## /** | |||
## * 删除${functionName}信息 | |||
## * | |||
## * @param ${pkColumn.javaField} ${functionName}主键 | |||
## * @return 结果 | |||
## */ | |||
###if($table.sub) | |||
## @Transactional | |||
###end | |||
## @Override | |||
## public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField}) | |||
## { | |||
###if($table.sub) | |||
## ${className}Mapper.delete${subClassName}By${subTableFkClassName}(${pkColumn.javaField}); | |||
###end | |||
## return ${className}Mapper.delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaField}); | |||
## } | |||
###if($table.sub) | |||
## | |||
## /** | |||
## * 新增${subTable.functionName}信息 | |||
## * | |||
## * @param ${className} ${functionName}对象 | |||
## */ | |||
## public void insert${subClassName}(${ClassName} ${className}) | |||
## { | |||
## List<${subClassName}> ${subclassName}List = ${className}.get${subClassName}List(); | |||
## ${pkColumn.javaType} ${pkColumn.javaField} = ${className}.get${pkColumn.capJavaField}(); | |||
## if (StringUtils.isNotNull(${subclassName}List)) | |||
## { | |||
## List<${subClassName}> list = new ArrayList<${subClassName}>(); | |||
## for (${subClassName} ${subclassName} : ${subclassName}List) | |||
## { | |||
## ${subclassName}.set${subTableFkClassName}(${pkColumn.javaField}); | |||
## list.add(${subclassName}); | |||
## } | |||
## if (list.size() > 0) | |||
## { | |||
## ${className}Mapper.batch${subClassName}(list); | |||
## } | |||
## } | |||
## } | |||
###end | |||
} |
@@ -1,6 +1,6 @@ | |||
<template> | |||
<div class="app-container"> | |||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> | |||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px"> | |||
#foreach($column in $columns) | |||
#if($column.query) | |||
#set($dictType=$column.dictType) | |||
@@ -114,7 +114,12 @@ | |||
</el-row> | |||
<el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange"> | |||
<el-table-column type="selection" width="55" align="center" /> | |||
<el-table-column type="selection" width="55" align="center" fixed="left" /> | |||
<el-table-column label="序号" width="55" align="center" fixed="left" > | |||
<template slot-scope="scope"> | |||
{{ scope.$index + 1 }} | |||
</template> | |||
</el-table-column> | |||
#foreach($column in $columns) | |||
#set($javaField=$column.javaField) | |||
#set($parentheseIndex=$column.columnComment.indexOf("(")) | |||
@@ -123,27 +128,34 @@ | |||
#else | |||
#set($comment=$column.columnComment) | |||
#end | |||
#if($column.pk) | |||
#if($column.pk || ($column.list && ${javaField} == "uuid")) | |||
## <el-table-column label="${comment}" align="center" prop="${javaField}" /> | |||
<el-table-column label="序列" align="center"> | |||
<template slot-scope="scope"> | |||
{{ scope.$index + 1 }} | |||
</template> | |||
</el-table-column> | |||
#elseif($column.list && $column.htmlType == "datetime") | |||
<el-table-column label="${comment}" align="center" prop="${javaField}" width="180"> | |||
#elseif($column.list && (${javaField} == "createTime" || ${javaField} == "updateTime")) | |||
<el-table-column label="${comment}" align="center" fixed="right" prop="${javaField}" width="100"> | |||
<template slot-scope="scope"> | |||
<span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span> | |||
</template> | |||
</el-table-column> | |||
#elseif($column.list && ${javaField} == "remark") | |||
<el-table-column label="${comment}" align="center" prop="${javaField}"/> | |||
#elseif($column.list && (${javaField} == "createBy" || ${javaField} == "updateBy")) | |||
<el-table-column label="${comment}" align="center" fixed="right" prop="${javaField}" width="100"/> | |||
#elseif($column.list && $column.htmlType == "imageUpload") | |||
<el-table-column label="${comment}" align="center" prop="${javaField}" width="100"> | |||
<template slot-scope="scope"> | |||
<image-preview :src="scope.row.${javaField}" :width="50" :height="50"/> | |||
</template> | |||
</el-table-column> | |||
#elseif($column.list && "image" == $column.htmlType) | |||
<el-table-column label="${comment}" align="center" prop="${javaField}" width="100"> | |||
<template slot-scope="scope"> | |||
<el-image :src="scope.row.${javaField}" | |||
:preview-src-list="[item]" > | |||
</el-image> | |||
</template> | |||
</el-table-column> | |||
#elseif($column.list && "" != $column.dictType) | |||
<el-table-column label="${comment}" align="center" prop="${javaField}"> | |||
<el-table-column label="${comment}" align="center" prop="${javaField}" width="100"> | |||
<template slot-scope="scope"> | |||
#if($column.htmlType == "checkbox") | |||
<dict-tag :options="dict.type.${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/> | |||
@@ -153,10 +165,10 @@ | |||
</template> | |||
</el-table-column> | |||
#elseif($column.list && "" != $javaField) | |||
<el-table-column label="${comment}" align="center" prop="${javaField}" /> | |||
<el-table-column label="${comment}" align="center" prop="${javaField}" width="100"/> | |||
#end | |||
#end | |||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | |||
<el-table-column label="操作" align="center" width="150" fixed="right" class-name="small-padding fixed-width"> | |||
<template slot-scope="scope"> | |||
<el-button | |||
size="mini" | |||
@@ -185,8 +197,8 @@ | |||
/> | |||
<!-- 添加或修改${functionName}对话框 --> | |||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> | |||
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> | |||
<el-dialog :title="title" :visible.sync="open" width="900px" append-to-body> | |||
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> | |||
#foreach($column in $columns) | |||
#set($field=$column.javaField) | |||
#if($column.insert && !$column.pk) | |||
@@ -300,8 +312,12 @@ | |||
</el-col> | |||
</el-row> | |||
<el-table :data="${subclassName}List" :row-class-name="row${subClassName}Index" @selection-change="handle${subClassName}SelectionChange" ref="${subclassName}"> | |||
<el-table-column type="selection" width="50" align="center" /> | |||
<el-table-column label="序号" align="center" prop="index" width="50"/> | |||
<el-table-column type="selection" width="50" align="center" fixed="left" /> | |||
<el-table-column label="序号" align="center" prop="index" width="50" fixed="left"> | |||
<template slot-scope="scope"> | |||
{{ scope.$index + 1 }} | |||
</template> | |||
</el-table-column> | |||
#foreach($column in $subTable.columns) | |||
#set($javaField=$column.javaField) | |||
#set($parentheseIndex=$column.columnComment.indexOf("(")) | |||
@@ -380,7 +396,7 @@ export default { | |||
// 非多个禁用 | |||
multiple: true, | |||
// 显示搜索条件 | |||
showSearch: true, | |||
showSearch: false, | |||
// 总条数 | |||
total: 0, | |||
// ${functionName}表格数据 | |||
@@ -119,11 +119,6 @@ | |||
#set($comment=$column.columnComment) | |||
#end | |||
#if($column.pk) | |||
<el-table-column label="序列" align="center" > | |||
<template slot-scope="scope"> | |||
{{ scope.$index+1 }} | |||
</template> | |||
</el-table-column> | |||
<el-table-column label="${comment}" align="center" prop="${javaField}" /> | |||
#elseif($column.list && $column.htmlType == "datetime") | |||
<el-table-column label="${comment}" align="center" prop="${javaField}" width="180"> | |||
@@ -3,9 +3,10 @@ | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="${packageName}.mapper.${ClassName}Mapper"> | |||
<!--${functionName}对象 ${tableName}--> | |||
<resultMap type="${ClassName}" id="${ClassName}Result"> | |||
#foreach ($column in $columns) | |||
<!-- $column.columnComment --> | |||
<result property="${column.javaField}" column="${column.columnName}" /> | |||
#end | |||
</resultMap> | |||
@@ -23,12 +24,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
#end | |||
<sql id="select${ClassName}Vo"> | |||
select#foreach($column in $columns) $column.columnName#if($foreach.count != $columns.size()),#end#end from ${tableName} | |||
select | |||
#foreach($column in $columns) | |||
$column.columnName#if($foreach.count != $columns.size()),<!-- $column.columnComment --> | |||
#end#end | |||
</sql> | |||
<select id="select${ClassName}List" parameterType="${ClassName}" resultMap="${ClassName}Result"> | |||
<include refid="select${ClassName}Vo"/> | |||
<where> | |||
from ${tableName} | |||
<where> | |||
deleted = 0 | |||
#foreach($column in $columns) | |||
#set($queryType=$column.queryType) | |||
#set($javaField=$column.javaField) | |||
@@ -49,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
#elseif($queryType == "LTE") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName <= #{$javaField}</if> | |||
#elseif($queryType == "LIKE") | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat('%', #{$javaField}, '%')</if> | |||
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat(#{$javaField}, '%')</if> | |||
#elseif($queryType == "BETWEEN") | |||
<if test="params.begin$AttrName != null and params.begin$AttrName != '' and params.end$AttrName != null and params.end$AttrName != ''"> and $columnName between #{params.begin$AttrName} and #{params.end$AttrName}</if> | |||
#end | |||
@@ -57,79 +63,79 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
#end | |||
</where> | |||
</select> | |||
<select id="select${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}" resultMap="#if($table.sub)${ClassName}${subClassName}Result#else${ClassName}Result#end"> | |||
#if($table.crud || $table.tree) | |||
<include refid="select${ClassName}Vo"/> | |||
where ${pkColumn.columnName} = #{${pkColumn.javaField}} | |||
#elseif($table.sub) | |||
select#foreach($column in $columns) a.$column.columnName#if($foreach.count != $columns.size()),#end#end, | |||
#foreach($column in $subTable.columns) b.$column.columnName as sub_$column.columnName#if($foreach.count != $subTable.columns.size()),#end#end | |||
from ${tableName} a | |||
left join ${subTableName} b on b.${subTableFkName} = a.${pkColumn.columnName} | |||
where a.${pkColumn.columnName} = #{${pkColumn.javaField}} | |||
#end | |||
</select> | |||
<insert id="insert${ClassName}" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end> | |||
insert into ${tableName} | |||
<trim prefix="(" suffix=")" suffixOverrides=","> | |||
#foreach($column in $columns) | |||
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) | |||
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName,</if> | |||
#end | |||
#end | |||
</trim> | |||
<trim prefix="values (" suffix=")" suffixOverrides=","> | |||
#foreach($column in $columns) | |||
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) | |||
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">#{$column.javaField},</if> | |||
#end | |||
#end | |||
</trim> | |||
</insert> | |||
<update id="update${ClassName}" parameterType="${ClassName}"> | |||
update ${tableName} | |||
<trim prefix="SET" suffixOverrides=","> | |||
#foreach($column in $columns) | |||
#if($column.columnName != $pkColumn.columnName) | |||
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if> | |||
#end | |||
#end | |||
</trim> | |||
where ${pkColumn.columnName} = #{${pkColumn.javaField}} | |||
</update> | |||
<delete id="delete${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}"> | |||
delete from ${tableName} where ${pkColumn.columnName} = #{${pkColumn.javaField}} | |||
</delete> | |||
<delete id="delete${ClassName}By${pkColumn.capJavaField}s" parameterType="String"> | |||
delete from ${tableName} where ${pkColumn.columnName} in | |||
<foreach item="${pkColumn.javaField}" collection="array" open="(" separator="," close=")"> | |||
#{${pkColumn.javaField}} | |||
</foreach> | |||
</delete> | |||
#if($table.sub) | |||
<delete id="delete${subClassName}By${subTableFkClassName}s" parameterType="String"> | |||
delete from ${subTableName} where ${subTableFkName} in | |||
<foreach item="${subTableFkclassName}" collection="array" open="(" separator="," close=")"> | |||
#{${subTableFkclassName}} | |||
</foreach> | |||
</delete> | |||
<delete id="delete${subClassName}By${subTableFkClassName}" parameterType="${pkColumn.javaType}"> | |||
delete from ${subTableName} where ${subTableFkName} = #{${subTableFkclassName}} | |||
</delete> | |||
<insert id="batch${subClassName}"> | |||
insert into ${subTableName}(#foreach($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end) values | |||
<foreach item="item" index="index" collection="list" separator=","> | |||
(#foreach($column in $subTable.columns) #{item.$column.javaField}#if($foreach.count != $subTable.columns.size()),#end#end) | |||
</foreach> | |||
</insert> | |||
#end | |||
## | |||
## <select id="select${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}" resultMap="#if($table.sub)${ClassName}${subClassName}Result#else${ClassName}Result#end"> | |||
###if($table.crud || $table.tree) | |||
## <include refid="select${ClassName}Vo"/> | |||
## where ${pkColumn.columnName} = #{${pkColumn.javaField}} | |||
###elseif($table.sub) | |||
## select#foreach($column in $columns) a.$column.columnName#if($foreach.count != $columns.size()),#end#end, | |||
## #foreach($column in $subTable.columns) b.$column.columnName as sub_$column.columnName#if($foreach.count != $subTable.columns.size()),#end#end | |||
## | |||
## from ${tableName} a | |||
## left join ${subTableName} b on b.${subTableFkName} = a.${pkColumn.columnName} | |||
## where a.${pkColumn.columnName} = #{${pkColumn.javaField}} | |||
###end | |||
## </select> | |||
## | |||
## <insert id="insert${ClassName}" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end> | |||
## insert into ${tableName} | |||
## <trim prefix="(" suffix=")" suffixOverrides=","> | |||
###foreach($column in $columns) | |||
###if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) | |||
## <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName,</if> | |||
###end | |||
###end | |||
## </trim> | |||
## <trim prefix="values (" suffix=")" suffixOverrides=","> | |||
###foreach($column in $columns) | |||
###if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) | |||
## <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">#{$column.javaField},</if> | |||
###end | |||
###end | |||
## </trim> | |||
## </insert> | |||
## | |||
## <update id="update${ClassName}" parameterType="${ClassName}"> | |||
## update ${tableName} | |||
## <trim prefix="SET" suffixOverrides=","> | |||
###foreach($column in $columns) | |||
###if($column.columnName != $pkColumn.columnName) | |||
## <if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if> | |||
###end | |||
###end | |||
## </trim> | |||
## where ${pkColumn.columnName} = #{${pkColumn.javaField}} | |||
## </update> | |||
## | |||
## <delete id="delete${ClassName}By${pkColumn.capJavaField}" parameterType="${pkColumn.javaType}"> | |||
## delete from ${tableName} where ${pkColumn.columnName} = #{${pkColumn.javaField}} | |||
## </delete> | |||
## | |||
## <delete id="delete${ClassName}By${pkColumn.capJavaField}s" parameterType="String"> | |||
## delete from ${tableName} where ${pkColumn.columnName} in | |||
## <foreach item="${pkColumn.javaField}" collection="array" open="(" separator="," close=")"> | |||
## #{${pkColumn.javaField}} | |||
## </foreach> | |||
## </delete> | |||
###if($table.sub) | |||
## | |||
## <delete id="delete${subClassName}By${subTableFkClassName}s" parameterType="String"> | |||
## delete from ${subTableName} where ${subTableFkName} in | |||
## <foreach item="${subTableFkclassName}" collection="array" open="(" separator="," close=")"> | |||
## #{${subTableFkclassName}} | |||
## </foreach> | |||
## </delete> | |||
## | |||
## <delete id="delete${subClassName}By${subTableFkClassName}" parameterType="${pkColumn.javaType}"> | |||
## delete from ${subTableName} where ${subTableFkName} = #{${subTableFkclassName}} | |||
## </delete> | |||
## | |||
## <insert id="batch${subClassName}"> | |||
## insert into ${subTableName}(#foreach($column in $subTable.columns) $column.columnName#if($foreach.count != $subTable.columns.size()),#end#end) values | |||
## <foreach item="item" index="index" collection="list" separator=","> | |||
## (#foreach($column in $subTable.columns) #{item.$column.javaField}#if($foreach.count != $subTable.columns.size()),#end#end) | |||
## </foreach> | |||
## </insert> | |||
###end | |||
</mapper> |