更新代码

This commit is contained in:
xiao-fajia 2024-09-18 15:04:54 +08:00
parent 90992c5990
commit 419406abad
13 changed files with 219 additions and 66 deletions

View File

@ -37,7 +37,7 @@ public class DlRepairSoController {
* @date 10:49 2024/9/14
**/
@PostMapping("/create")
@Operation(summary = "采购单/领料单新增")
@Operation(summary = "采购单/领料单 新增")
public CommonResult<?> createRepairSo(@RequestBody DlRepairSoRespVO repairSoRespVO) {
dlRepairSoService.createRepairSo(repairSoRespVO);
return CommonResult.ok();
@ -53,12 +53,26 @@ public class DlRepairSoController {
* @date 18:14 2024/9/14
**/
@GetMapping("/page")
@Operation(summary = "采购单/领料单新增分页")
@Operation(summary = "采购单/领料单 分页")
public CommonResult<?> getRepairSoPage(DlRepairSoReqVO repairSoReqVO,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
Page<DlRepairSo> page = new Page<>(pageNo, pageSize);
return success(dlRepairSoService.getRepairSoPage(repairSoReqVO, page));
}
/**
* 采购单/领料单 作废
*
* @author 小李
* @date 11:12 2024/9/18
* @param repairSoReqVO 作废对象
**/
@PostMapping("/void")
@Operation(summary = "采购单/领料单 作废")
public CommonResult<?> voidRepairSo(@RequestBody DlRepairSoReqVO repairSoReqVO) {
dlRepairSoService.voidRepairSo(repairSoReqVO);
return CommonResult.ok();
}
}

View File

@ -1,12 +1,21 @@
package cn.iocoder.yudao.module.stockOperate.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoiService;
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoiReqVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
* 采购单领料单子表(DlRepairSoi)表控制层
* @author 小李
@ -21,60 +30,22 @@ public class DlRepairSoiController{
@Resource
private DlRepairSoiService dlRepairSoiService;
// /**
// * 分页查询所有数据
// *
// * @param page 分页对象
// * @param dlRepairSoi 查询实体
// * @return 所有数据
// */
// @GetMapping
// public R selectAll(Page<DlRepairSoi> page, DlRepairSoi dlRepairSoi) {
// return success(this.dlRepairSoiService.page(page, new QueryWrapper<>(dlRepairSoi)));
// }
//
// /**
// * 通过主键查询单条数据
// *
// * @param id 主键
// * @return 单条数据
// */
// @GetMapping("{id}")
// public R selectOne(@PathVariable Serializable id) {
// return success(this.dlRepairSoiService.getById(id));
// }
//
// /**
// * 新增数据
// *
// * @param dlRepairSoi 实体对象
// * @return 新增结果
// */
// @PostMapping
// public R insert(@RequestBody DlRepairSoi dlRepairSoi) {
// return success(this.dlRepairSoiService.save(dlRepairSoi));
// }
//
// /**
// * 修改数据
// *
// * @param dlRepairSoi 实体对象
// * @return 修改结果
// */
// @PutMapping
// public R update(@RequestBody DlRepairSoi dlRepairSoi) {
// return success(this.dlRepairSoiService.updateById(dlRepairSoi));
// }
//
// /**
// * 删除数据
// *
// * @param idList 主键结合
// * @return 删除结果
// */
// @DeleteMapping
// public R delete(@RequestParam("idList") List<Long> idList) {
// return success(this.dlRepairSoiService.removeByIds(idList));
// }
/**
* 采购单领料单子表 分页
*
* @author 小李
* @date 10:44 2024/9/18
* @param repairSoiReqVO 查询对象
* @param pageNo 页码
* @param pageSize 条数
**/
@GetMapping("/page")
@Operation(summary = "采购单领料单子表 分页")
public CommonResult<?> getRepairSoiPage(DlRepairSoiReqVO repairSoiReqVO,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){
Page<DlRepairSoi> page = new Page<>(pageNo, pageSize);
return success(dlRepairSoiService.getRepairSoiPage(repairSoiReqVO, page));
}
}

View File

@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.math.BigDecimal;
@ -69,6 +71,8 @@ public class DlRepairSo extends TenantBaseDO {
/**
* 采购时间/领料时间
*/
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern="yyyy-MM-dd")
private Date soTime;
/**

View File

@ -29,10 +29,15 @@ public class DlRepairSoi extends TenantBaseDO {
private String id;
/**
* 采购单ID(dl_repair_so表的ID)
* 采购单/领料单ID(dl_repair_so表的ID)
*/
private String soId;
/**
* 子表类型(字典repair_so_type)
**/
private String soiType;
/**
* 配件表ID(dl_base_type的ID)
*/

View File

@ -1,8 +1,12 @@
package cn.iocoder.yudao.module.stockOperate.mapper;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoiReqVO;
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.Param;
/**
* 针对表dl_repair_soi(采购单领料单子表)的数据库操作Mapper
@ -11,6 +15,15 @@ import org.apache.ibatis.annotations.Mapper;
**/
@Mapper
public interface DlRepairSoiMapper extends BaseMapper<DlRepairSoi> {
/**
* 采购单领料单子表 分页
*
* @author 小李
* @date 10:44 2024/9/18
* @param repairSoiReqVO 查询对象
**/
IPage<DlRepairSoi> getRepairSoiPage(@Param("map") DlRepairSoiReqVO repairSoiReqVO, Page<DlRepairSoi> page);
}

View File

@ -31,4 +31,13 @@ public interface DlRepairSoService extends IService<DlRepairSo> {
* @date 18:14 2024/9/14
**/
IPage<DlRepairSo> getRepairSoPage(DlRepairSoReqVO repairSoReqVO, Page<DlRepairSo> page);
/**
* 采购单/领料单 作废
*
* @author 小李
* @date 11:12 2024/9/18
* @param repairSoReqVO 作废对象
**/
void voidRepairSo(DlRepairSoReqVO repairSoReqVO);
}

View File

@ -1,6 +1,9 @@
package cn.iocoder.yudao.module.stockOperate.service;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoiReqVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
/**
@ -9,4 +12,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
* @date 9:09 2024/9/13
**/
public interface DlRepairSoiService extends IService<DlRepairSoi> {
/**
* 采购单领料单子表 分页
*
* @author 小李
* @date 10:44 2024/9/18
* @param repairSoiReqVO 查询对象
**/
IPage<DlRepairSoi> getRepairSoiPage(DlRepairSoiReqVO repairSoiReqVO, Page<DlRepairSoi> page);
}

View File

@ -1,15 +1,21 @@
package cn.iocoder.yudao.module.stockOperate.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.common.RepairErrorCodeConstants;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.company.entity.Company;
import cn.iocoder.yudao.module.company.service.CompanyService;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
import cn.iocoder.yudao.module.stockOperate.mapper.DlRepairSoMapper;
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoService;
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoiService;
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoReqVO;
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoRespVO;
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -17,9 +23,6 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
/**
@ -35,6 +38,12 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
@Resource
private DlRepairSoiService repairSoiService;
@Resource
private DeptApi deptApi;
@Resource
private CompanyService companyService;
/**
* 采购单/领料单 新增
* @author 小李
@ -44,6 +53,17 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
@DSTransactional
@Override
public void createRepairSo(DlRepairSoRespVO repairSoRespVO){
// 取当前登录用户的门店信息
Long deptId = SecurityFrameworkUtils.getLoginUserDeptId();
repairSoRespVO.setDeptId(deptId);
DeptRespDTO dept = deptApi.getDept(deptId);
if (ObjectUtil.isNotEmpty(dept)){
repairSoRespVO.setCorpId(dept.getCorpId());
Company company = companyService.getById(dept.getCorpId());
repairSoRespVO.setCorpName(company.getCorpName());
}
// 新增主表
baseMapper.insertOrUpdate(repairSoRespVO);
// 新增子表
@ -65,6 +85,18 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
public IPage<DlRepairSo> getRepairSoPage(DlRepairSoReqVO repairSoReqVO, Page<DlRepairSo> page){
return baseMapper.getRepairSoPage(repairSoReqVO, page);
}
/**
* 采购单/领料单 作废
*
* @author 小李
* @date 11:12 2024/9/18
* @param repairSoReqVO 作废对象
**/
@Override
public void voidRepairSo(DlRepairSoReqVO repairSoReqVO){
baseMapper.updateById(repairSoReqVO);
}
}

View File

@ -3,6 +3,9 @@ package cn.iocoder.yudao.module.stockOperate.service.impl;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
import cn.iocoder.yudao.module.stockOperate.mapper.DlRepairSoiMapper;
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoiService;
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoiReqVO;
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;
@ -15,6 +18,18 @@ import org.springframework.stereotype.Service;
@Service
public class DlRepairSoiServiceImpl extends ServiceImpl<DlRepairSoiMapper, DlRepairSoi>
implements DlRepairSoiService {
/**
* 采购单领料单子表 分页
*
* @author 小李
* @date 10:44 2024/9/18
* @param repairSoiReqVO 查询对象
**/
@Override
public IPage<DlRepairSoi> getRepairSoiPage(DlRepairSoiReqVO repairSoiReqVO, Page<DlRepairSoi> page){
return baseMapper.getRepairSoiPage(repairSoiReqVO, page);
}
}

View File

@ -1,7 +1,13 @@
package cn.iocoder.yudao.module.stockOperate.vo;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 采购单/领料单 请求VO
@ -10,4 +16,8 @@ import lombok.Data;
**/
@Data
public class DlRepairSoReqVO extends DlRepairSo {
@Schema(description = "时间区间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] searchTimeArray;
}

View File

@ -1,7 +1,13 @@
package cn.iocoder.yudao.module.stockOperate.vo;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 采购单/领料单子表 请求VO
@ -10,4 +16,14 @@ import lombok.Data;
**/
@Data
public class DlRepairSoiReqVO extends DlRepairSoi {
@Schema(pattern = "时间区间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] searchTimeArray;
@Schema(pattern = "单据状态")
private String soStatus;
@Schema(pattern = "门店")
private String corpId;
}

View File

@ -21,6 +21,9 @@
<result property="corpId" column="corp_id" jdbcType="VARCHAR"/>
<result property="corpName" column="corp_name" jdbcType="VARCHAR"/>
<result property="deptId" column="dept_id" jdbcType="BIGINT"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="updater" column="updater" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_SQL">
@ -39,13 +42,35 @@
remark,
corp_id,
corp_name,
dept_id
dept_id,
create_time,
update_time,
updater
from dl_repair_so so
where so.deleted = '0'
</sql>
<select id="getRepairSoPage" resultMap="BaseResultMap">
<include refid="Base_SQL"/>
and so_type = #{map.soType}
and so_type = #{map.soType} and purchase_type = #{map.purchaseType}
<if test="map.soStatus != null and map.soStatus != ''">
and so.so_status = #{map.soStatus}
</if>
<if test="map.searchTimeArray != null and map.searchTimeArray.length > 0">
and (so.create_time between #{map.searchTimeArray[0]} and #{map.searchTimeArray[1]})
</if>
<if test="map.supplierId != null and map.supplierId != ''">
and so.supplier_id = #{map.supplierId}
</if>
<if test="map.soStatus != null and map.soStatus != ''">
and so.so_status = #{map.soStatus}
</if>
<if test="map.corpId != null and map.corpId != ''">
and so.corp_id = #{map.corpId}
</if>
<if test="map.soNo != null and map.soNo != ''">
and (so.so_no like concat('%', #{map.soNo}, '%') or so.remark like concat('%', #{map.soNo}, '%'))
</if>
order by so.create_time desc
</select>
</mapper>

View File

@ -7,6 +7,7 @@
<resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi">
<id property="id" column="id" jdbcType="VARCHAR"/>
<result property="soId" column="so_id" jdbcType="VARCHAR"/>
<result property="soiType" column="soi_type" jdbcType="VARCHAR"/>
<result property="goodsId" column="goods_id" jdbcType="VARCHAR"/>
<result property="goodsType" column="goods_type" jdbcType="VARCHAR"/>
<result property="wareId" column="ware_id" jdbcType="VARCHAR"/>
@ -16,15 +17,41 @@
</resultMap>
<sql id="Base_SQL">
select id,
select soi.id,
so_id,
soi_type,
goods_id,
goods_type,
ware_id,
goods_count,
goods_price,
remark
soi.remark,
so.create_time,
so.so_status,
so.corp_id
from dl_repair_soi soi
left join
dl_repair_so so
on soi.so_id = so.id
where soi.deleted = '0'
</sql>
<select id="getRepairSoiPage" resultMap="BaseResultMap">
<include refid="Base_SQL" />
<if test="map.goodsType != null and map.goodsType != ''">
and soi.goods_type = #{map.goodsType}
</if>
<if test="map.soiType != null and map.soiType != ''">
and soi.soi_type = #{map.soiType}
</if>
<if test="map.searchTimeArray != null and map.searchTimeArray.length > 0">
and (so.create_time between #{map.searchTimeArray[0]} and #{map.searchTimeArray[1]})
</if>
<if test="map.soStatus != null and map.soStatus != ''">
and so.so_status = #{map.soStatus}
</if>
<if test="map.corpId != null and map.corpId != ''">
and so.corp_id = #{map.corpId}
</if>
</select>
</mapper>