提交 | 用户 | 时间
e7c126 1 package com.iailab.module.system.dal.mysql.dict;
H 2
3 import com.iailab.framework.common.pojo.PageResult;
4 import com.iailab.framework.mybatis.core.mapper.BaseMapperX;
5 import com.iailab.framework.mybatis.core.query.LambdaQueryWrapperX;
6 import com.iailab.module.system.controller.admin.dict.vo.type.DictTypePageReqVO;
7 import com.iailab.module.system.dal.dataobject.dict.DictTypeDO;
8 import org.apache.ibatis.annotations.Mapper;
9 import org.apache.ibatis.annotations.Param;
10 import org.apache.ibatis.annotations.Update;
11
12 import java.time.LocalDateTime;
13
14 @Mapper
15 public interface DictTypeMapper extends BaseMapperX<DictTypeDO> {
16
17     default PageResult<DictTypeDO> selectPage(DictTypePageReqVO reqVO) {
18         return selectPage(reqVO, new LambdaQueryWrapperX<DictTypeDO>()
19                 .likeIfPresent(DictTypeDO::getName, reqVO.getName())
20                 .likeIfPresent(DictTypeDO::getType, reqVO.getType())
21                 .eqIfPresent(DictTypeDO::getStatus, reqVO.getStatus())
22                 .betweenIfPresent(DictTypeDO::getCreateTime, reqVO.getCreateTime())
23                 .orderByDesc(DictTypeDO::getId));
24     }
25
26     default DictTypeDO selectByType(String type) {
27         return selectOne(DictTypeDO::getType, type);
28     }
29
30     default DictTypeDO selectByName(String name) {
648b14 31         return selectOne(new LambdaQueryWrapperX<DictTypeDO>().eq(DictTypeDO::getName, name).eq(DictTypeDO::getDeleted, 0));
e7c126 32     }
H 33
34     @Update("UPDATE system_dict_type SET deleted = 1, deleted_time = #{deletedTime} WHERE id = #{id}")
35     void updateToDelete(@Param("id") Long id, @Param("deletedTime") LocalDateTime deletedTime);
36
37 }