parent
4bfe03cf15
commit
029a164b13
10 changed files with 763 additions and 0 deletions
@ -0,0 +1,238 @@ |
||||
/** |
||||
* Author: Tom Shuo |
||||
*/ |
||||
package org.springblade.desk.basic.controller; |
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
import io.swagger.v3.oas.annotations.Operation; |
||||
import io.swagger.v3.oas.annotations.Parameter; |
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import jakarta.annotation.Resource; |
||||
import jakarta.validation.Valid; |
||||
|
||||
import lombok.Data; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.core.secure.BladeUser; |
||||
import org.springblade.core.secure.annotation.IsAdmin; |
||||
import org.springblade.core.mp.support.Condition; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.core.tool.utils.Func; |
||||
import org.springframework.http.ResponseEntity; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.springblade.desk.basic.util.ExcelExtUtil; |
||||
import org.springblade.desk.basic.pojo.entity.Oem; |
||||
import org.springblade.desk.basic.pojo.vo.OemVO; |
||||
import org.springblade.desk.basic.excel.OemExcel; |
||||
import org.springblade.desk.basic.wrapper.OemWrapper; |
||||
import org.springblade.desk.basic.service.IOemService; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.tool.utils.DateUtil; |
||||
import org.springblade.core.excel.util.ExcelUtil; |
||||
import org.springblade.core.tool.constant.BladeConstant; |
||||
import java.util.Map; |
||||
import java.util.List; |
||||
import jakarta.servlet.http.HttpServletResponse; |
||||
|
||||
/** |
||||
* [外协厂家] 控制器 |
||||
* |
||||
* @author Tom Shuo |
||||
* @since 2026-01-04 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/Oem") |
||||
@Data |
||||
@AllArgsConstructor |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@Slf4j |
||||
@Tag(name = "[外协厂家]", description = "[外协厂家]接口") |
||||
public class OemController extends BladeController { |
||||
|
||||
@Resource |
||||
private IOemService service; |
||||
|
||||
/** |
||||
* [外协厂家] 详情 |
||||
*/ |
||||
@GetMapping("/detail") |
||||
@ApiOperationSupport(order = 10) |
||||
@Operation(summary = "详情", description = "传入Oem Obj") |
||||
public R<OemVO> detail(Oem oem) { |
||||
QueryWrapper<Oem> qw = Condition.getQueryWrapper(oem); |
||||
Oem detail = service.getOne(qw); |
||||
OemVO detailVO = OemWrapper.build().entityVO(detail); |
||||
service.setVOValue(detailVO); |
||||
return R.data(detailVO); |
||||
} |
||||
|
||||
/** |
||||
* [外协厂家] list分页 |
||||
*/ |
||||
@GetMapping("/list") |
||||
@ApiOperationSupport(order = 20) |
||||
@Operation(summary = "list分页", description = "传入Oem Obj") |
||||
public R<IPage<OemVO>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> oem, |
||||
Query query) { |
||||
QueryWrapper<Oem> qw = Condition.getQueryWrapper(oem, Oem.class); |
||||
IPage<Oem> pages = service.page(Condition.getPage(query), qw); |
||||
IPage<OemVO> pagesVO = OemWrapper.build().pageVO(pages); |
||||
pagesVO.getRecords() |
||||
.stream() |
||||
.peek(service::setVOValue) |
||||
.collect(Collectors.toList()); |
||||
return R.data(pagesVO); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* [外协厂家] page分页 |
||||
*/ |
||||
@GetMapping("/page") |
||||
@ApiOperationSupport(order = 21) |
||||
@Operation(summary = "page分页", description = "传入Oem Obj") |
||||
public R<IPage<OemVO>> page(OemVO oem, Query query) { |
||||
IPage<OemVO> pagesVO = service.selectOemPage( |
||||
Condition.getPage(query), oem |
||||
); |
||||
return R.data(pagesVO); |
||||
} |
||||
|
||||
/** |
||||
* [外协厂家] list下拉选择 |
||||
*/ |
||||
@GetMapping("/listForSelect") |
||||
@ApiOperationSupport(order = 22) |
||||
@Operation(summary = "list下拉选择", description = "") |
||||
public R<List<OemVO>> listForSelect() { |
||||
List<Oem> list = service.list(); |
||||
List<OemVO> listVO = OemWrapper.build().listVO(list); |
||||
return R.data(listVO); |
||||
} |
||||
|
||||
/** |
||||
* [外协厂家] 新增一条 |
||||
*/ |
||||
@PostMapping("/save") |
||||
@ApiOperationSupport(order = 30) |
||||
@Operation(summary = "新增一条", description = "传入Oem Obj") |
||||
public R save(@Valid @RequestBody Oem addOne) { |
||||
addOne.setId(null); |
||||
return R.status(service.save(addOne)); |
||||
} |
||||
|
||||
/** |
||||
* [外协厂家] 新增批量 |
||||
*/ |
||||
@PostMapping("/saveBat") |
||||
@ApiOperationSupport(order = 31) |
||||
@Operation(summary = "新增批量", description = "传入Oem List") |
||||
public R saveBat(@Valid @RequestBody List<Oem> addList) { |
||||
addList.forEach(one -> { |
||||
one.setId(null); |
||||
}); |
||||
return R.status(service.saveBatch(addList)); |
||||
} |
||||
|
||||
/** |
||||
* [外协厂家] 修改一条 |
||||
*/ |
||||
@PostMapping("/update") |
||||
@ApiOperationSupport(order = 40) |
||||
@Operation(summary = "修改一条", description = "传入Oem Obj") |
||||
public R update(@Valid @RequestBody Oem updateOne) { |
||||
return R.status(service.updateById(updateOne)); |
||||
} |
||||
|
||||
/** |
||||
* [外协厂家] 修改批量 |
||||
*/ |
||||
@PostMapping("/updateBat") |
||||
@ApiOperationSupport(order = 41) |
||||
@Operation(summary = "修改批量", description = "传入Oem List") |
||||
public R updateBat(@Valid @RequestBody List<Oem> updateList) { |
||||
return R.status(service.updateBatchById(updateList)); |
||||
} |
||||
|
||||
/** |
||||
* [外协厂家] 新增或修改一条 |
||||
*/ |
||||
@PostMapping("/submit") |
||||
@ApiOperationSupport(order = 50) |
||||
@Operation(summary = "新增或修改一条", description = "传入Oem Obj") |
||||
public R submit(@Valid @RequestBody Oem mergeOne) { |
||||
return R.status(service.saveOrUpdate(mergeOne)); |
||||
} |
||||
|
||||
/** |
||||
* [外协厂家] 新增或修改批量 |
||||
*/ |
||||
@PostMapping("/submitBat") |
||||
@ApiOperationSupport(order = 51) |
||||
@Operation(summary = "新增或修改批量", description = "传入Oem List") |
||||
public R submitBat(@Valid @RequestBody List<Oem> mergeList) { |
||||
return R.status(service.saveOrUpdateBatch(mergeList)); |
||||
} |
||||
|
||||
/** |
||||
* [外协厂家] 逻辑删除 |
||||
*/ |
||||
@PostMapping("/remove") |
||||
@ApiOperationSupport(order = 61) |
||||
@Operation(summary = "逻辑删除", description = "传入ids") |
||||
public R remove(@Parameter(description = "主键集合", required = true) @RequestParam String ids) { |
||||
return R.status(service.deleteLogic(Func.toLongList(ids))); |
||||
} |
||||
|
||||
/** |
||||
* [外协厂家] 导出Excel |
||||
*/ |
||||
@GetMapping("/exportExcel") |
||||
@ApiOperationSupport(order = 70) |
||||
@Operation(summary = "导出Excel", description = "传入Oem") |
||||
public void exportExcel(@Parameter(hidden = true) @RequestParam Map<String, Object> oem, |
||||
BladeUser bladeUser, HttpServletResponse response) { |
||||
QueryWrapper<Oem> qw = Condition.getQueryWrapper(oem, Oem.class); |
||||
//if (!AuthUtil.isAdministrator()) {
|
||||
// queryWrapper.lambda().eq(Oem::getTenantId, bladeUser.getTenantId());
|
||||
//}
|
||||
//queryWrapper.lambda().eq(OemEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
|
||||
List<OemExcel> list = service.exportOem(qw); |
||||
ExcelUtil.export(response, "[外协厂家]数据" + org.springblade.core.tool.utils.DateUtil.time(), |
||||
"[外协厂家]数据表", list, OemExcel.class); |
||||
} |
||||
|
||||
/** |
||||
* [外协厂家] 下载Excel模板 |
||||
*/ |
||||
@GetMapping("/downloadExcelTemplate") |
||||
@ApiOperationSupport(order = 71) |
||||
@Operation(summary = "下载Excel模板", description = "") |
||||
public ResponseEntity<org.springframework.core.io.Resource> downloadExcelTemplate() { |
||||
return ExcelExtUtil.downloadXlsTemplate( |
||||
"Excel/QA/ImportTemplate-CycleTestItem.xls", |
||||
"导入模版-周期试验项目.xls"); |
||||
} |
||||
|
||||
/** |
||||
* [外协厂家] 导入Excel |
||||
*/ |
||||
@PostMapping("/importExcel") |
||||
@ApiOperationSupport(order = 72) |
||||
@Operation(summary = "导入Excel", description = "MultipartFile") |
||||
public R importExcel(@RequestParam("file") MultipartFile file) { |
||||
R checkR = ExcelExtUtil.importExcelCheck(file); |
||||
if (checkR != null) { |
||||
return checkR; |
||||
} |
||||
List<Oem> importList = ExcelUtil.read( |
||||
file, 0, 1, Oem.class |
||||
); |
||||
return R.status(service.saveBatch(importList)); |
||||
} |
||||
} |
||||
@ -0,0 +1,117 @@ |
||||
/** |
||||
* Author: Tom Shuo |
||||
*/ |
||||
package org.springblade.desk.basic.excel; |
||||
|
||||
|
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import com.alibaba.excel.annotation.ExcelProperty; |
||||
import com.alibaba.excel.annotation.write.style.ColumnWidth; |
||||
import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
||||
import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
||||
import java.io.Serial; |
||||
|
||||
|
||||
/** |
||||
* [外协厂家] Excel实体类 |
||||
* |
||||
* @author Tom Shuo |
||||
* @since 2026-01-04 |
||||
*/ |
||||
@Data |
||||
@ColumnWidth(25) |
||||
@HeadRowHeight(20) |
||||
@ContentRowHeight(18) |
||||
public class OemExcel implements Serializable { |
||||
|
||||
@Serial |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** |
||||
* 编码 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("编码") |
||||
private String code; |
||||
/** |
||||
* 简称 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("简称") |
||||
private String abbreviation; |
||||
/** |
||||
* 工艺能力 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("工艺能力") |
||||
private String craftAbility; |
||||
/** |
||||
* 地区 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("地区") |
||||
private String region; |
||||
/** |
||||
* 地址 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("地址") |
||||
private String address; |
||||
/** |
||||
* 资质 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("资质") |
||||
private Short qualification; |
||||
/** |
||||
* 联系人 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("联系人") |
||||
private String contactMan; |
||||
/** |
||||
* 邮箱 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("邮箱") |
||||
private String email; |
||||
/** |
||||
* 联系电话 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("联系电话") |
||||
private String contactPhone; |
||||
/** |
||||
* 密码 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("密码") |
||||
private String oemPassword; |
||||
/** |
||||
* 名称 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("名称") |
||||
private String ocName; |
||||
/** |
||||
* 类型 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("类型") |
||||
private Long oemType; |
||||
/** |
||||
* 排序 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("排序") |
||||
private Long sort; |
||||
/** |
||||
* 备注 |
||||
*/ |
||||
@ColumnWidth(20) |
||||
@ExcelProperty("备注") |
||||
private String remark; |
||||
} |
||||
@ -0,0 +1,39 @@ |
||||
/** |
||||
* Author: Tom Shuo |
||||
*/ |
||||
package org.springblade.desk.basic.mapper; |
||||
|
||||
import org.springblade.desk.basic.pojo.entity.Oem; |
||||
import org.springblade.desk.basic.pojo.vo.OemVO; |
||||
import org.springblade.desk.basic.excel.OemExcel; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* [外协厂家] Mapper 接口 |
||||
* |
||||
* @author Tom Shuo |
||||
* @since 2026-01-04 |
||||
*/ |
||||
public interface OemMapper extends BaseMapper<Oem> { |
||||
|
||||
/** |
||||
* 自定义分页 |
||||
* |
||||
* @param page 分页参数 |
||||
* @param oem 查询参数 |
||||
* @return List<OemVO> |
||||
*/ |
||||
List<OemVO> selectOemPage(IPage page, OemVO oem); |
||||
|
||||
/** |
||||
* 获取导出数据 |
||||
* |
||||
* @param queryWrapper 查询条件 |
||||
* @return List<OemExcel> |
||||
*/ |
||||
List<OemExcel> exportOem(@Param("ew") Wrapper<Oem> queryWrapper); |
||||
} |
||||
@ -0,0 +1,30 @@ |
||||
<?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="org.springblade.desk.basic.mapper.OemMapper"> |
||||
|
||||
<!-- 通用查询映射结果 --> |
||||
<resultMap id="oemResultMap" type="org.springblade.desk.basic.pojo.entity.Oem"> |
||||
<result column="CODE" property="code"/> |
||||
<result column="ABBREVIATION" property="abbreviation"/> |
||||
<result column="CRAFT_ABILITY" property="craftAbility"/> |
||||
<result column="REGION" property="region"/> |
||||
<result column="ADDRESS" property="address"/> |
||||
<result column="QUALIFICATION" property="qualification"/> |
||||
<result column="CONTACT_MAN" property="contactMan"/> |
||||
<result column="EMAIL" property="email"/> |
||||
<result column="CONTACT_PHONE" property="contactPhone"/> |
||||
<result column="OEM_PASSWORD" property="oemPassword"/> |
||||
<result column="OC_NAME" property="ocName"/> |
||||
<result column="OEM_TYPE" property="oemType"/> |
||||
<result column="SORT" property="sort"/> |
||||
<result column="REMARK" property="remark"/> |
||||
</resultMap> |
||||
|
||||
<select id="selectOemPage" resultMap="oemResultMap"> |
||||
SELECT * FROM BA_OEM WHERE is_deleted = 0 |
||||
</select> |
||||
|
||||
<select id="exportOem" resultType="org.springblade.desk.basic.excel.OemExcel"> |
||||
SELECT * FROM BA_OEM ${ew.customSqlSegment} |
||||
</select> |
||||
</mapper> |
||||
@ -0,0 +1,23 @@ |
||||
/** |
||||
* Author: Tom Shuo |
||||
*/ |
||||
package org.springblade.desk.basic.pojo.dto; |
||||
|
||||
import org.springblade.desk.basic.pojo.entity.Oem; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import java.io.Serial; |
||||
|
||||
/** |
||||
* [外协厂家] 数据传输对象实体类 |
||||
* |
||||
* @author Tom Shuo |
||||
* @since 2026-01-04 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class OemDTO extends Oem { |
||||
@Serial |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
} |
||||
@ -0,0 +1,155 @@ |
||||
/** |
||||
* Author: Tom Shuo |
||||
*/ |
||||
package org.springblade.desk.basic.pojo.entity; |
||||
|
||||
import lombok.Data; |
||||
import io.swagger.v3.oas.annotations.media.Schema; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import org.springblade.core.mp.base.BaseEntity; |
||||
import lombok.EqualsAndHashCode; |
||||
import java.io.Serial; |
||||
|
||||
/** |
||||
* [外协厂家] 实体类 |
||||
* |
||||
* @author Tom Shuo |
||||
* @since 2026-01-04 |
||||
*/ |
||||
@Data |
||||
@TableName("BA_OEM") |
||||
@Schema(description = "Oem Entity对象") |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class Oem extends BaseEntity { |
||||
|
||||
@Serial |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** |
||||
* 编码 |
||||
*/ |
||||
public static final String COL_CODE = "CODE"; |
||||
/** |
||||
* 简称 |
||||
*/ |
||||
public static final String COL_ABBREVIATION = "ABBREVIATION"; |
||||
/** |
||||
* 工艺能力 |
||||
*/ |
||||
public static final String COL_CRAFT_ABILITY = "CRAFT_ABILITY"; |
||||
/** |
||||
* 地区 |
||||
*/ |
||||
public static final String COL_REGION = "REGION"; |
||||
/** |
||||
* 地址 |
||||
*/ |
||||
public static final String COL_ADDRESS = "ADDRESS"; |
||||
/** |
||||
* 资质 |
||||
*/ |
||||
public static final String COL_QUALIFICATION = "QUALIFICATION"; |
||||
/** |
||||
* 联系人 |
||||
*/ |
||||
public static final String COL_CONTACT_MAN = "CONTACT_MAN"; |
||||
/** |
||||
* 邮箱 |
||||
*/ |
||||
public static final String COL_EMAIL = "EMAIL"; |
||||
/** |
||||
* 联系电话 |
||||
*/ |
||||
public static final String COL_CONTACT_PHONE = "CONTACT_PHONE"; |
||||
/** |
||||
* 密码 |
||||
*/ |
||||
public static final String COL_OEM_PASSWORD = "OEM_PASSWORD"; |
||||
/** |
||||
* 名称 |
||||
*/ |
||||
public static final String COL_OC_NAME = "OC_NAME"; |
||||
/** |
||||
* 类型 |
||||
*/ |
||||
public static final String COL_OEM_TYPE = "OEM_TYPE"; |
||||
/** |
||||
* 排序 |
||||
*/ |
||||
public static final String COL_SORT = "SORT"; |
||||
/** |
||||
* 备注 |
||||
*/ |
||||
public static final String COL_REMARK = "REMARK"; |
||||
|
||||
/** |
||||
* 编码 |
||||
*/ |
||||
@Schema(description = "编码") |
||||
private String code; |
||||
/** |
||||
* 简称 |
||||
*/ |
||||
@Schema(description = "简称") |
||||
private String abbreviation; |
||||
/** |
||||
* 工艺能力 |
||||
*/ |
||||
@Schema(description = "工艺能力") |
||||
private String craftAbility; |
||||
/** |
||||
* 地区 |
||||
*/ |
||||
@Schema(description = "地区") |
||||
private String region; |
||||
/** |
||||
* 地址 |
||||
*/ |
||||
@Schema(description = "地址") |
||||
private String address; |
||||
/** |
||||
* 资质 |
||||
*/ |
||||
@Schema(description = "资质") |
||||
private Short qualification; |
||||
/** |
||||
* 联系人 |
||||
*/ |
||||
@Schema(description = "联系人") |
||||
private String contactMan; |
||||
/** |
||||
* 邮箱 |
||||
*/ |
||||
@Schema(description = "邮箱") |
||||
private String email; |
||||
/** |
||||
* 联系电话 |
||||
*/ |
||||
@Schema(description = "联系电话") |
||||
private String contactPhone; |
||||
/** |
||||
* 密码 |
||||
*/ |
||||
@Schema(description = "密码") |
||||
private String oemPassword; |
||||
/** |
||||
* 名称 |
||||
*/ |
||||
@Schema(description = "名称") |
||||
private String ocName; |
||||
/** |
||||
* 类型 |
||||
*/ |
||||
@Schema(description = "类型") |
||||
private Long oemType; |
||||
/** |
||||
* 排序 |
||||
*/ |
||||
@Schema(description = "排序") |
||||
private Long sort; |
||||
/** |
||||
* 备注 |
||||
*/ |
||||
@Schema(description = "备注") |
||||
private String remark; |
||||
} |
||||
@ -0,0 +1,23 @@ |
||||
/** |
||||
* Author: Tom Shuo |
||||
*/ |
||||
package org.springblade.desk.basic.pojo.vo; |
||||
|
||||
import org.springblade.desk.basic.pojo.entity.Oem; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
import java.io.Serial; |
||||
|
||||
/** |
||||
* [外协厂家] 视图实体类 |
||||
* |
||||
* @author Tom Shuo |
||||
* @since 2026-01-04 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = true) |
||||
public class OemVO extends Oem { |
||||
@Serial |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
} |
||||
@ -0,0 +1,43 @@ |
||||
/** |
||||
* Author: Tom Shuo |
||||
*/ |
||||
package org.springblade.desk.basic.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
import org.springblade.desk.basic.pojo.entity.Oem; |
||||
import org.springblade.desk.basic.pojo.vo.OemVO; |
||||
import org.springblade.desk.basic.excel.OemExcel; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.springblade.core.mp.base.BaseService; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* [外协厂家] 服务类 |
||||
* |
||||
* @author Tom Shuo |
||||
* @since 2026-01-04 |
||||
*/ |
||||
public interface IOemService extends BaseService<Oem> { |
||||
/** |
||||
* 自定义分页 |
||||
* |
||||
* @param page 分页参数 |
||||
* @param oem 查询参数 |
||||
* @return IPage<OemVO> |
||||
*/ |
||||
IPage<OemVO> selectOemPage(IPage<OemVO> page, OemVO oem); |
||||
|
||||
/** |
||||
* 导出数据 |
||||
* |
||||
* @param queryWrapper 查询条件 |
||||
* @return List<OemExcel> |
||||
*/ |
||||
List<OemExcel> exportOem(Wrapper<Oem> queryWrapper); |
||||
|
||||
/** |
||||
* VO |
||||
* @param vo |
||||
*/ |
||||
void setVOValue(OemVO vo); |
||||
} |
||||
@ -0,0 +1,60 @@ |
||||
/** |
||||
* Author: Tom Shuo |
||||
*/ |
||||
package org.springblade.desk.basic.service.impl; |
||||
|
||||
import jakarta.annotation.Resource; |
||||
import lombok.Data; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.EqualsAndHashCode; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springblade.desk.basic.pojo.entity.Oem; |
||||
import org.springblade.desk.basic.pojo.vo.OemVO; |
||||
import org.springblade.desk.basic.excel.OemExcel; |
||||
import org.springblade.desk.basic.mapper.OemMapper; |
||||
import org.springblade.desk.basic.service.IOemService; |
||||
import org.springblade.system.feign.IUserClient; |
||||
import org.springblade.system.feign.IDictClient; |
||||
import org.springframework.stereotype.Service; |
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import org.springblade.core.mp.base.BaseServiceImpl; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* [外协厂家] 服务实现类 |
||||
* |
||||
* @author Tom Shuo |
||||
* @since 2026-01-04 |
||||
*/ |
||||
@Service |
||||
@Data |
||||
@AllArgsConstructor |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@Slf4j |
||||
public class OemServiceImpl extends BaseServiceImpl<OemMapper, Oem> implements IOemService { |
||||
|
||||
@Resource |
||||
private IUserClient userClient; |
||||
@Resource |
||||
private IDictClient dictClient; |
||||
|
||||
@Override |
||||
public IPage<OemVO> selectOemPage(IPage<OemVO> page, OemVO oem) { |
||||
return page.setRecords(baseMapper.selectOemPage(page, oem)); |
||||
} |
||||
|
||||
@Override |
||||
public List<OemExcel> exportOem(Wrapper<Oem> queryWrapper) { |
||||
List<OemExcel> oemList = baseMapper.exportOem(queryWrapper); |
||||
//oemList.forEach(oem -> {
|
||||
// oem.setTypeName(DictCache.getValue(DictEnum.YES_NO, Oem.getType()));
|
||||
//});
|
||||
return oemList; |
||||
} |
||||
|
||||
@Override |
||||
public void setVOValue(OemVO vo) { |
||||
|
||||
} |
||||
} |
||||
@ -0,0 +1,35 @@ |
||||
/** |
||||
* Author: Tom Shuo |
||||
*/ |
||||
package org.springblade.desk.basic.wrapper; |
||||
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper; |
||||
import org.springblade.core.tool.utils.BeanUtil; |
||||
import org.springblade.desk.basic.pojo.entity.Oem; |
||||
import org.springblade.desk.basic.pojo.vo.OemVO; |
||||
import java.util.Objects; |
||||
|
||||
/** |
||||
* [外协厂家] 包装类,返回视图层所需的字段 |
||||
* |
||||
* @author Tom Shuo |
||||
* @since 2026-01-04 |
||||
*/ |
||||
public class OemWrapper extends BaseEntityWrapper<Oem, OemVO> { |
||||
|
||||
public static OemWrapper build() { |
||||
return new OemWrapper(); |
||||
} |
||||
|
||||
@Override |
||||
public OemVO entityVO(Oem oem) { |
||||
OemVO VO = Objects.requireNonNull(BeanUtil.copyProperties(oem, OemVO.class)); |
||||
|
||||
//User createUser = UserCache.getUser(oem.getCreateUser());
|
||||
//User updateUser = UserCache.getUser(oem.getUpdateUser());
|
||||
//oemVO.setCreateUserName(createUser.getName());
|
||||
//oemVO.setUpdateUserName(updateUser.getName());
|
||||
|
||||
return VO; |
||||
} |
||||
} |
||||
Loading…
Reference in new issue