diff --git a/src/main/java/com/isu/gaswellwatch/constants/UserConstant.java b/src/main/java/com/isu/gaswellwatch/constants/UserConstant.java index 974b313..58dad69 100644 --- a/src/main/java/com/isu/gaswellwatch/constants/UserConstant.java +++ b/src/main/java/com/isu/gaswellwatch/constants/UserConstant.java @@ -5,7 +5,7 @@ public class UserConstant { public static final String MENU_LIST_PREFIX = "gwwMenuList:"; public static final String DEFAULT_PASSWORD = "123456"; public static final String NORMAL = "1"; - public static final String FORBIDDEN = "2"; + public static final String FORBIDDEN = "0"; public static final Long MENU_ROOT_ID = 0L; public static final Long SUPER_ADMIN_ID = 1L; public static final String HEADER_TOKEN_NAME = "gwwToken"; diff --git a/src/main/java/com/isu/gaswellwatch/controller/CompanyController.java b/src/main/java/com/isu/gaswellwatch/controller/CompanyController.java new file mode 100644 index 0000000..10946dd --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/controller/CompanyController.java @@ -0,0 +1,55 @@ +package com.isu.gaswellwatch.controller; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.isu.gaswellwatch.annotation.OperationLog; +import com.isu.gaswellwatch.dto.CompanyDTO; +import com.isu.gaswellwatch.dto.CompanyEditDTO; +import com.isu.gaswellwatch.entity.Response; +import com.isu.gaswellwatch.enums.LogType; +import com.isu.gaswellwatch.service.CompanyService; +import com.isu.gaswellwatch.vo.CompanyVO; +import jakarta.annotation.Resource; +import jakarta.validation.Valid; +import org.springframework.web.bind.annotation.*; + + +@RestController +@RequestMapping("company") +public class CompanyController { + /** + * 服务对象 + */ + @Resource + private CompanyService companyService; + + @GetMapping("/page") + public Response> page(@RequestParam(defaultValue = "1") Integer currentPage, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(required = false) String name, + @RequestParam(required = false) String code){ + return Response.succeed(companyService.page(currentPage,pageSize,name,code)); + } + + @PostMapping("/add") + @OperationLog(description = "新增公司",type = LogType.ADD) + public Response add(@RequestBody @Valid CompanyDTO companyDTO){ + companyService.add(companyDTO); + return Response.succeed(); + } + + @PostMapping("/edit") + @OperationLog(description = "修改公司",type = LogType.UPDATE) + public Response edit(@RequestBody @Valid CompanyEditDTO companyEditDTO){ + companyService.edit(companyEditDTO); + return Response.succeed(); + } + + @GetMapping("/delete") + @OperationLog(description = "删除公司",type = LogType.DELETE) + public Response delete(@RequestParam Long id){ + companyService.delete(id); + return Response.succeed(); + } +} + diff --git a/src/main/java/com/isu/gaswellwatch/dao/CompanyDao.java b/src/main/java/com/isu/gaswellwatch/dao/CompanyDao.java new file mode 100644 index 0000000..fee2e0d --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/dao/CompanyDao.java @@ -0,0 +1,22 @@ +package com.isu.gaswellwatch.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.isu.gaswellwatch.entity.Company; +import com.isu.gaswellwatch.vo.CompanyVO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Mapper +@Repository +public interface CompanyDao extends BaseMapper { + + Page page(Page page, + @Param("name") String name, + @Param("code") String code + ); +} + diff --git a/src/main/java/com/isu/gaswellwatch/dto/CompanyDTO.java b/src/main/java/com/isu/gaswellwatch/dto/CompanyDTO.java new file mode 100644 index 0000000..70cc699 --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/dto/CompanyDTO.java @@ -0,0 +1,23 @@ +package com.isu.gaswellwatch.dto; + +import jakarta.validation.constraints.NotBlank; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class CompanyDTO { + //公司名称 + @NotBlank(message = "名称不能为空") + private String name; + //描述 + private String description; + //公司编号 + private String code; + +} diff --git a/src/main/java/com/isu/gaswellwatch/dto/CompanyEditDTO.java b/src/main/java/com/isu/gaswellwatch/dto/CompanyEditDTO.java new file mode 100644 index 0000000..ad52e74 --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/dto/CompanyEditDTO.java @@ -0,0 +1,25 @@ +package com.isu.gaswellwatch.dto; + +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class CompanyEditDTO { + @NotNull(message = "id不能为空") + private Long id; + //名称 + @NotBlank(message = "名称不能为空") + private String name; + //描述 + private String description; + //编号 + private String code; +} diff --git a/src/main/java/com/isu/gaswellwatch/entity/Company.java b/src/main/java/com/isu/gaswellwatch/entity/Company.java new file mode 100644 index 0000000..43ccb0e --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/entity/Company.java @@ -0,0 +1,30 @@ +package com.isu.gaswellwatch.entity; + +import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Builder; +import lombok.Data; + +import java.util.Date; + +@Data +@Builder +public class Company extends Model { + + private Long id; + //名称 + private String name; + //描述 + private String description; + //公司编码 + private String code; + //创建时间 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date createTime; + //更新时间 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date updateTime; + + +} + diff --git a/src/main/java/com/isu/gaswellwatch/service/CompanyService.java b/src/main/java/com/isu/gaswellwatch/service/CompanyService.java new file mode 100644 index 0000000..b02c119 --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/service/CompanyService.java @@ -0,0 +1,17 @@ +package com.isu.gaswellwatch.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.isu.gaswellwatch.dto.CompanyDTO; +import com.isu.gaswellwatch.dto.CompanyEditDTO; +import com.isu.gaswellwatch.entity.Company; +import com.isu.gaswellwatch.vo.CompanyVO; + +public interface CompanyService extends IService { + + Page page(Integer currentPage, Integer pageSize, String name,String code); + void add(CompanyDTO companyDTO); + void edit(CompanyEditDTO companyEditDTO); + void delete(Long id); +} + diff --git a/src/main/java/com/isu/gaswellwatch/service/impl/CompanyServiceImpl.java b/src/main/java/com/isu/gaswellwatch/service/impl/CompanyServiceImpl.java new file mode 100644 index 0000000..489a472 --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/service/impl/CompanyServiceImpl.java @@ -0,0 +1,66 @@ +package com.isu.gaswellwatch.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.isu.gaswellwatch.config.SnowflakeConfig; +import com.isu.gaswellwatch.service.CompanyService; +import com.isu.gaswellwatch.dao.CompanyDao; +import com.isu.gaswellwatch.dto.*; +import com.isu.gaswellwatch.entity.Company; +import com.isu.gaswellwatch.exception.BusinessException; +import com.isu.gaswellwatch.utils.ConverterUtil; +import com.isu.gaswellwatch.vo.CompanyVO; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service("companyService") +@Transactional(rollbackFor = Exception.class) +public class CompanyServiceImpl extends ServiceImpl implements CompanyService { + + @Resource + private SnowflakeConfig snowflakeConfig; + + @Resource + private CompanyDao companyDao; + + @Override + public Page page(Integer currentPage, Integer pageSize, String name,String code){ + Page page = companyDao.page(new Page<>(currentPage, pageSize),name,code); + return ConverterUtil.convertPage(page,CompanyVO.class); + } + + @Override + public void add(CompanyDTO companyDTO){ + //查重 + List list = list(new LambdaQueryWrapper().eq(Company::getName, companyDTO.getName())); + if(CollectionUtil.isNotEmpty(list)) { + throw new BusinessException("已有相同名称,请重新输入"); + } + Long companyId = snowflakeConfig.snowflakeId(); + save(Company.builder().id(companyId).name(companyDTO.getName()).description(companyDTO.getDescription()).code(companyDTO.getCode()).build()); + } + + @Override + public void edit(CompanyEditDTO companyEditDTO){ + List list = list(new LambdaQueryWrapper().eq(Company::getName, companyEditDTO.getName()).ne(Company::getId, companyEditDTO.getId())); + if(CollectionUtil.isNotEmpty(list)) { + throw new BusinessException("公司名称已存在,请重新输入"); + } + updateById(ConverterUtil.convert(companyEditDTO, Company.class)); + } + + @Override + public void delete(Long id){ + //TODO 如果公司绑定了气井 不能删除 + + //删除 + removeById(id); + } + +} + diff --git a/src/main/java/com/isu/gaswellwatch/vo/CompanyVO.java b/src/main/java/com/isu/gaswellwatch/vo/CompanyVO.java new file mode 100644 index 0000000..a26ad06 --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/vo/CompanyVO.java @@ -0,0 +1,27 @@ +package com.isu.gaswellwatch.vo; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class CompanyVO implements Serializable { + private Long id; + //名称 + private String name; + //描述 + private String description; + //编号 + private String code; + //创建时间 + private String createTime; + //更新时间 + private String updateTime; +} diff --git a/src/main/resources/gaswellwatch.sql b/src/main/resources/gaswellwatch.sql index e8c75bf..885d6a8 100644 --- a/src/main/resources/gaswellwatch.sql +++ b/src/main/resources/gaswellwatch.sql @@ -11,27 +11,47 @@ Target Server Version : 80034 File Encoding : 65001 - Date: 30/10/2024 11:13:08 + Date: 01/11/2024 16:44:33 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; +-- ---------------------------- +-- Table structure for company +-- ---------------------------- +DROP TABLE IF EXISTS `company`; +CREATE TABLE `company` ( + `id` bigint NOT NULL, + `name` varchar(255) DEFAULT NULL COMMENT '公司名称', + `description` varchar(500) DEFAULT NULL COMMENT '描述', + `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `code` varchar(100) DEFAULT NULL COMMENT '公司编号', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +-- ---------------------------- +-- Records of company +-- ---------------------------- +BEGIN; +COMMIT; + -- ---------------------------- -- Table structure for menu -- ---------------------------- DROP TABLE IF EXISTS `menu`; CREATE TABLE `menu` ( - `id` bigint NOT NULL, - `parent` bigint DEFAULT NULL COMMENT '父节点', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '名称', - `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '编码', - `icon` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '图标', - `sort` int DEFAULT '0' COMMENT '顺序', - `extra` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '外部数据', - `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - PRIMARY KEY (`id`) USING BTREE + `id` bigint NOT NULL, + `parent` bigint DEFAULT NULL COMMENT '父节点', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '名称', + `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '编码', + `icon` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '图标', + `sort` int DEFAULT '0' COMMENT '顺序', + `extra` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '外部数据', + `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- ---------------------------- @@ -53,12 +73,12 @@ COMMIT; -- ---------------------------- DROP TABLE IF EXISTS `role`; CREATE TABLE `role` ( - `id` bigint NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '名称', - `description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '描述', - `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - PRIMARY KEY (`id`) USING BTREE + `id` bigint NOT NULL, + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '名称', + `description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '描述', + `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- ---------------------------- @@ -77,13 +97,13 @@ COMMIT; -- ---------------------------- DROP TABLE IF EXISTS `role_menu`; CREATE TABLE `role_menu` ( - `id` bigint NOT NULL, - `role_id` bigint DEFAULT NULL COMMENT '角色id', - `menu_id` bigint DEFAULT NULL COMMENT '菜单id', - `identifier` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '类型(0只能查,1可查可控,2编辑组态)', - `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - PRIMARY KEY (`id`) USING BTREE + `id` bigint NOT NULL, + `role_id` bigint DEFAULT NULL COMMENT '角色id', + `menu_id` bigint DEFAULT NULL COMMENT '菜单id', + `identifier` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '类型(0只能查,1可查可控,2编辑组态)', + `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- ---------------------------- @@ -105,16 +125,16 @@ COMMIT; -- ---------------------------- DROP TABLE IF EXISTS `user`; CREATE TABLE `user` ( - `id` bigint NOT NULL, - `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '账户', - `password` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '密码', - `nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '昵称', - `phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '手机号', - `picture` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '头像', - `is_enable` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '是否启用(1启用,2冻结)', - `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - PRIMARY KEY (`id`) USING BTREE + `id` bigint NOT NULL, + `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '账户', + `password` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '密码', + `nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '昵称', + `phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '手机号', + `picture` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '头像', + `is_enable` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '是否启用(1启用,0冻结)', + `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- ---------------------------- @@ -131,21 +151,21 @@ COMMIT; -- ---------------------------- DROP TABLE IF EXISTS `user_operation_record`; CREATE TABLE `user_operation_record` ( - `id` bigint NOT NULL, - `type` int DEFAULT NULL COMMENT '日志类型(1登录 )', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '日志标题', - `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '用户名', - `uri` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '请求地址', - `menu` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '菜单', - `request` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '请求参数', - `request_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '请求类型', - `error_msg` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '错误消息', - `cost_time` bigint DEFAULT NULL COMMENT '请求时间', - `result` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '请求结果(0成功,1失败)', - `ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '登录ip', - `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - PRIMARY KEY (`id`) USING BTREE + `id` bigint NOT NULL, + `type` int DEFAULT NULL COMMENT '日志类型(1登录 )', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '日志标题', + `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '用户名', + `uri` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '请求地址', + `menu` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '菜单', + `request` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '请求参数', + `request_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '请求类型', + `error_msg` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '错误消息', + `cost_time` bigint DEFAULT NULL COMMENT '请求时间', + `result` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '请求结果(0成功,1失败)', + `ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '登录ip', + `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- ---------------------------- @@ -159,12 +179,12 @@ COMMIT; -- ---------------------------- DROP TABLE IF EXISTS `user_role`; CREATE TABLE `user_role` ( - `id` bigint NOT NULL, - `user_id` bigint DEFAULT NULL COMMENT '用户id', - `role_id` bigint DEFAULT NULL COMMENT '角色id', - `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - PRIMARY KEY (`id`) USING BTREE + `id` bigint NOT NULL, + `user_id` bigint DEFAULT NULL COMMENT '用户id', + `role_id` bigint DEFAULT NULL COMMENT '角色id', + `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; -- ---------------------------- diff --git a/src/main/resources/mapper/CompanyDao.xml b/src/main/resources/mapper/CompanyDao.xml new file mode 100644 index 0000000..6456f56 --- /dev/null +++ b/src/main/resources/mapper/CompanyDao.xml @@ -0,0 +1,20 @@ + + + + + + + +