gaoluyang
5 天以前 d39e4f7d839167c16425086dfa2f8747bccfdff9
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
package cn.iocoder.yudao.module.srm.dal.mysql;
 
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.srm.controller.admin.inquiry.vo.SrmInquiryPageReqVO;
import cn.iocoder.yudao.module.srm.dal.dataobject.SrmInquiryDO;
import org.apache.ibatis.annotations.Mapper;
 
import java.util.List;
 
@Mapper
public interface SrmInquiryMapper extends BaseMapperX<SrmInquiryDO> {
 
    default PageResult<SrmInquiryDO> selectPage(SrmInquiryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SrmInquiryDO>()
                .likeIfPresent(SrmInquiryDO::getNo, reqVO.getNo())
                .likeIfPresent(SrmInquiryDO::getTitle, reqVO.getTitle())
                .eqIfPresent(SrmInquiryDO::getStatus, reqVO.getStatus())
                .geIfPresent(SrmInquiryDO::getInquiryDate, reqVO.getInquiryDateStart())
                .leIfPresent(SrmInquiryDO::getInquiryDate, reqVO.getInquiryDateEnd())
                .orderByDesc(SrmInquiryDO::getId));
    }
 
    default SrmInquiryDO selectByNo(String no) {
        return selectOne(SrmInquiryDO::getNo, no);
    }
 
    default List<SrmInquiryDO> selectListByStatus(Integer status) {
        return selectList(SrmInquiryDO::getStatus, status);
    }
 
    /**
     * 按当前状态条件更新,避免并发重复确认
     */
    default int updateByIdAndStatus(Long id, Integer whereStatus, SrmInquiryDO updateObj) {
        return update(updateObj, new com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper<SrmInquiryDO>()
                .eq(SrmInquiryDO::getId, id)
                .eq(SrmInquiryDO::getStatus, whereStatus));
    }
 
}