1.添加大哥员工业务功能

This commit is contained in:
2025-07-07 13:34:38 +08:00
parent 31a780518a
commit 2d223d2a46
11 changed files with 589 additions and 39 deletions

View File

@@ -0,0 +1,107 @@
package cn.iocoder.yudao.module.tkdata.controller.admin.employeebigbrother;
import cn.iocoder.yudao.module.tkdata.controller.admin.employeebigbrother.vo.EmployeeBigBrotherPageReqVO;
import cn.iocoder.yudao.module.tkdata.controller.admin.employeebigbrother.vo.EmployeeBigBrotherRespVO;
import cn.iocoder.yudao.module.tkdata.controller.admin.employeebigbrother.vo.EmployeeBigBrotherSaveReqVO;
import cn.iocoder.yudao.module.tkdata.dal.dataobject.employeebigbrother.EmployeeBigBrotherDO;
import cn.iocoder.yudao.module.tkdata.service.employeebigbrother.EmployeeBigBrotherService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
@Tag(name = "管理后台 - 大哥数据员工业务")
@RestController
@RequestMapping("/server/employee-big-brother")
@Validated
public class EmployeeBigBrotherController {
@Resource
private EmployeeBigBrotherService employeeBigBrotherService;
@PostMapping("/create")
@Operation(summary = "创建大哥数据员工业务")
@PreAuthorize("@ss.hasPermission('server:employee-big-brother:create')")
public CommonResult<Integer> createEmployeeBigBrother(@Valid @RequestBody EmployeeBigBrotherSaveReqVO createReqVO) {
return success(employeeBigBrotherService.createEmployeeBigBrother(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新大哥数据员工业务")
@PreAuthorize("@ss.hasPermission('server:employee-big-brother:update')")
public CommonResult<Boolean> updateEmployeeBigBrother(@Valid @RequestBody EmployeeBigBrotherSaveReqVO updateReqVO) {
employeeBigBrotherService.updateEmployeeBigBrother(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除大哥数据员工业务")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('server:employee-big-brother:delete')")
public CommonResult<Boolean> deleteEmployeeBigBrother(@RequestParam("id") Integer id) {
employeeBigBrotherService.deleteEmployeeBigBrother(id);
return success(true);
}
@DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除大哥数据员工业务")
@PreAuthorize("@ss.hasPermission('server:employee-big-brother:delete')")
public CommonResult<Boolean> deleteEmployeeBigBrotherList(@RequestParam("ids") List<Integer> ids) {
employeeBigBrotherService.deleteEmployeeBigBrotherListByIds(ids);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得大哥数据员工业务")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('server:employee-big-brother:query')")
public CommonResult<EmployeeBigBrotherRespVO> getEmployeeBigBrother(@RequestParam("id") Integer id) {
EmployeeBigBrotherDO employeeBigBrother = employeeBigBrotherService.getEmployeeBigBrother(id);
return success(BeanUtils.toBean(employeeBigBrother, EmployeeBigBrotherRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得大哥数据员工业务分页")
@PreAuthorize("@ss.hasPermission('server:employee-big-brother:query')")
public CommonResult<PageResult<EmployeeBigBrotherRespVO>> getEmployeeBigBrotherPage(@Valid EmployeeBigBrotherPageReqVO pageReqVO) {
PageResult<EmployeeBigBrotherDO> pageResult = employeeBigBrotherService.getEmployeeBigBrotherPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, EmployeeBigBrotherRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出大哥数据员工业务 Excel")
@PreAuthorize("@ss.hasPermission('server:employee-big-brother:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportEmployeeBigBrotherExcel(@Valid EmployeeBigBrotherPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<EmployeeBigBrotherDO> list = employeeBigBrotherService.getEmployeeBigBrotherPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "大哥数据员工业务.xls", "数据", EmployeeBigBrotherRespVO.class,
BeanUtils.toBean(list, EmployeeBigBrotherRespVO.class));
}
}

View File

@@ -0,0 +1,59 @@
package cn.iocoder.yudao.module.tkdata.controller.admin.employeebigbrother.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 大哥数据员工业务分页 Request VO")
@Data
public class EmployeeBigBrotherPageReqVO extends PageParam {
@Schema(description = "大哥的display_id", example = "15943")
private String displayId;
@Schema(description = "大哥的用户id")
private String userIdStr;
@Schema(description = "大哥的用户昵称", example = "张三")
private String nickname;
@Schema(description = "大哥的等级")
private Integer level;
@Schema(description = "大哥打赏的金币")
private Integer hostcoins;
@Schema(description = "大哥的粉丝数", example = "9021")
private Integer followerCount;
@Schema(description = "大哥的关注数", example = "17240")
private Integer followingCount;
@Schema(description = "大哥所在的地区")
private String region;
@Schema(description = "大哥打赏的历史最高金币")
private Integer historicHighCoins;
@Schema(description = "大哥历史打赏金币总和")
private Integer totalGiftCoins;
@Schema(description = "大哥所在的直播间的主播display_id", example = "2057")
private String hostDisplayId;
@Schema(description = "该数据所属的账号id", example = "533")
private String userId;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "是否洽谈", example = "2")
private Integer operationStatus;
}

View File

@@ -0,0 +1,75 @@
package cn.iocoder.yudao.module.tkdata.controller.admin.employeebigbrother.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 大哥数据员工业务 Response VO")
@Data
@ExcelIgnoreUnannotated
public class EmployeeBigBrotherRespVO {
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "31905")
@ExcelProperty("主键id")
private Integer id;
@Schema(description = "大哥的display_id", requiredMode = Schema.RequiredMode.REQUIRED, example = "15943")
@ExcelProperty("大哥的display_id")
private String displayId;
@Schema(description = "大哥的用户id")
@ExcelProperty("大哥的用户id")
private String userIdStr;
@Schema(description = "大哥的用户昵称", example = "张三")
@ExcelProperty("大哥的用户昵称")
private String nickname;
@Schema(description = "大哥的等级")
@ExcelProperty("大哥的等级")
private Integer level;
@Schema(description = "大哥打赏的金币")
@ExcelProperty("大哥打赏的金币")
private Integer hostcoins;
@Schema(description = "大哥的粉丝数", example = "9021")
@ExcelProperty("大哥的粉丝数")
private Integer followerCount;
@Schema(description = "大哥的关注数", example = "17240")
@ExcelProperty("大哥的关注数")
private Integer followingCount;
@Schema(description = "大哥所在的地区")
@ExcelProperty("大哥所在的地区")
private String region;
@Schema(description = "大哥打赏的历史最高金币")
@ExcelProperty("大哥打赏的历史最高金币")
private Integer historicHighCoins;
@Schema(description = "大哥历史打赏金币总和")
@ExcelProperty("大哥历史打赏金币总和")
private Integer totalGiftCoins;
@Schema(description = "大哥所在的直播间的主播display_id", example = "2057")
@ExcelProperty("大哥所在的直播间的主播display_id")
private String hostDisplayId;
@Schema(description = "该数据所属的账号id", example = "533")
@ExcelProperty("该数据所属的账号id")
private String userId;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "是否洽谈", example = "2")
@ExcelProperty("是否洽谈")
private Integer operationStatus;
}

View File

@@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.tkdata.controller.admin.employeebigbrother.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 大哥数据员工业务新增/修改 Request VO")
@Data
public class EmployeeBigBrotherSaveReqVO {
@Schema(description = "主键id", requiredMode = Schema.RequiredMode.REQUIRED, example = "31905")
private Integer id;
@Schema(description = "大哥的display_id", requiredMode = Schema.RequiredMode.REQUIRED, example = "15943")
@NotEmpty(message = "大哥的display_id不能为空")
private String displayId;
@Schema(description = "大哥的用户id")
private String userIdStr;
@Schema(description = "大哥的用户昵称", example = "张三")
private String nickname;
@Schema(description = "大哥的等级")
private Integer level;
@Schema(description = "大哥打赏的金币")
private Integer hostcoins;
@Schema(description = "大哥的粉丝数", example = "9021")
private Integer followerCount;
@Schema(description = "大哥的关注数", example = "17240")
private Integer followingCount;
@Schema(description = "大哥所在的地区")
private String region;
@Schema(description = "大哥打赏的历史最高金币")
private Integer historicHighCoins;
@Schema(description = "大哥历史打赏金币总和")
private Integer totalGiftCoins;
@Schema(description = "大哥所在的直播间的主播display_id", example = "2057")
private String hostDisplayId;
@Schema(description = "该数据所属的账号id", example = "533")
private String userId;
@Schema(description = "是否洽谈", example = "2")
private Integer operationStatus;
}

View File

@@ -0,0 +1,84 @@
package cn.iocoder.yudao.module.tkdata.dal.dataobject.employeebigbrother;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 大哥数据员工业务 DO
*
* @author ziin
*/
@TableName("server_employee_big_brother")
@KeySequence("server_employee_big_brother_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class EmployeeBigBrotherDO extends BaseDO {
/**
* 主键id
*/
@TableId
private Integer id;
/**
* 大哥的display_id
*/
private String displayId;
/**
* 大哥的用户id
*/
private String userIdStr;
/**
* 大哥的用户昵称
*/
private String nickname;
/**
* 大哥的等级
*/
private Integer level;
/**
* 大哥打赏的金币
*/
private Integer hostcoins;
/**
* 大哥的粉丝数
*/
private Integer followerCount;
/**
* 大哥的关注数
*/
private Integer followingCount;
/**
* 大哥所在的地区
*/
private String region;
/**
* 大哥打赏的历史最高金币
*/
private Integer historicHighCoins;
/**
* 大哥历史打赏金币总和
*/
private Integer totalGiftCoins;
/**
* 大哥所在的直播间的主播display_id
*/
private String hostDisplayId;
/**
* 该数据所属的账号id
*/
private String userId;
/**
* 是否洽谈
*/
private Integer operationStatus;
}

View File

@@ -0,0 +1,39 @@
package cn.iocoder.yudao.module.tkdata.dal.mysql.employeebigbrother;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.tkdata.controller.admin.employeebigbrother.vo.EmployeeBigBrotherPageReqVO;
import cn.iocoder.yudao.module.tkdata.dal.dataobject.employeebigbrother.EmployeeBigBrotherDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 大哥数据员工业务 Mapper
*
* @author ziin
*/
@Mapper
public interface EmployeeBigBrotherMapper extends BaseMapperX<EmployeeBigBrotherDO> {
default PageResult<EmployeeBigBrotherDO> selectPage(EmployeeBigBrotherPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<EmployeeBigBrotherDO>()
.eqIfPresent(EmployeeBigBrotherDO::getDisplayId, reqVO.getDisplayId())
.eqIfPresent(EmployeeBigBrotherDO::getUserIdStr, reqVO.getUserIdStr())
.likeIfPresent(EmployeeBigBrotherDO::getNickname, reqVO.getNickname())
.eqIfPresent(EmployeeBigBrotherDO::getLevel, reqVO.getLevel())
.eqIfPresent(EmployeeBigBrotherDO::getHostcoins, reqVO.getHostcoins())
.eqIfPresent(EmployeeBigBrotherDO::getFollowerCount, reqVO.getFollowerCount())
.eqIfPresent(EmployeeBigBrotherDO::getFollowingCount, reqVO.getFollowingCount())
.eqIfPresent(EmployeeBigBrotherDO::getRegion, reqVO.getRegion())
.eqIfPresent(EmployeeBigBrotherDO::getHistoricHighCoins, reqVO.getHistoricHighCoins())
.eqIfPresent(EmployeeBigBrotherDO::getTotalGiftCoins, reqVO.getTotalGiftCoins())
.eqIfPresent(EmployeeBigBrotherDO::getHostDisplayId, reqVO.getHostDisplayId())
.eqIfPresent(EmployeeBigBrotherDO::getUserId, reqVO.getUserId())
.betweenIfPresent(EmployeeBigBrotherDO::getCreateTime, reqVO.getCreateTime())
.eqIfPresent(EmployeeBigBrotherDO::getOperationStatus, reqVO.getOperationStatus())
.orderByDesc(EmployeeBigBrotherDO::getId));
}
}

View File

@@ -21,45 +21,6 @@ import org.apache.ibatis.annotations.Param;
@Mapper
public interface EmployeeHostsMapper extends BaseMapperX<EmployeeHostsDO> {
// default PageResult<EmployeeHostsDO> selectPage(EmployeeHostsPageReqVO reqVO) {
// return selectPage(reqVO, new LambdaQueryWrapperX<EmployeeHostsDO>()
// .likeIfPresent(EmployeeHostsDO::getHostsId, reqVO.getHostsId())
// .eqIfPresent(EmployeeHostsDO::getUserId, reqVO.getUserId())
// .eqIfPresent(EmployeeHostsDO::getHostsLevel, reqVO.getHostsLevel())
// .betweenIfPresent(EmployeeHostsDO::getHostsCoins, reqVO.getHostsCoins())
// .eqIfPresent(EmployeeHostsDO::getInvitationType, reqVO.getInvitationType())
// .betweenIfPresent(EmployeeHostsDO::getOnlineFans, reqVO.getOnlineFans())
// .betweenIfPresent(EmployeeHostsDO::getFans, reqVO.getFans())
// .betweenIfPresent(EmployeeHostsDO::getFllowernum, reqVO.getFllowernum())
// .betweenIfPresent(EmployeeHostsDO::getYesterdayCoins, reqVO.getYesterdayCoins())
// .eqIfPresent(EmployeeHostsDO::getCountry, reqVO.getCountry())
// .likeIfPresent(EmployeeHostsDO::getHostsKind, reqVO.getHostsKind())
// .eqIfPresent(EmployeeHostsDO::getOperationStatus, reqVO.getOperationStatus())
// .betweenIfPresent(EmployeeHostsDO::getCreateTime, reqVO.getCreateTime())
// .orderByDesc(EmployeeHostsDO::getId));
// }
// default PageResult<EmployeeHostsDO> selectPageWithSelf(EmployeeHostsPageReqVO reqVO) {
// return selectPage(reqVO, new LambdaQueryWrapperX<EmployeeHostsDO>()
// .likeIfPresent(EmployeeHostsDO::getHostsId, reqVO.getHostsId())
// .eqIfPresent(EmployeeHostsDO::getUserId, reqVO.getUserId())
// .eqIfPresent(EmployeeHostsDO::getHostsLevel, reqVO.getHostsLevel())
// .betweenIfPresent(EmployeeHostsDO::getHostsCoins, reqVO.getHostsCoins())
// .eqIfPresent(EmployeeHostsDO::getInvitationType, reqVO.getInvitationType())
// .betweenIfPresent(EmployeeHostsDO::getOnlineFans, reqVO.getOnlineFans())
// .betweenIfPresent(EmployeeHostsDO::getFans, reqVO.getFans())
// .betweenIfPresent(EmployeeHostsDO::getFllowernum, reqVO.getFllowernum())
// .betweenIfPresent(EmployeeHostsDO::getYesterdayCoins, reqVO.getYesterdayCoins())
// .eqIfPresent(EmployeeHostsDO::getCountry, reqVO.getCountry())
// .likeIfPresent(EmployeeHostsDO::getHostsKind, reqVO.getHostsKind())
// .eqIfPresent(EmployeeHostsDO::getOperationStatus, reqVO.getOperationStatus())
// .betweenIfPresent(EmployeeHostsDO::getCreateTime, reqVO.getCreateTime())
// .eq(EmployeeHostsDO::getUserId, reqVO.getUserId())
// .orderByDesc(EmployeeHostsDO::getId));
// }
int insertIgnore(EmployeeHostsDO bean);
int batchInsertIgnore(List<EmployeeHostsDO> list);

View File

@@ -13,4 +13,5 @@ public interface ErrorCodeConstants {
ErrorCode NEW_HOSTS_NOT_EXISTS = new ErrorCode(1_001_301_000, "主播数据不存在");
ErrorCode EMPLOYEE_HOSTS_NOT_EXISTS = new ErrorCode(1_001_301_001, "分配员工数据不存在");
ErrorCode BIG_BROTHER_NOT_EXISTS = new ErrorCode(1_001_401_001, "大哥数据不存在");
ErrorCode EMPLOYEE_BIG_BROTHER_NOT_EXISTS = new ErrorCode(1_001_401_001, "大哥数据员工业务不存在");
}

View File

@@ -0,0 +1,63 @@
package cn.iocoder.yudao.module.tkdata.service.employeebigbrother;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.tkdata.controller.admin.employeebigbrother.vo.EmployeeBigBrotherPageReqVO;
import cn.iocoder.yudao.module.tkdata.controller.admin.employeebigbrother.vo.EmployeeBigBrotherSaveReqVO;
import cn.iocoder.yudao.module.tkdata.dal.dataobject.employeebigbrother.EmployeeBigBrotherDO;
/**
* 大哥数据员工业务 Service 接口
*
* @author ziin
*/
public interface EmployeeBigBrotherService {
/**
* 创建大哥数据员工业务
*
* @param createReqVO 创建信息
* @return 编号
*/
Integer createEmployeeBigBrother(@Valid EmployeeBigBrotherSaveReqVO createReqVO);
/**
* 更新大哥数据员工业务
*
* @param updateReqVO 更新信息
*/
void updateEmployeeBigBrother(@Valid EmployeeBigBrotherSaveReqVO updateReqVO);
/**
* 删除大哥数据员工业务
*
* @param id 编号
*/
void deleteEmployeeBigBrother(Integer id);
/**
* 批量删除大哥数据员工业务
*
* @param ids 编号
*/
void deleteEmployeeBigBrotherListByIds(List<Integer> ids);
/**
* 获得大哥数据员工业务
*
* @param id 编号
* @return 大哥数据员工业务
*/
EmployeeBigBrotherDO getEmployeeBigBrother(Integer id);
/**
* 获得大哥数据员工业务分页
*
* @param pageReqVO 分页查询
* @return 大哥数据员工业务分页
*/
PageResult<EmployeeBigBrotherDO> getEmployeeBigBrotherPage(EmployeeBigBrotherPageReqVO pageReqVO);
}

View File

@@ -0,0 +1,94 @@
package cn.iocoder.yudao.module.tkdata.service.employeebigbrother;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.module.tkdata.controller.admin.employeebigbrother.vo.EmployeeBigBrotherPageReqVO;
import cn.iocoder.yudao.module.tkdata.controller.admin.employeebigbrother.vo.EmployeeBigBrotherSaveReqVO;
import cn.iocoder.yudao.module.tkdata.dal.dataobject.employeebigbrother.EmployeeBigBrotherDO;
import cn.iocoder.yudao.module.tkdata.dal.mysql.employeebigbrother.EmployeeBigBrotherMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.diffList;
import static cn.iocoder.yudao.module.tkdata.enums.ErrorCodeConstants.EMPLOYEE_BIG_BROTHER_NOT_EXISTS;
/**
* 大哥数据员工业务 Service 实现类
*
* @author ziin
*/
@Service
@Validated
public class EmployeeBigBrotherServiceImpl implements EmployeeBigBrotherService {
@Resource
private EmployeeBigBrotherMapper employeeBigBrotherMapper;
@Override
public Integer createEmployeeBigBrother(EmployeeBigBrotherSaveReqVO createReqVO) {
// 插入
EmployeeBigBrotherDO employeeBigBrother = BeanUtils.toBean(createReqVO, EmployeeBigBrotherDO.class);
employeeBigBrotherMapper.insert(employeeBigBrother);
// 返回
return employeeBigBrother.getId();
}
@Override
public void updateEmployeeBigBrother(EmployeeBigBrotherSaveReqVO updateReqVO) {
// 校验存在
validateEmployeeBigBrotherExists(updateReqVO.getId());
// 更新
EmployeeBigBrotherDO updateObj = BeanUtils.toBean(updateReqVO, EmployeeBigBrotherDO.class);
employeeBigBrotherMapper.updateById(updateObj);
}
@Override
public void deleteEmployeeBigBrother(Integer id) {
// 校验存在
validateEmployeeBigBrotherExists(id);
// 删除
employeeBigBrotherMapper.deleteById(id);
}
@Override
public void deleteEmployeeBigBrotherListByIds(List<Integer> ids) {
// 校验存在
validateEmployeeBigBrotherExists(ids);
// 删除
employeeBigBrotherMapper.deleteByIds(ids);
}
private void validateEmployeeBigBrotherExists(List<Integer> ids) {
List<EmployeeBigBrotherDO> list = employeeBigBrotherMapper.selectByIds(ids);
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
throw exception(EMPLOYEE_BIG_BROTHER_NOT_EXISTS);
}
}
private void validateEmployeeBigBrotherExists(Integer id) {
if (employeeBigBrotherMapper.selectById(id) == null) {
throw exception(EMPLOYEE_BIG_BROTHER_NOT_EXISTS);
}
}
@Override
public EmployeeBigBrotherDO getEmployeeBigBrother(Integer id) {
return employeeBigBrotherMapper.selectById(id);
}
@Override
public PageResult<EmployeeBigBrotherDO> getEmployeeBigBrotherPage(EmployeeBigBrotherPageReqVO pageReqVO) {
return employeeBigBrotherMapper.selectPage(pageReqVO);
}
}

View File

@@ -0,0 +1,12 @@
<?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.tkdata.dal.mysql.employeebigbrother.EmployeeBigBrotherMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>