diff --git a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/continew/starter/extension/crud/model/entity/BaseCreateDO.java b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/continew/starter/extension/crud/model/entity/BaseCreateDO.java new file mode 100644 index 00000000..6f6282b5 --- /dev/null +++ b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/continew/starter/extension/crud/model/entity/BaseCreateDO.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. + *
+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * http://www.gnu.org/licenses/lgpl.html + *
+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package top.continew.starter.extension.crud.model.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; + +import java.io.Serial; +import java.time.LocalDateTime; + +/** + * 实体类基类 + * + *
+ * 通用字段:创建人、创建时间 + *
+ * + * @author Charles7c + * @since 2.0.1 + */ +public class BaseCreateDO extends BaseIdDO { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + private Long createUser; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + public Long getCreateUser() { + return createUser; + } + + public void setCreateUser(Long createUser) { + this.createUser = createUser; + } + + public LocalDateTime getCreateTime() { + return createTime; + } + + public void setCreateTime(LocalDateTime createTime) { + this.createTime = createTime; + } +} diff --git a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/continew/starter/extension/crud/model/entity/BaseDO.java b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/continew/starter/extension/crud/model/entity/BaseDO.java index c0367c9b..3e17461c 100644 --- a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/continew/starter/extension/crud/model/entity/BaseDO.java +++ b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/continew/starter/extension/crud/model/entity/BaseDO.java @@ -18,10 +18,8 @@ package top.continew.starter.extension.crud.model.entity; import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; import java.io.Serial; -import java.io.Serializable; import java.time.LocalDateTime; /** @@ -30,17 +28,11 @@ import java.time.LocalDateTime; * @author Charles7c * @since 1.0.0 */ -public class BaseDO implements Serializable { +public class BaseDO extends BaseIdDO { @Serial private static final long serialVersionUID = 1L; - /** - * ID - */ - @TableId - private Long id; - /** * 创建人 */ @@ -65,14 +57,6 @@ public class BaseDO implements Serializable { @TableField(fill = FieldFill.UPDATE) private LocalDateTime updateTime; - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - public Long getCreateUser() { return createUser; } diff --git a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/continew/starter/extension/crud/model/entity/BaseIdDO.java b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/continew/starter/extension/crud/model/entity/BaseIdDO.java new file mode 100644 index 00000000..4d07e1c4 --- /dev/null +++ b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/continew/starter/extension/crud/model/entity/BaseIdDO.java @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. + *+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * http://www.gnu.org/licenses/lgpl.html + *
+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package top.continew.starter.extension.crud.model.entity; + +import com.baomidou.mybatisplus.annotation.TableId; + +import java.io.Serial; +import java.io.Serializable; + +/** + * 实体类基类 + * + *
+ * 通用字段:ID 主键 + *
+ * + * @author Charles7c + * @since 2.0.1 + */ +public class BaseIdDO implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @TableId + private Long id; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } +} diff --git a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/continew/starter/extension/crud/model/entity/BaseUpdateDO.java b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/continew/starter/extension/crud/model/entity/BaseUpdateDO.java new file mode 100644 index 00000000..c1c85cdf --- /dev/null +++ b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/continew/starter/extension/crud/model/entity/BaseUpdateDO.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. + *+ * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * http://www.gnu.org/licenses/lgpl.html + *
+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package top.continew.starter.extension.crud.model.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; + +import java.io.Serial; +import java.time.LocalDateTime; + +/** + * 实体类基类 + * + *
+ * 通用字段:创建人、创建时间 + *
+ * + * @author Charles7c + * @since 2.0.1 + */ +public class BaseUpdateDO extends BaseIdDO { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 修改人 + */ + @TableField(fill = FieldFill.UPDATE) + private Long updateUser; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.UPDATE) + private LocalDateTime updateTime; + + public Long getUpdateUser() { + return updateUser; + } + + public void setUpdateUser(Long updateUser) { + this.updateUser = updateUser; + } + + public LocalDateTime getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(LocalDateTime updateTime) { + this.updateTime = updateTime; + } +} diff --git a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/continew/starter/extension/crud/service/BaseService.java b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/continew/starter/extension/crud/service/BaseService.java index fc9a5d8c..d56e1ac2 100644 --- a/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/continew/starter/extension/crud/service/BaseService.java +++ b/continew-starter-extension/continew-starter-extension-crud/src/main/java/top/continew/starter/extension/crud/service/BaseService.java @@ -18,7 +18,6 @@ package top.continew.starter.extension.crud.service; import cn.hutool.core.lang.tree.Tree; import jakarta.servlet.http.HttpServletResponse; -import top.continew.starter.extension.crud.model.req.BaseReq; import top.continew.starter.extension.crud.model.query.PageQuery; import top.continew.starter.extension.crud.model.query.SortQuery; import top.continew.starter.extension.crud.model.resp.PageResp; @@ -35,7 +34,7 @@ import java.util.List; * @author Charles7c * @since 1.0.0 */ -public interface BaseService