PDA增加新增工单和保存工单的方法

master
杨万里 2 weeks ago
parent e82b3c9d37
commit 9e6b5105cb

@ -168,4 +168,5 @@ public class BaseCarController extends BaseController
{
return baseCarService.queryCarByRfid(baseCar);
}
}

@ -1,6 +1,10 @@
package com.ruoyi.web.controller.tyre;
import java.util.List;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.BaseCar;
import com.ruoyi.system.service.IBaseCarService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -27,9 +31,13 @@ public class BizMaintenanceOrderController extends BaseController
{
private String prefix = "tyre/order";
@Autowired
private IBaseCarService baseCarService;
@Autowired
private IBizMaintenanceOrderService bizMaintenanceOrderService;
@RequiresPermissions("system:order:view")
@GetMapping()
public String order()
@ -77,13 +85,19 @@ public class BizMaintenanceOrderController extends BaseController
return util.exportExcel(list, "维保工单数据");
}
/**
*
*/
/**
*
*/
@RequiresPermissions("system:order:add")
@GetMapping("/add")
public String add()
{
public String add(ModelMap mmap) {
// 查询车辆数据
List<BaseCar> baseCarList = baseCarService.selectBaseCarList(new BaseCar());
mmap.put("baseCarList", baseCarList);
mmap.put("orderNo", orderNoCreate());
return prefix + "/add";
}
@ -142,4 +156,55 @@ public class BizMaintenanceOrderController extends BaseController
return AjaxResult.success(list);
}
/**
* PDA
* @param bizMaintenanceOrder
* @return
*/
@PostMapping("/PDAAddMaintenanceOrder")
@ResponseBody
public AjaxResult PDAAddMaintenanceOrder(@RequestBody BizMaintenanceOrder bizMaintenanceOrder)
{
String orderNo=orderNoCreate();
bizMaintenanceOrder.setOrderNo(orderNo);
return toAjax(bizMaintenanceOrderService.insertBizMaintenanceOrder(bizMaintenanceOrder));
}
/**
* PDA
* @param bizMaintenanceOrder
* @return
*/
@PostMapping("/PDASaveMaintenanceOrder")
@ResponseBody
public AjaxResult PDASaveMaintenanceOrder(@RequestBody BizMaintenanceOrder bizMaintenanceOrder)
{
bizMaintenanceOrder.setOrderNo(orderNoCreate());
return toAjax(bizMaintenanceOrderService.updateBizMaintenanceOrder(bizMaintenanceOrder));
}
private String orderNoCreate(){
// 查询当天的工单号(返回的是当天最新的一条记录)
BizMaintenanceOrder bizMaintenanceOrder = bizMaintenanceOrderService.selectBizMaintenanceOrderTD();
String orderNo;
String today = new java.text.SimpleDateFormat("yyyyMMdd").format(new java.util.Date());
if (bizMaintenanceOrder == null) {
// 当天没有工单从001开始
orderNo = today + "001";
} else {
// 获取已有订单号
String lastOrderNo = bizMaintenanceOrder.getOrderNo();
// 提取流水号部分(后三位)
String seqStr = lastOrderNo.substring(lastOrderNo.length() - 3);
int seq = Integer.parseInt(seqStr);
// 流水号+1
int newSeq = seq + 1;
// 格式化为三位数字不足三位前面补0
String newSeqStr = String.format("%03d", newSeq);
orderNo = today + newSeqStr;
}
return orderNo;
}
}

@ -118,12 +118,12 @@
<form id="signupForm" autocomplete="off">
<!-- 用户名 -->
<div class="form-group">
<input type="text" name="username" class="form-control uname" placeholder="请输入用户名" value="" />
<input type="text" name="username" class="form-control uname" placeholder="请输入用户名" value="admin" />
</div>
<!-- 密码 -->
<div class="form-group">
<input type="password" name="password" class="form-control pword" placeholder="请输入密码" value="" />
<input type="password" name="password" class="form-control pword" placeholder="请输入密码" value="haiwei@123" />
</div>
<!-- 验证码 (根据后端配置显示) -->

@ -19,12 +19,12 @@
<div class="col-sm-9">
<form id="formId">
<div class="select-list">
<li class="select-time">
<label>创建时间: </label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="birthday"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
</li>
<!-- <li class="select-time">-->
<!-- <label>创建时间: </label>-->
<!-- <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="birthday"/>-->
<!-- <span>-</span>-->
<!-- <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>-->
<!-- </li>-->
<!-- 2. 分公司下拉框 (新增) -->
<li>
<label>分公司: </label>
@ -218,7 +218,9 @@
var prefix = ctx + "tyre/tyre";
var datas = [[${@dict.getType('tyre_type')}]];
var shopData = {
'one': [], // 一分公司:空数组
'one': [
{ value: 'guangming', name: '一分公司修理厂' },
], // 一分公司:空数组
'three': [ // 三分公司:包含两个选项
{ value: 'guangming', name: '光明修理厂' },
{ value: 'shiyan', name: '石岩修理厂' }

@ -3,6 +3,8 @@
<head>
<th:block th:include="include :: header('新增维保工单')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: select2-css" />
<th:block th:include="include :: bootstrap-select-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
@ -11,23 +13,25 @@
<div class="form-group">
<label class="col-sm-3 control-label is-required">工单编号:</label>
<div class="col-sm-8">
<input name="orderNo" class="form-control" type="text" required>
<input name="orderNo" th:value="${orderNo}" class="form-control" type="text" required readonly>
</div>
</div>
</div>
<div class="col-xs-12">
<div class="form-group">
<label class="col-sm-3 control-label is-required">辆ID/轮胎ID</label>
<label class="col-sm-3 control-label is-required">牌号码</label>
<div class="col-sm-8">
<input name="vehicleId" class="form-control" type="text" required>
</div>
</div>
</div>
<div class="col-xs-12">
<div class="form-group">
<label class="col-sm-3 control-label">车牌号码:</label>
<div class="col-sm-8">
<input name="plateNumber" class="form-control" type="text">
<input name="vehicleId" id="vehicleId" type="hidden">
<select class="form-control" name="plateNumber" id="plateNumber" onchange="selectCarChange(this)" required>
<option value="">--请选择车牌号码--</option>
<!-- 3. 使用 th:each 遍历后端传来的 baseCarList -->
<!-- 4. th:value 绑定实际提交的值通常是车牌号或ID -->
<!-- 5. th:text 绑定页面显示的文本 -->
<option th:each="car : ${baseCarList}"
th:value="${car.carNo}"
th:text="${car.carNo}">
</option>
</select>
</div>
</div>
</div>
@ -36,86 +40,48 @@
<label class="col-sm-3 control-label is-required">维保类型:</label>
<div class="col-sm-8">
<select name="typeCode" class="form-control" th:with="type=${@dict.getType('main_type')}" required>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
<option th:each="dict : ${type}" th:if="${dict.dictValue == '1'} or ${dict.dictValue == '4'}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
</div>
<div class="col-xs-12">
<div class="form-group">
<label class="col-sm-3 control-label">维修站点/修理厂ID</label>
<label class="col-sm-3 control-label is-required">维修站点/修理厂:</label>
<div class="col-sm-8">
<input name="factoryId" class="form-control" type="text">
<div class="input-group">
<input type="hidden" name="factoryId" id="factoryId" value="" />
<input name="factoryName" onclick="selectDeptTree()" id="treeName" type="text" placeholder="请选择维修站点" class="form-control" required>
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div>
</div>
<!-- <div class="col-sm-8">-->
<!-- <input name="factoryId" onclick="selectDeptTree()" id="treeName" type="text" placeholder="请选择站点" class="form-control">-->
<!-- <span class="input-group-addon"><i class="fa fa-search"></i></span>-->
<!-- </div>-->
</div>
</div>
<div class="col-xs-12">
<div class="form-group">
<label class="col-sm-3 control-label">仪表盘录入里程:</label>
<div class="col-sm-8">
<input name="inputMileage" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-12">
<div class="form-group">
<label class="col-sm-3 control-label">上次维保里程:</label>
<div class="col-sm-8">
<input name="lastMileage" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-12">
<div class="form-group">
<label class="col-sm-3 control-label">保养日期:</label>
<label class="col-sm-3 control-label is-required">保养日期:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="maintainDate" class="form-control" placeholder="yyyy-MM-dd" type="text">
<input name="maintainDate" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
</div>
<div class="col-xs-12">
<div class="form-group">
<label class="col-sm-3 control-label">补充说明:</label>
<div class="col-sm-8">
<textarea name="description" class="form-control"></textarea>
</div>
</div>
</div>
<div class="col-xs-12">
<div class="form-group">
<label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8">
<select name="status" class="form-control" th:with="type=${@dict.getType('order_status')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
</div>
<div class="col-xs-12">
<div class="form-group">
<label class="col-sm-3 control-label">1代表汽车、2代表轮胎</label>
<div class="col-sm-8">
<input name="orderType" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-12">
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<textarea name="remark" class="form-control"></textarea>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-select-js" />
<script th:inline="javascript">
var prefix = ctx + "system/order"
var prefix = ctx + "tyre/order"
$("#form-order-add").validate({
focusCleanup: true
});
@ -131,6 +97,55 @@
minView: "month",
autoclose: true
});
/* 用户管理-新增-选择部门树 */
function selectDeptTree() {
var treeId = $("#treeId").val();
var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
var url = ctx + "system/user/selectDeptTree/" + deptId;
var btn = ['<i class="fa fa-check"></i> 确认', '<i class="fa fa-trash-o"></i> 清除', '<i class="fa fa-close"></i> 关闭'];
var options = {
title: '选择站点',
width: "380",
url: url,
btn: btn,
btn2: function(index, layero) {
$("#treeId").val("");
$("#treeName").val("");
$.modal.close(index);
},
callBack: doSubmit
};
$.modal.openOptions(options);
}
function doSubmit(index, layero){
var body = $.modal.getChildFrame(index);
// 1. 获取子页面传回来的 ID赋值给【隐藏域】(这是关键!)
var selectedId = body.find('#treeId').val();
$("#factoryId").val(selectedId); // 注意:这里 ID 赋值给 #factoryId
// 2. 获取子页面传回来的名称,赋值给【文本框】(这是展示)
var selectedName = body.find('#treeName').val();
$("#treeName").val(selectedName); // 这里名称赋值给 #treeName
$.modal.close(index);
}
function selectCarChange(obj) {
// 获取当前选中的 option 元素
var selectedOption = obj.options[obj.selectedIndex];
console.log(selectedOption);
// 获取 option 上定义的 data-id 属性值 (即 car.id)
var vehicleId = selectedOption.getAttribute('data-select2-id');
// 将 id 赋值给隐藏的 input 框
document.getElementById('vehicleId').value = vehicleId;
// 调试:控制台打印,确保获取到了
console.log("选中的车牌: " + obj.value);
console.log("选中的ID: " + vehicleId);
}
</script>
</body>
</html>

@ -23,6 +23,10 @@
</li>
<li>
<label>维修站点:</label>
<select name="typeCode" th:with="type=${@dict.getType('main_type')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:if="${dict.dictValue == '1'} or ${dict.dictValue == '4'}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
<input type="text" name="factoryId"/>
</li>
<!-- <li>-->
@ -36,6 +40,12 @@
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li class="select-time">
<label>保养日期: </label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
@ -47,11 +57,11 @@
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:order:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:order:edit">
<i class="fa fa-edit"></i> 修改
<i class="fa fa-plus"></i> 新增维保
</a>
<!-- <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:order:edit">-->
<!-- <i class="fa fa-edit"></i> 修改-->
<!-- </a>-->
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:order:remove">
<i class="fa fa-remove"></i> 删除
</a>
@ -92,10 +102,6 @@
field: 'orderNo',
title: '工单编号'
},
{
field: 'vehicleId',
title: '车辆ID/轮胎ID'
},
{
field: 'plateNumber',
title: '车牌号码'
@ -108,8 +114,8 @@
}
},
{
field: 'factoryId',
title: '维修站点/修理厂ID'
field: 'factoryName',
title: '维修站点'
},
{
field: 'inputMileage',
@ -134,20 +140,33 @@
return $.table.selectDictLabel(statusDatas, value);
}
},
{
field: 'orderType',
title: '1代表汽车、2代表轮胎'
},
{
field: 'remark',
title: '备注'
},
{
field: 'userName',
title: '创建人'
},
{
field: 'userName',
title: '创建时间'
},
{
field: 'updateName',
title: '维保人'
},
{
field: 'updateTime',
title: '维保时间'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.orderId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
// actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.orderId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}

@ -10,6 +10,10 @@ import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
import com.ruoyi.common.utils.StringUtils;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.concurrent.atomic.AtomicInteger;
/**
* spring 便springbean
*
@ -22,6 +26,11 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC
private static ConfigurableListableBeanFactory beanFactory;
private static ApplicationContext applicationContext;
// 1. 定义时间格式化器 (yyyy-MM-dd) -> 例如 20260416
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd");
// 2. 定义原子计数器 (线程安全,最大支持 9999)
private static final AtomicInteger counter = new AtomicInteger(1);
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
@ -156,4 +165,27 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC
return applicationContext.getEnvironment().getRequiredProperty(key);
}
/**
* yyyyMMdd + 4
* 202604160001
*/
public static synchronized String generateOrderNo() {
// 获取当前日期字符串
String dateStr = LocalDateTime.now().format(DATE_FORMATTER);
// 获取当前计数并自增
int seq = counter.getAndIncrement();
// 如果超过 9999重置为 1 (防止溢出实际业务中一天很难超过1万单除非用long)
if (seq > 9999) {
counter.set(1);
seq = 1;
}
// 格式化流水号为 4 位 (0001, 0002...)
String seqStr = String.format("%04d", seq);
return dateStr + seqStr;
}
}

@ -345,6 +345,8 @@ public class ShiroConfig
filterChainDefinitionMap.put("/system/package/checkUpdate", "anon,captchaValidate");
filterChainDefinitionMap.put("/common/downloadApk", "anon,captchaValidate");
filterChainDefinitionMap.put("/tyre/order/PDAGetMaintenanceOrder", "anon,captchaValidate");
filterChainDefinitionMap.put("/tyre/order/PDAAddMaintenanceOrder", "anon,captchaValidate");
filterChainDefinitionMap.put("/tyre/order/PDASaveMaintenanceOrder", "anon,captchaValidate");
// 系统权限列表
// filterChainDefinitionMap.putAll(SpringUtils.getBean(IMenuService.class).selectPermsAll());

@ -38,9 +38,12 @@ public class BizMaintenanceOrder extends BaseEntity
private String typeCode;
/** 维修站点/修理厂ID */
@Excel(name = "维修站点/修理厂ID")
//@Excel(name = "维修站点/修理厂ID")
private Long factoryId;
@Excel(name = "维修站点")
private String factoryName;
/** 仪表盘录入里程(截图中的必填项) */
@Excel(name = "仪表盘录入里程", readConverterExp = "截=图中的必填项")
private BigDecimal inputMileage;
@ -63,9 +66,53 @@ public class BizMaintenanceOrder extends BaseEntity
private String status;
/** 1代表汽车、2代表轮胎 */
@Excel(name = "1代表汽车、2代表轮胎")
// @Excel(name = "1代表汽车、2代表轮胎")
private String orderType;
@Excel(name = "创建人")
private String userName;
@Excel(name = "维保人")
private String updateName;
@Excel(name = "维保时间")
private Date updateTime;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUpdateName() {
return updateName;
}
public void setUpdateName(String updateName) {
this.updateName = updateName;
}
@Override
public Date getUpdateTime() {
return updateTime;
}
@Override
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getFactoryName() {
return factoryName;
}
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
public void setOrderId(Long orderId)
{
this.orderId = orderId;

@ -61,4 +61,6 @@ public interface BizMaintenanceOrderMapper
* @return
*/
public int deleteBizMaintenanceOrderByOrderIds(String[] orderIds);
BizMaintenanceOrder selectBizMaintenanceOrderTD();
}

@ -60,4 +60,7 @@ public interface IBizMaintenanceOrderService
public int deleteBizMaintenanceOrderByOrderId(Long orderId);
List<BizMaintenanceOrder> selectBizMaintenanceOrderListTwo(BizMaintenanceOrder bizMaintenanceOrder);
BizMaintenanceOrder selectBizMaintenanceOrderTD();
}

@ -1,7 +1,10 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.BizMaintenanceOrderMapper;
@ -9,6 +12,8 @@ import com.ruoyi.system.domain.BizMaintenanceOrder;
import com.ruoyi.system.service.IBizMaintenanceOrderService;
import com.ruoyi.common.core.text.Convert;
import static com.ruoyi.common.utils.ShiroUtils.getLoginName;
/**
* Service
*
@ -55,6 +60,7 @@ public class BizMaintenanceOrderServiceImpl implements IBizMaintenanceOrderServi
public int insertBizMaintenanceOrder(BizMaintenanceOrder bizMaintenanceOrder)
{
bizMaintenanceOrder.setCreateTime(DateUtils.getNowDate());
bizMaintenanceOrder.setCreateBy(getLoginName());
return bizMaintenanceOrderMapper.insertBizMaintenanceOrder(bizMaintenanceOrder);
}
@ -68,6 +74,7 @@ public class BizMaintenanceOrderServiceImpl implements IBizMaintenanceOrderServi
public int updateBizMaintenanceOrder(BizMaintenanceOrder bizMaintenanceOrder)
{
bizMaintenanceOrder.setUpdateTime(DateUtils.getNowDate());
bizMaintenanceOrder.setStatus("COMPLETED");
return bizMaintenanceOrderMapper.updateBizMaintenanceOrder(bizMaintenanceOrder);
}
@ -96,7 +103,13 @@ public class BizMaintenanceOrderServiceImpl implements IBizMaintenanceOrderServi
}
@Override
@DataScope(deptAlias = "d", userAlias = "u")
public List<BizMaintenanceOrder> selectBizMaintenanceOrderListTwo(BizMaintenanceOrder bizMaintenanceOrder) {
return bizMaintenanceOrderMapper.selectBizMaintenanceOrderListTwo(bizMaintenanceOrder);
}
@Override
public BizMaintenanceOrder selectBizMaintenanceOrderTD() {
return bizMaintenanceOrderMapper.selectBizMaintenanceOrderTD();
}
}

@ -62,7 +62,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT COUNT(*) FROM `base_car`
</select>
<select id="querytotal" resultType="java.util.Map">
SELECT
COUNT(bi.id) AS total,
COUNT(CASE WHEN bt.tyre_type IN ('全新胎', 'new') THEN 1 END) AS new,

@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="plateNumber" column="plate_number" />
<result property="typeCode" column="type_code" />
<result property="factoryId" column="factory_id" />
<result property="factoryName" column="factoryName" />
<result property="inputMileage" column="input_mileage" />
<result property="lastMileage" column="last_mileage" />
<result property="maintainDate" column="maintain_date" />
@ -20,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="userName" column="user_name" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
@ -42,12 +44,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
<if test="params.beginTime != null and params.beginTime != ''">
and date_format(maintain_date,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''">
and date_format(maintain_date,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if>
</where>
</select>
<select id="selectBizMaintenanceOrderListTwo" parameterType="BizMaintenanceOrder" resultMap="BizMaintenanceOrderResult">
<include refid="selectBizMaintenanceOrderVo"/>
select order_id, order_no, vehicle_id, plate_number, type_code, factory_id, d.dept_name as factoryName, input_mileage, last_mileage, maintain_date, description, bmo.status, order_type,
bmo.create_by,su.user_name, bmo.create_time, bmo.update_by, bmo.update_time, bmo.remark
from biz_maintenance_order bmo
left join sys_user su ON su.login_name = bmo.create_by
left join sys_dept d on bmo.factory_id = d.dept_id
<where>
<if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
<if test="vehicleId != null "> and vehicle_id = #{vehicleId}</if>
@ -59,8 +70,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="lastMileage != null "> and last_mileage = #{lastMileage}</if>
<if test="maintainDate != null "> and maintain_date = #{maintainDate}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="status != null and status != ''"> and bmo.status = #{status}</if>
<if test="orderType != null and orderType != ''"> and order_type = #{orderType}</if>
<if test="params.beginTime != null and params.beginTime != ''">
and date_format(maintain_date,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''">
and date_format(maintain_date,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
</if>
${params.dataScope}
</where>
</select>
@ -68,6 +86,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectBizMaintenanceOrderVo"/>
where order_id = #{orderId}
</select>
<select id="selectBizMaintenanceOrderTD" resultMap="BizMaintenanceOrderResult">
SELECT
MAX(order_no) as order_no
FROM
biz_maintenance_order
WHERE
DATE(create_time) = CURDATE();
</select>
<insert id="insertBizMaintenanceOrder" parameterType="BizMaintenanceOrder" useGeneratedKeys="true" keyProperty="orderId">
insert into biz_maintenance_order

Loading…
Cancel
Save