From f57c5b200b97a01738ace0cfa06e991ee4c01460 Mon Sep 17 00:00:00 2001 From: feige <791364011@qq.com> Date: 星期一, 07 十月 2024 23:13:55 +0800 Subject: [PATCH] 修改了bug --- zhang-content/src/main/java/com/ruoyi/mapper/ZfAncestorMapper.java | 6 ++ zhang-content/src/main/java/com/ruoyi/domain/ZfAncestor.java | 6 ++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfAncestorController.java | 30 ++++++++++ ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHonorShareController.java | 10 +- zhang-content/src/main/java/com/ruoyi/domain/dto/AncestorClan.java | 5 + zhang-content/src/main/java/com/ruoyi/service/ZfAncestorService.java | 6 ++ zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java | 20 +++++- zhang-content/src/main/java/com/ruoyi/service/impl/ZfAncestorServiceImpl.java | 48 +++++++++++++++- 8 files changed, 117 insertions(+), 14 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHonorShareController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHonorShareController.java index 86e55ee..32f8ded 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHonorShareController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZHonorShareController.java @@ -26,7 +26,7 @@ @PostMapping("/share") public AjaxResult share(@RequestBody ShareMore zfDoctor){ - zfDoctor.setSysMenuId(2053L); + zfDoctor.setSysMenuId(2030L); return zHonorShareService.saveZa(zfDoctor); } @@ -35,7 +35,7 @@ */ @PostMapping("/getInfoByUserId") public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){ - zfDoctor.setSysMenuId(2053L); + zfDoctor.setSysMenuId(2030L); Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); return zHonorShareService.listByFidAid(zfDoctor,pageNo,pageSize) ; @@ -55,7 +55,7 @@ */ @PostMapping("/deleteInfoByUserId") public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){ - zfDoctor.setSysMenuId(2053L); + zfDoctor.setSysMenuId(2030L); return zHonorShareService.deleteZa(zfDoctor); } @@ -64,7 +64,7 @@ */ @PostMapping("/downloadDate") public AjaxResult ifDownLoad(@RequestBody ZfDownload zfDownload){ - zfDownload.setSysMenuId(2053L); + zfDownload.setSysMenuId(2030L); return zHonorDownloadService.addData(zfDownload); } @@ -73,7 +73,7 @@ */ @GetMapping("/all") public AjaxResult data(ZfDownload zfDownload){ - zfDownload.setSysMenuId(2053L); + zfDownload.setSysMenuId(2030L); Integer pageNo = Convert.toInt(ServletUtils.getParameter(PAGE_NO), 1); Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10); return zHonorDownloadService.selectDoctorList(zfDownload,pageNo ,pageSize); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfAncestorController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfAncestorController.java index 244de4e..71434a8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfAncestorController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfAncestorController.java @@ -10,7 +10,9 @@ import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.ServletUtils; import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.domain.*; +import com.ruoyi.domain.dto.AncestorClan; import com.ruoyi.domain.dto.AncestorHelper; import com.ruoyi.service.ZInfoUserService; import com.ruoyi.service.ZfAncestorService; @@ -23,12 +25,14 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.List; import static com.ruoyi.common.core.domain.AjaxResult.error; import static com.ruoyi.common.core.page.TableSupport.*; +import static jdk.nashorn.internal.runtime.regexp.joni.Config.log; @RestController @RequestMapping("/ZfAncestor") @@ -140,6 +144,32 @@ zInfoUserService.updateById(infoUser); } + @Log(title = "瀹跺涵澶т簨浠惰褰�", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ZfAncestor zfAncestor) { + List<AncestorClan> list = new ArrayList<>(); + + list = zfAncestorService.selectByCondition(zfAncestor); + // log.info("瀵煎嚭璁板綍涓�:{}", list); + ExcelUtil<AncestorClan> util = new ExcelUtil<>(AncestorClan.class); + util.exportExcel(response, list, "瀹跺涵澶т簨浠惰褰曟暟鎹�"); + + } + /** + * 瀵煎嚭瀵煎嚭绁栧厛淇℃伅璁板綍鍒楄〃 + */ +// @PreAuthorize("@ss.hasPermi('system:property:export')") + @Log(title = "瀵煎嚭绁栧厛淇℃伅", businessType = BusinessType.EXPORT) + @PostMapping("/export1/{ids}") + public void export(HttpServletResponse response, @PathVariable Long[] ids) + { + List<AncestorClan> list = zfAncestorService.selectByIds(ids); + // log.info("瀵煎嚭璁板綍涓�:{}",list); + ExcelUtil<AncestorClan> util = new ExcelUtil<>(AncestorClan.class); + util.exportExcel(response, list, "淇濇磥鏀剁撼璁板綍鏁版嵁"); + } + + /** * 淇敼绁栧厛淇℃伅 diff --git a/zhang-content/src/main/java/com/ruoyi/domain/ZfAncestor.java b/zhang-content/src/main/java/com/ruoyi/domain/ZfAncestor.java index bcabd02..49a33f0 100644 --- a/zhang-content/src/main/java/com/ruoyi/domain/ZfAncestor.java +++ b/zhang-content/src/main/java/com/ruoyi/domain/ZfAncestor.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.ruoyi.common.annotation.Excel; import lombok.Data; @Data @@ -17,12 +18,14 @@ /** * 瀹舵棌id */ + private Integer clanId; /** * 绁栧厛鍚嶇О */ + @Excel(name="绁栧厛鍚嶇О") private String name; /** @@ -33,16 +36,19 @@ /** * 绁栧厛鎬у埆 */ + @Excel(name="绁栧厛鎬у埆",readConverterExp = "0=濂�,1=鐢�") private Integer sex; /** * 绁栧厛绫诲瀷 */ + private Integer roleId; /** * 鐘舵�� */ + @Excel(name="鐘舵��",readConverterExp = "0=鍦ㄧ敤,1=绂佺敤") private Integer status; // /** diff --git a/zhang-content/src/main/java/com/ruoyi/domain/dto/AncestorClan.java b/zhang-content/src/main/java/com/ruoyi/domain/dto/AncestorClan.java index 4dd402d..6565bb9 100644 --- a/zhang-content/src/main/java/com/ruoyi/domain/dto/AncestorClan.java +++ b/zhang-content/src/main/java/com/ruoyi/domain/dto/AncestorClan.java @@ -1,15 +1,16 @@ package com.ruoyi.domain.dto; +import com.ruoyi.common.annotation.Excel; import com.ruoyi.domain.ZfAncestor; import lombok.Data; import java.io.Serializable; @Data public class AncestorClan extends ZfAncestor implements Serializable { - + @Excel(name="瀹舵棌鍚嶇О") private String clanName; - + @Excel(name="绫诲瀷") private String roleName; diff --git a/zhang-content/src/main/java/com/ruoyi/mapper/ZfAncestorMapper.java b/zhang-content/src/main/java/com/ruoyi/mapper/ZfAncestorMapper.java index 5ea78e6..892dcdc 100644 --- a/zhang-content/src/main/java/com/ruoyi/mapper/ZfAncestorMapper.java +++ b/zhang-content/src/main/java/com/ruoyi/mapper/ZfAncestorMapper.java @@ -14,10 +14,16 @@ import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; +import java.util.List; + @Mapper public interface ZfAncestorMapper extends BaseMapper<ZfAncestor> { @Select("select * , zf_role.name as roleName from zf_ancestor, zf_clan,zf_role where zf_ancestor.clan_id = zf_clan.clan_id and zf_ancestor.role_id = zf_role.id ${ew.customSqlSegment}") Page<AncestorClan> selectInfo(Page page, @Param(Constants.WRAPPER) Wrapper<Object> queryWrapper); + + @Select("select * , zf_role.name as roleName from zf_ancestor, zf_clan,zf_role where zf_ancestor.clan_id = zf_clan.clan_id and zf_ancestor.role_id = zf_role.id ${ew.customSqlSegment}") + List<AncestorClan> selectAllInfo( @Param(Constants.WRAPPER) Wrapper<Object> queryWrapper); + } diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZfAncestorService.java b/zhang-content/src/main/java/com/ruoyi/service/ZfAncestorService.java index 81f09d1..57cc54f 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZfAncestorService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZfAncestorService.java @@ -4,10 +4,16 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.domain.ZfAncestor; +import com.ruoyi.domain.dto.AncestorClan; + +import java.util.List; public interface ZfAncestorService extends IService<ZfAncestor> { AjaxResult selectDataList(Integer clanId, Integer pageNo, Integer pageSize); AjaxResult selectDataList(ZfAncestor zfAncestor, Integer pageNo, Integer pageSize); + List<AncestorClan> selectByCondition(ZfAncestor zfAncestor); + + List<AncestorClan> selectByIds(Long []ids); boolean count(Integer clanId); diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfAncestorServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfAncestorServiceImpl.java index 32e8358..e059439 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfAncestorServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfAncestorServiceImpl.java @@ -11,9 +11,8 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.EsModel; import com.ruoyi.common.utils.MapUtils; -import com.ruoyi.domain.ZInfoUser; -import com.ruoyi.domain.ZfAncestor; -import com.ruoyi.domain.ZfClan; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.domain.*; import com.ruoyi.domain.dto.AncestorClan; import com.ruoyi.mapper.ZfAncestorMapper; import com.ruoyi.service.*; @@ -122,6 +121,7 @@ queryWrapper.eq(zfAncestor.getClanId() !=null , " zf_ancestor.clan_id", zfAncestor.getClanId()); queryWrapper.eq(zfAncestor.getSysId() !=null , " zf_ancestor.sys_id ", zfAncestor.getSysId()); + queryWrapper.like(StringUtils.isNotEmpty(zfAncestor.getName()),"zf_ancestor.name",zfAncestor.getName()); Page<AncestorClan> info = zfAncestorMapper.selectInfo(new Page<>(pageNo, pageSize),queryWrapper); //page(pa, wrapper); @@ -131,6 +131,48 @@ return AjaxResult.success(data); } + @Override + public List<AncestorClan> selectByCondition(ZfAncestor zfAncestor) { + QueryWrapper<Object> lqw = new QueryWrapper<>(); + + lqw.like(StringUtils.isNotEmpty(zfAncestor.getName()),"zf_ancestor.name",zfAncestor.getName()); + + List<AncestorClan> lis = zfAncestorMapper.selectAllInfo(lqw); + + return lis; + } + + @Override + public List<AncestorClan> selectByIds(Long[] ids) { + List<AncestorClan> list = new ArrayList<>(); + QueryWrapper<Object> lqw = new QueryWrapper<>(); + // lqw.like(StringUtils.isNotEmpty(zfAncestor.getName()),"zf_ancestor.name",zfAncestor.getName()); + + // if(ids.length!=0) + // list = listByIds(Arrays.asList(ids)); + //else + list = zfAncestorMapper.selectAllInfo(lqw); +// System.out.println(list.size()); +// System.out.println("---------+++++++++---------"); + + List tmp = new ArrayList<>(Arrays.asList(ids)); + List res = new ArrayList(); + if(ids.length!=0) + { + for(AncestorClan ast : list) + { + if(tmp.contains(ast.getId().longValue())) + { + res.add(ast); + } + } + return res; + } + else + + return list; + } + @Override public Long addData(ZfAncestor zfAncestor) { diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java index 9f007e5..65d18d4 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfEquipmentServiceImpl.java @@ -217,6 +217,12 @@ //瑕佹煡鑷繁瀹跺涵鐨� ZInfoUser myself = zInfoUserService.getMyself(); Long familyId = myself.getFamilyId(); + Long fatherFaId = 0L; + if(myself.getFatherId()!=null) + fatherFaId = zInfoUserService.getInfoById(myself.getFatherId()).getFamilyId(); + Long motherFaId = 0L; + if(myself.getMomId()!=null) + motherFaId = zInfoUserService.getInfoBysysId(myself.getMomId()).getFamilyId(); //涔熻鏌ュ埆浜烘巿鏉冪殑 List<ZAuthority> authority = zAuthorityService.getAuthority(); List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EQUIPMENT_LIST)).map(ZAuthority::getFid).collect(Collectors.toList()); @@ -226,7 +232,7 @@ LambdaQueryWrapper<ZfEquipment> lambdaQueryWrapper = buildCondition(zfEquipment, idList); List<ZfEquipment> beanRecords = list(lambdaQueryWrapper); log.info("浠庢暟鎹簱涓煡鍒扮殑涓�:{}", beanRecords); - return markOwnData(familyId, beanRecords); + return markOwnData(familyId, fatherFaId, motherFaId, beanRecords); } @Override @@ -256,10 +262,10 @@ // }).collect(Collectors.toList()); // } - public List<ZfEquipment> markOwnData(Long familyId,List<ZfEquipment> beanRecords){ + public List<ZfEquipment> markOwnData(Long familyId,Long fatherFamilyId, Long motherFamilyId, List<ZfEquipment> beanRecords){ return beanRecords.stream().peek( bean -> { - if (bean.getFamilyId() == familyId) { + if (bean.getFamilyId() == familyId ||(fatherFamilyId!=0L && fatherFamilyId==familyId)||(motherFamilyId!=0L && motherFamilyId==familyId)) { bean.setOwnData(1); } else { bean.setOwnData(0); @@ -292,6 +298,12 @@ return AjaxResult.success("鎮ㄦ病鍔犲叆鍒板搴旂殑瀹跺涵锛岃鑱旂郴绠$悊鍛�"); } Long familyId = myself.getFamilyId(); + Long fatherFaId = 0L; + if(myself.getFatherId()!=null) + fatherFaId = zInfoUserService.getInfoById(myself.getFatherId()).getFamilyId(); + Long motherFaId = 0L; + if(myself.getMomId()!=null) + motherFaId = zInfoUserService.getInfoBysysId(myself.getMomId()).getFamilyId(); //涔熻鏌ュ埆浜烘巿鏉冪殑 List<ZAuthority> authority = zAuthorityService.getAuthority(); List<Long> idList = authority.stream().filter(auth -> auth.getAuthority().toString().equals(EQUIPMENT_LIST)).map(ZAuthority::getFid).collect(Collectors.toList()); @@ -307,7 +319,7 @@ List<ZfEquipment> beanRecords = pageResult.getRecords();//寰楀埌鏌ヨ鍑烘潵鐨勬暟鎹� - List<ZfEquipment> dtoResult = markOwnData(familyId, beanRecords); + List<ZfEquipment> dtoResult = markOwnData(familyId, fatherFaId, motherFaId,beanRecords); HashMap<String, Object> data = MapUtils.getResult(pageResult, dtoResult); return AjaxResult.success(data); -- Gitblit v1.9.1