|
@@ -2,9 +2,13 @@ package com.iotechn.unimall.admin.api.gubi.impl;
|
|
|
|
|
|
import java.util.List;
|
|
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.apache.ibatis.session.RowBounds;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
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.data.domain.gubi.GubiTypeInfo;
|
|
import com.iotechn.unimall.admin.api.gubi.IGubiTypeInfoService;
|
|
import com.iotechn.unimall.admin.api.gubi.IGubiTypeInfoService;
|
|
import com.iotechn.unimall.data.model.Page;
|
|
import com.iotechn.unimall.data.model.Page;
|
|
|
|
+
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
+
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 一级分类Service业务层处理
|
|
* 一级分类Service业务层处理
|
|
- *
|
|
|
|
|
|
+ *
|
|
* @author jlb
|
|
* @author jlb
|
|
* @date 2022-11-15
|
|
* @date 2022-11-15
|
|
*/
|
|
*/
|
|
@Service
|
|
@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, "操作日志");
|
|
|
|
+ }
|
|
}
|
|
}
|