Commit 1626458a41f99cb08a11a8f71a4319c9100f6df1
1 parent
c911a421
feat: 新增车队与线路文件模板
Showing
14 changed files
with
739 additions
and
46 deletions
Bsth-admin/src/main/java/com/ruoyi/controller/BigViewController.java
| 1 | 1 | package com.ruoyi.controller; |
| 2 | 2 | |
| 3 | +import com.ruoyi.common.annotation.Log; | |
| 4 | +import com.ruoyi.common.enums.BusinessType; | |
| 3 | 5 | import com.ruoyi.common.global.Result; |
| 4 | 6 | import com.ruoyi.pojo.vo.bigViewVo.FleetInfoVo; |
| 5 | 7 | import com.ruoyi.pojo.vo.bigViewVo.SignInfoVo; |
| ... | ... | @@ -8,8 +10,11 @@ import com.ruoyi.service.BigViewService; |
| 8 | 10 | import io.swagger.annotations.Api; |
| 9 | 11 | import io.swagger.annotations.ApiOperation; |
| 10 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 11 | 14 | import org.springframework.web.bind.annotation.*; |
| 15 | +import org.springframework.web.multipart.MultipartFile; | |
| 12 | 16 | |
| 17 | +import javax.servlet.http.HttpServletResponse; | |
| 13 | 18 | import java.util.List; |
| 14 | 19 | |
| 15 | 20 | /** |
| ... | ... | @@ -50,5 +55,22 @@ public class BigViewController { |
| 50 | 55 | return Result.OK(bigViewService.querySignDetails(date,jobCode)); |
| 51 | 56 | } |
| 52 | 57 | |
| 58 | + @ApiOperation("全量导入车队与线路匹配") | |
| 59 | + @PostMapping("/importExcel") | |
| 60 | + @PreAuthorize("@ss.hasPermi('template:template:import')") | |
| 61 | + @Log(title = "全量导入车队与线路匹配",businessType = BusinessType.INSERT) | |
| 62 | + public Result<?> importExcel(MultipartFile file){ | |
| 63 | + bigViewService.importExcel(file); | |
| 64 | + return Result.OK(); | |
| 65 | + } | |
| 66 | + | |
| 67 | + @ApiOperation("全量导入车队与线路匹配模板") | |
| 68 | + @PostMapping("/exportExcel") | |
| 69 | + @PreAuthorize("@ss.hasPermi('template:template:import')") | |
| 70 | + @Log(title = "全量导入车队与线路匹配模板",businessType = BusinessType.EXPORT) | |
| 71 | + public void exportExcel(HttpServletResponse response){ | |
| 72 | + bigViewService.exportExcel(response); | |
| 73 | + } | |
| 74 | + | |
| 53 | 75 | |
| 54 | 76 | } | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/pojo/template/FleetLineImportTemplate.java
0 → 100644
| 1 | +package com.ruoyi.pojo.template; | |
| 2 | + | |
| 3 | +import com.alibaba.excel.annotation.ExcelProperty; | |
| 4 | +import com.ruoyi.common.annotation.Excel; | |
| 5 | +import lombok.Data; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * 车队与线路导入模板 | |
| 9 | + * @author 20412 | |
| 10 | + */ | |
| 11 | +@Data | |
| 12 | +public class FleetLineImportTemplate { | |
| 13 | + @ExcelProperty(value = "车队名称") | |
| 14 | + private String fleetName; | |
| 15 | + @ExcelProperty(value = "线路名称") | |
| 16 | + private String lineName; | |
| 17 | +} | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/pojo/vo/bigViewVo/LineInfo.java
| ... | ... | @@ -13,6 +13,8 @@ public class LineInfo { |
| 13 | 13 | private String nbbm; |
| 14 | 14 | private PersonInfoVo driverInfoVo; |
| 15 | 15 | private PersonInfoVo saleInfoVo; |
| 16 | + private String lineName; | |
| 17 | + private String fleetName; | |
| 16 | 18 | @Data |
| 17 | 19 | public static class PersonInfoVo { |
| 18 | 20 | private String jobCode; | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/BigViewService.java
| ... | ... | @@ -3,7 +3,9 @@ package com.ruoyi.service; |
| 3 | 3 | import com.ruoyi.pojo.vo.bigViewVo.FleetInfoVo; |
| 4 | 4 | import com.ruoyi.pojo.vo.bigViewVo.SignInfoVo; |
| 5 | 5 | import com.ruoyi.pojo.vo.bigViewVo.SignNumberVo; |
| 6 | +import org.springframework.web.multipart.MultipartFile; | |
| 6 | 7 | |
| 8 | +import javax.servlet.http.HttpServletResponse; | |
| 7 | 9 | import java.util.List; |
| 8 | 10 | |
| 9 | 11 | /** |
| ... | ... | @@ -34,4 +36,12 @@ public interface BigViewService { |
| 34 | 36 | * @return SignInfoVo |
| 35 | 37 | */ |
| 36 | 38 | SignInfoVo querySignDetails(String date,String jobCode); |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 导入车队与线路匹配模板 | |
| 42 | + * @param file | |
| 43 | + */ | |
| 44 | + void importExcel(MultipartFile file); | |
| 45 | + | |
| 46 | + void exportExcel(HttpServletResponse response); | |
| 37 | 47 | } | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/service/impl/BigViewServiceImpl.java
| ... | ... | @@ -2,21 +2,35 @@ package com.ruoyi.service.impl; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.collection.CollectionUtil; |
| 4 | 4 | import com.ruoyi.common.cache.NowSchedulingCache; |
| 5 | +import com.ruoyi.common.config.RuoYiConfig; | |
| 6 | +import com.ruoyi.common.utils.SecurityUtils; | |
| 5 | 7 | import com.ruoyi.common.utils.StringUtils; |
| 8 | +import com.ruoyi.common.utils.file.FileUploadUtils; | |
| 9 | +import com.ruoyi.common.utils.poi.ExcelUtil; | |
| 6 | 10 | import com.ruoyi.domain.DriverScheduling; |
| 7 | 11 | import com.ruoyi.driver.mapper.DriverMapper; |
| 8 | 12 | import com.ruoyi.driver.mapper.DriverSchedulingMapper; |
| 9 | 13 | import com.ruoyi.in.service.ISignInService; |
| 10 | 14 | import com.ruoyi.pojo.response.SignInResponseVo; |
| 15 | +import com.ruoyi.pojo.template.FleetLineImportTemplate; | |
| 11 | 16 | import com.ruoyi.pojo.vo.bigViewVo.*; |
| 12 | 17 | import com.ruoyi.service.BigViewService; |
| 13 | 18 | import com.ruoyi.service.ThreadJobService; |
| 19 | +import com.ruoyi.template.domain.FleetLineTemplate; | |
| 20 | +import com.ruoyi.template.service.IFleetLineTemplateService; | |
| 14 | 21 | import org.slf4j.Logger; |
| 15 | 22 | import org.slf4j.LoggerFactory; |
| 16 | 23 | import org.springframework.beans.factory.annotation.Autowired; |
| 24 | +import org.springframework.beans.factory.annotation.Value; | |
| 17 | 25 | import org.springframework.stereotype.Service; |
| 26 | +import org.springframework.web.multipart.MultipartFile; | |
| 18 | 27 | |
| 19 | 28 | import javax.annotation.Resource; |
| 29 | +import javax.servlet.ServletOutputStream; | |
| 30 | +import javax.servlet.http.HttpServletResponse; | |
| 31 | +import java.io.File; | |
| 32 | +import java.io.FileInputStream; | |
| 33 | +import java.io.IOException; | |
| 20 | 34 | import java.time.LocalDate; |
| 21 | 35 | import java.util.*; |
| 22 | 36 | import java.util.stream.Collectors; |
| ... | ... | @@ -33,6 +47,9 @@ public class BigViewServiceImpl implements BigViewService { |
| 33 | 47 | |
| 34 | 48 | private static final Logger log = LoggerFactory.getLogger(BigViewServiceImpl.class); |
| 35 | 49 | |
| 50 | + @Value("${api.template}") | |
| 51 | + private String filePrefix; | |
| 52 | + | |
| 36 | 53 | @Resource |
| 37 | 54 | private ThreadJobService threadJobService; |
| 38 | 55 | @Autowired |
| ... | ... | @@ -47,6 +64,9 @@ public class BigViewServiceImpl implements BigViewService { |
| 47 | 64 | @Resource |
| 48 | 65 | private NowSchedulingCache cache; |
| 49 | 66 | |
| 67 | + @Autowired | |
| 68 | + private IFleetLineTemplateService templateService; | |
| 69 | + | |
| 50 | 70 | @Override |
| 51 | 71 | public SignNumberVo queryNumberByType(String type, String dateKey) { |
| 52 | 72 | SignNumberVo x = handleType(type, dateKey); |
| ... | ... | @@ -58,14 +78,12 @@ public class BigViewServiceImpl implements BigViewService { |
| 58 | 78 | public List<FleetInfoVo> queryFleetInfoByFleetName(String dateKey) { |
| 59 | 79 | // 从缓存中读取数据,但是调度表中还好包含飞司售人员信息 需要过滤一下 非司售人员nbbm不会存在 |
| 60 | 80 | String key = dateKey.replaceAll("-", ""); |
| 61 | - Map<String, List<DriverScheduling>> map = cache.getCacheScheduling(key); | |
| 62 | - | |
| 63 | - Map<String, LineInfo> matchMap = transformMapByMacheList(map); | |
| 81 | + Map<String, LineInfo> matchMap = transformMapByMacheList(cache.getCacheScheduling(key)); | |
| 64 | 82 | // 车队和线路 车队为key |
| 65 | - Map<String, Map<String, List<String>>> mapVo = new HashMap<>(4); | |
| 66 | - | |
| 83 | + Map<String, Map<String, String>> mapVo = new HashMap<>(4); | |
| 84 | + List<FleetLineTemplate> templateList = templateService.selectFleetLineTemplateList(new FleetLineTemplate()); | |
| 67 | 85 | // 记录所有得签到数据 以车队 -》 线路 -》 人员信息 层次 |
| 68 | - handleFleetWithLine(map, mapVo); | |
| 86 | + handleFleetWithLine(mapVo, templateList); | |
| 69 | 87 | // 进一步处理人员信息 |
| 70 | 88 | List<FleetInfoVo> fleetInfoVos = handleFleetWithLinePersonInfo(matchMap, mapVo); |
| 71 | 89 | // 特殊处理 处理进博会线路信息 |
| ... | ... | @@ -120,7 +138,7 @@ public class BigViewServiceImpl implements BigViewService { |
| 120 | 138 | if (item.getLineName().startsWith("进博短驳")) { |
| 121 | 139 | // 这个循环是因为不同车队的人在拼接到进博会时出现相同线路两条记录问题 |
| 122 | 140 | for (FleetInfoVo.FleetInfo fleetInfo : jinbo) { |
| 123 | - if (fleetInfo.getLineName().equals(item.getLineName())){ | |
| 141 | + if (fleetInfo.getLineName().equals(item.getLineName())) { | |
| 124 | 142 | fleetInfo.getLineInfos().addAll(item.getLineInfos()); |
| 125 | 143 | return false; |
| 126 | 144 | } |
| ... | ... | @@ -192,10 +210,118 @@ public class BigViewServiceImpl implements BigViewService { |
| 192 | 210 | return vo; |
| 193 | 211 | } |
| 194 | 212 | |
| 195 | - private List<FleetInfoVo> handleFleetWithLinePersonInfo(Map<String, LineInfo> map, Map<String, Map<String, List<String>>> mapVo) { | |
| 213 | + @Override | |
| 214 | + public void importExcel(MultipartFile file) { | |
| 215 | + try { | |
| 216 | + ExcelUtil<FleetLineImportTemplate> excelUtil = new ExcelUtil<FleetLineImportTemplate>(FleetLineImportTemplate.class); | |
| 217 | + List<FleetLineImportTemplate> exportTemplate = excelUtil.importEasyExcel(file.getInputStream()); | |
| 218 | + List<FleetLineTemplate> templateList = new ArrayList<>(); | |
| 219 | + for (FleetLineImportTemplate template : exportTemplate) { | |
| 220 | + FleetLineTemplate fleetLineTemplate = new FleetLineTemplate(); | |
| 221 | + fleetLineTemplate.setFleetName(template.getFleetName()); | |
| 222 | + fleetLineTemplate.setLineName(template.getLineName()); | |
| 223 | + fleetLineTemplate.setCreateTime(new Date()); | |
| 224 | + fleetLineTemplate.setUpdateTime(new Date()); | |
| 225 | + fleetLineTemplate.setCreateBy(String.valueOf(SecurityUtils.getUserId())); | |
| 226 | + fleetLineTemplate.setUpdateBy(String.valueOf(SecurityUtils.getUserId())); | |
| 227 | + fleetLineTemplate.setRemark("全量导入"); | |
| 228 | + templateList.add(fleetLineTemplate); | |
| 229 | + } | |
| 230 | + templateService.deleteAllTemplate(); | |
| 231 | + templateService.insertBatch(templateList); | |
| 232 | + } catch (Exception e) { | |
| 233 | + log.error(e.getMessage()); | |
| 234 | + throw new RuntimeException("模板导入异常"); | |
| 235 | + } | |
| 236 | + } | |
| 237 | + | |
| 238 | + @Override | |
| 239 | + public void exportExcel(HttpServletResponse response) { | |
| 240 | + FileInputStream fis = null; | |
| 241 | + ServletOutputStream os = null; | |
| 242 | + try { | |
| 243 | + String basePath = RuoYiConfig.getDownloadPath(); | |
| 244 | + File dir = new File(basePath); | |
| 245 | + if (!dir.exists()) { | |
| 246 | + if (!dir.getParentFile().exists()) { | |
| 247 | + dir.getParentFile().mkdirs(); | |
| 248 | + } | |
| 249 | + } | |
| 250 | + String fileName = getFileName(dir); | |
| 251 | + if (StringUtils.isEmpty(fileName)) { | |
| 252 | + log.info("请管理员尽快把最新的模板放入:{} 目录下", basePath); | |
| 253 | + // TODO | |
| 254 | + createExportTemplate(response); | |
| 255 | + } else { | |
| 256 | + File file = FileUploadUtils.getAbsoluteFile(basePath, fileName); | |
| 257 | + fis = new FileInputStream(file); | |
| 258 | + os = response.getOutputStream(); | |
| 259 | + byte[] bits = new byte[1024]; | |
| 260 | + int len; | |
| 261 | + while ((len = fis.read(bits)) != -1) { | |
| 262 | + os.write(bits, 0, len); | |
| 263 | + } | |
| 264 | + } | |
| 265 | + } catch (IOException e) { | |
| 266 | + log.error(e.getMessage()); | |
| 267 | + throw new RuntimeException("模板下载失败"); | |
| 268 | + } finally { | |
| 269 | + try { | |
| 270 | + if (fis != null) { | |
| 271 | + fis.close(); | |
| 272 | + } | |
| 273 | + if (os != null) { | |
| 274 | + os.close(); | |
| 275 | + } | |
| 276 | + } catch (Exception e) { | |
| 277 | + log.error("未关闭文件流"); | |
| 278 | + } | |
| 279 | + } | |
| 280 | + } | |
| 281 | + | |
| 282 | + private void createExportTemplate(HttpServletResponse response) { | |
| 283 | + List<FleetLineImportTemplate> list = new ArrayList<>(3); | |
| 284 | + FleetLineImportTemplate template1 = new FleetLineImportTemplate(); | |
| 285 | + template1.setFleetName("一车队"); | |
| 286 | + template1.setLineName("xxxx线路"); | |
| 287 | + FleetLineImportTemplate template2 = new FleetLineImportTemplate(); | |
| 288 | + template2.setFleetName("二车队"); | |
| 289 | + template2.setLineName("xxxx线路"); | |
| 290 | + FleetLineImportTemplate template3 = new FleetLineImportTemplate(); | |
| 291 | + template3.setFleetName("三车队"); | |
| 292 | + template3.setLineName("xxxx线路"); | |
| 293 | + list.add(template1); | |
| 294 | + list.add(template2); | |
| 295 | + list.add(template3); | |
| 296 | + ExcelUtil<FleetLineImportTemplate> excelUtil = new ExcelUtil<FleetLineImportTemplate>(FleetLineImportTemplate.class); | |
| 297 | + excelUtil.exportEasyExcel(response, list, "车队与线路匹配模板"); | |
| 298 | + } | |
| 299 | + | |
| 300 | + private String getFileName(File fileInput) { | |
| 301 | + // 获取文件列表 | |
| 302 | + File[] fileList = fileInput.listFiles(); | |
| 303 | +// assert fileList != null; | |
| 304 | + if (fileList == null) { | |
| 305 | + return null; | |
| 306 | + } | |
| 307 | + for (File file : fileList) { | |
| 308 | + if (file.isDirectory()) { | |
| 309 | + // 递归处理文件夹 | |
| 310 | + // 如果不想统计子文件夹则可以将下一行注释掉 | |
| 311 | +// getAllFile(file, allFileList); | |
| 312 | + } else { | |
| 313 | + if (StringUtils.contains(file.getName(), filePrefix)) { | |
| 314 | + return file.getName(); | |
| 315 | + } | |
| 316 | + } | |
| 317 | + } | |
| 318 | + return null; | |
| 319 | + } | |
| 320 | + | |
| 321 | + private List<FleetInfoVo> handleFleetWithLinePersonInfo(Map<String, LineInfo> map, Map<String, Map<String, String>> mapVo) { | |
| 196 | 322 | List<FleetInfoVo> vos = new ArrayList<>(4); |
| 197 | - for (Map.Entry<String, Map<String, List<String>>> entry : mapVo.entrySet()) { | |
| 198 | - Map<String, List<String>> value = entry.getValue(); | |
| 323 | + for (Map.Entry<String, Map<String, String>> entry : mapVo.entrySet()) { | |
| 324 | + Map<String, String> value = entry.getValue(); | |
| 199 | 325 | String fleetName = entry.getKey(); |
| 200 | 326 | FleetInfoVo vo = new FleetInfoVo(); |
| 201 | 327 | vo.setTitle(fleetName); |
| ... | ... | @@ -224,20 +350,21 @@ public class BigViewServiceImpl implements BigViewService { |
| 224 | 350 | * 信息拼接 |
| 225 | 351 | * |
| 226 | 352 | * @param value |
| 227 | - * @param map | |
| 353 | + * @param personMap | |
| 228 | 354 | * @return |
| 229 | 355 | */ |
| 230 | - private List<FleetInfoVo.FleetInfo> handleLineInfos(Map<String, List<String>> value, Map<String, LineInfo> map) { | |
| 356 | + private List<FleetInfoVo.FleetInfo> handleLineInfos(Map<String, String> value, Map<String, LineInfo> personMap) { | |
| 231 | 357 | List<FleetInfoVo.FleetInfo> fleetInfos = new ArrayList<>(); |
| 232 | - for (Map.Entry<String, List<String>> entry : value.entrySet()) { | |
| 358 | + for (Map.Entry<String, String> entry : value.entrySet()) { | |
| 233 | 359 | String lineName = entry.getKey(); |
| 234 | - List<String> nbbms = entry.getValue(); | |
| 235 | 360 | FleetInfoVo.FleetInfo fleetInfo = new FleetInfoVo.FleetInfo(); |
| 236 | 361 | fleetInfo.setLineName(lineName); |
| 237 | 362 | List<LineInfo> lineInfos = new ArrayList<>(); |
| 238 | - for (String nbbm : nbbms) { | |
| 239 | - LineInfo info = map.get(nbbm); | |
| 240 | - lineInfos.add(info); | |
| 363 | + for (Map.Entry<String, LineInfo> infoEntry : personMap.entrySet()) { | |
| 364 | + LineInfo lineInfo = infoEntry.getValue(); | |
| 365 | + if (lineInfo.getLineName().equals(lineName)) { | |
| 366 | + lineInfos.add(lineInfo); | |
| 367 | + } | |
| 241 | 368 | } |
| 242 | 369 | lineInfos.sort(Comparator.comparing(LineInfo::getNbbm).reversed()); |
| 243 | 370 | fleetInfo.setLineInfos(lineInfos); |
| ... | ... | @@ -249,35 +376,16 @@ public class BigViewServiceImpl implements BigViewService { |
| 249 | 376 | /** |
| 250 | 377 | * 设置车队和线路 以车队为key |
| 251 | 378 | */ |
| 252 | - private void handleFleetWithLine(Map<String, List<DriverScheduling>> map, Map<String, Map<String, List<String>>> mapVo) { | |
| 253 | - // 整合车队 | |
| 254 | - for (Map.Entry<String, List<DriverScheduling>> entry : map.entrySet()) { | |
| 255 | - // 过滤进场 系统设置出场为签到 进场为签退 | |
| 256 | - List<DriverScheduling> value = entry.getValue().stream().filter(item -> BC_TYPE_OUT.equals(item.getBcType()) && !Objects.isNull(item.getNbbm())).collect(Collectors.toList()); | |
| 257 | - if (CollectionUtil.isNotEmpty(value)) { | |
| 258 | - String fleetName = value.get(0).getFleetName(); | |
| 259 | - Map<String, List<String>> distinctMap = mapVo.get(fleetName); | |
| 260 | - if (CollectionUtil.isEmpty(distinctMap)) { | |
| 261 | - distinctMap = new HashMap<>(value.size()); | |
| 262 | - // 线路去重 | |
| 263 | - for (DriverScheduling scheduling : value) { | |
| 264 | - handleDistinctMap(distinctMap, scheduling); | |
| 265 | - } | |
| 266 | - // 把线路和自编号放入集合 | |
| 267 | - mapVo.put(fleetName, distinctMap); | |
| 268 | - } else { | |
| 269 | - for (DriverScheduling scheduling : value) { | |
| 270 | - handleDistinctMap(distinctMap, scheduling); | |
| 271 | - } | |
| 272 | - mapVo.put(fleetName, distinctMap); | |
| 273 | - } | |
| 274 | - } | |
| 275 | - } | |
| 276 | - // 对自编号进行去重 | |
| 277 | - for (Map.Entry<String, Map<String, List<String>>> entry : mapVo.entrySet()) { | |
| 278 | - Map<String, List<String>> value = entry.getValue(); | |
| 279 | - for (Map.Entry<String, List<String>> listEntry : value.entrySet()) { | |
| 280 | - listEntry.setValue(listEntry.getValue().stream().distinct().collect(Collectors.toList())); | |
| 379 | + private void handleFleetWithLine(Map<String, Map<String, String>> mapVo, List<FleetLineTemplate> templateList) { | |
| 380 | + for (FleetLineTemplate template : templateList) { | |
| 381 | + String fleetName = template.getFleetName(); | |
| 382 | + Map<String, String> fleetMap = mapVo.get(fleetName); | |
| 383 | + if (CollectionUtil.isEmpty(fleetMap)) { | |
| 384 | + Map<String, String> lineMap = new HashMap<>(); | |
| 385 | + lineMap.put(template.getLineName(), ""); | |
| 386 | + mapVo.put(fleetName, lineMap); | |
| 387 | + } else { | |
| 388 | + fleetMap.put(template.getLineName(), ""); | |
| 281 | 389 | } |
| 282 | 390 | } |
| 283 | 391 | } |
| ... | ... | @@ -310,6 +418,8 @@ public class BigViewServiceImpl implements BigViewService { |
| 310 | 418 | if (Objects.isNull(lineInfoList)) { |
| 311 | 419 | LineInfo lineInfo = new LineInfo(); |
| 312 | 420 | lineInfo.setNbbm(nbbm); |
| 421 | + lineInfo.setLineName(scheduling.getLineName()); | |
| 422 | + lineInfo.setFleetName(scheduling.getFleetName()); | |
| 313 | 423 | LineInfo.PersonInfoVo personInfoVo = getPersonInfoVo(scheduling); |
| 314 | 424 | if (DRIVER_STRING.equals(scheduling.getPosts())) { |
| 315 | 425 | lineInfo.setDriverInfoVo(personInfoVo); | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/template/controller/FleetLineTemplateController.java
0 → 100644
| 1 | +package com.ruoyi.template.controller; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import javax.servlet.http.HttpServletResponse; | |
| 5 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 8 | +import org.springframework.web.bind.annotation.PostMapping; | |
| 9 | +import org.springframework.web.bind.annotation.PutMapping; | |
| 10 | +import org.springframework.web.bind.annotation.DeleteMapping; | |
| 11 | +import org.springframework.web.bind.annotation.PathVariable; | |
| 12 | +import org.springframework.web.bind.annotation.RequestBody; | |
| 13 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 14 | +import org.springframework.web.bind.annotation.RestController; | |
| 15 | +import com.ruoyi.common.annotation.Log; | |
| 16 | +import com.ruoyi.common.core.controller.BaseController; | |
| 17 | +import com.ruoyi.common.core.domain.AjaxResult; | |
| 18 | +import com.ruoyi.common.enums.BusinessType; | |
| 19 | +import com.ruoyi.template.domain.FleetLineTemplate; | |
| 20 | +import com.ruoyi.template.service.IFleetLineTemplateService; | |
| 21 | +import com.ruoyi.common.utils.poi.ExcelUtil; | |
| 22 | +import com.ruoyi.common.core.page.TableDataInfo; | |
| 23 | + | |
| 24 | +/** | |
| 25 | + * 车队与线路对应模板Controller | |
| 26 | + * | |
| 27 | + * @author guzijian | |
| 28 | + * @date 2023-12-04 | |
| 29 | + */ | |
| 30 | +@RestController | |
| 31 | +@RequestMapping("/template/template") | |
| 32 | +public class FleetLineTemplateController extends BaseController | |
| 33 | +{ | |
| 34 | + @Autowired | |
| 35 | + private IFleetLineTemplateService fleetLineTemplateService; | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * 查询车队与线路对应模板列表 | |
| 39 | + */ | |
| 40 | + @PreAuthorize("@ss.hasPermi('template:template:list')") | |
| 41 | + @GetMapping("/list") | |
| 42 | + public TableDataInfo list(FleetLineTemplate fleetLineTemplate) | |
| 43 | + { | |
| 44 | + startPage(); | |
| 45 | + List<FleetLineTemplate> list = fleetLineTemplateService.selectFleetLineTemplateList(fleetLineTemplate); | |
| 46 | + return getDataTable(list); | |
| 47 | + } | |
| 48 | + | |
| 49 | + /** | |
| 50 | + * 导出车队与线路对应模板列表 | |
| 51 | + */ | |
| 52 | + @PreAuthorize("@ss.hasPermi('template:template:export')") | |
| 53 | + @Log(title = "车队与线路对应模板", businessType = BusinessType.EXPORT) | |
| 54 | + @PostMapping("/export") | |
| 55 | + public void export(HttpServletResponse response, FleetLineTemplate fleetLineTemplate) | |
| 56 | + { | |
| 57 | + List<FleetLineTemplate> list = fleetLineTemplateService.selectFleetLineTemplateList(fleetLineTemplate); | |
| 58 | + ExcelUtil<FleetLineTemplate> util = new ExcelUtil<FleetLineTemplate>(FleetLineTemplate.class); | |
| 59 | + util.exportExcel(response, list, "车队与线路对应模板数据"); | |
| 60 | + } | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * 获取车队与线路对应模板详细信息 | |
| 64 | + */ | |
| 65 | + @PreAuthorize("@ss.hasPermi('template:template:query')") | |
| 66 | + @GetMapping(value = "/{id}") | |
| 67 | + public AjaxResult getInfo(@PathVariable("id") String id) | |
| 68 | + { | |
| 69 | + return success(fleetLineTemplateService.selectFleetLineTemplateById(id)); | |
| 70 | + } | |
| 71 | + | |
| 72 | + /** | |
| 73 | + * 新增车队与线路对应模板 | |
| 74 | + */ | |
| 75 | + @PreAuthorize("@ss.hasPermi('template:template:add')") | |
| 76 | + @Log(title = "车队与线路对应模板", businessType = BusinessType.INSERT) | |
| 77 | + @PostMapping | |
| 78 | + public AjaxResult add(@RequestBody FleetLineTemplate fleetLineTemplate) | |
| 79 | + { | |
| 80 | + return toAjax(fleetLineTemplateService.insertFleetLineTemplate(fleetLineTemplate)); | |
| 81 | + } | |
| 82 | + | |
| 83 | + /** | |
| 84 | + * 修改车队与线路对应模板 | |
| 85 | + */ | |
| 86 | + @PreAuthorize("@ss.hasPermi('template:template:edit')") | |
| 87 | + @Log(title = "车队与线路对应模板", businessType = BusinessType.UPDATE) | |
| 88 | + @PutMapping | |
| 89 | + public AjaxResult edit(@RequestBody FleetLineTemplate fleetLineTemplate) | |
| 90 | + { | |
| 91 | + return toAjax(fleetLineTemplateService.updateFleetLineTemplate(fleetLineTemplate)); | |
| 92 | + } | |
| 93 | + | |
| 94 | + /** | |
| 95 | + * 删除车队与线路对应模板 | |
| 96 | + */ | |
| 97 | + @PreAuthorize("@ss.hasPermi('template:template:remove')") | |
| 98 | + @Log(title = "车队与线路对应模板", businessType = BusinessType.DELETE) | |
| 99 | + @DeleteMapping("/{ids}") | |
| 100 | + public AjaxResult remove(@PathVariable String[] ids) | |
| 101 | + { | |
| 102 | + return toAjax(fleetLineTemplateService.deleteFleetLineTemplateByIds(ids)); | |
| 103 | + } | |
| 104 | +} | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/template/domain/FleetLineTemplate.java
0 → 100644
| 1 | +package com.ruoyi.template.domain; | |
| 2 | + | |
| 3 | +import org.apache.commons.lang3.builder.ToStringBuilder; | |
| 4 | +import org.apache.commons.lang3.builder.ToStringStyle; | |
| 5 | +import com.ruoyi.common.annotation.Excel; | |
| 6 | +import com.ruoyi.common.core.domain.BaseEntity; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 车队与线路对应模板对象 fleet_line_template | |
| 10 | + * | |
| 11 | + * @author guzijian | |
| 12 | + * @date 2023-12-04 | |
| 13 | + */ | |
| 14 | +public class FleetLineTemplate extends BaseEntity | |
| 15 | +{ | |
| 16 | + private static final long serialVersionUID = 1L; | |
| 17 | + | |
| 18 | + /** 模板id */ | |
| 19 | + private Integer id; | |
| 20 | + | |
| 21 | + /** 车队名称 */ | |
| 22 | + @Excel(name = "车队名称") | |
| 23 | + private String fleetName; | |
| 24 | + | |
| 25 | + /** 线路名称 */ | |
| 26 | + @Excel(name = "线路名称") | |
| 27 | + private String lineName; | |
| 28 | + | |
| 29 | + public void setId(Integer id) | |
| 30 | + { | |
| 31 | + this.id = id; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public Integer getId() | |
| 35 | + { | |
| 36 | + return id; | |
| 37 | + } | |
| 38 | + public void setFleetName(String fleetName) | |
| 39 | + { | |
| 40 | + this.fleetName = fleetName; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public String getFleetName() | |
| 44 | + { | |
| 45 | + return fleetName; | |
| 46 | + } | |
| 47 | + public void setLineName(String lineName) | |
| 48 | + { | |
| 49 | + this.lineName = lineName; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public String getLineName() | |
| 53 | + { | |
| 54 | + return lineName; | |
| 55 | + } | |
| 56 | + | |
| 57 | + @Override | |
| 58 | + public String toString() { | |
| 59 | + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) | |
| 60 | + .append("id", getId()) | |
| 61 | + .append("fleetName", getFleetName()) | |
| 62 | + .append("lineName", getLineName()) | |
| 63 | + .append("createTime", getCreateTime()) | |
| 64 | + .append("updateTime", getUpdateTime()) | |
| 65 | + .append("createBy", getCreateBy()) | |
| 66 | + .append("updateBy", getUpdateBy()) | |
| 67 | + .append("remark", getRemark()) | |
| 68 | + .toString(); | |
| 69 | + } | |
| 70 | +} | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/template/mapper/FleetLineTemplateMapper.java
0 → 100644
| 1 | +package com.ruoyi.template.mapper; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | + | |
| 5 | +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; | |
| 6 | +import com.ruoyi.template.domain.FleetLineTemplate; | |
| 7 | +import org.apache.ibatis.annotations.Delete; | |
| 8 | +import org.apache.ibatis.annotations.Param; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * 车队与线路对应模板Mapper接口 | |
| 12 | + * | |
| 13 | + * @author guzijian | |
| 14 | + * @date 2023-12-04 | |
| 15 | + */ | |
| 16 | +public interface FleetLineTemplateMapper | |
| 17 | +{ | |
| 18 | + /** | |
| 19 | + * 查询车队与线路对应模板 | |
| 20 | + * | |
| 21 | + * @param id 车队与线路对应模板主键 | |
| 22 | + * @return 车队与线路对应模板 | |
| 23 | + */ | |
| 24 | + public FleetLineTemplate selectFleetLineTemplateById(String id); | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * 查询车队与线路对应模板列表 | |
| 28 | + * | |
| 29 | + * @param fleetLineTemplate 车队与线路对应模板 | |
| 30 | + * @return 车队与线路对应模板集合 | |
| 31 | + */ | |
| 32 | + public List<FleetLineTemplate> selectFleetLineTemplateList(FleetLineTemplate fleetLineTemplate); | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * 新增车队与线路对应模板 | |
| 36 | + * | |
| 37 | + * @param fleetLineTemplate 车队与线路对应模板 | |
| 38 | + * @return 结果 | |
| 39 | + */ | |
| 40 | + public int insertFleetLineTemplate(FleetLineTemplate fleetLineTemplate); | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * 修改车队与线路对应模板 | |
| 44 | + * | |
| 45 | + * @param fleetLineTemplate 车队与线路对应模板 | |
| 46 | + * @return 结果 | |
| 47 | + */ | |
| 48 | + public int updateFleetLineTemplate(FleetLineTemplate fleetLineTemplate); | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * 删除车队与线路对应模板 | |
| 52 | + * | |
| 53 | + * @param id 车队与线路对应模板主键 | |
| 54 | + * @return 结果 | |
| 55 | + */ | |
| 56 | + public int deleteFleetLineTemplateById(String id); | |
| 57 | + | |
| 58 | + /** | |
| 59 | + * 批量删除车队与线路对应模板 | |
| 60 | + * | |
| 61 | + * @param ids 需要删除的数据主键集合 | |
| 62 | + * @return 结果 | |
| 63 | + */ | |
| 64 | + public int deleteFleetLineTemplateByIds(String[] ids); | |
| 65 | + | |
| 66 | + @Delete("delete from fleet_line_template") | |
| 67 | + @InterceptorIgnore(blockAttack = "true") | |
| 68 | + void deleteAllTemplate(); | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * 导入模板 | |
| 72 | + */ | |
| 73 | + void insertBatch(@Param("list") List<FleetLineTemplate> templateList); | |
| 74 | + | |
| 75 | +} | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/template/service/IFleetLineTemplateService.java
0 → 100644
| 1 | +package com.ruoyi.template.service; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import com.ruoyi.template.domain.FleetLineTemplate; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * 车队与线路对应模板Service接口 | |
| 8 | + * | |
| 9 | + * @author guzijian | |
| 10 | + * @date 2023-12-04 | |
| 11 | + */ | |
| 12 | +public interface IFleetLineTemplateService | |
| 13 | +{ | |
| 14 | + /** | |
| 15 | + * 查询车队与线路对应模板 | |
| 16 | + * | |
| 17 | + * @param id 车队与线路对应模板主键 | |
| 18 | + * @return 车队与线路对应模板 | |
| 19 | + */ | |
| 20 | + public FleetLineTemplate selectFleetLineTemplateById(String id); | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 查询车队与线路对应模板列表 | |
| 24 | + * | |
| 25 | + * @param fleetLineTemplate 车队与线路对应模板 | |
| 26 | + * @return 车队与线路对应模板集合 | |
| 27 | + */ | |
| 28 | + public List<FleetLineTemplate> selectFleetLineTemplateList(FleetLineTemplate fleetLineTemplate); | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 新增车队与线路对应模板 | |
| 32 | + * | |
| 33 | + * @param fleetLineTemplate 车队与线路对应模板 | |
| 34 | + * @return 结果 | |
| 35 | + */ | |
| 36 | + public int insertFleetLineTemplate(FleetLineTemplate fleetLineTemplate); | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * 修改车队与线路对应模板 | |
| 40 | + * | |
| 41 | + * @param fleetLineTemplate 车队与线路对应模板 | |
| 42 | + * @return 结果 | |
| 43 | + */ | |
| 44 | + public int updateFleetLineTemplate(FleetLineTemplate fleetLineTemplate); | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * 批量删除车队与线路对应模板 | |
| 48 | + * | |
| 49 | + * @param ids 需要删除的车队与线路对应模板主键集合 | |
| 50 | + * @return 结果 | |
| 51 | + */ | |
| 52 | + public int deleteFleetLineTemplateByIds(String[] ids); | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 删除车队与线路对应模板信息 | |
| 56 | + * | |
| 57 | + * @param id 车队与线路对应模板主键 | |
| 58 | + * @return 结果 | |
| 59 | + */ | |
| 60 | + public int deleteFleetLineTemplateById(String id); | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * 删除模板表所有数据 | |
| 64 | + */ | |
| 65 | + void deleteAllTemplate(); | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * 导入模板 | |
| 69 | + * @param templateList | |
| 70 | + */ | |
| 71 | + void insertBatch(List<FleetLineTemplate> templateList); | |
| 72 | +} | ... | ... |
Bsth-admin/src/main/java/com/ruoyi/template/service/impl/FleetLineTemplateServiceImpl.java
0 → 100644
| 1 | +package com.ruoyi.template.service.impl; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | +import com.ruoyi.common.utils.DateUtils; | |
| 5 | +import com.ruoyi.common.utils.SecurityUtils; | |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | +import org.springframework.stereotype.Service; | |
| 8 | +import com.ruoyi.template.mapper.FleetLineTemplateMapper; | |
| 9 | +import com.ruoyi.template.domain.FleetLineTemplate; | |
| 10 | +import com.ruoyi.template.service.IFleetLineTemplateService; | |
| 11 | + | |
| 12 | +/** | |
| 13 | + * 车队与线路对应模板Service业务层处理 | |
| 14 | + * | |
| 15 | + * @author guzijian | |
| 16 | + * @date 2023-12-04 | |
| 17 | + */ | |
| 18 | +@Service | |
| 19 | +public class FleetLineTemplateServiceImpl implements IFleetLineTemplateService | |
| 20 | +{ | |
| 21 | + @Autowired | |
| 22 | + private FleetLineTemplateMapper fleetLineTemplateMapper; | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * 查询车队与线路对应模板 | |
| 26 | + * | |
| 27 | + * @param id 车队与线路对应模板主键 | |
| 28 | + * @return 车队与线路对应模板 | |
| 29 | + */ | |
| 30 | + @Override | |
| 31 | + public FleetLineTemplate selectFleetLineTemplateById(String id) | |
| 32 | + { | |
| 33 | + return fleetLineTemplateMapper.selectFleetLineTemplateById(id); | |
| 34 | + } | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * 查询车队与线路对应模板列表 | |
| 38 | + * | |
| 39 | + * @param fleetLineTemplate 车队与线路对应模板 | |
| 40 | + * @return 车队与线路对应模板 | |
| 41 | + */ | |
| 42 | + @Override | |
| 43 | + public List<FleetLineTemplate> selectFleetLineTemplateList(FleetLineTemplate fleetLineTemplate) | |
| 44 | + { | |
| 45 | + return fleetLineTemplateMapper.selectFleetLineTemplateList(fleetLineTemplate); | |
| 46 | + } | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * 新增车队与线路对应模板 | |
| 50 | + * | |
| 51 | + * @param fleetLineTemplate 车队与线路对应模板 | |
| 52 | + * @return 结果 | |
| 53 | + */ | |
| 54 | + @Override | |
| 55 | + public int insertFleetLineTemplate(FleetLineTemplate fleetLineTemplate) | |
| 56 | + { | |
| 57 | + fleetLineTemplate.setCreateTime(DateUtils.getNowDate()); | |
| 58 | + fleetLineTemplate.setCreateBy(SecurityUtils.getUsername()); | |
| 59 | + return fleetLineTemplateMapper.insertFleetLineTemplate(fleetLineTemplate); | |
| 60 | + } | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * 修改车队与线路对应模板 | |
| 64 | + * | |
| 65 | + * @param fleetLineTemplate 车队与线路对应模板 | |
| 66 | + * @return 结果 | |
| 67 | + */ | |
| 68 | + @Override | |
| 69 | + public int updateFleetLineTemplate(FleetLineTemplate fleetLineTemplate) | |
| 70 | + { | |
| 71 | + fleetLineTemplate.setUpdateTime(DateUtils.getNowDate()); | |
| 72 | + fleetLineTemplate.setUpdateBy(SecurityUtils.getUsername()); | |
| 73 | + return fleetLineTemplateMapper.updateFleetLineTemplate(fleetLineTemplate); | |
| 74 | + } | |
| 75 | + | |
| 76 | + /** | |
| 77 | + * 批量删除车队与线路对应模板 | |
| 78 | + * | |
| 79 | + * @param ids 需要删除的车队与线路对应模板主键 | |
| 80 | + * @return 结果 | |
| 81 | + */ | |
| 82 | + @Override | |
| 83 | + public int deleteFleetLineTemplateByIds(String[] ids) | |
| 84 | + { | |
| 85 | + return fleetLineTemplateMapper.deleteFleetLineTemplateByIds(ids); | |
| 86 | + } | |
| 87 | + | |
| 88 | + /** | |
| 89 | + * 删除车队与线路对应模板信息 | |
| 90 | + * | |
| 91 | + * @param id 车队与线路对应模板主键 | |
| 92 | + * @return 结果 | |
| 93 | + */ | |
| 94 | + @Override | |
| 95 | + public int deleteFleetLineTemplateById(String id) | |
| 96 | + { | |
| 97 | + return fleetLineTemplateMapper.deleteFleetLineTemplateById(id); | |
| 98 | + } | |
| 99 | + | |
| 100 | + @Override | |
| 101 | + public void deleteAllTemplate() { | |
| 102 | + fleetLineTemplateMapper.deleteAllTemplate(); | |
| 103 | + } | |
| 104 | + | |
| 105 | + @Override | |
| 106 | + public void insertBatch(List<FleetLineTemplate> templateList) { | |
| 107 | + fleetLineTemplateMapper.insertBatch(templateList); | |
| 108 | + } | |
| 109 | +} | ... | ... |
Bsth-admin/src/main/resources/application-druid-dev.yml
Bsth-admin/src/main/resources/application-druid-prd.yml
Bsth-admin/src/main/resources/application-druid-uat.yml
Bsth-admin/src/main/resources/mapper/template/FleetLineTemplateMapper.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8" ?> | |
| 2 | +<!DOCTYPE mapper | |
| 3 | +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |
| 4 | +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 5 | +<mapper namespace="com.ruoyi.template.mapper.FleetLineTemplateMapper"> | |
| 6 | + | |
| 7 | + <resultMap type="FleetLineTemplate" id="FleetLineTemplateResult"> | |
| 8 | + <result property="id" column="id" /> | |
| 9 | + <result property="fleetName" column="fleet_name" /> | |
| 10 | + <result property="lineName" column="line_name" /> | |
| 11 | + <result property="createTime" column="create_time" /> | |
| 12 | + <result property="updateTime" column="update_time" /> | |
| 13 | + <result property="createBy" column="create_by" /> | |
| 14 | + <result property="updateBy" column="update_by" /> | |
| 15 | + <result property="remark" column="remark" /> | |
| 16 | + </resultMap> | |
| 17 | + | |
| 18 | + <sql id="selectFleetLineTemplateVo"> | |
| 19 | + select id, fleet_name, line_name, create_time, update_time, create_by, update_by, remark from fleet_line_template | |
| 20 | + </sql> | |
| 21 | + | |
| 22 | + <select id="selectFleetLineTemplateList" parameterType="FleetLineTemplate" resultMap="FleetLineTemplateResult"> | |
| 23 | + <include refid="selectFleetLineTemplateVo"/> | |
| 24 | + <where> | |
| 25 | + <if test="fleetName != null and fleetName != ''"> and fleet_name like concat('%', #{fleetName}, '%')</if> | |
| 26 | + <if test="lineName != null and lineName != ''"> and line_name like concat('%', #{lineName}, '%')</if> | |
| 27 | + </where> | |
| 28 | + </select> | |
| 29 | + | |
| 30 | + <select id="selectFleetLineTemplateById" parameterType="String" resultMap="FleetLineTemplateResult"> | |
| 31 | + <include refid="selectFleetLineTemplateVo"/> | |
| 32 | + where id = #{id} | |
| 33 | + </select> | |
| 34 | + | |
| 35 | + <insert id="insertFleetLineTemplate" parameterType="FleetLineTemplate"> | |
| 36 | + insert into fleet_line_template | |
| 37 | + <trim prefix="(" suffix=")" suffixOverrides=","> | |
| 38 | + <if test="id != null">id,</if> | |
| 39 | + <if test="fleetName != null">fleet_name,</if> | |
| 40 | + <if test="lineName != null">line_name,</if> | |
| 41 | + <if test="createTime != null">create_time,</if> | |
| 42 | + <if test="updateTime != null">update_time,</if> | |
| 43 | + <if test="createBy != null">create_by,</if> | |
| 44 | + <if test="updateBy != null">update_by,</if> | |
| 45 | + <if test="remark != null">remark,</if> | |
| 46 | + </trim> | |
| 47 | + <trim prefix="values (" suffix=")" suffixOverrides=","> | |
| 48 | + <if test="id != null">#{id},</if> | |
| 49 | + <if test="fleetName != null">#{fleetName},</if> | |
| 50 | + <if test="lineName != null">#{lineName},</if> | |
| 51 | + <if test="createTime != null">#{createTime},</if> | |
| 52 | + <if test="updateTime != null">#{updateTime},</if> | |
| 53 | + <if test="createBy != null">#{createBy},</if> | |
| 54 | + <if test="updateBy != null">#{updateBy},</if> | |
| 55 | + <if test="remark != null">#{remark},</if> | |
| 56 | + </trim> | |
| 57 | + </insert> | |
| 58 | + | |
| 59 | + <insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id" keyProperty="id"> | |
| 60 | + insert into fleet_line_template (fleet_name, line_name, create_time, update_time, create_by, update_by, remark) | |
| 61 | + values | |
| 62 | + <foreach collection="list" item="item" separator="," > | |
| 63 | + ( | |
| 64 | + #{item.fleetName}, | |
| 65 | + #{item.lineName}, | |
| 66 | + #{item.createTime}, | |
| 67 | + #{item.updateTime}, | |
| 68 | + #{item.createBy}, | |
| 69 | + #{item.updateBy}, | |
| 70 | + #{item.remark} | |
| 71 | + ) | |
| 72 | + </foreach> | |
| 73 | + </insert> | |
| 74 | + | |
| 75 | + <update id="updateFleetLineTemplate" parameterType="FleetLineTemplate"> | |
| 76 | + update fleet_line_template | |
| 77 | + <trim prefix="SET" suffixOverrides=","> | |
| 78 | + <if test="fleetName != null">fleet_name = #{fleetName},</if> | |
| 79 | + <if test="lineName != null">line_name = #{lineName},</if> | |
| 80 | + <if test="createTime != null">create_time = #{createTime},</if> | |
| 81 | + <if test="updateTime != null">update_time = #{updateTime},</if> | |
| 82 | + <if test="createBy != null">create_by = #{createBy},</if> | |
| 83 | + <if test="updateBy != null">update_by = #{updateBy},</if> | |
| 84 | + <if test="remark != null">remark = #{remark},</if> | |
| 85 | + </trim> | |
| 86 | + where id = #{id} | |
| 87 | + </update> | |
| 88 | + | |
| 89 | + <delete id="deleteFleetLineTemplateById" parameterType="String"> | |
| 90 | + delete from fleet_line_template where id = #{id} | |
| 91 | + </delete> | |
| 92 | + | |
| 93 | + <delete id="deleteFleetLineTemplateByIds" parameterType="String"> | |
| 94 | + delete from fleet_line_template where id in | |
| 95 | + <foreach item="id" collection="array" open="(" separator="," close=")"> | |
| 96 | + #{id} | |
| 97 | + </foreach> | |
| 98 | + </delete> | |
| 99 | +</mapper> | |
| 0 | 100 | \ No newline at end of file | ... | ... |