更新代码

This commit is contained in:
xiao-fajia 2024-09-20 16:22:24 +08:00
parent 8b253be951
commit eeafcc14cb
11 changed files with 106 additions and 5 deletions

View File

@ -42,4 +42,6 @@ public class CarMainRespVO extends CarMain {
String bxCont;
/**车辆品牌型号数组*/
List<String> brandAndModel;
/** 车辆类型 */
private String brandType;
}

View File

@ -117,6 +117,7 @@
bcm.phone_number AS phoneNumber,
bcb.brand_name AS brandStr,
bcmm.model_name AS modelStr,
bcb.brand_type AS brand_type,
DATEDIFF(tbcm.next_inspection_date, CURDATE()) AS njCont,
DATEDIFF(tbcm.next_maintenance_date, CURDATE()) AS byCont,
DATEDIFF(tbcm.insurance_expiry_date, CURDATE()) AS bxCont

View File

@ -9,4 +9,5 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
**/
public interface RepairErrorCodeConstants {
ErrorCode GOODS_IS_EMPTY = new ErrorCode(500, "商品为空");
ErrorCode ITEM_IS_EMPTY = new ErrorCode(500, "工单内容");
}

View File

@ -1,7 +1,12 @@
package cn.iocoder.yudao.module.tickets.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -13,12 +18,26 @@ import javax.annotation.Resource;
* @date 18:21 2024/9/13
**/
@RestController
@RequestMapping("dlRepairTickets")
@RequestMapping("/repair/tickets")
public class DlRepairTicketsController {
/**
* 服务对象
*/
@Resource
private DlRepairTicketsService dlRepairTicketsService;
/**
* 维修工单表 新增
*
* @author 小李
* @date 11:33 2024/9/20
* @param ticketsRespVO 新增对象
**/
@PostMapping("/create")
@Operation(summary = "维修工单表 新增")
public CommonResult<?> createTicket(@RequestBody DlRepairTicketsRespVO ticketsRespVO){
dlRepairTicketsService.createTickets(ticketsRespVO);
return CommonResult.ok();
}
}

View File

@ -14,7 +14,7 @@ import javax.annotation.Resource;
* @date 18:21 2024/9/13
**/
@RestController
@RequestMapping("dlRepairTitem")
@RequestMapping("/repair/titem")
public class DlRepairTitemController {
/**
* 服务对象

View File

@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
/**
* 维修工单表
* @author 小李
@ -131,4 +133,19 @@ public class DlRepairTickets extends TenantBaseDO {
* 部门ID
*/
private Long deptId;
}
/** 工单子项的总数(每一个子项的数量) */
private Integer count;
/** 工单项目总价 */
private BigDecimal projectPrice;
/** 工单配件总价 */
private BigDecimal partPrice;
/** 工单其他总价 */
private BigDecimal otherPrice;
/** 工单总价 */
private BigDecimal totalPrice;
}

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.tickets.service;
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
@ -11,4 +12,12 @@ import com.baomidou.mybatisplus.extension.service.IService;
**/
public interface DlRepairTicketsService extends IService<DlRepairTickets> {
/**
* 维修工单表 新增
*
* @author 小李
* @date 11:33 2024/9/20
* @param ticketsRespVO 新增对象
**/
void createTickets(DlRepairTicketsRespVO ticketsRespVO);
}

View File

@ -1,11 +1,22 @@
package cn.iocoder.yudao.module.tickets.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.common.RepairErrorCodeConstants;
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
import cn.iocoder.yudao.module.tickets.mapper.DlRepairTicketsMapper;
import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService;
import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService;
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
/**
* 针对表dl_repair_tickets(维修工单表)的数据库操作Service实现
*
@ -16,6 +27,31 @@ import org.springframework.stereotype.Service;
public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMapper, DlRepairTickets>
implements DlRepairTicketsService {
@Resource
private DlRepairTitemService titemService;
/**
* 维修工单表 新增
*
* @author 小李
* @date 11:33 2024/9/20
* @param ticketsRespVO 新增对象
**/
@Override
public void createTickets(DlRepairTicketsRespVO ticketsRespVO){
// 新增主表
baseMapper.insert(ticketsRespVO);
// 新增子表
if (CollectionUtil.isEmpty(ticketsRespVO.getItemList())){
throw exception(RepairErrorCodeConstants.ITEM_IS_EMPTY);
}
List<DlRepairTitem> itemList = ticketsRespVO.getItemList();
itemList.forEach(item -> {
item.setTichetId(ticketsRespVO.getId());
});
titemService.saveBatch(itemList);
}
}

View File

@ -1,8 +1,11 @@
package cn.iocoder.yudao.module.tickets.vo;
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
import lombok.Data;
import java.util.List;
/**
* 维修工单表 响应VO
* @author 小李
@ -10,4 +13,7 @@ import lombok.Data;
**/
@Data
public class DlRepairTicketsRespVO extends DlRepairTickets {
/** 子表数组 */
private List<DlRepairTitem> itemList;
}

View File

@ -28,6 +28,11 @@
<result property="ticketType" column="ticket_type" jdbcType="VARCHAR"/>
<result property="corpId" column="corp_id" jdbcType="VARCHAR"/>
<result property="deptId" column="dept_id" jdbcType="BIGINT"/>
<result property="count" column="count" />
<result property="projectPrice" column="project_price" />
<result property="partPrice" column="part_price" />
<result property="otherPrice" column="other_price" />
<result property="totalPrice" column="total_price" />
</resultMap>
<sql id="Base_SQL">
@ -53,7 +58,12 @@
remark,
ticket_type,
corp_id,
dept_id
dept_id,
count,
project_price,
part_price,
other_price,
total_price
from dl_repair_tickets drt
where drt.deleted = '0'
</sql>

View File

@ -68,7 +68,7 @@ flowable:
mybatis-plus:
configuration:
map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
db-config:
id-type: NONE # “智能”模式,基于 IdTypeEnvironmentPostProcessor + 数据源的类型,自动适配成 AUTO、INPUT 模式。