Browse Source

Merge remote-tracking branch 'origin/master'

master
DX 2 months ago
parent
commit
c398421a02
  1. 23
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java
  2. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java
  3. 6
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java
  4. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseSaveReqVO.java
  5. 9
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/EnterpriseQualificationController.java
  6. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationPageReqVO.java
  7. 7
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationRespVO.java
  8. 8
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationSaveReqVO.java
  9. 10
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java
  10. 6
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java
  11. 15
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java
  12. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java
  13. 7
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/qualification/EnterpriseQualificationDO.java
  14. 15
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taskinfo/TaskInfoDO.java
  15. 4
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java
  16. 95
      yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprises/EnterprisesController.java
  17. 62
      yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprises/vo/EnterprisesPageReqVO.java
  18. 79
      yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprises/vo/EnterprisesRespVO.java
  19. 56
      yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprises/vo/EnterprisesSaveReqVO.java
  20. 87
      yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprises/EnterprisesDO.java
  21. 39
      yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprises/EnterprisesMapper.java
  22. 55
      yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprises/EnterprisesService.java
  23. 74
      yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprises/EnterprisesServiceImpl.java
  24. 12
      yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/enterprises/EnterprisesMapper.xml

23
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/EnterpriseController.java

@ -1,11 +1,16 @@
package cn.iocoder.yudao.module.system.controller.admin.enterprise;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.infra.api.file.FileApi;
import cn.iocoder.yudao.module.system.controller.admin.taglibrary.vo.TagLibraryPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.taglibrary.vo.TagLibraryRespVO;
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
import cn.iocoder.yudao.module.system.dal.dataobject.enterpriseauditlog.EnterpriseAuditLogDO;
import cn.iocoder.yudao.module.system.dal.dataobject.enterprisetag.EnterpriseTagDO;
import cn.iocoder.yudao.module.system.dal.dataobject.fileInfo.FileInfoDO;
import cn.iocoder.yudao.module.system.dal.dataobject.qualification.EnterpriseQualificationDO;
import cn.iocoder.yudao.module.system.dal.dataobject.taglibrary.TagLibraryDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.dal.mysql.enterpriseauditlog.EnterpriseAuditLogMapper;
import cn.iocoder.yudao.module.system.dal.mysql.enterprisetag.EnterpriseTagMapper;
import cn.iocoder.yudao.module.system.dal.mysql.fileInfo.FileInfoMapper;
@ -14,6 +19,7 @@ import cn.iocoder.yudao.module.system.dal.mysql.taglibrary.TagLibraryMapper;
import cn.iocoder.yudao.module.system.service.fileInfo.FileInfoService;
import cn.iocoder.yudao.module.system.service.qualification.EnterpriseQualificationService;
import cn.iocoder.yudao.module.system.service.taglibrary.TagLibraryService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
@ -68,6 +74,8 @@ public class EnterpriseController {
private TagLibraryMapper tagLibraryMapper;
@Resource
private EnterpriseTagMapper enterpriseTagMapper;
@Resource
private AdminUserService adminUserService;
@PostMapping("/create")
@Operation(summary = "创建企业")
@ -122,6 +130,18 @@ public class EnterpriseController {
return success(BeanUtils.toBean(enterprise, EnterpriseRespVO.class));
}
@GetMapping("/pcpage")
@Operation(summary = "电脑端获得企业标签分页")
@PreAuthorize("@ss.hasPermission('system:tag-library:query')")
public CommonResult<PageResult<EnterpriseRespVO>> getTagLibraryPcPage(EnterprisePageReqVO pageReqVO) {
PageResult<EnterpriseDO> pageResult = enterpriseService.getEnterprisePage(pageReqVO);
pageResult.getList().forEach(item->{
item.setInviterName(adminUserService.getUser(Long.valueOf(item.getUserId())).getNickname());
});
return success(BeanUtils.toBean(pageResult, EnterpriseRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得企业分页")
@PreAuthorize("@ss.hasPermission('system:enterprise:query')")
@ -195,6 +215,9 @@ public class EnterpriseController {
return success(BeanUtils.toBean(pageResult, EnterpriseRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出企业 Excel")
@PreAuthorize("@ss.hasPermission('system:enterprise:export')")

4
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterprisePageReqVO.java

@ -67,4 +67,8 @@ public class EnterprisePageReqVO extends PageParam {
@Schema(description = "管理部门", example = "26433")
private Long deptId;
@Schema(description = "邀请人")
private String inviterName;
}

6
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseRespVO.java

@ -97,5 +97,11 @@ public class EnterpriseRespVO {
@Schema(description = "企业标签", example = "26433")
private List<String> tagList;
@Schema(description = "邀请人")
@ExcelProperty("邀请人")
private String inviterName;
}

4
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprise/vo/EnterpriseSaveReqVO.java

@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
import javax.validation.constraints.NotEmpty;
@ -28,7 +29,6 @@ public class EnterpriseSaveReqVO {
private String region;
@Schema(description = "企业名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@NotEmpty(message = "企业名称不能为空")
private String enterprisesName;
@Schema(description = "企业地址")
@ -47,7 +47,7 @@ public class EnterpriseSaveReqVO {
private String introduction;
@Schema(description = "企业成立时间")
private LocalDate establishmentDate;
private LocalDateTime establishmentDate;
@Schema(description = "企业经纬度")
private String gpsLocation;

9
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/EnterpriseQualificationController.java

@ -1,5 +1,7 @@
package cn.iocoder.yudao.module.system.controller.admin.qualification;
import cn.iocoder.yudao.module.system.dal.dataobject.enterprise.EnterpriseDO;
import cn.iocoder.yudao.module.system.service.enterprise.EnterpriseService;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
@ -37,6 +39,10 @@ public class EnterpriseQualificationController {
@Resource
private EnterpriseQualificationService enterpriseQualificationService;
@Resource
private EnterpriseService enterpriseService;
@PostMapping("/create")
@Operation(summary = "创建企业资质")
// @PreAuthorize("@ss.hasPermission('system:enterprise-qualification:create')")
@ -75,6 +81,9 @@ public class EnterpriseQualificationController {
// @PreAuthorize("@ss.hasPermission('system:enterprise-qualification:query')")
public CommonResult<PageResult<EnterpriseQualificationRespVO>> getEnterpriseQualificationPage(EnterpriseQualificationPageReqVO pageReqVO) {
PageResult<EnterpriseQualificationDO> pageResult = enterpriseQualificationService.getEnterpriseQualificationPage(pageReqVO);
pageResult.getList().forEach(item->{
item.setEnterpriseName(enterpriseService.getEnterprise(Long.valueOf(item.getEnterpriseId())).getEnterprisesName());
});
return success(BeanUtils.toBean(pageResult, EnterpriseQualificationRespVO.class));
}

4
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationPageReqVO.java

@ -22,6 +22,10 @@ public class EnterpriseQualificationPageReqVO extends PageParam {
@Schema(description = "企业ID", example = "28564")
private Long enterpriseId;
@Schema(description = "企业名称", example = "28564")
private String enterpriseName;
@Schema(description = "资质名称,例如:排污许可证、环保合格证", example = "张三")
private String qualificationName;

7
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationRespVO.java

@ -22,9 +22,14 @@ public class EnterpriseQualificationRespVO {
@ExcelProperty("企业ID")
private Long enterpriseId;
@Schema(description = "企业名称", example = "28564")
@ExcelProperty("企业名称")
private String enterpriseName;
@Schema(description = "资质名称,例如:排污许可证、环保合格证", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
@ExcelProperty("资质名称,例如:排污许可证、环保合格证")
private Integer qualificationName;
private String qualificationName;
@Schema(description = "资质到期日期")
@ExcelProperty("资质到期日期")

8
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/qualification/vo/EnterpriseQualificationSaveReqVO.java

@ -5,6 +5,7 @@ import lombok.*;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
@Schema(description = "管理后台 - 企业资质新增/修改 Request VO")
@ -15,14 +16,13 @@ public class EnterpriseQualificationSaveReqVO {
private Long id;
@Schema(description = "企业ID", example = "28564", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull
private Long enterpriseId;
@Schema(description = "资质名称,例如:排污许可证、环保合格证", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
private Integer qualificationName;
private String qualificationName;
@Schema(description = "资质到期日期")
private LocalDate expiryDate;
private LocalDateTime expiryDate;
@Schema(description = "资质描述,详细说明资质信息", example = "随便")
private String qualificationDescription;
@ -34,7 +34,7 @@ public class EnterpriseQualificationSaveReqVO {
private String creator;
@Schema(description = "办理日期")
private LocalDate handleDate;
private LocalDateTime handleDate;
@Schema(description = "资质编号")
private String enterpriseAuth;

10
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/TaskInfoController.java

@ -1,6 +1,10 @@
package cn.iocoder.yudao.module.system.controller.admin.taskinfo;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.infra.api.job.JobApi;
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.dept.DeptService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
@ -41,6 +45,9 @@ public class TaskInfoController {
private TaskInfoService taskInfoService;
@Resource
private AdminUserService adminUserService;
@Resource
private DeptService deptService;
@PostMapping("/create")
@ -81,7 +88,10 @@ public class TaskInfoController {
@PreAuthorize("@ss.hasPermission('system:task-info:query')")
public CommonResult<PageResult<TaskInfoRespVO>> getTaskInfoPage(@Valid TaskInfoPageReqVO pageReqVO) {
PageResult<TaskInfoDO> pageResult = taskInfoService.getTaskInfoPage(pageReqVO);
AdminUserDO user = adminUserService.getUser(SecurityFrameworkUtils.getLoginUserId());
DeptDO dep= deptService.getDept( user.getDeptId());
pageResult.getList().forEach(item->{
item.setPublishDep(dep.getName());
item.setCreateName(adminUserService.getUser(Long.valueOf(item.getCreator())).getRealName());
});
return success(BeanUtils.toBean(pageResult, TaskInfoRespVO.class));

6
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java

@ -20,7 +20,11 @@ public class TaskInfoPageReqVO extends PageParam {
@Schema(description = "任务标题")
private String title;
@Schema(description = "任务描述", example = "你猜")
@Schema(description = "任务编号", example = "")
private String taskNumber;
@Schema(description = "任务描述", example = "")
private String description;
@Schema(description = "执行周期")

15
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoRespVO.java

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.system.controller.admin.taskinfo.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
@ -20,6 +21,12 @@ public class TaskInfoRespVO {
@ExcelProperty("任务ID,主键")
private Long id;
//任务编号
@Schema(description = "任务编号", example = "你猜")
@ExcelProperty("任务编号")
private String taskNumber;
@Schema(description = "任务标题", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("任务标题")
private String title;
@ -82,4 +89,12 @@ public class TaskInfoRespVO {
@ExcelProperty("创建人名字")
private String createName;
@Schema(description = "发布部门")
@ExcelProperty("发布部门")
private String publishDep;
}

4
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprise/EnterpriseDO.java

@ -97,4 +97,8 @@ public class EnterpriseDO extends BaseDO {
@TableField(exist = false)
private List<String> tagList;
//邀请人姓名
@TableField(exist = false)
private String inviterName;
}

7
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/qualification/EnterpriseQualificationDO.java

@ -31,10 +31,12 @@ public class EnterpriseQualificationDO extends BaseDO {
* 企业ID
*/
private Long enterpriseId;
/**
* 资质名称例如排污许可证环保合格证
*/
private Integer qualificationName;
private String qualificationName;
/**
* 资质到期日期
*/
@ -53,5 +55,8 @@ public class EnterpriseQualificationDO extends BaseDO {
*/
private String enterpriseAuth;
//企业名称
@TableField(exist = false)
private String enterpriseName;
}

15
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/taskinfo/TaskInfoDO.java

@ -29,6 +29,10 @@ public class TaskInfoDO extends BaseDO {
*/
@TableId
private Long id;
//任务编号
@TableField(exist = false)
private String taskNumber;
/**
* 任务标题
*/
@ -85,4 +89,15 @@ public class TaskInfoDO extends BaseDO {
@TableField(exist = false)
private String createName;
//发布部门
@TableField(exist = false)
private String publishDep;
}

4
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java

@ -38,4 +38,8 @@ public interface EnterpriseMapper extends BaseMapperX<EnterpriseDO> {
.orderByDesc(EnterpriseDO::getId));
}
default List<EnterpriseDO> selectListByStatus() {
return selectList();
}
}

95
yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprises/EnterprisesController.java

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.system.controller.admin.enterprises;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.system.controller.admin.enterprises.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.enterprises.EnterprisesDO;
import cn.iocoder.yudao.module.system.service.enterprises.EnterprisesService;
@Tag(name = "管理后台 - 企业")
@RestController
@RequestMapping("/system/enterprises")
@Validated
public class EnterprisesController {
@Resource
private EnterprisesService enterprisesService;
@PostMapping("/create")
@Operation(summary = "创建企业")
@PreAuthorize("@ss.hasPermission('system:enterprises:create')")
public CommonResult<Long> createEnterprises(@Valid @RequestBody EnterprisesSaveReqVO createReqVO) {
return success(enterprisesService.createEnterprises(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新企业")
@PreAuthorize("@ss.hasPermission('system:enterprises:update')")
public CommonResult<Boolean> updateEnterprises(@Valid @RequestBody EnterprisesSaveReqVO updateReqVO) {
enterprisesService.updateEnterprises(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除企业")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('system:enterprises:delete')")
public CommonResult<Boolean> deleteEnterprises(@RequestParam("id") Long id) {
enterprisesService.deleteEnterprises(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得企业")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('system:enterprises:query')")
public CommonResult<EnterprisesRespVO> getEnterprises(@RequestParam("id") Long id) {
EnterprisesDO enterprises = enterprisesService.getEnterprises(id);
return success(BeanUtils.toBean(enterprises, EnterprisesRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得企业分页")
@PreAuthorize("@ss.hasPermission('system:enterprises:query')")
public CommonResult<PageResult<EnterprisesRespVO>> getEnterprisesPage(@Valid EnterprisesPageReqVO pageReqVO) {
PageResult<EnterprisesDO> pageResult = enterprisesService.getEnterprisesPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, EnterprisesRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出企业 Excel")
@PreAuthorize("@ss.hasPermission('system:enterprises:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportEnterprisesExcel(@Valid EnterprisesPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<EnterprisesDO> list = enterprisesService.getEnterprisesPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "企业.xls", "数据", EnterprisesRespVO.class,
BeanUtils.toBean(list, EnterprisesRespVO.class));
}
}

62
yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprises/vo/EnterprisesPageReqVO.java

@ -0,0 +1,62 @@
package cn.iocoder.yudao.module.system.controller.admin.enterprises.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 企业分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class EnterprisesPageReqVO extends PageParam {
@Schema(description = "所属部门ID", example = "15442")
private Long departmentId;
@Schema(description = "邀请人", example = "981")
private Long userId;
@Schema(description = "企业类型", example = "1")
private String type;
@Schema(description = "企业所属区域")
private String region;
@Schema(description = "企业名称", example = "芋艿")
private String enterprisesName;
@Schema(description = "企业地址")
private String address;
@Schema(description = "环保负责人姓名", example = "王五")
private String contactName;
@Schema(description = "企业环保负责人联系电话")
private String environmentalContactPhone;
@Schema(description = "企业注册号")
private String registrationNumber;
@Schema(description = "企业图文介绍")
private String introduction;
@Schema(description = "企业成立时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDate[] establishmentDate;
@Schema(description = "企业经纬度")
private String gpsLocation;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "管理部门", example = "978")
private Long managerDeptId;
}

79
yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprises/vo/EnterprisesRespVO.java

@ -0,0 +1,79 @@
package cn.iocoder.yudao.module.system.controller.admin.enterprises.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
@Schema(description = "管理后台 - 企业 Response VO")
@Data
@ExcelIgnoreUnannotated
public class EnterprisesRespVO {
@Schema(description = "企业ID,主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "13265")
@ExcelProperty("企业ID,主键")
private Long id;
@Schema(description = "所属部门ID", example = "15442")
@ExcelProperty("所属部门ID")
private Long departmentId;
@Schema(description = "邀请人", example = "981")
@ExcelProperty("邀请人")
private Long userId;
@Schema(description = "企业类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty(value = "企业类型", converter = DictConvert.class)
@DictFormat("enterprises_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
private String type;
@Schema(description = "企业所属区域")
@ExcelProperty(value = "企业所属区域", converter = DictConvert.class)
@DictFormat("enterprises_area") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
private String region;
@Schema(description = "企业名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
@ExcelProperty("企业名称")
private String enterprisesName;
@Schema(description = "企业地址")
@ExcelProperty("企业地址")
private String address;
@Schema(description = "环保负责人姓名", example = "王五")
@ExcelProperty("环保负责人姓名")
private String contactName;
@Schema(description = "企业环保负责人联系电话")
@ExcelProperty("企业环保负责人联系电话")
private String environmentalContactPhone;
@Schema(description = "企业注册号")
@ExcelProperty("企业注册号")
private String registrationNumber;
@Schema(description = "企业图文介绍")
@ExcelProperty("企业图文介绍")
private String introduction;
@Schema(description = "企业成立时间")
@ExcelProperty("企业成立时间")
private LocalDate establishmentDate;
@Schema(description = "企业经纬度")
@ExcelProperty("企业经纬度")
private String gpsLocation;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "管理部门", example = "978")
@ExcelProperty("管理部门")
private Long managerDeptId;
}

56
yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/enterprises/vo/EnterprisesSaveReqVO.java

@ -0,0 +1,56 @@
package cn.iocoder.yudao.module.system.controller.admin.enterprises.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
@Schema(description = "管理后台 - 企业新增/修改 Request VO")
@Data
public class EnterprisesSaveReqVO {
@Schema(description = "企业ID,主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "13265")
private Long id;
@Schema(description = "所属部门ID", example = "15442")
private Long departmentId;
@Schema(description = "邀请人", example = "981")
private Long userId;
@Schema(description = "企业类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotEmpty(message = "企业类型不能为空")
private String type;
@Schema(description = "企业所属区域")
private String region;
@Schema(description = "企业名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
@NotEmpty(message = "企业名称不能为空")
private String enterprisesName;
@Schema(description = "企业地址")
private String address;
@Schema(description = "环保负责人姓名", example = "王五")
private String contactName;
@Schema(description = "企业环保负责人联系电话")
private String environmentalContactPhone;
@Schema(description = "企业注册号")
private String registrationNumber;
@Schema(description = "企业图文介绍")
private String introduction;
@Schema(description = "企业成立时间")
private LocalDate establishmentDate;
@Schema(description = "企业经纬度")
private String gpsLocation;
@Schema(description = "管理部门", example = "978")
private Long managerDeptId;
}

87
yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/enterprises/EnterprisesDO.java

@ -0,0 +1,87 @@
package cn.iocoder.yudao.module.system.dal.dataobject.enterprises;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 企业 DO
*
* @author 芋道源码
*/
@TableName("enterprises")
@KeySequence("enterprises_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class EnterprisesDO extends BaseDO {
/**
* 企业ID主键
*/
@TableId
private Long id;
/**
* 所属部门ID
*/
private Long departmentId;
/**
* 邀请人
*/
private Long userId;
/**
* 企业类型
*
* 枚举 {@link TODO enterprises_type 对应的类}
*/
private String type;
/**
* 企业所属区域
*
* 枚举 {@link TODO enterprises_area 对应的类}
*/
private String region;
/**
* 企业名称
*/
private String enterprisesName;
/**
* 企业地址
*/
private String address;
/**
* 环保负责人姓名
*/
private String contactName;
/**
* 企业环保负责人联系电话
*/
private String environmentalContactPhone;
/**
* 企业注册号
*/
private String registrationNumber;
/**
* 企业图文介绍
*/
private String introduction;
/**
* 企业成立时间
*/
private LocalDate establishmentDate;
/**
* 企业经纬度
*/
private String gpsLocation;
/**
* 管理部门
*/
private Long managerDeptId;
}

39
yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprises/EnterprisesMapper.java

@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.system.dal.mysql.enterprises;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.enterprises.EnterprisesDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.enterprises.vo.*;
/**
* 企业 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface EnterprisesMapper extends BaseMapperX<EnterprisesDO> {
default PageResult<EnterprisesDO> selectPage(EnterprisesPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<EnterprisesDO>()
.eqIfPresent(EnterprisesDO::getDepartmentId, reqVO.getDepartmentId())
.eqIfPresent(EnterprisesDO::getUserId, reqVO.getUserId())
.eqIfPresent(EnterprisesDO::getType, reqVO.getType())
.eqIfPresent(EnterprisesDO::getRegion, reqVO.getRegion())
.likeIfPresent(EnterprisesDO::getEnterprisesName, reqVO.getEnterprisesName())
.eqIfPresent(EnterprisesDO::getAddress, reqVO.getAddress())
.likeIfPresent(EnterprisesDO::getContactName, reqVO.getContactName())
.eqIfPresent(EnterprisesDO::getEnvironmentalContactPhone, reqVO.getEnvironmentalContactPhone())
.eqIfPresent(EnterprisesDO::getRegistrationNumber, reqVO.getRegistrationNumber())
.eqIfPresent(EnterprisesDO::getIntroduction, reqVO.getIntroduction())
.betweenIfPresent(EnterprisesDO::getEstablishmentDate, reqVO.getEstablishmentDate())
.eqIfPresent(EnterprisesDO::getGpsLocation, reqVO.getGpsLocation())
.betweenIfPresent(EnterprisesDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(EnterprisesDO::getManagerDeptId, reqVO.getManagerDeptId())
.orderByDesc(EnterprisesDO::getId));
}
}

55
yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprises/EnterprisesService.java

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.system.service.enterprises;
import java.util.*;
import jakarta.validation.*;
import cn.iocoder.yudao.module.system.controller.admin.enterprises.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.enterprises.EnterprisesDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 企业 Service 接口
*
* @author 芋道源码
*/
public interface EnterprisesService {
/**
* 创建企业
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createEnterprises(@Valid EnterprisesSaveReqVO createReqVO);
/**
* 更新企业
*
* @param updateReqVO 更新信息
*/
void updateEnterprises(@Valid EnterprisesSaveReqVO updateReqVO);
/**
* 删除企业
*
* @param id 编号
*/
void deleteEnterprises(Long id);
/**
* 获得企业
*
* @param id 编号
* @return 企业
*/
EnterprisesDO getEnterprises(Long id);
/**
* 获得企业分页
*
* @param pageReqVO 分页查询
* @return 企业分页
*/
PageResult<EnterprisesDO> getEnterprisesPage(EnterprisesPageReqVO pageReqVO);
}

74
yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprises/EnterprisesServiceImpl.java

@ -0,0 +1,74 @@
package cn.iocoder.yudao.module.system.service.enterprises;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.module.system.controller.admin.enterprises.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.enterprises.EnterprisesDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.dal.mysql.enterprises.EnterprisesMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
/**
* 企业 Service 实现类
*
* @author 芋道源码
*/
@Service
@Validated
public class EnterprisesServiceImpl implements EnterprisesService {
@Resource
private EnterprisesMapper enterprisesMapper;
@Override
public Long createEnterprises(EnterprisesSaveReqVO createReqVO) {
// 插入
EnterprisesDO enterprises = BeanUtils.toBean(createReqVO, EnterprisesDO.class);
enterprisesMapper.insert(enterprises);
// 返回
return enterprises.getId();
}
@Override
public void updateEnterprises(EnterprisesSaveReqVO updateReqVO) {
// 校验存在
validateEnterprisesExists(updateReqVO.getId());
// 更新
EnterprisesDO updateObj = BeanUtils.toBean(updateReqVO, EnterprisesDO.class);
enterprisesMapper.updateById(updateObj);
}
@Override
public void deleteEnterprises(Long id) {
// 校验存在
validateEnterprisesExists(id);
// 删除
enterprisesMapper.deleteById(id);
}
private void validateEnterprisesExists(Long id) {
if (enterprisesMapper.selectById(id) == null) {
throw exception(ENTERPRISES_NOT_EXISTS);
}
}
@Override
public EnterprisesDO getEnterprises(Long id) {
return enterprisesMapper.selectById(id);
}
@Override
public PageResult<EnterprisesDO> getEnterprisesPage(EnterprisesPageReqVO pageReqVO) {
return enterprisesMapper.selectPage(pageReqVO);
}
}

12
yudao-module-system/yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/enterprises/EnterprisesMapper.xml

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.system.dal.mysql.enterprises.EnterprisesMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>
Loading…
Cancel
Save