代码优化,废弃API修改
This commit is contained in:
@@ -3,6 +3,8 @@ package com.macro.mall.service;
|
|||||||
import com.macro.mall.dto.PmsProductCategoryParam;
|
import com.macro.mall.dto.PmsProductCategoryParam;
|
||||||
import com.macro.mall.dto.PmsProductCategoryWithChildrenItem;
|
import com.macro.mall.dto.PmsProductCategoryWithChildrenItem;
|
||||||
import com.macro.mall.model.PmsProductCategory;
|
import com.macro.mall.model.PmsProductCategory;
|
||||||
|
import org.springframework.transaction.annotation.Isolation;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -84,4 +84,9 @@ public interface UmsAdminService {
|
|||||||
* 获取用户信息
|
* 获取用户信息
|
||||||
*/
|
*/
|
||||||
UserDetails loadUserByUsername(String username);
|
UserDetails loadUserByUsername(String username);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取缓存服务
|
||||||
|
*/
|
||||||
|
UmsAdminCacheService getCacheService();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.macro.mall.service.impl;
|
package com.macro.mall.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.macro.mall.mapper.CmsSubjectMapper;
|
import com.macro.mall.mapper.CmsSubjectMapper;
|
||||||
import com.macro.mall.model.CmsSubject;
|
import com.macro.mall.model.CmsSubject;
|
||||||
@@ -30,7 +31,7 @@ public class CmsSubjectServiceImpl implements CmsSubjectService {
|
|||||||
PageHelper.startPage(pageNum, pageSize);
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
CmsSubjectExample example = new CmsSubjectExample();
|
CmsSubjectExample example = new CmsSubjectExample();
|
||||||
CmsSubjectExample.Criteria criteria = example.createCriteria();
|
CmsSubjectExample.Criteria criteria = example.createCriteria();
|
||||||
if (!StringUtils.isEmpty(keyword)) {
|
if (!StrUtil.isEmpty(keyword)) {
|
||||||
criteria.andTitleLike("%" + keyword + "%");
|
criteria.andTitleLike("%" + keyword + "%");
|
||||||
}
|
}
|
||||||
return subjectMapper.selectByExample(example);
|
return subjectMapper.selectByExample(example);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.macro.mall.service.impl;
|
package com.macro.mall.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.macro.mall.dto.PmsBrandParam;
|
import com.macro.mall.dto.PmsBrandParam;
|
||||||
import com.macro.mall.mapper.PmsBrandMapper;
|
import com.macro.mall.mapper.PmsBrandMapper;
|
||||||
@@ -37,7 +38,7 @@ public class PmsBrandServiceImpl implements PmsBrandService {
|
|||||||
PmsBrand pmsBrand = new PmsBrand();
|
PmsBrand pmsBrand = new PmsBrand();
|
||||||
BeanUtils.copyProperties(pmsBrandParam, pmsBrand);
|
BeanUtils.copyProperties(pmsBrandParam, pmsBrand);
|
||||||
//如果创建时首字母为空,取名称的第一个为首字母
|
//如果创建时首字母为空,取名称的第一个为首字母
|
||||||
if (StringUtils.isEmpty(pmsBrand.getFirstLetter())) {
|
if (StrUtil.isEmpty(pmsBrand.getFirstLetter())) {
|
||||||
pmsBrand.setFirstLetter(pmsBrand.getName().substring(0, 1));
|
pmsBrand.setFirstLetter(pmsBrand.getName().substring(0, 1));
|
||||||
}
|
}
|
||||||
return brandMapper.insertSelective(pmsBrand);
|
return brandMapper.insertSelective(pmsBrand);
|
||||||
@@ -49,7 +50,7 @@ public class PmsBrandServiceImpl implements PmsBrandService {
|
|||||||
BeanUtils.copyProperties(pmsBrandParam, pmsBrand);
|
BeanUtils.copyProperties(pmsBrandParam, pmsBrand);
|
||||||
pmsBrand.setId(id);
|
pmsBrand.setId(id);
|
||||||
//如果创建时首字母为空,取名称的第一个为首字母
|
//如果创建时首字母为空,取名称的第一个为首字母
|
||||||
if (StringUtils.isEmpty(pmsBrand.getFirstLetter())) {
|
if (StrUtil.isEmpty(pmsBrand.getFirstLetter())) {
|
||||||
pmsBrand.setFirstLetter(pmsBrand.getName().substring(0, 1));
|
pmsBrand.setFirstLetter(pmsBrand.getName().substring(0, 1));
|
||||||
}
|
}
|
||||||
//更新品牌时要更新商品中的品牌名称
|
//更新品牌时要更新商品中的品牌名称
|
||||||
@@ -79,7 +80,7 @@ public class PmsBrandServiceImpl implements PmsBrandService {
|
|||||||
PmsBrandExample pmsBrandExample = new PmsBrandExample();
|
PmsBrandExample pmsBrandExample = new PmsBrandExample();
|
||||||
pmsBrandExample.setOrderByClause("sort desc");
|
pmsBrandExample.setOrderByClause("sort desc");
|
||||||
PmsBrandExample.Criteria criteria = pmsBrandExample.createCriteria();
|
PmsBrandExample.Criteria criteria = pmsBrandExample.createCriteria();
|
||||||
if (!StringUtils.isEmpty(keyword)) {
|
if (!StrUtil.isEmpty(keyword)) {
|
||||||
criteria.andNameLike("%" + keyword + "%");
|
criteria.andNameLike("%" + keyword + "%");
|
||||||
}
|
}
|
||||||
return brandMapper.selectByExample(pmsBrandExample);
|
return brandMapper.selectByExample(pmsBrandExample);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.macro.mall.service.impl;
|
package com.macro.mall.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.macro.mall.dao.*;
|
import com.macro.mall.dao.*;
|
||||||
import com.macro.mall.dto.PmsProductParam;
|
import com.macro.mall.dto.PmsProductParam;
|
||||||
@@ -98,7 +99,7 @@ public class PmsProductServiceImpl implements PmsProductService {
|
|||||||
if(CollectionUtils.isEmpty(skuStockList))return;
|
if(CollectionUtils.isEmpty(skuStockList))return;
|
||||||
for(int i=0;i<skuStockList.size();i++){
|
for(int i=0;i<skuStockList.size();i++){
|
||||||
PmsSkuStock skuStock = skuStockList.get(i);
|
PmsSkuStock skuStock = skuStockList.get(i);
|
||||||
if(StringUtils.isEmpty(skuStock.getSkuCode())){
|
if(StrUtil.isEmpty(skuStock.getSkuCode())){
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
//日期
|
//日期
|
||||||
@@ -215,10 +216,10 @@ public class PmsProductServiceImpl implements PmsProductService {
|
|||||||
if (productQueryParam.getVerifyStatus() != null) {
|
if (productQueryParam.getVerifyStatus() != null) {
|
||||||
criteria.andVerifyStatusEqualTo(productQueryParam.getVerifyStatus());
|
criteria.andVerifyStatusEqualTo(productQueryParam.getVerifyStatus());
|
||||||
}
|
}
|
||||||
if (!StringUtils.isEmpty(productQueryParam.getKeyword())) {
|
if (!StrUtil.isEmpty(productQueryParam.getKeyword())) {
|
||||||
criteria.andNameLike("%" + productQueryParam.getKeyword() + "%");
|
criteria.andNameLike("%" + productQueryParam.getKeyword() + "%");
|
||||||
}
|
}
|
||||||
if (!StringUtils.isEmpty(productQueryParam.getProductSn())) {
|
if (!StrUtil.isEmpty(productQueryParam.getProductSn())) {
|
||||||
criteria.andProductSnEqualTo(productQueryParam.getProductSn());
|
criteria.andProductSnEqualTo(productQueryParam.getProductSn());
|
||||||
}
|
}
|
||||||
if (productQueryParam.getBrandId() != null) {
|
if (productQueryParam.getBrandId() != null) {
|
||||||
@@ -293,7 +294,7 @@ public class PmsProductServiceImpl implements PmsProductService {
|
|||||||
PmsProductExample productExample = new PmsProductExample();
|
PmsProductExample productExample = new PmsProductExample();
|
||||||
PmsProductExample.Criteria criteria = productExample.createCriteria();
|
PmsProductExample.Criteria criteria = productExample.createCriteria();
|
||||||
criteria.andDeleteStatusEqualTo(0);
|
criteria.andDeleteStatusEqualTo(0);
|
||||||
if(!StringUtils.isEmpty(keyword)){
|
if(!StrUtil.isEmpty(keyword)){
|
||||||
criteria.andNameLike("%" + keyword + "%");
|
criteria.andNameLike("%" + keyword + "%");
|
||||||
productExample.or().andDeleteStatusEqualTo(0).andProductSnLike("%" + keyword + "%");
|
productExample.or().andDeleteStatusEqualTo(0).andProductSnLike("%" + keyword + "%");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.macro.mall.service.impl;
|
package com.macro.mall.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.macro.mall.dao.PmsSkuStockDao;
|
import com.macro.mall.dao.PmsSkuStockDao;
|
||||||
import com.macro.mall.mapper.PmsSkuStockMapper;
|
import com.macro.mall.mapper.PmsSkuStockMapper;
|
||||||
import com.macro.mall.model.PmsSkuStock;
|
import com.macro.mall.model.PmsSkuStock;
|
||||||
@@ -26,7 +27,7 @@ public class PmsSkuStockServiceImpl implements PmsSkuStockService {
|
|||||||
public List<PmsSkuStock> getList(Long pid, String keyword) {
|
public List<PmsSkuStock> getList(Long pid, String keyword) {
|
||||||
PmsSkuStockExample example = new PmsSkuStockExample();
|
PmsSkuStockExample example = new PmsSkuStockExample();
|
||||||
PmsSkuStockExample.Criteria criteria = example.createCriteria().andProductIdEqualTo(pid);
|
PmsSkuStockExample.Criteria criteria = example.createCriteria().andProductIdEqualTo(pid);
|
||||||
if (!StringUtils.isEmpty(keyword)) {
|
if (!StrUtil.isEmpty(keyword)) {
|
||||||
criteria.andSkuCodeLike("%" + keyword + "%");
|
criteria.andSkuCodeLike("%" + keyword + "%");
|
||||||
}
|
}
|
||||||
return skuStockMapper.selectByExample(example);
|
return skuStockMapper.selectByExample(example);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.macro.mall.service.impl;
|
package com.macro.mall.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.macro.mall.mapper.SmsCouponHistoryMapper;
|
import com.macro.mall.mapper.SmsCouponHistoryMapper;
|
||||||
import com.macro.mall.model.SmsCouponHistory;
|
import com.macro.mall.model.SmsCouponHistory;
|
||||||
@@ -30,7 +31,7 @@ public class SmsCouponHistoryServiceImpl implements SmsCouponHistoryService {
|
|||||||
if(useStatus!=null){
|
if(useStatus!=null){
|
||||||
criteria.andUseStatusEqualTo(useStatus);
|
criteria.andUseStatusEqualTo(useStatus);
|
||||||
}
|
}
|
||||||
if(!StringUtils.isEmpty(orderSn)){
|
if(!StrUtil.isEmpty(orderSn)){
|
||||||
criteria.andOrderSnEqualTo(orderSn);
|
criteria.andOrderSnEqualTo(orderSn);
|
||||||
}
|
}
|
||||||
return historyMapper.selectByExample(example);
|
return historyMapper.selectByExample(example);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.macro.mall.service.impl;
|
package com.macro.mall.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.macro.mall.dao.SmsCouponDao;
|
import com.macro.mall.dao.SmsCouponDao;
|
||||||
import com.macro.mall.dao.SmsCouponProductCategoryRelationDao;
|
import com.macro.mall.dao.SmsCouponProductCategoryRelationDao;
|
||||||
@@ -108,7 +109,7 @@ public class SmsCouponServiceImpl implements SmsCouponService {
|
|||||||
public List<SmsCoupon> list(String name, Integer type, Integer pageSize, Integer pageNum) {
|
public List<SmsCoupon> list(String name, Integer type, Integer pageSize, Integer pageNum) {
|
||||||
SmsCouponExample example = new SmsCouponExample();
|
SmsCouponExample example = new SmsCouponExample();
|
||||||
SmsCouponExample.Criteria criteria = example.createCriteria();
|
SmsCouponExample.Criteria criteria = example.createCriteria();
|
||||||
if(!StringUtils.isEmpty(name)){
|
if(!StrUtil.isEmpty(name)){
|
||||||
criteria.andNameLike("%"+name+"%");
|
criteria.andNameLike("%"+name+"%");
|
||||||
}
|
}
|
||||||
if(type!=null){
|
if(type!=null){
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.macro.mall.service.impl;
|
package com.macro.mall.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.macro.mall.mapper.SmsFlashPromotionMapper;
|
import com.macro.mall.mapper.SmsFlashPromotionMapper;
|
||||||
import com.macro.mall.model.SmsFlashPromotion;
|
import com.macro.mall.model.SmsFlashPromotion;
|
||||||
@@ -55,7 +56,7 @@ public class SmsFlashPromotionServiceImpl implements SmsFlashPromotionService {
|
|||||||
public List<SmsFlashPromotion> list(String keyword, Integer pageSize, Integer pageNum) {
|
public List<SmsFlashPromotion> list(String keyword, Integer pageSize, Integer pageNum) {
|
||||||
PageHelper.startPage(pageNum, pageSize);
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
SmsFlashPromotionExample example = new SmsFlashPromotionExample();
|
SmsFlashPromotionExample example = new SmsFlashPromotionExample();
|
||||||
if (!StringUtils.isEmpty(keyword)) {
|
if (!StrUtil.isEmpty(keyword)) {
|
||||||
example.createCriteria().andTitleLike("%" + keyword + "%");
|
example.createCriteria().andTitleLike("%" + keyword + "%");
|
||||||
}
|
}
|
||||||
return flashPromotionMapper.selectByExample(example);
|
return flashPromotionMapper.selectByExample(example);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.macro.mall.service.impl;
|
package com.macro.mall.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.macro.mall.mapper.SmsHomeAdvertiseMapper;
|
import com.macro.mall.mapper.SmsHomeAdvertiseMapper;
|
||||||
import com.macro.mall.model.SmsHomeAdvertise;
|
import com.macro.mall.model.SmsHomeAdvertise;
|
||||||
@@ -61,13 +62,13 @@ public class SmsHomeAdvertiseServiceImpl implements SmsHomeAdvertiseService {
|
|||||||
PageHelper.startPage(pageNum, pageSize);
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
SmsHomeAdvertiseExample example = new SmsHomeAdvertiseExample();
|
SmsHomeAdvertiseExample example = new SmsHomeAdvertiseExample();
|
||||||
SmsHomeAdvertiseExample.Criteria criteria = example.createCriteria();
|
SmsHomeAdvertiseExample.Criteria criteria = example.createCriteria();
|
||||||
if (!StringUtils.isEmpty(name)) {
|
if (!StrUtil.isEmpty(name)) {
|
||||||
criteria.andNameLike("%" + name + "%");
|
criteria.andNameLike("%" + name + "%");
|
||||||
}
|
}
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
criteria.andTypeEqualTo(type);
|
criteria.andTypeEqualTo(type);
|
||||||
}
|
}
|
||||||
if (!StringUtils.isEmpty(endTime)) {
|
if (!StrUtil.isEmpty(endTime)) {
|
||||||
String startStr = endTime + " 00:00:00";
|
String startStr = endTime + " 00:00:00";
|
||||||
String endStr = endTime + " 23:59:59";
|
String endStr = endTime + " 23:59:59";
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.macro.mall.service.impl;
|
package com.macro.mall.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.macro.mall.mapper.SmsHomeBrandMapper;
|
import com.macro.mall.mapper.SmsHomeBrandMapper;
|
||||||
import com.macro.mall.model.SmsHomeBrand;
|
import com.macro.mall.model.SmsHomeBrand;
|
||||||
@@ -58,7 +59,7 @@ public class SmsHomeBrandServiceImpl implements SmsHomeBrandService {
|
|||||||
PageHelper.startPage(pageNum,pageSize);
|
PageHelper.startPage(pageNum,pageSize);
|
||||||
SmsHomeBrandExample example = new SmsHomeBrandExample();
|
SmsHomeBrandExample example = new SmsHomeBrandExample();
|
||||||
SmsHomeBrandExample.Criteria criteria = example.createCriteria();
|
SmsHomeBrandExample.Criteria criteria = example.createCriteria();
|
||||||
if(!StringUtils.isEmpty(brandName)){
|
if(!StrUtil.isEmpty(brandName)){
|
||||||
criteria.andBrandNameLike("%"+brandName+"%");
|
criteria.andBrandNameLike("%"+brandName+"%");
|
||||||
}
|
}
|
||||||
if(recommendStatus!=null){
|
if(recommendStatus!=null){
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.macro.mall.service.impl;
|
package com.macro.mall.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.macro.mall.mapper.SmsHomeNewProductMapper;
|
import com.macro.mall.mapper.SmsHomeNewProductMapper;
|
||||||
import com.macro.mall.model.SmsHomeNewProduct;
|
import com.macro.mall.model.SmsHomeNewProduct;
|
||||||
@@ -58,7 +59,7 @@ public class SmsHomeNewProductServiceImpl implements SmsHomeNewProductService {
|
|||||||
PageHelper.startPage(pageNum,pageSize);
|
PageHelper.startPage(pageNum,pageSize);
|
||||||
SmsHomeNewProductExample example = new SmsHomeNewProductExample();
|
SmsHomeNewProductExample example = new SmsHomeNewProductExample();
|
||||||
SmsHomeNewProductExample.Criteria criteria = example.createCriteria();
|
SmsHomeNewProductExample.Criteria criteria = example.createCriteria();
|
||||||
if(!StringUtils.isEmpty(productName)){
|
if(!StrUtil.isEmpty(productName)){
|
||||||
criteria.andProductNameLike("%"+productName+"%");
|
criteria.andProductNameLike("%"+productName+"%");
|
||||||
}
|
}
|
||||||
if(recommendStatus!=null){
|
if(recommendStatus!=null){
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.macro.mall.service.impl;
|
package com.macro.mall.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.macro.mall.mapper.SmsHomeRecommendProductMapper;
|
import com.macro.mall.mapper.SmsHomeRecommendProductMapper;
|
||||||
import com.macro.mall.model.SmsHomeRecommendProduct;
|
import com.macro.mall.model.SmsHomeRecommendProduct;
|
||||||
@@ -58,7 +59,7 @@ public class SmsHomeRecommendProductServiceImpl implements SmsHomeRecommendProdu
|
|||||||
PageHelper.startPage(pageNum,pageSize);
|
PageHelper.startPage(pageNum,pageSize);
|
||||||
SmsHomeRecommendProductExample example = new SmsHomeRecommendProductExample();
|
SmsHomeRecommendProductExample example = new SmsHomeRecommendProductExample();
|
||||||
SmsHomeRecommendProductExample.Criteria criteria = example.createCriteria();
|
SmsHomeRecommendProductExample.Criteria criteria = example.createCriteria();
|
||||||
if(!StringUtils.isEmpty(productName)){
|
if(!StrUtil.isEmpty(productName)){
|
||||||
criteria.andProductNameLike("%"+productName+"%");
|
criteria.andProductNameLike("%"+productName+"%");
|
||||||
}
|
}
|
||||||
if(recommendStatus!=null){
|
if(recommendStatus!=null){
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.macro.mall.service.impl;
|
package com.macro.mall.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.macro.mall.mapper.SmsHomeRecommendSubjectMapper;
|
import com.macro.mall.mapper.SmsHomeRecommendSubjectMapper;
|
||||||
import com.macro.mall.model.SmsHomeRecommendSubject;
|
import com.macro.mall.model.SmsHomeRecommendSubject;
|
||||||
@@ -58,7 +59,7 @@ public class SmsHomeRecommendSubjectServiceImpl implements SmsHomeRecommendSubje
|
|||||||
PageHelper.startPage(pageNum,pageSize);
|
PageHelper.startPage(pageNum,pageSize);
|
||||||
SmsHomeRecommendSubjectExample example = new SmsHomeRecommendSubjectExample();
|
SmsHomeRecommendSubjectExample example = new SmsHomeRecommendSubjectExample();
|
||||||
SmsHomeRecommendSubjectExample.Criteria criteria = example.createCriteria();
|
SmsHomeRecommendSubjectExample.Criteria criteria = example.createCriteria();
|
||||||
if(!StringUtils.isEmpty(subjectName)){
|
if(!StrUtil.isEmpty(subjectName)){
|
||||||
criteria.andSubjectNameLike("%"+subjectName+"%");
|
criteria.andSubjectNameLike("%"+subjectName+"%");
|
||||||
}
|
}
|
||||||
if(recommendStatus!=null){
|
if(recommendStatus!=null){
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.macro.mall.mapper.UmsAdminMapper;
|
|||||||
import com.macro.mall.mapper.UmsAdminRoleRelationMapper;
|
import com.macro.mall.mapper.UmsAdminRoleRelationMapper;
|
||||||
import com.macro.mall.model.*;
|
import com.macro.mall.model.*;
|
||||||
import com.macro.mall.security.util.JwtTokenUtil;
|
import com.macro.mall.security.util.JwtTokenUtil;
|
||||||
|
import com.macro.mall.security.util.SpringUtil;
|
||||||
import com.macro.mall.service.UmsAdminCacheService;
|
import com.macro.mall.service.UmsAdminCacheService;
|
||||||
import com.macro.mall.service.UmsAdminService;
|
import com.macro.mall.service.UmsAdminService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -56,19 +57,17 @@ public class UmsAdminServiceImpl implements UmsAdminService {
|
|||||||
private UmsAdminRoleRelationDao adminRoleRelationDao;
|
private UmsAdminRoleRelationDao adminRoleRelationDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private UmsAdminLoginLogMapper loginLogMapper;
|
private UmsAdminLoginLogMapper loginLogMapper;
|
||||||
@Autowired
|
|
||||||
private UmsAdminCacheService adminCacheService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UmsAdmin getAdminByUsername(String username) {
|
public UmsAdmin getAdminByUsername(String username) {
|
||||||
UmsAdmin admin = adminCacheService.getAdmin(username);
|
UmsAdmin admin = getCacheService().getAdmin(username);
|
||||||
if(admin!=null) return admin;
|
if(admin!=null) return admin;
|
||||||
UmsAdminExample example = new UmsAdminExample();
|
UmsAdminExample example = new UmsAdminExample();
|
||||||
example.createCriteria().andUsernameEqualTo(username);
|
example.createCriteria().andUsernameEqualTo(username);
|
||||||
List<UmsAdmin> adminList = adminMapper.selectByExample(example);
|
List<UmsAdmin> adminList = adminMapper.selectByExample(example);
|
||||||
if (adminList != null && adminList.size() > 0) {
|
if (adminList != null && adminList.size() > 0) {
|
||||||
admin = adminList.get(0);
|
admin = adminList.get(0);
|
||||||
adminCacheService.setAdmin(admin);
|
getCacheService().setAdmin(admin);
|
||||||
return admin;
|
return admin;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -159,7 +158,7 @@ public class UmsAdminServiceImpl implements UmsAdminService {
|
|||||||
PageHelper.startPage(pageNum, pageSize);
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
UmsAdminExample example = new UmsAdminExample();
|
UmsAdminExample example = new UmsAdminExample();
|
||||||
UmsAdminExample.Criteria criteria = example.createCriteria();
|
UmsAdminExample.Criteria criteria = example.createCriteria();
|
||||||
if (!StringUtils.isEmpty(keyword)) {
|
if (!StrUtil.isEmpty(keyword)) {
|
||||||
criteria.andUsernameLike("%" + keyword + "%");
|
criteria.andUsernameLike("%" + keyword + "%");
|
||||||
example.or(example.createCriteria().andNickNameLike("%" + keyword + "%"));
|
example.or(example.createCriteria().andNickNameLike("%" + keyword + "%"));
|
||||||
}
|
}
|
||||||
@@ -182,15 +181,15 @@ public class UmsAdminServiceImpl implements UmsAdminService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
int count = adminMapper.updateByPrimaryKeySelective(admin);
|
int count = adminMapper.updateByPrimaryKeySelective(admin);
|
||||||
adminCacheService.delAdmin(id);
|
getCacheService().delAdmin(id);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int delete(Long id) {
|
public int delete(Long id) {
|
||||||
adminCacheService.delAdmin(id);
|
getCacheService().delAdmin(id);
|
||||||
int count = adminMapper.deleteByPrimaryKey(id);
|
int count = adminMapper.deleteByPrimaryKey(id);
|
||||||
adminCacheService.delResourceList(id);
|
getCacheService().delResourceList(id);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,7 +211,7 @@ public class UmsAdminServiceImpl implements UmsAdminService {
|
|||||||
}
|
}
|
||||||
adminRoleRelationDao.insertList(list);
|
adminRoleRelationDao.insertList(list);
|
||||||
}
|
}
|
||||||
adminCacheService.delResourceList(adminId);
|
getCacheService().delResourceList(adminId);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,13 +222,13 @@ public class UmsAdminServiceImpl implements UmsAdminService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<UmsResource> getResourceList(Long adminId) {
|
public List<UmsResource> getResourceList(Long adminId) {
|
||||||
List<UmsResource> resourceList = adminCacheService.getResourceList(adminId);
|
List<UmsResource> resourceList = getCacheService().getResourceList(adminId);
|
||||||
if(CollUtil.isNotEmpty(resourceList)){
|
if(CollUtil.isNotEmpty(resourceList)){
|
||||||
return resourceList;
|
return resourceList;
|
||||||
}
|
}
|
||||||
resourceList = adminRoleRelationDao.getResourceList(adminId);
|
resourceList = adminRoleRelationDao.getResourceList(adminId);
|
||||||
if(CollUtil.isNotEmpty(resourceList)){
|
if(CollUtil.isNotEmpty(resourceList)){
|
||||||
adminCacheService.setResourceList(adminId,resourceList);
|
getCacheService().setResourceList(adminId,resourceList);
|
||||||
}
|
}
|
||||||
return resourceList;
|
return resourceList;
|
||||||
}
|
}
|
||||||
@@ -253,7 +252,7 @@ public class UmsAdminServiceImpl implements UmsAdminService {
|
|||||||
}
|
}
|
||||||
umsAdmin.setPassword(passwordEncoder.encode(param.getNewPassword()));
|
umsAdmin.setPassword(passwordEncoder.encode(param.getNewPassword()));
|
||||||
adminMapper.updateByPrimaryKey(umsAdmin);
|
adminMapper.updateByPrimaryKey(umsAdmin);
|
||||||
adminCacheService.delAdmin(umsAdmin.getId());
|
getCacheService().delAdmin(umsAdmin.getId());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,4 +266,9 @@ public class UmsAdminServiceImpl implements UmsAdminService {
|
|||||||
}
|
}
|
||||||
throw new UsernameNotFoundException("用户名或密码错误");
|
throw new UsernameNotFoundException("用户名或密码错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UmsAdminCacheService getCacheService() {
|
||||||
|
return SpringUtil.getBean(UmsAdminCacheService.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.macro.mall.service.impl;
|
package com.macro.mall.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.macro.mall.dao.UmsRoleDao;
|
import com.macro.mall.dao.UmsRoleDao;
|
||||||
import com.macro.mall.mapper.UmsRoleMapper;
|
import com.macro.mall.mapper.UmsRoleMapper;
|
||||||
@@ -63,7 +64,7 @@ public class UmsRoleServiceImpl implements UmsRoleService {
|
|||||||
public List<UmsRole> list(String keyword, Integer pageSize, Integer pageNum) {
|
public List<UmsRole> list(String keyword, Integer pageSize, Integer pageNum) {
|
||||||
PageHelper.startPage(pageNum, pageSize);
|
PageHelper.startPage(pageNum, pageSize);
|
||||||
UmsRoleExample example = new UmsRoleExample();
|
UmsRoleExample example = new UmsRoleExample();
|
||||||
if (!StringUtils.isEmpty(keyword)) {
|
if (!StrUtil.isEmpty(keyword)) {
|
||||||
example.createCriteria().andNameLike("%" + keyword + "%");
|
example.createCriteria().andNameLike("%" + keyword + "%");
|
||||||
}
|
}
|
||||||
return roleMapper.selectByExample(example);
|
return roleMapper.selectByExample(example);
|
||||||
|
|||||||
Reference in New Issue
Block a user