diff --git a/neutrino-core/src/main/java/fun/asgc/neutrino/core/db/mapper/SqlMapperInterceptor.java b/neutrino-core/src/main/java/fun/asgc/neutrino/core/db/mapper/SqlMapperInterceptor.java index 1572c908..20a24e6f 100644 --- a/neutrino-core/src/main/java/fun/asgc/neutrino/core/db/mapper/SqlMapperInterceptor.java +++ b/neutrino-core/src/main/java/fun/asgc/neutrino/core/db/mapper/SqlMapperInterceptor.java @@ -26,12 +26,13 @@ import fun.asgc.neutrino.core.annotation.NonIntercept; import fun.asgc.neutrino.core.annotation.Param; import fun.asgc.neutrino.core.aop.Invocation; import fun.asgc.neutrino.core.aop.interceptor.Interceptor; -import fun.asgc.neutrino.core.cache.MemoryCache; +import fun.asgc.neutrino.core.db.page.Page; import fun.asgc.neutrino.core.db.template.JdbcTemplate; import fun.asgc.neutrino.core.util.*; -import java.lang.reflect.Method; + import java.lang.reflect.Parameter; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -59,7 +60,26 @@ public class SqlMapperInterceptor implements Interceptor { if (sqlParser.isReturnCollection()) { res = jdbcTemplate.queryForList(resultComponentType, sql, inv.getArgs()); } else { - res = jdbcTemplate.query(resultType, sql, inv.getArgs()); + if (Page.class.isAssignableFrom(inv.getTargetMethod().getParameters()[0].getType())) { + // 分页查询 TODO 此处暂时临时处理,假设后面的参数是一个DO对象 + Page page = (Page) inv.getArgs()[0]; +// Map params = new HashMap<>(); +// for (int i = 1; i < inv.getTargetMethod().getParameterCount(); i++) { +// Parameter parameter = inv.getTargetMethod().getParameters()[i]; +// Param param = parameter.getAnnotation(Param.class); +// if (null == param || StringUtil.isEmpty(param.value())) { +// continue; +// } +// params.put(param.value(), inv.getArgs()[i]); +// } + int offset = (page.getCurrentPage() - 1) * page.getPageSize(); + long total = jdbcTemplate.queryForLongByModel(String.format("select count(1) from (%s) T", sql), inv.getArgs()[1]); + List resultList = jdbcTemplate.queryForListByModel(resultComponentType, String.format("%s limit %s,%s", sql, offset, page.getPageSize()), inv.getArgs()[1]); + page.setTotal(total); + page.setRecords(resultList); + } else { + res = jdbcTemplate.query(resultType, sql, inv.getArgs()); + } } } else if (sqlParser.isInsert() || sqlParser.isDelete() || sqlParser.isUpdate()) { int argsCount = ArrayUtil.isEmpty(inv.getArgs()) ? 0 : inv.getArgs().length; diff --git a/neutrino-core/src/main/java/fun/asgc/neutrino/core/db/page/Page.java b/neutrino-core/src/main/java/fun/asgc/neutrino/core/db/page/Page.java new file mode 100644 index 00000000..e127262c --- /dev/null +++ b/neutrino-core/src/main/java/fun/asgc/neutrino/core/db/page/Page.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2022 aoshiguchen + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package fun.asgc.neutrino.core.db.page; + +import lombok.Data; + +import java.util.List; + +/** + * + * @author: aoshiguchen + * @date: 2022/8/6 + */ +@Data +public class Page extends PageQuery { + /** + * 数据总数 + */ + private Long total; + /** + * 结果数据 + */ + private List records; + + public static Page create(PageQuery pageQuery) { + Page page = new Page(); + page.setPageSize(pageQuery.getPageSize()); + page.setCurrentPage(pageQuery.getCurrentPage()); + return page; + } +} diff --git a/neutrino-core/src/main/java/fun/asgc/neutrino/core/db/page/PageQuery.java b/neutrino-core/src/main/java/fun/asgc/neutrino/core/db/page/PageQuery.java new file mode 100644 index 00000000..1ff198a6 --- /dev/null +++ b/neutrino-core/src/main/java/fun/asgc/neutrino/core/db/page/PageQuery.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2022 aoshiguchen + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package fun.asgc.neutrino.core.db.page; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * + * @author: aoshiguchen + * @date: 2022/8/6 + */ +public class PageQuery { + /** + * 当前页 + */ + private int currentPage = 1; + /** + * 分页大小 + */ + private int pageSize = 10; + + public int getCurrentPage() { + return currentPage; + } + + public void setCurrentPage(int currentPage) { + this.currentPage = currentPage; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } +} diff --git a/neutrino-core/src/main/java/fun/asgc/neutrino/core/db/template/JdbcTemplate.java b/neutrino-core/src/main/java/fun/asgc/neutrino/core/db/template/JdbcTemplate.java index 29257d3d..b5c999ec 100644 --- a/neutrino-core/src/main/java/fun/asgc/neutrino/core/db/template/JdbcTemplate.java +++ b/neutrino-core/src/main/java/fun/asgc/neutrino/core/db/template/JdbcTemplate.java @@ -21,12 +21,16 @@ */ package fun.asgc.neutrino.core.db.template; +import fun.asgc.neutrino.core.util.ArrayUtil; + import javax.sql.DataSource; import java.sql.Connection; import java.sql.SQLException; +import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * @@ -257,6 +261,19 @@ public class JdbcTemplate { Connection conn = null; try { + // TODO 临时处理集合参数 + if (ArrayUtil.notEmpty(params)) { + for (int i = 0; i < params.length; i++) { + Object item = params[i]; + if (null != item && Collection.class.isAssignableFrom(item.getClass()) && !((Collection)item).isEmpty()) { + Object first = ((Collection)item).stream().findFirst().get(); + if (Integer.class.isAssignableFrom(first.getClass())) { + params[i] = ((Collection)item).stream().map(String::valueOf).collect(Collectors.joining(",")); + } + } + } + } + conn = dataSourceHolder.getConnection(); res = jdbcOperations.executeQueryForList(conn, clazz, sql, params); } finally { diff --git a/neutrino-core/src/main/java/fun/asgc/neutrino/core/db/template/SqlAndParams.java b/neutrino-core/src/main/java/fun/asgc/neutrino/core/db/template/SqlAndParams.java index ee9c49cd..78f3e380 100644 --- a/neutrino-core/src/main/java/fun/asgc/neutrino/core/db/template/SqlAndParams.java +++ b/neutrino-core/src/main/java/fun/asgc/neutrino/core/db/template/SqlAndParams.java @@ -22,11 +22,13 @@ package fun.asgc.neutrino.core.db.template; import fun.asgc.neutrino.core.base.Orderly; +import fun.asgc.neutrino.core.util.ArrayUtil; import fun.asgc.neutrino.core.util.ReflectUtil; import java.lang.reflect.Field; import java.util.*; import java.util.stream.Collectors; +import java.util.stream.Stream; /** * sql语句+sql参数的封装,用于支持以下3种用法 diff --git a/neutrino-core/src/main/java/fun/asgc/neutrino/core/util/TypeUtil.java b/neutrino-core/src/main/java/fun/asgc/neutrino/core/util/TypeUtil.java index aa9f18f2..c4639ea6 100644 --- a/neutrino-core/src/main/java/fun/asgc/neutrino/core/util/TypeUtil.java +++ b/neutrino-core/src/main/java/fun/asgc/neutrino/core/util/TypeUtil.java @@ -126,8 +126,8 @@ public class TypeUtil { * 基本类型列表(用于计算类型提升距离) */ public static final List> basicTypeList = Lists.newArrayList( - boolean.class, byte.class, short.class, char.class, int.class, long.class, float.class, double.class, - Boolean.class, Byte.class, Short.class, Character.class, Integer.class, Long.class, Float.class, Double.class + boolean.class, Boolean.class, byte.class, Byte.class, short.class, Short.class, char.class, Character.class, + int.class, Integer.class, long.class, Long.class, float.class, Float.class, double.class, Double.class ); /** diff --git a/neutrino-core/src/main/java/fun/asgc/neutrino/core/web/HttpRequestHandler.java b/neutrino-core/src/main/java/fun/asgc/neutrino/core/web/HttpRequestHandler.java index 95737cbb..8b7e2c0c 100644 --- a/neutrino-core/src/main/java/fun/asgc/neutrino/core/web/HttpRequestHandler.java +++ b/neutrino-core/src/main/java/fun/asgc/neutrino/core/web/HttpRequestHandler.java @@ -265,7 +265,10 @@ public class HttpRequestHandler { for (Field field : fields) { String name = field.getName(); Object value = TypeUtil.conversion(HttpContextHolder.getHttpRequestWrapper().getParameter(name), field.getType()); - ReflectUtil.setFieldValue(field, obj, value); + // 临时处理默认值被覆盖的问题 + if (!(null != value && TypeUtil.isStrictBasicType(field) && value.equals(TypeUtil.getDefaultValue(field.getType())))) { + ReflectUtil.setFieldValue(field, obj, value); + } } } catch (Exception e) { e.printStackTrace(); diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/LicenseController.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/LicenseController.java index 6d07a9c3..ace1544f 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/LicenseController.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/LicenseController.java @@ -29,14 +29,14 @@ package fun.asgc.neutrino.proxy.server.controller; import fun.asgc.neutrino.core.annotation.Autowired; import fun.asgc.neutrino.core.annotation.NonIntercept; +import fun.asgc.neutrino.core.db.page.Page; +import fun.asgc.neutrino.core.db.page.PageQuery; import fun.asgc.neutrino.core.web.annotation.*; import fun.asgc.neutrino.proxy.server.controller.req.LicenseCreateReq; +import fun.asgc.neutrino.proxy.server.controller.req.LicenseListReq; import fun.asgc.neutrino.proxy.server.controller.req.LicenseUpdateEnableStatusReq; import fun.asgc.neutrino.proxy.server.controller.req.LicenseUpdateReq; -import fun.asgc.neutrino.proxy.server.controller.res.LicenseCreateRes; -import fun.asgc.neutrino.proxy.server.controller.res.LicenseDetailRes; -import fun.asgc.neutrino.proxy.server.controller.res.LicenseUpdateEnableStatusRes; -import fun.asgc.neutrino.proxy.server.controller.res.LicenseUpdateRes; +import fun.asgc.neutrino.proxy.server.controller.res.*; import fun.asgc.neutrino.proxy.server.service.LicenseService; @NonIntercept @@ -47,6 +47,12 @@ public class LicenseController { @Autowired private LicenseService licenseService; + @GetMapping("page") + public Page page(PageQuery pageQuery, LicenseListReq req) { + // TODO 参数校验 + return licenseService.page(pageQuery, req); + } + @PostMapping("create") public LicenseCreateRes create(@RequestBody LicenseCreateReq req) { // TODO 参数校验 diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/req/LicenseListReq.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/req/LicenseListReq.java new file mode 100644 index 00000000..9d7c68fa --- /dev/null +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/req/LicenseListReq.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2022 aoshiguchen + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package fun.asgc.neutrino.proxy.server.controller.req; + +import lombok.Data; + +/** + * + * @author: aoshiguchen + * @date: 2022/8/6 + */ +@Data +public class LicenseListReq { + +} diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/res/LicenseListRes.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/res/LicenseListRes.java new file mode 100644 index 00000000..3af4bd14 --- /dev/null +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/controller/res/LicenseListRes.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2022 aoshiguchen + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package fun.asgc.neutrino.proxy.server.controller.res; + +import fun.asgc.neutrino.core.db.annotation.Id; +import fun.asgc.neutrino.proxy.server.base.rest.constant.OnlineStatusEnum; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.Date; + +/** + * + * @author: aoshiguchen + * @date: 2022/8/6 + */ +@Accessors(chain = true) +@Data +public class LicenseListRes { + @Id + private Integer id; + /** + * 名称 + */ + private String name; + /** + * licenseKey + */ + private String key; + /** + * 用户ID + */ + private Integer userId; + /** + * 用户名 + */ + private String userName; + /** + * 是否在线 + * {@link OnlineStatusEnum} + */ + private Integer isOnline; + /** + * 启用状态 + * {@link fun.asgc.neutrino.proxy.server.base.rest.constant.EnableStatusEnum} + */ + private Integer enable; + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新时间 + */ + private Date updateTime; +} diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/dal/LicenseMapper.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/dal/LicenseMapper.java index fd5da8a9..5ce937dc 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/dal/LicenseMapper.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/dal/LicenseMapper.java @@ -27,6 +27,9 @@ import fun.asgc.neutrino.core.db.annotation.Delete; import fun.asgc.neutrino.core.db.annotation.Select; import fun.asgc.neutrino.core.db.annotation.Update; import fun.asgc.neutrino.core.db.mapper.SqlMapper; +import fun.asgc.neutrino.core.db.page.Page; +import fun.asgc.neutrino.core.db.page.PageQuery; +import fun.asgc.neutrino.proxy.server.controller.req.LicenseListReq; import fun.asgc.neutrino.proxy.server.dal.entity.LicenseDO; import java.util.Date; @@ -39,6 +42,13 @@ import java.util.Date; @Component public interface LicenseMapper extends SqlMapper { + /** + * 查询license分页 + * @param page + * @param req + */ + void page(Page page, LicenseListReq req); + /** * 新增license * @param license diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/dal/UserMapper.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/dal/UserMapper.java index 9b191ae1..26bc5a18 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/dal/UserMapper.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/dal/UserMapper.java @@ -22,10 +22,14 @@ package fun.asgc.neutrino.proxy.server.dal; import fun.asgc.neutrino.core.annotation.Component; +import fun.asgc.neutrino.core.db.annotation.ResultType; import fun.asgc.neutrino.core.db.annotation.Select; import fun.asgc.neutrino.core.db.mapper.SqlMapper; import fun.asgc.neutrino.proxy.server.dal.entity.UserDO; +import java.util.List; +import java.util.Set; + /** * * @author: aoshiguchen @@ -50,4 +54,7 @@ public interface UserMapper extends SqlMapper { @Select("select * from user where id = ?") UserDO findById(Integer id); + @ResultType(UserDO.class) + @Select("select * from user where id in (?)") + List findByIds(Set ids); } diff --git a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/LicenseService.java b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/LicenseService.java index 7ccbdce5..2a11c6b9 100644 --- a/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/LicenseService.java +++ b/neutrino-proxy-server/src/main/java/fun/asgc/neutrino/proxy/server/service/LicenseService.java @@ -23,22 +23,24 @@ package fun.asgc.neutrino.proxy.server.service; import fun.asgc.neutrino.core.annotation.Autowired; import fun.asgc.neutrino.core.annotation.Component; +import fun.asgc.neutrino.core.db.page.Page; +import fun.asgc.neutrino.core.db.page.PageQuery; +import fun.asgc.neutrino.core.util.CollectionUtil; import fun.asgc.neutrino.proxy.server.base.rest.constant.EnableStatusEnum; import fun.asgc.neutrino.proxy.server.base.rest.constant.OnlineStatusEnum; import fun.asgc.neutrino.proxy.server.controller.req.LicenseCreateReq; +import fun.asgc.neutrino.proxy.server.controller.req.LicenseListReq; import fun.asgc.neutrino.proxy.server.controller.req.LicenseUpdateEnableStatusReq; import fun.asgc.neutrino.proxy.server.controller.req.LicenseUpdateReq; -import fun.asgc.neutrino.proxy.server.controller.res.LicenseCreateRes; -import fun.asgc.neutrino.proxy.server.controller.res.LicenseDetailRes; -import fun.asgc.neutrino.proxy.server.controller.res.LicenseUpdateEnableStatusRes; -import fun.asgc.neutrino.proxy.server.controller.res.LicenseUpdateRes; +import fun.asgc.neutrino.proxy.server.controller.res.*; import fun.asgc.neutrino.proxy.server.dal.LicenseMapper; import fun.asgc.neutrino.proxy.server.dal.UserMapper; import fun.asgc.neutrino.proxy.server.dal.entity.LicenseDO; import fun.asgc.neutrino.proxy.server.dal.entity.UserDO; -import java.util.Date; -import java.util.UUID; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; /** * license服务 @@ -53,6 +55,23 @@ public class LicenseService { @Autowired private UserMapper userMapper; + public Page page(PageQuery pageQuery, LicenseListReq req) { + Page page = Page.create(pageQuery); + licenseMapper.page(page, req); + if (!CollectionUtil.isEmpty(page.getRecords())) { + Set userIds = page.getRecords().stream().map(LicenseListRes::getUserId).collect(Collectors.toSet()); + List userList = userMapper.findByIds(userIds); + Map userMap = userList.stream().collect(Collectors.toMap(UserDO::getId, Function.identity())); + for (LicenseListRes item : page.getRecords()) { + UserDO userDO = userMap.get(item.getUserId()); + if (null != userDO) { + item.setUserName(userDO.getName()); + } + } + } + return page; + } + /** * 创建license * @param req diff --git a/neutrino-proxy-server/src/main/resources/mapper/LicenseMapper.xml b/neutrino-proxy-server/src/main/resources/mapper/LicenseMapper.xml index 52a65c78..9f53a5c4 100644 --- a/neutrino-proxy-server/src/main/resources/mapper/LicenseMapper.xml +++ b/neutrino-proxy-server/src/main/resources/mapper/LicenseMapper.xml @@ -1,5 +1,9 @@ + + insert into `license`(`name`,`key`,`user_id`,`is_online`,`enable`,`create_time`,`update_time`) values (:name, :key, :userId, :isOnline, :enable, :createTime, :updateTime) diff --git a/neutrino-proxy-server/src/main/resources/sql/user.data.sql b/neutrino-proxy-server/src/main/resources/sql/user.data.sql index 81c853f2..f544beda 100644 --- a/neutrino-proxy-server/src/main/resources/sql/user.data.sql +++ b/neutrino-proxy-server/src/main/resources/sql/user.data.sql @@ -1,3 +1,3 @@ #用户表 insert into `user`(`id`, `name`,`login_name`,`login_password`,`enable`,`create_time`, `update_time`) values -(1, '管理员', 'admin', 'e10adc3949ba59abbe56e057f20f883e', 1, datetime('now', 'localtime'), datetime('now', 'localtime')); +(1, '管理员', 'admin', 'e10adc3949ba59abbe56e057f20f883e', 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));