forked from sfms3.0/sfms3.0
56 changed files with 1191 additions and 87 deletions
@ -0,0 +1,102 @@ |
|||||
|
package com.win.module.wms.controller.documentSwitch; |
||||
|
|
||||
|
import com.win.module.wms.controller.documentSwitch.vo.*; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
import javax.annotation.Resource; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
|
import io.swagger.v3.oas.annotations.Parameter; |
||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||
|
|
||||
|
import javax.validation.*; |
||||
|
import javax.servlet.http.*; |
||||
|
import java.util.*; |
||||
|
import java.io.IOException; |
||||
|
|
||||
|
import com.win.framework.common.pojo.PageResult; |
||||
|
import com.win.framework.common.pojo.CommonResult; |
||||
|
import static com.win.framework.common.pojo.CommonResult.success; |
||||
|
|
||||
|
import com.win.framework.excel.core.util.ExcelUtils; |
||||
|
|
||||
|
import com.win.framework.operatelog.core.annotations.OperateLog; |
||||
|
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.*; |
||||
|
|
||||
|
import com.win.module.wms.controller.documentSwitch.vo.*; |
||||
|
import com.win.module.wms.dal.dataobject.documentSwitch.SwitchDO; |
||||
|
import com.win.module.wms.convert.documentSwitch.SwitchConvert; |
||||
|
import com.win.module.wms.service.documentSwitch.SwitchService; |
||||
|
|
||||
|
@Tag(name = "管理后台 - 单据开关") |
||||
|
@RestController |
||||
|
@RequestMapping("/wms/switch") |
||||
|
@Validated |
||||
|
public class SwitchController { |
||||
|
|
||||
|
@Resource |
||||
|
private SwitchService switchService; |
||||
|
|
||||
|
@PostMapping("/create") |
||||
|
@Operation(summary = "创建单据开关") |
||||
|
@PreAuthorize("@ss.hasPermission('wms:switch:create')") |
||||
|
public CommonResult<Long> createSwitch(@Valid @RequestBody SwitchCreateReqVO createReqVO) { |
||||
|
return success(switchService.createSwitch(createReqVO)); |
||||
|
} |
||||
|
|
||||
|
@PutMapping("/update") |
||||
|
@Operation(summary = "更新单据开关") |
||||
|
@PreAuthorize("@ss.hasPermission('wms:switch:update')") |
||||
|
public CommonResult<Boolean> updateSwitch(@Valid @RequestBody SwitchUpdateReqVO updateReqVO) { |
||||
|
switchService.updateSwitch(updateReqVO); |
||||
|
return success(true); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping("/delete") |
||||
|
@Operation(summary = "删除单据开关") |
||||
|
@Parameter(name = "id", description = "编号", required = true) |
||||
|
@PreAuthorize("@ss.hasPermission('wms:switch:delete')") |
||||
|
public CommonResult<Boolean> deleteSwitch(@RequestParam("id") Long id) { |
||||
|
switchService.deleteSwitch(id); |
||||
|
return success(true); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/get") |
||||
|
@Operation(summary = "获得单据开关") |
||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024") |
||||
|
@PreAuthorize("@ss.hasPermission('wms:switch:query')") |
||||
|
public CommonResult<SwitchRespVO> getSwitch(@RequestParam("id") Long id) { |
||||
|
SwitchDO documentSwitch = switchService.getSwitch(id); |
||||
|
return success(SwitchConvert.INSTANCE.convert(documentSwitch)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/list") |
||||
|
@Operation(summary = "获得单据开关列表") |
||||
|
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") |
||||
|
@PreAuthorize("@ss.hasPermission('wms:switch:query')") |
||||
|
public CommonResult<List<SwitchRespVO>> getSwitchList(@RequestParam("ids") Collection<Long> ids) { |
||||
|
List<SwitchDO> list = switchService.getSwitchList(ids); |
||||
|
return success(SwitchConvert.INSTANCE.convertList(list)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/page") |
||||
|
@Operation(summary = "获得单据开关分页") |
||||
|
@PreAuthorize("@ss.hasPermission('wms:switch:query')") |
||||
|
public CommonResult<PageResult<SwitchRespVO>> getSwitchPage(@Valid SwitchPageReqVO pageVO) { |
||||
|
PageResult<SwitchDO> pageResult = switchService.getSwitchPage(pageVO); |
||||
|
return success(SwitchConvert.INSTANCE.convertPage(pageResult)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/export-excel") |
||||
|
@Operation(summary = "导出单据开关 Excel") |
||||
|
@PreAuthorize("@ss.hasPermission('wms:switch:export')") |
||||
|
@OperateLog(type = EXPORT) |
||||
|
public void exportSwitchExcel(@Valid SwitchExportReqVO exportReqVO, |
||||
|
HttpServletResponse response) throws IOException { |
||||
|
List<SwitchDO> list = switchService.getSwitchList(exportReqVO); |
||||
|
// 导出 Excel
|
||||
|
List<SwitchExcelVO> datas = SwitchConvert.INSTANCE.convertList02(list); |
||||
|
ExcelUtils.write(response, "单据开关.xls", "数据", SwitchExcelVO.class, datas); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
package com.win.module.wms.controller.documentSwitch.vo; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.*; |
||||
|
import java.util.*; |
||||
|
import javax.validation.constraints.*; |
||||
|
|
||||
|
/** |
||||
|
* 单据开关 Base VO,提供给添加、修改、详细的子 VO 使用 |
||||
|
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class SwitchBaseVO { |
||||
|
|
||||
|
@Schema(description = "代码", requiredMode = Schema.RequiredMode.REQUIRED) |
||||
|
@NotNull(message = "代码不能为空") |
||||
|
private String code; |
||||
|
|
||||
|
@Schema(description = "描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜") |
||||
|
@NotNull(message = "描述不能为空") |
||||
|
private String description; |
||||
|
|
||||
|
@Schema(description = "有效设置值 TRUE FALSE", requiredMode = Schema.RequiredMode.REQUIRED) |
||||
|
@NotNull(message = "有效设置值 TRUE FALSE不能为空") |
||||
|
private String effectiveSetValue; |
||||
|
|
||||
|
@Schema(description = "是否可用", requiredMode = Schema.RequiredMode.REQUIRED) |
||||
|
@NotNull(message = "是否可用不能为空") |
||||
|
private String available; |
||||
|
|
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
package com.win.module.wms.controller.documentSwitch.vo; |
||||
|
|
||||
|
import lombok.*; |
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
|
||||
|
@Schema(description = "管理后台 - 单据开关创建 Request VO") |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@ToString(callSuper = true) |
||||
|
public class SwitchCreateReqVO extends SwitchBaseVO { |
||||
|
|
||||
|
} |
@ -0,0 +1,32 @@ |
|||||
|
package com.win.module.wms.controller.documentSwitch.vo; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.*; |
||||
|
import java.util.*; |
||||
|
|
||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||
|
|
||||
|
/** |
||||
|
* 单据开关 Excel VO |
||||
|
* |
||||
|
* @author 源码 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class SwitchExcelVO { |
||||
|
|
||||
|
@ExcelProperty("id") |
||||
|
private Long id; |
||||
|
|
||||
|
@ExcelProperty("代码") |
||||
|
private String code; |
||||
|
|
||||
|
@ExcelProperty("描述") |
||||
|
private String description; |
||||
|
|
||||
|
@ExcelProperty("有效设置值 TRUE FALSE") |
||||
|
private String effectiveSetValue; |
||||
|
|
||||
|
@ExcelProperty("是否可用") |
||||
|
private String available; |
||||
|
|
||||
|
} |
@ -0,0 +1,24 @@ |
|||||
|
package com.win.module.wms.controller.documentSwitch.vo; |
||||
|
|
||||
|
import lombok.*; |
||||
|
import java.util.*; |
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import com.win.framework.common.pojo.PageParam; |
||||
|
|
||||
|
@Schema(description = "管理后台 - 单据开关 Excel 导出 Request VO,参数和 SwitchPageReqVO 是一致的") |
||||
|
@Data |
||||
|
public class SwitchExportReqVO { |
||||
|
|
||||
|
@Schema(description = "代码") |
||||
|
private String code; |
||||
|
|
||||
|
@Schema(description = "描述", example = "你猜") |
||||
|
private String description; |
||||
|
|
||||
|
@Schema(description = "有效设置值 TRUE FALSE") |
||||
|
private String effectiveSetValue; |
||||
|
|
||||
|
@Schema(description = "是否可用") |
||||
|
private String available; |
||||
|
|
||||
|
} |
@ -0,0 +1,26 @@ |
|||||
|
package com.win.module.wms.controller.documentSwitch.vo; |
||||
|
|
||||
|
import lombok.*; |
||||
|
import java.util.*; |
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import com.win.framework.common.pojo.PageParam; |
||||
|
|
||||
|
@Schema(description = "管理后台 - 单据开关分页 Request VO") |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@ToString(callSuper = true) |
||||
|
public class SwitchPageReqVO extends PageParam { |
||||
|
|
||||
|
@Schema(description = "代码") |
||||
|
private String code; |
||||
|
|
||||
|
@Schema(description = "描述", example = "你猜") |
||||
|
private String description; |
||||
|
|
||||
|
@Schema(description = "有效设置值 TRUE FALSE") |
||||
|
private String effectiveSetValue; |
||||
|
|
||||
|
@Schema(description = "是否可用") |
||||
|
private String available; |
||||
|
|
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
package com.win.module.wms.controller.documentSwitch.vo; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.*; |
||||
|
|
||||
|
@Schema(description = "管理后台 - 单据开关 Response VO") |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@ToString(callSuper = true) |
||||
|
public class SwitchRespVO extends SwitchBaseVO { |
||||
|
|
||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17760") |
||||
|
private Long id; |
||||
|
|
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
package com.win.module.wms.controller.documentSwitch.vo; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.*; |
||||
|
|
||||
|
import javax.validation.constraints.*; |
||||
|
|
||||
|
@Schema(description = "管理后台 - 单据开关更新 Request VO") |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@ToString(callSuper = true) |
||||
|
public class SwitchUpdateReqVO extends SwitchBaseVO { |
||||
|
|
||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "17760") |
||||
|
@NotNull(message = "id不能为空") |
||||
|
private Long id; |
||||
|
|
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
package com.win.module.wms.convert.documentSwitch; |
||||
|
|
||||
|
import java.util.*; |
||||
|
|
||||
|
import com.win.framework.common.pojo.PageResult; |
||||
|
|
||||
|
import com.win.module.wms.controller.documentSwitch.vo.SwitchCreateReqVO; |
||||
|
import com.win.module.wms.controller.documentSwitch.vo.SwitchExcelVO; |
||||
|
import com.win.module.wms.controller.documentSwitch.vo.SwitchRespVO; |
||||
|
import com.win.module.wms.controller.documentSwitch.vo.SwitchUpdateReqVO; |
||||
|
import org.mapstruct.Mapper; |
||||
|
import org.mapstruct.factory.Mappers; |
||||
|
import com.win.module.wms.dal.dataobject.documentSwitch.SwitchDO; |
||||
|
|
||||
|
/** |
||||
|
* 单据开关 Convert |
||||
|
* |
||||
|
* @author 源码 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface SwitchConvert { |
||||
|
|
||||
|
SwitchConvert INSTANCE = Mappers.getMapper(SwitchConvert.class); |
||||
|
|
||||
|
SwitchDO convert(SwitchCreateReqVO bean); |
||||
|
|
||||
|
SwitchDO convert(SwitchUpdateReqVO bean); |
||||
|
|
||||
|
SwitchRespVO convert(SwitchDO bean); |
||||
|
|
||||
|
List<SwitchRespVO> convertList(List<SwitchDO> list); |
||||
|
|
||||
|
PageResult<SwitchRespVO> convertPage(PageResult<SwitchDO> page); |
||||
|
|
||||
|
List<SwitchExcelVO> convertList02(List<SwitchDO> list); |
||||
|
|
||||
|
} |
@ -0,0 +1,44 @@ |
|||||
|
package com.win.module.wms.dal.dataobject.documentSwitch; |
||||
|
|
||||
|
import lombok.*; |
||||
|
import java.util.*; |
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import com.win.framework.mybatis.core.dataobject.BaseDO; |
||||
|
|
||||
|
/** |
||||
|
* 单据开关 DO |
||||
|
* |
||||
|
* @author 源码 |
||||
|
*/ |
||||
|
@TableName("document_switch") |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@ToString(callSuper = true) |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class SwitchDO extends BaseDO { |
||||
|
|
||||
|
/** |
||||
|
* id |
||||
|
*/ |
||||
|
@TableId |
||||
|
private Long id; |
||||
|
/** |
||||
|
* 代码 |
||||
|
*/ |
||||
|
private String code; |
||||
|
/** |
||||
|
* 描述 |
||||
|
*/ |
||||
|
private String description; |
||||
|
/** |
||||
|
* 有效设置值 TRUE FALSE |
||||
|
*/ |
||||
|
private String effectiveSetValue; |
||||
|
/** |
||||
|
* 是否可用 |
||||
|
*/ |
||||
|
private String available; |
||||
|
|
||||
|
} |
@ -0,0 +1,39 @@ |
|||||
|
package com.win.module.wms.dal.mysql.documentSwitch; |
||||
|
|
||||
|
import java.util.*; |
||||
|
|
||||
|
import com.win.framework.common.pojo.PageResult; |
||||
|
import com.win.framework.mybatis.core.query.LambdaQueryWrapperX; |
||||
|
import com.win.framework.mybatis.core.mapper.BaseMapperX; |
||||
|
import com.win.module.wms.controller.documentSwitch.vo.SwitchExportReqVO; |
||||
|
import com.win.module.wms.controller.documentSwitch.vo.SwitchPageReqVO; |
||||
|
import com.win.module.wms.dal.dataobject.documentSwitch.SwitchDO; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
/** |
||||
|
* 单据开关 Mapper |
||||
|
* |
||||
|
* @author 源码 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface SwitchMapper extends BaseMapperX<SwitchDO> { |
||||
|
|
||||
|
default PageResult<SwitchDO> selectPage(SwitchPageReqVO reqVO) { |
||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<SwitchDO>() |
||||
|
.eqIfPresent(SwitchDO::getCode, reqVO.getCode()) |
||||
|
.eqIfPresent(SwitchDO::getDescription, reqVO.getDescription()) |
||||
|
.eqIfPresent(SwitchDO::getEffectiveSetValue, reqVO.getEffectiveSetValue()) |
||||
|
.eqIfPresent(SwitchDO::getAvailable, reqVO.getAvailable()) |
||||
|
.orderByDesc(SwitchDO::getId)); |
||||
|
} |
||||
|
|
||||
|
default List<SwitchDO> selectList(SwitchExportReqVO reqVO) { |
||||
|
return selectList(new LambdaQueryWrapperX<SwitchDO>() |
||||
|
.eqIfPresent(SwitchDO::getCode, reqVO.getCode()) |
||||
|
.eqIfPresent(SwitchDO::getDescription, reqVO.getDescription()) |
||||
|
.eqIfPresent(SwitchDO::getEffectiveSetValue, reqVO.getEffectiveSetValue()) |
||||
|
.eqIfPresent(SwitchDO::getAvailable, reqVO.getAvailable()) |
||||
|
.orderByDesc(SwitchDO::getId)); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,82 @@ |
|||||
|
package com.win.module.wms.service.documentSwitch; |
||||
|
|
||||
|
import java.util.*; |
||||
|
import javax.validation.*; |
||||
|
|
||||
|
import com.win.module.wms.controller.documentSwitch.vo.SwitchCreateReqVO; |
||||
|
import com.win.module.wms.controller.documentSwitch.vo.SwitchExportReqVO; |
||||
|
import com.win.module.wms.controller.documentSwitch.vo.SwitchPageReqVO; |
||||
|
import com.win.module.wms.controller.documentSwitch.vo.SwitchUpdateReqVO; |
||||
|
import com.win.module.wms.dal.dataobject.documentSwitch.SwitchDO; |
||||
|
import com.win.framework.common.pojo.PageResult; |
||||
|
|
||||
|
/** |
||||
|
* 单据开关 Service 接口 |
||||
|
* |
||||
|
* @author 源码 |
||||
|
*/ |
||||
|
public interface SwitchService { |
||||
|
|
||||
|
/** |
||||
|
* 创建单据开关 |
||||
|
* |
||||
|
* @param createReqVO 创建信息 |
||||
|
* @return 编号 |
||||
|
*/ |
||||
|
Long createSwitch(@Valid SwitchCreateReqVO createReqVO); |
||||
|
|
||||
|
/** |
||||
|
* 更新单据开关 |
||||
|
* |
||||
|
* @param updateReqVO 更新信息 |
||||
|
*/ |
||||
|
void updateSwitch(@Valid SwitchUpdateReqVO updateReqVO); |
||||
|
|
||||
|
/** |
||||
|
* 删除单据开关 |
||||
|
* |
||||
|
* @param id 编号 |
||||
|
*/ |
||||
|
void deleteSwitch(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 获得单据开关 |
||||
|
* |
||||
|
* @param id 编号 |
||||
|
* @return 单据开关 |
||||
|
*/ |
||||
|
SwitchDO getSwitch(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 获得单据开关列表 |
||||
|
* |
||||
|
* @param ids 编号 |
||||
|
* @return 单据开关列表 |
||||
|
*/ |
||||
|
List<SwitchDO> getSwitchList(Collection<Long> ids); |
||||
|
|
||||
|
/** |
||||
|
* 获得单据开关分页 |
||||
|
* |
||||
|
* @param pageReqVO 分页查询 |
||||
|
* @return 单据开关分页 |
||||
|
*/ |
||||
|
PageResult<SwitchDO> getSwitchPage(SwitchPageReqVO pageReqVO); |
||||
|
|
||||
|
/** |
||||
|
* 获得单据开关列表, 用于 Excel 导出 |
||||
|
* |
||||
|
* @param exportReqVO 查询条件 |
||||
|
* @return 单据开关列表 |
||||
|
*/ |
||||
|
List<SwitchDO> getSwitchList(SwitchExportReqVO exportReqVO); |
||||
|
|
||||
|
/** |
||||
|
* Setting-----QSwitch |
||||
|
* 查询单据开关是否存在 |
||||
|
* @author chenfang |
||||
|
* @param pcode code |
||||
|
* @return |
||||
|
*/ |
||||
|
public SwitchDO selectSwitchExist(String pcode); |
||||
|
} |
@ -0,0 +1,98 @@ |
|||||
|
package com.win.module.wms.service.documentSwitch; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.win.module.wms.controller.documentSwitch.vo.SwitchCreateReqVO; |
||||
|
import com.win.module.wms.controller.documentSwitch.vo.SwitchExportReqVO; |
||||
|
import com.win.module.wms.controller.documentSwitch.vo.SwitchPageReqVO; |
||||
|
import com.win.module.wms.controller.documentSwitch.vo.SwitchUpdateReqVO; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import javax.annotation.Resource; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
|
||||
|
import java.util.*; |
||||
|
|
||||
|
import com.win.module.wms.dal.dataobject.documentSwitch.SwitchDO; |
||||
|
import com.win.framework.common.pojo.PageResult; |
||||
|
|
||||
|
import com.win.module.wms.convert.documentSwitch.SwitchConvert; |
||||
|
import com.win.module.wms.dal.mysql.documentSwitch.SwitchMapper; |
||||
|
|
||||
|
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; |
||||
|
import static com.win.module.wms.enums.ErrorCodeConstants.*; |
||||
|
|
||||
|
/** |
||||
|
* 单据开关 Service 实现类 |
||||
|
* |
||||
|
* @author 源码 |
||||
|
*/ |
||||
|
@Service |
||||
|
@Validated |
||||
|
public class SwitchServiceImpl implements SwitchService { |
||||
|
|
||||
|
@Resource |
||||
|
private SwitchMapper switchMapper; |
||||
|
|
||||
|
@Override |
||||
|
public Long createSwitch(SwitchCreateReqVO createReqVO) { |
||||
|
// 插入
|
||||
|
SwitchDO documentSwitch = SwitchConvert.INSTANCE.convert(createReqVO); |
||||
|
switchMapper.insert(documentSwitch); |
||||
|
// 返回
|
||||
|
return documentSwitch.getId(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void updateSwitch(SwitchUpdateReqVO updateReqVO) { |
||||
|
// 校验存在
|
||||
|
validateSwitchExists(updateReqVO.getId()); |
||||
|
// 更新
|
||||
|
SwitchDO updateObj = SwitchConvert.INSTANCE.convert(updateReqVO); |
||||
|
switchMapper.updateById(updateObj); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void deleteSwitch(Long id) { |
||||
|
// 校验存在
|
||||
|
validateSwitchExists(id); |
||||
|
// 删除
|
||||
|
switchMapper.deleteById(id); |
||||
|
} |
||||
|
|
||||
|
private void validateSwitchExists(Long id) { |
||||
|
if (switchMapper.selectById(id) == null) { |
||||
|
throw exception(SWITCH_NOT_EXISTS); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public SwitchDO getSwitch(Long id) { |
||||
|
return switchMapper.selectById(id); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<SwitchDO> getSwitchList(Collection<Long> ids) { |
||||
|
return switchMapper.selectBatchIds(ids); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public PageResult<SwitchDO> getSwitchPage(SwitchPageReqVO pageReqVO) { |
||||
|
return switchMapper.selectPage(pageReqVO); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<SwitchDO> getSwitchList(SwitchExportReqVO exportReqVO) { |
||||
|
return switchMapper.selectList(exportReqVO); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public SwitchDO selectSwitchExist(String pcode){ |
||||
|
QueryWrapper queryWrapper = new QueryWrapper(); |
||||
|
queryWrapper.eq("code",pcode); |
||||
|
SwitchDO switchDO = switchMapper.selectOne(queryWrapper); |
||||
|
if(switchDO != null && "TRUE".equals(switchDO.getAvailable())){ |
||||
|
return switchDO; |
||||
|
}else { |
||||
|
throw exception(SWITCH_NOT_EXISTS); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
<?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.win.module.wms.dal.mysql.documentSwitch.SwitchMapper"> |
||||
|
|
||||
|
<!-- |
||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 |
||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 |
||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 |
||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ |
||||
|
--> |
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue