Compare commits

..

2 Commits

Author SHA1 Message Date
PQZ
5ee4f8e90c Merge branch 'dev' of http://122.51.230.86:3000/dianliang/lanan-system into dev 2024-10-09 14:28:10 +08:00
PQZ
8d382f03a5 维修工人代码初始化 2024-10-09 14:28:02 +08:00
11 changed files with 368 additions and 5 deletions

View File

@ -108,6 +108,7 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
try {
/*1、入参及基础参数值设置*/
CustomerMain main = JSONUtil.toBean(JSONUtil.parseObj(saveReqVO).toJSONString(0), CustomerMain.class);
/*2、新增客户时绑定绑定客户信息*/
if (SIGN_CREATE.equals(sign)){
//查询数据字典根据客户类型匹配出预设角色code
@ -163,10 +164,12 @@ public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, Cus
roleCodes.add(dict.getRemark());
permissionApi.assignUserRole(userId, roleCodes);
}
/*3、保存客户主表信息*/
//暂时写死会员id TODO
main.setMemberLevelId("9d4567b7e68803933f4917a4aab6b745");
this.saveOrUpdate(main);
/*4、保存扩展表信息*/
if ( null!=saveReqVO.getItemList() && !saveReqVO.getItemList().isEmpty()) {
customerItemService.saveCutomItem(main.getId(), saveReqVO.getItemList());

View File

@ -0,0 +1,80 @@
package cn.iocoder.yudao.module.base.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.base.entity.RepairWorker;
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
import cn.iocoder.yudao.module.base.vo.RepairWorkerPageReqVO;
import cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO;
import cn.iocoder.yudao.module.base.vo.RepairWorkerSaveReqVO;
import cn.iocoder.yudao.module.project.vo.RepairProjectPageReqVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 维修工人")
@RestController
@RequestMapping("/repair/worker")
@Validated
public class RepairWorkerController {
@Resource
private RepairWorkerService workerService;
@PostMapping("/create")
@Operation(summary = "创建维修工人")
public CommonResult<String> createWorker(@Valid @RequestBody RepairWorkerSaveReqVO createReqVO) {
return success(workerService.createWorker(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新维修工人")
public CommonResult<Boolean> updateWorker(@Valid @RequestBody RepairWorkerSaveReqVO updateReqVO) {
workerService.updateWorker(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除维修工人")
@Parameter(name = "id", description = "编号", required = true)
public CommonResult<Boolean> deleteWorker(@RequestParam("id") String id) {
workerService.deleteWorker(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得维修工人")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
public CommonResult<RepairWorkerRespVO> getWorker(@RequestParam("id") String id) {
RepairWorker worker = workerService.getWorker(id);
return success(BeanUtils.toBean(worker, RepairWorkerRespVO.class));
}
/**
* 分页查询维修工人
* @author PQZ
* @date 14:10 2024/10/9
* @param pageReqVO RepairWorkerPageReqVO实体
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<cn.iocoder.yudao.framework.common.pojo.PageResult<cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO>>
**/
@GetMapping("/page")
@Operation(summary = "获得维修工人分页")
public CommonResult<IPage<?>> getWorkerPage(RepairWorkerPageReqVO pageReqVO,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
Page<RepairWorkerRespVO> page = new Page<>(pageNo,pageSize);
return success(workerService.queryListPage(pageReqVO,page));
}
}

View File

@ -0,0 +1,49 @@
package cn.iocoder.yudao.module.base.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
/**
* 维修工人 DO
*
* @author pqz
*/
@TableName("dl_repair_worker")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RepairWorker extends TenantBaseDO {
/**
* 主键标识
*/
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/**
* 用户id
*/
private String userId;
/**
* 维修工人名称
*/
private String userName;
/**
* 工种
*/
private String workType;
/**
* 是否为组长0代表不是 1代表是
*/
private String isLeads;
/**
* 备注
*/
private String remark;
}

View File

@ -0,0 +1,29 @@
package cn.iocoder.yudao.module.base.mapper;
import cn.iocoder.yudao.module.base.entity.RepairWorker;
import cn.iocoder.yudao.module.base.vo.RepairWorkerPageReqVO;
import cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 维修工人 Mapper
*
* @author pqz
*/
@Mapper
public interface RepairWorkerMapper extends BaseMapper<RepairWorker> {
/**
* @param entity RepairWorkerPageReqVO实体
* @param page 分页参数
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO>
* @author PQZ
* @date 14:13 2024/10/9
**/
IPage<RepairWorkerRespVO> queryListPage(@Param("entity") RepairWorkerPageReqVO entity, Page<RepairWorkerRespVO> page);
}

View File

@ -0,0 +1,63 @@
package cn.iocoder.yudao.module.base.service;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.base.entity.RepairWorker;
import cn.iocoder.yudao.module.base.vo.RepairWorkerPageReqVO;
import cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO;
import cn.iocoder.yudao.module.base.vo.RepairWorkerSaveReqVO;
import cn.iocoder.yudao.module.project.vo.RepairProjectPageReqVO;
import cn.iocoder.yudao.module.project.vo.RepairProjectRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.validation.Valid;
/**
* 维修工人 Service 接口
*
* @author pqz
*/
public interface RepairWorkerService extends IService<RepairWorker> {
/**
* 创建维修工人
*
* @param createReqVO 创建信息
* @return 编号
*/
String createWorker(@Valid RepairWorkerSaveReqVO createReqVO);
/**
* 更新维修工人
*
* @param updateReqVO 更新信息
*/
void updateWorker(@Valid RepairWorkerSaveReqVO updateReqVO);
/**
* 删除维修工人
*
* @param id 编号
*/
void deleteWorker(String id);
/**
* 获得维修工人
*
* @param id 编号
* @return 维修工人
*/
RepairWorker getWorker(String id);
/**
* @param pageReqVO RepairWorkerPageReqVO实体
* @param page 分页参数
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO>
* @author PQZ
* @date 14:12 2024/10/9
**/
IPage<RepairWorkerRespVO> queryListPage(RepairWorkerPageReqVO pageReqVO, Page<RepairWorkerRespVO> page);
}

View File

@ -0,0 +1,70 @@
package cn.iocoder.yudao.module.base.service.impl;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.base.entity.RepairWorker;
import cn.iocoder.yudao.module.base.mapper.RepairWorkerMapper;
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
import cn.iocoder.yudao.module.base.vo.RepairWorkerPageReqVO;
import cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO;
import cn.iocoder.yudao.module.base.vo.RepairWorkerSaveReqVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
/**
* 维修工人 Service 实现类
*
* @author pqz
*/
@Service
@Validated
public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, RepairWorker> implements RepairWorkerService {
@Resource
private RepairWorkerMapper workerMapper;
@Override
public String createWorker(RepairWorkerSaveReqVO createReqVO) {
// 插入
RepairWorker worker = BeanUtils.toBean(createReqVO, RepairWorker.class);
workerMapper.insert(worker);
// 返回
return worker.getId();
}
@Override
public void updateWorker(RepairWorkerSaveReqVO updateReqVO) {
// 更新
RepairWorker updateObj = BeanUtils.toBean(updateReqVO, RepairWorker.class);
workerMapper.updateById(updateObj);
}
@Override
public void deleteWorker(String id) {
// 删除
workerMapper.deleteById(id);
}
@Override
public RepairWorker getWorker(String id) {
return workerMapper.selectById(id);
}
/**
* @param pageReqVO RepairWorkerPageReqVO实体
* @param page 分页参数
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO>
* @author PQZ
* @date 14:12 2024/10/9
**/
@Override
public IPage<RepairWorkerRespVO> queryListPage(RepairWorkerPageReqVO pageReqVO, Page<RepairWorkerRespVO> page) {
return workerMapper.queryListPage(pageReqVO,page);
}
}

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.base.vo;
import cn.iocoder.yudao.module.base.entity.RepairWorker;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "接受分页查询参数")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class RepairWorkerPageReqVO extends RepairWorker {
}

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.base.vo;
import cn.iocoder.yudao.module.base.entity.RepairWorker;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 维修工人 Response VO")
@Data
@ExcelIgnoreUnannotated
public class RepairWorkerRespVO extends RepairWorker {
}

View File

@ -0,0 +1,15 @@
package cn.iocoder.yudao.module.base.vo;
import cn.iocoder.yudao.module.base.entity.RepairWorker;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 维修工人新增/修改 Request VO")
@Data
public class RepairWorkerSaveReqVO extends RepairWorker {
}

View File

@ -44,7 +44,6 @@ public class RepairProjectController {
**/
@PostMapping("/create")
@Operation(summary = "创建维修项目")
// @PreAuthorize("@ss.hasPermission('repair:project:create')")
public CommonResult<RepairProject> createRepairProject(@Valid @RequestBody RepairProjectSaveReqVO createReqVO) {
RepairProject repairProject = repairProjectService.saveRepairProject(createReqVO);
return success(repairProject);
@ -60,7 +59,6 @@ public class RepairProjectController {
**/
@PutMapping("/update")
@Operation(summary = "更新维修项目")
// @PreAuthorize("@ss.hasPermission('repair:project:update')")
public CommonResult<Boolean> updateRepairProject(@Valid @RequestBody RepairProjectSaveReqVO updateReqVO) {
repairProjectService.saveRepairProject(updateReqVO);
return success(true);
@ -77,7 +75,6 @@ public class RepairProjectController {
@DeleteMapping("/delete")
@Operation(summary = "删除维修项目")
@Parameter(name = "id", description = "编号", required = true)
// @PreAuthorize("@ss.hasPermission('repair:project:delete')")
public CommonResult<Boolean> deleteRepairProject(@RequestParam("id") String id) {
repairProjectService.deleteRepairProject(id);
return success(true);
@ -94,7 +91,6 @@ public class RepairProjectController {
@GetMapping("/get")
@Operation(summary = "获得维修项目")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
// @PreAuthorize("@ss.hasPermission('repair:project:query')")
public CommonResult<RepairProjectRespVO> getRepairProject(@RequestParam("id") String id) {
RepairProject repairProject = repairProjectService.getRepairProject(id);
return success(BeanUtils.toBean(repairProject, RepairProjectRespVO.class));
@ -113,7 +109,6 @@ public class RepairProjectController {
**/
@GetMapping("/page")
@Operation(summary = "获得维修项目分页")
// @PreAuthorize("@ss.hasPermission('repair:project:query')")
public CommonResult<IPage<?>> getRepairProjectPage(RepairProjectPageReqVO pageReqVO,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {

View File

@ -0,0 +1,27 @@
<?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.base.mapper.RepairWorkerMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="queryListPage" resultType="cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO">
SELECT
main.*
FROM
dl_repair_worker main
LEFT JOIN system_users su ON main.user_id = su.id
AND su.deleted = 0
<where>
main.deleted = 0
<if test="entity.userName != null and entity.userName != ''">
and main.user_name = #{entity.userName}
</if>
</where>
</select>
</mapper>