diff --git a/src/main/java/com/isu/gaswellwatch/controller/CompanyController.java b/src/main/java/com/isu/gaswellwatch/controller/CompanyController.java deleted file mode 100644 index 10946dd..0000000 --- a/src/main/java/com/isu/gaswellwatch/controller/CompanyController.java +++ /dev/null @@ -1,55 +0,0 @@ -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/controller/DepartmentController.java b/src/main/java/com/isu/gaswellwatch/controller/DepartmentController.java new file mode 100644 index 0000000..00f65e1 --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/controller/DepartmentController.java @@ -0,0 +1,63 @@ +package com.isu.gaswellwatch.controller; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.isu.gaswellwatch.annotation.OperationLog; +import com.isu.gaswellwatch.dto.DepartmentDTO; +import com.isu.gaswellwatch.dto.DepartmentEditDTO; +import com.isu.gaswellwatch.entity.Department; +import com.isu.gaswellwatch.entity.Response; +import com.isu.gaswellwatch.enums.LogType; +import com.isu.gaswellwatch.service.DepartmentService; +import com.isu.gaswellwatch.vo.DepartmentVO; +import jakarta.annotation.Resource; +import jakarta.validation.Valid; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + + +@RestController +@RequestMapping("department") +public class DepartmentController { + /** + * 服务对象 + */ + @Resource + private DepartmentService departmentService; + + @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(departmentService.page(currentPage,pageSize,name,code)); + } + + @PostMapping("/add") + @OperationLog(description = "新增部门",type = LogType.ADD) + public Response add(@RequestBody @Valid DepartmentDTO companyDTO){ + departmentService.add(companyDTO); + return Response.succeed(); + } + + @PostMapping("/edit") + @OperationLog(description = "修改部门",type = LogType.UPDATE) + public Response edit(@RequestBody @Valid DepartmentEditDTO departmentEditDTO){ + departmentService.edit(departmentEditDTO); + return Response.succeed(); + } + + @GetMapping("/delete") + @OperationLog(description = "删除部门",type = LogType.DELETE) + public Response delete(@RequestParam Long id){ + departmentService.delete(id); + return Response.succeed(); + } + + @GetMapping("/list") + public Response> list(){ + return Response.succeed(departmentService.list()); + } +} + diff --git a/src/main/java/com/isu/gaswellwatch/controller/RoleController.java b/src/main/java/com/isu/gaswellwatch/controller/RoleController.java index edccc96..8bfcd8c 100644 --- a/src/main/java/com/isu/gaswellwatch/controller/RoleController.java +++ b/src/main/java/com/isu/gaswellwatch/controller/RoleController.java @@ -6,13 +6,15 @@ import com.isu.gaswellwatch.annotation.OperationLog; import com.isu.gaswellwatch.dto.RoleDTO; import com.isu.gaswellwatch.dto.RoleEditDTO; import com.isu.gaswellwatch.entity.Response; +import com.isu.gaswellwatch.entity.Role; import com.isu.gaswellwatch.enums.LogType; import com.isu.gaswellwatch.service.RoleService; -import com.isu.gaswellwatch.vo.RoleVO; import jakarta.annotation.Resource; import jakarta.validation.Valid; import org.springframework.web.bind.annotation.*; +import java.util.List; + @RestController @RequestMapping("role") @@ -24,9 +26,9 @@ public class RoleController { private RoleService roleService; @GetMapping("/page") - public Response> page(@RequestParam(defaultValue = "1") Integer currentPage, - @RequestParam(defaultValue = "10") Integer pageSize, - @RequestParam(required = false) String name){ + public Response> page(@RequestParam(defaultValue = "1") Integer currentPage, + @RequestParam(defaultValue = "10") Integer pageSize, + @RequestParam(required = false) String name){ return Response.succeed(roleService.page(currentPage,pageSize,name)); } @@ -50,5 +52,10 @@ public class RoleController { roleService.delete(id); return Response.succeed(); } + + @GetMapping("/list") + public Response> delete(){ + return Response.succeed(roleService.list()); + } } diff --git a/src/main/java/com/isu/gaswellwatch/dao/CompanyDao.java b/src/main/java/com/isu/gaswellwatch/dao/DepartmentDao.java similarity index 51% rename from src/main/java/com/isu/gaswellwatch/dao/CompanyDao.java rename to src/main/java/com/isu/gaswellwatch/dao/DepartmentDao.java index fee2e0d..5a3062d 100644 --- a/src/main/java/com/isu/gaswellwatch/dao/CompanyDao.java +++ b/src/main/java/com/isu/gaswellwatch/dao/DepartmentDao.java @@ -2,21 +2,19 @@ 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 com.isu.gaswellwatch.entity.Department; +import com.isu.gaswellwatch.vo.DepartmentVO; 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 { +public interface DepartmentDao extends BaseMapper { - Page page(Page page, - @Param("name") String name, - @Param("code") String code + Page page(Page page, + @Param("name") String name, + @Param("code") String code ); } diff --git a/src/main/java/com/isu/gaswellwatch/dao/UserDepartmentDao.java b/src/main/java/com/isu/gaswellwatch/dao/UserDepartmentDao.java new file mode 100644 index 0000000..6eeb532 --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/dao/UserDepartmentDao.java @@ -0,0 +1,13 @@ +package com.isu.gaswellwatch.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.isu.gaswellwatch.entity.UserDepartment; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Repository; + +@Mapper +@Repository +public interface UserDepartmentDao extends BaseMapper { + +} + diff --git a/src/main/java/com/isu/gaswellwatch/dto/CompanyDTO.java b/src/main/java/com/isu/gaswellwatch/dto/DepartmentDTO.java similarity index 93% rename from src/main/java/com/isu/gaswellwatch/dto/CompanyDTO.java rename to src/main/java/com/isu/gaswellwatch/dto/DepartmentDTO.java index 70cc699..710be7b 100644 --- a/src/main/java/com/isu/gaswellwatch/dto/CompanyDTO.java +++ b/src/main/java/com/isu/gaswellwatch/dto/DepartmentDTO.java @@ -11,7 +11,7 @@ import lombok.NoArgsConstructor; @Builder @AllArgsConstructor @NoArgsConstructor -public class CompanyDTO { +public class DepartmentDTO { //公司名称 @NotBlank(message = "名称不能为空") private String name; diff --git a/src/main/java/com/isu/gaswellwatch/dto/CompanyEditDTO.java b/src/main/java/com/isu/gaswellwatch/dto/DepartmentEditDTO.java similarity index 94% rename from src/main/java/com/isu/gaswellwatch/dto/CompanyEditDTO.java rename to src/main/java/com/isu/gaswellwatch/dto/DepartmentEditDTO.java index ad52e74..1b65bc5 100644 --- a/src/main/java/com/isu/gaswellwatch/dto/CompanyEditDTO.java +++ b/src/main/java/com/isu/gaswellwatch/dto/DepartmentEditDTO.java @@ -12,7 +12,7 @@ import lombok.NoArgsConstructor; @Builder @AllArgsConstructor @NoArgsConstructor -public class CompanyEditDTO { +public class DepartmentEditDTO { @NotNull(message = "id不能为空") private Long id; //名称 diff --git a/src/main/java/com/isu/gaswellwatch/dto/UserEditDTO.java b/src/main/java/com/isu/gaswellwatch/dto/UserEditDTO.java index 4457472..07ad439 100644 --- a/src/main/java/com/isu/gaswellwatch/dto/UserEditDTO.java +++ b/src/main/java/com/isu/gaswellwatch/dto/UserEditDTO.java @@ -32,4 +32,7 @@ public class UserEditDTO { @NotNull(message = "角色不能为空") private List roles; + //部门ID + private Long departmentId; + } diff --git a/src/main/java/com/isu/gaswellwatch/entity/Company.java b/src/main/java/com/isu/gaswellwatch/entity/Department.java similarity index 92% rename from src/main/java/com/isu/gaswellwatch/entity/Company.java rename to src/main/java/com/isu/gaswellwatch/entity/Department.java index 43ccb0e..6210059 100644 --- a/src/main/java/com/isu/gaswellwatch/entity/Company.java +++ b/src/main/java/com/isu/gaswellwatch/entity/Department.java @@ -9,7 +9,7 @@ import java.util.Date; @Data @Builder -public class Company extends Model { +public class Department extends Model { private Long id; //名称 diff --git a/src/main/java/com/isu/gaswellwatch/entity/UserDepartment.java b/src/main/java/com/isu/gaswellwatch/entity/UserDepartment.java new file mode 100644 index 0000000..60adc16 --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/entity/UserDepartment.java @@ -0,0 +1,28 @@ +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 UserDepartment extends Model { + + private Long id; + //用户id + private Long userId; + //角色id + private Long departmentId; + //创建时间 + @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 deleted file mode 100644 index b02c119..0000000 --- a/src/main/java/com/isu/gaswellwatch/service/CompanyService.java +++ /dev/null @@ -1,17 +0,0 @@ -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/DepartmentService.java b/src/main/java/com/isu/gaswellwatch/service/DepartmentService.java new file mode 100644 index 0000000..e66dfbb --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/service/DepartmentService.java @@ -0,0 +1,20 @@ +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.DepartmentDTO; +import com.isu.gaswellwatch.dto.DepartmentEditDTO; +import com.isu.gaswellwatch.entity.Department; +import com.isu.gaswellwatch.vo.DepartmentVO; + +import java.util.List; + +public interface DepartmentService extends IService { + + Page page(Integer currentPage, Integer pageSize, String name, String code); + void add(DepartmentDTO companyDTO); + void edit(DepartmentEditDTO departmentEditDTO); + void delete(Long id); + +} + diff --git a/src/main/java/com/isu/gaswellwatch/service/RoleService.java b/src/main/java/com/isu/gaswellwatch/service/RoleService.java index 5e127e3..1f7b271 100644 --- a/src/main/java/com/isu/gaswellwatch/service/RoleService.java +++ b/src/main/java/com/isu/gaswellwatch/service/RoleService.java @@ -9,7 +9,7 @@ import com.isu.gaswellwatch.vo.RoleVO; public interface RoleService extends IService { - Page page(Integer currentPage, Integer pageSize, String name); + Page page(Integer currentPage, Integer pageSize, String name); void add(RoleDTO roleDTO); void edit(RoleEditDTO roleEditDTO); void delete(Long id); diff --git a/src/main/java/com/isu/gaswellwatch/service/UserDepartmentService.java b/src/main/java/com/isu/gaswellwatch/service/UserDepartmentService.java new file mode 100644 index 0000000..249697a --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/service/UserDepartmentService.java @@ -0,0 +1,9 @@ +package com.isu.gaswellwatch.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.isu.gaswellwatch.entity.UserDepartment; + +public interface UserDepartmentService extends IService { + +} + diff --git a/src/main/java/com/isu/gaswellwatch/service/impl/CompanyServiceImpl.java b/src/main/java/com/isu/gaswellwatch/service/impl/CompanyServiceImpl.java deleted file mode 100644 index 489a472..0000000 --- a/src/main/java/com/isu/gaswellwatch/service/impl/CompanyServiceImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -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/service/impl/DepartmentServiceImpl.java b/src/main/java/com/isu/gaswellwatch/service/impl/DepartmentServiceImpl.java new file mode 100644 index 0000000..f27e8ac --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/service/impl/DepartmentServiceImpl.java @@ -0,0 +1,67 @@ +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.DepartmentService; +import com.isu.gaswellwatch.dao.DepartmentDao; +import com.isu.gaswellwatch.dto.*; +import com.isu.gaswellwatch.entity.Department; +import com.isu.gaswellwatch.exception.BusinessException; +import com.isu.gaswellwatch.utils.ConverterUtil; +import com.isu.gaswellwatch.vo.DepartmentVO; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Service("departmentService") +@Transactional(rollbackFor = Exception.class) +public class DepartmentServiceImpl extends ServiceImpl implements DepartmentService { + + @Resource + private SnowflakeConfig snowflakeConfig; + + @Resource + private DepartmentDao 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, DepartmentVO.class); + } + + @Override + public void add(DepartmentDTO companyDTO){ + //查重 + List list = list(new LambdaQueryWrapper().eq(Department::getName, companyDTO.getName())); + if(CollectionUtil.isNotEmpty(list)) { + throw new BusinessException("已有相同名称,请重新输入"); + } + Long companyId = snowflakeConfig.snowflakeId(); + save(Department.builder().id(companyId).name(companyDTO.getName()).description(companyDTO.getDescription()).code(companyDTO.getCode()).build()); + } + + @Override + public void edit(DepartmentEditDTO departmentEditDTO){ + List list = list(new LambdaQueryWrapper().eq(Department::getName, departmentEditDTO.getName()).ne(Department::getId, departmentEditDTO.getId())); + if(CollectionUtil.isNotEmpty(list)) { + throw new BusinessException("部门名称已存在,请重新输入"); + } + updateById(ConverterUtil.convert(departmentEditDTO, Department.class)); + } + + @Override + public void delete(Long id){ + //TODO 如果部门绑定了气井 不能删除 + + //删除 + removeById(id); + } + + +} + diff --git a/src/main/java/com/isu/gaswellwatch/service/impl/RoleServiceImpl.java b/src/main/java/com/isu/gaswellwatch/service/impl/RoleServiceImpl.java index 99dda9f..0579001 100644 --- a/src/main/java/com/isu/gaswellwatch/service/impl/RoleServiceImpl.java +++ b/src/main/java/com/isu/gaswellwatch/service/impl/RoleServiceImpl.java @@ -42,9 +42,8 @@ public class RoleServiceImpl extends ServiceImpl implements RoleS private UserRoleService userRoleService; @Override - public Page page(Integer currentPage, Integer pageSize, String name){ - Page page = page(new Page<>(currentPage, pageSize), new LambdaQueryWrapper().like(StringUtils.isNotBlank(name), Role::getName, name).orderByDesc(Role::getCreateTime)); - return ConverterUtil.convertPage(page,RoleVO.class); + public Page page(Integer currentPage, Integer pageSize, String name){ + return page(new Page<>(currentPage, pageSize), new LambdaQueryWrapper().like(StringUtils.isNotBlank(name), Role::getName, name).orderByDesc(Role::getCreateTime)); } @Override diff --git a/src/main/java/com/isu/gaswellwatch/service/impl/UserDepartmentServiceImpl.java b/src/main/java/com/isu/gaswellwatch/service/impl/UserDepartmentServiceImpl.java new file mode 100644 index 0000000..b2d2068 --- /dev/null +++ b/src/main/java/com/isu/gaswellwatch/service/impl/UserDepartmentServiceImpl.java @@ -0,0 +1,15 @@ +package com.isu.gaswellwatch.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.isu.gaswellwatch.dao.UserDepartmentDao; +import com.isu.gaswellwatch.entity.UserDepartment; +import com.isu.gaswellwatch.service.UserDepartmentService; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service("userDepartmentService") +@Transactional(rollbackFor = Exception.class) +public class UserDepartmentServiceImpl extends ServiceImpl implements UserDepartmentService { + +} + diff --git a/src/main/java/com/isu/gaswellwatch/service/impl/UserServiceImpl.java b/src/main/java/com/isu/gaswellwatch/service/impl/UserServiceImpl.java index 13beea2..e54003b 100644 --- a/src/main/java/com/isu/gaswellwatch/service/impl/UserServiceImpl.java +++ b/src/main/java/com/isu/gaswellwatch/service/impl/UserServiceImpl.java @@ -17,9 +17,11 @@ import com.isu.gaswellwatch.dto.ModifyPasswordDTO; import com.isu.gaswellwatch.dto.UserDTO; import com.isu.gaswellwatch.dto.UserEditDTO; import com.isu.gaswellwatch.entity.User; +import com.isu.gaswellwatch.entity.UserDepartment; import com.isu.gaswellwatch.entity.UserExport; import com.isu.gaswellwatch.entity.UserRole; import com.isu.gaswellwatch.exception.BusinessException; +import com.isu.gaswellwatch.service.UserDepartmentService; import com.isu.gaswellwatch.service.UserRoleService; import com.isu.gaswellwatch.service.UserService; import com.isu.gaswellwatch.utils.ConverterUtil; @@ -48,6 +50,8 @@ public class UserServiceImpl extends ServiceImpl implements UserS @Resource private UserRoleService userRoleService; @Resource + private UserDepartmentService userDepartmentService; + @Resource private SnowflakeConfig snowflakeConfig; @Resource private MenuServiceImpl menuService; @@ -143,6 +147,16 @@ public class UserServiceImpl extends ServiceImpl implements UserS //关联更新 userRoleService.remove(new LambdaQueryWrapper().eq(UserRole::getUserId, user.getId())); addRelation(userEditDTO.getRoles(), user); + + if(userEditDTO.getDepartmentId()!=null){ + userDepartmentService.remove(new LambdaQueryWrapper().eq(UserDepartment::getUserId, user.getId())); + addDepartment(userEditDTO.getDepartmentId(), user); + } + + } + + private void addDepartment(Long departmentId, User user) { + UserDepartment.builder().id(snowflakeConfig.snowflakeId()).userId(user.getId()).departmentId(departmentId).build().insert(); } @Override diff --git a/src/main/java/com/isu/gaswellwatch/vo/CompanyVO.java b/src/main/java/com/isu/gaswellwatch/vo/DepartmentVO.java similarity index 86% rename from src/main/java/com/isu/gaswellwatch/vo/CompanyVO.java rename to src/main/java/com/isu/gaswellwatch/vo/DepartmentVO.java index a26ad06..795332a 100644 --- a/src/main/java/com/isu/gaswellwatch/vo/CompanyVO.java +++ b/src/main/java/com/isu/gaswellwatch/vo/DepartmentVO.java @@ -6,13 +6,12 @@ import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; -import java.util.List; @Data @Builder @AllArgsConstructor @NoArgsConstructor -public class CompanyVO implements Serializable { +public class DepartmentVO implements Serializable { private Long id; //名称 private String name; diff --git a/src/main/java/com/isu/gaswellwatch/vo/RoleVO.java b/src/main/java/com/isu/gaswellwatch/vo/RoleVO.java index 62898ad..c48a8cb 100644 --- a/src/main/java/com/isu/gaswellwatch/vo/RoleVO.java +++ b/src/main/java/com/isu/gaswellwatch/vo/RoleVO.java @@ -17,4 +17,6 @@ public class RoleVO implements Serializable { private String name; //描述 private String description; + //创建时间 + private String createTime; } diff --git a/src/main/java/com/isu/gaswellwatch/vo/UserVO.java b/src/main/java/com/isu/gaswellwatch/vo/UserVO.java index 3f5f33b..54a2a0b 100644 --- a/src/main/java/com/isu/gaswellwatch/vo/UserVO.java +++ b/src/main/java/com/isu/gaswellwatch/vo/UserVO.java @@ -27,4 +27,7 @@ public class UserVO implements Serializable { //创建时间 private String createTime; + //所属部门 + private DepartmentVO department; + } diff --git a/src/main/resources/gaswellwatch.sql b/src/main/resources/gaswellwatch.sql index 885d6a8..12f77d6 100644 --- a/src/main/resources/gaswellwatch.sql +++ b/src/main/resources/gaswellwatch.sql @@ -11,28 +11,168 @@ Target Server Version : 80034 File Encoding : 65001 - Date: 01/11/2024 16:44:33 + Date: 17/11/2024 02:45:52 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- --- Table structure for company +-- Table structure for blocks -- ---------------------------- -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; +DROP TABLE IF EXISTS `blocks`; +CREATE TABLE `blocks` ( + `id` bigint NOT NULL COMMENT '主键', + `parent_id` bigint NOT NULL COMMENT '上级标识', + `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '名称', + `details` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '描述', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否已删除', + `create_by` bigint NOT NULL COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_by` bigint NOT NULL COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='区块管理'; -- ---------------------------- --- Records of company +-- Records of blocks +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for command_points +-- ---------------------------- +DROP TABLE IF EXISTS `command_points`; +CREATE TABLE `command_points` ( + `command_id` bigint NOT NULL COMMENT '对应指令标识', + `id` bigint NOT NULL COMMENT '主键', + `field` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '采集后转换字段名称', + `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '采集后显示名称', + `type` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '数据类型,主要用于读取数据长度控制,int16,uint16,int32,uint32,int64,uint64,float,double,bit,string', + `address` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '采集驱动地址', + `factor` decimal(10,4) NOT NULL COMMENT '乘系数', + `precision` int DEFAULT NULL COMMENT '精度', + `details` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '描述', + `sort_num` int NOT NULL COMMENT '排序号', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='指令点表'; + +-- ---------------------------- +-- Records of command_points +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for commands +-- ---------------------------- +DROP TABLE IF EXISTS `commands`; +CREATE TABLE `commands` ( + `id` bigint NOT NULL COMMENT '主键', + `ref_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '引用类型,DEVICE:设备;DEVICE_TYPE:设备类型', + `ref_id` bigint NOT NULL COMMENT '引用对象标识', + `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '指令名称', + `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '指令类型,Read:读;Write:写;默认Read。', + `collection_frequency` int DEFAULT NULL COMMENT '采集频率,默认30秒。采集类指令必填', + `details` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '指令描述', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='指令表'; + +-- ---------------------------- +-- Records of commands +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for department +-- ---------------------------- +DROP TABLE IF EXISTS `department`; +CREATE TABLE `department` ( + `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 COMMENT='部门管理\n'; + +-- ---------------------------- +-- Records of department +-- ---------------------------- +BEGIN; +INSERT INTO `department` (`id`, `name`, `description`, `create_time`, `update_time`, `code`) VALUES (1, '第一业务部', '无', '2024-11-17 01:11:07', '2024-11-17 01:11:07', '0001'); +INSERT INTO `department` (`id`, `name`, `description`, `create_time`, `update_time`, `code`) VALUES (2, '第二业务部', '无', '2024-11-17 01:11:21', '2024-11-17 01:11:21', '0002'); +COMMIT; + +-- ---------------------------- +-- Table structure for device_types +-- ---------------------------- +DROP TABLE IF EXISTS `device_types`; +CREATE TABLE `device_types` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '名称', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='设备类型'; + +-- ---------------------------- +-- Records of device_types +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for devices +-- ---------------------------- +DROP TABLE IF EXISTS `devices`; +CREATE TABLE `devices` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', + `device_type_id` bigint NOT NULL COMMENT '设备类型', + `code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '设备编号', + `group_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '分组名称', + `product_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '设备品牌', + `address` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '通讯地址', + `collection_flag` bit(1) NOT NULL COMMENT '是否采集标志', + `collection_frequency` int NOT NULL DEFAULT '30' COMMENT '采集频率,默认30秒。', + `control_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '控制类型', + `running_mode` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '生产模式,计时器;间开电压', + `status` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '状态', + `status_time` datetime NOT NULL COMMENT '状态时间', + `details` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '描述', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否已删除', + `create_by` bigint NOT NULL COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_by` bigint NOT NULL COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='设备列表'; + +-- ---------------------------- +-- Records of devices +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for gas_wells +-- ---------------------------- +DROP TABLE IF EXISTS `gas_wells`; +CREATE TABLE `gas_wells` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', + `company_id` bigint DEFAULT NULL COMMENT '关联公司', + `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '气井名称', + `details` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '描述', + `create_by` bigint NOT NULL COMMENT '创建人', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_by` bigint NOT NULL COMMENT '更新人', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='气井管理'; + +-- ---------------------------- +-- Records of gas_wells -- ---------------------------- BEGIN; COMMIT; @@ -52,7 +192,7 @@ CREATE TABLE `menu` ( `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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='菜单管理'; -- ---------------------------- -- Records of menu @@ -79,7 +219,7 @@ CREATE TABLE `role` ( `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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='角色管理'; -- ---------------------------- -- Records of role @@ -90,6 +230,8 @@ INSERT INTO `role` (`id`, `name`, `description`, `create_time`, `update_time`) V INSERT INTO `role` (`id`, `name`, `description`, `create_time`, `update_time`) VALUES (1836581703372505088, '测试角色22', '测试角色2', '2024-09-19 09:42:54', '2024-09-19 09:55:03'); INSERT INTO `role` (`id`, `name`, `description`, `create_time`, `update_time`) VALUES (1836581757135093760, '测试角色234', '测试角色2', '2024-09-19 09:43:07', '2024-09-19 09:46:25'); INSERT INTO `role` (`id`, `name`, `description`, `create_time`, `update_time`) VALUES (1851162080074268672, '测试角色123', 'test', '2024-10-29 15:20:07', '2024-10-29 15:20:07'); +INSERT INTO `role` (`id`, `name`, `description`, `create_time`, `update_time`) VALUES (1854116823323115520, '22222', '', '2024-11-06 19:01:13', '2024-11-06 19:01:13'); +INSERT INTO `role` (`id`, `name`, `description`, `create_time`, `update_time`) VALUES (1854121363019661312, '33333', '', '2024-11-06 19:19:15', '2024-11-06 19:19:15'); COMMIT; -- ---------------------------- @@ -104,7 +246,7 @@ CREATE TABLE `role_menu` ( `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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='角色菜单关联表'; -- ---------------------------- -- Records of role_menu @@ -118,6 +260,9 @@ INSERT INTO `role_menu` (`id`, `role_id`, `menu_id`, `identifier`, `create_time` INSERT INTO `role_menu` (`id`, `role_id`, `menu_id`, `identifier`, `create_time`, `update_time`) VALUES (6, 1, 1834501113332629504, NULL, '2024-10-29 15:31:35', '2024-10-29 15:31:35'); INSERT INTO `role_menu` (`id`, `role_id`, `menu_id`, `identifier`, `create_time`, `update_time`) VALUES (7, 1, 1834501151140085760, NULL, '2024-10-29 15:31:51', '2024-10-29 15:31:51'); INSERT INTO `role_menu` (`id`, `role_id`, `menu_id`, `identifier`, `create_time`, `update_time`) VALUES (1851162080078462976, 1851162080074268672, 1834500910013743104, NULL, '2024-10-29 15:20:07', '2024-10-29 15:20:07'); +INSERT INTO `role_menu` (`id`, `role_id`, `menu_id`, `identifier`, `create_time`, `update_time`) VALUES (1854116823335698432, 1854116823323115520, 1834499936926826496, NULL, '2024-11-06 19:01:13', '2024-11-06 19:01:13'); +INSERT INTO `role_menu` (`id`, `role_id`, `menu_id`, `identifier`, `create_time`, `update_time`) VALUES (1854116823335698433, 1854116823323115520, 1834501029547212800, NULL, '2024-11-06 19:01:13', '2024-11-06 19:01:13'); +INSERT INTO `role_menu` (`id`, `role_id`, `menu_id`, `identifier`, `create_time`, `update_time`) VALUES (1854116823335698434, 1854116823323115520, 1834501061923045376, NULL, '2024-11-06 19:01:13', '2024-11-06 19:01:13'); COMMIT; -- ---------------------------- @@ -135,7 +280,7 @@ CREATE TABLE `user` ( `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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='用户表'; -- ---------------------------- -- Records of user @@ -144,6 +289,27 @@ BEGIN; INSERT INTO `user` (`id`, `username`, `password`, `nickname`, `phone`, `picture`, `is_enable`, `create_time`, `update_time`) VALUES (1, 'admin', '7c4a8d09ca3762af61e59520943dc26494f8941b', 'admin', '13028138200', NULL, '1', '2024-08-30 10:17:10', '2024-10-25 10:14:24'); INSERT INTO `user` (`id`, `username`, `password`, `nickname`, `phone`, `picture`, `is_enable`, `create_time`, `update_time`) VALUES (1850801224132067328, 'test1', '7c4a8d09ca3762af61e59520943dc26494f8941b', '张四', '13012341234', NULL, '1', '2024-10-28 15:26:12', '2024-10-28 15:56:52'); INSERT INTO `user` (`id`, `username`, `password`, `nickname`, `phone`, `picture`, `is_enable`, `create_time`, `update_time`) VALUES (1850812935484473344, 'test2', '7c4a8d09ca3762af61e59520943dc26494f8941b', '王五', '13012341235', NULL, '1', '2024-10-28 16:12:44', '2024-10-28 16:12:44'); +INSERT INTO `user` (`id`, `username`, `password`, `nickname`, `phone`, `picture`, `is_enable`, `create_time`, `update_time`) VALUES (1853726975508611072, '123d', '7c4a8d09ca3762af61e59520943dc26494f8941b', '123dd', '13333333331', NULL, '0', '2024-11-05 17:12:06', '2024-11-06 15:04:57'); +COMMIT; + +-- ---------------------------- +-- Table structure for user_department +-- ---------------------------- +DROP TABLE IF EXISTS `user_department`; +CREATE TABLE `user_department` ( + `id` bigint NOT NULL, + `user_id` bigint DEFAULT NULL COMMENT '用户id', + `department_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`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户部门关联表'; + +-- ---------------------------- +-- Records of user_department +-- ---------------------------- +BEGIN; +INSERT INTO `user_department` (`id`, `user_id`, `department_id`, `create_time`, `update_time`) VALUES (1857847465089171456, 1850812935484473344, 1, '2024-11-17 02:05:27', '2024-11-17 02:05:27'); COMMIT; -- ---------------------------- @@ -166,7 +332,7 @@ CREATE TABLE `user_operation_record` ( `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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='用户操作记录表'; -- ---------------------------- -- Records of user_operation_record @@ -185,7 +351,7 @@ CREATE TABLE `user_role` ( `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; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='用户角色关联表'; -- ---------------------------- -- Records of user_role @@ -193,7 +359,8 @@ CREATE TABLE `user_role` ( BEGIN; INSERT INTO `user_role` (`id`, `user_id`, `role_id`, `create_time`, `update_time`) VALUES (1, 1, 1, '2024-10-28 15:28:14', '2024-10-28 15:28:14'); INSERT INTO `user_role` (`id`, `user_id`, `role_id`, `create_time`, `update_time`) VALUES (1850808941676593152, 1850801224132067328, 1836575681450868736, '2024-10-28 15:56:52', '2024-10-28 15:56:52'); -INSERT INTO `user_role` (`id`, `user_id`, `role_id`, `create_time`, `update_time`) VALUES (1850812935497056256, 1850812935484473344, 1836575681450868736, '2024-10-28 16:12:44', '2024-10-28 16:12:44'); +INSERT INTO `user_role` (`id`, `user_id`, `role_id`, `create_time`, `update_time`) VALUES (1854057365498757120, 1853726975508611072, 1836581703372505088, '2024-11-06 15:04:57', '2024-11-06 15:04:57'); +INSERT INTO `user_role` (`id`, `user_id`, `role_id`, `create_time`, `update_time`) VALUES (1857847465064005632, 1850812935484473344, 1836575681450868736, '2024-11-17 02:05:27', '2024-11-17 02:05:27'); COMMIT; SET FOREIGN_KEY_CHECKS = 1; diff --git a/src/main/resources/mapper/CompanyDao.xml b/src/main/resources/mapper/DepartmentDao.xml similarity index 78% rename from src/main/resources/mapper/CompanyDao.xml rename to src/main/resources/mapper/DepartmentDao.xml index 6456f56..42a4119 100644 --- a/src/main/resources/mapper/CompanyDao.xml +++ b/src/main/resources/mapper/DepartmentDao.xml @@ -1,10 +1,10 @@ - + - select u.id, u.name, u.description, u.code, u.create_time, u.update_time - from company u + from department u and u.name LIKE CONCAT('%',#{name},'%') diff --git a/src/main/resources/mapper/UserDao.xml b/src/main/resources/mapper/UserDao.xml index 4b7bb70..e46fc85 100644 --- a/src/main/resources/mapper/UserDao.xml +++ b/src/main/resources/mapper/UserDao.xml @@ -8,6 +8,12 @@ + + + + + + @@ -45,6 +51,8 @@ + + @@ -79,12 +87,21 @@ where ur.user_id=#{user_id} +