Merge branch 'master' of http://git.unissense.tech/mula/unis_sip
commit
c8def41c4a
|
@ -1,4 +1,5 @@
|
|||
ruoyi:
|
||||
demoEnabled: false
|
||||
excelTemplate: /home/application/excelTemplate
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为80
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
</div>
|
||||
<a th:href="@{/index}">
|
||||
<li class="logo hidden-xs">
|
||||
<span class="logo-lg">RuoYi</span>
|
||||
<span class="logo-lg">SIP</span>
|
||||
</li>
|
||||
</a>
|
||||
<div class="sidebar-collapse">
|
||||
|
|
|
@ -388,20 +388,19 @@
|
|||
|
||||
function downloadTem() {
|
||||
var xhr = new XMLHttpRequest(); // 创建XMLHttpRequest对象
|
||||
xhr.open('post', prefix + '/list/export', true); // 设置请求类型和URL
|
||||
// 当请求完成时执行的回调函数
|
||||
$.modal.loading("正在下载,请稍候...");
|
||||
xhr.onload = function (data) {
|
||||
const url = window.URL.createObjectURL(data.currentTarget.response)
|
||||
const a=document.createElement('a')
|
||||
a.href= url
|
||||
a.download='合同清单模板.xlsx'
|
||||
document.append(a)
|
||||
a.click()
|
||||
a.remove()
|
||||
$.modal.closeLoading();
|
||||
}
|
||||
xhr.send();
|
||||
window.location.href =prefix + "/list/export"
|
||||
$.modal.closeLoading();
|
||||
// $.post(prefix + "/list/export", {}, function (result) {
|
||||
// if (result.code == web_status.SUCCESS) {
|
||||
// window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
|
||||
// } else if (result.code == web_status.WARNING) {
|
||||
// $.modal.alertWarning(result.msg)
|
||||
// } else {
|
||||
// $.modal.alertError(result.msg);
|
||||
// }
|
||||
// $.modal.closeLoading();
|
||||
// })
|
||||
|
||||
}
|
||||
|
||||
document.getElementById('uploadInput').addEventListener('change', function (event) {
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label is-required">客户编码:</label>
|
||||
<label class="col-sm-4 control-label is-required">客户名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input name="customerName" th:field="*{customerName}" class="form-control" type="text"
|
||||
|
@ -117,7 +117,7 @@
|
|||
</div>
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label is-required">客户名称:</label>
|
||||
<label class="col-sm-4 control-label is-required">客户编码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input readonly name="customerCode" th:field="*{customerCode}" class="form-control" type="text"
|
||||
required >
|
||||
|
@ -234,7 +234,7 @@
|
|||
width: "680",
|
||||
url: url,
|
||||
height:'600',
|
||||
|
||||
|
||||
callBack: doSubmitPartner
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
|
@ -324,21 +324,19 @@
|
|||
});
|
||||
|
||||
function downloadTem() {
|
||||
var xhr = new XMLHttpRequest(); // 创建XMLHttpRequest对象
|
||||
xhr.open('post', prefix + '/list/export', true); // 设置请求类型和URL
|
||||
// 当请求完成时执行的回调函数
|
||||
$.modal.loading("正在下载,请稍候...");
|
||||
xhr.onload = function (data) {
|
||||
const url = window.URL.createObjectURL(data.currentTarget.response)
|
||||
const a=document.createElement('a')
|
||||
a.href= url
|
||||
a.download='合同清单模板.xlsx'
|
||||
document.append(a)
|
||||
a.click()
|
||||
a.remove()
|
||||
$.modal.closeLoading();
|
||||
}
|
||||
xhr.send();
|
||||
window.location.href=prefix + "/list/export"
|
||||
$.modal.closeLoading();
|
||||
// $.post(prefix + "/list/export", {}, function (result) {
|
||||
// if (result.code == web_status.SUCCESS) {
|
||||
// window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
|
||||
// } else if (result.code == web_status.WARNING) {
|
||||
// $.modal.alertWarning(result.msg)
|
||||
// } else {
|
||||
// $.modal.alertError(result.msg);
|
||||
// }
|
||||
// $.modal.closeLoading();
|
||||
// })
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -209,11 +209,11 @@
|
|||
str=``
|
||||
res.data.forEach((ele)=>{
|
||||
str+=`<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>${ele.startDate}</td>
|
||||
<td>${ele.endDate}</td>
|
||||
<td>${ele.status == 0 ? '有效' : '无效'}</td>
|
||||
<td>${ele.serviceLevel}</td>
|
||||
<td>${ele.serviceDescribe}</td>
|
||||
<td>${ele.serviceStartTime}</td>
|
||||
<td>${ele.serviceEndTime}</td>
|
||||
<td>有效</td>
|
||||
</tr>`
|
||||
})
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ public class OrderInfoController extends BaseController
|
|||
}
|
||||
@RequiresPermissions("sip:list:export")
|
||||
@Log(title = "发货清单", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/list/export")
|
||||
@GetMapping("/list/export")
|
||||
public void listExport(HttpServletRequest request, HttpServletResponse response) {
|
||||
try
|
||||
{
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
package com.ruoyi.sip.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
|
||||
|
||||
/**
|
||||
* 代码生成业务表(CodeGenTable)实体类
|
||||
*
|
||||
* @author ch
|
||||
* @since 2025-05-21 14:39:07
|
||||
*/
|
||||
@Data
|
||||
public class CodeGenTable {
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
|
||||
private Long id;
|
||||
/**
|
||||
* 表名称
|
||||
*/
|
||||
|
||||
private String tableName;
|
||||
/**
|
||||
* 表描述
|
||||
*/
|
||||
|
||||
private String tableComment;
|
||||
/**
|
||||
* code前缀
|
||||
*/
|
||||
|
||||
private String prefix;
|
||||
/**
|
||||
* 流水号
|
||||
*/
|
||||
|
||||
private Integer number;
|
||||
/**
|
||||
* code生成日期
|
||||
*/
|
||||
|
||||
private Date genDate;
|
||||
private String dateFormat;
|
||||
/**
|
||||
* 流水号长度
|
||||
*/
|
||||
|
||||
private Integer numberLength;
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
|
||||
private String createBy;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
|
||||
private String updateBy;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
||||
private String remark;
|
||||
private Long version;
|
||||
|
||||
@Getter
|
||||
public enum TableNameEnum{
|
||||
ORDER_DELIVERY("order_delivery", "发货记录"),
|
||||
;
|
||||
private final String name;
|
||||
private final String desc;
|
||||
TableNameEnum(String type, String desc) {
|
||||
this.name = type;
|
||||
this.desc = desc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -75,5 +75,6 @@ public class OrderDelivery extends BaseEntity
|
|||
/** 删除时间 */
|
||||
private Date deletedAt;
|
||||
private String total;
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
|
|
@ -28,5 +28,6 @@ public class ApiDataQueryDto {
|
|||
@NotNull(message = "查询结束时间不能为空")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date queryEndTime;
|
||||
private String serialNumber;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package com.ruoyi.sip.mapper;
|
||||
|
||||
import com.ruoyi.sip.domain.CodeGenTable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author ch
|
||||
* @Desc 代码生成业务表(CodeGenTable)表数据库访问层
|
||||
* @Date 2025-05-21 14:39:07
|
||||
*/
|
||||
public interface CodeGenTableMapper {
|
||||
|
||||
/**
|
||||
* 通过实体作为筛选条件查询
|
||||
*
|
||||
* @param codeGenTable 实例对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
List<CodeGenTable> queryAll(CodeGenTable codeGenTable);
|
||||
|
||||
/**
|
||||
* 根据ID查详情
|
||||
*/
|
||||
CodeGenTable queryById(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*/
|
||||
int insert(CodeGenTable codeGenTable);
|
||||
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*/
|
||||
int update(CodeGenTable codeGenTable);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*/
|
||||
int deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 通过id批量删除代码生成业务表
|
||||
*/
|
||||
int batchRemove(Long[] ids);
|
||||
|
||||
CodeGenTable selectByTableName(String tableName);
|
||||
|
||||
int updateNumber(CodeGenTable codeGeneratorConfig);
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.sip.mapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.ruoyi.sip.domain.OrderDelivery;
|
||||
|
||||
|
@ -58,4 +59,6 @@ public interface OrderDeliveryMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteOrderDeliveryByIds(String[] ids);
|
||||
|
||||
int count(OrderDelivery orderDelivery);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
package com.ruoyi.sip.service;
|
||||
|
||||
import com.ruoyi.sip.domain.CodeGenTable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author ch
|
||||
* @Desc 代码生成业务表(CodeGenTable)表服务接口
|
||||
* @Date 2025-05-21 14:39:07
|
||||
*/
|
||||
public interface ICodeGenTableService {
|
||||
|
||||
/**
|
||||
* 通过实体作为筛选条件查询
|
||||
*/
|
||||
List<CodeGenTable> queryAll(CodeGenTable codeGenTable);
|
||||
|
||||
|
||||
/**
|
||||
* 根据ID查详情
|
||||
*/
|
||||
CodeGenTable queryById(Long id);
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*/
|
||||
int insert(CodeGenTable codeGenTable);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*/
|
||||
int update(CodeGenTable codeGenTable);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
*/
|
||||
int deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 通过id批量删除代码生成业务表
|
||||
*/
|
||||
int batchRemove(Long[] ids);
|
||||
|
||||
String generateCode(String tableName);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2,9 +2,10 @@ package com.ruoyi.sip.service;
|
|||
|
||||
import com.ruoyi.sip.domain.MaintenanceRecord;
|
||||
import com.ruoyi.sip.domain.MaintenanceRecordsDto;
|
||||
import com.ruoyi.sip.vo.DeliveryInfoVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IMaintenanceService {
|
||||
List<MaintenanceRecord> query(MaintenanceRecordsDto dto);
|
||||
List<DeliveryInfoVo.ServiceInfo> query(MaintenanceRecordsDto dto);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
package com.ruoyi.sip.service.impl;
|
||||
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.sip.domain.CodeGenTable;
|
||||
import com.ruoyi.sip.mapper.CodeGenTableMapper;
|
||||
import com.ruoyi.sip.service.ICodeGenTableService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author ch
|
||||
* @Desc 代码生成业务表(CodeGenTable)表服务实现类
|
||||
* @Date 2025-05-21 14:39:08
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class CodeGenTableServiceImpl implements ICodeGenTableService {
|
||||
|
||||
@Resource
|
||||
private CodeGenTableMapper codeGenTableMapper;
|
||||
public static final String DELIMIT = "-";
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*
|
||||
* @param codeGenTable 实例对象
|
||||
* @return 对象列表
|
||||
*/
|
||||
@Override
|
||||
public List<CodeGenTable> queryAll(CodeGenTable codeGenTable) {
|
||||
List<CodeGenTable> dataList = codeGenTableMapper.queryAll(codeGenTable);
|
||||
return dataList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodeGenTable queryById(Long id) {
|
||||
return codeGenTableMapper.queryById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int insert(CodeGenTable codeGenTable) {
|
||||
return codeGenTableMapper.insert(codeGenTable);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int update(CodeGenTable codeGenTable) {
|
||||
return codeGenTableMapper.update(codeGenTable);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int deleteById(Long id) {
|
||||
return codeGenTableMapper.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id批量删除代码生成业务表
|
||||
*/
|
||||
@Override
|
||||
public int batchRemove(Long[] ids) {
|
||||
return codeGenTableMapper.batchRemove(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateCode(String tableName) {
|
||||
CodeGenTable codeGeneratorConfig = codeGenTableMapper.selectByTableName(tableName);
|
||||
|
||||
if (codeGeneratorConfig == null) {
|
||||
throw new ServiceException(StringUtils.format("未找到[{}]对应编码生成规则", tableName));
|
||||
}
|
||||
|
||||
// 根据表字段动态获取生成规则
|
||||
String prefix = codeGeneratorConfig.getPrefix();
|
||||
int numberLength = codeGeneratorConfig.getNumberLength();
|
||||
|
||||
|
||||
CodeGenTable updateDto = new CodeGenTable();
|
||||
updateDto.setTableName(tableName);
|
||||
updateDto.setVersion(codeGeneratorConfig.getVersion());
|
||||
|
||||
if (!DateUtils.isSameDay(codeGeneratorConfig.getGenDate(), DateUtils.getNowDate())) {
|
||||
updateDto.setNumber(0);
|
||||
updateDto.setGenDate(DateUtils.getNowDate());
|
||||
} else {
|
||||
updateDto.setNumber(codeGeneratorConfig.getNumber());
|
||||
}
|
||||
String datePart = DateUtils.parseDateToStr(codeGeneratorConfig.getDateFormat(), DateUtils.getNowDate());
|
||||
// 使用乐观锁机制更新 number
|
||||
int currentSequence = updateDto.getNumber();
|
||||
String sequenceStr = String.format("%0" + numberLength + "d", currentSequence);
|
||||
|
||||
// 构造唯一 code
|
||||
String generatedCode = prefix + DELIMIT + datePart + DELIMIT + sequenceStr;
|
||||
|
||||
// 更新数据库中的 number 字段,确保并发安全性
|
||||
int updatedRows = codeGenTableMapper.updateNumber(updateDto);
|
||||
if (updatedRows == 0) {
|
||||
throw new ServiceException("系统繁忙,请重试");
|
||||
}
|
||||
|
||||
return generatedCode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,14 +1,20 @@
|
|||
package com.ruoyi.sip.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.ruoyi.sip.domain.MaintenanceRecord;
|
||||
import com.ruoyi.sip.domain.MaintenanceRecordsDto;
|
||||
import com.ruoyi.sip.dto.ApiDataQueryDto;
|
||||
import com.ruoyi.sip.mapper.MaintenanceMapper;
|
||||
import com.ruoyi.sip.service.IDeliveryListService;
|
||||
import com.ruoyi.sip.service.IMaintenanceService;
|
||||
import com.ruoyi.sip.vo.DeliveryInfoVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -30,10 +36,19 @@ public class MaintenanceServiceImpl implements IMaintenanceService {
|
|||
|
||||
@Resource
|
||||
private MaintenanceMapper mapper;
|
||||
@Autowired
|
||||
private IDeliveryListService deliveryListService;
|
||||
|
||||
|
||||
@Override
|
||||
public List<MaintenanceRecord> query(MaintenanceRecordsDto dto) {
|
||||
return mapper.query(dto);
|
||||
public List<DeliveryInfoVo.ServiceInfo> query(MaintenanceRecordsDto dto) {
|
||||
|
||||
ApiDataQueryDto apiDataQueryDto = new ApiDataQueryDto();
|
||||
apiDataQueryDto.setSerialNumber(dto.getSerialNumber());
|
||||
List<DeliveryInfoVo> numberInfo = deliveryListService.getNumberInfo(apiDataQueryDto);
|
||||
if (CollUtil.isEmpty(numberInfo)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return numberInfo.get(0).getServiceInfo();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
package com.ruoyi.sip.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.sip.domain.CodeGenTable;
|
||||
import com.ruoyi.sip.service.ICodeGenTableService;
|
||||
import com.ruoyi.sip.utils.CodeGeneratorUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.sip.mapper.OrderDeliveryMapper;
|
||||
|
@ -20,6 +25,8 @@ public class OrderDeliveryServiceImpl implements IOrderDeliveryService
|
|||
@Autowired
|
||||
private OrderDeliveryMapper orderDeliveryMapper;
|
||||
|
||||
@Autowired
|
||||
private ICodeGenTableService codeGenTableService;
|
||||
/**
|
||||
* 查询发货记录
|
||||
*
|
||||
|
@ -53,6 +60,9 @@ public class OrderDeliveryServiceImpl implements IOrderDeliveryService
|
|||
@Override
|
||||
public int insertOrderDelivery(OrderDelivery orderDelivery)
|
||||
{
|
||||
|
||||
String deliveryCode =codeGenTableService.generateCode(CodeGenTable.TableNameEnum.ORDER_DELIVERY.getName());
|
||||
orderDelivery.setDeliveryCode(deliveryCode);
|
||||
return orderDeliveryMapper.insertOrderDelivery(orderDelivery);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
package com.ruoyi.sip.utils;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.function.IntSupplier;
|
||||
|
||||
/**
|
||||
* @author : ch
|
||||
* @version : 1.0
|
||||
* @ClassName : CodeGeneratorUtil
|
||||
* @Description :
|
||||
* @DATE : Created in 9:55 2025/5/21
|
||||
* <pre> Copyright: Copyright(c) 2025 </pre>
|
||||
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||
* Modification History:
|
||||
* Date Author Version Discription
|
||||
* --------------------------------------------------------------------------
|
||||
* 2025/05/21 ch 1.0 Why & What is modified: <修改原因描述> *
|
||||
*/
|
||||
public class CodeGeneratorUtil {
|
||||
|
||||
private static final String DELIMITER = "-";
|
||||
private static final Map<String, AtomicLong> SEQUENCE_MAP = new ConcurrentHashMap<>();
|
||||
private static final Map<String, String> DATE_MAP = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 生成唯一编码
|
||||
*
|
||||
* @param prefix 编码前缀
|
||||
* @param defaultValueSupplier 函数式接口,返回默认值
|
||||
* @return 唯一编码
|
||||
*/
|
||||
public static String generateUniqueCode(String prefix, IntSupplier defaultValueSupplier) {
|
||||
// 获取当前日期(yyyyMMdd格式)
|
||||
String currentDate = DateUtils.dateTime();
|
||||
if (!DATE_MAP.containsKey(currentDate)) {
|
||||
DATE_MAP.clear();
|
||||
SEQUENCE_MAP.clear();
|
||||
DATE_MAP.put(currentDate, currentDate);
|
||||
}
|
||||
// 获取当前流水号并递增
|
||||
AtomicLong sequence = SEQUENCE_MAP.computeIfAbsent(prefix, k -> {
|
||||
if (CollUtil.isEmpty(SEQUENCE_MAP)) {
|
||||
return new AtomicLong(defaultValueSupplier.getAsInt());
|
||||
} else {
|
||||
return new AtomicLong(0);
|
||||
}
|
||||
});
|
||||
long currentSequence = sequence.incrementAndGet();
|
||||
// 生成编码
|
||||
return prefix + DELIMITER + currentDate + DELIMITER + String.format("%04d", currentSequence);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,245 @@
|
|||
<?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="com.ruoyi.sip.mapper.CodeGenTableMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.sip.domain.CodeGenTable" id="CodeGenTableMap">
|
||||
<result property="id" column="id"/>
|
||||
<result property="tableName" column="table_name"/>
|
||||
<result property="tableComment" column="table_comment"/>
|
||||
<result property="prefix" column="prefix"/>
|
||||
<result property="number" column="number"/>
|
||||
<result property="genDate" column="gen_date"/>
|
||||
<result property="numberLength" column="number_length"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="version" column="version"/>
|
||||
<result property="dateFormat" column="date_format"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 基本字段 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, table_name, table_comment, prefix, number, gen_date, number_length, create_by, create_time, update_by, update_time, remark,version,date_format
|
||||
</sql>
|
||||
|
||||
<!--通过实体作为筛选条件查询-->
|
||||
<select id="queryAll" resultMap="CodeGenTableMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from code_gen_table
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="tableName != null and tableName != ''">
|
||||
and table_name = #{tableName}
|
||||
</if>
|
||||
<if test="tableComment != null and tableComment != ''">
|
||||
and table_comment = #{tableComment}
|
||||
</if>
|
||||
<if test="prefix != null and prefix != ''">
|
||||
and prefix = #{prefix}
|
||||
</if>
|
||||
<if test="number != null">
|
||||
and number = #{number}
|
||||
</if>
|
||||
<if test="genDate != null">
|
||||
and gen_date = #{genDate}
|
||||
</if>
|
||||
<if test="numberLength != null">
|
||||
and number_length = #{numberLength}
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
and create_by = #{createBy}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
and update_by = #{updateBy}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
and remark = #{remark}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<!--根据ID查详情-->
|
||||
<select id="queryById" parameterType="Integer" resultMap="CodeGenTableMap">
|
||||
SELECT id,
|
||||
table_name,
|
||||
table_comment,
|
||||
prefix,
|
||||
number,
|
||||
gen_date,
|
||||
number_length,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
remark,
|
||||
version,
|
||||
date_format
|
||||
FROM code_gen_table
|
||||
WHERE id = #{id}
|
||||
LIMIT 1
|
||||
</select>
|
||||
<select id="selectByTableName" resultType="com.ruoyi.sip.domain.CodeGenTable">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from code_gen_table where table_name=#{tableName}
|
||||
</select>
|
||||
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
INSERT INTO code_gen_table
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="tableName != null and tableName != ''">
|
||||
table_name,
|
||||
</if>
|
||||
<if test="tableComment != null and tableComment != ''">
|
||||
table_comment,
|
||||
</if>
|
||||
<if test="prefix != null and prefix != ''">
|
||||
prefix,
|
||||
</if>
|
||||
<if test="number != null">
|
||||
number,
|
||||
</if>
|
||||
<if test="genDate != null">
|
||||
gen_date,
|
||||
</if>
|
||||
<if test="numberLength != null">
|
||||
number_length,
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
update_by,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
remark,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="tableName != null and tableName != ''">
|
||||
#{tableName},
|
||||
</if>
|
||||
<if test="tableComment != null and tableComment != ''">
|
||||
#{tableComment},
|
||||
</if>
|
||||
<if test="prefix != null and prefix != ''">
|
||||
#{prefix},
|
||||
</if>
|
||||
<if test="number != null">
|
||||
#{number},
|
||||
</if>
|
||||
<if test="genDate != null">
|
||||
#{genDate},
|
||||
</if>
|
||||
<if test="numberLength != null">
|
||||
#{numberLength},
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
#{remark},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
UPDATE code_gen_table
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
version=version+1
|
||||
<if test="tableName != null and tableName != ''">
|
||||
table_name = #{tableName},
|
||||
</if>
|
||||
<if test="tableComment != null and tableComment != ''">
|
||||
table_comment = #{tableComment},
|
||||
</if>
|
||||
<if test="prefix != null and prefix != ''">
|
||||
prefix = #{prefix},
|
||||
</if>
|
||||
<if test="number != null">
|
||||
number = #{number},
|
||||
</if>
|
||||
<if test="genDate != null">
|
||||
gen_date = #{genDate},
|
||||
</if>
|
||||
<if test="numberLength != null">
|
||||
number_length = #{numberLength},
|
||||
</if>
|
||||
<if test="createBy != null and createBy != ''">
|
||||
create_by = #{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null and updateBy != ''">
|
||||
update_by = #{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
remark = #{remark},
|
||||
</if>
|
||||
</trim>
|
||||
WHERE id = #{id} and version=#{version}
|
||||
</update>
|
||||
<update id="updateNumber">
|
||||
update code_gen_table
|
||||
set number=#{number} + 1,
|
||||
version=version + 1
|
||||
<if test="genDate != null">
|
||||
,gen_date = #{genDate}
|
||||
</if>
|
||||
where table_name = #{tableName}
|
||||
and version = #{version}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
DELETE
|
||||
FROM code_gen_table
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!--通过id批量删除-->
|
||||
<delete id="batchRemove">
|
||||
delete from code_gen_table where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
|
|
@ -79,6 +79,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and t1.updated_at <![CDATA[ <= ]]> #{queryEndTime}
|
||||
</when>
|
||||
</choose>
|
||||
<if test="serialNumber!=null and serialNumber!=''">
|
||||
and t1.serial_number = #{serialNumber}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
|
@ -50,6 +50,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectOrderDeliveryVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="count" resultType="java.lang.Integer">
|
||||
select count(1) from order_delivery
|
||||
<where>
|
||||
<if test="status != null "> and tatus = #{status}</if>
|
||||
<if test="orderId != null "> and order_id = #{orderId}</if>
|
||||
<if test="deliveryCode != null and deliveryCode != ''"> and delivery_code like concat('%', #{deliveryCode}, '%')</if>
|
||||
<if test="deliveryDate != null "> and delivery_date = #{deliveryDate}</if>
|
||||
<if test="deliveryType != null and deliveryType != ''"> and delivery_type = #{deliveryType}</if>
|
||||
<if test="logisticsCompany != null and logisticsCompany != ''"> and logistics_company = #{logisticsCompany}</if>
|
||||
<if test="deliveryStatus != null and deliveryStatus != ''"> and delivery_status = #{deliveryStatus}</if>
|
||||
<if test="createdAt != null "> and created_at between date_format(#{createdAt}, '%Y-%m-%d 00:00:00') and date_format(#{createdAt}, '%Y-%m-%d 23:59:59')</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertOrderDelivery" parameterType="OrderDelivery" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into order_delivery
|
||||
|
|
Loading…
Reference in New Issue