This commit is contained in:
PQZ 2024-09-23 15:24:09 +08:00
parent dc5f77853e
commit f3ac071e5b
5 changed files with 130 additions and 53 deletions

View File

@ -1,13 +1,14 @@
package cn.iocoder.yudao.module.project.controller.admin; package cn.iocoder.yudao.module.project.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.project.entity.RepairOrderInfo; import cn.iocoder.yudao.module.project.entity.RepairOrderInfo;
import cn.iocoder.yudao.module.project.service.RepairOrderInfoService; import cn.iocoder.yudao.module.project.service.RepairOrderInfoService;
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoPageReqVO; import cn.iocoder.yudao.module.project.vo.RepairOrderInfoPageReqVO;
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoRespVO; import cn.iocoder.yudao.module.project.vo.RepairOrderInfoRespVO;
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoSaveReqVO; import cn.iocoder.yudao.module.project.vo.RepairOrderInfoSaveReqVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
@ -27,29 +28,15 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
public class RepairOrderInfoController { public class RepairOrderInfoController {
@Resource @Resource
private RepairOrderInfoService orderInfoService; private RepairOrderInfoService repairOrderInfoService;
@PostMapping("/create")
@Operation(summary = "创建维修模块 订单")
@PreAuthorize("@ss.hasPermission('repair:order-info:create')")
public CommonResult<String> createOrderInfo(@Valid @RequestBody RepairOrderInfoSaveReqVO createReqVO) {
return success(orderInfoService.createOrderInfo(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新维修模块 订单")
@PreAuthorize("@ss.hasPermission('repair:order-info:update')")
public CommonResult<Boolean> updateOrderInfo(@Valid @RequestBody RepairOrderInfoSaveReqVO updateReqVO) {
orderInfoService.updateOrderInfo(updateReqVO);
return success(true);
}
@DeleteMapping("/delete") @DeleteMapping("/delete")
@Operation(summary = "删除维修模块 订单") @Operation(summary = "删除维修模块 订单")
@Parameter(name = "id", description = "编号", required = true) @Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('repair:order-info:delete')") @PreAuthorize("@ss.hasPermission('repair:order-info:delete')")
public CommonResult<Boolean> deleteOrderInfo(@RequestParam("id") String id) { public CommonResult<Boolean> deleteOrderInfo(@RequestParam("id") String id) {
orderInfoService.deleteOrderInfo(id); repairOrderInfoService.deleteOrderInfo(id);
return success(true); return success(true);
} }
@ -58,16 +45,28 @@ public class RepairOrderInfoController {
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('repair:order-info:query')") @PreAuthorize("@ss.hasPermission('repair:order-info:query')")
public CommonResult<RepairOrderInfoRespVO> getOrderInfo(@RequestParam("id") String id) { public CommonResult<RepairOrderInfoRespVO> getOrderInfo(@RequestParam("id") String id) {
RepairOrderInfo orderInfo = orderInfoService.getOrderInfo(id); RepairOrderInfo orderInfo = repairOrderInfoService.getOrderInfo(id);
return success(BeanUtils.toBean(orderInfo, RepairOrderInfoRespVO.class)); return success(BeanUtils.toBean(orderInfo, RepairOrderInfoRespVO.class));
} }
/**
* 分页查询订单内容
*
* @param pageReqVO RepairOrderInfoPageReqVO实体
* @param pageNo 分页参数
* @param pageSize 分页参数
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<com.baomidou.mybatisplus.core.metadata.IPage < ?>>
* @author PQZ
* @date 14:30 2024/9/23
**/
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得维修模块 订单分页") @Operation(summary = "获得维修模块 订单分页")
@PreAuthorize("@ss.hasPermission('repair:order-info:query')") @PreAuthorize("@ss.hasPermission('repair:order-info:query')")
public CommonResult<PageResult<RepairOrderInfoRespVO>> getOrderInfoPage(@Valid RepairOrderInfoPageReqVO pageReqVO) { public CommonResult<IPage<?>> getOrderInfoPage(@Valid RepairOrderInfoPageReqVO pageReqVO,
PageResult<RepairOrderInfo> pageResult = orderInfoService.getOrderInfoPage(pageReqVO); @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
return success(BeanUtils.toBean(pageResult, RepairOrderInfoRespVO.class)); @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
Page<RepairOrderInfoRespVO> page = new Page<>(pageNo, pageSize);
return success(repairOrderInfoService.queryListPage(pageReqVO,page));
} }

View File

@ -1,8 +1,13 @@
package cn.iocoder.yudao.module.project.mapper; package cn.iocoder.yudao.module.project.mapper;
import cn.iocoder.yudao.module.project.entity.RepairOrderInfo; import cn.iocoder.yudao.module.project.entity.RepairOrderInfo;
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoPageReqVO;
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoRespVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* 维修模块 订单 Mapper * 维修模块 订单 Mapper
@ -12,4 +17,16 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface RepairOrderInfoMapper extends BaseMapper<RepairOrderInfo> { public interface RepairOrderInfoMapper extends BaseMapper<RepairOrderInfo> {
/**
* 分页查询订单信息
*
* @param entity RepairOrderInfoPageReqVO实体
* @param page 分页参数
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.project.vo.RepairOrderInfoRespVO>
* @author PQZ
* @date 14:37 2024/9/23
**/
IPage<RepairOrderInfoRespVO> queryListPage(@Param("entity") RepairOrderInfoPageReqVO entity, Page<RepairOrderInfoRespVO> page);
} }

View File

@ -3,31 +3,28 @@ package cn.iocoder.yudao.module.project.service;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.project.entity.RepairOrderInfo; import cn.iocoder.yudao.module.project.entity.RepairOrderInfo;
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoPageReqVO; import cn.iocoder.yudao.module.project.vo.RepairOrderInfoPageReqVO;
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoRespVO;
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoSaveReqVO; import cn.iocoder.yudao.module.project.vo.RepairOrderInfoSaveReqVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import javax.validation.Valid; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
/** /**
* 维修模块 订单 Service 接口 * 维修模块 订单 Service 接口
* *
* @author pqz * @author pqz
*/ */
public interface RepairOrderInfoService { public interface RepairOrderInfoService extends IService<RepairOrderInfo> {
/** /**
* 创建维修模块 订单 * 保存订单信息
* *
* @param createReqVO 创建信息 * @param saveReqVO TODO
* @return 编号 * @author PQZ
*/ * @date 14:57 2024/9/23
String createOrderInfo(@Valid RepairOrderInfoSaveReqVO createReqVO); **/
void saveOrderInfo(RepairOrderInfoSaveReqVO saveReqVO);
/**
* 更新维修模块 订单
*
* @param updateReqVO 更新信息
*/
void updateOrderInfo(@Valid RepairOrderInfoSaveReqVO updateReqVO);
/** /**
* 删除维修模块 订单 * 删除维修模块 订单
@ -52,4 +49,16 @@ public interface RepairOrderInfoService {
*/ */
PageResult<RepairOrderInfo> getOrderInfoPage(RepairOrderInfoPageReqVO pageReqVO); PageResult<RepairOrderInfo> getOrderInfoPage(RepairOrderInfoPageReqVO pageReqVO);
/**
* 分页查询订单信息
*
* @param pageReqVO RepairOrderInfoPageReqVO实体
* @param page 分页参数
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.project.vo.RepairOrderInfoRespVO>
* @author PQZ
* @date 14:36 2024/9/23
**/
IPage<RepairOrderInfoRespVO> queryListPage(RepairOrderInfoPageReqVO pageReqVO, Page<RepairOrderInfoRespVO> page);
} }

View File

@ -6,7 +6,11 @@ import cn.iocoder.yudao.module.project.entity.RepairOrderInfo;
import cn.iocoder.yudao.module.project.mapper.RepairOrderInfoMapper; import cn.iocoder.yudao.module.project.mapper.RepairOrderInfoMapper;
import cn.iocoder.yudao.module.project.service.RepairOrderInfoService; import cn.iocoder.yudao.module.project.service.RepairOrderInfoService;
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoPageReqVO; import cn.iocoder.yudao.module.project.vo.RepairOrderInfoPageReqVO;
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoRespVO;
import cn.iocoder.yudao.module.project.vo.RepairOrderInfoSaveReqVO; import cn.iocoder.yudao.module.project.vo.RepairOrderInfoSaveReqVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -19,38 +23,36 @@ import javax.annotation.Resource;
*/ */
@Service @Service
@Validated @Validated
public class RepairOrderInfoServiceImpl implements RepairOrderInfoService { public class RepairOrderInfoServiceImpl extends ServiceImpl<RepairOrderInfoMapper, RepairOrderInfo> implements RepairOrderInfoService {
@Resource @Resource
private RepairOrderInfoMapper orderInfoMapper; private RepairOrderInfoMapper repairOrderInfoMapper;
@Override
public String createOrderInfo(RepairOrderInfoSaveReqVO createReqVO) {
// 插入
RepairOrderInfo orderInfo = BeanUtils.toBean(createReqVO, RepairOrderInfo.class);
orderInfoMapper.insert(orderInfo);
// 返回
return orderInfo.getId();
}
/**
* 保存订单信息
*
* @param saveReqVO RepairOrderInfoSaveReqVO实体
* @author PQZ
* @date 14:57 2024/9/23
**/
@Override @Override
public void updateOrderInfo(RepairOrderInfoSaveReqVO updateReqVO) { public void saveOrderInfo(RepairOrderInfoSaveReqVO saveReqVO) {
// 更新 RepairOrderInfo save = BeanUtils.toBean(saveReqVO, RepairOrderInfo.class);
RepairOrderInfo updateObj = BeanUtils.toBean(updateReqVO, RepairOrderInfo.class); saveOrUpdate(save);
orderInfoMapper.updateById(updateObj);
} }
@Override @Override
public void deleteOrderInfo(String id) { public void deleteOrderInfo(String id) {
// 删除 // 删除
orderInfoMapper.deleteById(id); repairOrderInfoMapper.deleteById(id);
} }
@Override @Override
public RepairOrderInfo getOrderInfo(String id) { public RepairOrderInfo getOrderInfo(String id) {
return orderInfoMapper.selectById(id); return repairOrderInfoMapper.selectById(id);
} }
@Override @Override
@ -58,4 +60,18 @@ public class RepairOrderInfoServiceImpl implements RepairOrderInfoService {
return null; return null;
} }
/**
* 分页查询订单信息
*
* @param pageReqVO RepairOrderInfoPageReqVO实体
* @param page 分页参数
* @return com.baomidou.mybatisplus.core.metadata.IPage<cn.iocoder.yudao.module.project.vo.RepairOrderInfoRespVO>
* @author PQZ
* @date 14:36 2024/9/23
**/
@Override
public IPage<RepairOrderInfoRespVO> queryListPage(RepairOrderInfoPageReqVO pageReqVO, Page<RepairOrderInfoRespVO> page) {
return repairOrderInfoMapper.queryListPage(pageReqVO, page);
}
} }

View File

@ -0,0 +1,36 @@
<?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="cn.iocoder.yudao.module.project.mapper.RepairOrderInfoMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="queryListPage" resultType="cn.iocoder.yudao.module.project.vo.RepairOrderInfoRespVO">
SELECT
roi.*
FROM
repair_order_info roi
<where>
roi.deleted = 0
<if test="entity.orderNo != null and entity.orderNo != ''">
and roi.order_no like concat('%', #{entity.orderNo}, '%')
</if>
<if test="entity.goodsTitle != null and entity.goodsTitle != ''">
and roi.goods_totle like concat('%', #{entity.goodsTitle}, '%')
</if>
<if test="entity.goodsType != null and entity.goodsType != ''">
and roi.goods_type = #{entity.goodsType}
</if>
<if test="entity.cusName != null and entity.cusName != ''">
and roi.cus_name like concat('%', #{entity.cusName}, '%')
</if>
<if test="entity.orderStatus != null and entity.orderStatus != ''">
and roi.order_status = #{entity.orderStatus}
</if>
</where>
</select>
</mapper>