| | |
| | | |
| | | # 数据采集模块 |
| | | gather: |
| | | enabled: true |
| | | enabled: true |
| | | |
| | | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| | | # 业务功能配置参数 |
| | | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| | | recommend: |
| | | |
| | | video: |
| | | # 视频采集存储根路径 |
| | | data-folder: D:/dev_tools/ai/ |
| | |
| | | <module>recommend-common</module> |
| | | <module>recommend-text</module> |
| | | <module>recommend-video</module> |
| | | <module>recommend-model-pojo</module> |
| | | <module>deploy-jar-template</module> |
| | | </modules> |
| | | |
| | |
| | | <recommend-common.version>1.0.0-SNAPSHOT</recommend-common.version> |
| | | <recommend-text.version>1.0.0-SNAPSHOT</recommend-text.version> |
| | | <recommend-video.version>1.0.0-SNAPSHOT</recommend-video.version> |
| | | <recommend-model-pojo.version>1.0.0-SNAPSHOT</recommend-model-pojo.version> |
| | | <deploy-jar-template.version>1.0.0-SNAPSHOT</deploy-jar-template.version> |
| | | </properties> |
| | | |
| | |
| | | <version>${recommend-video.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 接口对象(pojo)模块,2022/09/22 --> |
| | | <dependency> |
| | | <groupId>com.iplatform</groupId> |
| | | <artifactId>recommend-model-pojo</artifactId> |
| | | <version>${recommend-model-pojo.version}</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | </dependencyManagement> |
| | | |
New file |
| | |
| | | package com.iplatform.reccommon; |
| | | |
| | | /** |
| | | * 采集任务类型定义。 |
| | | */ |
| | | public enum TaskType { |
| | | |
| | | VideoLoad { |
| | | public String getIndex(){ |
| | | return INDEX_VIDEO_LOAD; |
| | | } |
| | | }, |
| | | TextLoad { |
| | | public String getIndex(){ |
| | | return INDEX_TEXT_LOAD; |
| | | } |
| | | }; |
| | | |
| | | public String getIndex(){ |
| | | throw new AbstractMethodError(); |
| | | } |
| | | |
| | | public static final TaskType getType(String index){ |
| | | if(index.equals(INDEX_VIDEO_LOAD)){ |
| | | return VideoLoad; |
| | | } else if(index.equals(INDEX_TEXT_LOAD)){ |
| | | return TextLoad; |
| | | } else { |
| | | throw new UnsupportedOperationException("index '" + index + "' is not supported!"); |
| | | } |
| | | } |
| | | |
| | | public static final String INDEX_VIDEO_LOAD = "video_load"; |
| | | public static final String INDEX_TEXT_LOAD = "text_load"; |
| | | |
| | | } |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | |
| | | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| | | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>train_recommend</artifactId> |
| | | <groupId>com.iplatform</groupId> |
| | | <version>1.0.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>recommend-model-pojo</artifactId> |
| | | <name>recommend-model-pojo</name> |
| | | <packaging>jar</packaging> |
| | | |
| | | <properties> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <!-- jdbc pojo通用依赖 --> |
| | | <dependency> |
| | | <groupId>com.walkersoft</groupId> |
| | | <artifactId>walker-jdbc-common</artifactId> |
| | | </dependency> |
| | | <!-- json注解:属性绑定依赖 --> |
| | | <dependency> |
| | | <groupId>com.fasterxml.jackson.core</groupId> |
| | | <artifactId>jackson-databind</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.iplatform.model.po; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonAutoDetect; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.walker.jdbc.BasePo; |
| | | |
| | | /** |
| | | * 表名:RC_TASK_STATUS * |
| | | * @author genrator |
| | | */ |
| | | @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) |
| | | public class Rc_task_status extends BasePo<Rc_task_status> { |
| | | // 序列化版本号 |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 用于兼容老写法 |
| | | */ |
| | | @JsonIgnore |
| | | public static final Rc_task_status ROW_MAPPER = new Rc_task_status(); |
| | | |
| | | // 主键 |
| | | private Long id = null; |
| | | @JsonIgnore |
| | | protected boolean isset_id = false; |
| | | |
| | | // 属性列表 |
| | | private Long create_time = null; |
| | | @JsonIgnore |
| | | protected boolean isset_create_time = false; |
| | | |
| | | private String name = null; |
| | | @JsonIgnore |
| | | protected boolean isset_name = false; |
| | | |
| | | private Long last_value = null; |
| | | @JsonIgnore |
| | | protected boolean isset_last_value = false; |
| | | |
| | | private String status = null; |
| | | @JsonIgnore |
| | | protected boolean isset_status = false; |
| | | |
| | | private Long start_time = null; |
| | | @JsonIgnore |
| | | protected boolean isset_start_time = false; |
| | | |
| | | private Long end_time = null; |
| | | @JsonIgnore |
| | | protected boolean isset_end_time = false; |
| | | |
| | | private String msg = null; |
| | | @JsonIgnore |
| | | protected boolean isset_msg = false; |
| | | |
| | | private String task_type = null; |
| | | @JsonIgnore |
| | | protected boolean isset_task_type = false; |
| | | |
| | | /** |
| | | * 默认构造函数 |
| | | */ |
| | | public Rc_task_status() { |
| | | } |
| | | |
| | | /** |
| | | * 根据主键构造对象 |
| | | */ |
| | | public Rc_task_status(Long id) { |
| | | this.setId(id); |
| | | } |
| | | |
| | | /** |
| | | * 设置主键值 |
| | | */ |
| | | @Override |
| | | public void setPkValue(Object value) { |
| | | this.setId((Long) value); |
| | | } |
| | | |
| | | public Long getId() { |
| | | return this.id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | this.isset_id = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptyId() { |
| | | return this.id == null; |
| | | } |
| | | |
| | | public Long getCreate_time() { |
| | | return this.create_time; |
| | | } |
| | | |
| | | public void setCreate_time(Long create_time) { |
| | | this.create_time = create_time; |
| | | this.isset_create_time = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptyCreate_time() { |
| | | return this.create_time == null; |
| | | } |
| | | |
| | | public String getName() { |
| | | return this.name; |
| | | } |
| | | |
| | | public void setName(String name) { |
| | | this.name = name; |
| | | this.isset_name = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptyName() { |
| | | return this.name == null || this.name.length() == 0; |
| | | } |
| | | |
| | | public Long getLast_value() { |
| | | return this.last_value; |
| | | } |
| | | |
| | | public void setLast_value(Long last_value) { |
| | | this.last_value = last_value; |
| | | this.isset_last_value = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptyLast_value() { |
| | | return this.last_value == null; |
| | | } |
| | | |
| | | public String getStatus() { |
| | | return this.status; |
| | | } |
| | | |
| | | public void setStatus(String status) { |
| | | this.status = status; |
| | | this.isset_status = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptyStatus() { |
| | | return this.status == null || this.status.length() == 0; |
| | | } |
| | | |
| | | public Long getStart_time() { |
| | | return this.start_time; |
| | | } |
| | | |
| | | public void setStart_time(Long start_time) { |
| | | this.start_time = start_time; |
| | | this.isset_start_time = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptyStart_time() { |
| | | return this.start_time == null; |
| | | } |
| | | |
| | | public Long getEnd_time() { |
| | | return this.end_time; |
| | | } |
| | | |
| | | public void setEnd_time(Long end_time) { |
| | | this.end_time = end_time; |
| | | this.isset_end_time = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptyEnd_time() { |
| | | return this.end_time == null; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return this.msg; |
| | | } |
| | | |
| | | public void setMsg(String msg) { |
| | | this.msg = msg; |
| | | this.isset_msg = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptyMsg() { |
| | | return this.msg == null || this.msg.length() == 0; |
| | | } |
| | | |
| | | public String getTask_type() { |
| | | return this.task_type; |
| | | } |
| | | |
| | | public void setTask_type(String task_type) { |
| | | this.task_type = task_type; |
| | | this.isset_task_type = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptyTask_type() { |
| | | return this.task_type == null || this.task_type.length() == 0; |
| | | } |
| | | |
| | | /** |
| | | * 重写 toString() 方法 |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | return new StringBuilder() |
| | | .append("id=").append(this.id) |
| | | .append("create_time=").append(this.create_time) |
| | | .append("name=").append(this.name) |
| | | .append("last_value=").append(this.last_value) |
| | | .append("status=").append(this.status) |
| | | .append("start_time=").append(this.start_time) |
| | | .append("end_time=").append(this.end_time) |
| | | .append("msg=").append(this.msg) |
| | | .append("task_type=").append(this.task_type) |
| | | .toString(); |
| | | } |
| | | |
| | | /** |
| | | * 克隆 |
| | | */ |
| | | public Rc_task_status $clone() { |
| | | Rc_task_status rc_task_status = new Rc_task_status(); |
| | | |
| | | // 数据库名称 |
| | | //rc_task_status.setDatabaseName_(this.getDatabaseName_()); |
| | | |
| | | // 主键 |
| | | if (this.isset_id) { |
| | | rc_task_status.setId(this.getId()); |
| | | } |
| | | // 普通属性 |
| | | if (this.isset_create_time) { |
| | | rc_task_status.setCreate_time(this.getCreate_time()); |
| | | } |
| | | if (this.isset_name) { |
| | | rc_task_status.setName(this.getName()); |
| | | } |
| | | if (this.isset_last_value) { |
| | | rc_task_status.setLast_value(this.getLast_value()); |
| | | } |
| | | if (this.isset_status) { |
| | | rc_task_status.setStatus(this.getStatus()); |
| | | } |
| | | if (this.isset_start_time) { |
| | | rc_task_status.setStart_time(this.getStart_time()); |
| | | } |
| | | if (this.isset_end_time) { |
| | | rc_task_status.setEnd_time(this.getEnd_time()); |
| | | } |
| | | if (this.isset_msg) { |
| | | rc_task_status.setMsg(this.getMsg()); |
| | | } |
| | | if (this.isset_task_type) { |
| | | rc_task_status.setTask_type(this.getTask_type()); |
| | | } |
| | | return rc_task_status; |
| | | } |
| | | } |
New file |
| | |
| | | package com.iplatform.model.po; |
| | | |
| | | import com.walker.jdbc.BaseMapper; |
| | | import com.walker.jdbc.ResultSetUtils; |
| | | import com.walker.jdbc.SqlAndParameters; |
| | | import com.walker.jdbc.sqlgen.DeleteBuilder; |
| | | import com.walker.jdbc.sqlgen.InsertBuilder; |
| | | import com.walker.jdbc.sqlgen.SelectBuilder; |
| | | import com.walker.jdbc.sqlgen.UpdateBuilder; |
| | | import com.walker.jdbc.util.StringUtils; |
| | | |
| | | import org.springframework.jdbc.core.RowMapper; |
| | | |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 表名:RC_TASK_STATUS * |
| | | * @author genrator |
| | | */ |
| | | public class Rc_task_status_mapper extends Rc_task_status implements BaseMapper<Rc_task_status> { |
| | | // 序列化版本号 |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public static final RowMapper<Rc_task_status> ROW_MAPPER = new Rc_task_statusRowMapper(); |
| | | |
| | | // 主键 |
| | | public static final String ID = "id"; |
| | | // 普通属性 |
| | | public static final String CREATE_TIME = "create_time"; |
| | | public static final String NAME = "name"; |
| | | public static final String LAST_VALUE = "last_value"; |
| | | public static final String STATUS = "status"; |
| | | public static final String START_TIME = "start_time"; |
| | | public static final String END_TIME = "end_time"; |
| | | public static final String MSG = "msg"; |
| | | public static final String TASK_TYPE = "task_type"; |
| | | |
| | | /** |
| | | * 默认构造函数 |
| | | */ |
| | | public Rc_task_status_mapper(Rc_task_status rc_task_status) { |
| | | if (rc_task_status == null) { |
| | | throw new IllegalArgumentException("po参数不允许为空!"); |
| | | } |
| | | //主键 |
| | | if (rc_task_status.isset_id) { |
| | | this.setId(rc_task_status.getId()); |
| | | } |
| | | //普通属性 |
| | | if (rc_task_status.isset_create_time) { |
| | | this.setCreate_time(rc_task_status.getCreate_time()); |
| | | } |
| | | if (rc_task_status.isset_name) { |
| | | this.setName(rc_task_status.getName()); |
| | | } |
| | | if (rc_task_status.isset_last_value) { |
| | | this.setLast_value(rc_task_status.getLast_value()); |
| | | } |
| | | if (rc_task_status.isset_status) { |
| | | this.setStatus(rc_task_status.getStatus()); |
| | | } |
| | | if (rc_task_status.isset_start_time) { |
| | | this.setStart_time(rc_task_status.getStart_time()); |
| | | } |
| | | if (rc_task_status.isset_end_time) { |
| | | this.setEnd_time(rc_task_status.getEnd_time()); |
| | | } |
| | | if (rc_task_status.isset_msg) { |
| | | this.setMsg(rc_task_status.getMsg()); |
| | | } |
| | | if (rc_task_status.isset_task_type) { |
| | | this.setTask_type(rc_task_status.getTask_type()); |
| | | } |
| | | // 去掉,2022-09-07 |
| | | // this.setDatabaseName_(rc_task_status.getDatabaseName_()); |
| | | } |
| | | |
| | | /** |
| | | * 获取表名 |
| | | */ |
| | | @Override |
| | | public String getTableName_() { |
| | | String tableName = "rc_task_status"; |
| | | /** |
| | | if (StringUtils.isNotEmpty(this.getDatabaseName_())) { |
| | | return this.getDatabaseName_() + "." + tableName; |
| | | } else { |
| | | return tableName; |
| | | } |
| | | */ |
| | | return tableName; |
| | | } |
| | | |
| | | /** |
| | | * 获取主键名称 |
| | | */ |
| | | @Override |
| | | public String getPkName_() { |
| | | return ID; |
| | | } |
| | | |
| | | /** |
| | | * 获取主键值 |
| | | */ |
| | | @Override |
| | | public Object getPkValue_() { |
| | | return this.getId(); |
| | | } |
| | | |
| | | /** |
| | | * 获取插入语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getInsertSql_() { |
| | | InsertBuilder ib = new InsertBuilder(this.getTableName_()); |
| | | ib.set(ID, this.getId()); |
| | | ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); |
| | | ib.set(NAME, this.getName(), this.isset_name); |
| | | ib.set(LAST_VALUE, this.getLast_value(), this.isset_last_value); |
| | | ib.set(STATUS, this.getStatus(), this.isset_status); |
| | | ib.set(START_TIME, this.getStart_time(), this.isset_start_time); |
| | | ib.set(END_TIME, this.getEnd_time(), this.isset_end_time); |
| | | ib.set(MSG, this.getMsg(), this.isset_msg); |
| | | ib.set(TASK_TYPE, this.getTask_type(), this.isset_task_type); |
| | | return ib.genMapSql(); |
| | | } |
| | | |
| | | /** |
| | | * 获取更新语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getUpdateSql_() { |
| | | UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); |
| | | ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); |
| | | ub.set(NAME, this.getName(), this.isset_name); |
| | | ub.set(LAST_VALUE, this.getLast_value(), this.isset_last_value); |
| | | ub.set(STATUS, this.getStatus(), this.isset_status); |
| | | ub.set(START_TIME, this.getStart_time(), this.isset_start_time); |
| | | ub.set(END_TIME, this.getEnd_time(), this.isset_end_time); |
| | | ub.set(MSG, this.getMsg(), this.isset_msg); |
| | | ub.set(TASK_TYPE, this.getTask_type(), this.isset_task_type); |
| | | ub.where(this.getPkName_(), this.getPkValue_()); |
| | | return ub.genMapSql(); |
| | | } |
| | | |
| | | /** |
| | | * 获取更新语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { |
| | | UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); |
| | | ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); |
| | | ub.set(NAME, this.getName(), this.isset_name); |
| | | ub.set(LAST_VALUE, this.getLast_value(), this.isset_last_value); |
| | | ub.set(STATUS, this.getStatus(), this.isset_status); |
| | | ub.set(START_TIME, this.getStart_time(), this.isset_start_time); |
| | | ub.set(END_TIME, this.getEnd_time(), this.isset_end_time); |
| | | ub.set(MSG, this.getMsg(), this.isset_msg); |
| | | ub.set(TASK_TYPE, this.getTask_type(), this.isset_task_type); |
| | | |
| | | return ub.genMapSql(where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 获取更新语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { |
| | | UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); |
| | | ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); |
| | | ub.set(NAME, this.getName(), this.isset_name); |
| | | ub.set(LAST_VALUE, this.getLast_value(), this.isset_last_value); |
| | | ub.set(STATUS, this.getStatus(), this.isset_status); |
| | | ub.set(START_TIME, this.getStart_time(), this.isset_start_time); |
| | | ub.set(END_TIME, this.getEnd_time(), this.isset_end_time); |
| | | ub.set(MSG, this.getMsg(), this.isset_msg); |
| | | ub.set(TASK_TYPE, this.getTask_type(), this.isset_task_type); |
| | | |
| | | return ub.genArraySql(where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 获取删除语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getDeleteSql_() { |
| | | DeleteBuilder db = new DeleteBuilder(this.getTableName_()); |
| | | db.where(this.getPkName_(), this.getPkValue_()); |
| | | return db.genMapSql(); |
| | | } |
| | | |
| | | /** |
| | | * 获取删除语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { |
| | | DeleteBuilder db = new DeleteBuilder(this.getTableName_()); |
| | | return db.genMapSql(where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 获取删除语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { |
| | | DeleteBuilder db = new DeleteBuilder(this.getTableName_()); |
| | | return db.genArraySql(where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 获取单行查询语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getSingleSql_() { |
| | | SelectBuilder sb = new SelectBuilder(this.getTableName_()); |
| | | sb.where(this.getPkName_(), this.getPkValue_()); |
| | | return sb.genMapSql(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取查询语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { |
| | | return new SqlAndParameters<>("select id, create_time, name, last_value, status, start_time, end_time, msg, task_type from " + this.getTableName_() + " " + where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 获取查询语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { |
| | | return new SqlAndParameters<>("select id, create_time, name, last_value, status, start_time, end_time, msg, task_type from " + this.getTableName_() + " " + where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 将resultset的一行转化为po |
| | | */ |
| | | @Override |
| | | public Rc_task_status mapRow(ResultSet rs, int i) throws SQLException { |
| | | return ROW_MAPPER.mapRow(rs, i); |
| | | } |
| | | |
| | | /** |
| | | * 克隆 |
| | | */ |
| | | public Rc_task_status toRc_task_status() { |
| | | return super.$clone(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * rc_task_status RowMapper |
| | | * |
| | | * @author genrator |
| | | */ |
| | | class Rc_task_statusRowMapper implements RowMapper<Rc_task_status> { |
| | | |
| | | @Override |
| | | public Rc_task_status mapRow(ResultSet rs, int i) throws SQLException { |
| | | ResultSetUtils resultSetUtils = new ResultSetUtils(); |
| | | Rc_task_status rc_task_status = new Rc_task_status(); |
| | | Integer columnIndex; |
| | | //主键 |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_task_status_mapper.ID); |
| | | if (columnIndex > 0) { |
| | | rc_task_status.setId(rs.getLong(columnIndex)); |
| | | } |
| | | //普通属性 |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_task_status_mapper.CREATE_TIME); |
| | | if (columnIndex > 0) { |
| | | if (rs.getBigDecimal(columnIndex) == null) { |
| | | rc_task_status.setCreate_time(null); |
| | | } else { |
| | | rc_task_status.setCreate_time(rs.getLong(columnIndex)); |
| | | } |
| | | } |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_task_status_mapper.NAME); |
| | | if (columnIndex > 0) { |
| | | rc_task_status.setName(rs.getString(columnIndex)); |
| | | } |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_task_status_mapper.LAST_VALUE); |
| | | if (columnIndex > 0) { |
| | | if (rs.getBigDecimal(columnIndex) == null) { |
| | | rc_task_status.setLast_value(null); |
| | | } else { |
| | | rc_task_status.setLast_value(rs.getLong(columnIndex)); |
| | | } |
| | | } |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_task_status_mapper.STATUS); |
| | | if (columnIndex > 0) { |
| | | rc_task_status.setStatus(rs.getString(columnIndex)); |
| | | } |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_task_status_mapper.START_TIME); |
| | | if (columnIndex > 0) { |
| | | if (rs.getBigDecimal(columnIndex) == null) { |
| | | rc_task_status.setStart_time(null); |
| | | } else { |
| | | rc_task_status.setStart_time(rs.getLong(columnIndex)); |
| | | } |
| | | } |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_task_status_mapper.END_TIME); |
| | | if (columnIndex > 0) { |
| | | if (rs.getBigDecimal(columnIndex) == null) { |
| | | rc_task_status.setEnd_time(null); |
| | | } else { |
| | | rc_task_status.setEnd_time(rs.getLong(columnIndex)); |
| | | } |
| | | } |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_task_status_mapper.MSG); |
| | | if (columnIndex > 0) { |
| | | rc_task_status.setMsg(rs.getString(columnIndex)); |
| | | } |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_task_status_mapper.TASK_TYPE); |
| | | if (columnIndex > 0) { |
| | | rc_task_status.setTask_type(rs.getString(columnIndex)); |
| | | } |
| | | return rc_task_status; |
| | | } |
| | | } |
New file |
| | |
| | | package com.iplatform.model.po; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonAutoDetect; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.walker.jdbc.BasePo; |
| | | |
| | | /** |
| | | * 表名:RC_VIDEO_T1 * |
| | | * @author genrator |
| | | */ |
| | | @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) |
| | | public class Rc_video_t1 extends BasePo<Rc_video_t1> { |
| | | // 序列化版本号 |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 用于兼容老写法 |
| | | */ |
| | | @JsonIgnore |
| | | public static final Rc_video_t1 ROW_MAPPER = new Rc_video_t1(); |
| | | |
| | | // 主键 |
| | | private String id = null; |
| | | @JsonIgnore |
| | | protected boolean isset_id = false; |
| | | |
| | | // 属性列表 |
| | | private String src_img = null; |
| | | @JsonIgnore |
| | | protected boolean isset_src_img = false; |
| | | |
| | | private String src_video_id = null; |
| | | @JsonIgnore |
| | | protected boolean isset_src_video_id = false; |
| | | |
| | | private String sim_video_id = null; |
| | | @JsonIgnore |
| | | protected boolean isset_sim_video_id = false; |
| | | |
| | | private Double distance = null; |
| | | @JsonIgnore |
| | | protected boolean isset_distance = false; |
| | | |
| | | /** |
| | | * 默认构造函数 |
| | | */ |
| | | public Rc_video_t1() { |
| | | } |
| | | |
| | | /** |
| | | * 根据主键构造对象 |
| | | */ |
| | | public Rc_video_t1(String id) { |
| | | this.setId(id); |
| | | } |
| | | |
| | | /** |
| | | * 设置主键值 |
| | | */ |
| | | @Override |
| | | public void setPkValue(Object value) { |
| | | this.setId((String) value); |
| | | } |
| | | |
| | | public String getId() { |
| | | return this.id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | this.isset_id = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptyId() { |
| | | return this.id == null || this.id.length() == 0; |
| | | } |
| | | |
| | | public String getSrc_img() { |
| | | return this.src_img; |
| | | } |
| | | |
| | | public void setSrc_img(String src_img) { |
| | | this.src_img = src_img; |
| | | this.isset_src_img = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptySrc_img() { |
| | | return this.src_img == null || this.src_img.length() == 0; |
| | | } |
| | | |
| | | public String getSrc_video_id() { |
| | | return this.src_video_id; |
| | | } |
| | | |
| | | public void setSrc_video_id(String src_video_id) { |
| | | this.src_video_id = src_video_id; |
| | | this.isset_src_video_id = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptySrc_video_id() { |
| | | return this.src_video_id == null || this.src_video_id.length() == 0; |
| | | } |
| | | |
| | | public String getSim_video_id() { |
| | | return this.sim_video_id; |
| | | } |
| | | |
| | | public void setSim_video_id(String sim_video_id) { |
| | | this.sim_video_id = sim_video_id; |
| | | this.isset_sim_video_id = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptySim_video_id() { |
| | | return this.sim_video_id == null || this.sim_video_id.length() == 0; |
| | | } |
| | | |
| | | public Double getDistance() { |
| | | return this.distance; |
| | | } |
| | | |
| | | public void setDistance(Double distance) { |
| | | this.distance = distance; |
| | | this.isset_distance = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptyDistance() { |
| | | return this.distance == null; |
| | | } |
| | | |
| | | /** |
| | | * 重写 toString() 方法 |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | return new StringBuilder() |
| | | .append("id=").append(this.id) |
| | | .append("src_img=").append(this.src_img) |
| | | .append("src_video_id=").append(this.src_video_id) |
| | | .append("sim_video_id=").append(this.sim_video_id) |
| | | .append("distance=").append(this.distance) |
| | | .toString(); |
| | | } |
| | | |
| | | /** |
| | | * 克隆 |
| | | */ |
| | | public Rc_video_t1 $clone() { |
| | | Rc_video_t1 rc_video_t1 = new Rc_video_t1(); |
| | | |
| | | // 数据库名称 |
| | | //rc_video_t1.setDatabaseName_(this.getDatabaseName_()); |
| | | |
| | | // 主键 |
| | | if (this.isset_id) { |
| | | rc_video_t1.setId(this.getId()); |
| | | } |
| | | // 普通属性 |
| | | if (this.isset_src_img) { |
| | | rc_video_t1.setSrc_img(this.getSrc_img()); |
| | | } |
| | | if (this.isset_src_video_id) { |
| | | rc_video_t1.setSrc_video_id(this.getSrc_video_id()); |
| | | } |
| | | if (this.isset_sim_video_id) { |
| | | rc_video_t1.setSim_video_id(this.getSim_video_id()); |
| | | } |
| | | if (this.isset_distance) { |
| | | rc_video_t1.setDistance(this.getDistance()); |
| | | } |
| | | return rc_video_t1; |
| | | } |
| | | } |
New file |
| | |
| | | package com.iplatform.model.po; |
| | | |
| | | import com.walker.jdbc.BaseMapper; |
| | | import com.walker.jdbc.ResultSetUtils; |
| | | import com.walker.jdbc.SqlAndParameters; |
| | | import com.walker.jdbc.sqlgen.DeleteBuilder; |
| | | import com.walker.jdbc.sqlgen.InsertBuilder; |
| | | import com.walker.jdbc.sqlgen.SelectBuilder; |
| | | import com.walker.jdbc.sqlgen.UpdateBuilder; |
| | | import com.walker.jdbc.util.StringUtils; |
| | | |
| | | import org.springframework.jdbc.core.RowMapper; |
| | | |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 表名:RC_VIDEO_T1 * |
| | | * @author genrator |
| | | */ |
| | | public class Rc_video_t1_mapper extends Rc_video_t1 implements BaseMapper<Rc_video_t1> { |
| | | // 序列化版本号 |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public static final RowMapper<Rc_video_t1> ROW_MAPPER = new Rc_video_t1RowMapper(); |
| | | |
| | | // 主键 |
| | | public static final String ID = "id"; |
| | | // 普通属性 |
| | | public static final String SRC_IMG = "src_img"; |
| | | public static final String SRC_VIDEO_ID = "src_video_id"; |
| | | public static final String SIM_VIDEO_ID = "sim_video_id"; |
| | | public static final String DISTANCE = "distance"; |
| | | |
| | | /** |
| | | * 默认构造函数 |
| | | */ |
| | | public Rc_video_t1_mapper(Rc_video_t1 rc_video_t1) { |
| | | if (rc_video_t1 == null) { |
| | | throw new IllegalArgumentException("po参数不允许为空!"); |
| | | } |
| | | //主键 |
| | | if (rc_video_t1.isset_id) { |
| | | this.setId(rc_video_t1.getId()); |
| | | } |
| | | //普通属性 |
| | | if (rc_video_t1.isset_src_img) { |
| | | this.setSrc_img(rc_video_t1.getSrc_img()); |
| | | } |
| | | if (rc_video_t1.isset_src_video_id) { |
| | | this.setSrc_video_id(rc_video_t1.getSrc_video_id()); |
| | | } |
| | | if (rc_video_t1.isset_sim_video_id) { |
| | | this.setSim_video_id(rc_video_t1.getSim_video_id()); |
| | | } |
| | | if (rc_video_t1.isset_distance) { |
| | | this.setDistance(rc_video_t1.getDistance()); |
| | | } |
| | | // 去掉,2022-09-07 |
| | | // this.setDatabaseName_(rc_video_t1.getDatabaseName_()); |
| | | } |
| | | |
| | | /** |
| | | * 获取表名 |
| | | */ |
| | | @Override |
| | | public String getTableName_() { |
| | | String tableName = "rc_video_t1"; |
| | | /** |
| | | if (StringUtils.isNotEmpty(this.getDatabaseName_())) { |
| | | return this.getDatabaseName_() + "." + tableName; |
| | | } else { |
| | | return tableName; |
| | | } |
| | | */ |
| | | return tableName; |
| | | } |
| | | |
| | | /** |
| | | * 获取主键名称 |
| | | */ |
| | | @Override |
| | | public String getPkName_() { |
| | | return ID; |
| | | } |
| | | |
| | | /** |
| | | * 获取主键值 |
| | | */ |
| | | @Override |
| | | public Object getPkValue_() { |
| | | return this.getId(); |
| | | } |
| | | |
| | | /** |
| | | * 获取插入语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getInsertSql_() { |
| | | InsertBuilder ib = new InsertBuilder(this.getTableName_()); |
| | | ib.set(ID, this.getId()); |
| | | ib.set(SRC_IMG, this.getSrc_img(), this.isset_src_img); |
| | | ib.set(SRC_VIDEO_ID, this.getSrc_video_id(), this.isset_src_video_id); |
| | | ib.set(SIM_VIDEO_ID, this.getSim_video_id(), this.isset_sim_video_id); |
| | | ib.set(DISTANCE, this.getDistance(), this.isset_distance); |
| | | return ib.genMapSql(); |
| | | } |
| | | |
| | | /** |
| | | * 获取更新语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getUpdateSql_() { |
| | | UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); |
| | | ub.set(SRC_IMG, this.getSrc_img(), this.isset_src_img); |
| | | ub.set(SRC_VIDEO_ID, this.getSrc_video_id(), this.isset_src_video_id); |
| | | ub.set(SIM_VIDEO_ID, this.getSim_video_id(), this.isset_sim_video_id); |
| | | ub.set(DISTANCE, this.getDistance(), this.isset_distance); |
| | | ub.where(this.getPkName_(), this.getPkValue_()); |
| | | return ub.genMapSql(); |
| | | } |
| | | |
| | | /** |
| | | * 获取更新语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { |
| | | UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); |
| | | ub.set(SRC_IMG, this.getSrc_img(), this.isset_src_img); |
| | | ub.set(SRC_VIDEO_ID, this.getSrc_video_id(), this.isset_src_video_id); |
| | | ub.set(SIM_VIDEO_ID, this.getSim_video_id(), this.isset_sim_video_id); |
| | | ub.set(DISTANCE, this.getDistance(), this.isset_distance); |
| | | |
| | | return ub.genMapSql(where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 获取更新语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { |
| | | UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); |
| | | ub.set(SRC_IMG, this.getSrc_img(), this.isset_src_img); |
| | | ub.set(SRC_VIDEO_ID, this.getSrc_video_id(), this.isset_src_video_id); |
| | | ub.set(SIM_VIDEO_ID, this.getSim_video_id(), this.isset_sim_video_id); |
| | | ub.set(DISTANCE, this.getDistance(), this.isset_distance); |
| | | |
| | | return ub.genArraySql(where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 获取删除语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getDeleteSql_() { |
| | | DeleteBuilder db = new DeleteBuilder(this.getTableName_()); |
| | | db.where(this.getPkName_(), this.getPkValue_()); |
| | | return db.genMapSql(); |
| | | } |
| | | |
| | | /** |
| | | * 获取删除语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { |
| | | DeleteBuilder db = new DeleteBuilder(this.getTableName_()); |
| | | return db.genMapSql(where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 获取删除语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { |
| | | DeleteBuilder db = new DeleteBuilder(this.getTableName_()); |
| | | return db.genArraySql(where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 获取单行查询语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getSingleSql_() { |
| | | SelectBuilder sb = new SelectBuilder(this.getTableName_()); |
| | | sb.where(this.getPkName_(), this.getPkValue_()); |
| | | return sb.genMapSql(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取查询语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { |
| | | return new SqlAndParameters<>("select id, src_img, src_video_id, sim_video_id, distance from " + this.getTableName_() + " " + where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 获取查询语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { |
| | | return new SqlAndParameters<>("select id, src_img, src_video_id, sim_video_id, distance from " + this.getTableName_() + " " + where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 将resultset的一行转化为po |
| | | */ |
| | | @Override |
| | | public Rc_video_t1 mapRow(ResultSet rs, int i) throws SQLException { |
| | | return ROW_MAPPER.mapRow(rs, i); |
| | | } |
| | | |
| | | /** |
| | | * 克隆 |
| | | */ |
| | | public Rc_video_t1 toRc_video_t1() { |
| | | return super.$clone(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * rc_video_t1 RowMapper |
| | | * |
| | | * @author genrator |
| | | */ |
| | | class Rc_video_t1RowMapper implements RowMapper<Rc_video_t1> { |
| | | |
| | | @Override |
| | | public Rc_video_t1 mapRow(ResultSet rs, int i) throws SQLException { |
| | | ResultSetUtils resultSetUtils = new ResultSetUtils(); |
| | | Rc_video_t1 rc_video_t1 = new Rc_video_t1(); |
| | | Integer columnIndex; |
| | | //主键 |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_video_t1_mapper.ID); |
| | | if (columnIndex > 0) { |
| | | rc_video_t1.setId(rs.getString(columnIndex)); |
| | | } |
| | | //普通属性 |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_video_t1_mapper.SRC_IMG); |
| | | if (columnIndex > 0) { |
| | | rc_video_t1.setSrc_img(rs.getString(columnIndex)); |
| | | } |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_video_t1_mapper.SRC_VIDEO_ID); |
| | | if (columnIndex > 0) { |
| | | rc_video_t1.setSrc_video_id(rs.getString(columnIndex)); |
| | | } |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_video_t1_mapper.SIM_VIDEO_ID); |
| | | if (columnIndex > 0) { |
| | | rc_video_t1.setSim_video_id(rs.getString(columnIndex)); |
| | | } |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_video_t1_mapper.DISTANCE); |
| | | if (columnIndex > 0) { |
| | | if (rs.getBigDecimal(columnIndex) == null) { |
| | | rc_video_t1.setDistance(null); |
| | | } else { |
| | | rc_video_t1.setDistance(rs.getDouble(columnIndex)); |
| | | } |
| | | } |
| | | return rc_video_t1; |
| | | } |
| | | } |
New file |
| | |
| | | package com.iplatform.model.po; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonAutoDetect; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.walker.jdbc.BasePo; |
| | | |
| | | /** |
| | | * 表名:RC_VIDEO_T2 * |
| | | * @author genrator |
| | | */ |
| | | @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) |
| | | public class Rc_video_t2 extends BasePo<Rc_video_t2> { |
| | | // 序列化版本号 |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 用于兼容老写法 |
| | | */ |
| | | @JsonIgnore |
| | | public static final Rc_video_t2 ROW_MAPPER = new Rc_video_t2(); |
| | | |
| | | // 主键 |
| | | private String id = null; |
| | | @JsonIgnore |
| | | protected boolean isset_id = false; |
| | | |
| | | // 属性列表 |
| | | private String src_video_id = null; |
| | | @JsonIgnore |
| | | protected boolean isset_src_video_id = false; |
| | | |
| | | private String sim_video_id = null; |
| | | @JsonIgnore |
| | | protected boolean isset_sim_video_id = false; |
| | | |
| | | private Double score = null; |
| | | @JsonIgnore |
| | | protected boolean isset_score = false; |
| | | |
| | | /** |
| | | * 默认构造函数 |
| | | */ |
| | | public Rc_video_t2() { |
| | | } |
| | | |
| | | /** |
| | | * 根据主键构造对象 |
| | | */ |
| | | public Rc_video_t2(String id) { |
| | | this.setId(id); |
| | | } |
| | | |
| | | /** |
| | | * 设置主键值 |
| | | */ |
| | | @Override |
| | | public void setPkValue(Object value) { |
| | | this.setId((String) value); |
| | | } |
| | | |
| | | public String getId() { |
| | | return this.id; |
| | | } |
| | | |
| | | public void setId(String id) { |
| | | this.id = id; |
| | | this.isset_id = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptyId() { |
| | | return this.id == null || this.id.length() == 0; |
| | | } |
| | | |
| | | public String getSrc_video_id() { |
| | | return this.src_video_id; |
| | | } |
| | | |
| | | public void setSrc_video_id(String src_video_id) { |
| | | this.src_video_id = src_video_id; |
| | | this.isset_src_video_id = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptySrc_video_id() { |
| | | return this.src_video_id == null || this.src_video_id.length() == 0; |
| | | } |
| | | |
| | | public String getSim_video_id() { |
| | | return this.sim_video_id; |
| | | } |
| | | |
| | | public void setSim_video_id(String sim_video_id) { |
| | | this.sim_video_id = sim_video_id; |
| | | this.isset_sim_video_id = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptySim_video_id() { |
| | | return this.sim_video_id == null || this.sim_video_id.length() == 0; |
| | | } |
| | | |
| | | public Double getScore() { |
| | | return this.score; |
| | | } |
| | | |
| | | public void setScore(Double score) { |
| | | this.score = score; |
| | | this.isset_score = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptyScore() { |
| | | return this.score == null; |
| | | } |
| | | |
| | | /** |
| | | * 重写 toString() 方法 |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | return new StringBuilder() |
| | | .append("id=").append(this.id) |
| | | .append("src_video_id=").append(this.src_video_id) |
| | | .append("sim_video_id=").append(this.sim_video_id) |
| | | .append("score=").append(this.score) |
| | | .toString(); |
| | | } |
| | | |
| | | /** |
| | | * 克隆 |
| | | */ |
| | | public Rc_video_t2 $clone() { |
| | | Rc_video_t2 rc_video_t2 = new Rc_video_t2(); |
| | | |
| | | // 数据库名称 |
| | | //rc_video_t2.setDatabaseName_(this.getDatabaseName_()); |
| | | |
| | | // 主键 |
| | | if (this.isset_id) { |
| | | rc_video_t2.setId(this.getId()); |
| | | } |
| | | // 普通属性 |
| | | if (this.isset_src_video_id) { |
| | | rc_video_t2.setSrc_video_id(this.getSrc_video_id()); |
| | | } |
| | | if (this.isset_sim_video_id) { |
| | | rc_video_t2.setSim_video_id(this.getSim_video_id()); |
| | | } |
| | | if (this.isset_score) { |
| | | rc_video_t2.setScore(this.getScore()); |
| | | } |
| | | return rc_video_t2; |
| | | } |
| | | } |
New file |
| | |
| | | package com.iplatform.model.po; |
| | | |
| | | import com.walker.jdbc.BaseMapper; |
| | | import com.walker.jdbc.ResultSetUtils; |
| | | import com.walker.jdbc.SqlAndParameters; |
| | | import com.walker.jdbc.sqlgen.DeleteBuilder; |
| | | import com.walker.jdbc.sqlgen.InsertBuilder; |
| | | import com.walker.jdbc.sqlgen.SelectBuilder; |
| | | import com.walker.jdbc.sqlgen.UpdateBuilder; |
| | | import com.walker.jdbc.util.StringUtils; |
| | | |
| | | import org.springframework.jdbc.core.RowMapper; |
| | | |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 表名:RC_VIDEO_T2 * |
| | | * @author genrator |
| | | */ |
| | | public class Rc_video_t2_mapper extends Rc_video_t2 implements BaseMapper<Rc_video_t2> { |
| | | // 序列化版本号 |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public static final RowMapper<Rc_video_t2> ROW_MAPPER = new Rc_video_t2RowMapper(); |
| | | |
| | | // 主键 |
| | | public static final String ID = "id"; |
| | | // 普通属性 |
| | | public static final String SRC_VIDEO_ID = "src_video_id"; |
| | | public static final String SIM_VIDEO_ID = "sim_video_id"; |
| | | public static final String SCORE = "score"; |
| | | |
| | | /** |
| | | * 默认构造函数 |
| | | */ |
| | | public Rc_video_t2_mapper(Rc_video_t2 rc_video_t2) { |
| | | if (rc_video_t2 == null) { |
| | | throw new IllegalArgumentException("po参数不允许为空!"); |
| | | } |
| | | //主键 |
| | | if (rc_video_t2.isset_id) { |
| | | this.setId(rc_video_t2.getId()); |
| | | } |
| | | //普通属性 |
| | | if (rc_video_t2.isset_src_video_id) { |
| | | this.setSrc_video_id(rc_video_t2.getSrc_video_id()); |
| | | } |
| | | if (rc_video_t2.isset_sim_video_id) { |
| | | this.setSim_video_id(rc_video_t2.getSim_video_id()); |
| | | } |
| | | if (rc_video_t2.isset_score) { |
| | | this.setScore(rc_video_t2.getScore()); |
| | | } |
| | | // 去掉,2022-09-07 |
| | | // this.setDatabaseName_(rc_video_t2.getDatabaseName_()); |
| | | } |
| | | |
| | | /** |
| | | * 获取表名 |
| | | */ |
| | | @Override |
| | | public String getTableName_() { |
| | | String tableName = "rc_video_t2"; |
| | | /** |
| | | if (StringUtils.isNotEmpty(this.getDatabaseName_())) { |
| | | return this.getDatabaseName_() + "." + tableName; |
| | | } else { |
| | | return tableName; |
| | | } |
| | | */ |
| | | return tableName; |
| | | } |
| | | |
| | | /** |
| | | * 获取主键名称 |
| | | */ |
| | | @Override |
| | | public String getPkName_() { |
| | | return ID; |
| | | } |
| | | |
| | | /** |
| | | * 获取主键值 |
| | | */ |
| | | @Override |
| | | public Object getPkValue_() { |
| | | return this.getId(); |
| | | } |
| | | |
| | | /** |
| | | * 获取插入语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getInsertSql_() { |
| | | InsertBuilder ib = new InsertBuilder(this.getTableName_()); |
| | | ib.set(ID, this.getId()); |
| | | ib.set(SRC_VIDEO_ID, this.getSrc_video_id(), this.isset_src_video_id); |
| | | ib.set(SIM_VIDEO_ID, this.getSim_video_id(), this.isset_sim_video_id); |
| | | ib.set(SCORE, this.getScore(), this.isset_score); |
| | | return ib.genMapSql(); |
| | | } |
| | | |
| | | /** |
| | | * 获取更新语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getUpdateSql_() { |
| | | UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); |
| | | ub.set(SRC_VIDEO_ID, this.getSrc_video_id(), this.isset_src_video_id); |
| | | ub.set(SIM_VIDEO_ID, this.getSim_video_id(), this.isset_sim_video_id); |
| | | ub.set(SCORE, this.getScore(), this.isset_score); |
| | | ub.where(this.getPkName_(), this.getPkValue_()); |
| | | return ub.genMapSql(); |
| | | } |
| | | |
| | | /** |
| | | * 获取更新语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { |
| | | UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); |
| | | ub.set(SRC_VIDEO_ID, this.getSrc_video_id(), this.isset_src_video_id); |
| | | ub.set(SIM_VIDEO_ID, this.getSim_video_id(), this.isset_sim_video_id); |
| | | ub.set(SCORE, this.getScore(), this.isset_score); |
| | | |
| | | return ub.genMapSql(where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 获取更新语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { |
| | | UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); |
| | | ub.set(SRC_VIDEO_ID, this.getSrc_video_id(), this.isset_src_video_id); |
| | | ub.set(SIM_VIDEO_ID, this.getSim_video_id(), this.isset_sim_video_id); |
| | | ub.set(SCORE, this.getScore(), this.isset_score); |
| | | |
| | | return ub.genArraySql(where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 获取删除语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getDeleteSql_() { |
| | | DeleteBuilder db = new DeleteBuilder(this.getTableName_()); |
| | | db.where(this.getPkName_(), this.getPkValue_()); |
| | | return db.genMapSql(); |
| | | } |
| | | |
| | | /** |
| | | * 获取删除语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { |
| | | DeleteBuilder db = new DeleteBuilder(this.getTableName_()); |
| | | return db.genMapSql(where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 获取删除语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { |
| | | DeleteBuilder db = new DeleteBuilder(this.getTableName_()); |
| | | return db.genArraySql(where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 获取单行查询语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getSingleSql_() { |
| | | SelectBuilder sb = new SelectBuilder(this.getTableName_()); |
| | | sb.where(this.getPkName_(), this.getPkValue_()); |
| | | return sb.genMapSql(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取查询语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { |
| | | return new SqlAndParameters<>("select id, src_video_id, sim_video_id, score from " + this.getTableName_() + " " + where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 获取查询语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { |
| | | return new SqlAndParameters<>("select id, src_video_id, sim_video_id, score from " + this.getTableName_() + " " + where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 将resultset的一行转化为po |
| | | */ |
| | | @Override |
| | | public Rc_video_t2 mapRow(ResultSet rs, int i) throws SQLException { |
| | | return ROW_MAPPER.mapRow(rs, i); |
| | | } |
| | | |
| | | /** |
| | | * 克隆 |
| | | */ |
| | | public Rc_video_t2 toRc_video_t2() { |
| | | return super.$clone(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * rc_video_t2 RowMapper |
| | | * |
| | | * @author genrator |
| | | */ |
| | | class Rc_video_t2RowMapper implements RowMapper<Rc_video_t2> { |
| | | |
| | | @Override |
| | | public Rc_video_t2 mapRow(ResultSet rs, int i) throws SQLException { |
| | | ResultSetUtils resultSetUtils = new ResultSetUtils(); |
| | | Rc_video_t2 rc_video_t2 = new Rc_video_t2(); |
| | | Integer columnIndex; |
| | | //主键 |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_video_t2_mapper.ID); |
| | | if (columnIndex > 0) { |
| | | rc_video_t2.setId(rs.getString(columnIndex)); |
| | | } |
| | | //普通属性 |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_video_t2_mapper.SRC_VIDEO_ID); |
| | | if (columnIndex > 0) { |
| | | rc_video_t2.setSrc_video_id(rs.getString(columnIndex)); |
| | | } |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_video_t2_mapper.SIM_VIDEO_ID); |
| | | if (columnIndex > 0) { |
| | | rc_video_t2.setSim_video_id(rs.getString(columnIndex)); |
| | | } |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_video_t2_mapper.SCORE); |
| | | if (columnIndex > 0) { |
| | | if (rs.getBigDecimal(columnIndex) == null) { |
| | | rc_video_t2.setScore(null); |
| | | } else { |
| | | rc_video_t2.setScore(rs.getDouble(columnIndex)); |
| | | } |
| | | } |
| | | return rc_video_t2; |
| | | } |
| | | } |
New file |
| | |
| | | package com.iplatform.model.po; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonAutoDetect; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.walker.jdbc.BasePo; |
| | | |
| | | /** |
| | | * 表名:RC_VIDEO_USER * |
| | | * @author genrator |
| | | */ |
| | | @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) |
| | | public class Rc_video_user extends BasePo<Rc_video_user> { |
| | | // 序列化版本号 |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 用于兼容老写法 |
| | | */ |
| | | @JsonIgnore |
| | | public static final Rc_video_user ROW_MAPPER = new Rc_video_user(); |
| | | |
| | | // 主键 |
| | | private Long user_id = null; |
| | | @JsonIgnore |
| | | protected boolean isset_user_id = false; |
| | | |
| | | // 属性列表 |
| | | private String video_id = null; |
| | | @JsonIgnore |
| | | protected boolean isset_video_id = false; |
| | | |
| | | private Double score = null; |
| | | @JsonIgnore |
| | | protected boolean isset_score = false; |
| | | |
| | | private Long create_time = null; |
| | | @JsonIgnore |
| | | protected boolean isset_create_time = false; |
| | | |
| | | /** |
| | | * 默认构造函数 |
| | | */ |
| | | public Rc_video_user() { |
| | | } |
| | | |
| | | /** |
| | | * 根据主键构造对象 |
| | | */ |
| | | public Rc_video_user(Long user_id) { |
| | | this.setUser_id(user_id); |
| | | } |
| | | |
| | | /** |
| | | * 设置主键值 |
| | | */ |
| | | @Override |
| | | public void setPkValue(Object value) { |
| | | this.setUser_id((Long) value); |
| | | } |
| | | |
| | | public Long getUser_id() { |
| | | return this.user_id; |
| | | } |
| | | |
| | | public void setUser_id(Long user_id) { |
| | | this.user_id = user_id; |
| | | this.isset_user_id = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptyUser_id() { |
| | | return this.user_id == null; |
| | | } |
| | | |
| | | public String getVideo_id() { |
| | | return this.video_id; |
| | | } |
| | | |
| | | public void setVideo_id(String video_id) { |
| | | this.video_id = video_id; |
| | | this.isset_video_id = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptyVideo_id() { |
| | | return this.video_id == null || this.video_id.length() == 0; |
| | | } |
| | | |
| | | public Double getScore() { |
| | | return this.score; |
| | | } |
| | | |
| | | public void setScore(Double score) { |
| | | this.score = score; |
| | | this.isset_score = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptyScore() { |
| | | return this.score == null; |
| | | } |
| | | |
| | | public Long getCreate_time() { |
| | | return this.create_time; |
| | | } |
| | | |
| | | public void setCreate_time(Long create_time) { |
| | | this.create_time = create_time; |
| | | this.isset_create_time = true; |
| | | } |
| | | |
| | | @JsonIgnore |
| | | public boolean isEmptyCreate_time() { |
| | | return this.create_time == null; |
| | | } |
| | | |
| | | /** |
| | | * 重写 toString() 方法 |
| | | */ |
| | | @Override |
| | | public String toString() { |
| | | return new StringBuilder() |
| | | .append("user_id=").append(this.user_id) |
| | | .append("video_id=").append(this.video_id) |
| | | .append("score=").append(this.score) |
| | | .append("create_time=").append(this.create_time) |
| | | .toString(); |
| | | } |
| | | |
| | | /** |
| | | * 克隆 |
| | | */ |
| | | public Rc_video_user $clone() { |
| | | Rc_video_user rc_video_user = new Rc_video_user(); |
| | | |
| | | // 数据库名称 |
| | | //rc_video_user.setDatabaseName_(this.getDatabaseName_()); |
| | | |
| | | // 主键 |
| | | if (this.isset_user_id) { |
| | | rc_video_user.setUser_id(this.getUser_id()); |
| | | } |
| | | // 普通属性 |
| | | if (this.isset_video_id) { |
| | | rc_video_user.setVideo_id(this.getVideo_id()); |
| | | } |
| | | if (this.isset_score) { |
| | | rc_video_user.setScore(this.getScore()); |
| | | } |
| | | if (this.isset_create_time) { |
| | | rc_video_user.setCreate_time(this.getCreate_time()); |
| | | } |
| | | return rc_video_user; |
| | | } |
| | | } |
New file |
| | |
| | | package com.iplatform.model.po; |
| | | |
| | | import com.walker.jdbc.BaseMapper; |
| | | import com.walker.jdbc.ResultSetUtils; |
| | | import com.walker.jdbc.SqlAndParameters; |
| | | import com.walker.jdbc.sqlgen.DeleteBuilder; |
| | | import com.walker.jdbc.sqlgen.InsertBuilder; |
| | | import com.walker.jdbc.sqlgen.SelectBuilder; |
| | | import com.walker.jdbc.sqlgen.UpdateBuilder; |
| | | import com.walker.jdbc.util.StringUtils; |
| | | |
| | | import org.springframework.jdbc.core.RowMapper; |
| | | |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 表名:RC_VIDEO_USER * |
| | | * @author genrator |
| | | */ |
| | | public class Rc_video_user_mapper extends Rc_video_user implements BaseMapper<Rc_video_user> { |
| | | // 序列化版本号 |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public static final RowMapper<Rc_video_user> ROW_MAPPER = new Rc_video_userRowMapper(); |
| | | |
| | | // 主键 |
| | | public static final String USER_ID = "user_id"; |
| | | // 普通属性 |
| | | public static final String VIDEO_ID = "video_id"; |
| | | public static final String SCORE = "score"; |
| | | public static final String CREATE_TIME = "create_time"; |
| | | |
| | | /** |
| | | * 默认构造函数 |
| | | */ |
| | | public Rc_video_user_mapper(Rc_video_user rc_video_user) { |
| | | if (rc_video_user == null) { |
| | | throw new IllegalArgumentException("po参数不允许为空!"); |
| | | } |
| | | //主键 |
| | | if (rc_video_user.isset_user_id) { |
| | | this.setUser_id(rc_video_user.getUser_id()); |
| | | } |
| | | //普通属性 |
| | | if (rc_video_user.isset_video_id) { |
| | | this.setVideo_id(rc_video_user.getVideo_id()); |
| | | } |
| | | if (rc_video_user.isset_score) { |
| | | this.setScore(rc_video_user.getScore()); |
| | | } |
| | | if (rc_video_user.isset_create_time) { |
| | | this.setCreate_time(rc_video_user.getCreate_time()); |
| | | } |
| | | // 去掉,2022-09-07 |
| | | // this.setDatabaseName_(rc_video_user.getDatabaseName_()); |
| | | } |
| | | |
| | | /** |
| | | * 获取表名 |
| | | */ |
| | | @Override |
| | | public String getTableName_() { |
| | | String tableName = "rc_video_user"; |
| | | /** |
| | | if (StringUtils.isNotEmpty(this.getDatabaseName_())) { |
| | | return this.getDatabaseName_() + "." + tableName; |
| | | } else { |
| | | return tableName; |
| | | } |
| | | */ |
| | | return tableName; |
| | | } |
| | | |
| | | /** |
| | | * 获取主键名称 |
| | | */ |
| | | @Override |
| | | public String getPkName_() { |
| | | return USER_ID; |
| | | } |
| | | |
| | | /** |
| | | * 获取主键值 |
| | | */ |
| | | @Override |
| | | public Object getPkValue_() { |
| | | return this.getUser_id(); |
| | | } |
| | | |
| | | /** |
| | | * 获取插入语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getInsertSql_() { |
| | | InsertBuilder ib = new InsertBuilder(this.getTableName_()); |
| | | ib.set(USER_ID, this.getUser_id()); |
| | | ib.set(VIDEO_ID, this.getVideo_id(), this.isset_video_id); |
| | | ib.set(SCORE, this.getScore(), this.isset_score); |
| | | ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); |
| | | return ib.genMapSql(); |
| | | } |
| | | |
| | | /** |
| | | * 获取更新语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getUpdateSql_() { |
| | | UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); |
| | | ub.set(VIDEO_ID, this.getVideo_id(), this.isset_video_id); |
| | | ub.set(SCORE, this.getScore(), this.isset_score); |
| | | ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); |
| | | ub.where(this.getPkName_(), this.getPkValue_()); |
| | | return ub.genMapSql(); |
| | | } |
| | | |
| | | /** |
| | | * 获取更新语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { |
| | | UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); |
| | | ub.set(VIDEO_ID, this.getVideo_id(), this.isset_video_id); |
| | | ub.set(SCORE, this.getScore(), this.isset_score); |
| | | ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); |
| | | |
| | | return ub.genMapSql(where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 获取更新语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { |
| | | UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); |
| | | ub.set(VIDEO_ID, this.getVideo_id(), this.isset_video_id); |
| | | ub.set(SCORE, this.getScore(), this.isset_score); |
| | | ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); |
| | | |
| | | return ub.genArraySql(where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 获取删除语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getDeleteSql_() { |
| | | DeleteBuilder db = new DeleteBuilder(this.getTableName_()); |
| | | db.where(this.getPkName_(), this.getPkValue_()); |
| | | return db.genMapSql(); |
| | | } |
| | | |
| | | /** |
| | | * 获取删除语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { |
| | | DeleteBuilder db = new DeleteBuilder(this.getTableName_()); |
| | | return db.genMapSql(where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 获取删除语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { |
| | | DeleteBuilder db = new DeleteBuilder(this.getTableName_()); |
| | | return db.genArraySql(where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 获取单行查询语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getSingleSql_() { |
| | | SelectBuilder sb = new SelectBuilder(this.getTableName_()); |
| | | sb.where(this.getPkName_(), this.getPkValue_()); |
| | | return sb.genMapSql(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取查询语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { |
| | | return new SqlAndParameters<>("select user_id, video_id, score, create_time from " + this.getTableName_() + " " + where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 获取查询语句和参数 |
| | | */ |
| | | @Override |
| | | public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { |
| | | return new SqlAndParameters<>("select user_id, video_id, score, create_time from " + this.getTableName_() + " " + where, parameters); |
| | | } |
| | | |
| | | /** |
| | | * 将resultset的一行转化为po |
| | | */ |
| | | @Override |
| | | public Rc_video_user mapRow(ResultSet rs, int i) throws SQLException { |
| | | return ROW_MAPPER.mapRow(rs, i); |
| | | } |
| | | |
| | | /** |
| | | * 克隆 |
| | | */ |
| | | public Rc_video_user toRc_video_user() { |
| | | return super.$clone(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * rc_video_user RowMapper |
| | | * |
| | | * @author genrator |
| | | */ |
| | | class Rc_video_userRowMapper implements RowMapper<Rc_video_user> { |
| | | |
| | | @Override |
| | | public Rc_video_user mapRow(ResultSet rs, int i) throws SQLException { |
| | | ResultSetUtils resultSetUtils = new ResultSetUtils(); |
| | | Rc_video_user rc_video_user = new Rc_video_user(); |
| | | Integer columnIndex; |
| | | //主键 |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_video_user_mapper.USER_ID); |
| | | if (columnIndex > 0) { |
| | | rc_video_user.setUser_id(rs.getLong(columnIndex)); |
| | | } |
| | | //普通属性 |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_video_user_mapper.VIDEO_ID); |
| | | if (columnIndex > 0) { |
| | | rc_video_user.setVideo_id(rs.getString(columnIndex)); |
| | | } |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_video_user_mapper.SCORE); |
| | | if (columnIndex > 0) { |
| | | if (rs.getBigDecimal(columnIndex) == null) { |
| | | rc_video_user.setScore(null); |
| | | } else { |
| | | rc_video_user.setScore(rs.getDouble(columnIndex)); |
| | | } |
| | | } |
| | | columnIndex = resultSetUtils.findColumn(rs, Rc_video_user_mapper.CREATE_TIME); |
| | | if (columnIndex > 0) { |
| | | if (rs.getBigDecimal(columnIndex) == null) { |
| | | rc_video_user.setCreate_time(null); |
| | | } else { |
| | | rc_video_user.setCreate_time(rs.getLong(columnIndex)); |
| | | } |
| | | } |
| | | return rc_video_user; |
| | | } |
| | | } |
| | |
| | | </properties> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>junit</groupId> |
| | | <artifactId>junit</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | |
| | | <!-- 数据库及接口对象依赖(pojo), 2022/09/23 --> |
| | | <dependency> |
| | | <groupId>com.iplatform</groupId> |
| | | <artifactId>recommend-model-pojo</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.iplatform</groupId> |
| | | <artifactId>recommend-common</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- RestTemplate依赖,2022/09/23 --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.iplatform.recvideo; |
| | | |
| | | public class Constants { |
| | | |
| | | public static final String IMAGE_SUFFIX = ".jpg"; |
| | | } |
New file |
| | |
| | | package com.iplatform.recvideo; |
| | | |
| | | /** |
| | | * 调度任务通过文件夹扫描到的视频图像信息。 |
| | | * @author 时克英 |
| | | * @date 2022-09-23 |
| | | */ |
| | | public class ImageInfo { |
| | | |
| | | private String videoId; // 视频ID,文件夹名字就是 |
| | | private String imagePath; // 图像绝对路径,访问使用 |
| | | |
| | | private String imageName; // 图像名称(不包括路径,如:landscape_01.jpg),暂时没有使用 |
| | | |
| | | public String getVideoId() { |
| | | return videoId; |
| | | } |
| | | |
| | | public void setVideoId(String videoId) { |
| | | this.videoId = videoId; |
| | | } |
| | | |
| | | public String getImagePath() { |
| | | return imagePath; |
| | | } |
| | | |
| | | public void setImagePath(String imagePath) { |
| | | this.imagePath = imagePath; |
| | | } |
| | | |
| | | public String getImageName() { |
| | | return imageName; |
| | | } |
| | | |
| | | public void setImageName(String imageName) { |
| | | this.imageName = imageName; |
| | | } |
| | | |
| | | @Override |
| | | public String toString(){ |
| | | return new StringBuilder("[videoId=").append(this.videoId) |
| | | .append(", imagePath=").append(this.imagePath) |
| | | .append("]").toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.iplatform.recvideo; |
| | | |
| | | import com.iplatform.model.po.Rc_video_t1; |
| | | import com.iplatform.recvideo.util.VideoFileUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.io.File; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 视频相似度结果计算以及写入执行器。 |
| | | * <pre> |
| | | * 1)该对象为'有状态',在每次完成一个采集过程后,需要重新创建。 |
| | | * </pre> |
| | | * @author 时克英 |
| | | * @date 2022-09-23 |
| | | */ |
| | | public abstract class SimilarExecutor { |
| | | |
| | | protected final transient Logger logger = LoggerFactory.getLogger(this.getClass()); |
| | | |
| | | private String videoDataFolder = null; |
| | | |
| | | private String batchId = null; |
| | | |
| | | private List<VideoFolderInfo> videoFolderInfoList = null; |
| | | |
| | | // 记录当前执行到(该批次)哪个视频文件对应的第几个图片 |
| | | private int currentVideoFolderIndex = -1; |
| | | private int currentImageIndex = -1; |
| | | // private VideoFolderInfo currentVideoFolderInfo = null; |
| | | // private ImageInfo currentImageInfo = null; |
| | | |
| | | // |
| | | private boolean pythonLoadVideoDone = false; |
| | | |
| | | /** |
| | | * 初始化对象调用一次 |
| | | * @param videoDataFolder |
| | | * @param batchId |
| | | */ |
| | | public void startup(String videoDataFolder, String batchId){ |
| | | if(StringUtils.isEmpty(videoDataFolder)){ |
| | | throw new IllegalArgumentException("视频文件夹根目录必须设置!"); |
| | | } |
| | | if(StringUtils.isEmpty(batchId)){ |
| | | throw new IllegalArgumentException("处理批次(时间)必须设置!"); |
| | | } |
| | | this.videoDataFolder = videoDataFolder; |
| | | this.batchId = batchId; |
| | | // this.videoFolderInfoList = VideoFileUtils.getBatchVideoFolderInfo(this.videoDataFolder, batchId); |
| | | } |
| | | |
| | | /** |
| | | * 在每次调度时钟周期执行一次。例如: 10秒一次。<p></p> |
| | | * 注意:该方法英确保每次调用不会重复数据。 |
| | | */ |
| | | public void execute(){ |
| | | if(!this.pythonLoadVideoDone){ |
| | | logger.debug("当前 pythonLoadVideoDone = false, 需要查询数据库是否已加载视频"); |
| | | this.pythonLoadVideoDone = this.pythonLoadVideoDone(this.batchId, videoDataFolder + File.separator + batchId); |
| | | } |
| | | |
| | | // 1: 如果视频还未加载,则先加载视频 |
| | | if(!this.pythonLoadVideoDone){ |
| | | try{ |
| | | String error = this.requestStartPythonLoadVideo(this.batchId); |
| | | if(StringUtils.isNotEmpty(error)){ |
| | | // 终止调用,等待下次调度继续尝试执行 |
| | | logger.error("python调用加载视频返回错误:" + error); |
| | | return; |
| | | } |
| | | this.pythonLoadVideoDone = true; |
| | | |
| | | } catch (Exception ex){ |
| | | logger.error("python调用加载视频异常:" + this.batchId, ex); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | // 2: 加载完视频,需要查询每个图片相似度结果,并存储到数据库 |
| | | // 这里注意,程序必须和AI服务器部署在一起,方便检索视频分析文件夹(本地) |
| | | if(this.videoFolderInfoList == null){ |
| | | this.videoFolderInfoList = VideoFileUtils.getBatchVideoFolderInfo(this.videoDataFolder, batchId); |
| | | } |
| | | if(StringUtils.isEmptyList(this.videoFolderInfoList)){ |
| | | logger.warn("视频分析文件夹内容为空,无法继续查询相似度结果! videoFolderInfoList = null"); |
| | | return; |
| | | } |
| | | |
| | | if(this.isSearchWriteDone()){ |
| | | logger.info("已经完成批次相似结果写入数据库,不再往下处理。batch = " + this.batchId); |
| | | return; |
| | | } |
| | | |
| | | // 开始检索相似度 |
| | | if(this.currentVideoFolderIndex == -1){ |
| | | this.currentVideoFolderIndex ++; |
| | | } |
| | | |
| | | } |
| | | |
| | | private void processOneSearchAndWrite() throws Exception{ |
| | | if(this.currentVideoFolderIndex >= this.videoFolderInfoList.size()){ |
| | | throw new IllegalArgumentException("currentVideoFolderIndex 越界: " + this.currentVideoFolderIndex); |
| | | } |
| | | VideoFolderInfo currentVideoFolderInfo = this.videoFolderInfoList.get(this.currentVideoFolderIndex); |
| | | |
| | | if(this.currentImageIndex == -1){ |
| | | this.currentImageIndex ++; |
| | | } |
| | | ImageInfo imageInfo = currentVideoFolderInfo.getImageInfoList().get(this.currentImageIndex); |
| | | |
| | | this.acquirePythonSearchSimilarOnce(imageInfo.getImagePath(), "30"); |
| | | |
| | | if((this.currentImageIndex + 1) >= currentVideoFolderInfo.getImageInfoSize()){ |
| | | if((this.currentVideoFolderIndex + 1) < this.videoFolderInfoList.size()){ |
| | | logger.debug("一个视频图像集合检索处理完毕,切换到下一个,currentImageIndex = " + this.currentImageIndex); |
| | | this.currentVideoFolderIndex ++; |
| | | this.currentImageIndex = -1; |
| | | } else { |
| | | // |
| | | logger.debug("所有视频包含的所有图像处理完毕,currentVideoFolderIndex = " + this.currentVideoFolderIndex); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | this.currentImageIndex ++; |
| | | } |
| | | |
| | | /** |
| | | * 判断是否已经全部把图片相似度结果写入到数据库中。(针对该批次) |
| | | * @return |
| | | */ |
| | | private boolean isSearchWriteDone(){ |
| | | if(this.currentVideoFolderIndex == -1 || this.currentImageIndex == -1){ |
| | | return false; |
| | | } |
| | | if((this.currentVideoFolderIndex+1) == this.videoFolderInfoList.size()){ |
| | | VideoFolderInfo lastVideo = this.videoFolderInfoList.get(this.currentVideoFolderIndex); |
| | | // 如果最后一个视频处理图片数量超过已有数量,判断肯定处理完毕 |
| | | if((this.currentImageIndex+1) > lastVideo.getImageInfoSize()){ |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 查询数据库,检查是否已经完成本次批次视频加载。读这个表: milvus_video_status |
| | | * @param batchId |
| | | * @param batchFolder 批次所在文件夹全路径,如: /opt/ai/video/20220921 |
| | | * @return |
| | | */ |
| | | protected abstract boolean pythonLoadVideoDone(String batchId, String batchFolder); |
| | | |
| | | /** |
| | | * 请求AI服务,开始一个批次视频数据导入。 |
| | | * @param batchId |
| | | * @return |
| | | */ |
| | | protected abstract String requestStartPythonLoadVideo(String batchId) throws Exception; |
| | | |
| | | /** |
| | | * 请求AI服务,检索给定图片的相似度结果集合。 |
| | | * @return |
| | | */ |
| | | protected abstract List<Rc_video_t1> acquirePythonSearchSimilarOnce(String imagePath, String topN); |
| | | } |
New file |
| | |
| | | package com.iplatform.recvideo; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 调度任务扫描到的视频文件夹信息,包含里面图片集合。 |
| | | * @author 时克英 |
| | | * @date 2022-09-23 |
| | | */ |
| | | public class VideoFolderInfo { |
| | | |
| | | private String videoId; |
| | | |
| | | private List<ImageInfo> imageInfoList; |
| | | |
| | | public VideoFolderInfo(String videoId){ |
| | | this.videoId = videoId; |
| | | } |
| | | |
| | | public void addImageInfo(String imagePath, String imageName){ |
| | | ImageInfo imageInfo = new ImageInfo(); |
| | | imageInfo.setImagePath(imagePath); |
| | | imageInfo.setImageName(imageName); |
| | | imageInfo.setVideoId(this.videoId); |
| | | if(this.imageInfoList == null){ |
| | | this.imageInfoList = new ArrayList<>(32); |
| | | } |
| | | this.imageInfoList.add(imageInfo); |
| | | } |
| | | |
| | | public String getVideoId() { |
| | | return videoId; |
| | | } |
| | | |
| | | public void setVideoId(String videoId) { |
| | | this.videoId = videoId; |
| | | } |
| | | |
| | | public List<ImageInfo> getImageInfoList() { |
| | | return imageInfoList; |
| | | } |
| | | |
| | | public void setImageInfoList(List<ImageInfo> imageInfoList) { |
| | | this.imageInfoList = imageInfoList; |
| | | } |
| | | |
| | | public int getImageInfoSize(){ |
| | | if(this.imageInfoList == null){ |
| | | return 0; |
| | | } |
| | | return this.imageInfoList.size(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.iplatform.recvideo.config; |
| | | |
| | | import com.iplatform.core.PlatformConfiguration; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.http.client.SimpleClientHttpRequestFactory; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | @Configuration |
| | | public class VideoSimilarConfig extends PlatformConfiguration { |
| | | |
| | | @Bean |
| | | public VideoSimilarProperties videoSimilarProperties(){ |
| | | return new VideoSimilarProperties(); |
| | | } |
| | | |
| | | /** |
| | | * 创建远程调用对象,临时使用内置Http配置,后续会单独发布模块支持 okHttp |
| | | * @return |
| | | * @date 2022-09-23 |
| | | */ |
| | | @Bean |
| | | public RestTemplate restTemplate(){ |
| | | SimpleClientHttpRequestFactory clientHttpRequestFactory = new SimpleClientHttpRequestFactory(); |
| | | clientHttpRequestFactory.setConnectTimeout(10 * 1000); |
| | | clientHttpRequestFactory.setReadTimeout(1200 * 1000); |
| | | return new RestTemplate(clientHttpRequestFactory); |
| | | } |
| | | } |
New file |
| | |
| | | package com.iplatform.recvideo.config; |
| | | |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | |
| | | @ConfigurationProperties(prefix = "recommend.video") |
| | | public class VideoSimilarProperties { |
| | | |
| | | private String dataFolder; |
| | | |
| | | public String getDataFolder() { |
| | | return dataFolder; |
| | | } |
| | | |
| | | public void setDataFolder(String dataFolder) { |
| | | this.dataFolder = dataFolder; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.iplatform.recvideo.service; |
| | | |
| | | import com.walker.jdbc.service.BaseServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | public class VideoExecutorServiceImpl extends BaseServiceImpl { |
| | | |
| | | } |
New file |
| | |
| | | package com.iplatform.recvideo.util; |
| | | |
| | | import com.iplatform.recvideo.Constants; |
| | | import com.iplatform.recvideo.ImageInfo; |
| | | import com.iplatform.recvideo.VideoFolderInfo; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class VideoFileUtils { |
| | | |
| | | protected static final transient Logger logger = LoggerFactory.getLogger(VideoFileUtils.class); |
| | | |
| | | public static final List<VideoFolderInfo> getBatchVideoFolderInfo(String videoDataFolder, String batchId){ |
| | | String batchFolderPath = videoDataFolder + File.separator + batchId; |
| | | File batchFolder = new File(batchFolderPath); |
| | | if(!batchFolder.exists()){ |
| | | logger.error("视频文件夹不存在,无法获取图片集合信息。batchFolderPath = " + batchFolderPath); |
| | | return null; |
| | | } |
| | | File[] files = batchFolder.listFiles(); |
| | | if(files == null || files.length == 0){ |
| | | logger.error("视频文件夹下没有任何图像文件夹: " + batchFolderPath); |
| | | return null; |
| | | } |
| | | |
| | | List<VideoFolderInfo> resultList = new ArrayList<>(); |
| | | |
| | | VideoFolderInfo videoFolderInfo = null; |
| | | for(File file : files){ |
| | | if(file.isFile()){ |
| | | continue; // 视频文件忽略,只看文件夹 |
| | | } |
| | | videoFolderInfo = new VideoFolderInfo(file.getName()); |
| | | // logger.debug("find folder = " + file.getName() + ", " + file.getAbsolutePath()); |
| | | acquireImagesInVideoFolder(file, videoFolderInfo); |
| | | resultList.add(videoFolderInfo); |
| | | } |
| | | return resultList; |
| | | } |
| | | |
| | | private static void acquireImagesInVideoFolder(File imageFolder, VideoFolderInfo videoFolderInfo){ |
| | | // ImageInfo imageInfo = null; |
| | | File[] imageFiles = imageFolder.listFiles(); |
| | | for(File file : imageFiles){ |
| | | if(!file.isFile()){ |
| | | continue; |
| | | } |
| | | if(!file.getName().endsWith(Constants.IMAGE_SUFFIX)){ |
| | | logger.warn("图像后缀名不是指定格式'.jpg', name = " + file.getName()); |
| | | continue; |
| | | } |
| | | // imageInfo = new ImageInfo(); |
| | | // imageInfo.setVideoId(videoFolderInfo.getVideoId()); |
| | | // imageInfo.setImagePath(file.getAbsolutePath()); |
| | | // imageInfo.setImageName(file.getName()); |
| | | videoFolderInfo.addImageInfo(file.getAbsolutePath(), file.getName()); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.iplatform.recvideo; |
| | | |
| | | import com.iplatform.recvideo.util.VideoFileUtils; |
| | | import org.junit.Test; |
| | | |
| | | import java.util.List; |
| | | |
| | | public class VideoSimilarTest { |
| | | |
| | | @Test |
| | | public void testVideoFolderInfo(){ |
| | | List<VideoFolderInfo> list = VideoFileUtils.getBatchVideoFolderInfo("D:/dev_tools/ai", "video"); |
| | | if(list != null){ |
| | | for(VideoFolderInfo e : list){ |
| | | System.out.println("------------> video folder: " + e.getVideoId()); |
| | | List<ImageInfo> imageInfoList = e.getImageInfoList(); |
| | | if(imageInfoList != null){ |
| | | for(ImageInfo im : imageInfoList){ |
| | | System.out.println(im); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |