14 changed files with 995 additions and 1 deletions
@ -0,0 +1,104 @@ |
|||||
|
package cn.iocoder.yudao.module.system.controller.admin.tenantinterphone; |
||||
|
|
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
import jakarta.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 jakarta.validation.constraints.*; |
||||
|
import jakarta.validation.*; |
||||
|
import jakarta.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.*; |
||||
|
|
||||
|
import cn.iocoder.yudao.module.system.controller.admin.tenantinterphone.vo.*; |
||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.tenantinterphone.TenantInterphoneDO; |
||||
|
import cn.iocoder.yudao.module.system.service.tenantinterphone.TenantInterphoneService; |
||||
|
|
||||
|
@Tag(name = "管理后台 - 租户对讲平台对应") |
||||
|
@RestController |
||||
|
@RequestMapping("/system/tenant-interphone") |
||||
|
@Validated |
||||
|
public class TenantInterphoneController { |
||||
|
|
||||
|
@Resource |
||||
|
private TenantInterphoneService tenantInterphoneService; |
||||
|
|
||||
|
@PostMapping("/create") |
||||
|
@Operation(summary = "创建租户对讲平台对应") |
||||
|
@PreAuthorize("@ss.hasPermission('system:tenant-interphone:create')") |
||||
|
public CommonResult<Long> createTenantInterphone(@Valid @RequestBody TenantInterphoneSaveReqVO createReqVO) { |
||||
|
return success(tenantInterphoneService.createTenantInterphone(createReqVO)); |
||||
|
} |
||||
|
|
||||
|
@PutMapping("/update") |
||||
|
@Operation(summary = "更新租户对讲平台对应") |
||||
|
@PreAuthorize("@ss.hasPermission('system:tenant-interphone:update')") |
||||
|
public CommonResult<Boolean> updateTenantInterphone(@Valid @RequestBody TenantInterphoneSaveReqVO updateReqVO) { |
||||
|
tenantInterphoneService.updateTenantInterphone(updateReqVO); |
||||
|
return success(true); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping("/delete") |
||||
|
@Operation(summary = "删除租户对讲平台对应") |
||||
|
@Parameter(name = "id", description = "编号", required = true) |
||||
|
@PreAuthorize("@ss.hasPermission('system:tenant-interphone:delete')") |
||||
|
public CommonResult<Boolean> deleteTenantInterphone(@RequestParam("id") Long id) { |
||||
|
tenantInterphoneService.deleteTenantInterphone(id); |
||||
|
return success(true); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping("/delete-list") |
||||
|
@Parameter(name = "ids", description = "编号", required = true) |
||||
|
@Operation(summary = "批量删除租户对讲平台对应") |
||||
|
@PreAuthorize("@ss.hasPermission('system:tenant-interphone:delete')") |
||||
|
public CommonResult<Boolean> deleteTenantInterphoneList(@RequestParam("ids") List<Long> ids) { |
||||
|
tenantInterphoneService.deleteTenantInterphoneListByIds(ids); |
||||
|
return success(true); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/get") |
||||
|
@Operation(summary = "获得租户对讲平台对应") |
||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024") |
||||
|
@PreAuthorize("@ss.hasPermission('system:tenant-interphone:query')") |
||||
|
public CommonResult<TenantInterphoneRespVO> getTenantInterphone(@RequestParam("id") Long id) { |
||||
|
TenantInterphoneDO tenantInterphone = tenantInterphoneService.getTenantInterphone(id); |
||||
|
return success(BeanUtils.toBean(tenantInterphone, TenantInterphoneRespVO.class)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/page") |
||||
|
@Operation(summary = "获得租户对讲平台对应分页") |
||||
|
@PreAuthorize("@ss.hasPermission('system:tenant-interphone:query')") |
||||
|
public CommonResult<PageResult<TenantInterphoneRespVO>> getTenantInterphonePage(@Valid TenantInterphonePageReqVO pageReqVO) { |
||||
|
PageResult<TenantInterphoneDO> pageResult = tenantInterphoneService.getTenantInterphonePage(pageReqVO); |
||||
|
return success(BeanUtils.toBean(pageResult, TenantInterphoneRespVO.class)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/export-excel") |
||||
|
@Operation(summary = "导出租户对讲平台对应 Excel") |
||||
|
@PreAuthorize("@ss.hasPermission('system:tenant-interphone:export')") |
||||
|
@ApiAccessLog(operateType = EXPORT) |
||||
|
public void exportTenantInterphoneExcel(@Valid TenantInterphonePageReqVO pageReqVO, |
||||
|
HttpServletResponse response) throws IOException { |
||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
||||
|
List<TenantInterphoneDO> list = tenantInterphoneService.getTenantInterphonePage(pageReqVO).getList(); |
||||
|
// 导出 Excel
|
||||
|
ExcelUtils.write(response, "租户对讲平台对应.xls", "数据", TenantInterphoneRespVO.class, |
||||
|
BeanUtils.toBean(list, TenantInterphoneRespVO.class)); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,44 @@ |
|||||
|
package cn.iocoder.yudao.module.system.controller.admin.tenantinterphone.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 TenantInterphonePageReqVO extends PageParam { |
||||
|
|
||||
|
@Schema(description = "租户id", example = "18871") |
||||
|
private Long tendId; |
||||
|
|
||||
|
@Schema(description = "创建时间") |
||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
||||
|
private LocalDateTime[] createTime; |
||||
|
|
||||
|
@Schema(description = "对讲平台单位id", example = "16985") |
||||
|
private Long corgId; |
||||
|
|
||||
|
@Schema(description = "对讲平台单位名称", example = "张三") |
||||
|
private String corgName; |
||||
|
|
||||
|
@Schema(description = "对讲平台用户数量", example = "11267") |
||||
|
private Long userCount; |
||||
|
|
||||
|
@Schema(description = "对讲平台群组数量", example = "27649") |
||||
|
private Long groupCount; |
||||
|
|
||||
|
@Schema(description = "对讲平台账号", example = "张三") |
||||
|
private String loginname; |
||||
|
|
||||
|
@Schema(description = "对讲平台联系人") |
||||
|
private String contact; |
||||
|
|
||||
|
@Schema(description = "对讲平台单位是否绑定平台") |
||||
|
private Integer bindingPlatform; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,55 @@ |
|||||
|
package cn.iocoder.yudao.module.system.controller.admin.tenantinterphone.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 TenantInterphoneRespVO { |
||||
|
|
||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "8781") |
||||
|
@ExcelProperty("id") |
||||
|
private Long id; |
||||
|
|
||||
|
@Schema(description = "租户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18871") |
||||
|
@ExcelProperty("租户id") |
||||
|
private Long tendId; |
||||
|
|
||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
||||
|
@ExcelProperty("创建时间") |
||||
|
private LocalDateTime createTime; |
||||
|
|
||||
|
@Schema(description = "对讲平台单位id", requiredMode = Schema.RequiredMode.REQUIRED, example = "16985") |
||||
|
@ExcelProperty("对讲平台单位id") |
||||
|
private Long corgId; |
||||
|
|
||||
|
@Schema(description = "对讲平台单位名称", example = "张三") |
||||
|
@ExcelProperty("对讲平台单位名称") |
||||
|
private String corgName; |
||||
|
|
||||
|
@Schema(description = "对讲平台用户数量", example = "11267") |
||||
|
@ExcelProperty("对讲平台用户数量") |
||||
|
private Long userCount; |
||||
|
|
||||
|
@Schema(description = "对讲平台群组数量", example = "27649") |
||||
|
@ExcelProperty("对讲平台群组数量") |
||||
|
private Long groupCount; |
||||
|
|
||||
|
@Schema(description = "对讲平台账号", example = "张三") |
||||
|
@ExcelProperty("对讲平台账号") |
||||
|
private String loginname; |
||||
|
|
||||
|
@Schema(description = "对讲平台联系人") |
||||
|
@ExcelProperty("对讲平台联系人") |
||||
|
private String contact; |
||||
|
|
||||
|
@Schema(description = "对讲平台单位是否绑定平台") |
||||
|
@ExcelProperty("对讲平台单位是否绑定平台") |
||||
|
private Integer bindingPlatform; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,44 @@ |
|||||
|
package cn.iocoder.yudao.module.system.controller.admin.tenantinterphone.vo; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.*; |
||||
|
import java.util.*; |
||||
|
import jakarta.validation.constraints.*; |
||||
|
|
||||
|
@Schema(description = "管理后台 - 租户对讲平台对应新增/修改 Request VO") |
||||
|
@Data |
||||
|
public class TenantInterphoneSaveReqVO { |
||||
|
|
||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "8781") |
||||
|
private Long id; |
||||
|
|
||||
|
@Schema(description = "租户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18871") |
||||
|
@NotNull(message = "租户id不能为空") |
||||
|
private Long tendId; |
||||
|
|
||||
|
@Schema(description = "对讲平台单位id", requiredMode = Schema.RequiredMode.REQUIRED, example = "16985") |
||||
|
@NotNull(message = "对讲平台单位id不能为空") |
||||
|
private Long corgId; |
||||
|
|
||||
|
@Schema(description = "对讲平台单位名称", example = "张三") |
||||
|
private String corgName; |
||||
|
|
||||
|
@Schema(description = "对讲平台用户数量", example = "11267") |
||||
|
private Long userCount; |
||||
|
|
||||
|
@Schema(description = "对讲平台群组数量", example = "27649") |
||||
|
private Long groupCount; |
||||
|
|
||||
|
@Schema(description = "对讲平台账号", example = "张三") |
||||
|
private String loginname; |
||||
|
|
||||
|
@Schema(description = "对讲平台密码") |
||||
|
private String password; |
||||
|
|
||||
|
@Schema(description = "对讲平台联系人") |
||||
|
private String contact; |
||||
|
|
||||
|
@Schema(description = "对讲平台单位是否绑定平台") |
||||
|
private Integer bindingPlatform; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,68 @@ |
|||||
|
package cn.iocoder.yudao.module.system.dal.dataobject.tenantinterphone; |
||||
|
|
||||
|
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 超级管理员 |
||||
|
*/ |
||||
|
@TableName("system_tenant_interphone") |
||||
|
@KeySequence("system_tenant_interphone_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@ToString(callSuper = true) |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class TenantInterphoneDO extends BaseDO { |
||||
|
|
||||
|
/** |
||||
|
* id |
||||
|
*/ |
||||
|
@TableId |
||||
|
private Long id; |
||||
|
/** |
||||
|
* 租户id |
||||
|
*/ |
||||
|
private Long tendId; |
||||
|
/** |
||||
|
* 对讲平台单位id |
||||
|
*/ |
||||
|
private Long corgId; |
||||
|
/** |
||||
|
* 对讲平台单位名称 |
||||
|
*/ |
||||
|
private String corgName; |
||||
|
/** |
||||
|
* 对讲平台用户数量 |
||||
|
*/ |
||||
|
private Long userCount; |
||||
|
/** |
||||
|
* 对讲平台群组数量 |
||||
|
*/ |
||||
|
private Long groupCount; |
||||
|
/** |
||||
|
* 对讲平台账号 |
||||
|
*/ |
||||
|
private String loginname; |
||||
|
/** |
||||
|
* 对讲平台密码 |
||||
|
*/ |
||||
|
private String password; |
||||
|
/** |
||||
|
* 对讲平台联系人 |
||||
|
*/ |
||||
|
private String contact; |
||||
|
/** |
||||
|
* 对讲平台单位是否绑定平台 |
||||
|
*/ |
||||
|
private Integer bindingPlatform; |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,34 @@ |
|||||
|
package cn.iocoder.yudao.module.system.dal.mysql.tenantinterphone; |
||||
|
|
||||
|
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.system.dal.dataobject.tenantinterphone.TenantInterphoneDO; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import cn.iocoder.yudao.module.system.controller.admin.tenantinterphone.vo.*; |
||||
|
|
||||
|
/** |
||||
|
* 租户对讲平台对应 Mapper |
||||
|
* |
||||
|
* @author 超级管理员 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface TenantInterphoneMapper extends BaseMapperX<TenantInterphoneDO> { |
||||
|
|
||||
|
default PageResult<TenantInterphoneDO> selectPage(TenantInterphonePageReqVO reqVO) { |
||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<TenantInterphoneDO>() |
||||
|
.eqIfPresent(TenantInterphoneDO::getTendId, reqVO.getTendId()) |
||||
|
.betweenIfPresent(TenantInterphoneDO::getCreateTime, reqVO.getCreateTime()) |
||||
|
.eqIfPresent(TenantInterphoneDO::getCorgId, reqVO.getCorgId()) |
||||
|
.likeIfPresent(TenantInterphoneDO::getCorgName, reqVO.getCorgName()) |
||||
|
.eqIfPresent(TenantInterphoneDO::getUserCount, reqVO.getUserCount()) |
||||
|
.eqIfPresent(TenantInterphoneDO::getGroupCount, reqVO.getGroupCount()) |
||||
|
.likeIfPresent(TenantInterphoneDO::getLoginname, reqVO.getLoginname()) |
||||
|
.eqIfPresent(TenantInterphoneDO::getContact, reqVO.getContact()) |
||||
|
.eqIfPresent(TenantInterphoneDO::getBindingPlatform, reqVO.getBindingPlatform()) |
||||
|
.orderByDesc(TenantInterphoneDO::getId)); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,62 @@ |
|||||
|
package cn.iocoder.yudao.module.system.service.tenantinterphone; |
||||
|
|
||||
|
import java.util.*; |
||||
|
import jakarta.validation.*; |
||||
|
import cn.iocoder.yudao.module.system.controller.admin.tenantinterphone.vo.*; |
||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.tenantinterphone.TenantInterphoneDO; |
||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult; |
||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam; |
||||
|
|
||||
|
/** |
||||
|
* 租户对讲平台对应 Service 接口 |
||||
|
* |
||||
|
* @author 超级管理员 |
||||
|
*/ |
||||
|
public interface TenantInterphoneService { |
||||
|
|
||||
|
/** |
||||
|
* 创建租户对讲平台对应 |
||||
|
* |
||||
|
* @param createReqVO 创建信息 |
||||
|
* @return 编号 |
||||
|
*/ |
||||
|
Long createTenantInterphone(@Valid TenantInterphoneSaveReqVO createReqVO); |
||||
|
|
||||
|
/** |
||||
|
* 更新租户对讲平台对应 |
||||
|
* |
||||
|
* @param updateReqVO 更新信息 |
||||
|
*/ |
||||
|
void updateTenantInterphone(@Valid TenantInterphoneSaveReqVO updateReqVO); |
||||
|
|
||||
|
/** |
||||
|
* 删除租户对讲平台对应 |
||||
|
* |
||||
|
* @param id 编号 |
||||
|
*/ |
||||
|
void deleteTenantInterphone(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除租户对讲平台对应 |
||||
|
* |
||||
|
* @param ids 编号 |
||||
|
*/ |
||||
|
void deleteTenantInterphoneListByIds(List<Long> ids); |
||||
|
|
||||
|
/** |
||||
|
* 获得租户对讲平台对应 |
||||
|
* |
||||
|
* @param id 编号 |
||||
|
* @return 租户对讲平台对应 |
||||
|
*/ |
||||
|
TenantInterphoneDO getTenantInterphone(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 获得租户对讲平台对应分页 |
||||
|
* |
||||
|
* @param pageReqVO 分页查询 |
||||
|
* @return 租户对讲平台对应分页 |
||||
|
*/ |
||||
|
PageResult<TenantInterphoneDO> getTenantInterphonePage(TenantInterphonePageReqVO pageReqVO); |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,85 @@ |
|||||
|
package cn.iocoder.yudao.module.system.service.tenantinterphone; |
||||
|
|
||||
|
import cn.hutool.core.collection.CollUtil; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import jakarta.annotation.Resource; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.*; |
||||
|
import cn.iocoder.yudao.module.system.controller.admin.tenantinterphone.vo.*; |
||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.tenantinterphone.TenantInterphoneDO; |
||||
|
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 cn.iocoder.yudao.module.system.dal.mysql.tenantinterphone.TenantInterphoneMapper; |
||||
|
|
||||
|
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.system.enums.ErrorCodeConstants.*; |
||||
|
|
||||
|
/** |
||||
|
* 租户对讲平台对应 Service 实现类 |
||||
|
* |
||||
|
* @author 超级管理员 |
||||
|
*/ |
||||
|
@Service |
||||
|
@Validated |
||||
|
public class TenantInterphoneServiceImpl implements TenantInterphoneService { |
||||
|
|
||||
|
@Resource |
||||
|
private TenantInterphoneMapper tenantInterphoneMapper; |
||||
|
|
||||
|
@Override |
||||
|
public Long createTenantInterphone(TenantInterphoneSaveReqVO createReqVO) { |
||||
|
// 插入
|
||||
|
TenantInterphoneDO tenantInterphone = BeanUtils.toBean(createReqVO, TenantInterphoneDO.class); |
||||
|
tenantInterphoneMapper.insert(tenantInterphone); |
||||
|
|
||||
|
// 返回
|
||||
|
return tenantInterphone.getId(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void updateTenantInterphone(TenantInterphoneSaveReqVO updateReqVO) { |
||||
|
// 校验存在
|
||||
|
validateTenantInterphoneExists(updateReqVO.getId()); |
||||
|
// 更新
|
||||
|
TenantInterphoneDO updateObj = BeanUtils.toBean(updateReqVO, TenantInterphoneDO.class); |
||||
|
tenantInterphoneMapper.updateById(updateObj); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void deleteTenantInterphone(Long id) { |
||||
|
// 校验存在
|
||||
|
validateTenantInterphoneExists(id); |
||||
|
// 删除
|
||||
|
tenantInterphoneMapper.deleteById(id); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void deleteTenantInterphoneListByIds(List<Long> ids) { |
||||
|
// 删除
|
||||
|
tenantInterphoneMapper.deleteByIds(ids); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private void validateTenantInterphoneExists(Long id) { |
||||
|
if (tenantInterphoneMapper.selectById(id) == null) { |
||||
|
throw exception(TENANT_INTERPHONE_NOT_EXISTS); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public TenantInterphoneDO getTenantInterphone(Long id) { |
||||
|
return tenantInterphoneMapper.selectById(id); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public PageResult<TenantInterphoneDO> getTenantInterphonePage(TenantInterphonePageReqVO pageReqVO) { |
||||
|
return tenantInterphoneMapper.selectPage(pageReqVO); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -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.system.dal.mysql.tenantinterphone.TenantInterphoneMapper"> |
||||
|
|
||||
|
<!-- |
||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 |
||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 |
||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 |
||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ |
||||
|
--> |
||||
|
|
||||
|
</mapper> |
||||
@ -0,0 +1,54 @@ |
|||||
|
import request from '@/config/axios' |
||||
|
import type { Dayjs } from 'dayjs'; |
||||
|
|
||||
|
/** 租户对讲平台对应信息 */ |
||||
|
export interface TenantInterphone { |
||||
|
id: number; // id
|
||||
|
tendId?: number; // 租户id
|
||||
|
corgId?: number; // 对讲平台单位id
|
||||
|
corgName: string; // 对讲平台单位名称
|
||||
|
userCount: number; // 对讲平台用户数量
|
||||
|
groupCount: number; // 对讲平台群组数量
|
||||
|
loginname: string; // 对讲平台账号
|
||||
|
password: string; // 对讲平台密码
|
||||
|
contact: string; // 对讲平台联系人
|
||||
|
bindingPlatform: number; // 对讲平台单位是否绑定平台
|
||||
|
} |
||||
|
|
||||
|
// 租户对讲平台对应 API
|
||||
|
export const TenantInterphoneApi = { |
||||
|
// 查询租户对讲平台对应分页
|
||||
|
getTenantInterphonePage: async (params: any) => { |
||||
|
return await request.get({ url: `/system/tenant-interphone/page`, params }) |
||||
|
}, |
||||
|
|
||||
|
// 查询租户对讲平台对应详情
|
||||
|
getTenantInterphone: async (id: number) => { |
||||
|
return await request.get({ url: `/system/tenant-interphone/get?id=` + id }) |
||||
|
}, |
||||
|
|
||||
|
// 新增租户对讲平台对应
|
||||
|
createTenantInterphone: async (data: TenantInterphone) => { |
||||
|
return await request.post({ url: `/system/tenant-interphone/create`, data }) |
||||
|
}, |
||||
|
|
||||
|
// 修改租户对讲平台对应
|
||||
|
updateTenantInterphone: async (data: TenantInterphone) => { |
||||
|
return await request.put({ url: `/system/tenant-interphone/update`, data }) |
||||
|
}, |
||||
|
|
||||
|
// 删除租户对讲平台对应
|
||||
|
deleteTenantInterphone: async (id: number) => { |
||||
|
return await request.delete({ url: `/system/tenant-interphone/delete?id=` + id }) |
||||
|
}, |
||||
|
|
||||
|
/** 批量删除租户对讲平台对应 */ |
||||
|
deleteTenantInterphoneList: async (ids: number[]) => { |
||||
|
return await request.delete({ url: `/system/tenant-interphone/delete-list?ids=${ids.join(',')}` }) |
||||
|
}, |
||||
|
|
||||
|
// 导出租户对讲平台对应 Excel
|
||||
|
exportTenantInterphone: async (params) => { |
||||
|
return await request.download({ url: `/system/tenant-interphone/export-excel`, params }) |
||||
|
}, |
||||
|
} |
||||
@ -0,0 +1,133 @@ |
|||||
|
<template> |
||||
|
<Dialog :title="dialogTitle" v-model="dialogVisible"> |
||||
|
<el-form |
||||
|
ref="formRef" |
||||
|
:model="formData" |
||||
|
:rules="formRules" |
||||
|
label-width="100px" |
||||
|
v-loading="formLoading" |
||||
|
> |
||||
|
<el-form-item label="租户id" prop="tendId"> |
||||
|
<el-input v-model="formData.tendId" placeholder="请输入租户id" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="对讲平台单位id" prop="corgId"> |
||||
|
<el-input v-model="formData.corgId" placeholder="请输入对讲平台单位id" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="对讲平台单位名称" prop="corgName"> |
||||
|
<el-input v-model="formData.corgName" placeholder="请输入对讲平台单位名称" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="对讲平台用户数量" prop="userCount"> |
||||
|
<el-input v-model="formData.userCount" placeholder="请输入对讲平台用户数量" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="对讲平台群组数量" prop="groupCount"> |
||||
|
<el-input v-model="formData.groupCount" placeholder="请输入对讲平台群组数量" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="对讲平台账号" prop="loginname"> |
||||
|
<el-input v-model="formData.loginname" placeholder="请输入对讲平台账号" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="对讲平台密码" prop="password"> |
||||
|
<el-input v-model="formData.password" placeholder="请输入对讲平台密码" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="对讲平台联系人" prop="contact"> |
||||
|
<el-input v-model="formData.contact" placeholder="请输入对讲平台联系人" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="对讲平台单位是否绑定平台" prop="bindingPlatform"> |
||||
|
<el-input v-model="formData.bindingPlatform" placeholder="请输入对讲平台单位是否绑定平台" /> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
<template #footer> |
||||
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button> |
||||
|
<el-button @click="dialogVisible = false">取 消</el-button> |
||||
|
</template> |
||||
|
</Dialog> |
||||
|
</template> |
||||
|
<script setup lang="ts"> |
||||
|
import { TenantInterphoneApi, TenantInterphone } from '@/api/system/tenantinterphone' |
||||
|
|
||||
|
/** 租户对讲平台对应 表单 */ |
||||
|
defineOptions({ name: 'TenantInterphoneForm' }) |
||||
|
|
||||
|
const { t } = useI18n() // 国际化 |
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
|
||||
|
const dialogVisible = ref(false) // 弹窗的是否展示 |
||||
|
const dialogTitle = ref('') // 弹窗的标题 |
||||
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用 |
||||
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改 |
||||
|
const formData = ref({ |
||||
|
id: undefined, |
||||
|
tendId: undefined, |
||||
|
corgId: undefined, |
||||
|
corgName: undefined, |
||||
|
userCount: undefined, |
||||
|
groupCount: undefined, |
||||
|
loginname: undefined, |
||||
|
password: undefined, |
||||
|
contact: undefined, |
||||
|
bindingPlatform: undefined, |
||||
|
}) |
||||
|
const formRules = reactive({ |
||||
|
tendId: [{ required: true, message: '租户id不能为空', trigger: 'blur' }], |
||||
|
corgId: [{ required: true, message: '对讲平台单位id不能为空', trigger: 'blur' }], |
||||
|
}) |
||||
|
const formRef = ref() // 表单 Ref |
||||
|
|
||||
|
/** 打开弹窗 */ |
||||
|
const open = async (type: string, id?: number) => { |
||||
|
dialogVisible.value = true |
||||
|
dialogTitle.value = t('action.' + type) |
||||
|
formType.value = type |
||||
|
resetForm() |
||||
|
// 修改时,设置数据 |
||||
|
if (id) { |
||||
|
formLoading.value = true |
||||
|
try { |
||||
|
formData.value = await TenantInterphoneApi.getTenantInterphone(id) |
||||
|
} finally { |
||||
|
formLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗 |
||||
|
|
||||
|
/** 提交表单 */ |
||||
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调 |
||||
|
const submitForm = async () => { |
||||
|
// 校验表单 |
||||
|
await formRef.value.validate() |
||||
|
// 提交请求 |
||||
|
formLoading.value = true |
||||
|
try { |
||||
|
const data = formData.value as unknown as TenantInterphone |
||||
|
if (formType.value === 'create') { |
||||
|
await TenantInterphoneApi.createTenantInterphone(data) |
||||
|
message.success(t('common.createSuccess')) |
||||
|
} else { |
||||
|
await TenantInterphoneApi.updateTenantInterphone(data) |
||||
|
message.success(t('common.updateSuccess')) |
||||
|
} |
||||
|
dialogVisible.value = false |
||||
|
// 发送操作成功的事件 |
||||
|
emit('success') |
||||
|
} finally { |
||||
|
formLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 重置表单 */ |
||||
|
const resetForm = () => { |
||||
|
formData.value = { |
||||
|
id: undefined, |
||||
|
tendId: undefined, |
||||
|
corgId: undefined, |
||||
|
corgName: undefined, |
||||
|
userCount: undefined, |
||||
|
groupCount: undefined, |
||||
|
loginname: undefined, |
||||
|
password: undefined, |
||||
|
contact: undefined, |
||||
|
bindingPlatform: undefined, |
||||
|
} |
||||
|
formRef.value?.resetFields() |
||||
|
} |
||||
|
</script> |
||||
@ -0,0 +1,298 @@ |
|||||
|
<template> |
||||
|
<ContentWrap> |
||||
|
<!-- 搜索工作栏 --> |
||||
|
<el-form |
||||
|
class="-mb-15px" |
||||
|
:model="queryParams" |
||||
|
ref="queryFormRef" |
||||
|
:inline="true" |
||||
|
label-width="68px" |
||||
|
> |
||||
|
<el-form-item label="租户id" prop="tendId"> |
||||
|
<el-input |
||||
|
v-model="queryParams.tendId" |
||||
|
placeholder="请输入租户id" |
||||
|
clearable |
||||
|
@keyup.enter="handleQuery" |
||||
|
class="!w-240px" |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="创建时间" prop="createTime"> |
||||
|
<el-date-picker |
||||
|
v-model="queryParams.createTime" |
||||
|
value-format="YYYY-MM-DD HH:mm:ss" |
||||
|
type="daterange" |
||||
|
start-placeholder="开始日期" |
||||
|
end-placeholder="结束日期" |
||||
|
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" |
||||
|
class="!w-220px" |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="对讲平台单位id" prop="corgId"> |
||||
|
<el-input |
||||
|
v-model="queryParams.corgId" |
||||
|
placeholder="请输入对讲平台单位id" |
||||
|
clearable |
||||
|
@keyup.enter="handleQuery" |
||||
|
class="!w-240px" |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="对讲平台单位名称" prop="corgName"> |
||||
|
<el-input |
||||
|
v-model="queryParams.corgName" |
||||
|
placeholder="请输入对讲平台单位名称" |
||||
|
clearable |
||||
|
@keyup.enter="handleQuery" |
||||
|
class="!w-240px" |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="对讲平台用户数量" prop="userCount"> |
||||
|
<el-input |
||||
|
v-model="queryParams.userCount" |
||||
|
placeholder="请输入对讲平台用户数量" |
||||
|
clearable |
||||
|
@keyup.enter="handleQuery" |
||||
|
class="!w-240px" |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="对讲平台群组数量" prop="groupCount"> |
||||
|
<el-input |
||||
|
v-model="queryParams.groupCount" |
||||
|
placeholder="请输入对讲平台群组数量" |
||||
|
clearable |
||||
|
@keyup.enter="handleQuery" |
||||
|
class="!w-240px" |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="对讲平台账号" prop="loginname"> |
||||
|
<el-input |
||||
|
v-model="queryParams.loginname" |
||||
|
placeholder="请输入对讲平台账号" |
||||
|
clearable |
||||
|
@keyup.enter="handleQuery" |
||||
|
class="!w-240px" |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="对讲平台联系人" prop="contact"> |
||||
|
<el-input |
||||
|
v-model="queryParams.contact" |
||||
|
placeholder="请输入对讲平台联系人" |
||||
|
clearable |
||||
|
@keyup.enter="handleQuery" |
||||
|
class="!w-240px" |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="对讲平台单位是否绑定平台" prop="bindingPlatform"> |
||||
|
<el-input |
||||
|
v-model="queryParams.bindingPlatform" |
||||
|
placeholder="请输入对讲平台单位是否绑定平台" |
||||
|
clearable |
||||
|
@keyup.enter="handleQuery" |
||||
|
class="!w-240px" |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
<el-form-item> |
||||
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button> |
||||
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button> |
||||
|
<el-button |
||||
|
type="primary" |
||||
|
plain |
||||
|
@click="openForm('create')" |
||||
|
v-hasPermi="['system:tenant-interphone:create']" |
||||
|
> |
||||
|
<Icon icon="ep:plus" class="mr-5px" /> 新增 |
||||
|
</el-button> |
||||
|
<el-button |
||||
|
type="success" |
||||
|
plain |
||||
|
@click="handleExport" |
||||
|
:loading="exportLoading" |
||||
|
v-hasPermi="['system:tenant-interphone:export']" |
||||
|
> |
||||
|
<Icon icon="ep:download" class="mr-5px" /> 导出 |
||||
|
</el-button> |
||||
|
<el-button |
||||
|
type="danger" |
||||
|
plain |
||||
|
:disabled="isEmpty(checkedIds)" |
||||
|
@click="handleDeleteBatch" |
||||
|
v-hasPermi="['system:tenant-interphone:delete']" |
||||
|
> |
||||
|
<Icon icon="ep:delete" class="mr-5px" /> 批量删除 |
||||
|
</el-button> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 列表 --> |
||||
|
<ContentWrap> |
||||
|
<el-table |
||||
|
row-key="id" |
||||
|
v-loading="loading" |
||||
|
:data="list" |
||||
|
:stripe="true" |
||||
|
:show-overflow-tooltip="true" |
||||
|
@selection-change="handleRowCheckboxChange" |
||||
|
> |
||||
|
<el-table-column type="selection" width="55" /> |
||||
|
<el-table-column label="id" align="center" prop="id" /> |
||||
|
<el-table-column label="租户id" align="center" prop="tendId" /> |
||||
|
<el-table-column |
||||
|
label="创建时间" |
||||
|
align="center" |
||||
|
prop="createTime" |
||||
|
:formatter="dateFormatter" |
||||
|
width="180px" |
||||
|
/> |
||||
|
<el-table-column label="对讲平台单位id" align="center" prop="corgId" /> |
||||
|
<el-table-column label="对讲平台单位名称" align="center" prop="corgName" /> |
||||
|
<el-table-column label="对讲平台用户数量" align="center" prop="userCount" /> |
||||
|
<el-table-column label="对讲平台群组数量" align="center" prop="groupCount" /> |
||||
|
<el-table-column label="对讲平台账号" align="center" prop="loginname" /> |
||||
|
<el-table-column label="对讲平台联系人" align="center" prop="contact" /> |
||||
|
<el-table-column label="对讲平台单位是否绑定平台" align="center" prop="bindingPlatform" /> |
||||
|
<el-table-column label="操作" align="center" min-width="120px"> |
||||
|
<template #default="scope"> |
||||
|
<el-button |
||||
|
link |
||||
|
type="primary" |
||||
|
@click="openForm('update', scope.row.id)" |
||||
|
v-hasPermi="['system:tenant-interphone:update']" |
||||
|
> |
||||
|
编辑 |
||||
|
</el-button> |
||||
|
<el-button |
||||
|
link |
||||
|
type="danger" |
||||
|
@click="handleDelete(scope.row.id)" |
||||
|
v-hasPermi="['system:tenant-interphone:delete']" |
||||
|
> |
||||
|
删除 |
||||
|
</el-button> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
<!-- 分页 --> |
||||
|
<Pagination |
||||
|
:total="total" |
||||
|
v-model:page="queryParams.pageNo" |
||||
|
v-model:limit="queryParams.pageSize" |
||||
|
@pagination="getList" |
||||
|
/> |
||||
|
</ContentWrap> |
||||
|
|
||||
|
<!-- 表单弹窗:添加/修改 --> |
||||
|
<TenantInterphoneForm ref="formRef" @success="getList" /> |
||||
|
</template> |
||||
|
|
||||
|
<script setup lang="ts"> |
||||
|
import { isEmpty } from '@/utils/is' |
||||
|
import { dateFormatter } from '@/utils/formatTime' |
||||
|
import download from '@/utils/download' |
||||
|
import { TenantInterphoneApi, TenantInterphone } from '@/api/system/tenantinterphone' |
||||
|
import TenantInterphoneForm from './TenantInterphoneForm.vue' |
||||
|
|
||||
|
/** 租户对讲平台对应 列表 */ |
||||
|
defineOptions({ name: 'TenantInterphone' }) |
||||
|
|
||||
|
const message = useMessage() // 消息弹窗 |
||||
|
const { t } = useI18n() // 国际化 |
||||
|
|
||||
|
const loading = ref(true) // 列表的加载中 |
||||
|
const list = ref<TenantInterphone[]>([]) // 列表的数据 |
||||
|
const total = ref(0) // 列表的总页数 |
||||
|
const queryParams = reactive({ |
||||
|
pageNo: 1, |
||||
|
pageSize: 10, |
||||
|
tendId: undefined, |
||||
|
createTime: [], |
||||
|
corgId: undefined, |
||||
|
corgName: undefined, |
||||
|
userCount: undefined, |
||||
|
groupCount: undefined, |
||||
|
loginname: undefined, |
||||
|
contact: undefined, |
||||
|
bindingPlatform: undefined, |
||||
|
}) |
||||
|
const queryFormRef = ref() // 搜索的表单 |
||||
|
const exportLoading = ref(false) // 导出的加载中 |
||||
|
|
||||
|
/** 查询列表 */ |
||||
|
const getList = async () => { |
||||
|
loading.value = true |
||||
|
try { |
||||
|
const data = await TenantInterphoneApi.getTenantInterphonePage(queryParams) |
||||
|
list.value = data.list |
||||
|
total.value = data.total |
||||
|
} finally { |
||||
|
loading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 搜索按钮操作 */ |
||||
|
const handleQuery = () => { |
||||
|
queryParams.pageNo = 1 |
||||
|
getList() |
||||
|
} |
||||
|
|
||||
|
/** 重置按钮操作 */ |
||||
|
const resetQuery = () => { |
||||
|
queryFormRef.value.resetFields() |
||||
|
handleQuery() |
||||
|
} |
||||
|
|
||||
|
/** 添加/修改操作 */ |
||||
|
const formRef = ref() |
||||
|
const openForm = (type: string, id?: number) => { |
||||
|
formRef.value.open(type, id) |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
const handleDelete = async (id: number) => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
// 发起删除 |
||||
|
await TenantInterphoneApi.deleteTenantInterphone(id) |
||||
|
message.success(t('common.delSuccess')) |
||||
|
// 刷新列表 |
||||
|
await getList() |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
/** 批量删除租户对讲平台对应 */ |
||||
|
const handleDeleteBatch = async () => { |
||||
|
try { |
||||
|
// 删除的二次确认 |
||||
|
await message.delConfirm() |
||||
|
await TenantInterphoneApi.deleteTenantInterphoneList(checkedIds.value); |
||||
|
message.success(t('common.delSuccess')) |
||||
|
await getList(); |
||||
|
} catch {} |
||||
|
} |
||||
|
|
||||
|
const checkedIds = ref<number[]>([]) |
||||
|
const handleRowCheckboxChange = (records: TenantInterphone[]) => { |
||||
|
checkedIds.value = records.map((item) => item.id); |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
const handleExport = async () => { |
||||
|
try { |
||||
|
// 导出的二次确认 |
||||
|
await message.exportConfirm() |
||||
|
// 发起导出 |
||||
|
exportLoading.value = true |
||||
|
const data = await TenantInterphoneApi.exportTenantInterphone(queryParams) |
||||
|
download.excel(data, '租户对讲平台对应.xls') |
||||
|
} catch { |
||||
|
} finally { |
||||
|
exportLoading.value = false |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 初始化 **/ |
||||
|
onMounted(() => { |
||||
|
getList() |
||||
|
}) |
||||
|
</script> |
||||
Loading…
Reference in new issue