Merge remote-tracking branch 'origin/master'
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
@@ -40,7 +40,7 @@ public class CustomerNoticesController extends BaseController {
|
||||
/**
|
||||
* 查询客户服务-通知公告列表
|
||||
*/
|
||||
@SaCheckPermission("domain:notices:list")
|
||||
//@SaCheckPermission("domain:notices:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<CustomerNoticesVo> list(CustomerNoticesBo bo, PageQuery pageQuery) {
|
||||
return customerNoticesService.queryPageList(bo, pageQuery);
|
||||
@@ -62,7 +62,7 @@ public class CustomerNoticesController extends BaseController {
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("domain:notices:query")
|
||||
//@SaCheckPermission("domain:notices:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<CustomerNoticesVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
|
@@ -70,13 +70,13 @@ public class TbCommunityBo extends BaseEntity {
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@NotBlank(message = "经度不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
// @NotBlank(message = "经度不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String lon;
|
||||
|
||||
/**
|
||||
* 维度
|
||||
*/
|
||||
@NotBlank(message = "维度不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
// @NotBlank(message = "维度不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String lat;
|
||||
|
||||
/**
|
||||
|
@@ -18,13 +18,15 @@ public class ServiceWorkOrderAnalysisVo {
|
||||
private String date;
|
||||
private String dayOfWeek;
|
||||
private long count;
|
||||
private long weekCount;
|
||||
|
||||
public LineChartVo() {}
|
||||
|
||||
public LineChartVo(String date, String dayOfWeek, long count) {
|
||||
public LineChartVo(String date, String dayOfWeek, long count,long weekCount) {
|
||||
this.date = date;
|
||||
this.dayOfWeek = dayOfWeek;
|
||||
this.count = count;
|
||||
this.weekCount = weekCount;
|
||||
}
|
||||
}
|
||||
@Data
|
||||
|
@@ -3,6 +3,7 @@ package org.dromara.property.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import jodd.util.StringUtil;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
@@ -58,7 +59,24 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService {
|
||||
*/
|
||||
@Override
|
||||
public CustomerNoticesVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
List<ResidentPerson> residentPeople = residentPersonMapper.selectList();
|
||||
CustomerNoticesVo customerNoticesVo = baseMapper.selectVoById(id);
|
||||
if (CollUtil.isNotEmpty(residentPeople)) {
|
||||
ResidentPerson residentPerson = residentPeople.stream()
|
||||
.filter(vo -> vo.getId() != null && vo.getId().equals(customerNoticesVo.getIssuers())).findFirst().orElse(null);
|
||||
customerNoticesVo.setIssuersName(residentPerson.getUserName());
|
||||
if (ObjectUtil.isNotEmpty(customerNoticesVo.getNoticePersion())) {
|
||||
List<String> list = Arrays.asList(customerNoticesVo.getNoticePersion().split(","));
|
||||
List<ResidentPerson> filteredList = residentPeople.stream()
|
||||
.filter(person -> list.contains(person.getId().toString()))
|
||||
.collect(Collectors.toList());
|
||||
String usernames = filteredList.stream()
|
||||
.map(ResidentPerson::getUserName) // 假设ResidentPerson类有一个getUserName方法
|
||||
.collect(Collectors.joining(","));
|
||||
customerNoticesVo.setNoticePersionName(StringUtils.isNotBlank(usernames)?usernames:null);
|
||||
}
|
||||
}
|
||||
return customerNoticesVo;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package org.dromara.property.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
@@ -147,7 +148,7 @@ public class MachineTypeServiceImpl implements IMachineTypeService {
|
||||
if (CollUtil.isEmpty(machineTypeVoList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<MachineTypeTreeVo> machineTypeTreeVoList = MapstructUtils.convert(machineTypeVoList, MachineTypeTreeVo.class);
|
||||
List<MachineTypeTreeVo> machineTypeTreeVoList = BeanUtil.copyToList(machineTypeVoList, MachineTypeTreeVo.class);
|
||||
// 2. 构建树结构
|
||||
return buildMachineTypeTree(machineTypeTreeVoList);
|
||||
|
||||
|
@@ -379,33 +379,52 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
|
||||
dateList.add(today.minusDays(i));
|
||||
}
|
||||
|
||||
Map<String, Long> workOrdersByDate = serviceWorkOrdersList.stream()
|
||||
.filter(order -> {
|
||||
try {
|
||||
LocalDate createTime = LocalDate.parse((CharSequence) order.getCreateTime());
|
||||
return !createTime.isBefore(today.minusDays(7));
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.collect(Collectors.groupingBy(
|
||||
order -> LocalDate.parse((CharSequence) order.getCreateTime()).format(DateTimeFormatter.ISO_LOCAL_DATE),
|
||||
Collectors.counting()
|
||||
));
|
||||
// 按日期分组:统计总数量 和 已处理数量
|
||||
Map<String, Long> totalWorkOrdersByDate = new HashMap<>();
|
||||
Map<String, Long> processedWorkOrdersByDate = new HashMap<>();
|
||||
|
||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
DateTimeFormatter dateFormatter = DateTimeFormatter.ISO_LOCAL_DATE;
|
||||
|
||||
for (ServiceWorkOrders order : serviceWorkOrdersList) {
|
||||
try {
|
||||
LocalDate createTime = LocalDate.parse((CharSequence) order.getCreateTime());
|
||||
if (createTime.isBefore(today.minusDays(7))) {
|
||||
continue; // 跳过超过7天的数据
|
||||
}
|
||||
|
||||
String dateStr = createTime.format(dateFormatter);
|
||||
|
||||
// 总数 +1
|
||||
totalWorkOrdersByDate.put(dateStr, totalWorkOrdersByDate.getOrDefault(dateStr, 0L) + 1);
|
||||
|
||||
// 如果已处理,processed +1
|
||||
if (isProcessed(order)) {
|
||||
processedWorkOrdersByDate.put(dateStr, processedWorkOrdersByDate.getOrDefault(dateStr, 0L) + 1);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
// 忽略格式错误的日期
|
||||
}
|
||||
}
|
||||
|
||||
DateTimeFormatter dateFormatterFull = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
DateTimeFormatter dayOfWeekFormatter = DateTimeFormatter.ofPattern("E");
|
||||
|
||||
List<ServiceWorkOrderAnalysisVo.LineChartVo> result = new ArrayList<>();
|
||||
for (LocalDate date : dateList) {
|
||||
String dateStr = date.format(dateFormatter);
|
||||
String dateStr = date.format(dateFormatterFull);
|
||||
String dayOfWeek = date.format(dayOfWeekFormatter);
|
||||
result.add(new ServiceWorkOrderAnalysisVo.LineChartVo(dateStr, dayOfWeek, workOrdersByDate.getOrDefault(dateStr, 0L)));
|
||||
long total = totalWorkOrdersByDate.getOrDefault(dateStr, 0L);
|
||||
long processed = processedWorkOrdersByDate.getOrDefault(dateStr, 0L);
|
||||
result.add(new ServiceWorkOrderAnalysisVo.LineChartVo(dateStr, dayOfWeek, total, processed));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean isProcessed(ServiceWorkOrders order) {
|
||||
// 假设有一个字段 status 表示状态,"COMPLETED" 表示已处理
|
||||
return "4".equalsIgnoreCase(order.getStatus());
|
||||
}
|
||||
// 计算工单类型分布
|
||||
private List<ServiceWorkOrderAnalysisVo.PieChartVo> calculateWorkOrderTypeDistribution(List<ServiceWorkOrders> serviceWorkOrdersList) {
|
||||
// 按 typeId 分组统计数量
|
||||
|
@@ -0,0 +1,106 @@
|
||||
package org.dromara.system.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.system.domain.vo.AppFunListVo;
|
||||
import org.dromara.system.domain.bo.AppFunListBo;
|
||||
import org.dromara.system.service.IAppFunListService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* APP功能列表
|
||||
* 前端访问路由地址为:/system/funList
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/funList")
|
||||
public class AppFunListController extends BaseController {
|
||||
|
||||
private final IAppFunListService appFunListService;
|
||||
|
||||
/**
|
||||
* 查询APP功能列表列表
|
||||
*/
|
||||
@SaCheckPermission("system:funList:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<AppFunListVo> list(AppFunListBo bo, PageQuery pageQuery) {
|
||||
return appFunListService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出APP功能列表列表
|
||||
*/
|
||||
@SaCheckPermission("system:funList:export")
|
||||
@Log(title = "APP功能列表", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(AppFunListBo bo, HttpServletResponse response) {
|
||||
List<AppFunListVo> list = appFunListService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "APP功能列表", AppFunListVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取APP功能列表详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("system:funList:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<AppFunListVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return R.ok(appFunListService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增APP功能列表
|
||||
*/
|
||||
@SaCheckPermission("system:funList:add")
|
||||
@Log(title = "APP功能列表", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody AppFunListBo bo) {
|
||||
return toAjax(appFunListService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改APP功能列表
|
||||
*/
|
||||
@SaCheckPermission("system:funList:edit")
|
||||
@Log(title = "APP功能列表", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody AppFunListBo bo) {
|
||||
return toAjax(appFunListService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除APP功能列表
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("system:funList:remove")
|
||||
@Log(title = "APP功能列表", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("ids") Long[] ids) {
|
||||
return toAjax(appFunListService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
@@ -0,0 +1,66 @@
|
||||
package org.dromara.system.domain;
|
||||
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* APP功能列表对象 app_fun_list
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("app_fun_list")
|
||||
public class AppFunList extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
private Long roleid;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* icon
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* url
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 创建人id
|
||||
*/
|
||||
private Long createById;
|
||||
|
||||
/**
|
||||
* 更新人id
|
||||
*/
|
||||
private Long updateById;
|
||||
|
||||
/**
|
||||
* 搜索值
|
||||
*/
|
||||
private String searchValue;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
package org.dromara.system.domain.bo;
|
||||
|
||||
import org.dromara.system.domain.AppFunList;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* APP功能列表业务对象 app_fun_list
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = AppFunList.class, reverseConvertGenerate = false)
|
||||
public class AppFunListBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
private Long roleid;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* icon
|
||||
*/
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* url
|
||||
*/
|
||||
private String url;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,70 @@
|
||||
package org.dromara.system.domain.vo;
|
||||
|
||||
import org.dromara.common.translation.annotation.Translation;
|
||||
import org.dromara.common.translation.constant.TransConstant;
|
||||
import org.dromara.system.domain.AppFunList;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* APP功能列表视图对象 app_fun_list
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = AppFunList.class)
|
||||
public class AppFunListVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ExcelProperty(value = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
@ExcelProperty(value = "角色id")
|
||||
private Long roleid;
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
@ExcelProperty(value = "角色id")
|
||||
private String roleName;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@ExcelProperty(value = "名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* icon
|
||||
*/
|
||||
@Translation(type = TransConstant.OSS_ID_TO_URL)
|
||||
@ExcelProperty(value = "icon")
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* url
|
||||
*/
|
||||
@ExcelProperty(value = "url")
|
||||
private String url;
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
package org.dromara.system.mapper;
|
||||
|
||||
import org.dromara.system.domain.AppFunList;
|
||||
import org.dromara.system.domain.vo.AppFunListVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* APP功能列表Mapper接口
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
public interface AppFunListMapper extends BaseMapperPlus<AppFunList, AppFunListVo> {
|
||||
|
||||
}
|
@@ -0,0 +1,69 @@
|
||||
package org.dromara.system.service;
|
||||
|
||||
import org.dromara.system.domain.AppFunList;
|
||||
import org.dromara.system.domain.vo.AppFunListVo;
|
||||
import org.dromara.system.domain.bo.AppFunListBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* APP功能列表Service接口
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
public interface IAppFunListService {
|
||||
|
||||
/**
|
||||
* 查询APP功能列表
|
||||
*
|
||||
* @param id 主键
|
||||
* @return APP功能列表
|
||||
*/
|
||||
AppFunListVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询APP功能列表列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return APP功能列表分页列表
|
||||
*/
|
||||
TableDataInfo<AppFunListVo> queryPageList(AppFunListBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的APP功能列表列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return APP功能列表列表
|
||||
*/
|
||||
List<AppFunListVo> queryList(AppFunListBo bo);
|
||||
|
||||
/**
|
||||
* 新增APP功能列表
|
||||
*
|
||||
* @param bo APP功能列表
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(AppFunListBo bo);
|
||||
|
||||
/**
|
||||
* 修改APP功能列表
|
||||
*
|
||||
* @param bo APP功能列表
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(AppFunListBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除APP功能列表信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@@ -0,0 +1,139 @@
|
||||
package org.dromara.system.service.impl;
|
||||
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.system.mapper.SysRoleMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.system.domain.bo.AppFunListBo;
|
||||
import org.dromara.system.domain.vo.AppFunListVo;
|
||||
import org.dromara.system.domain.AppFunList;
|
||||
import org.dromara.system.mapper.AppFunListMapper;
|
||||
import org.dromara.system.service.IAppFunListService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* APP功能列表Service业务层处理
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class AppFunListServiceImpl implements IAppFunListService {
|
||||
|
||||
private final AppFunListMapper baseMapper;
|
||||
private final SysRoleMapper sysRoleMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询APP功能列表
|
||||
*
|
||||
* @param id 主键
|
||||
* @return APP功能列表
|
||||
*/
|
||||
@Override
|
||||
public AppFunListVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询APP功能列表列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return APP功能列表分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<AppFunListVo> queryPageList(AppFunListBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<AppFunList> lqw = buildQueryWrapper(bo);
|
||||
Page<AppFunListVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
result.getRecords().forEach(r -> r.setRoleName(sysRoleMapper.selectVoById(r.getRoleid()).getRoleName()));
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的APP功能列表列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return APP功能列表列表
|
||||
*/
|
||||
@Override
|
||||
public List<AppFunListVo> queryList(AppFunListBo bo) {
|
||||
LambdaQueryWrapper<AppFunList> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<AppFunList> buildQueryWrapper(AppFunListBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<AppFunList> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(AppFunList::getId);
|
||||
lqw.eq(bo.getRoleid() != null, AppFunList::getRoleid, bo.getRoleid());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getName()), AppFunList::getName, bo.getName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getIcon()), AppFunList::getIcon, bo.getIcon());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getUrl()), AppFunList::getUrl, bo.getUrl());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增APP功能列表
|
||||
*
|
||||
* @param bo APP功能列表
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(AppFunListBo bo) {
|
||||
AppFunList add = MapstructUtils.convert(bo, AppFunList.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改APP功能列表
|
||||
*
|
||||
* @param bo APP功能列表
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(AppFunListBo bo) {
|
||||
AppFunList update = MapstructUtils.convert(bo, AppFunList.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(AppFunList entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除APP功能列表信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
<?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="org.dromara.system.mapper.AppFunListMapper">
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user