# Conflicts:
#	dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CustomerMainController.java
#	dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CustomerMainService.java
#	yudao-server/src/main/resources/application-local.yaml
This commit is contained in:
Vinjor 2024-08-01 18:04:35 +08:00
commit 73740982f0
19 changed files with 850 additions and 182 deletions

View File

@ -0,0 +1,21 @@
package cn.iocoder.yudao.common;
/**
* 字典编码常量类
* @author PQZ
* @date 16:20 2024/8/1
**/
public class DictBaseConstants {
/**客户类型字典编码*/
public static final String DICT_CUS_TYPE = "cus_type";
/**客户初始来源字典编码*/
public static final String DICT_CUS_DATA_FROM = "cus_data_from";
/**业务分类字典编码*/
public static final String DICT_CUS_BUSI_TYPE = "cus_busi_type";
/**客户注册方式字典编码*/
public static final String DICT_SIGN_TYPE = "cus_sign_type";
/**性别*/
public static final String DICT_SYS_USER_SEX = "system_user_sex";
}

View File

@ -1,4 +0,0 @@
package cn.iocoder.yudao.common;
public interface TestCommon {
}

View File

@ -0,0 +1,99 @@
package cn.iocoder.yudao.module.custom.controller.admin;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.service.CarMainService;
import cn.iocoder.yudao.module.custom.vo.CarMainReqVO;
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.*;
import javax.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 javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
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.*;
@Tag(name = "管理后台 - 车辆信息")
@RestController
@RequestMapping("/base/carMain")
@Validated
public class CarMainController {
@Resource
private CarMainService carMainService;
@PostMapping("/create")
@Operation(summary = "创建车辆信息")
@PreAuthorize("@ss.hasPermission('base:car-main:create')")
public CommonResult<String> createCarMain(@RequestBody CarMainReqVO createReqVO) {
return success(carMainService.createCarMain(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新车辆信息")
@PreAuthorize("@ss.hasPermission('base:car-main:update')")
public CommonResult<Boolean> updateCarMain(@RequestBody CarMainReqVO updateReqVO) {
carMainService.updateCarMain(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除车辆信息")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:car-main:delete')")
public CommonResult<Boolean> deleteCarMain(@RequestParam("id") String id) {
carMainService.deleteCarMain(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得车辆信息")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:car-main:query')")
public CommonResult<CarMainRespVO> getCarMain(@RequestParam("id") String id) {
CarMain carMain = carMainService.getCarMain(id);
return success(BeanUtils.toBean(carMain, CarMainRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得车辆信息分页")
@PreAuthorize("@ss.hasPermission('base:car-main:query')")
public CommonResult<IPage<CarMainRespVO>> getCarMainPage(CarMainReqVO pageReqVO) {
IPage<CarMainRespVO> pageResult = carMainService.getCarMainPage(pageReqVO);
return success(pageResult);
}
@GetMapping("/export-excel")
@Operation(summary = "导出车辆信息 Excel")
@PreAuthorize("@ss.hasPermission('base:car-main:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportCarMainExcel(CarMainReqVO pageReqVO, HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<CarMainRespVO> list = carMainService.getCarMainPage(pageReqVO).getRecords();
// 导出 Excel
ExcelUtils.write(response, "车辆信息.xls", "数据", CarMainRespVO.class,
BeanUtils.toBean(list, CarMainRespVO.class));
}
}

View File

@ -1,13 +1,6 @@
package cn.iocoder.yudao.module.custom.controller.admin; package cn.iocoder.yudao.module.custom.controller.admin;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.module.company.vo.CompanyReqVO;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.service.CustomerMainService; import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO; import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO; import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
@ -22,17 +15,13 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.IOException;
import java.util.List;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/** /**
* 客户管理每个租户的下属客户信息 * 客户管理每个租户的下的客户信息
*
* @author : http://www.chiner.pro * @author : http://www.chiner.pro
* @date : 2024-7-31 * @date : 2024-7-31
*/ */
@ -41,20 +30,67 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - BASE 企业管理") @Tag(name = "管理后台 - BASE 企业管理")
@Validated @Validated
public class CustomerMainController { public class CustomerMainController {
@Autowired
private CustomerMainService customerMainService;
/**
* 客户管理分页列表查询
*
* @param pageReqVO 客户管理查询条件封装实体
* @param pageNo 分页参数
* @param pageSize 分页参数
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<com.baomidou.mybatisplus.core.metadata.IPage < ?>>
* @author PQZ
* @date 14:56 2024/8/1
**/
@GetMapping("/page")
@Operation(summary = "获得客户管理分页")
@PreAuthorize("@ss.hasPermission('base:customer-main:query')")
public CommonResult<IPage<?>> getCustomerMainPage(CustomerMainPageReqVO pageReqVO,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
Page<CustomerMainRespVO> page = new Page<>(pageNo, pageSize);
return success(customerMainService.queryListPage(pageReqVO, page));
}
/**
* 新增客户
*
* @param saveReqVO 保存客户信息扩展实体
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
* @author PQZ
* @date 15:42 2024/8/1
**/
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建客户管理") @Operation(summary = "创建客户管理")
@PreAuthorize("@ss.hasPermission('base:customer-main:create')") @PreAuthorize("@ss.hasPermission('base:customer-main:create')")
public CommonResult<Boolean> createCustomerMain(@Valid @RequestBody CustomerMainSaveReqVO createReqVO) { public CommonResult<Boolean> createCustomerMain(@Valid @RequestBody CustomerMainSaveReqVO saveReqVO) {
return success(true); return success(true);
} }
/**
* 编辑客户
*
* @param saveReqVO 保存客户信息扩展实体
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
* @author PQZ
* @date 15:44 2024/8/1
**/
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新客户管理") @Operation(summary = "更新客户管理")
@PreAuthorize("@ss.hasPermission('base:customer-main:update')") @PreAuthorize("@ss.hasPermission('base:customer-main:update')")
public CommonResult<Boolean> updateCustomerMain(@Valid @RequestBody CustomerMainSaveReqVO updateReqVO) { public CommonResult<Boolean> updateCustomerMain(@Valid @RequestBody CustomerMainSaveReqVO saveReqVO) {
return success(true); return success(true);
} }
/**
* 删除客户
*
* @param id 保存客户信息扩展实体
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
* @author PQZ
* @date 15:44 2024/8/1
**/
@DeleteMapping("/delete") @DeleteMapping("/delete")
@Operation(summary = "删除客户管理") @Operation(summary = "删除客户管理")
@Parameter(name = "id", description = "编号", required = true) @Parameter(name = "id", description = "编号", required = true)
@ -63,6 +99,14 @@ public class CustomerMainController {
return success(true); return success(true);
} }
/**
* 通过客户id查询客户信息
*
* @param id 客户id
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<java.lang.Boolean>
* @author PQZ
* @date 15:44 2024/8/1
**/
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得客户管理") @Operation(summary = "获得客户管理")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@ -71,23 +115,4 @@ public class CustomerMainController {
return success(true); return success(true);
} }
@GetMapping("/page")
@Operation(summary = "获得客户管理分页")
@PreAuthorize("@ss.hasPermission('base:customer-main:query')")
public CommonResult<Boolean> getCustomerMainPage(@Valid CustomerMainPageReqVO pageReqVO) {
return success(true);
}
@GetMapping("/export-excel")
@Operation(summary = "导出客户管理 Excel")
@PreAuthorize("@ss.hasPermission('base:customer-main:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportCustomerMainExcel(@Valid CustomerMainPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
// List<CustomerMain> list = customerMainService.getCustomerMainPage(pageReqVO).getList();
// // 导出 Excel
// ExcelUtils.write(response, "客户管理.xls", "数据", CustomerMainRespVO.class,
// BeanUtils.toBean(list, CustomerMainRespVO.class));
}
} }

View File

@ -0,0 +1,121 @@
package cn.iocoder.yudao.module.custom.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
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 后台管理员
*/
@TableName("base_car_main")
@Data
@EqualsAndHashCode(callSuper = true)
public class CarMain extends TenantBaseDO {
/**
* 主键标识
*/
@TableId(type = IdType.ASSIGN_UUID)
private String id;
/**
* 发动机号码
*/
private String engineNumber;
/**
* 车架号
*/
private String vin;
/**
* 车牌号
*/
private String licenseNumber;
/**
* 车辆型号
*/
private String carModel;
/**
* 保养日期
*/
private LocalDateTime maintenanceDate;
/**
* 保养里程
*/
private String maintenanceMileage;
/**
* 年检日期
*/
private LocalDateTime inspectionDate;
/**
* 保险日期
*/
private LocalDateTime insuranceDate;
/**
* 二级维护时间
*/
private LocalDateTime checkDate;
/**
* 下次保养日期
*/
private LocalDateTime nextMaintenanceDate;
/**
* 下次保养里程
*/
private Integer nextMaintenanceMileage;
/**
* 下次年检日期
*/
private LocalDateTime nextInspectionDate;
/**
* 保险到期日期
*/
private LocalDateTime insuranceExpiryDate;
/**
* 下次二级维护时间
*/
private LocalDateTime nextCheckDate;
/**
* 车辆品牌
*/
private String carBrand;
/**
* 车辆性质营运 非营运等
*/
private String carNature;
/**
* 车辆类别私家车 货车 教练车 公务车 出租车
*/
private String carCategory;
/**
* 车辆注册日期
*/
private LocalDateTime carRegisterDate;
/**
* 行驶证图片
*/
private String carLicenseImg;
/**
* 最近办理业务
*/
private String recentlyHandledBusiness;
/**
* 最近办理业务的时间
*/
private LocalDateTime recentlyHandleBusinessTime;
}

View File

@ -1,11 +1,15 @@
package cn.iocoder.yudao.module.custom.entity; package cn.iocoder.yudao.module.custom.entity;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; 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.*; import lombok.*;
import java.time.LocalDateTime; import java.util.Date;
import com.baomidou.mybatisplus.annotation.*; import static cn.iocoder.yudao.common.DictBaseConstants.*;
/** /**
* 客户管理 DO * 客户管理 DO
@ -13,7 +17,6 @@ import com.baomidou.mybatisplus.annotation.*;
* @author pqz * @author pqz
*/ */
@TableName("base_customer_main") @TableName("base_customer_main")
@KeySequence("base_customer_main_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
@ -25,7 +28,7 @@ public class CustomerMain extends TenantBaseDO {
/** /**
* uuid * uuid
*/ */
@TableId(type = IdType.INPUT) @TableId(type = IdType.ASSIGN_UUID)
private String id; private String id;
/** /**
* sys_user表id * sys_user表id
@ -34,6 +37,7 @@ public class CustomerMain extends TenantBaseDO {
/** /**
* 用户类型 * 用户类型
*/ */
@DictFormat(DICT_CUS_TYPE)
private String typeCode; private String typeCode;
/** /**
* 所属企业code部门表code * 所属企业code部门表code
@ -50,7 +54,7 @@ public class CustomerMain extends TenantBaseDO {
/** /**
* 生日 * 生日
*/ */
private LocalDateTime birthday; private Date birthday;
/** /**
* 住址 * 住址
*/ */
@ -58,6 +62,7 @@ public class CustomerMain extends TenantBaseDO {
/** /**
* 性别 * 性别
*/ */
@DictFormat(DICT_SYS_USER_SEX)
private String sex; private String sex;
/** /**
* 身份证号 * 身份证号
@ -70,14 +75,16 @@ public class CustomerMain extends TenantBaseDO {
/** /**
* 客户初始来源 * 客户初始来源
*/ */
@DictFormat(DICT_CUS_DATA_FROM)
private String dataFrom; private String dataFrom;
/** /**
* 最近业务办理时间 * 最近业务办理时间
*/ */
private LocalDateTime nearDoTime; private Date nearDoTime;
/** /**
* 最近办理业务数据字典业务标识 * 最近办理业务数据字典业务标识
*/ */
@DictFormat(DICT_CUS_BUSI_TYPE)
private String nearDoContent; private String nearDoContent;
/** /**
* 邀请者user_id * 邀请者user_id
@ -86,6 +93,7 @@ public class CustomerMain extends TenantBaseDO {
/** /**
* 邀请者类型 * 邀请者类型
*/ */
@DictFormat(DICT_SIGN_TYPE)
private String inviterType; private String inviterType;
/** /**
* 客户状态 * 客户状态

View File

@ -0,0 +1,24 @@
package cn.iocoder.yudao.module.custom.mapper;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.vo.CarMainReqVO;
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
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 后台管理员
*/
@Mapper
public interface CarMainMapper extends BaseMapper<CarMain> {
IPage<CarMainRespVO> findPage(Page<CarMain> page, @Param("dto") CarMainReqVO pageReqVO);
}

View File

@ -1,8 +1,15 @@
package cn.iocoder.yudao.module.custom.mapper; package cn.iocoder.yudao.module.custom.mapper;
import cn.iocoder.yudao.module.company.entity.DlCompany;
import cn.iocoder.yudao.module.company.vo.CompanyReqVO;
import cn.iocoder.yudao.module.custom.entity.CustomerMain; import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; 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.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* 客户管理 Mapper * 客户管理 Mapper
@ -12,5 +19,16 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface CustomerMainMapper extends BaseMapper<CustomerMain> { public interface CustomerMainMapper extends BaseMapper<CustomerMain> {
/**
* 客户管理分页列表查询
*
* @param pageReqVO 客户管理查询条件封装实体
* @param page 分页参数
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO>
* @author PQZ
* @date 15:01 2024/8/1
**/
IPage<CustomerMainRespVO> selectListPage(@Param("entity") CustomerMainPageReqVO pageReqVO, Page<CustomerMainRespVO> page);
} }

View File

@ -0,0 +1,60 @@
package cn.iocoder.yudao.module.custom.service;
import javax.validation.*;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.vo.CarMainReqVO;
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* 车辆信息 Service 接口
*
* @author 后台管理员
*/
public interface CarMainService extends IService<CarMain> {
/**
* 创建车辆信息
*
* @param createReqVO 创建信息
* @return 编号
*/
String createCarMain(CarMainReqVO createReqVO);
/**
* 更新车辆信息
*
* @param updateReqVO 更新信息
*/
void updateCarMain(CarMainReqVO updateReqVO);
/**
* 删除车辆信息
*
* @param id 编号
*/
void deleteCarMain(String id);
/**
* 获得车辆信息
*
* @param id 编号
* @return 车辆信息
*/
CarMain getCarMain(String id);
/**
* 获得车辆信息分页
*
* @param pageReqVO 分页查询
* @return 车辆信息分页
*/
IPage<CarMainRespVO> getCarMainPage(CarMainReqVO pageReqVO);
}

View File

@ -1,6 +1,13 @@
package cn.iocoder.yudao.module.custom.service; package cn.iocoder.yudao.module.custom.service;
import cn.iocoder.yudao.module.company.entity.DlCompany;
import cn.iocoder.yudao.module.company.vo.CompanyReqVO;
import cn.iocoder.yudao.module.custom.entity.CustomerMain; import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
/** /**
@ -10,6 +17,25 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/ */
public interface CustomerMainService extends IService<CustomerMain> { public interface CustomerMainService extends IService<CustomerMain> {
/**
* 客户管理分页列表查询
*
* @param pageReqVO 客户管理查询条件封装实体
* @param page 分页参数
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO>
* @author PQZ
* @date 14:57 2024/8/1
**/
IPage<CustomerMainRespVO> queryListPage(CustomerMainPageReqVO pageReqVO, Page<CustomerMainRespVO> page);
/**
* 保存客户信息
*
* @param saveReqVO 保存客户信息扩展实体
* @return void
* @author PQZ
* @date 15:46 2024/8/1
**/
void saveCustomer(CustomerMainSaveReqVO saveReqVO);
} }

View File

@ -0,0 +1,58 @@
package cn.iocoder.yudao.module.custom.service.impl;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.mapper.CarMainMapper;
import cn.iocoder.yudao.module.custom.service.CarMainService;
import cn.iocoder.yudao.module.custom.vo.CarMainReqVO;
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
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 cn.iocoder.yudao.framework.common.util.object.BeanUtils;
/**
* 车辆信息 Service 实现类
*
* @author 后台管理员
*/
@Service
public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> implements CarMainService{
@Override
public String createCarMain(CarMainReqVO createReqVO) {
// 插入
CarMain carMain = BeanUtils.toBean(createReqVO, CarMain.class);
baseMapper.insert(carMain);
// 返回
return carMain.getId();
}
@Override
public void updateCarMain(CarMainReqVO updateReqVO){
// 更新
CarMain updateObj = BeanUtils.toBean(updateReqVO, CarMain.class);
baseMapper.updateById(updateObj);
}
@Override
public void deleteCarMain(String id) {
// 删除
baseMapper.deleteById(id);
}
@Override
public CarMain getCarMain(String id) {
return baseMapper.selectById(id);
}
@Override
public IPage<CarMainRespVO> getCarMainPage(CarMainReqVO pageReqVO) {
Page<CarMain> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
return baseMapper.findPage(page,pageReqVO);
}
}

View File

@ -1,9 +1,16 @@
package cn.iocoder.yudao.module.custom.service.impl; package cn.iocoder.yudao.module.custom.service.impl;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.module.custom.entity.CustomerMain; import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import cn.iocoder.yudao.module.custom.mapper.CustomerMainMapper; import cn.iocoder.yudao.module.custom.mapper.CustomerMainMapper;
import cn.iocoder.yudao.module.custom.service.CustomerMainService; import cn.iocoder.yudao.module.custom.service.CustomerMainService;
import cn.iocoder.yudao.module.custom.vo.CustomerMainPageReqVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO;
import cn.iocoder.yudao.module.custom.vo.CustomerMainSaveReqVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -16,4 +23,34 @@ import org.springframework.validation.annotation.Validated;
@Validated @Validated
public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, CustomerMain> implements CustomerMainService { public class CustomerMainServiceImpl extends ServiceImpl<CustomerMainMapper, CustomerMain> implements CustomerMainService {
@Autowired
private CustomerMainMapper customerMainMapper;
/**
* 客户管理分页列表查询
*
* @param pageReqVO 客户管理查询条件封装实体
* @param page 分页参数
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO>
* @author PQZ
* @date 14:57 2024/8/1
**/
@Override
public IPage<CustomerMainRespVO> queryListPage(CustomerMainPageReqVO pageReqVO, Page<CustomerMainRespVO> page) {
return customerMainMapper.selectListPage(pageReqVO,page);
}
/**
* 保存客户信息
*
* @param saveReqVO 保存客户信息扩展实体
* @return void
* @author PQZ
* @date 15:46 2024/8/1
**/
@Override
public void saveCustomer(CustomerMainSaveReqVO saveReqVO) {
CustomerMain main = JSONUtil.toBean(JSONUtil.parseObj(saveReqVO).toJSONString(0), CustomerMain.class);
this.saveOrUpdate(main);
}
} }

View File

@ -0,0 +1,83 @@
package cn.iocoder.yudao.module.custom.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 CarMainReqVO extends PageParam {
@Schema(description = "主键ID")
private String id;
@Schema(description = "发动机号码")
private String engineNumber;
@Schema(description = "车架号")
private String vin;
@Schema(description = "车牌号")
private String licenseNumber;
@Schema(description = "车辆型号")
private String carModel;
@Schema(description = "保养日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime maintenanceDate;
@Schema(description = "保养里程")
private String maintenanceMileage;
@Schema(description = "年检日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime inspectionDate;
@Schema(description = "保险日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime insuranceDate;
@Schema(description = "二级维护时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime checkDate;
@Schema(description = "车辆品牌")
private String carBrand;
@Schema(description = "车辆性质:营运 非营运等")
private String carNature;
@Schema(description = "车辆类别:私家车 货车 教练车 公务车 出租车")
private String carCategory;
@Schema(description = "车辆注册日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime carRegisterDate;
@Schema(description = "行驶证图片")
private String carLicenseImg;
@Schema(description = "最近办理业务")
private String recentlyHandledBusiness;
@Schema(description = "最近办理业务的时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime recentlyHandleBusinessTime;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime createTime;
@Schema(description = "租户ID")
private String tenantId;
}

View File

@ -0,0 +1,89 @@
package cn.iocoder.yudao.module.custom.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 static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 车辆信息 Response VO")
@Data
@ExcelIgnoreUnannotated
public class CarMainRespVO {
@Schema(description = "主键标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "8714")
@ExcelProperty("主键标识")
private String id;
@Schema(description = "发动机号码", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("发动机号码")
private String engineNumber;
@Schema(description = "车架号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("车架号")
private String vin;
@Schema(description = "车牌号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("车牌号")
private String licenseNumber;
@Schema(description = "车辆型号")
@ExcelProperty("车辆型号")
private String carModel;
@Schema(description = "保养日期")
@ExcelProperty("保养日期")
private LocalDateTime maintenanceDate;
@Schema(description = "保养里程")
@ExcelProperty("保养里程")
private String maintenanceMileage;
@Schema(description = "年检日期", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("年检日期")
private LocalDateTime inspectionDate;
@Schema(description = "保险日期")
@ExcelProperty("保险日期")
private LocalDateTime insuranceDate;
@Schema(description = "二级维护时间")
@ExcelProperty("二级维护时间")
private LocalDateTime checkDate;
@Schema(description = "车辆品牌", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("车辆品牌")
private String carBrand;
@Schema(description = "车辆性质:营运 非营运等", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("车辆性质")
private String carNature;
@Schema(description = "车辆类别:私家车 货车 教练车 公务车 出租车")
@ExcelProperty("车辆类别")
private String carCategory;
@Schema(description = "车辆注册日期", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("车辆注册日期")
private LocalDateTime carRegisterDate;
@Schema(description = "行驶证图片")
@ExcelProperty("行驶证图片")
private String carLicenseImg;
@Schema(description = "最近办理业务")
@ExcelProperty("最近办理业务")
private String recentlyHandledBusiness;
@Schema(description = "最近办理业务的时间")
@ExcelProperty("最近办理业务的时间")
private LocalDateTime recentlyHandleBusinessTime;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -1,71 +1,17 @@
package cn.iocoder.yudao.module.custom.vo; package cn.iocoder.yudao.module.custom.vo;
import lombok.*; import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat; import lombok.EqualsAndHashCode;
import java.time.LocalDateTime; import lombok.ToString;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 客户管理分页 Request VO") @Schema(description = "管理后台 - 客户管理分页 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class CustomerMainPageReqVO extends PageParam { public class CustomerMainPageReqVO extends CustomerMain {
/**系统标识*/
@Schema(description = "sys_user表id", example = "17679") private String systemCode;
private String userId;
@Schema(description = "用户类型")
private String typeCode;
@Schema(description = "所属企业code部门表code")
private String deptCode;
@Schema(description = "客户名称(政企客户填企业名称)", example = "赵六")
private String cusName;
@Schema(description = "联系方式")
private String phoneNumber;
@Schema(description = "生日")
private LocalDateTime birthday;
@Schema(description = "住址")
private String address;
@Schema(description = "性别")
private String sex;
@Schema(description = "身份证号")
private String idCard;
@Schema(description = "身份证照片")
private String idCardImage;
@Schema(description = "客户初始来源")
private String dataFrom;
@Schema(description = "最近业务办理时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] nearDoTime;
@Schema(description = "最近办理业务(数据字典业务标识)")
private String nearDoContent;
@Schema(description = "邀请者user_id")
private String inviter;
@Schema(description = "邀请者类型", example = "2")
private String inviterType;
@Schema(description = "客户状态", example = "1")
private String status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
} }

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.custom.vo; package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.module.custom.entity.CustomerMain;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;
@ -10,78 +11,19 @@ import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 客户管理 Response VO") @Schema(description = "管理后台 - 客户管理 Response VO")
@Data @Data
@ExcelIgnoreUnannotated @ExcelIgnoreUnannotated
public class CustomerMainRespVO { public class CustomerMainRespVO extends CustomerMain {
/**客户管理子表id*/
@Schema(description = "uuid", requiredMode = Schema.RequiredMode.REQUIRED, example = "29951") private String itemId;
@ExcelProperty("uuid") /**系统标识*/
private String id; private String systemCode;
/**用户等级*/
@Schema(description = "sys_user表id", example = "17679") private String userLevel;
@ExcelProperty("sys_user表id") /**服务内容*/
private String userId; private String serContent;
/**服务开始时间*/
@Schema(description = "用户类型") private Date serTimeStart;
@ExcelProperty("用户类型") /**服务结束时间*/
private String typeCode; private Date serTimeEnd;
/**大json*/
@Schema(description = "所属企业code部门表code") private String bigJson;
@ExcelProperty("所属企业code部门表code")
private String deptCode;
@Schema(description = "客户名称(政企客户填企业名称)", example = "赵六")
@ExcelProperty("客户名称(政企客户填企业名称)")
private String cusName;
@Schema(description = "联系方式")
@ExcelProperty("联系方式")
private String phoneNumber;
@Schema(description = "生日")
@ExcelProperty("生日")
private LocalDateTime birthday;
@Schema(description = "住址")
@ExcelProperty("住址")
private String address;
@Schema(description = "性别")
@ExcelProperty("性别")
private String sex;
@Schema(description = "身份证号")
@ExcelProperty("身份证号")
private String idCard;
@Schema(description = "身份证照片")
@ExcelProperty("身份证照片")
private String idCardImage;
@Schema(description = "客户初始来源")
@ExcelProperty("客户初始来源")
private String dataFrom;
@Schema(description = "最近业务办理时间")
@ExcelProperty("最近业务办理时间")
private LocalDateTime nearDoTime;
@Schema(description = "最近办理业务(数据字典业务标识)")
@ExcelProperty("最近办理业务(数据字典业务标识)")
private String nearDoContent;
@Schema(description = "邀请者user_id")
@ExcelProperty("邀请者user_id")
private String inviter;
@Schema(description = "邀请者类型", example = "2")
@ExcelProperty("邀请者类型")
private String inviterType;
@Schema(description = "客户状态", example = "1")
@ExcelProperty("客户状态")
private String status;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
} }

View File

@ -0,0 +1,71 @@
<?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.custom.mapper.CarMainMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<sql id="column">
id,
engine_number,
vin,
license_number,
car_model,
maintenance_date,
maintenance_mileage,
inspection_date,
insurance_date,
check_date,
next_maintenance_date,
next_maintenance_mileage,
next_inspection_date,
insurance_expiry_date,
next_check_date,
car_brand,
car_nature,
car_category,
car_register_date,
car_license_img,
recently_handled_business,
recently_handle_business_time,
deleted,
creator,
create_time,
updater,
update_time
</sql>
<select id="findPage" resultType="cn.iocoder.yudao.module.custom.vo.CarMainRespVO">
SELECT
<include refid="column"></include>
FROM `base_car_main`
WHERE
deleted = 0
<if test="dto.licenseNumber != null and dto.licenseNumber != ''">
AND license_number LIKE CONCAT('%',#{dto.licenseNumber},'%')
</if>
<if test="dto.carBrand != null and dto.carBrand != ''">
AND car_brand = #{dto.carBrand}
</if>
<if test="dto.carCategory != null and dto.carCategory != ''">
AND car_category = #{dto.carCategory}
</if>
<if test="dto.recentlyHandledBusiness != null and dto.recentlyHandledBusiness != ''">
AND recently_handled_business = #{dto.recentlyHandledBusiness}
</if>
<if test="dto.recentlyHandleBusinessTime != null">
AND recently_handle_business_time = #{dto.recentlyHandleBusinessTime}
</if>
<if test="dto.vin != null and dto.vin != ''">
AND vin LIKE CONCAT('%',#{dto.vin},'%')
</if>
<if test="dto.recentlyHandledBusiness != null and dto.recentlyHandledBusiness != ''">
AND tenant_id = #{dto.tenant}
</if>
</select>
</mapper>

View File

@ -2,11 +2,54 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.custom.mapper.CustomerMainMapper"> <mapper namespace="cn.iocoder.yudao.module.custom.mapper.CustomerMainMapper">
<!-- <!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/ 文档可见https://www.iocoder.cn/MyBatis/x-plugins/
--> -->
<select id="selectListPage" resultType="cn.iocoder.yudao.module.custom.vo.CustomerMainRespVO">
SELECT
main.id AS id,
main.user_id AS userId,
main.type_code AS typeCode,
main.dept_code AS deptCode,
main.cus_name AS cusName,
main.phone_number AS phoneNumber,
main.birthday AS birthday,
main.address AS address,
main.sex AS sex,
main.id_card AS idCard,
main.id_card_image AS idCardImage,
main.data_from AS dataFrom,
main.near_do_time AS nearDoTime,
main.near_do_content AS nearDoContent,
main.inviter AS inviter,
main.inviter_type AS inviterType,
main.status AS status,
item.id AS itemId,
item.system_code AS systemCode,
item.user_level AS userLevel,
item.ser_content AS serContent,
item.ser_time_start AS serTimeStart,
item.ser_time_end AS serTimeEnd,
item.big_json AS bigJson
FROM
base_customer_main main
LEFT JOIN base_customer_item item ON main.id = item.cus_id
<where>
main.deleted = 0
<if test="entity.cusName != null and entity.cusName != ''">
AND main.cus_name LIKE concat('%',#{entity.cusName},'%')
</if>
<if test="entity.typeCode != null and entity.typeCode != ''">
AND main.type_code = #{entity.typeCode}
</if>
<if test="entity.systemCode != null and entity.systemCode != ''">
AND item.system_code = #{entity.systemCode}
</if>
</where>
ORDER BY main.create_time DESC
</select>
</mapper> </mapper>

View File

@ -175,7 +175,8 @@ logging:
cn.iocoder.yudao.module.crm.dal.mysql: debug cn.iocoder.yudao.module.crm.dal.mysql: debug
cn.iocoder.yudao.module.erp.dal.mysql: debug cn.iocoder.yudao.module.erp.dal.mysql: debug
org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR # TODO 芋艿先禁用Spring Boot 3.X 存在部分错误的 WARN 提示 org.springframework.context.support.PostProcessorRegistrationDelegate: ERROR # TODO 芋艿先禁用Spring Boot 3.X 存在部分错误的 WARN 提示
cn.iocoder.yudao.module.company.mapper.DlCompanyMapper: debug # cn.iocoder.yudao.module.custom.mapper: debug #
cn.iocoder.yudao.module.company.mapper: debug #
debug: false debug: false