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

修改分页顺序 科室修改判断

ljx 4 роки тому
батько
коміт
bfac05ac97

+ 2 - 1
src/main/java/com/imed/costaccount/service/impl/CostShareParamServiceImpl.java

@@ -46,7 +46,8 @@ public class CostShareParamServiceImpl extends ServiceImpl<CostShareParamMapper,
         Page<CostShareParam> costShareParamPage = new Page<>(current, pageSize);
         Page<CostShareParam> pages = this.page(costShareParamPage, new QueryWrapper<CostShareParam>().lambda()
                 .eq(!StringUtils.isEmpty(hospId), CostShareParam::getHospId, hospId)
-                .like(!StringUtils.isEmpty(name), CostShareParam::getShareParamName, name));
+                .like(!StringUtils.isEmpty(name), CostShareParam::getShareParamName, name).orderByDesc(CostShareParam::getCreateTime))
+                ;
         List<CostShareParam> records = pages.getRecords();
         List<CostShareParamVO> costShareParamVOList = BeanUtil.convertList(records, CostShareParamVO.class);
         PageUtils pageUtils = new PageUtils(pages);

+ 9 - 1
src/main/java/com/imed/costaccount/service/impl/DepartmentServiceImpl.java

@@ -77,7 +77,8 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
                 .eq(!StringUtils.isEmpty(id), Department::getId, id)
                 .like(!StringUtils.isEmpty(departmentName), Department::getDepartmentName, departmentName)
                 .eq(!StringUtils.isEmpty(departmentCode), Department::getDepartmentCode, departmentCode)
-                .eq(!StringUtils.isEmpty(hospId), Department::getHospId, hospId);
+                .eq(!StringUtils.isEmpty(hospId), Department::getHospId, hospId)
+                .orderByDesc(Department::getCreateTime);
         List<Department> departmentList = baseMapper.selectList(wrapper);
         return departmentList;
     }
@@ -122,6 +123,13 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
             throw new CostException("未找到相关科室信息");
         }
         baseMapper.deleteById(id);
+        // 查询所有的科室信息
+        List<Department> departmentList = baseMapper.selectList(new QueryWrapper<Department>().lambda().eq(Department::getHospId, hospId));
+        Map<String, List<Department>> map =
+                departmentList.stream().collect(Collectors.groupingBy(Department::getDepartmentCode));
+        if (!CollectionUtils.isEmpty(map.get(departmentRequest.getDepartmentCode()))){
+            throw new CostException(500,"科室代码"+departmentRequest.getDepartmentCode()+"已存在");
+        }
         // 新增操作
         Department departmentResponse = BeanUtil.convertObj(departmentRequest, Department.class);
         departmentResponse.setId(null);

+ 1 - 1
src/main/java/com/imed/costaccount/service/impl/HospitalServiceImpl.java

@@ -45,7 +45,7 @@ public class HospitalServiceImpl extends ServiceImpl<HospitalMapper, Hospital> i
     public PageUtils queryList(Integer current, Integer pageSize, Integer hospId, String name) {
         Page<Hospital> hosptailPage = new Page<>(current, pageSize);
         Page<Hospital> pages = this.page(hosptailPage, new QueryWrapper<Hospital>().lambda()
-                .like(!StringUtils.isEmpty(name), Hospital::getName, name));
+                .like(!StringUtils.isEmpty(name), Hospital::getName, name).orderByDesc(Hospital::getCreateTime));
         List<Hospital> records = pages.getRecords();
         List<HospitalVO> hospitalVOList = BeanUtil.convertList(records, HospitalVO.class);
 

+ 8 - 9
src/main/java/com/imed/costaccount/service/impl/ProductServiceImpl.java

@@ -4,29 +4,27 @@ import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.imed.costaccount.common.exception.CostException;
 import com.imed.costaccount.common.util.PageUtils;
-import com.imed.costaccount.model.dto.ProductDTO;
+import com.imed.costaccount.mapper.ProductMapper;
+import com.imed.costaccount.model.Product;
 import com.imed.costaccount.model.User;
+import com.imed.costaccount.model.dto.ProductDTO;
 import com.imed.costaccount.model.dto.ProductEditDTO;
 import com.imed.costaccount.model.vo.CommonVO;
 import com.imed.costaccount.model.vo.ProductVO;
+import com.imed.costaccount.service.ProductService;
 import com.imed.costaccount.utils.BeanUtil;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Collections;
 import java.util.List;
 import java.util.Objects;
 import java.util.stream.Collectors;
 
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-
-import com.imed.costaccount.mapper.ProductMapper;
-import com.imed.costaccount.model.Product;
-import com.imed.costaccount.service.ProductService;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
 
 @Service("productService")
 public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements ProductService {
@@ -48,6 +46,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
                 new LambdaQueryWrapper<Product>()
                         .eq(Product::getHospId, user.getHospId())
                         .eq(StrUtil.isNotBlank(name), Product::getProductName, name)
+                .orderByDesc(Product::getCreateTime)
         );
         PageUtils pageUtils = new PageUtils(pages);
         List<Product> records = pages.getRecords();

+ 5 - 2
src/main/java/com/imed/costaccount/service/impl/UserServiceImpl.java

@@ -34,7 +34,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 
@@ -104,7 +103,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
     @Override
     public PageUtils queryList(Integer page, Integer pageSize, Integer hospId, String name) {
         Page<User> userPage = new Page<>(page, pageSize);
-        Page<User> pages = this.page(userPage, new QueryWrapper<User>().lambda().eq(User::getHospId, hospId).like(!StringUtils.isEmpty(name), User::getName, name));
+        Page<User> pages = this.page(userPage,
+                new QueryWrapper<User>().lambda().
+                        eq(User::getHospId, hospId)
+                        .like(!StringUtils.isEmpty(name), User::getName, name)
+                        .orderByDesc(User::getCreateTime));
         List<User> records = pages.getRecords();
         List<UserVO> userVOS = BeanUtil.convertList(records, UserVO.class);
         PageUtils pageUtils = new PageUtils(pages);