1.添加下载记录相关接口和记录逻辑

master
x_z 3 years ago
parent 73ab68db0b
commit 33f38638fc

@ -128,4 +128,13 @@ public class ConstantStatus {
public static final String SYNC_BASIC_DATA = "AutoUploadAllData";
public static final String SYNC_BUS_TYPE = "AutoUploadBusType";
public static final String SYNC_SCAN_ORDER = "AutoUploadOrder";
//自动下载所有数据
public static final String SYNC_DOWNLOAD_BASIC_DATA = "AutoDownloadAllData";
//自动下载单据数据
public static final String SYNC_DOWNLOAD_BUS_TYPE = "AutoDownloadBusType";
//自动下载单据数据
public static final String SYNC_DOWNLOAD_SCAN_ORDER = "AutoDownloadOrder";
//自动下载DI数据
public static final String SYNC_DOWNLOAD_DI = "AutoDownloadDI";
}

@ -0,0 +1,82 @@
package com.glxp.api.admin.controller.basic;
import com.github.pagehelper.PageInfo;
import com.glxp.api.admin.entity.basic.BasicDownloadStatusEntity;
import com.glxp.api.admin.httpclient.SpGetHttpClient;
import com.glxp.api.admin.req.basic.BasicDownloadRequest;
import com.glxp.api.admin.req.info.DeleteRequest;
import com.glxp.api.admin.res.PageSimpleResponse;
import com.glxp.api.admin.service.basic.BasicDownloadService;
import com.glxp.api.admin.util.RedisUtil;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Slf4j
@RestController
public class SpsSyncDownloadController {
@Resource
BasicDownloadService basicDownloadService;
@Resource
RedisUtil redisUtil;
@Resource
SpGetHttpClient spGetHttp;
@GetMapping("/spssync/download/basic/udiinfo/getStatus")
public BaseResponse getStatus(BasicDownloadRequest basicDownloadRequest) {
List<BasicDownloadStatusEntity> basicDownloadStatusEntities = basicDownloadService.filterDownloadStatus(basicDownloadRequest);
return ResultVOUtils.success(basicDownloadStatusEntities);
}
@GetMapping("/spssync/download/basic/udiinfo/filter")
public BaseResponse filterStatus(BasicDownloadRequest basicDownloadRequest) {
List<BasicDownloadStatusEntity> basicDownloadStatusEntities = basicDownloadService.filterDownloadStatus(basicDownloadRequest);
PageInfo<BasicDownloadStatusEntity> pageInfo;
pageInfo = new PageInfo<>(basicDownloadStatusEntities);
PageSimpleResponse<BasicDownloadStatusEntity> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(basicDownloadStatusEntities);
return ResultVOUtils.success(pageSimpleResponse);
}
@PostMapping("/spssync/download/basic/udiinfo/deleteByStatus")
public BaseResponse deleteByStatus(@RequestBody DeleteRequest deleteRequest) {
boolean b = basicDownloadService.deleteById(deleteRequest.getId());
redisUtil.del(deleteRequest.getId());
if (b)
return ResultVOUtils.success("删除成功!");
else
return ResultVOUtils.error(500, "删除失败!");
}
@PostMapping("/spssync/download/basic/udiinfo/updateStatus")
public BaseResponse updateStatus(@RequestBody BasicDownloadStatusEntity basicDownloadStatusEntity) {
basicDownloadStatusEntity.setEndTime(new Date());
basicDownloadStatusEntity.setUpdateTime(new Date());
boolean b = basicDownloadService.updateDownloadStatus(basicDownloadStatusEntity);
if (b)
return ResultVOUtils.success("更新成功!");
else
return ResultVOUtils.error(500, "更新成功!");
}
@GetMapping("/spssync/download/basic/connect/test")
public BaseResponse testConnect() {
return spGetHttp.testConnect();
}
}

@ -0,0 +1,23 @@
package com.glxp.api.admin.dao.basic;
import com.glxp.api.admin.entity.basic.BasicDownloadStatusEntity;
import com.glxp.api.admin.req.basic.BasicDownloadRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface BasicDownloadDao {
List<BasicDownloadStatusEntity> filterDownloadStatus(BasicDownloadRequest basicDownloadRequest);
boolean insertDownloadStatus(BasicDownloadStatusEntity basicDownloadStatusEntity);
boolean deleteById(@Param("id") String id);
boolean updateDownloadStatus(BasicDownloadStatusEntity basicDownloadStatusEntity);
}

@ -0,0 +1,15 @@
package com.glxp.api.admin.req.basic;
import com.glxp.api.admin.req.ListPageRequest;
import lombok.Data;
@Data
public class BasicDownloadRequest extends ListPageRequest {
private String id;
private Integer status;
private Integer type;
private String idDatas;
private Integer scheduleType;
public Integer createType;
private String syncTime;
}

@ -9,6 +9,8 @@ import java.util.List;
@Data
public class SpSyncUdiResponse {
//同步任务ID
private String taskId;
List<ProductInfoEntity> productInfoEntityList;
List<UdiCompanyEntity> udiCompanyEntities;
}

@ -8,6 +8,8 @@ import java.util.List;
@Data
public class SpsSyncBusResponse {
//同步任务ID
private String taskId;
private List<BussinessTypeEntity> bussinessTypeEntities;
private List<BussinessOriginTypeEntity> bussinessOriginTypeEntities;
private List<SpsBusLoclTypeResponse> bussinessLocalTypeEntities;

@ -16,6 +16,8 @@ import java.util.List;
@Data
public class SpsSyncDataResponse {
//同步任务ID
private String taskId;
List<InvWarehouseEntity> invWarehouseEntities;
List<UdiInfoEntity> udiInfoEntities;
List<BasicUnitMaintainEntity> basicUnitMaintainEntities;

@ -10,6 +10,8 @@ import java.util.List;
@Data
public class SpsSyncOrderResponse {
//同步任务ID
private String taskId;
List<OrderEntity> orderEntities;
List<ErpOrderEntity> orderDetailEntityList;
List<WarehouseEntity> warehouseEntityList;

@ -0,0 +1,19 @@
package com.glxp.api.admin.service.basic;
import com.glxp.api.admin.entity.basic.BasicDownloadStatusEntity;
import com.glxp.api.admin.req.basic.BasicDownloadRequest;
import java.util.List;
public interface BasicDownloadService {
BasicDownloadStatusEntity findByData(String idDatas, Integer status);
List<BasicDownloadStatusEntity> filterDownloadStatus(BasicDownloadRequest basicDownloadRequest);
boolean insertDownloadStatus(BasicDownloadStatusEntity basicDownloadStatusEntity);
boolean deleteById(String id);
boolean updateDownloadStatus(BasicDownloadStatusEntity basicDownloadStatusEntity);
}

@ -0,0 +1,59 @@
package com.glxp.api.admin.service.basic.impl;
import cn.hutool.core.collection.CollUtil;
import com.github.pagehelper.PageHelper;
import com.glxp.api.admin.dao.basic.BasicDownloadDao;
import com.glxp.api.admin.entity.basic.BasicDownloadStatusEntity;
import com.glxp.api.admin.req.basic.BasicDownloadRequest;
import com.glxp.api.admin.service.basic.BasicDownloadService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
public class BasicDownloadServiceImpl implements BasicDownloadService {
@Resource
BasicDownloadDao basicDownloadDao;
@Override
public BasicDownloadStatusEntity findByData(String idDatas, Integer status) {
BasicDownloadRequest basicDownloadRequest = new BasicDownloadRequest();
basicDownloadRequest.setStatus(status);
basicDownloadRequest.setIdDatas(idDatas);
List<BasicDownloadStatusEntity> basicDownloadStatusEntities = basicDownloadDao.filterDownloadStatus(basicDownloadRequest);
if (CollUtil.isNotEmpty(basicDownloadStatusEntities)) {
return basicDownloadStatusEntities.get(0);
}
return null;
}
@Override
public List<BasicDownloadStatusEntity> filterDownloadStatus(BasicDownloadRequest basicDownloadRequest) {
if (basicDownloadRequest == null) {
return Collections.emptyList();
}
if (basicDownloadRequest.getPage() != null) {
int offset = (basicDownloadRequest.getPage() - 1) * basicDownloadRequest.getLimit();
PageHelper.offsetPage(offset, basicDownloadRequest.getLimit());
}
return basicDownloadDao.filterDownloadStatus(basicDownloadRequest);
}
@Override
public boolean insertDownloadStatus(BasicDownloadStatusEntity basicDownloadStatusEntity) {
return basicDownloadDao.insertDownloadStatus(basicDownloadStatusEntity);
}
@Override
public boolean deleteById(String id) {
return basicDownloadDao.deleteById(id);
}
@Override
public boolean updateDownloadStatus(BasicDownloadStatusEntity basicDownloadStatusEntity) {
return basicDownloadDao.updateDownloadStatus(basicDownloadStatusEntity);
}
}

@ -7,26 +7,34 @@ import com.glxp.api.admin.constant.BasicProcessStatus;
import com.glxp.api.admin.constant.ConstantStatus;
import com.glxp.api.admin.dao.auth.AuthAdminDao;
import com.glxp.api.admin.dao.basic.*;
import com.glxp.api.admin.dao.inout.*;
import com.glxp.api.admin.dao.inout.CodesTempDao;
import com.glxp.api.admin.dao.inout.OrderDao;
import com.glxp.api.admin.dao.inout.WarehouseBussinessTypeDao;
import com.glxp.api.admin.dao.inout.WarehouseUserDao;
import com.glxp.api.admin.dao.thrsys.ThrCorpDao;
import com.glxp.api.admin.dao.thrsys.ThrOrderDao;
import com.glxp.api.admin.dao.thrsys.ThrOrderDetailDao;
import com.glxp.api.admin.dao.thrsys.ThrProductsDao;
import com.glxp.api.admin.entity.auth.AuthAdmin;
import com.glxp.api.admin.entity.basic.*;
import com.glxp.api.admin.entity.inout.*;
import com.glxp.api.admin.entity.inout.OrderEntity;
import com.glxp.api.admin.entity.inout.WarehouseBussinessTypeEntity;
import com.glxp.api.admin.entity.inout.WarehouseEntity;
import com.glxp.api.admin.entity.inout.WarehouseUserEntity;
import com.glxp.api.admin.entity.inventory.InvWarehouseEntity;
import com.glxp.api.admin.entity.thrsys.*;
import com.glxp.api.admin.httpclient.SpGetHttpClient;
import com.glxp.api.admin.req.basic.BasicExportStatusRequest;
import com.glxp.api.admin.res.basic.*;
import com.glxp.api.admin.service.auth.AuthAdminService;
import com.glxp.api.admin.res.basic.SpSyncUdiResponse;
import com.glxp.api.admin.res.basic.SpsSyncBusResponse;
import com.glxp.api.admin.res.basic.SpsSyncDataResponse;
import com.glxp.api.admin.res.basic.SpsSyncOrderResponse;
import com.glxp.api.admin.service.basic.BasicDownloadService;
import com.glxp.api.admin.service.basic.BussinessChangeTypeService;
import com.glxp.api.admin.service.basic.UdiInfoImportDetailService;
import com.glxp.api.admin.service.inout.OrderService;
import com.glxp.api.admin.service.inventory.InvWarehouseService;
import com.glxp.api.admin.service.thrsys.ThrInvWarehouseService;
import com.glxp.api.admin.util.RedisUtil;
import com.glxp.api.admin.httpclient.SpGetHttpClient;
import com.glxp.api.common.res.BaseResponse;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
@ -68,6 +76,8 @@ public class DlBasicService {
ThrInvWarehouseService thrInvWarehouseService;
@Resource
BussinessChangeTypeService bussinessChangeTypeService;
@Resource
private BasicDownloadService basicDownloadService;
private static final Logger logger = LoggerFactory.getLogger(DlBasicService.class);
//------------------------------------------------------------
@ -82,8 +92,22 @@ public class DlBasicService {
String datas = spGetHttp.getBasicData(basicExportStatusEntity.getId(), BasicProcessStatus.NEW_ALL_DATA);
BaseResponse<SpsSyncDataResponse> response = JSONObject.parseObject(datas, new TypeReference<BaseResponse<SpsSyncDataResponse>>() {
});
if (response.getCode() == 20000 && response.getData() != null) {
SpsSyncDataResponse syncDataResponse = response.getData();
//构造下载记录
BasicDownloadStatusEntity basicDownloadStatusEntity = new BasicDownloadStatusEntity();
basicDownloadStatusEntity.setId(syncDataResponse.getTaskId());
basicDownloadStatusEntity.setStartTime(new Date());
basicDownloadStatusEntity.setIdDatas(ConstantStatus.SYNC_DOWNLOAD_BASIC_DATA);
basicDownloadStatusEntity.setStatus(0); //下载中
basicDownloadStatusEntity.setType(BasicProcessStatus.NEW_ALL_DATA);
basicDownloadStatusEntity.setScheduleType(1);
basicDownloadService.insertDownloadStatus(basicDownloadStatusEntity);
StringBuffer remark = new StringBuffer();
SqlSession batchSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
//仓库字典导入
if (CollUtil.isNotEmpty(syncDataResponse.getInvWarehouseEntities())) {
@ -93,6 +117,7 @@ public class DlBasicService {
}
invWarehouseService.importInvWarehouse(syncDataResponse.getInvWarehouseEntities());
remark.append("仓库字典:").append(syncDataResponse.getInvWarehouseEntities().size()).append("条\n");
}
//关联表导入
@ -118,6 +143,7 @@ public class DlBasicService {
mapper.insertUdiInfo(udiInfoEntity);
}
batchSession.commit();
remark.append("耗材字典:").append(syncDataResponse.getUdiInfoEntities().size()).append("条\n");
} catch (Exception e) {
}
}
@ -133,6 +159,7 @@ public class DlBasicService {
mapper.importBasicUnitMaintain(basicUnitMaintainEntity);
}
batchSession.commit();
remark.append("往来单位:").append(syncDataResponse.getBasicUnitMaintainEntities().size()).append("条\n");
} catch (Exception e) {
}
}
@ -163,6 +190,7 @@ public class DlBasicService {
mapper.insertThrProducts(thrProductsEntity);
}
batchSession.commit();
remark.append("第三方产品信息:").append(syncDataResponse.getThrProductsEntities().size()).append("条\n");
} catch (Exception e) {
}
}
@ -178,6 +206,7 @@ public class DlBasicService {
mapper.importThrCorp(thrCorpEntity);
});
batchSession.commit();
remark.append("第三方往来单位信息:").append(syncDataResponse.getThrCorpEntities().size()).append("条\n");
} catch (Exception e) {
}
}
@ -192,6 +221,7 @@ public class DlBasicService {
mapper.importThrOrder(thrCorpEntity);
});
batchSession.commit();
remark.append("第三方业务单据:").append(syncDataResponse.getThrOrderEntities().size()).append("条\n");
} catch (Exception e) {
}
}
@ -205,6 +235,7 @@ public class DlBasicService {
mapper.importThrOrderDetail(thrOrderDetailEntity);
});
batchSession.commit();
remark.append("第三方业务单据详情:").append(syncDataResponse.getThrOrderDetailEntities().size()).append("条\n");
} catch (Exception e) {
}
}
@ -215,6 +246,7 @@ public class DlBasicService {
invWarehouseEntity.setUpdateTime(null);
}
thrInvWarehouseService.insertInvWarehouses(syncDataResponse.getThrInvWarehouseEntities());
remark.append("第三方仓库信息:").append(syncDataResponse.getThrInvWarehouseEntities().size()).append("条\n");
}
@ -223,6 +255,7 @@ public class DlBasicService {
for (WarehouseUserEntity warehouseUserEntity : syncDataResponse.getWarehouseUserEntities()) {
warehouseUserDao.insertOrUpdate(warehouseUserEntity);
}
remark.append("仓库用户:").append(syncDataResponse.getWarehouseUserEntities().size()).append("条\n");
}
//仓库单据类型表
@ -230,6 +263,7 @@ public class DlBasicService {
for (WarehouseBussinessTypeEntity warehouseUserEntity : syncDataResponse.getWarehouseBussinessTypeEntities()) {
warehouseBussinessTypeDao.insertOrUpdate(warehouseUserEntity);
}
remark.append("仓库单据:").append(syncDataResponse.getWarehouseBussinessTypeEntities().size()).append("条\n");
}
//用户表
@ -238,13 +272,16 @@ public class DlBasicService {
authAdmin.setLastModifyTime(null);
authAdminService.replaceAuthAdmin(authAdmin);
}
remark.append("用户:").append(syncDataResponse.getAuthAdminList().size()).append("条\n");
}
spGetHttp.postBasicStatus(basicExportStatusEntity.getId());
batchSession.close();
basicDownloadStatusEntity.setUpdateTime(new Date());
basicDownloadStatusEntity.setEndTime(new Date());
basicDownloadStatusEntity.setRemark(remark.toString());
basicDownloadService.updateDownloadStatus(basicDownloadStatusEntity);
}
}
}
@ -264,6 +301,19 @@ public class DlBasicService {
});
if (response.getCode() == 20000 && response.getData() != null) {
SpsSyncBusResponse syncDataResponse = response.getData();
//构造下载记录
BasicDownloadStatusEntity basicDownloadStatusEntity = new BasicDownloadStatusEntity();
basicDownloadStatusEntity.setId(syncDataResponse.getTaskId());
basicDownloadStatusEntity.setStartTime(new Date());
basicDownloadStatusEntity.setIdDatas(ConstantStatus.SYNC_DOWNLOAD_BUS_TYPE);
basicDownloadStatusEntity.setStatus(0); //下载中
basicDownloadStatusEntity.setType(BasicProcessStatus.NEW_ALL_BUS);
basicDownloadStatusEntity.setScheduleType(1);
basicDownloadService.insertDownloadStatus(basicDownloadStatusEntity);
StringBuffer remark = new StringBuffer();
SqlSession batchSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
//扫码单据
@ -276,6 +326,7 @@ public class DlBasicService {
mapper.insertBussinessType(bussinessTypeEntity);
}
batchSession.commit();
remark.append("扫码单据类型:").append(syncDataResponse.getBussinessTypeEntities().size()).append("条\n");
} catch (Exception e) {
logger.error(e.getMessage());
}
@ -299,6 +350,7 @@ public class DlBasicService {
bussinessChangeTypeService.insertBusChangeTypee(bussinessChangeTypeEntity);
}
}
remark.append("业务单据类型:").append(syncDataResponse.getBussinessLocalTypeEntities().size()).append("条\n");
} catch (Exception e) {
logger.error(e.getMessage());
}
@ -313,12 +365,19 @@ public class DlBasicService {
mapper.insertBusOriginType(bussinessTypeEntity);
}
batchSession.commit();
remark.append("第三方单据类型:").append(syncDataResponse.getBussinessOriginTypeEntities().size()).append("条\n");
} catch (Exception e) {
logger.error(e.getMessage());
}
}
batchSession.close();
spGetHttp.postBasicStatus(basicExportStatusEntity.getId());
basicDownloadStatusEntity.setUpdateTime(new Date());
basicDownloadStatusEntity.setEndTime(new Date());
basicDownloadStatusEntity.setRemark(remark.toString());
basicDownloadService.updateDownloadStatus(basicDownloadStatusEntity);
}
}
}
@ -339,6 +398,18 @@ public class DlBasicService {
});
if (response.getCode() == 20000 && response.getData() != null) {
SpsSyncOrderResponse syncDataResponse = response.getData();
BasicDownloadStatusEntity basicDownloadStatusEntity = new BasicDownloadStatusEntity();
basicDownloadStatusEntity.setId(syncDataResponse.getTaskId());
basicDownloadStatusEntity.setStartTime(new Date());
basicDownloadStatusEntity.setIdDatas(ConstantStatus.SYNC_DOWNLOAD_SCAN_ORDER);
basicDownloadStatusEntity.setStatus(0); //下载中
basicDownloadStatusEntity.setType(BasicProcessStatus.NEW_ALL_ORDER);
basicDownloadStatusEntity.setScheduleType(1);
basicDownloadService.insertDownloadStatus(basicDownloadStatusEntity);
StringBuffer remark = new StringBuffer();
SqlSession batchSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
if (CollUtil.isNotEmpty(syncDataResponse.getOrderEntities())) {
try {
@ -371,11 +442,17 @@ public class DlBasicService {
}
batchSession.commit();
remark.append("单据:").append(syncDataResponse.getOrderEntities().size()).append("条\n");
} catch (Exception e) {
}
}
batchSession.close();
spGetHttp.postBasicStatus(basicExportStatusEntity.getId());
basicDownloadStatusEntity.setUpdateTime(new Date());
basicDownloadStatusEntity.setEndTime(new Date());
basicDownloadStatusEntity.setRemark(remark.toString());
basicDownloadService.updateDownloadStatus(basicDownloadStatusEntity);
}
}
}
@ -410,7 +487,6 @@ public class DlBasicService {
public void dlAllUDI() {
BaseResponse<List<BasicExportStatusEntity>> baseResponse = spGetHttp.getBasicStatus(BasicProcessStatus.NEW_ALL_DI + "");
List<BasicExportStatusEntity> pageSimpleResponse = baseResponse.getData();
if (pageSimpleResponse != null) {
@ -423,6 +499,18 @@ public class DlBasicService {
});
if (response.getCode() == 20000 && response.getData() != null) {
SpSyncUdiResponse spSyncUdiResponse = response.getData();
BasicDownloadStatusEntity basicDownloadStatusEntity = new BasicDownloadStatusEntity();
basicDownloadStatusEntity.setId(spSyncUdiResponse.getTaskId());
basicDownloadStatusEntity.setStartTime(new Date());
basicDownloadStatusEntity.setIdDatas(ConstantStatus.SYNC_DOWNLOAD_DI);
basicDownloadStatusEntity.setStatus(0); //下载中
basicDownloadStatusEntity.setType(BasicProcessStatus.NEW_ALL_DI);
basicDownloadStatusEntity.setScheduleType(1);
basicDownloadService.insertDownloadStatus(basicDownloadStatusEntity);
StringBuffer remark = new StringBuffer();
SqlSession batchSession = sqlSessionFactory.openSession(ExecutorType.BATCH, TransactionIsolationLevel.READ_COMMITTED);
if (CollUtil.isNotEmpty(spSyncUdiResponse.getUdiCompanyEntities())) {
List<UdiCompanyEntity> udiCompanyEntities = spSyncUdiResponse.getUdiCompanyEntities();
@ -431,6 +519,7 @@ public class DlBasicService {
mapper.insertUdiCompany(udiCompanyEntity);
}
batchSession.commit();
remark.append("公司信息:").append(spSyncUdiResponse.getUdiCompanyEntities().size()).append("条\n");
}
if (CollUtil.isNotEmpty(spSyncUdiResponse.getProductInfoEntityList())) {
@ -440,9 +529,15 @@ public class DlBasicService {
mapper.insertProductInfo(productInfoEntity);
}
batchSession.commit();
remark.append("产品信息:").append(spSyncUdiResponse.getProductInfoEntityList().size()).append("条\n");
}
batchSession.close();
spGetHttp.postBasicStatus(basicExportStatusEntity.getId());
basicDownloadStatusEntity.setUpdateTime(new Date());
basicDownloadStatusEntity.setEndTime(new Date());
basicDownloadStatusEntity.setRemark(remark.toString());
basicDownloadService.updateDownloadStatus(basicDownloadStatusEntity);
}
}
@ -450,7 +545,6 @@ public class DlBasicService {
}
}

@ -0,0 +1,66 @@
<?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.glxp.api.admin.dao.basic.BasicDownloadDao">
<select id="filterDownloadStatus" parameterType="com.glxp.api.admin.req.basic.BasicDownloadRequest"
resultType="com.glxp.api.admin.entity.basic.BasicDownloadStatusEntity">
select * from basic_download_status
<where>
<if test="id != '' and id!=null">
and id = #{id}
</if>
<if test="status!=null">
and status = #{status}
</if>
<if test="type!=null">
and `type` = #{type}
</if>
<if test="idDatas != '' and idDatas!=null">
and idDatas = #{idDatas}
</if>
<if test="scheduleType!=null">
and scheduleType = #{scheduleType}
</if>
</where>
order by updateTime desc
</select>
<insert id="insertDownloadStatus" keyProperty="id"
parameterType="com.glxp.api.admin.entity.basic.BasicDownloadStatusEntity">
replace
INTO basic_download_status(id,idDatas,status,type,updateTime,scheduleType,startTime,endTime,remark)
values(
#{id},
#{idDatas},
#{status},
#{type},
#{updateTime},
#{scheduleType},
#{startTime},
#{endTime},#{remark}
)
</insert>
<update id="updateDownloadStatus" parameterType="com.glxp.api.admin.entity.basic.BasicDownloadStatusEntity">
UPDATE basic_download_status
<trim prefix="set" suffixOverrides=",">
<if test="idDatas != null">idDatas=#{idDatas},</if>
<if test="status != null">status=#{status},</if>
<if test="type != null">type=#{type},</if>
<if test="updateTime != null">updateTime=#{updateTime},</if>
<if test="scheduleType != null">scheduleType=#{scheduleType},</if>
<if test="startTime != null">startTime=#{startTime},</if>
<if test="endTime != null">endTime=#{endTime},</if>
<if test="remark != null">remark=#{remark},</if>
</trim>
WHERE id = #{id}
</update>
<delete id="deleteById" parameterType="Map">
DELETE
FROM basic_download_status
WHERE id = #{id}
</delete>
</mapper>
Loading…
Cancel
Save