gongdecai 2 năm trước cách đây
mục cha
commit
3726bfb23b

+ 4 - 0
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/gubi/IGubiTypeInfoService.java

@@ -10,6 +10,7 @@ import com.iotechn.unimall.core.annotation.param.NotNull;
 import com.iotechn.unimall.core.exception.ServiceException;
 import com.iotechn.unimall.data.model.Page;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 一级分类Service接口
@@ -38,6 +39,9 @@ public interface IGubiTypeInfoService{
 		@HttpParam(name = "limit", type = HttpParamType.COMMON, description = "页码长度", valueDef = "20") Integer limit)
 		throws ServiceException;
 
+	@HttpMethod(description = "列表", permission = "admin:gubi:gubiTypeInfo:list",permissionParentName = "宠物管理", permissionName = "一级分类管理")
+	public List<GubiTypeInfo> listInfo() throws ServiceException;
+
 	@HttpMethod(description = "删除", permission = "admin:gubi:gubiTypeInfo:delete",permissionParentName = "宠物管理", permissionName = "一级分类管理")
 	public Boolean delete(@NotNull @HttpParam(name = "id", type = HttpParamType.COMMON, description = "")String id)throws ServiceException;
 

+ 139 - 107
unimall-admin-api/src/main/java/com/iotechn/unimall/admin/api/gubi/impl/GubiTypeInfoServiceImpl.java

@@ -2,9 +2,13 @@ package com.iotechn.unimall.admin.api.gubi.impl;
 
 import java.util.List;
 
+import com.iotechn.unimall.data.domain.gubi.GubiTypeSecond;
+import com.iotechn.unimall.data.mapper.gubi.GubiTypeSecondMapper;
+import com.iotechn.unimall.data.mapper.gubi.GubiTypeThreeMapper;
 import org.apache.ibatis.session.RowBounds;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
 
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
@@ -15,124 +19,152 @@ import com.iotechn.unimall.data.mapper.gubi.GubiTypeInfoMapper;
 import com.iotechn.unimall.data.domain.gubi.GubiTypeInfo;
 import com.iotechn.unimall.admin.api.gubi.IGubiTypeInfoService;
 import com.iotechn.unimall.data.model.Page;
+
 import java.util.Date;
+
 import org.springframework.transaction.annotation.Transactional;
 
 /**
  * 一级分类Service业务层处理
- * 
+ *
  * @author jlb
  * @date 2022-11-15
  */
 @Service
-public class GubiTypeInfoServiceImpl implements IGubiTypeInfoService{
-	@Autowired
-	private GubiTypeInfoMapper gubiTypeInfoMapper;
-	
-	@Override
-	public Boolean add(GubiTypeInfo gubiTypeInfo,Long adminId) throws ServiceException {
-		Date now = new Date();
-		gubiTypeInfo.setGmtCreate(now);
-		gubiTypeInfo.setGmtUpdate(now);
-		gubiTypeInfo.setAdminId(adminId);
-		return gubiTypeInfoMapper.insert(gubiTypeInfo)>0;
-	}
+public class GubiTypeInfoServiceImpl implements IGubiTypeInfoService {
+    @Autowired
+    private GubiTypeInfoMapper gubiTypeInfoMapper;
+    @Autowired
+    private GubiTypeSecondMapper gubiTypeSecondMapper;
+    @Autowired
+    private GubiTypeThreeMapper gubiTypeThreeMapper;
+
+    @Override
+    public Boolean add(GubiTypeInfo gubiTypeInfo, Long adminId) throws ServiceException {
+        Date now = new Date();
+        gubiTypeInfo.setGmtCreate(now);
+        gubiTypeInfo.setGmtUpdate(now);
+        gubiTypeInfo.setAdminId(adminId);
+        return gubiTypeInfoMapper.insert(gubiTypeInfo) > 0;
+    }
+
+    @Override
+    public Page<GubiTypeInfo> list(Long companyId, String typeName, Long postion, String status, Long deleteFlag, Date gmtCreate, Date gmtUpdate, Long userId, Long adminId, Integer page, Integer limit) throws ServiceException {
+        Wrapper<GubiTypeInfo> wrapper = new EntityWrapper<GubiTypeInfo>();
+        if (!StringUtils.isEmpty(companyId)) {
+            wrapper.eq("company_id", companyId);
+        }
+        if (!StringUtils.isEmpty(typeName)) {
+            wrapper.eq("type_name", typeName);
+        }
+        if (!StringUtils.isEmpty(postion)) {
+            wrapper.eq("postion", postion);
+        }
+        if (!StringUtils.isEmpty(status)) {
+            wrapper.eq("status", status);
+        }
+        if (!StringUtils.isEmpty(deleteFlag)) {
+            wrapper.eq("delete_flag", deleteFlag);
+        }
+        if (!StringUtils.isEmpty(gmtCreate)) {
+            wrapper.eq("gmt_create", gmtCreate);
+        }
+        if (!StringUtils.isEmpty(gmtUpdate)) {
+            wrapper.eq("gmt_update", gmtUpdate);
+        }
+        if (!StringUtils.isEmpty(userId)) {
+            wrapper.eq("user_id", userId);
+        }
+        if (!StringUtils.isEmpty(adminId)) {
+            wrapper.eq("admin_id", adminId);
+        }
+        wrapper.eq("delete_flag", 0);
+        List<GubiTypeInfo> list = gubiTypeInfoMapper.selectPage(new RowBounds((page - 1) * limit, limit), wrapper);
+        Integer count = gubiTypeInfoMapper.selectCount(wrapper);
+        return new Page<GubiTypeInfo>(list, page, limit, count);
+    }
+
+    public List<GubiTypeInfo> listInfo() {
+        List<GubiTypeInfo> list = gubiTypeInfoMapper.selectList(new EntityWrapper<GubiTypeInfo>()
+                .eq("delete_flag", "0")
+                .orderBy("postion"));
+        if (!CollectionUtils.isEmpty(list)) {
+            for (int i = 0; i < list.size(); i++) {
+                List<GubiTypeSecond> gubiTypeSeconds = gubiTypeSecondMapper.selectList(new EntityWrapper<GubiTypeSecond>()
+                        .eq("type_id", list.get(i).getTypeName())
+                        .eq("delete_flag", "0")
+                        .orderBy("postion"));
+                list.get(i).setGubiTypeSeconds(gubiTypeSeconds);
+//                if(!CollectionUtils.isEmpty(gubiTypeSeconds)){
+//                    for(){
+//
+//                    }
+//                }
+            }
+
+        }
+        return list;
+    }
 
-	@Override
-	public Page<GubiTypeInfo> list(Long companyId,String typeName,Long postion,String status,Long deleteFlag,Date gmtCreate,Date gmtUpdate,Long userId,Long adminId, Integer page, Integer limit)throws ServiceException {
-		Wrapper<GubiTypeInfo> wrapper = new EntityWrapper<GubiTypeInfo>();
-														if (!StringUtils.isEmpty(companyId)) {
-					wrapper.eq("company_id", companyId);
-				}
-												if (!StringUtils.isEmpty(typeName)) {
-					wrapper.eq("type_name", typeName);
-				}
-												if (!StringUtils.isEmpty(postion)) {
-					wrapper.eq("postion", postion);
-				}
-												if (!StringUtils.isEmpty(status)) {
-					wrapper.eq("status", status);
-				}
-												if (!StringUtils.isEmpty(deleteFlag)) {
-					wrapper.eq("delete_flag", deleteFlag);
-				}
-												if (!StringUtils.isEmpty(gmtCreate)) {
-					wrapper.eq("gmt_create", gmtCreate);
-				}
-												if (!StringUtils.isEmpty(gmtUpdate)) {
-					wrapper.eq("gmt_update", gmtUpdate);
-				}
-												if (!StringUtils.isEmpty(userId)) {
-					wrapper.eq("user_id", userId);
-				}
-												if (!StringUtils.isEmpty(adminId)) {
-					wrapper.eq("admin_id", adminId);
-				}
-							wrapper.eq("delete_flag", 0);
-		List<GubiTypeInfo> list = gubiTypeInfoMapper.selectPage(new RowBounds((page - 1) * limit, limit), wrapper);
-		Integer count = gubiTypeInfoMapper.selectCount(wrapper);
-		return new Page<GubiTypeInfo>(list, page, limit, count);
-	}
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean delete(String id) {
+        String[] ids = String.valueOf(id).split(",");
+        for (String tt : ids) {
+            GubiTypeInfo tmp = gubiTypeInfoMapper.selectById(Long.parseLong(tt));
+            if (tmp != null) {
+                tmp.setDeleteFlag(1l);
+                gubiTypeInfoMapper.updateById(tmp);
+            }
+        }
+        return true;
+    }
 
-	@Override
-	@Transactional(rollbackFor = Exception.class)
-	public Boolean delete(String id) {
-		String[] ids = String.valueOf(id).split(",");
-		for (String tt:ids) {
-			GubiTypeInfo tmp =  gubiTypeInfoMapper.selectById(Long.parseLong(tt));
-			if(tmp != null){
-				tmp.setDeleteFlag(1l);
-				gubiTypeInfoMapper.updateById(tmp);
-			}
-		}
-		return true;
-	}
+    @Override
+    public Boolean update(GubiTypeInfo gubiTypeInfo, Long adminId) throws ServiceException {
+        Date now = new Date();
+        gubiTypeInfo.setGmtUpdate(now);
+        gubiTypeInfo.setAdminId(adminId);
+        return gubiTypeInfoMapper.updateById(gubiTypeInfo) > 0;
+    }
 
-	@Override
-	public Boolean update(GubiTypeInfo gubiTypeInfo,Long adminId) throws ServiceException {
-		Date now = new Date();
-		gubiTypeInfo.setGmtUpdate(now);
-		gubiTypeInfo.setAdminId(adminId);
-		return gubiTypeInfoMapper.updateById(gubiTypeInfo)>0;
-	}
+    @Override
+    public GubiTypeInfo get(Long id) throws ServiceException {
+        return gubiTypeInfoMapper.selectById(id);
+    }
 
-	@Override
-	public GubiTypeInfo get(Long id) throws ServiceException {
-		return gubiTypeInfoMapper.selectById(id);
-	}
-	
-	@Override
-	public String export(Long companyId,String typeName,Long postion,String status,Long deleteFlag,Date gmtCreate,Date gmtUpdate,Long userId,Long adminId, Integer page, Integer limit)throws ServiceException {
-		Wrapper<GubiTypeInfo> wrapper = new EntityWrapper<GubiTypeInfo>();
-														if (!StringUtils.isEmpty(companyId)) {
-					wrapper.eq("company_id", companyId);
-				}
-												if (!StringUtils.isEmpty(typeName)) {
-					wrapper.eq("type_name", typeName);
-				}
-												if (!StringUtils.isEmpty(postion)) {
-					wrapper.eq("postion", postion);
-				}
-												if (!StringUtils.isEmpty(status)) {
-					wrapper.eq("status", status);
-				}
-												if (!StringUtils.isEmpty(deleteFlag)) {
-					wrapper.eq("delete_flag", deleteFlag);
-				}
-												if (!StringUtils.isEmpty(gmtCreate)) {
-					wrapper.eq("gmt_create", gmtCreate);
-				}
-												if (!StringUtils.isEmpty(gmtUpdate)) {
-					wrapper.eq("gmt_update", gmtUpdate);
-				}
-												if (!StringUtils.isEmpty(userId)) {
-					wrapper.eq("user_id", userId);
-				}
-												if (!StringUtils.isEmpty(adminId)) {
-					wrapper.eq("admin_id", adminId);
-				}
-							List<GubiTypeInfo> list = gubiTypeInfoMapper.selectList(wrapper);
-		ExcelUtil<GubiTypeInfo> util = new ExcelUtil<GubiTypeInfo>(GubiTypeInfo.class);
-		return util.exportExcel(list, "操作日志");
-	}
+    @Override
+    public String export(Long companyId, String typeName, Long postion, String status, Long deleteFlag, Date gmtCreate, Date gmtUpdate, Long userId, Long adminId, Integer page, Integer limit) throws ServiceException {
+        Wrapper<GubiTypeInfo> wrapper = new EntityWrapper<GubiTypeInfo>();
+        if (!StringUtils.isEmpty(companyId)) {
+            wrapper.eq("company_id", companyId);
+        }
+        if (!StringUtils.isEmpty(typeName)) {
+            wrapper.eq("type_name", typeName);
+        }
+        if (!StringUtils.isEmpty(postion)) {
+            wrapper.eq("postion", postion);
+        }
+        if (!StringUtils.isEmpty(status)) {
+            wrapper.eq("status", status);
+        }
+        if (!StringUtils.isEmpty(deleteFlag)) {
+            wrapper.eq("delete_flag", deleteFlag);
+        }
+        if (!StringUtils.isEmpty(gmtCreate)) {
+            wrapper.eq("gmt_create", gmtCreate);
+        }
+        if (!StringUtils.isEmpty(gmtUpdate)) {
+            wrapper.eq("gmt_update", gmtUpdate);
+        }
+        if (!StringUtils.isEmpty(userId)) {
+            wrapper.eq("user_id", userId);
+        }
+        if (!StringUtils.isEmpty(adminId)) {
+            wrapper.eq("admin_id", adminId);
+        }
+        List<GubiTypeInfo> list = gubiTypeInfoMapper.selectList(wrapper);
+        ExcelUtil<GubiTypeInfo> util = new ExcelUtil<GubiTypeInfo>(GubiTypeInfo.class);
+        return util.exportExcel(list, "操作日志");
+    }
 }

+ 4 - 0
unimall-data/src/main/java/com/iotechn/unimall/data/domain/gubi/GubiTypeInfo.java

@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.annotations.TableField;
 import com.baomidou.mybatisplus.enums.FieldFill;
 import com.iotechn.unimall.core.util.StringUtils;
 import java.util.Date;
+import java.util.List;
 
 /**
  * 一级分类对象 gubi_type_info
@@ -73,6 +74,9 @@ public class GubiTypeInfo extends SuperDO {
     @TableField("admin_id")
     private Long adminId;
 
+    /**  */
+    @TableField(exist = false)
+    private List<GubiTypeSecond> gubiTypeSeconds;
 
     @Override
     public String toString() {

+ 5 - 0
unimall-data/src/main/java/com/iotechn/unimall/data/domain/gubi/GubiTypeThree.java

@@ -78,6 +78,11 @@ public class GubiTypeThree extends SuperDO {
     @TableField("grade")
     private String grade;
 
+    /** 同分数量 */
+    @Excel(name = "同分数量")
+    @TableField("tong_fen")
+    private String tongFen;
+
     /** 高分数量 */
     @Excel(name = "高分数量")
     @TableField("high_scores")