[feat] 添加项目跟踪

This commit is contained in:
hhyykk 2024-12-13 19:52:46 +08:00
parent 95c6f196eb
commit 126373b34c
21 changed files with 795 additions and 0 deletions

View File

@ -0,0 +1,55 @@
-- 菜单 SQL
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status, component_name
)
VALUES (
'项目跟踪 管理', '', 2, 0, 2759,
'project-tracking', '', 'pm/projecttracking/index', 0, 'ProjectTracking'
);
-- 按钮父菜单ID
-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
SELECT @parentId := LAST_INSERT_ID();
-- 按钮 SQL
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'项目跟踪 查询', 'pm:project-tracking:query', 3, 1, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'项目跟踪 创建', 'pm:project-tracking:create', 3, 2, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'项目跟踪 更新', 'pm:project-tracking:update', 3, 3, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'项目跟踪 删除', 'pm:project-tracking:delete', 3, 4, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'项目跟踪 导出', 'pm:project-tracking:export', 3, 5, @parentId,
'', '', '', 0
);

View File

@ -12,4 +12,7 @@ public interface ErrorCodeConstants {
ErrorCode SUBCONTRACTOR_NOT_EXISTS = new ErrorCode(1_061_000_000, "供应商信息不存在");
ErrorCode SUBCONTRACTOR_NAME_DUPLICATE = new ErrorCode(1_061_000_001, "供应商名称重复");
ErrorCode SUBCONTRACTOR_CODE_DUPLICATE = new ErrorCode(1_061_000_002, "组织机构代码重复");
// 项目跟踪
ErrorCode PROJECT_TRACKING_NOT_EXISTS = new ErrorCode(1_062_000_000, "项目跟踪信息不存在");
}

View File

@ -79,6 +79,14 @@ public class CustomerController {
return success(BeanUtils.toBean(pageResult, CustomerRespVO.class));
}
@GetMapping("/list")
@Operation(summary = "获得客户信息列表")
@PreAuthorize("@ss.hasPermission('pm:customer:query')")
public CommonResult<List<CustomerRespVO>> getCustomerList(@Valid CustomerReqVO reqVO) {
List<CustomerDO> list = customerService.getCustomerList(reqVO);
return success(BeanUtils.toBean(list, CustomerRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出客户信息 Excel")
@PreAuthorize("@ss.hasPermission('pm:customer:export')")

View File

@ -0,0 +1,31 @@
package cn.iocoder.yudao.module.pm.controller.admin.customer.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - 客户信息 Request VO")
@Data
@EqualsAndHashCode
@ToString(callSuper = true)
public class CustomerReqVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "18202")
private Long id;
@Schema(description = "客户名称", example = "设计院")
private String name;
@Schema(description = "组织机构代码", example = "91350200MAD0EHH44J")
private String code;
@Schema(description = "联系人", example = "张三")
private String contacts;
@Schema(description = "电话", example = "18655424896")
private String phone;
@Schema(description = "地址", example = "厦门市湖里区槟城道289号701室")
private String address;
}

View File

@ -0,0 +1,95 @@
package cn.iocoder.yudao.module.pm.controller.admin.projecttracking;
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.pm.controller.admin.projecttracking.vo.*;
import cn.iocoder.yudao.module.pm.dal.dataobject.projecttracking.ProjectTrackingDO;
import cn.iocoder.yudao.module.pm.service.projecttracking.ProjectTrackingService;
@Tag(name = "管理后台 - 项目跟踪 ")
@RestController
@RequestMapping("/pm/project-tracking")
@Validated
public class ProjectTrackingController {
@Resource
private ProjectTrackingService projectTrackingService;
@PostMapping("/create")
@Operation(summary = "创建项目跟踪 ")
@PreAuthorize("@ss.hasPermission('pm:project-tracking:create')")
public CommonResult<Long> createProjectTracking(@Valid @RequestBody ProjectTrackingSaveReqVO createReqVO) {
return success(projectTrackingService.createProjectTracking(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新项目跟踪 ")
@PreAuthorize("@ss.hasPermission('pm:project-tracking:update')")
public CommonResult<Boolean> updateProjectTracking(@Valid @RequestBody ProjectTrackingSaveReqVO updateReqVO) {
projectTrackingService.updateProjectTracking(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除项目跟踪 ")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('pm:project-tracking:delete')")
public CommonResult<Boolean> deleteProjectTracking(@RequestParam("id") Long id) {
projectTrackingService.deleteProjectTracking(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得项目跟踪 ")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('pm:project-tracking:query')")
public CommonResult<ProjectTrackingRespVO> getProjectTracking(@RequestParam("id") Long id) {
ProjectTrackingDO projectTracking = projectTrackingService.getProjectTracking(id);
return success(BeanUtils.toBean(projectTracking, ProjectTrackingRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得项目跟踪 分页")
@PreAuthorize("@ss.hasPermission('pm:project-tracking:query')")
public CommonResult<PageResult<ProjectTrackingRespVO>> getProjectTrackingPage(@Valid ProjectTrackingPageReqVO pageReqVO) {
PageResult<ProjectTrackingDO> pageResult = projectTrackingService.getProjectTrackingPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ProjectTrackingRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出项目跟踪 Excel")
@PreAuthorize("@ss.hasPermission('pm:project-tracking:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportProjectTrackingExcel(@Valid ProjectTrackingPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ProjectTrackingDO> list = projectTrackingService.getProjectTrackingPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "项目跟踪 .xls", "数据", ProjectTrackingRespVO.class,
BeanUtils.toBean(list, ProjectTrackingRespVO.class));
}
}

View File

@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.pm.controller.admin.projecttracking.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 ProjectTrackingPageReqVO extends PageParam {
@Schema(description = "项目名称", example = "王五")
private String name;
@Schema(description = "建设单位id", example = "9765")
private Long constructionId;
@Schema(description = "主控部门id", example = "30103")
private Long deptId;
@Schema(description = "项目负责人id", example = "21123")
private Long pmId;
@Schema(description = "预计合同额")
private String contractAmount;
@Schema(description = "业务类型", example = "2")
private String businessType;
@Schema(description = "落地可能性")
private String landingPossibility;
}

View File

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.pm.controller.admin.projecttracking.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 ProjectTrackingRespVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "17734")
@ExcelProperty("主键")
private Long id;
@Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@ExcelProperty("项目名称")
private String name;
@Schema(description = "建设单位id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9765")
@ExcelProperty("建设单位id")
private Long constructionId;
@Schema(description = "主控部门id", requiredMode = Schema.RequiredMode.REQUIRED, example = "30103")
@ExcelProperty("主控部门id")
private Long deptId;
@Schema(description = "项目负责人id", requiredMode = Schema.RequiredMode.REQUIRED, example = "21123")
@ExcelProperty("项目负责人id")
private Long pmId;
@Schema(description = "预计合同额", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("预计合同额")
private String contractAmount;
@Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty(value = "业务类型", converter = DictConvert.class)
@DictFormat("project_type") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private String businessType;
@Schema(description = "落地可能性", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty(value = "落地可能性", converter = DictConvert.class)
@DictFormat("possibility_of_landing") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private String landingPossibility;
@Schema(description = "预计落地时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("预计落地时间")
private LocalDateTime expectedTime;
}

View File

@ -0,0 +1,107 @@
package cn.iocoder.yudao.module.pm.controller.admin.projecttracking.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 项目跟踪 新增/修改 Request VO")
@Data
public class ProjectTrackingSaveReqVO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "17734")
private Long id;
@Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
@NotEmpty(message = "项目名称不能为空")
private String name;
@Schema(description = "建设单位id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9765")
@NotNull(message = "建设单位id不能为空")
private Long constructionId;
@Schema(description = "联系人 ", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "联系人 不能为空")
private String contacts;
@Schema(description = "联系方式", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "联系方式不能为空")
private String phone;
@Schema(description = "主控部门id", requiredMode = Schema.RequiredMode.REQUIRED, example = "30103")
@NotNull(message = "主控部门id不能为空")
private Long deptId;
@Schema(description = "项目负责人id", requiredMode = Schema.RequiredMode.REQUIRED, example = "21123")
@NotNull(message = "项目负责人id不能为空")
private Long pmId;
@Schema(description = "预计合同额", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "预计合同额不能为空")
private String contractAmount;
@Schema(description = "省份id", requiredMode = Schema.RequiredMode.REQUIRED, example = "331")
@NotNull(message = "省份id不能为空")
private Long provincId;
@Schema(description = "城市id", requiredMode = Schema.RequiredMode.REQUIRED, example = "15332")
@NotNull(message = "城市id不能为空")
private Long cityId;
@Schema(description = "地址", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "地址不能为空")
private String address;
@Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotEmpty(message = "业务类型不能为空")
private String businessType;
@Schema(description = "项目情况", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "项目情况不能为空")
private String situation;
@Schema(description = "是否为应急项目", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "是否为应急项目不能为空")
private Boolean emergency;
@Schema(description = "委托方式", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "委托方式不能为空")
private String entrustmentMethod;
@Schema(description = "应急项目附件id", example = "20206")
private Long emergencyDocId;
@Schema(description = "是否业务合作项目", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "是否业务合作项目不能为空")
private Boolean collaborativeProjects;
@Schema(description = "合作单位id", requiredMode = Schema.RequiredMode.REQUIRED, example = "13695")
@NotNull(message = "合作单位id不能为空")
private Long cooperativeCompanyId;
@Schema(description = "落地可能性", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "落地可能性不能为空")
private String landingPossibility;
@Schema(description = "预计落地时间", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "预计落地时间不能为空")
private LocalDateTime expectedTime;
@Schema(description = "变更事项")
private String changeOfMatters;
@Schema(description = "变更原因 ", example = "不好")
private String changeReason;
@Schema(description = "变更前")
private String beforeChange;
@Schema(description = "变更后")
private String afterChange;
@Schema(description = "委托方式其他")
private String entrustmentOther;
}

View File

@ -79,6 +79,14 @@ public class SubcontractorController {
return success(BeanUtils.toBean(pageResult, SubcontractorRespVO.class));
}
@GetMapping("/list")
@Operation(summary = "获得供应商信息列表")
@PreAuthorize("@ss.hasPermission('pm:subcontractor:query')")
public CommonResult<List<SubcontractorRespVO>> getSubcontractorList(@Valid SubcontractorReqVO reqVO) {
List<SubcontractorDO> list = subcontractorService.getSubcontractorList(reqVO);
return success(BeanUtils.toBean(list, SubcontractorRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出供应商信息 Excel")
@PreAuthorize("@ss.hasPermission('pm:subcontractor:export')")

View File

@ -0,0 +1,27 @@
package cn.iocoder.yudao.module.pm.controller.admin.subcontractor.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - 供应商 Request VO")
@Data
@EqualsAndHashCode
@ToString(callSuper = true)
public class SubcontractorReqVO {
@Schema(description = "供应商名称", example = "张三")
private String name;
@Schema(description = "组织机构代码", example = "12345")
private String code;
@Schema(description = "联系人", example = "张三")
private String contacts;
@Schema(description = "电话 ", example = "145789754112")
private String phone;
@Schema(description = "地址 ", example = "北京合同1234路")
private String address;
}

View File

@ -0,0 +1,152 @@
package cn.iocoder.yudao.module.pm.dal.dataobject.projecttracking;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 项目跟踪 DO
*
* @author hhyykk
*/
@TableName("pm_project_tracking")
@KeySequence("pm_project_tracking_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ProjectTrackingDO extends BaseDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 项目名称
*/
private String name;
/**
* 建设单位id
*/
private Long constructionId;
/**
* 联系人
*/
private String contacts;
/**
* 联系方式
*/
private String phone;
/**
* 主控部门id
*/
private Long deptId;
/**
* 项目负责人id
*/
private Long pmId;
/**
* 预计合同额
*/
private String contractAmount;
/**
* 省份id
*/
private Long provincId;
/**
* 城市id
*/
private Long cityId;
/**
* 地址
*/
private String address;
/**
* 业务类型
*
* 枚举 {@link TODO project_type 对应的类}
*/
private String businessType;
/**
* 项目情况
*/
private String situation;
/**
* 是否为应急项目
*/
private Boolean emergency;
/**
* 委托方式
*
* 枚举 {@link TODO entrust_method 对应的类}
*/
private String entrustmentMethod;
/**
* 应急项目附件id
*/
private Long emergencyDocId;
/**
* 是否业务合作项目
*/
private Boolean collaborativeProjects;
/**
* 合作单位id
*/
private Long cooperativeCompanyId;
/**
* 落地可能性
*
* 枚举 {@link TODO possibility_of_landing 对应的类}
*/
private String landingPossibility;
/**
* 预计落地时间
*/
private LocalDateTime expectedTime;
/**
* 变更事项
*
* 枚举 {@link TODO change_of_matters 对应的类}
*/
private String changeOfMatters;
/**
* 变更原因
*/
private String changeReason;
/**
* 变更前
*/
private String beforeChange;
/**
* 变更后
*/
private String afterChange;
/**
* 委托方式其他
*/
private String entrustmentOther;
/**
* 拓展字段2
*/
private String exTxt2;
/**
* 拓展字段3
*/
private String exTxt3;
/**
* 拓展字段4
*/
private String exTxt4;
/**
* 拓展字段5
*/
private String exTxt5;
}

View File

@ -27,4 +27,13 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> {
.orderByDesc(CustomerDO::getId));
}
default List<CustomerDO> getList(CustomerReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<CustomerDO>()
.likeIfPresent(CustomerDO::getName, reqVO.getName())
.likeIfPresent(CustomerDO::getCode, reqVO.getCode())
.likeIfPresent(CustomerDO::getContacts, reqVO.getContacts())
.likeIfPresent(CustomerDO::getPhone, reqVO.getPhone())
.likeIfPresent(CustomerDO::getAddress, reqVO.getAddress())
.orderByDesc(CustomerDO::getId));
}
}

View File

@ -0,0 +1,32 @@
package cn.iocoder.yudao.module.pm.dal.mysql.projecttracking;
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.pm.dal.dataobject.projecttracking.ProjectTrackingDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.pm.controller.admin.projecttracking.vo.*;
/**
* 项目跟踪 Mapper
*
* @author hhyykk
*/
@Mapper
public interface ProjectTrackingMapper extends BaseMapperX<ProjectTrackingDO> {
default PageResult<ProjectTrackingDO> selectPage(ProjectTrackingPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ProjectTrackingDO>()
.likeIfPresent(ProjectTrackingDO::getName, reqVO.getName())
.eqIfPresent(ProjectTrackingDO::getConstructionId, reqVO.getConstructionId())
.eqIfPresent(ProjectTrackingDO::getDeptId, reqVO.getDeptId())
.eqIfPresent(ProjectTrackingDO::getPmId, reqVO.getPmId())
.likeIfPresent(ProjectTrackingDO::getContractAmount, reqVO.getContractAmount())
.eqIfPresent(ProjectTrackingDO::getBusinessType, reqVO.getBusinessType())
.eqIfPresent(ProjectTrackingDO::getLandingPossibility, reqVO.getLandingPossibility())
.orderByDesc(ProjectTrackingDO::getId));
}
}

View File

@ -27,4 +27,13 @@ public interface SubcontractorMapper extends BaseMapperX<SubcontractorDO> {
.orderByDesc(SubcontractorDO::getId));
}
default List<SubcontractorDO> getList(SubcontractorReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<SubcontractorDO>()
.likeIfPresent(SubcontractorDO::getName, reqVO.getName())
.likeIfPresent(SubcontractorDO::getCode, reqVO.getCode())
.likeIfPresent(SubcontractorDO::getContacts, reqVO.getContacts())
.likeIfPresent(SubcontractorDO::getPhone, reqVO.getPhone())
.likeIfPresent(SubcontractorDO::getAddress, reqVO.getAddress())
.orderByDesc(SubcontractorDO::getId));
}
}

View File

@ -52,4 +52,11 @@ public interface CustomerService {
*/
PageResult<CustomerDO> getCustomerPage(CustomerPageReqVO pageReqVO);
/**
* 获得客户信息列表, 用于 Excel 导出
*
* @param reqVO 查询条件
* @return 客户信息列表
*/
List<CustomerDO> getCustomerList(CustomerReqVO reqVO);
}

View File

@ -92,4 +92,9 @@ public class CustomerServiceImpl implements CustomerService {
return customerMapper.selectPage(pageReqVO);
}
@Override
public List<CustomerDO> getCustomerList(CustomerReqVO reqVO) {
return customerMapper.getList(reqVO);
}
}

View File

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.pm.service.projecttracking;
import java.util.*;
import jakarta.validation.*;
import cn.iocoder.yudao.module.pm.controller.admin.projecttracking.vo.*;
import cn.iocoder.yudao.module.pm.dal.dataobject.projecttracking.ProjectTrackingDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 项目跟踪 Service 接口
*
* @author hhyykk
*/
public interface ProjectTrackingService {
/**
* 创建项目跟踪
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createProjectTracking(@Valid ProjectTrackingSaveReqVO createReqVO);
/**
* 更新项目跟踪
*
* @param updateReqVO 更新信息
*/
void updateProjectTracking(@Valid ProjectTrackingSaveReqVO updateReqVO);
/**
* 删除项目跟踪
*
* @param id 编号
*/
void deleteProjectTracking(Long id);
/**
* 获得项目跟踪
*
* @param id 编号
* @return 项目跟踪
*/
ProjectTrackingDO getProjectTracking(Long id);
/**
* 获得项目跟踪 分页
*
* @param pageReqVO 分页查询
* @return 项目跟踪 分页
*/
PageResult<ProjectTrackingDO> getProjectTrackingPage(ProjectTrackingPageReqVO pageReqVO);
}

View File

@ -0,0 +1,74 @@
package cn.iocoder.yudao.module.pm.service.projecttracking;
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.pm.controller.admin.projecttracking.vo.*;
import cn.iocoder.yudao.module.pm.dal.dataobject.projecttracking.ProjectTrackingDO;
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.pm.dal.mysql.projecttracking.ProjectTrackingMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.pm.enums.ErrorCodeConstants.*;
/**
* 项目跟踪 Service 实现类
*
* @author hhyykk
*/
@Service
@Validated
public class ProjectTrackingServiceImpl implements ProjectTrackingService {
@Resource
private ProjectTrackingMapper projectTrackingMapper;
@Override
public Long createProjectTracking(ProjectTrackingSaveReqVO createReqVO) {
// 插入
ProjectTrackingDO projectTracking = BeanUtils.toBean(createReqVO, ProjectTrackingDO.class);
projectTrackingMapper.insert(projectTracking);
// 返回
return projectTracking.getId();
}
@Override
public void updateProjectTracking(ProjectTrackingSaveReqVO updateReqVO) {
// 校验存在
validateProjectTrackingExists(updateReqVO.getId());
// 更新
ProjectTrackingDO updateObj = BeanUtils.toBean(updateReqVO, ProjectTrackingDO.class);
projectTrackingMapper.updateById(updateObj);
}
@Override
public void deleteProjectTracking(Long id) {
// 校验存在
validateProjectTrackingExists(id);
// 删除
projectTrackingMapper.deleteById(id);
}
private void validateProjectTrackingExists(Long id) {
if (projectTrackingMapper.selectById(id) == null) {
throw exception(PROJECT_TRACKING_NOT_EXISTS);
}
}
@Override
public ProjectTrackingDO getProjectTracking(Long id) {
return projectTrackingMapper.selectById(id);
}
@Override
public PageResult<ProjectTrackingDO> getProjectTrackingPage(ProjectTrackingPageReqVO pageReqVO) {
return projectTrackingMapper.selectPage(pageReqVO);
}
}

View File

@ -52,4 +52,11 @@ public interface SubcontractorService {
*/
PageResult<SubcontractorDO> getSubcontractorPage(SubcontractorPageReqVO pageReqVO);
/**
* 获得供应商信息列表, 用于 Excel 导出
*
* @param reqVO 查询条件
* @return 供应商信息列表
*/
List<SubcontractorDO> getSubcontractorList(@Valid SubcontractorReqVO reqVO);
}

View File

@ -90,4 +90,9 @@ public class SubcontractorServiceImpl implements SubcontractorService {
return subcontractorMapper.selectPage(pageReqVO);
}
@Override
public List<SubcontractorDO> getSubcontractorList(SubcontractorReqVO reqVO) {
return subcontractorMapper.getList(reqVO);
}
}

View File

@ -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.pm.dal.mysql.projecttracking.ProjectTrackingMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>