Merge branch 'develop' of http://112.74.186.154:3000/nflg/mobilebroken into develop
This commit is contained in:
commit
873af20e90
|
|
@ -26,4 +26,12 @@ public class Constant {
|
|||
* 职位编码前缀
|
||||
*/
|
||||
public static final String JobCodePrefix="JOB";
|
||||
|
||||
|
||||
/**
|
||||
* 部件编码前缀
|
||||
*/
|
||||
public static final String PartCodePrefix="BJ";
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,156 @@
|
|||
package com.nflg.mobilebroken.admin.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.mobilebroken.admin.annotation.ApiMark;
|
||||
import com.nflg.mobilebroken.admin.pojo.dto.BasePartDTO;
|
||||
import com.nflg.mobilebroken.admin.pojo.dto.CustomerDTO;
|
||||
import com.nflg.mobilebroken.admin.pojo.query.DepartmentQuery;
|
||||
import com.nflg.mobilebroken.admin.pojo.query.PartQuery;
|
||||
import com.nflg.mobilebroken.admin.pojo.vo.BaseDepartmentVO;
|
||||
import com.nflg.mobilebroken.admin.pojo.vo.DeviceExcelVO;
|
||||
import com.nflg.mobilebroken.admin.service.AdminBasePartService;
|
||||
import com.nflg.mobilebroken.common.constant.STATE;
|
||||
import com.nflg.mobilebroken.common.pojo.ApiResult;
|
||||
import com.nflg.mobilebroken.common.pojo.PageData;
|
||||
import com.nflg.mobilebroken.common.pojo.dto.ExportPartDTO;
|
||||
import com.nflg.mobilebroken.common.util.EecExcelUtil;
|
||||
import com.nflg.mobilebroken.common.util.VUtils;
|
||||
import com.nflg.mobilebroken.repository.entity.DeviceComponentDetail;
|
||||
import com.nflg.mobilebroken.repository.entity.Language;
|
||||
import com.nflg.mobilebroken.repository.entity.TBasePart;
|
||||
import com.nflg.mobilebroken.repository.service.IDeviceComponentDetailService;
|
||||
import com.nflg.mobilebroken.repository.service.ILanguageService;
|
||||
import com.nflg.mobilebroken.repository.service.ITBasePartService;
|
||||
import com.nflg.mobilebroken.starter.annotation.MethodInfoMark;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.ttzero.excel.entity.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* 部件管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/part")
|
||||
@Slf4j
|
||||
@RefreshScope
|
||||
public class BasePartController extends ControllerBase{
|
||||
|
||||
@Resource
|
||||
ITBasePartService partService;
|
||||
|
||||
@Resource
|
||||
AdminBasePartService adminBasePartService;
|
||||
|
||||
@Resource
|
||||
IDeviceComponentDetailService componentDetailService;
|
||||
|
||||
@Resource
|
||||
ILanguageService languageService;
|
||||
/**
|
||||
* 获取部件列表
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("getList")
|
||||
@ApiMark(moduleName = "部门管理", apiName = "获取部门列表")
|
||||
public ApiResult<PageData<TBasePart>> getList(@RequestBody PartQuery query){
|
||||
Page<TBasePart> result = partService.selectListByPage(query);
|
||||
return ApiResult.success(result.getRecords(),query,result.getTotal());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存 id>0 时为修改
|
||||
* @param basePartDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("save")
|
||||
@MethodInfoMark(value = "保存" ,menuName = "部件管理")
|
||||
public ApiResult<Boolean> save(@Valid @RequestBody BasePartDTO basePartDTO) {
|
||||
|
||||
adminBasePartService.save(basePartDTO);
|
||||
return ApiResult.success(true);
|
||||
}
|
||||
|
||||
@PostMapping("del")
|
||||
@MethodInfoMark(value = "删除" ,menuName = "部件管理")
|
||||
public ApiResult<Boolean> del(@RequestBody List<Integer> ids) {
|
||||
VUtils.trueThrow(CollUtil.isEmpty(ids)).throwMessage(STATE.ParamErr,"请选择要删除的行");
|
||||
//检查部件是否已挂载到设备机型下
|
||||
List<DeviceComponentDetail> deviceParts = componentDetailService.lambdaQuery().in(DeviceComponentDetail::getModelPartId, ids).select(DeviceComponentDetail::getModelPartName).list();
|
||||
if(CollUtil.isNotEmpty(deviceParts)){
|
||||
List<String> partNames = deviceParts.stream().map(u -> u.getModelPartName()).collect(Collectors.toList());
|
||||
VUtils.trueThrow(CollUtil.isNotEmpty(partNames)).throwMessage(STATE.ParamErr, StrUtil.join(",",partNames)+"已挂在设备机型下,无法删除");
|
||||
}
|
||||
partService.getBaseMapper().deleteByIds(ids);
|
||||
return ApiResult.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出
|
||||
* @param query
|
||||
* @param response
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("exportData")
|
||||
|
||||
public void exportData(@RequestBody PartQuery query, HttpServletResponse response) throws IOException {
|
||||
EecExcelUtil.setResponseExcelHeader(response,"部件列表");
|
||||
List<ExportPartDTO> result = partService.exportPart(query.getPartNo(), query.getPartName());
|
||||
Map<String, List<ExportPartDTO>> map = result.stream()
|
||||
.collect(Collectors.groupingBy(ExportPartDTO::getPartName));
|
||||
List<Map<String,String>> excelData=new ArrayList<>();
|
||||
|
||||
for (String key : map.keySet()) {
|
||||
Map<String,String> mp=new HashMap<>();
|
||||
mp.put("部件名称",key);
|
||||
List<ExportPartDTO> dataList = map.get(key);
|
||||
dataList.forEach(u->{
|
||||
mp.put(u.getLanguageName(),u.getLanguageValue());
|
||||
});
|
||||
excelData.add(mp);
|
||||
}
|
||||
new Workbook().addSheet(new ListMapSheet("部件列表", excelData,adminBasePartService.buildExcelHeaderColumn()))//
|
||||
.writeTo(response.getOutputStream());
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("downTemplate")
|
||||
@ApiMark(moduleName = "部件管理", apiName = "下载导入模板")
|
||||
// @MethodInfoMark(value = "导入模板下载",menuName = "设备管理")
|
||||
public void downTemplate(HttpServletResponse response) throws IOException {
|
||||
EecExcelUtil.setResponseExcelHeader(response,"设备导入模板");
|
||||
List<Object> rows = new ArrayList<>();
|
||||
rows.add(adminBasePartService.buildExcelHeader());
|
||||
new Workbook()
|
||||
.addSheet(new SimpleSheet<>(rows)) //
|
||||
.writeTo(response.getOutputStream());
|
||||
}
|
||||
|
||||
@PostMapping("importData")
|
||||
@ApiMark(moduleName = "部件管理", apiName = "导入")
|
||||
public ApiResult<Boolean> importData( @RequestParam(value = "file") MultipartFile file){
|
||||
|
||||
return ApiResult.success(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -5,10 +5,13 @@ import cn.hutool.core.collection.CollUtil;
|
|||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.nflg.mobilebroken.admin.annotation.ApiMark;
|
||||
import com.nflg.mobilebroken.admin.pojo.dto.DeviceComponentDTO;
|
||||
import com.nflg.mobilebroken.admin.pojo.dto.DeviceComponentDetailDTO;
|
||||
import com.nflg.mobilebroken.admin.pojo.query.DeviceComponentQuery;
|
||||
import com.nflg.mobilebroken.admin.pojo.vo.DeviceExcelVO;
|
||||
import com.nflg.mobilebroken.common.constant.STATE;
|
||||
import com.nflg.mobilebroken.common.exception.NflgException;
|
||||
import com.nflg.mobilebroken.common.pojo.ApiResult;
|
||||
|
|
@ -19,8 +22,10 @@ import com.nflg.mobilebroken.common.util.EecExcelUtil;
|
|||
import com.nflg.mobilebroken.common.util.VUtils;
|
||||
import com.nflg.mobilebroken.repository.entity.DeviceComponent;
|
||||
import com.nflg.mobilebroken.repository.entity.DeviceComponentDetail;
|
||||
import com.nflg.mobilebroken.repository.entity.TBasePart;
|
||||
import com.nflg.mobilebroken.repository.service.IDeviceComponentDetailService;
|
||||
import com.nflg.mobilebroken.repository.service.IDeviceComponentService;
|
||||
import com.nflg.mobilebroken.repository.service.ITBasePartService;
|
||||
import com.nflg.mobilebroken.starter.annotation.MethodInfoMark;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -33,8 +38,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -50,6 +54,9 @@ public class DeviceComponentController extends ControllerBase {
|
|||
@Resource
|
||||
IDeviceComponentDetailService deviceComponentDetailService;
|
||||
|
||||
@Resource
|
||||
ITBasePartService basePartService;
|
||||
|
||||
/**
|
||||
* 获取机型部件列表
|
||||
* @param query
|
||||
|
|
@ -59,6 +66,9 @@ public class DeviceComponentController extends ControllerBase {
|
|||
@ApiMark(moduleName = "机型部件管理", apiName = "获取设备机型列表")
|
||||
public ApiResult<PageData<DeviceComponent>> getList(@RequestBody DeviceComponentQuery query){
|
||||
Page<DeviceComponent> result = deviceComponentService.selectListByPage(query);
|
||||
result.getRecords().forEach(u->{
|
||||
u.setPartList(deviceComponentDetailService.lambdaQuery().eq(DeviceComponentDetail::getDeviceComponentId,u.getId()).list());
|
||||
});
|
||||
return ApiResult.success(result.getRecords(),query,result.getTotal());
|
||||
}
|
||||
|
||||
|
|
@ -76,9 +86,11 @@ public class DeviceComponentController extends ControllerBase {
|
|||
List<DeviceComponentDetail> result = deviceComponentDetailService.lambdaQuery()
|
||||
.eq(DeviceComponentDetail::getDeviceComponentId, deviceComponentId)
|
||||
.list();
|
||||
return ApiResult.success(result != null ?
|
||||
Convert.toList(DeviceComponentDetailDTO.class, result) :
|
||||
Collections.emptyList());
|
||||
if(CollUtil.isNotEmpty(result)) {
|
||||
List<TBasePart> tBaseParts = basePartService.getBaseMapper().selectByIds(result.stream().map(u -> u.getModelPartId()).collect(Collectors.toList()));
|
||||
return ApiResult.success(Convert.toList(DeviceComponentDetailDTO.class,tBaseParts) );
|
||||
}
|
||||
return ApiResult.success(Collections.emptyList());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -96,16 +108,22 @@ public class DeviceComponentController extends ControllerBase {
|
|||
throw new NflgException(STATE.ParamErr,"机型部件不能为空");
|
||||
}
|
||||
DeviceComponent ent = Convert.convert(DeviceComponent.class, component);
|
||||
List<String> compinets = component.getComponent().stream().map(u -> u.getModelPartName()).collect(Collectors.toList());
|
||||
List<String> compinets = component.getComponent().stream().map(u -> u.getPartName()).collect(Collectors.toList());
|
||||
ent.setComponent(StrUtil.join(",",compinets));
|
||||
|
||||
List<DeviceComponentDetail> deviceComponentDetails = Convert.toList(DeviceComponentDetail.class, component.getComponent());
|
||||
List<DeviceComponentDetail> deviceComponentDetails = new ArrayList<>();
|
||||
component.getComponent().forEach(u->{
|
||||
DeviceComponentDetail et=new DeviceComponentDetail();
|
||||
et.setModelPartId(u.getId());
|
||||
et.setModelPartName(u.getPartName());
|
||||
et.setCreateBy(AdminUserUtil.getUserName());
|
||||
et.setCreateTime(LocalDateTime.now());
|
||||
et.setDeviceComponentId(component.getId());
|
||||
deviceComponentDetails.add(et);
|
||||
});
|
||||
ent.setUpdateBy(AdminUserUtil.getUserName());
|
||||
ent.setUpdateTime(LocalDateTime.now());
|
||||
deviceComponentService.updateById(ent);
|
||||
deviceComponentDetails.forEach(u->{
|
||||
u.setDeviceComponentId(component.getId());
|
||||
});
|
||||
deviceComponentDetailService.delByComponentId(component.getId());
|
||||
deviceComponentDetailService.saveBatch(deviceComponentDetails);
|
||||
return ApiResult.success(true);
|
||||
|
|
@ -130,6 +148,26 @@ public class DeviceComponentController extends ControllerBase {
|
|||
return ApiResult.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 模板下载
|
||||
* @param response
|
||||
* @throws IOException
|
||||
*/
|
||||
@GetMapping("downTemplate")
|
||||
@ApiMark(moduleName = "机型部件", apiName = "导入模板下载")
|
||||
// @MethodInfoMark(value = "导入模板下载",menuName = "设备管理")
|
||||
public void downTemplate(HttpServletResponse response) throws IOException {
|
||||
EecExcelUtil.setResponseExcelHeader(response,"机型部件导入模板");
|
||||
|
||||
final ListSheet<DevComponentExcel> listSheet = new ListSheet<DevComponentExcel>() {
|
||||
@Override
|
||||
protected List<DevComponentExcel> more() {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
EecExcelUtil.eecExcel("机型部件导入模板", listSheet, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入部件
|
||||
* @param file
|
||||
|
|
@ -142,6 +180,51 @@ public class DeviceComponentController extends ControllerBase {
|
|||
try {
|
||||
List<DevComponentExcel> data = EecExcelUtil.getExcelContext(file.getInputStream(), DevComponentExcel.class);
|
||||
VUtils.trueThrowBusinessError(CollUtil.isEmpty(data)).throwMessage("导入文件内容为空");
|
||||
Set<String> modeNos = data.stream().map(u -> u.getModelNo()).collect(Collectors.toSet());
|
||||
List<DeviceComponent> extstsModes = deviceComponentService.lambdaQuery().in(DeviceComponent::getModelNo).list();
|
||||
Set<String> extstsModesSet = extstsModes.stream().map(u -> u.getModelNo()).collect(Collectors.toSet());
|
||||
Set<String> difference = Sets.difference(modeNos, extstsModesSet);
|
||||
VUtils.trueThrow(CollUtil.isNotEmpty(difference)).throwMessage(STATE.ParamErr, StrUtil.join(",", difference)+" 设备机型不存");
|
||||
//检查部件是否存在
|
||||
Set<String> partNames = data.stream().map(u -> u.getModelPartName()).collect(Collectors.toSet());
|
||||
List<TBasePart> exitsParts = basePartService.lambdaQuery().in(TBasePart::getPartName, partNames).list();
|
||||
Set<String> exitsPartSet = exitsParts.stream().map(u -> u.getPartName()).collect(Collectors.toSet());
|
||||
Set<String> diffParts = Sets.difference(partNames, exitsPartSet);
|
||||
VUtils.trueThrow(CollUtil.isNotEmpty(diffParts)).throwMessage(STATE.ParamErr,StrUtil.join(",", diffParts)+" 部门名称不存在,请在部件管理中维护");
|
||||
|
||||
Map<String, List<DevComponentExcel>> dataMap = data.stream().collect(Collectors.groupingBy(DevComponentExcel::getModelNo));
|
||||
Map<String, DeviceComponent> extstsModeMap = extstsModes.stream().collect(Collectors.toMap(DeviceComponent::getModelNo, u -> u));
|
||||
Map<String, TBasePart> exitsPartMap = exitsParts.stream().collect(Collectors.toMap(TBasePart::getPartName, u -> u));
|
||||
|
||||
List<DeviceComponentDetail> result=new ArrayList<>();
|
||||
List<DeviceComponent> deviceComponentResult=new ArrayList<>();
|
||||
for (String key :dataMap.keySet()) {
|
||||
List<DevComponentExcel> componments = dataMap.get(key);
|
||||
DeviceComponent dev=new DeviceComponent();
|
||||
dev.setId(extstsModeMap.get(key).getId());
|
||||
dev.setComponent(StrUtil.join(",", componments.stream().map(u->u.getModelPartName()).collect(Collectors.toSet())));
|
||||
deviceComponentResult.add(dev);
|
||||
//删除现有部件
|
||||
deviceComponentDetailService.removeByMap(ImmutableMap.of("device_component_id",dev.getId()));
|
||||
for (DevComponentExcel componment : componments) {
|
||||
DeviceComponentDetail ent=new DeviceComponentDetail();
|
||||
ent.setDeviceComponentId(extstsModeMap.get(key).getId());
|
||||
ent.setModelPartId(exitsPartMap.get(componment.getModelPartName()).getId());
|
||||
ent.setModelPartName(componment.getModelPartName());
|
||||
ent.setCreateBy(AdminUserUtil.getUserName());
|
||||
ent.setCreateTime(LocalDateTime.now());
|
||||
result.add(ent);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if(CollUtil.isNotEmpty(deviceComponentResult)){
|
||||
deviceComponentService.saveOrUpdateBatch(deviceComponentResult);
|
||||
}
|
||||
if(CollUtil.isNotEmpty(result)){
|
||||
deviceComponentDetailService.saveOrUpdateBatch(result);
|
||||
}
|
||||
|
||||
deviceComponentService.saveOrUpdateBatchComponent(Convert.toList(DeviceComponent.class, data));
|
||||
|
||||
} catch (IOException e) {
|
||||
|
|
@ -160,14 +243,13 @@ public class DeviceComponentController extends ControllerBase {
|
|||
@ApiMark(moduleName = "机型部件管理", apiName = "导出部件")
|
||||
public void exportData(HttpServletResponse response) throws IOException {
|
||||
EecExcelUtil.setResponseExcelHeader(response,"部件列表");
|
||||
List<DeviceComponent> list = deviceComponentService.list();
|
||||
List<DevComponentExcel> list = deviceComponentService.getExportData();
|
||||
if(CollUtil.isEmpty(list)) {
|
||||
throw new NflgException(STATE.BusinessError, "没有可导出的数据");
|
||||
}
|
||||
try {
|
||||
List<DevComponentExcel> excelList = Convert.toList(DevComponentExcel.class, list);
|
||||
new Workbook("部件列表", "")
|
||||
.addSheet(new ListSheet<>("sheet1", excelList))
|
||||
.addSheet(new ListSheet<>("sheet1", list))
|
||||
.writeTo(response.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
throw new NflgException(STATE.BusinessError, "导出失败:" + e.getMessage());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
package com.nflg.mobilebroken.admin.pojo.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.nflg.mobilebroken.admin.pojo.vo.PositionLanguageVO;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class BasePartDTO {
|
||||
|
||||
/**
|
||||
* id 自增id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 部件名称
|
||||
*/
|
||||
private String partName;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 状态 0-禁用 1-启用
|
||||
*/
|
||||
private Integer enable;
|
||||
|
||||
/**
|
||||
* 职位语言
|
||||
*/
|
||||
List<PositionLanguageVO> language;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -7,12 +7,18 @@ import lombok.Data;
|
|||
public class DeviceComponentDetailDTO {
|
||||
|
||||
/**
|
||||
* 部件ID
|
||||
* id 自增id
|
||||
*/
|
||||
private Integer modelPartId;
|
||||
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 部件编码
|
||||
*/
|
||||
private String partNo;
|
||||
|
||||
/**
|
||||
* 部件名称
|
||||
*/
|
||||
private String modelPartName;
|
||||
private String partName;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package com.nflg.mobilebroken.admin.pojo.query;
|
||||
|
||||
import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
public class PartQuery extends PageBaseQuery {
|
||||
|
||||
/**
|
||||
* 部件编码
|
||||
*/
|
||||
private String partNo;
|
||||
|
||||
/**
|
||||
* 部件名称
|
||||
*/
|
||||
private String partName;
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ import lombok.Data;
|
|||
@Data
|
||||
public class PositionLanguageVO {
|
||||
|
||||
|
||||
/**
|
||||
* 语言编码
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,90 @@
|
|||
package com.nflg.mobilebroken.admin.service;
|
||||
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.nflg.mobilebroken.admin.constant.Constant;
|
||||
import com.nflg.mobilebroken.admin.pojo.dto.BasePartDTO;
|
||||
import com.nflg.mobilebroken.common.util.AdminUserUtil;
|
||||
import com.nflg.mobilebroken.common.util.UniqueSequenceGenerator;
|
||||
import com.nflg.mobilebroken.repository.entity.Language;
|
||||
import com.nflg.mobilebroken.repository.entity.TBaseLanguageData;
|
||||
import com.nflg.mobilebroken.repository.entity.TBasePart;
|
||||
import com.nflg.mobilebroken.repository.service.ILanguageService;
|
||||
import com.nflg.mobilebroken.repository.service.ITBaseLanguageDataService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.ttzero.excel.entity.Column;
|
||||
import org.ttzero.excel.manager.Const;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class AdminBasePartService {
|
||||
|
||||
@Resource
|
||||
ITBaseLanguageDataService languageDataService;
|
||||
|
||||
@Resource
|
||||
ILanguageService languageService;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param basePartDTO
|
||||
*/
|
||||
public void save(BasePartDTO basePartDTO) {
|
||||
//保存
|
||||
if (null != basePartDTO.getId() && basePartDTO.getId() > 0) {
|
||||
TBasePart ent = Convert.convert(TBasePart.class, basePartDTO);
|
||||
ent.setPartNo(UniqueSequenceGenerator.generateCode(Constant.PartCodePrefix));
|
||||
ent.setCreateBy(AdminUserUtil.getUserName());
|
||||
ent.setCreateTime(LocalDateTime.now());
|
||||
ent.setUpdateBy(AdminUserUtil.getUserName());
|
||||
ent.setUpdateTime(LocalDateTime.now());
|
||||
|
||||
} else { //修改
|
||||
TBasePart ent = Convert.convert(TBasePart.class, basePartDTO);
|
||||
ent.setUpdateBy(AdminUserUtil.getUserName());
|
||||
ent.setUpdateTime(LocalDateTime.now());
|
||||
}
|
||||
//删除语言
|
||||
languageDataService.removeByMap(ImmutableMap.of("source_id", basePartDTO.getId()));
|
||||
List<TBaseLanguageData> result = new ArrayList<>();
|
||||
basePartDTO.getLanguage().forEach(u -> {
|
||||
TBaseLanguageData ent = new TBaseLanguageData();
|
||||
ent.setSourceId(Convert.convert(Long.class, basePartDTO.getId()) );
|
||||
ent.setLanguageCode(u.getCode());
|
||||
ent.setLanguageName(u.getName());
|
||||
ent.setLanguageValue(u.getLanguageValue());
|
||||
result.add(ent);
|
||||
});
|
||||
languageDataService.saveBatch(result);
|
||||
|
||||
}
|
||||
|
||||
public List<String> buildExcelHeader() {
|
||||
List<Language> allLanguage = languageService.lambdaQuery().eq(Language::getEnable, true).list();
|
||||
List<String> columnNames = new ArrayList<>();
|
||||
columnNames.add("部件名称");
|
||||
columnNames.addAll(allLanguage.stream().map(u -> u.getName()).collect(Collectors.toList()));
|
||||
return columnNames;
|
||||
}
|
||||
|
||||
public Column[] buildExcelHeaderColumn() {
|
||||
List<Language> allLanguage = languageService.lambdaQuery().eq(Language::getEnable, true).list();
|
||||
|
||||
|
||||
Column[] excelColumns = new Column[allLanguage.size() + 1];
|
||||
excelColumns[0] = new Column("部件名称", "部件名称", String.class);
|
||||
for (int i = 0; i < allLanguage.size(); i++) {
|
||||
Language lh = allLanguage.get(i );
|
||||
excelColumns[i+1] = new Column(lh.getName(), lh.getName(), String.class);
|
||||
}
|
||||
return excelColumns;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
package com.nflg.mobilebroken.common.constant;
|
||||
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Constant {
|
||||
|
|
@ -104,5 +106,5 @@ public class Constant {
|
|||
|
||||
public static final String DICTIONARY_ITEM_ACCOUNT_HAS_EXPIRED="AccountHasExpired";
|
||||
|
||||
public static final List<String> ROLE_CODE_TICKET_MANAGERS = List.of(TITLE_DIRECTOROF_BUSINESS_UNIT,TITLE_TECHNICAL_MANAGER,TITLE_SALES_MANAGER,TITLE_TEST_MANAGER,TITLE_QUALITY_MANAGER,DICTIONARY_TYPE_TITLE_CQM);
|
||||
public static final List<String> ROLE_CODE_TICKET_MANAGERS = ListUtil.of(TITLE_DIRECTOROF_BUSINESS_UNIT,TITLE_TECHNICAL_MANAGER,TITLE_SALES_MANAGER,TITLE_TEST_MANAGER,TITLE_QUALITY_MANAGER,DICTIONARY_TYPE_TITLE_CQM);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,14 +17,10 @@ public class DevComponentExcel {
|
|||
/**
|
||||
* 机型部件
|
||||
*/
|
||||
@ExcelColumn("机型部件")
|
||||
private String component;
|
||||
@ExcelColumn("部件名称")
|
||||
private String modelPartName;
|
||||
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@ExcelColumn("是否启用")
|
||||
private Boolean enable;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
|
|
@ -38,15 +34,5 @@ public class DevComponentExcel {
|
|||
@ExcelColumn("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 最后更新人
|
||||
*/
|
||||
@ExcelColumn("最后更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 最后更新时间
|
||||
*/
|
||||
@ExcelColumn("最后更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
package com.nflg.mobilebroken.common.pojo.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ExportPartDTO {
|
||||
|
||||
private String partName;
|
||||
|
||||
private String languageName;
|
||||
|
||||
private String languageValue;
|
||||
}
|
||||
|
|
@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
|
@ -62,4 +64,9 @@ public class DeviceComponent implements Serializable {
|
|||
* 最后更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 机型部件列表
|
||||
*/
|
||||
List<DeviceComponentDetail> partList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
|
@ -44,4 +46,14 @@ public class DeviceComponentDetail implements Serializable {
|
|||
* 机型部件名称
|
||||
*/
|
||||
private String modelPartName;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
package com.nflg.mobilebroken.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Accessors(chain = true)
|
||||
@TableName("t_base_part")
|
||||
public class TBaseLanguageData implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id 自增id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 源ID
|
||||
*/
|
||||
private Long sourceId;
|
||||
|
||||
/**
|
||||
* 语言编码
|
||||
*/
|
||||
private String languageCode;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 语言名称
|
||||
*/
|
||||
private String languageName;
|
||||
|
||||
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
private String languageValue;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
package com.nflg.mobilebroken.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表
|
||||
* </p>
|
||||
*
|
||||
* @author 代码生成器生成
|
||||
* @since 2025
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Accessors(chain = true)
|
||||
@TableName("t_base_part")
|
||||
public class TBasePart implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id 自增id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 部件编码
|
||||
*/
|
||||
private String partNo;
|
||||
|
||||
/**
|
||||
* 部件名称
|
||||
*/
|
||||
private String partName;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 状态 0-禁用 1-启用
|
||||
*/
|
||||
private Integer enable;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
|
|
@ -1,11 +1,14 @@
|
|||
package com.nflg.mobilebroken.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.mobilebroken.common.pojo.dto.DevComponentExcel;
|
||||
import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery;
|
||||
import com.nflg.mobilebroken.repository.entity.DeviceComponent;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 机型部件 Mapper 接口
|
||||
|
|
@ -23,4 +26,6 @@ public interface DeviceComponentMapper extends BaseMapper<DeviceComponent> {
|
|||
* @return
|
||||
*/
|
||||
Page<DeviceComponent> selectListByPage(@Param("page") Page<PageBaseQuery> page, @Param("query") PageBaseQuery query);
|
||||
|
||||
List<DevComponentExcel> getExportData();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package com.nflg.mobilebroken.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nflg.mobilebroken.repository.entity.TBaseLanguageData;
|
||||
import com.nflg.mobilebroken.repository.entity.TBasePart;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 曹鹏飞
|
||||
* @since 2025-01-20
|
||||
*/
|
||||
public interface TBaseLanguageDataMapper extends BaseMapper<TBaseLanguageData> {
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.nflg.mobilebroken.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.mobilebroken.common.pojo.dto.ExportPartDTO;
|
||||
import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery;
|
||||
import com.nflg.mobilebroken.repository.entity.TBaseDepartment;
|
||||
import com.nflg.mobilebroken.repository.entity.TBasePart;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 曹鹏飞
|
||||
* @since 2025-01-20
|
||||
*/
|
||||
public interface TBasePartMapper extends BaseMapper<TBasePart> {
|
||||
|
||||
Page<TBasePart> getListByPage(@Param("page") Page<PageBaseQuery> page, @Param("query") PageBaseQuery query);
|
||||
|
||||
List<ExportPartDTO> exportPart(@Param("partNo")String partNo, @Param("partName") String partName);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.nflg.mobilebroken.repository.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.mobilebroken.common.pojo.dto.DevComponentExcel;
|
||||
import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery;
|
||||
import com.nflg.mobilebroken.repository.entity.DeviceComponent;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
|
@ -35,4 +36,6 @@ public interface IDeviceComponentService extends IService<DeviceComponent> {
|
|||
void batchDelComponent(List<Integer> ids);
|
||||
|
||||
Boolean saveOrUpdateBatchComponent(List<DeviceComponent> data);
|
||||
|
||||
List<DevComponentExcel> getExportData();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.nflg.mobilebroken.repository.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nflg.mobilebroken.common.pojo.dto.DevComponentExcel;
|
||||
import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.DepartmentSimpleVO;
|
||||
import com.nflg.mobilebroken.repository.entity.TBaseDepartment;
|
||||
|
|
@ -30,4 +31,6 @@ public interface ITBaseDepartmentService extends IService<TBaseDepartment> {
|
|||
List<TBaseDepartment> getChildByParentId(Long id);
|
||||
|
||||
List<DepartmentSimpleVO> getSimpleDepartments();
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
package com.nflg.mobilebroken.repository.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nflg.mobilebroken.repository.entity.TBaseLanguageData;
|
||||
import com.nflg.mobilebroken.repository.entity.TBasePart;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 曹鹏飞
|
||||
* @since 2025-01-20
|
||||
*/
|
||||
public interface ITBaseLanguageDataService extends IService<TBaseLanguageData> {
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.nflg.mobilebroken.repository.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nflg.mobilebroken.common.pojo.dto.ExportPartDTO;
|
||||
import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery;
|
||||
import com.nflg.mobilebroken.common.pojo.vo.DepartmentSimpleVO;
|
||||
import com.nflg.mobilebroken.repository.entity.DeviceComponent;
|
||||
import com.nflg.mobilebroken.repository.entity.TBaseDepartment;
|
||||
import com.nflg.mobilebroken.repository.entity.TBasePart;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author 曹鹏飞
|
||||
* @since 2025-01-20
|
||||
*/
|
||||
public interface ITBasePartService extends IService<TBasePart> {
|
||||
|
||||
Page<TBasePart> selectListByPage(@Param("query") PageBaseQuery query);
|
||||
|
||||
List<ExportPartDTO> exportPart(@Param("partNo")String partNo, @Param("partName") String partName);
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.nflg.mobilebroken.repository.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.nflg.mobilebroken.common.pojo.dto.DevComponentExcel;
|
||||
import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery;
|
||||
import com.nflg.mobilebroken.repository.entity.DeviceComponent;
|
||||
import com.nflg.mobilebroken.repository.mapper.DeviceComponentMapper;
|
||||
|
|
@ -58,6 +59,10 @@ public class DeviceComponentServiceImpl extends ServiceImpl<DeviceComponentMappe
|
|||
|
||||
}
|
||||
|
||||
public List<DevComponentExcel> getExportData(){
|
||||
return this.getExportData();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package com.nflg.mobilebroken.repository.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.mobilebroken.repository.entity.TBaseLanguageData;
|
||||
import com.nflg.mobilebroken.repository.mapper.TBaseLanguageDataMapper;
|
||||
import com.nflg.mobilebroken.repository.service.ITBaseLanguageDataService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 曹鹏飞
|
||||
* @since 2025-01-20
|
||||
*/
|
||||
@Service
|
||||
public class TBaseLanguageDataServiceImpl extends ServiceImpl<TBaseLanguageDataMapper, TBaseLanguageData> implements ITBaseLanguageDataService {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.nflg.mobilebroken.repository.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.mobilebroken.common.pojo.dto.ExportPartDTO;
|
||||
import com.nflg.mobilebroken.common.pojo.query.PageBaseQuery;
|
||||
import com.nflg.mobilebroken.repository.entity.TBasePart;
|
||||
import com.nflg.mobilebroken.repository.mapper.TBasePartMapper;
|
||||
import com.nflg.mobilebroken.repository.service.ITBasePartService;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 部门表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author 曹鹏飞
|
||||
* @since 2025-01-20
|
||||
*/
|
||||
@Service
|
||||
public class TBasePartServiceImpl extends ServiceImpl<TBasePartMapper, TBasePart> implements ITBasePartService {
|
||||
|
||||
|
||||
public Page<TBasePart> selectListByPage(@Param("query") PageBaseQuery query){
|
||||
return this.getBaseMapper().getListByPage(new Page<PageBaseQuery>(query.getPage(),query.getPageSize()), query);
|
||||
}
|
||||
|
||||
public List<ExportPartDTO> exportPart(@Param("partNo")String partNo, @Param("partName") String partName){
|
||||
return this.getBaseMapper().exportPart(partNo,partName);
|
||||
}
|
||||
}
|
||||
|
|
@ -14,4 +14,10 @@
|
|||
select * from device_component where 1=1
|
||||
<include refid="whr" />
|
||||
</select>
|
||||
|
||||
<select id="getExportData" resultType="com.nflg.mobilebroken.common.pojo.dto.DevComponentExcel">
|
||||
select a.model_no,b.model_part_name,b.create_by,b.create_time
|
||||
from device_component a
|
||||
join device_component_detail b on a.id=b.device_component_id
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
<?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.nflg.mobilebroken.repository.mapper.TBaseLanguageDataMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?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.nflg.mobilebroken.repository.mapper.TBasePartMapper">
|
||||
|
||||
<sql id="whr">
|
||||
<if test="query.partNo!=null and query.partNo!=''">
|
||||
and part_no=#{query.partNo}
|
||||
</if>
|
||||
<if test="query.partName!=null and query.partName!=''">
|
||||
and part_name like concat('%', #{query.partName},'%')
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getListByPage" resultType="com.nflg.mobilebroken.repository.entity.TBasePart">
|
||||
select * from t_base_part where 1=1
|
||||
<include refid="whr">
|
||||
</include>
|
||||
</select>
|
||||
|
||||
<select id="exportPart" resultType="com.nflg.mobilebroken.common.pojo.dto.ExportPartDTO">
|
||||
select a.part_name,b.language_name,b.language_value
|
||||
from t_base_part a join t_base_language_data b on a.id=b.source_id
|
||||
where 1=1
|
||||
<if test="partNo!=null and partNo!=''">
|
||||
and part_no=#{partNo}
|
||||
</if>
|
||||
<if test="partName!=null and partName!=''">
|
||||
and part_name like concat('%', #{partName},'%')
|
||||
</if>
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue