Переглянути джерело

科室信息维护——查询修改

wangyu 6 роки тому
батько
коміт
ca0297c300

+ 2 - 15
icssman-service/src/main/java/com/diagbot/facade/DeptInfoFacade.java

@@ -1,8 +1,6 @@
 package com.diagbot.facade;
 
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.diagbot.entity.DeptInfo;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.exception.CommonErrorCode;
@@ -11,15 +9,12 @@ import com.diagbot.service.impl.DeptInfoServiceImpl;
 import com.diagbot.util.BeanUtil;
 import com.diagbot.util.DateUtil;
 import com.diagbot.util.ListUtil;
-import com.diagbot.util.StringUtil;
 import com.diagbot.util.UserUtils;
 import com.diagbot.vo.AddDeptInfoVO;
 import com.diagbot.vo.GetDeptInfoVO;
 import com.diagbot.vo.UpdateDeptInfoVO;
 import org.springframework.stereotype.Component;
 
-import java.util.List;
-
 /**
  * @Description:
  * @Author:zhaops
@@ -85,19 +80,11 @@ public class DeptInfoFacade extends DeptInfoServiceImpl {
 
 
     public IPage<DeptInfo> getDeptInfo(GetDeptInfoVO getDeptInfoVO){
-        IPage iPage =new Page();
-        BeanUtil.copyProperties(getDeptInfoVO,iPage);
-        QueryWrapper<DeptInfo> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("is_deleted",IsDeleteEnum.N.getKey());
-        if (StringUtil.isNotEmpty(getDeptInfoVO.getName())){
-            queryWrapper.eq("name",getDeptInfoVO.getName());
-        }
-        List<DeptInfo> deptInfoList = this.list(queryWrapper);
-        if (ListUtil.isEmpty(deptInfoList)){
+        IPage iPage = this.getAllDeptInfo(getDeptInfoVO);
+        if (ListUtil.isEmpty(iPage.getRecords())){
             throw new CommonException(CommonErrorCode.FAIL,
                     "获取科室信息失败");
         }
-        iPage.setRecords(deptInfoList);
         return iPage;
     }
 }

+ 9 - 1
icssman-service/src/main/java/com/diagbot/mapper/DeptInfoMapper.java

@@ -1,7 +1,9 @@
 package com.diagbot.mapper;
 
-import com.diagbot.entity.DeptInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.diagbot.entity.DeptInfo;
+import com.diagbot.vo.GetDeptInfoVO;
 
 /**
  * <p>
@@ -13,4 +15,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface DeptInfoMapper extends BaseMapper<DeptInfo> {
 
+    /**
+     * 获取科室信息
+     * @param getDeptInfoVO
+     * @return
+     */
+    public IPage<DeptInfo> getAllDeptInfo(GetDeptInfoVO getDeptInfoVO);
 }

+ 9 - 1
icssman-service/src/main/java/com/diagbot/service/DeptInfoService.java

@@ -1,7 +1,9 @@
 package com.diagbot.service;
 
-import com.diagbot.entity.DeptInfo;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.diagbot.entity.DeptInfo;
+import com.diagbot.vo.GetDeptInfoVO;
 
 /**
  * <p>
@@ -13,4 +15,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface DeptInfoService extends IService<DeptInfo> {
 
+    /**
+     * 获取科室信息
+     * @param getDeptInfoVO
+     * @return
+     */
+    public IPage<DeptInfo> getAllDeptInfo(GetDeptInfoVO getDeptInfoVO);
 }

+ 7 - 1
icssman-service/src/main/java/com/diagbot/service/impl/DeptInfoServiceImpl.java

@@ -1,9 +1,11 @@
 package com.diagbot.service.impl;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.diagbot.entity.DeptInfo;
 import com.diagbot.mapper.DeptInfoMapper;
 import com.diagbot.service.DeptInfoService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.diagbot.vo.GetDeptInfoVO;
 import org.springframework.stereotype.Service;
 
 /**
@@ -17,4 +19,8 @@ import org.springframework.stereotype.Service;
 @Service
 public class DeptInfoServiceImpl extends ServiceImpl<DeptInfoMapper, DeptInfo> implements DeptInfoService {
 
+    @Override
+    public IPage<DeptInfo> getAllDeptInfo(GetDeptInfoVO getDeptInfoVO) {
+        return baseMapper.getAllDeptInfo(getDeptInfoVO);
+    }
 }

+ 7 - 0
icssman-service/src/main/resources/mapper/DeptInfoMapper.xml

@@ -14,4 +14,11 @@
         <result column="remark" property="remark" />
     </resultMap>
 
+    <select id="getAllDeptInfo" resultType="com.diagbot.dto.DeptInfoDTO">
+        SELECT * FROM `icss_dept_info` WHERE is_deleted = 'N'
+         <if test="name != null and name != ''">
+             AND `name` LIKE CONCAT('%',#{name},'%')
+         </if>
+        order by id desc
+    </select>
 </mapper>