mirror of
https://github.com/abcv7/sfbx-cloud.git
synced 2026-08-16 19:49:49 +00:00
first commit
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
_ __ __
|
||||
(_) /__________ ______/ /_
|
||||
/ / __/ ___/ __ `/ ___/ __/
|
||||
/ / /_/ /__/ /_/ (__ ) /_
|
||||
/_/\__/\___/\__,_/____/\__/
|
||||
:: Spring Boot :: (v-2.7.10)
|
||||
:: Spring Cloud :: (v-2021.0.6)
|
||||
:: Spring Cloud Alibaba :: (v-2021.0.1.0)
|
||||
:: sfbx Cloud :: (v-2.0-SNAPSHOT)
|
||||
:: 献给可爱的传智人 ::
|
||||
@@ -0,0 +1,54 @@
|
||||
#服务配置
|
||||
server:
|
||||
#端口
|
||||
port: 7075
|
||||
#服务编码
|
||||
tomcat:
|
||||
uri-encoding: UTF-8
|
||||
spring:
|
||||
config:
|
||||
activate:
|
||||
on-profile:
|
||||
- test
|
||||
main:
|
||||
allow-circular-references: true
|
||||
allow-bean-definition-overriding: true
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
#应用配置
|
||||
application:
|
||||
#应用名称
|
||||
name: file-web
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: ${NACOS_ADDRESS:nacos-service.yjy-public-sfbx-java.svc.cluster.local:20015} # nacos注册中心
|
||||
group: SEATA_GROUP
|
||||
service: ${spring.application.name}
|
||||
username: ${NACOS_USERNAME:nacos}
|
||||
password: ${NACOS_PASSWORD:PKsf*bxQ4;yP3a+}
|
||||
config:
|
||||
server-addr: ${NACOS_ADDRESS:nacos-service.yjy-public-sfbx-java.svc.cluster.local:20015} # nacos注册中心
|
||||
group: SEATA_GROUP
|
||||
file-extension: yml
|
||||
shared-configs: # 共享配置
|
||||
- data-id: shared-spring-seata.yml #配置文件名-DataId
|
||||
group: SEATA_GROUP
|
||||
refresh: false
|
||||
- data-id: shared-redisson.yml #配置文件名-DataId
|
||||
group: SEATA_GROUP
|
||||
refresh: false
|
||||
- data-id: shared-mybatis-plus.yml #配置文件名-DataId
|
||||
group: SEATA_GROUP
|
||||
refresh: false
|
||||
- data-id: shared-stream-rabbit-basic.yml #配置文件名-DataId
|
||||
group: SEATA_GROUP
|
||||
refresh: false
|
||||
- data-id: shared-stream-rabbit-source-file.yml #配置文件名-DataId
|
||||
group: SEATA_GROUP
|
||||
refresh: false
|
||||
username: ${NACOS_USERNAME:nacos}
|
||||
password: ${NACOS_PASSWORD:PKsf*bxQ4;yP3a+}
|
||||
logging:
|
||||
config: classpath:logback.xml
|
||||
@@ -0,0 +1,53 @@
|
||||
#服务配置
|
||||
server:
|
||||
#端口
|
||||
port: 7075
|
||||
#服务编码
|
||||
tomcat:
|
||||
uri-encoding: UTF-8
|
||||
spring:
|
||||
servlet:
|
||||
multipart:
|
||||
enabled: true
|
||||
max-file-size: 10MB
|
||||
max-request-size: 20MB
|
||||
profiles:
|
||||
active: dev
|
||||
main:
|
||||
allow-circular-references: true
|
||||
allow-bean-definition-overriding: true
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
#应用配置
|
||||
application:
|
||||
#应用名称
|
||||
name: file-web
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 192.168.12.129:8848 # nacos注册中心
|
||||
group: SEATA_GROUP
|
||||
service: ${spring.application.name}
|
||||
config:
|
||||
server-addr: 192.168.12.129:8848 # nacos配置中心地址
|
||||
group: SEATA_GROUP
|
||||
file-extension: yml
|
||||
shared-configs: # 共享配置
|
||||
- data-id: shared-spring-seata.yml #配置文件名-DataId
|
||||
group: SEATA_GROUP
|
||||
refresh: false
|
||||
- data-id: shared-redisson.yml #配置文件名-DataId
|
||||
group: SEATA_GROUP
|
||||
refresh: false
|
||||
- data-id: shared-mybatis-plus.yml #配置文件名-DataId
|
||||
group: SEATA_GROUP
|
||||
refresh: false
|
||||
- data-id: shared-stream-rabbit-basic.yml #配置文件名-DataId
|
||||
group: SEATA_GROUP
|
||||
refresh: false
|
||||
- data-id: shared-stream-rabbit-source-file.yml #配置文件名-DataId
|
||||
group: SEATA_GROUP
|
||||
refresh: false
|
||||
logging:
|
||||
config: classpath:logback.xml
|
||||
@@ -0,0 +1,47 @@
|
||||
#\u6570\u636E\u5E93\u5730\u5740
|
||||
url=jdbc:mysql://192.168.12.129:3306/restkeeper-file?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&tinyInt1isBit=false
|
||||
#\u6570\u636E\u5E93\u8D26\u53F7
|
||||
userName=root
|
||||
#\u6570\u636E\u5E93\u5BC6\u7801
|
||||
password=pass
|
||||
#services\u7684src\u8DEF\u5F84
|
||||
serviceProjectPath=E:/itheima-project-parent/itheima-project-cloud/itheima-module-file/module-file-web
|
||||
#VO\u7684src\u8DEF\u5F84
|
||||
voProjectPath=E:/itheima-project-parent/itheima-project-cloud/itheima-component/component-vo
|
||||
#\u4F5C\u8005
|
||||
author=Admin
|
||||
#\u5305\u540D\u79F0
|
||||
parent=com.itheima
|
||||
#\u6A21\u5757\u540D\u79F0
|
||||
moduleName=project
|
||||
#\u6570\u636E\u5E93\u8868\u524D\u7F00
|
||||
tablePrefix =tab_
|
||||
#\u9700\u8981\u751F\u6210\u7684\u8868\u540D\uFF0C\u4F7F\u7528\uFF0C\u5206\u5272
|
||||
tableName= tab_file_part
|
||||
#\u9700\u8981\u751F\u6210\u9644\u4EF6\u76F8\u5173\u7684\u8868
|
||||
tablesFile=
|
||||
#pojo\u7684\u7236\u7C7B
|
||||
SuperEntityClass = com.itheima.easy.basic.BasicPojo
|
||||
#pojo\u7684\u901A\u7528\u5B57\u6BB5
|
||||
superEntityColumns = id,created_time,updated_time,sharding_id,enable_flag
|
||||
#\u751F\u6210\u89C4\u5219
|
||||
constant=true
|
||||
constant.ftl.path=/templates/constant.java
|
||||
enums=true
|
||||
enums.ftl.path=/templates/enums.java
|
||||
vo=true
|
||||
vo.ftl.path=/templates/vo.java
|
||||
entity=true
|
||||
entity.ftl.path=/templates/entity.java
|
||||
mapper=true
|
||||
mapper.ftl.path=/templates/mapper.java
|
||||
service=true
|
||||
service.ftl.path=/templates/service.java
|
||||
serviceImpl=true
|
||||
serviceImpl.ftl.path=/templates/serviceImpl.java
|
||||
face=false
|
||||
face.ftl.path=/templates/face.java
|
||||
faceImpl=false
|
||||
faceImpl.ftl.path=/templates/faceImpl.java
|
||||
controller=false
|
||||
controller.ftl.path=/templates/controller.java
|
||||
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration debug="false">
|
||||
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径 -->
|
||||
<property name="LOG_HOME" value="/data/logs/file-web" />
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}-%msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!-- 按照每天生成日志文件 -->
|
||||
<appender name="FILE"
|
||||
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!--日志文件输出的文件名 -->
|
||||
<FileNamePattern>${LOG_HOME}/file-web-01.log.%d{yyyy-MM-dd}.log
|
||||
</FileNamePattern>
|
||||
<!--日志文件保留天数 -->
|
||||
<MaxHistory>30</MaxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}-%msg%n</pattern>
|
||||
</encoder>
|
||||
<!--日志文件最大的大小 -->
|
||||
<triggeringPolicy
|
||||
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
|
||||
<MaxFileSize>10MB</MaxFileSize>
|
||||
</triggeringPolicy>
|
||||
</appender>
|
||||
<!-- show parameters for hibernate sql 专为 Hibernate 定制 -->
|
||||
<logger name="org.hibernate.type.descriptor.sql.BasicBinder"
|
||||
level="TRACE" />
|
||||
<logger name="org.hibernate.type.descriptor.sql.BasicExtractor"
|
||||
level="DEBUG" />
|
||||
<logger name="org.hibernate.SQL" level="DEBUG" />
|
||||
<logger name="org.hibernate.engine.QueryParameters" level="DEBUG" />
|
||||
<logger name="org.hibernate.engine.query.HQLQueryPlan" level="DEBUG" />
|
||||
|
||||
<!--myibatis log configure -->
|
||||
<logger name="com.apache.ibatis" level="TRACE" />
|
||||
<logger name="java.sql.Connection" level="DEBUG" />
|
||||
<logger name="java.sql.Statement" level="DEBUG" />
|
||||
<logger name="java.sql.PreparedStatement" level="DEBUG" />
|
||||
|
||||
<!-- 日志输出级别 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
</root>
|
||||
<!--日志异步到数据库 -->
|
||||
</configuration>
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.itheima.easy.constant;
|
||||
|
||||
/**
|
||||
* @Description:${table.comment!}缓存常量
|
||||
*/
|
||||
public class ${entity}CacheConstant extends CacheConstant {
|
||||
|
||||
//缓存父包
|
||||
public static final String PREFIX= "${controllerMappingHyphen}:";
|
||||
|
||||
//缓存父包
|
||||
public static final String BASIC= PREFIX+"basic";
|
||||
|
||||
//分布式锁前缀
|
||||
public static final String LOCK_PREFIX = PREFIX+"lock:";
|
||||
|
||||
//page分页
|
||||
public static final String PAGE= PREFIX+"page";
|
||||
|
||||
//list下拉框
|
||||
public static final String LIST= PREFIX+"list";
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package ${package.Controller};
|
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.itheima.sfbx.framework.commons.basic.ResponseResult;
|
||||
import com.itheima.sfbx.framework.commons.enums.trade.${entity}Enum;
|
||||
import com.itheima.easy.face.${entity}Face;
|
||||
import com.itheima.sfbx.framework.commons.utils.ResponseResultBuild;
|
||||
import com.itheima.sfbx.framework.commons.dto.trade.${entity}Vo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
<#if restControllerStyle>
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
<#else>
|
||||
import org.springframework.stereotype.Controller;
|
||||
</#if>
|
||||
<#if superControllerClassPackage??>
|
||||
import ${superControllerClassPackage};
|
||||
</#if>
|
||||
|
||||
/**
|
||||
* @Description:${table.comment!}前端控制器
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "${table.comment!}controller")
|
||||
<#if restControllerStyle>
|
||||
@RestController
|
||||
<#else>
|
||||
@Controller
|
||||
</#if>
|
||||
@RequestMapping("<#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")
|
||||
<#if kotlin>
|
||||
class ${table.controllerName}<#if superControllerClass??> : ${superControllerClass}()</#if>
|
||||
<#else>
|
||||
<#if superControllerClass??>
|
||||
public class ${table.controllerName} extends ${superControllerClass} {
|
||||
<#else>
|
||||
public class ${table.controllerName} {
|
||||
</#if>
|
||||
|
||||
@Autowired
|
||||
${entity}Face ${entity?uncap_first}Face;
|
||||
|
||||
/***
|
||||
* @description 多条件查询${table.comment!}分页列表
|
||||
* @param ${entity?uncap_first}Vo ${table.comment!}Vo查询条件
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 每页条数
|
||||
* @return: Page<${entity}Vo>
|
||||
*/
|
||||
@PostMapping("page/{pageNum}/{pageSize}")
|
||||
@ApiOperation(value = "${table.comment!}分页",notes = "${table.comment!}分页")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "${entity?uncap_first}Vo",value = "${table.comment!}Vo对象",required = true,dataType = "${entity}Vo"),
|
||||
@ApiImplicitParam(paramType = "path",name = "pageNum",value = "页码",example = "1",dataType = "Integer"),
|
||||
@ApiImplicitParam(paramType = "path",name = "pageSize",value = "每页条数",example = "10",dataType = "Integer")
|
||||
})
|
||||
public ResponseResult<Page<${entity}Vo>> find${entity}VoPage(
|
||||
@RequestBody ${entity}Vo ${entity?uncap_first}Vo,
|
||||
@PathVariable("pageNum") int pageNum,
|
||||
@PathVariable("pageSize") int pageSize) {
|
||||
Page<${entity}Vo> ${entity?uncap_first}VoPage = ${entity?uncap_first}Face.find${entity}VoPage(${entity?uncap_first}Vo, pageNum, pageSize);
|
||||
return ResponseResultBuild.build(${entity}Enum.SUCCEED,${entity?uncap_first}VoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 保存${table.comment!}
|
||||
* @param ${entity?uncap_first}Vo ${table.comment!}Vo对象
|
||||
* @return ${entity}Vo
|
||||
*/
|
||||
@PutMapping
|
||||
@ApiOperation(value = "添加${entity}",notes = "添加${entity}")
|
||||
@ApiImplicitParam(name = "${entity?uncap_first}Vo",value = "${table.comment!}Vo对象",required = true,dataType = "${entity}Vo")
|
||||
public ResponseResult<${entity}Vo> create${entity}(@RequestBody ${entity}Vo ${entity?uncap_first}Vo) {
|
||||
${entity}Vo ${entity?uncap_first}VoResult = ${entity?uncap_first}Face.create${entity}Vo(${entity?uncap_first}Vo);
|
||||
return ResponseResultBuild.build(${entity}Enum.SUCCEED,${entity?uncap_first}VoResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 修改${table.comment!}
|
||||
* @param ${entity?uncap_first}Vo ${table.comment!}Vo对象
|
||||
* @return Boolean 是否修改成功
|
||||
*/
|
||||
@PatchMapping
|
||||
@ApiOperation(value = "修改${table.comment!}",notes = "修改${table.comment!}")
|
||||
@ApiImplicitParam(name = "${entity?uncap_first}Vo",value = "${table.comment!}Vo对象",required = true,dataType = "${entity}Vo")
|
||||
public ResponseResult<Boolean> update${entity}(@RequestBody ${entity}Vo ${entity?uncap_first}Vo) {
|
||||
Boolean flag = ${entity?uncap_first}Face.update${entity}Vo(${entity?uncap_first}Vo);
|
||||
return ResponseResultBuild.build(${entity}Enum.SUCCEED,flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description 删除${table.comment!}
|
||||
* @param ${entity?uncap_first}Vo 刪除条件:checkedIds 不可为空
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping
|
||||
@ApiOperation(value = "删除${table.comment!}",notes = "删除${table.comment!}")
|
||||
@ApiImplicitParam(name = "${entity?uncap_first}Vo",value = "${table.comment!}Vo对象",required = true,dataType = "${entity}Vo")
|
||||
public ResponseResult<Boolean> delete${entity}(@RequestBody ${entity}Vo ${entity?uncap_first}Vo) {
|
||||
Boolean flag = ${entity?uncap_first}Face.delete${entity}Vo(${entity?uncap_first}Vo.getCheckedIds());
|
||||
return ResponseResultBuild.build(${entity}Enum.SUCCEED,flag);
|
||||
}
|
||||
|
||||
/***
|
||||
* @description 多条件查询${table.comment!}列表
|
||||
* @param ${entity?uncap_first}Vo ${table.comment!}Vo对象
|
||||
* @return List<${entity}Vo>
|
||||
*/
|
||||
@PostMapping("list")
|
||||
@ApiOperation(value = "多条件查询${table.comment!}列表",notes = "多条件查询${table.comment!}列表")
|
||||
@ApiImplicitParam(name = "${entity?uncap_first}Vo",value = "${table.comment!}Vo对象",required = true,dataType = "${entity}Vo")
|
||||
public ResponseResult<List<${entity}Vo>> ${entity?uncap_first}List(@RequestBody ${entity}Vo ${entity?uncap_first}Vo) {
|
||||
List<${entity}Vo> ${entity?uncap_first}VoList = ${entity?uncap_first}Face.find${entity}VoList(${entity?uncap_first}Vo);
|
||||
return ResponseResultBuild.build(${entity}Enum.SUCCEED,${entity?uncap_first}VoList);
|
||||
}
|
||||
|
||||
}
|
||||
</#if>
|
||||
@@ -0,0 +1,156 @@
|
||||
package ${package.Entity};
|
||||
|
||||
<#list table.importPackages as pkg>
|
||||
import ${pkg};
|
||||
</#list>
|
||||
<#if swagger2>
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
</#if>
|
||||
<#if entityLombokModel>
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
</#if>
|
||||
|
||||
/**
|
||||
* @Description:${table.comment!}
|
||||
*/
|
||||
<#if entityLombokModel>
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
<#if superEntityClass??>
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
<#else>
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
</#if>
|
||||
</#if>
|
||||
<#if table.convert>
|
||||
@TableName("${table.name}")
|
||||
</#if>
|
||||
<#if swagger2>
|
||||
@ApiModel(value="${entity}对象", description="${table.comment!}")
|
||||
</#if>
|
||||
<#if superEntityClass??>
|
||||
public class ${entity} extends ${superEntityClass}<#if activeRecord><${entity}></#if> {
|
||||
<#elseif activeRecord>
|
||||
public class ${entity} extends Model<${entity}> {
|
||||
<#else>
|
||||
public class ${entity} implements Serializable {
|
||||
</#if>
|
||||
|
||||
<#if entitySerialVersionUID>
|
||||
private static final long serialVersionUID = 1L;
|
||||
</#if>
|
||||
|
||||
@Builder
|
||||
public ${entity}(Long id,<#list table.fields as field>${field.propertyType} ${field.propertyName}<#if field_has_next>,</#if></#list>){
|
||||
super(id);
|
||||
<#list table.fields as field>
|
||||
this.${field.propertyName}=${field.propertyName};
|
||||
</#list>
|
||||
}
|
||||
<#-- ---------- BEGIN 字段循环遍历 ---------->
|
||||
<#list table.fields as field>
|
||||
<#if field.keyFlag>
|
||||
<#assign keyPropertyName="${field.propertyName}"/>
|
||||
</#if>
|
||||
|
||||
<#if field.comment!?length gt 0>
|
||||
<#if swagger2>
|
||||
@ApiModelProperty(value = "${field.comment}")
|
||||
<#else>
|
||||
/**
|
||||
* ${field.comment}
|
||||
*/
|
||||
</#if>
|
||||
</#if>
|
||||
<#if field.keyFlag>
|
||||
<#-- 主键 -->
|
||||
<#if field.keyIdentityFlag>
|
||||
@TableId(value = "${field.name}", type = IdType.AUTO)
|
||||
<#elseif idType??>
|
||||
@TableId(value = "${field.name}", type = IdType.${idType})
|
||||
<#elseif field.convert>
|
||||
@TableId("${field.name}")
|
||||
</#if>
|
||||
<#-- 普通字段 -->
|
||||
<#elseif field.fill??>
|
||||
<#-- ----- 存在字段填充设置 ----->
|
||||
<#if field.convert>
|
||||
@TableField(value = "${field.name}", fill = FieldFill.${field.fill})
|
||||
<#else>
|
||||
@TableField(fill = FieldFill.${field.fill})
|
||||
</#if>
|
||||
<#elseif field.convert>
|
||||
@TableField("${field.name}")
|
||||
</#if>
|
||||
<#-- 乐观锁注解 -->
|
||||
<#if (versionFieldName!"") == field.name>
|
||||
@Version
|
||||
</#if>
|
||||
<#-- 逻辑删除注解 -->
|
||||
<#if (logicDeleteFieldName!"") == field.name>
|
||||
@TableLogic
|
||||
</#if>
|
||||
private ${field.propertyType} ${field.propertyName};
|
||||
</#list>
|
||||
<#------------ END 字段循环遍历 ---------->
|
||||
|
||||
<#if !entityLombokModel>
|
||||
<#list table.fields as field>
|
||||
<#if field.propertyType == "boolean">
|
||||
<#assign getprefix="is"/>
|
||||
<#else>
|
||||
<#assign getprefix="get"/>
|
||||
</#if>
|
||||
public ${field.propertyType} ${getprefix}${field.capitalName}() {
|
||||
return ${field.propertyName};
|
||||
}
|
||||
|
||||
<#if entityBuilderModel>
|
||||
public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
|
||||
<#else>
|
||||
public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
|
||||
</#if>
|
||||
this.${field.propertyName} = ${field.propertyName};
|
||||
<#if entityBuilderModel>
|
||||
return this;
|
||||
</#if>
|
||||
}
|
||||
</#list>
|
||||
</#if>
|
||||
|
||||
<#if entityColumnConstant>
|
||||
<#list table.fields as field>
|
||||
public static final String ${field.name?upper_case} = "${field.name}";
|
||||
|
||||
</#list>
|
||||
</#if>
|
||||
<#if activeRecord>
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
<#if keyPropertyName??>
|
||||
return this.${keyPropertyName};
|
||||
<#else>
|
||||
return null;
|
||||
</#if>
|
||||
}
|
||||
|
||||
</#if>
|
||||
<#if !entityLombokModel>
|
||||
@Override
|
||||
public String toString() {
|
||||
return "${entity}{" +
|
||||
<#list table.fields as field>
|
||||
<#if field_index==0>
|
||||
"${field.propertyName}=" + ${field.propertyName} +
|
||||
<#else>
|
||||
", ${field.propertyName}=" + ${field.propertyName} +
|
||||
</#if>
|
||||
</#list>
|
||||
"}";
|
||||
}
|
||||
</#if>
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.itheima.easy.enums;
|
||||
|
||||
import com.itheima.easy.basic.IBasicEnum;
|
||||
|
||||
/**
|
||||
* @ClassName ${entity}Enum.java
|
||||
* @Description ${table.comment!}枚举
|
||||
*/
|
||||
|
||||
public enum ${entity}Enum implements IBasicEnum {
|
||||
|
||||
SUCCEED("200","操作成功"),
|
||||
FAIL("1000","操作失败"),
|
||||
PAGE_FAIL("53001", "查询${table.comment!}列表失败"),
|
||||
SAVE_FAIL("53002", "保存${table.comment!}失败"),
|
||||
UPDATE_FAIL("53003", "修改${table.comment!}失败"),
|
||||
DEL_FAIL("53004", "删除${table.comment!}失败"),
|
||||
LIST_FAIL("53005", "查询${table.comment!}失败")
|
||||
;
|
||||
|
||||
private String code;
|
||||
|
||||
private String msg;
|
||||
|
||||
${entity}Enum(String code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.itheima.easy.face;
|
||||
|
||||
import com.itheima.sfbx.framework.commons.dto.trade.${entity}Vo;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:${table.comment!}Face服务类
|
||||
*/
|
||||
<#if kotlin>
|
||||
interface ${entity}Face
|
||||
<#else>
|
||||
public interface ${entity}Face {
|
||||
|
||||
/**
|
||||
* @Description 多条件查询${table.comment!}分页列表
|
||||
* @param ${entity?uncap_first}Vo 查询条件
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 每页条数
|
||||
* @return Page<${entity}>
|
||||
*/
|
||||
Page<${entity}Vo> find${entity}VoPage(${entity}Vo ${entity?uncap_first}Vo, int pageNum, int pageSize);
|
||||
|
||||
/**
|
||||
* @Description 创建${table.comment!}
|
||||
* @param ${entity?uncap_first}Vo 对象信息
|
||||
* @return ${entity}
|
||||
*/
|
||||
${entity}Vo create${entity}Vo(${entity}Vo ${entity?uncap_first}Vo);
|
||||
|
||||
/**
|
||||
* @Description 修改${table.comment!}
|
||||
* @param ${entity?uncap_first}Vo 对象信息
|
||||
* @return Boolean
|
||||
*/
|
||||
Boolean update${entity}Vo(${entity}Vo ${entity?uncap_first}Vo);
|
||||
|
||||
/**
|
||||
* @Description 删除${table.comment!}
|
||||
* @param checkedIds 选择中对象Ids
|
||||
* @return Boolean
|
||||
*/
|
||||
Boolean delete${entity}Vo(String[] checkedIds);
|
||||
|
||||
/**
|
||||
* @description 多条件查询${table.comment!}列表
|
||||
* @param ${entity?uncap_first}Vo 查询条件
|
||||
* @return: List<${entity}>
|
||||
*/
|
||||
List<${entity}Vo> find${entity}VoList(${entity}Vo ${entity?uncap_first}Vo);
|
||||
}
|
||||
</#if>
|
||||
@@ -0,0 +1,188 @@
|
||||
package com.itheima.easy.face.impl;
|
||||
|
||||
import ${package.Entity}.${entity};
|
||||
import ${package.Service}.${table.serviceName};
|
||||
import com.itheima.sfbx.framework.commons.dto.trade.${entity}Vo;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.itheima.sfbx.framework.commons.utils.BeanConv;
|
||||
import com.itheima.easy.face.${entity}Face;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.cache.annotation.Caching;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.itheima.sfbx.framework.commons.utils.ExceptionsUtil;
|
||||
import com.itheima.sfbx.framework.commons.exception.ProjectException;
|
||||
import com.itheima.sfbx.framework.commons.constant.trade.${entity}CacheConstant;
|
||||
import com.itheima.sfbx.framework.commons.enums.trade.${entity}Enum;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
<#list cfg.tablesFile as tableFiile>
|
||||
<#if tableFiile==table.name>
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import com.itheima.sfbx.framework.commons.dto.file.FileVO;
|
||||
import com.itheima.sfbx.framework.commons.utils.EmptyUtil;
|
||||
import com.itheima.sfbx.framework.commons.basic.ResponseResult;
|
||||
import com.itheima.easy.feign.FileFeign;
|
||||
</#if>
|
||||
</#list>
|
||||
import java.util.List;
|
||||
/**
|
||||
* @Description:${table.comment!}Face服务实现类
|
||||
*/
|
||||
<#if kotlin>
|
||||
open class ${entity}FaceImpl : ${entity}Face {
|
||||
|
||||
}
|
||||
<#else>
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ${entity}FaceImpl implements ${entity}Face {
|
||||
|
||||
@Autowired
|
||||
I${entity}Service ${entity?uncap_first}Service;
|
||||
|
||||
<#list cfg.tablesFile as tableFiile>
|
||||
<#if tableFiile==table.name>
|
||||
@Autowired
|
||||
FileFeign fileFeign;
|
||||
</#if>
|
||||
</#list>
|
||||
|
||||
@Override
|
||||
@Cacheable(value = ${entity}CacheConstant.PAGE,key ="#pageNum+'-'+#pageSize+'-'+#${entity?uncap_first}Vo.hashCode()")
|
||||
public Page<${entity}Vo> find${entity}VoPage(${entity}Vo ${entity?uncap_first}Vo, int pageNum, int pageSize) {
|
||||
try {
|
||||
Page<${entity}> page = ${entity?uncap_first}Service.find${entity}Page(${entity?uncap_first}Vo, pageNum, pageSize);
|
||||
Page<${entity}Vo> pageVo =BeanConv.toPage(page,${entity}Vo.class);
|
||||
<#list cfg.tablesFile as tableFiile>
|
||||
<#if tableFiile==table.name>
|
||||
//查询记录结果
|
||||
List<${entity}Vo> records = pageVo.getRecords();
|
||||
//处理图片
|
||||
if (!EmptyUtil.isNullOrEmpty(records)){
|
||||
records.forEach(n->{
|
||||
ResponseResult<List<FileVO>> responseWrap = fileFeign
|
||||
.findFileVOByBusinessId(FileVO.builder().businessId(n.getId()).build());
|
||||
if (!EmptyUtil.isNullOrEmpty(responseWrap.getDatas())){
|
||||
n.setFileVOs(responseWrap.getDatas());
|
||||
}else {
|
||||
n.setFileVOs(new ArrayList<>());
|
||||
}
|
||||
});
|
||||
}
|
||||
</#if>
|
||||
</#list>
|
||||
return pageVo;
|
||||
}catch (Exception e){
|
||||
log.error("${table.comment!}列表异常:{}", ExceptionsUtil.getStackTraceAsString(e));
|
||||
throw new ProjectException(${entity}Enum.PAGE_FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Caching(evict = {@CacheEvict(value = ${entity}CacheConstant.PAGE,allEntries = true),
|
||||
@CacheEvict(value = ${entity}CacheConstant.LIST,allEntries = true)},
|
||||
put={@CachePut(value =${entity}CacheConstant.BASIC,key = "#result.id")})
|
||||
@Override
|
||||
public ${entity}Vo create${entity}Vo(${entity}Vo ${entity?uncap_first}Vo) {
|
||||
try {
|
||||
${entity}Vo ${entity?uncap_first}VoResult = BeanConv.toBean(${entity?uncap_first}Service.create${entity}(${entity?uncap_first}Vo), ${entity}Vo.class);
|
||||
<#list cfg.tablesFile as tableFiile>
|
||||
<#if tableFiile==table.name>
|
||||
//绑定附件
|
||||
if (!EmptyUtil.isNullOrEmpty(${entity?uncap_first}VoResult)&&!EmptyUtil.isNullOrEmpty(${entity?uncap_first}Vo.getFileVOs())){
|
||||
${entity?uncap_first}Vo.getFileVOs().forEach(n->{n.setBusinessId(${entity?uncap_first}VoResult.getId());});
|
||||
//绑定图片
|
||||
ResponseResult<List<FileVO>> listResponseResult = fileFeign.bindBatchBusinessId(${entity?uncap_first}Vo.getFileVOs());
|
||||
${entity?uncap_first}VoResult.setFileVOs(listResponseResult.getDatas());
|
||||
}
|
||||
</#if>
|
||||
</#list>
|
||||
return ${entity?uncap_first}VoResult;
|
||||
} catch (Exception e) {
|
||||
log.error("保存${table.comment!}异常:{}", ExceptionsUtil.getStackTraceAsString(e));
|
||||
throw new ProjectException(${entity}Enum.SAVE_FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Caching(evict = {@CacheEvict(value = ${entity}CacheConstant.PAGE,allEntries = true),
|
||||
@CacheEvict(value = ${entity}CacheConstant.LIST,allEntries = true),
|
||||
@CacheEvict(value =${entity}CacheConstant.BASIC,key = "#${entity?uncap_first}Vo.id")})
|
||||
@Override
|
||||
public Boolean update${entity}Vo(${entity}Vo ${entity?uncap_first}Vo) {
|
||||
try {
|
||||
Boolean flag = ${entity?uncap_first}Service.update${entity}(${entity?uncap_first}Vo);
|
||||
<#list cfg.tablesFile as tableFiile>
|
||||
<#if tableFiile==table.name>
|
||||
if (flag){
|
||||
//移除业务原图片,并绑定新的图片到业务上
|
||||
fileFeign.replaceBindBatchBusinessId(${entity?uncap_first}Vo.getFileVOs());
|
||||
}
|
||||
</#if>
|
||||
</#list>
|
||||
return flag;
|
||||
} catch (Exception e) {
|
||||
log.error("修改${table.comment!}异常:{}", ExceptionsUtil.getStackTraceAsString(e));
|
||||
throw new ProjectException(${entity}Enum.UPDATE_FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Caching(evict = {@CacheEvict(value = ${entity}CacheConstant.PAGE,allEntries = true),
|
||||
@CacheEvict(value = ${entity}CacheConstant.LIST,allEntries = true)})
|
||||
@Override
|
||||
public Boolean delete${entity}Vo(String[] checkedIds) {
|
||||
try {
|
||||
Boolean flag = ${entity?uncap_first}Service.delete${entity}(checkedIds);
|
||||
<#list cfg.tablesFile as tableFiile>
|
||||
<#if tableFiile==table.name>
|
||||
if (flag){
|
||||
//删除图片
|
||||
for (String checkedId : checkedIds) {
|
||||
fileFeign.deleteFileVOByBusinessId(FileVO.builder()
|
||||
.businessId(Long.valueOf(checkedId))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
</#if>
|
||||
</#list>
|
||||
return flag;
|
||||
} catch (Exception e) {
|
||||
log.error("删除${table.comment!}异常:{}", ExceptionsUtil.getStackTraceAsString(e));
|
||||
throw new ProjectException(${entity}Enum.DEL_FAIL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(value = ${entity}CacheConstant.LIST,key ="#${entity?uncap_first}Vo.hashCode()")
|
||||
public List<${entity}Vo> find${entity}VoList(${entity}Vo ${entity?uncap_first}Vo) {
|
||||
try {
|
||||
List<${entity}Vo> records = BeanConv.toBeanList(${entity?uncap_first}Service.find${entity}List(${entity?uncap_first}Vo),${entity}Vo.class);
|
||||
<#list cfg.tablesFile as tableFiile>
|
||||
<#if tableFiile==table.name>
|
||||
//处理图片
|
||||
if (!EmptyUtil.isNullOrEmpty(records)){
|
||||
records.forEach(n->{
|
||||
ResponseResult<List<FileVO>> responseWrap = fileFeign
|
||||
.findFileVOByBusinessId(FileVO.builder().businessId(n.getId()).build());
|
||||
if (!EmptyUtil.isNullOrEmpty(responseWrap.getDatas())){
|
||||
n.setFileVOs(responseWrap.getDatas());
|
||||
}else {
|
||||
n.setFileVOs(new ArrayList<>());
|
||||
}
|
||||
});
|
||||
}
|
||||
</#if>
|
||||
</#list>
|
||||
return records;
|
||||
} catch (Exception e) {
|
||||
log.error("删除${table.comment!}异常:{}", ExceptionsUtil.getStackTraceAsString(e));
|
||||
throw new ProjectException(${entity}Enum.LIST_FAIL);
|
||||
}
|
||||
}
|
||||
}
|
||||
</#if>
|
||||
@@ -0,0 +1,15 @@
|
||||
package ${package.Mapper};
|
||||
|
||||
import ${package.Entity}.${entity};
|
||||
import ${superMapperClassPackage};
|
||||
|
||||
/**
|
||||
* @Description:${table.comment!}Mapper接口
|
||||
*/
|
||||
<#if kotlin>
|
||||
interface ${table.mapperName} : ${superMapperClass}<${entity}>
|
||||
<#else>
|
||||
public interface ${table.mapperName} extends ${superMapperClass}<${entity}> {
|
||||
|
||||
}
|
||||
</#if>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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="${package.Mapper}.${table.mapperName}">
|
||||
|
||||
<#if enableCache>
|
||||
<!-- 开启二级缓存 -->
|
||||
<cache type="org.mybatis.caches.ehcache.LoggingEhcache"/>
|
||||
|
||||
</#if>
|
||||
<#if baseResultMap>
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="${package.Entity}.${entity}">
|
||||
<#list table.fields as field>
|
||||
<#if field.keyFlag><#--生成主键排在第一位-->
|
||||
<id column="${field.name}" property="${field.propertyName}" />
|
||||
</#if>
|
||||
</#list>
|
||||
<#list table.commonFields as field><#--生成公共字段 -->
|
||||
<result column="${field.name}" property="${field.propertyName}" />
|
||||
</#list>
|
||||
<#list table.fields as field>
|
||||
<#if !field.keyFlag><#--生成普通字段 -->
|
||||
<result column="${field.name}" property="${field.propertyName}" />
|
||||
</#if>
|
||||
</#list>
|
||||
</resultMap>
|
||||
|
||||
</#if>
|
||||
<#if baseColumnList>
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
<#list table.commonFields as field>
|
||||
${field.name},
|
||||
</#list>
|
||||
${table.fieldNames}
|
||||
</sql>
|
||||
|
||||
</#if>
|
||||
</mapper>
|
||||
@@ -0,0 +1,55 @@
|
||||
package ${package.Service};
|
||||
|
||||
import ${package.Entity}.${entity};
|
||||
import ${superServiceClassPackage};
|
||||
import com.itheima.sfbx.framework.commons.dto.trade.${entity}Vo;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description:${table.comment!}服务类
|
||||
*/
|
||||
<#if kotlin>
|
||||
interface ${table.serviceName} : ${superServiceClass}<${entity}>
|
||||
<#else>
|
||||
public interface ${table.serviceName} extends ${superServiceClass}<${entity}> {
|
||||
|
||||
/**
|
||||
* @Description 多条件查询${table.comment!}分页列表
|
||||
* @param ${entity?uncap_first}Vo 查询条件
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 每页条数
|
||||
* @return Page<${entity}>
|
||||
*/
|
||||
Page<${entity}> find${entity}Page(${entity}Vo ${entity?uncap_first}Vo, int pageNum, int pageSize);
|
||||
|
||||
/**
|
||||
* @Description 创建${table.comment!}
|
||||
* @param ${entity?uncap_first}Vo 对象信息
|
||||
* @return ${entity}
|
||||
*/
|
||||
${entity} create${entity}(${entity}Vo ${entity?uncap_first}Vo);
|
||||
|
||||
/**
|
||||
* @Description 修改${table.comment!}
|
||||
* @param ${entity?uncap_first}Vo 对象信息
|
||||
* @return Boolean
|
||||
*/
|
||||
Boolean update${entity}(${entity}Vo ${entity?uncap_first}Vo);
|
||||
|
||||
/**
|
||||
* @Description 删除${table.comment!}
|
||||
* @param checkedIds 选择中对象Ids
|
||||
* @return Boolean
|
||||
*/
|
||||
Boolean delete${entity}(String[] checkedIds);
|
||||
|
||||
/**
|
||||
* @description 多条件查询${table.comment!}列表
|
||||
* @param ${entity?uncap_first}Vo 查询条件
|
||||
* @return: List<${entity}>
|
||||
*/
|
||||
List<${entity}> find${entity}List(${entity}Vo ${entity?uncap_first}Vo);
|
||||
}
|
||||
</#if>
|
||||
@@ -0,0 +1,100 @@
|
||||
package ${package.ServiceImpl};
|
||||
|
||||
import ${package.Entity}.${entity};
|
||||
import ${package.Mapper}.${table.mapperName};
|
||||
import ${package.Service}.${table.serviceName};
|
||||
import ${superServiceImplClassPackage};
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.itheima.sfbx.framework.commons.dto.trade.${entity}Vo;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.itheima.sfbx.framework.commons.utils.BeanConv;
|
||||
import com.itheima.sfbx.framework.commons.utils.EmptyUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
/**
|
||||
* @Description:${table.comment!}服务实现类
|
||||
*/
|
||||
@Service
|
||||
<#if kotlin>
|
||||
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {
|
||||
|
||||
}
|
||||
<#else>
|
||||
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
|
||||
|
||||
@Override
|
||||
public Page<${entity}> find${entity}Page(${entity}Vo ${entity?uncap_first}Vo, int pageNum, int pageSize) {
|
||||
//构建分页对象
|
||||
Page<${entity}> page = new Page<>(pageNum,pageSize);
|
||||
//构建查询条件
|
||||
QueryWrapper<${entity}> queryWrapper = new QueryWrapper<>();
|
||||
//构建多条件查询,代码生成后自己可自行调整
|
||||
<#list table.fields as field>
|
||||
//${field.comment}查询
|
||||
if (!EmptyUtil.isNullOrEmpty(${entity?uncap_first}Vo.get${field.propertyName?cap_first}())) {
|
||||
queryWrapper.lambda().eq(${entity}::get${field.propertyName?cap_first},${entity?uncap_first}Vo.get${field.propertyName?cap_first}());
|
||||
}
|
||||
</#list>
|
||||
//状态查询
|
||||
if (!EmptyUtil.isNullOrEmpty(${entity?uncap_first}Vo.getEnableFlag())) {
|
||||
queryWrapper.lambda().eq(${entity}::getEnableFlag,${entity?uncap_first}Vo.getEnableFlag());
|
||||
}
|
||||
//按创建时间降序
|
||||
queryWrapper.lambda().orderByDesc(${entity}::getCreatedTime);
|
||||
//执行分页查询
|
||||
return page(page, queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ${entity} create${entity}(${entity}Vo ${entity?uncap_first}Vo) {
|
||||
//转换${entity}Vo为${entity}
|
||||
${entity} ${entity?uncap_first} = BeanConv.toBean(${entity?uncap_first}Vo, ${entity}.class);
|
||||
boolean flag = save(${entity?uncap_first});
|
||||
if (flag){
|
||||
return ${entity?uncap_first};
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean update${entity}(${entity}Vo ${entity?uncap_first}Vo) {
|
||||
//转换${entity}Vo为${entity}
|
||||
${entity} ${entity?uncap_first} = BeanConv.toBean(${entity?uncap_first}Vo, ${entity}.class);
|
||||
return updateById(${entity?uncap_first});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean delete${entity}(String[] checkedIds) {
|
||||
//转换数组为集合
|
||||
List<String> ids = Arrays.asList(checkedIds);
|
||||
List<Long> idsLong = new ArrayList<>();
|
||||
ids.forEach(n->{
|
||||
idsLong.add(Long.valueOf(n));
|
||||
});
|
||||
return removeByIds(idsLong);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<${entity}> find${entity}List(${entity}Vo ${entity?uncap_first}Vo) {
|
||||
//构建查询条件
|
||||
QueryWrapper<${entity}> queryWrapper = new QueryWrapper<>();
|
||||
if (!EmptyUtil.isNullOrEmpty(${entity?uncap_first}Vo.getId())) {
|
||||
queryWrapper.lambda().eq(${entity}::getId,${entity?uncap_first}Vo.getId());
|
||||
}
|
||||
<#list table.fields as field>
|
||||
//${field.comment}查询
|
||||
if (!EmptyUtil.isNullOrEmpty(${entity?uncap_first}Vo.get${field.propertyName?cap_first}())) {
|
||||
queryWrapper.lambda().eq(${entity}::get${field.propertyName?cap_first},${entity?uncap_first}Vo.get${field.propertyName?cap_first}());
|
||||
}
|
||||
</#list>
|
||||
//状态查询
|
||||
if (!EmptyUtil.isNullOrEmpty(${entity?uncap_first}Vo.getEnableFlag())) {
|
||||
queryWrapper.lambda().eq(${entity}::getEnableFlag,${entity?uncap_first}Vo.getEnableFlag());
|
||||
}
|
||||
return list(queryWrapper);
|
||||
}
|
||||
}
|
||||
</#if>
|
||||
@@ -0,0 +1,54 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover">
|
||||
<title>店铺商品详情</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app">
|
||||
<h1>商品信息json</h1>
|
||||
<div>
|
||||
${shopGoods}
|
||||
</div>
|
||||
<#-- <div>-->
|
||||
<#-- <h1>-->
|
||||
<#-- 封面图片列表-->
|
||||
<#-- </h1>-->
|
||||
<#-- <ul>-->
|
||||
<#-- <li>路径: <a href=""> </a></li>-->
|
||||
<#-- </ul>-->
|
||||
<#-- </div>-->
|
||||
<#-- <div>-->
|
||||
<#-- <h1>-->
|
||||
<#-- 商品基本信息-->
|
||||
<#-- </h1>-->
|
||||
<#-- <p> 优惠价: <span> </span> 原价: <span> </span> </p>-->
|
||||
<#-- -->
|
||||
<#-- <p>标题: <span> </span></p>-->
|
||||
|
||||
<#-- <p>当前规格: </p>-->
|
||||
<#-- -->
|
||||
<#-- <p>所有规格: </p>-->
|
||||
|
||||
<#-- <p>服务规则列表: </p>-->
|
||||
|
||||
<#-- </div>-->
|
||||
<#-- <div>-->
|
||||
<#-- <h1>-->
|
||||
<#-- 商品详情图片列表-->
|
||||
<#-- </h1>-->
|
||||
<#-- <ul>-->
|
||||
<#-- <li>路径: <a href=""> </a></li>-->
|
||||
<#-- </ul>-->
|
||||
<#-- </div>-->
|
||||
|
||||
<p>参数列表: 未提供</p>
|
||||
<p>评价列表: 异步ajax查询</p>
|
||||
<p>优惠券: 异步查询</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.itheima.easy.vo;
|
||||
|
||||
import com.itheima.easy.basic.BasicVo;
|
||||
<#if swagger2>
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
</#if>
|
||||
<#if entityLombokModel>
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
</#if>
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
<#list cfg.tablesFile as tableFiile>
|
||||
<#if tableFiile==table.name>
|
||||
import java.util.List;
|
||||
import com.itheima.sfbx.framework.commons.dto.file.FileVO;
|
||||
</#if>
|
||||
</#list>
|
||||
/**
|
||||
* @Description:${table.comment!}
|
||||
*/
|
||||
<#if entityLombokModel>
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
</#if>
|
||||
public class ${entity}Vo extends BasicVo {
|
||||
|
||||
@Builder
|
||||
public ${entity}Vo(Long id,<#list table.fields as field>${field.propertyType} ${field.propertyName}<#if field_has_next>,</#if></#list>){
|
||||
super(id);
|
||||
<#list table.fields as field>
|
||||
this.${field.propertyName}=${field.propertyName};
|
||||
</#list>
|
||||
}
|
||||
<#-- ---------- BEGIN 字段循环遍历 ---------->
|
||||
<#list table.fields as field>
|
||||
<#if field.keyFlag>
|
||||
<#assign keyPropertyName="${field.propertyName}"/>
|
||||
</#if>
|
||||
|
||||
<#if field.comment!?length gt 0>
|
||||
<#if swagger2>
|
||||
@ApiModelProperty(value = "${field.comment}")
|
||||
<#else>
|
||||
/**
|
||||
* ${field.comment}
|
||||
*/
|
||||
</#if>
|
||||
</#if>
|
||||
<#if field.propertyType=='Long'>
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING)
|
||||
</#if>
|
||||
<#if field.propertyType=='Date'>
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
</#if>
|
||||
private ${field.propertyType} ${field.propertyName};
|
||||
</#list>
|
||||
<#------------ END 字段循环遍历 ---------->
|
||||
|
||||
@ApiModelProperty(value = "选中节点")
|
||||
private String[] checkedIds;
|
||||
|
||||
<#list cfg.tablesFile as tableFiile>
|
||||
<#if tableFiile==table.name>
|
||||
<#if swagger2>
|
||||
@ApiModelProperty(value = "文件Vo对象")
|
||||
</#if>
|
||||
private List<FileVO> fileVOs;
|
||||
</#if>
|
||||
</#list>
|
||||
}
|
||||
Reference in New Issue
Block a user