liyong
2026-05-09 67fda7b2dfbfc9e6a8d8b9472499a67906d2bad1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package com.ruoyi.production.service.impl;
 
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Assert;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.enums.IsDeleteEnum;
import com.ruoyi.production.bean.dto.WorkshopDto;
import com.ruoyi.production.bean.vo.SaveWorkshopVo;
import com.ruoyi.production.bean.vo.SearchWorkshopVo;
import com.ruoyi.production.mapper.WorkshopMapper;
import com.ruoyi.production.pojo.Workshop;
import com.ruoyi.production.service.WorkshopService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
/**
 * @author buhuazhen
 * @description 针对表【workshop(车间表)】的数据库操作Service实现
 * @createDate 2026-05-08 09:11:49
 */
@Service
@RequiredArgsConstructor
public class WorkshopServiceImpl extends ServiceImpl<WorkshopMapper, Workshop>
        implements WorkshopService {
 
    private final WorkshopMapper workshopMapper;
 
    @Override
    @Transactional
    public void save(SaveWorkshopVo saveWorkshopVo) {
        Workshop workshop = BeanUtil.copyProperties(saveWorkshopVo, Workshop.class);
        workshopMapper.insertOrUpdate(workshop);
    }
 
    @Override
    @Transactional
    public void deleteById(Long id) {
        Assert.notNull(id,"workshop 没有传入Id");
        Workshop workshop = new Workshop();
        workshop.setId(id);
        workshop.setIsDelete(IsDeleteEnum.DELETED.getCode());
        workshopMapper.updateById(workshop);
    }
 
    @Override
    public Page<WorkshopDto> pageList(SearchWorkshopVo searchWorkshopVo) {
        return workshopMapper.pageList(searchWorkshopVo);
    }
}