Commit a5c2aff4 authored by Junling Bu's avatar Junling Bu
Browse files

chore[后端服务]: 后端服务代码基于IDEA的reformat code工具格式化代码,但是mybatis generator生成的代码除外。

parent 556f269d
package org.linlinjava.litemall.db.service; package org.linlinjava.litemall.db.service;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import org.linlinjava.litemall.db.domain.LitemallBrandExample;
import org.linlinjava.litemall.db.dao.LitemallBrandMapper; import org.linlinjava.litemall.db.dao.LitemallBrandMapper;
import org.linlinjava.litemall.db.domain.LitemallBrand.Column;
import org.linlinjava.litemall.db.domain.LitemallBrand; import org.linlinjava.litemall.db.domain.LitemallBrand;
import org.linlinjava.litemall.db.domain.LitemallBrand.Column;
import org.linlinjava.litemall.db.domain.LitemallBrandExample;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
......
...@@ -77,10 +77,10 @@ public class LitemallCartService { ...@@ -77,10 +77,10 @@ public class LitemallCartService {
LitemallCartExample example = new LitemallCartExample(); LitemallCartExample example = new LitemallCartExample();
LitemallCartExample.Criteria criteria = example.createCriteria(); LitemallCartExample.Criteria criteria = example.createCriteria();
if(!StringUtils.isEmpty(userId)){ if (!StringUtils.isEmpty(userId)) {
criteria.andUserIdEqualTo(userId); criteria.andUserIdEqualTo(userId);
} }
if(!StringUtils.isEmpty(goodsId)){ if (!StringUtils.isEmpty(goodsId)) {
criteria.andGoodsIdEqualTo(goodsId); criteria.andGoodsIdEqualTo(goodsId);
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
...@@ -97,15 +97,15 @@ public class LitemallCartService { ...@@ -97,15 +97,15 @@ public class LitemallCartService {
LitemallCartExample example = new LitemallCartExample(); LitemallCartExample example = new LitemallCartExample();
LitemallCartExample.Criteria criteria = example.createCriteria(); LitemallCartExample.Criteria criteria = example.createCriteria();
if(userId != null){ if (userId != null) {
criteria.andUserIdEqualTo(userId); criteria.andUserIdEqualTo(userId);
} }
if(goodsId != null){ if (goodsId != null) {
criteria.andGoodsIdEqualTo(goodsId); criteria.andGoodsIdEqualTo(goodsId);
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
return (int)cartMapper.countByExample(example); return (int) cartMapper.countByExample(example);
} }
public void deleteById(Integer id) { public void deleteById(Integer id) {
......
...@@ -15,6 +15,7 @@ import java.util.List; ...@@ -15,6 +15,7 @@ import java.util.List;
public class LitemallCategoryService { public class LitemallCategoryService {
@Resource @Resource
private LitemallCategoryMapper categoryMapper; private LitemallCategoryMapper categoryMapper;
private LitemallCategory.Column[] CHANNEL = {LitemallCategory.Column.id, LitemallCategory.Column.name, LitemallCategory.Column.iconUrl};
public List<LitemallCategory> queryL1WithoutRecommend(int offset, int limit) { public List<LitemallCategory> queryL1WithoutRecommend(int offset, int limit) {
LitemallCategoryExample example = new LitemallCategoryExample(); LitemallCategoryExample example = new LitemallCategoryExample();
...@@ -56,10 +57,10 @@ public class LitemallCategoryService { ...@@ -56,10 +57,10 @@ public class LitemallCategoryService {
LitemallCategoryExample example = new LitemallCategoryExample(); LitemallCategoryExample example = new LitemallCategoryExample();
LitemallCategoryExample.Criteria criteria = example.createCriteria(); LitemallCategoryExample.Criteria criteria = example.createCriteria();
if(!StringUtils.isEmpty(id)){ if (!StringUtils.isEmpty(id)) {
criteria.andIdEqualTo(Integer.valueOf(id)); criteria.andIdEqualTo(Integer.valueOf(id));
} }
if(!StringUtils.isEmpty(name)){ if (!StringUtils.isEmpty(name)) {
criteria.andNameLike("%" + name + "%"); criteria.andNameLike("%" + name + "%");
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
...@@ -76,15 +77,15 @@ public class LitemallCategoryService { ...@@ -76,15 +77,15 @@ public class LitemallCategoryService {
LitemallCategoryExample example = new LitemallCategoryExample(); LitemallCategoryExample example = new LitemallCategoryExample();
LitemallCategoryExample.Criteria criteria = example.createCriteria(); LitemallCategoryExample.Criteria criteria = example.createCriteria();
if(!StringUtils.isEmpty(id)){ if (!StringUtils.isEmpty(id)) {
criteria.andIdEqualTo(Integer.valueOf(id)); criteria.andIdEqualTo(Integer.valueOf(id));
} }
if(!StringUtils.isEmpty(name)){ if (!StringUtils.isEmpty(name)) {
criteria.andNameLike("%" + name + "%"); criteria.andNameLike("%" + name + "%");
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
return (int)categoryMapper.countByExample(example); return (int) categoryMapper.countByExample(example);
} }
public int updateById(LitemallCategory category) { public int updateById(LitemallCategory category) {
...@@ -102,7 +103,6 @@ public class LitemallCategoryService { ...@@ -102,7 +103,6 @@ public class LitemallCategoryService {
categoryMapper.insertSelective(category); categoryMapper.insertSelective(category);
} }
private LitemallCategory.Column[] CHANNEL = {LitemallCategory.Column.id, LitemallCategory.Column.name, LitemallCategory.Column.iconUrl};
public List<LitemallCategory> queryChannel() { public List<LitemallCategory> queryChannel() {
LitemallCategoryExample example = new LitemallCategoryExample(); LitemallCategoryExample example = new LitemallCategoryExample();
example.or().andLevelEqualTo("L1").andDeletedEqualTo(false); example.or().andLevelEqualTo("L1").andDeletedEqualTo(false);
......
package org.linlinjava.litemall.db.service; package org.linlinjava.litemall.db.service;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import org.linlinjava.litemall.db.domain.LitemallCollect;
import org.linlinjava.litemall.db.dao.LitemallCollectMapper; import org.linlinjava.litemall.db.dao.LitemallCollectMapper;
import org.linlinjava.litemall.db.domain.LitemallCollect;
import org.linlinjava.litemall.db.domain.LitemallCollectExample; import org.linlinjava.litemall.db.domain.LitemallCollectExample;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -19,7 +19,7 @@ public class LitemallCollectService { ...@@ -19,7 +19,7 @@ public class LitemallCollectService {
public int count(int uid, Integer gid) { public int count(int uid, Integer gid) {
LitemallCollectExample example = new LitemallCollectExample(); LitemallCollectExample example = new LitemallCollectExample();
example.or().andUserIdEqualTo(uid).andValueIdEqualTo(gid).andDeletedEqualTo(false); example.or().andUserIdEqualTo(uid).andValueIdEqualTo(gid).andDeletedEqualTo(false);
return (int)collectMapper.countByExample(example); return (int) collectMapper.countByExample(example);
} }
public List<LitemallCollect> queryByType(Integer userId, Byte type, Integer page, Integer size) { public List<LitemallCollect> queryByType(Integer userId, Byte type, Integer page, Integer size) {
...@@ -33,7 +33,7 @@ public class LitemallCollectService { ...@@ -33,7 +33,7 @@ public class LitemallCollectService {
public int countByType(Integer userId, Byte type) { public int countByType(Integer userId, Byte type) {
LitemallCollectExample example = new LitemallCollectExample(); LitemallCollectExample example = new LitemallCollectExample();
example.or().andUserIdEqualTo(userId).andTypeEqualTo(type).andDeletedEqualTo(false); example.or().andUserIdEqualTo(userId).andTypeEqualTo(type).andDeletedEqualTo(false);
return (int)collectMapper.countByExample(example); return (int) collectMapper.countByExample(example);
} }
public LitemallCollect queryByTypeAndValue(Integer userId, Byte type, Integer valueId) { public LitemallCollect queryByTypeAndValue(Integer userId, Byte type, Integer valueId) {
...@@ -56,10 +56,10 @@ public class LitemallCollectService { ...@@ -56,10 +56,10 @@ public class LitemallCollectService {
LitemallCollectExample example = new LitemallCollectExample(); LitemallCollectExample example = new LitemallCollectExample();
LitemallCollectExample.Criteria criteria = example.createCriteria(); LitemallCollectExample.Criteria criteria = example.createCriteria();
if(!StringUtils.isEmpty(userId)){ if (!StringUtils.isEmpty(userId)) {
criteria.andUserIdEqualTo(Integer.valueOf(userId)); criteria.andUserIdEqualTo(Integer.valueOf(userId));
} }
if(!StringUtils.isEmpty(valueId)){ if (!StringUtils.isEmpty(valueId)) {
criteria.andValueIdEqualTo(Integer.valueOf(valueId)); criteria.andValueIdEqualTo(Integer.valueOf(valueId));
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
...@@ -76,14 +76,14 @@ public class LitemallCollectService { ...@@ -76,14 +76,14 @@ public class LitemallCollectService {
LitemallCollectExample example = new LitemallCollectExample(); LitemallCollectExample example = new LitemallCollectExample();
LitemallCollectExample.Criteria criteria = example.createCriteria(); LitemallCollectExample.Criteria criteria = example.createCriteria();
if(!StringUtils.isEmpty(userId)){ if (!StringUtils.isEmpty(userId)) {
criteria.andUserIdEqualTo(Integer.valueOf(userId)); criteria.andUserIdEqualTo(Integer.valueOf(userId));
} }
if(!StringUtils.isEmpty(valueId)){ if (!StringUtils.isEmpty(valueId)) {
criteria.andValueIdEqualTo(Integer.valueOf(valueId)); criteria.andValueIdEqualTo(Integer.valueOf(valueId));
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
return (int)collectMapper.countByExample(example); return (int) collectMapper.countByExample(example);
} }
} }
...@@ -5,7 +5,6 @@ import org.linlinjava.litemall.db.dao.LitemallCommentMapper; ...@@ -5,7 +5,6 @@ import org.linlinjava.litemall.db.dao.LitemallCommentMapper;
import org.linlinjava.litemall.db.domain.LitemallComment; import org.linlinjava.litemall.db.domain.LitemallComment;
import org.linlinjava.litemall.db.domain.LitemallCommentExample; import org.linlinjava.litemall.db.domain.LitemallCommentExample;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -20,45 +19,41 @@ public class LitemallCommentService { ...@@ -20,45 +19,41 @@ public class LitemallCommentService {
public List<LitemallComment> queryGoodsByGid(Integer id, int offset, int limit) { public List<LitemallComment> queryGoodsByGid(Integer id, int offset, int limit) {
LitemallCommentExample example = new LitemallCommentExample(); LitemallCommentExample example = new LitemallCommentExample();
example.setOrderByClause(LitemallComment.Column.addTime.desc()); example.setOrderByClause(LitemallComment.Column.addTime.desc());
example.or().andValueIdEqualTo(id).andTypeEqualTo((byte)0).andDeletedEqualTo(false); example.or().andValueIdEqualTo(id).andTypeEqualTo((byte) 0).andDeletedEqualTo(false);
PageHelper.startPage(offset, limit); PageHelper.startPage(offset, limit);
return commentMapper.selectByExample(example); return commentMapper.selectByExample(example);
} }
public int countGoodsByGid(Integer id, int offset, int limit) { public int countGoodsByGid(Integer id, int offset, int limit) {
LitemallCommentExample example = new LitemallCommentExample(); LitemallCommentExample example = new LitemallCommentExample();
example.or().andValueIdEqualTo(id).andTypeEqualTo((byte)0).andDeletedEqualTo(false); example.or().andValueIdEqualTo(id).andTypeEqualTo((byte) 0).andDeletedEqualTo(false);
return (int)commentMapper.countByExample(example); return (int) commentMapper.countByExample(example);
} }
public List<LitemallComment> query(Byte type, Integer valueId, Integer showType, Integer offset, Integer limit) { public List<LitemallComment> query(Byte type, Integer valueId, Integer showType, Integer offset, Integer limit) {
LitemallCommentExample example = new LitemallCommentExample(); LitemallCommentExample example = new LitemallCommentExample();
example.setOrderByClause(LitemallComment.Column.addTime.desc()); example.setOrderByClause(LitemallComment.Column.addTime.desc());
if(showType == 0) { if (showType == 0) {
example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andDeletedEqualTo(false); example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andDeletedEqualTo(false);
} } else if (showType == 1) {
else if(showType == 1){
example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andHasPictureEqualTo(true).andDeletedEqualTo(false); example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andHasPictureEqualTo(true).andDeletedEqualTo(false);
} } else {
else{
throw new RuntimeException("showType不支持"); throw new RuntimeException("showType不支持");
} }
PageHelper.startPage(offset, limit); PageHelper.startPage(offset, limit);
return commentMapper.selectByExample(example); return commentMapper.selectByExample(example);
} }
public int count(Byte type, Integer valueId, Integer showType, Integer offset, Integer size){ public int count(Byte type, Integer valueId, Integer showType, Integer offset, Integer size) {
LitemallCommentExample example = new LitemallCommentExample(); LitemallCommentExample example = new LitemallCommentExample();
if(showType == 0) { if (showType == 0) {
example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andDeletedEqualTo(false); example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andDeletedEqualTo(false);
} } else if (showType == 1) {
else if(showType == 1){
example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andHasPictureEqualTo(true).andDeletedEqualTo(false); example.or().andValueIdEqualTo(valueId).andTypeEqualTo(type).andHasPictureEqualTo(true).andDeletedEqualTo(false);
} } else {
else{
throw new RuntimeException("showType不支持"); throw new RuntimeException("showType不支持");
} }
return (int)commentMapper.countByExample(example); return (int) commentMapper.countByExample(example);
} }
public int save(LitemallComment comment) { public int save(LitemallComment comment) {
...@@ -72,13 +67,13 @@ public class LitemallCommentService { ...@@ -72,13 +67,13 @@ public class LitemallCommentService {
LitemallCommentExample.Criteria criteria = example.createCriteria(); LitemallCommentExample.Criteria criteria = example.createCriteria();
// type=2 是订单商品回复,这里过滤 // type=2 是订单商品回复,这里过滤
criteria.andTypeNotEqualTo((byte)2); criteria.andTypeNotEqualTo((byte) 2);
if(!StringUtils.isEmpty(userId)){ if (!StringUtils.isEmpty(userId)) {
criteria.andUserIdEqualTo(Integer.valueOf(userId)); criteria.andUserIdEqualTo(Integer.valueOf(userId));
} }
if(!StringUtils.isEmpty(valueId)){ if (!StringUtils.isEmpty(valueId)) {
criteria.andValueIdEqualTo(Integer.valueOf(valueId)).andTypeEqualTo((byte)0); criteria.andValueIdEqualTo(Integer.valueOf(valueId)).andTypeEqualTo((byte) 0);
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
...@@ -94,15 +89,15 @@ public class LitemallCommentService { ...@@ -94,15 +89,15 @@ public class LitemallCommentService {
LitemallCommentExample example = new LitemallCommentExample(); LitemallCommentExample example = new LitemallCommentExample();
LitemallCommentExample.Criteria criteria = example.createCriteria(); LitemallCommentExample.Criteria criteria = example.createCriteria();
if(!StringUtils.isEmpty(userId)){ if (!StringUtils.isEmpty(userId)) {
criteria.andUserIdEqualTo(Integer.valueOf(userId)); criteria.andUserIdEqualTo(Integer.valueOf(userId));
} }
if(!StringUtils.isEmpty(valueId)){ if (!StringUtils.isEmpty(valueId)) {
criteria.andValueIdEqualTo(Integer.valueOf(valueId)).andTypeEqualTo((byte)0); criteria.andValueIdEqualTo(Integer.valueOf(valueId)).andTypeEqualTo((byte) 0);
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
return (int)commentMapper.countByExample(example); return (int) commentMapper.countByExample(example);
} }
public void deleteById(Integer id) { public void deleteById(Integer id) {
...@@ -111,10 +106,10 @@ public class LitemallCommentService { ...@@ -111,10 +106,10 @@ public class LitemallCommentService {
public String queryReply(Integer id) { public String queryReply(Integer id) {
LitemallCommentExample example = new LitemallCommentExample(); LitemallCommentExample example = new LitemallCommentExample();
example.or().andTypeEqualTo((byte)2).andValueIdEqualTo(id); example.or().andTypeEqualTo((byte) 2).andValueIdEqualTo(id);
List<LitemallComment> commentReply = commentMapper.selectByExampleSelective(example, LitemallComment.Column.content); List<LitemallComment> commentReply = commentMapper.selectByExampleSelective(example, LitemallComment.Column.content);
// 目前业务只支持回复一次 // 目前业务只支持回复一次
if(commentReply.size() == 1){ if (commentReply.size() == 1) {
return commentReply.get(0).getContent(); return commentReply.get(0).getContent();
} }
return null; return null;
......
...@@ -30,10 +30,10 @@ public class LitemallFeedbackService { ...@@ -30,10 +30,10 @@ public class LitemallFeedbackService {
LitemallFeedbackExample example = new LitemallFeedbackExample(); LitemallFeedbackExample example = new LitemallFeedbackExample();
LitemallFeedbackExample.Criteria criteria = example.createCriteria(); LitemallFeedbackExample.Criteria criteria = example.createCriteria();
if(userId != null){ if (userId != null) {
criteria.andUserIdEqualTo(userId); criteria.andUserIdEqualTo(userId);
} }
if(!StringUtils.isEmpty(username)){ if (!StringUtils.isEmpty(username)) {
criteria.andUsernameLike("%" + username + "%"); criteria.andUsernameLike("%" + username + "%");
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
...@@ -50,13 +50,13 @@ public class LitemallFeedbackService { ...@@ -50,13 +50,13 @@ public class LitemallFeedbackService {
LitemallFeedbackExample example = new LitemallFeedbackExample(); LitemallFeedbackExample example = new LitemallFeedbackExample();
LitemallFeedbackExample.Criteria criteria = example.createCriteria(); LitemallFeedbackExample.Criteria criteria = example.createCriteria();
if(userId != null){ if (userId != null) {
criteria.andUserIdEqualTo(userId); criteria.andUserIdEqualTo(userId);
} }
if(!StringUtils.isEmpty(username)){ if (!StringUtils.isEmpty(username)) {
criteria.andUsernameLike("%" + username + "%"); criteria.andUsernameLike("%" + username + "%");
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
return (int)feedbackMapper.countByExample(example); return (int) feedbackMapper.countByExample(example);
} }
} }
...@@ -24,17 +24,17 @@ public class LitemallFootprintService { ...@@ -24,17 +24,17 @@ public class LitemallFootprintService {
return footprintMapper.selectByExample(example); return footprintMapper.selectByExample(example);
} }
public int countByAddTime(Integer userId,Integer page, Integer size) { public int countByAddTime(Integer userId, Integer page, Integer size) {
LitemallFootprintExample example = new LitemallFootprintExample(); LitemallFootprintExample example = new LitemallFootprintExample();
example.or().andUserIdEqualTo(userId).andDeletedEqualTo(false); example.or().andUserIdEqualTo(userId).andDeletedEqualTo(false);
return (int)footprintMapper.countByExample(example); return (int) footprintMapper.countByExample(example);
} }
public LitemallFootprint findById(Integer id) { public LitemallFootprint findById(Integer id) {
return footprintMapper.selectByPrimaryKey(id); return footprintMapper.selectByPrimaryKey(id);
} }
public void deleteById(Integer id){ public void deleteById(Integer id) {
footprintMapper.logicalDeleteByPrimaryKey(id); footprintMapper.logicalDeleteByPrimaryKey(id);
} }
...@@ -48,10 +48,10 @@ public class LitemallFootprintService { ...@@ -48,10 +48,10 @@ public class LitemallFootprintService {
LitemallFootprintExample example = new LitemallFootprintExample(); LitemallFootprintExample example = new LitemallFootprintExample();
LitemallFootprintExample.Criteria criteria = example.createCriteria(); LitemallFootprintExample.Criteria criteria = example.createCriteria();
if(!StringUtils.isEmpty(userId)){ if (!StringUtils.isEmpty(userId)) {
criteria.andUserIdEqualTo(Integer.valueOf(userId)); criteria.andUserIdEqualTo(Integer.valueOf(userId));
} }
if(!StringUtils.isEmpty(goodsId)){ if (!StringUtils.isEmpty(goodsId)) {
criteria.andGoodsIdEqualTo(Integer.valueOf(goodsId)); criteria.andGoodsIdEqualTo(Integer.valueOf(goodsId));
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
...@@ -68,14 +68,14 @@ public class LitemallFootprintService { ...@@ -68,14 +68,14 @@ public class LitemallFootprintService {
LitemallFootprintExample example = new LitemallFootprintExample(); LitemallFootprintExample example = new LitemallFootprintExample();
LitemallFootprintExample.Criteria criteria = example.createCriteria(); LitemallFootprintExample.Criteria criteria = example.createCriteria();
if(!StringUtils.isEmpty(userId)){ if (!StringUtils.isEmpty(userId)) {
criteria.andUserIdEqualTo(Integer.valueOf(userId)); criteria.andUserIdEqualTo(Integer.valueOf(userId));
} }
if(!StringUtils.isEmpty(goodsId)){ if (!StringUtils.isEmpty(goodsId)) {
criteria.andGoodsIdEqualTo(Integer.valueOf(goodsId)); criteria.andGoodsIdEqualTo(Integer.valueOf(goodsId));
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
return (int)footprintMapper.countByExample(example); return (int) footprintMapper.countByExample(example);
} }
} }
package org.linlinjava.litemall.db.service; package org.linlinjava.litemall.db.service;
import com.github.pagehelper.PageHelper;
import org.linlinjava.litemall.db.dao.LitemallGoodsAttributeMapper; import org.linlinjava.litemall.db.dao.LitemallGoodsAttributeMapper;
import org.linlinjava.litemall.db.domain.LitemallGoodsAttribute; import org.linlinjava.litemall.db.domain.LitemallGoodsAttribute;
import org.linlinjava.litemall.db.domain.LitemallGoodsAttributeExample; import org.linlinjava.litemall.db.domain.LitemallGoodsAttributeExample;
......
...@@ -42,7 +42,7 @@ public class LitemallGoodsProductService { ...@@ -42,7 +42,7 @@ public class LitemallGoodsProductService {
public int count() { public int count() {
LitemallGoodsProductExample example = new LitemallGoodsProductExample(); LitemallGoodsProductExample example = new LitemallGoodsProductExample();
example.or().andDeletedEqualTo(false); example.or().andDeletedEqualTo(false);
return (int)goodsProductMapper.countByExample(example); return (int) goodsProductMapper.countByExample(example);
} }
public void deleteByGid(Integer gid) { public void deleteByGid(Integer gid) {
......
package org.linlinjava.litemall.db.service; package org.linlinjava.litemall.db.service;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import org.linlinjava.litemall.db.dao.LitemallGoodsMapper;
import org.linlinjava.litemall.db.domain.LitemallGoods; import org.linlinjava.litemall.db.domain.LitemallGoods;
import org.linlinjava.litemall.db.domain.LitemallGoods.Column; import org.linlinjava.litemall.db.domain.LitemallGoods.Column;
import org.linlinjava.litemall.db.dao.LitemallGoodsMapper;
import org.linlinjava.litemall.db.domain.LitemallGoodsExample; import org.linlinjava.litemall.db.domain.LitemallGoodsExample;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -15,11 +15,10 @@ import java.util.List; ...@@ -15,11 +15,10 @@ import java.util.List;
@Service @Service
public class LitemallGoodsService { public class LitemallGoodsService {
Column[] columns = new Column[]{Column.id, Column.name, Column.brief, Column.picUrl, Column.isHot, Column.isNew, Column.counterPrice, Column.retailPrice};
@Resource @Resource
private LitemallGoodsMapper goodsMapper; private LitemallGoodsMapper goodsMapper;
Column[] columns = new Column[]{Column.id, Column.name, Column.brief, Column.picUrl, Column.isHot, Column.isNew, Column.counterPrice, Column.retailPrice};
/** /**
* 获取热卖商品 * 获取热卖商品
* *
......
package org.linlinjava.litemall.db.service; package org.linlinjava.litemall.db.service;
import com.github.pagehelper.PageHelper;
import org.linlinjava.litemall.db.dao.LitemallGoodsSpecificationMapper; import org.linlinjava.litemall.db.dao.LitemallGoodsSpecificationMapper;
import org.linlinjava.litemall.db.domain.LitemallGoodsSpecification; import org.linlinjava.litemall.db.domain.LitemallGoodsSpecification;
import org.linlinjava.litemall.db.domain.LitemallGoodsSpecificationExample; import org.linlinjava.litemall.db.domain.LitemallGoodsSpecificationExample;
...@@ -40,38 +39,17 @@ public class LitemallGoodsSpecificationService { ...@@ -40,38 +39,17 @@ public class LitemallGoodsSpecificationService {
goodsSpecificationMapper.insertSelective(goodsSpecification); goodsSpecificationMapper.insertSelective(goodsSpecification);
} }
private class VO {
private String name;
private List<LitemallGoodsSpecification> valueList;
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public List<LitemallGoodsSpecification> getValueList() {
return valueList;
}
public void setValueList(List<LitemallGoodsSpecification> valueList) {
this.valueList = valueList;
}
}
/** /**
* [ * [
* { * {
* name: '', * name: '',
* valueList: [ {}, {}] * valueList: [ {}, {}]
* }, * },
* { * {
* name: '', * name: '',
* valueList: [ {}, {}] * valueList: [ {}, {}]
* } * }
* ] * ]
* *
* @param id * @param id
* @return * @return
...@@ -82,10 +60,10 @@ public class LitemallGoodsSpecificationService { ...@@ -82,10 +60,10 @@ public class LitemallGoodsSpecificationService {
Map<String, VO> map = new HashMap<>(); Map<String, VO> map = new HashMap<>();
List<VO> specificationVoList = new ArrayList<>(); List<VO> specificationVoList = new ArrayList<>();
for(LitemallGoodsSpecification goodsSpecification : goodsSpecificationList){ for (LitemallGoodsSpecification goodsSpecification : goodsSpecificationList) {
String specification = goodsSpecification.getSpecification(); String specification = goodsSpecification.getSpecification();
VO goodsSpecificationVo = map.get(specification); VO goodsSpecificationVo = map.get(specification);
if(goodsSpecificationVo == null){ if (goodsSpecificationVo == null) {
goodsSpecificationVo = new VO(); goodsSpecificationVo = new VO();
goodsSpecificationVo.setName(specification); goodsSpecificationVo.setName(specification);
List<LitemallGoodsSpecification> valueList = new ArrayList<>(); List<LitemallGoodsSpecification> valueList = new ArrayList<>();
...@@ -93,8 +71,7 @@ public class LitemallGoodsSpecificationService { ...@@ -93,8 +71,7 @@ public class LitemallGoodsSpecificationService {
goodsSpecificationVo.setValueList(valueList); goodsSpecificationVo.setValueList(valueList);
map.put(specification, goodsSpecificationVo); map.put(specification, goodsSpecificationVo);
specificationVoList.add(goodsSpecificationVo); specificationVoList.add(goodsSpecificationVo);
} } else {
else{
List<LitemallGoodsSpecification> valueList = goodsSpecificationVo.getValueList(); List<LitemallGoodsSpecification> valueList = goodsSpecificationVo.getValueList();
valueList.add(goodsSpecification); valueList.add(goodsSpecification);
} }
...@@ -103,4 +80,25 @@ public class LitemallGoodsSpecificationService { ...@@ -103,4 +80,25 @@ public class LitemallGoodsSpecificationService {
return specificationVoList; return specificationVoList;
} }
private class VO {
private String name;
private List<LitemallGoodsSpecification> valueList;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<LitemallGoodsSpecification> getValueList() {
return valueList;
}
public void setValueList(List<LitemallGoodsSpecification> valueList) {
this.valueList = valueList;
}
}
} }
...@@ -22,6 +22,7 @@ public class LitemallGrouponRulesService { ...@@ -22,6 +22,7 @@ public class LitemallGrouponRulesService {
private LitemallGrouponRulesMapper mapper; private LitemallGrouponRulesMapper mapper;
@Resource @Resource
private LitemallGoodsMapper goodsMapper; private LitemallGoodsMapper goodsMapper;
private LitemallGoods.Column[] goodsColumns = new LitemallGoods.Column[]{LitemallGoods.Column.id, LitemallGoods.Column.name, LitemallGoods.Column.brief, LitemallGoods.Column.picUrl, LitemallGoods.Column.counterPrice, LitemallGoods.Column.retailPrice};
public int createRules(LitemallGrouponRules rules) { public int createRules(LitemallGrouponRules rules) {
rules.setAddTime(LocalDateTime.now()); rules.setAddTime(LocalDateTime.now());
...@@ -64,7 +65,6 @@ public class LitemallGrouponRulesService { ...@@ -64,7 +65,6 @@ public class LitemallGrouponRulesService {
return queryList(offset, limit, "add_time", "desc"); return queryList(offset, limit, "add_time", "desc");
} }
private LitemallGoods.Column[] goodsColumns = new LitemallGoods.Column[]{LitemallGoods.Column.id, LitemallGoods.Column.name, LitemallGoods.Column.brief, LitemallGoods.Column.picUrl, LitemallGoods.Column.counterPrice, LitemallGoods.Column.retailPrice};
public List<Map<String, Object>> queryList(int offset, int limit, String sort, String order) { public List<Map<String, Object>> queryList(int offset, int limit, String sort, String order) {
LitemallGrouponRulesExample example = new LitemallGrouponRulesExample(); LitemallGrouponRulesExample example = new LitemallGrouponRulesExample();
example.or().andDeletedEqualTo(false); example.or().andDeletedEqualTo(false);
...@@ -72,7 +72,7 @@ public class LitemallGrouponRulesService { ...@@ -72,7 +72,7 @@ public class LitemallGrouponRulesService {
PageHelper.startPage(offset, limit); PageHelper.startPage(offset, limit);
List<LitemallGrouponRules> grouponRules = mapper.selectByExample(example); List<LitemallGrouponRules> grouponRules = mapper.selectByExample(example);
List<Map<String, Object>> grouponList = new ArrayList<>(grouponRules.size()); List<Map<String, Object>> grouponList = new ArrayList<>(grouponRules.size());
for (LitemallGrouponRules rule : grouponRules) { for (LitemallGrouponRules rule : grouponRules) {
Integer goodsId = rule.getGoodsId(); Integer goodsId = rule.getGoodsId();
LitemallGoods goods = goodsMapper.selectByPrimaryKeySelective(goodsId, goodsColumns); LitemallGoods goods = goodsMapper.selectByPrimaryKeySelective(goodsId, goodsColumns);
...@@ -92,7 +92,7 @@ public class LitemallGrouponRulesService { ...@@ -92,7 +92,7 @@ public class LitemallGrouponRulesService {
public int countList(int offset, int limit, String sort, String order) { public int countList(int offset, int limit, String sort, String order) {
LitemallGrouponRulesExample example = new LitemallGrouponRulesExample(); LitemallGrouponRulesExample example = new LitemallGrouponRulesExample();
example.or().andDeletedEqualTo(false); example.or().andDeletedEqualTo(false);
return (int)mapper.countByExample(example); return (int) mapper.countByExample(example);
} }
/** /**
......
...@@ -3,15 +3,13 @@ package org.linlinjava.litemall.db.service; ...@@ -3,15 +3,13 @@ package org.linlinjava.litemall.db.service;
import com.alibaba.druid.util.StringUtils; import com.alibaba.druid.util.StringUtils;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import org.linlinjava.litemall.db.dao.LitemallGrouponMapper; import org.linlinjava.litemall.db.dao.LitemallGrouponMapper;
import org.linlinjava.litemall.db.domain.*; import org.linlinjava.litemall.db.domain.LitemallGroupon;
import org.linlinjava.litemall.db.domain.LitemallGrouponExample;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@Service @Service
public class LitemallGrouponService { public class LitemallGrouponService {
......
...@@ -36,8 +36,8 @@ public class LitemallIssueService { ...@@ -36,8 +36,8 @@ public class LitemallIssueService {
LitemallIssueExample example = new LitemallIssueExample(); LitemallIssueExample example = new LitemallIssueExample();
LitemallIssueExample.Criteria criteria = example.createCriteria(); LitemallIssueExample.Criteria criteria = example.createCriteria();
if(!StringUtils.isEmpty(question)){ if (!StringUtils.isEmpty(question)) {
criteria.andQuestionLike("%" + question + "%" ); criteria.andQuestionLike("%" + question + "%");
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
...@@ -53,12 +53,12 @@ public class LitemallIssueService { ...@@ -53,12 +53,12 @@ public class LitemallIssueService {
LitemallIssueExample example = new LitemallIssueExample(); LitemallIssueExample example = new LitemallIssueExample();
LitemallIssueExample.Criteria criteria = example.createCriteria(); LitemallIssueExample.Criteria criteria = example.createCriteria();
if(!StringUtils.isEmpty(question)){ if (!StringUtils.isEmpty(question)) {
criteria.andQuestionLike("%" + question + "%" ); criteria.andQuestionLike("%" + question + "%");
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
return (int)issueMapper.countByExample(example); return (int) issueMapper.countByExample(example);
} }
public int updateById(LitemallIssue issue) { public int updateById(LitemallIssue issue) {
......
...@@ -69,7 +69,7 @@ public class LitemallKeywordService { ...@@ -69,7 +69,7 @@ public class LitemallKeywordService {
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
PageHelper.startPage(page, limit); PageHelper.startPage(page, limit);
return (int)keywordsMapper.countByExample(example); return (int) keywordsMapper.countByExample(example);
} }
public void add(LitemallKeyword keywords) { public void add(LitemallKeyword keywords) {
......
package org.linlinjava.litemall.db.service; package org.linlinjava.litemall.db.service;
import org.linlinjava.litemall.db.dao.LitemallOrderGoodsMapper; import org.linlinjava.litemall.db.dao.LitemallOrderGoodsMapper;
import org.linlinjava.litemall.db.domain.LitemallOrder;
import org.linlinjava.litemall.db.domain.LitemallOrderGoods; import org.linlinjava.litemall.db.domain.LitemallOrderGoods;
import org.linlinjava.litemall.db.domain.LitemallOrderGoodsExample; import org.linlinjava.litemall.db.domain.LitemallOrderGoodsExample;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -26,6 +25,7 @@ public class LitemallOrderGoodsService { ...@@ -26,6 +25,7 @@ public class LitemallOrderGoodsService {
example.or().andOrderIdEqualTo(orderId).andDeletedEqualTo(false); example.or().andOrderIdEqualTo(orderId).andDeletedEqualTo(false);
return orderGoodsMapper.selectByExample(example); return orderGoodsMapper.selectByExample(example);
} }
public List<LitemallOrderGoods> findByOidAndGid(Integer orderId, Integer goodsId) { public List<LitemallOrderGoods> findByOidAndGid(Integer orderId, Integer goodsId) {
LitemallOrderGoodsExample example = new LitemallOrderGoodsExample(); LitemallOrderGoodsExample example = new LitemallOrderGoodsExample();
example.or().andOrderIdEqualTo(orderId).andGoodsIdEqualTo(goodsId).andDeletedEqualTo(false); example.or().andOrderIdEqualTo(orderId).andGoodsIdEqualTo(goodsId).andDeletedEqualTo(false);
...@@ -45,6 +45,6 @@ public class LitemallOrderGoodsService { ...@@ -45,6 +45,6 @@ public class LitemallOrderGoodsService {
LitemallOrderGoodsExample example = new LitemallOrderGoodsExample(); LitemallOrderGoodsExample example = new LitemallOrderGoodsExample();
example.or().andOrderIdEqualTo(orderId).andDeletedEqualTo(false); example.or().andOrderIdEqualTo(orderId).andDeletedEqualTo(false);
long count = orderGoodsMapper.countByExample(example); long count = orderGoodsMapper.countByExample(example);
return (short)count; return (short) count;
} }
} }
...@@ -34,7 +34,7 @@ public class LitemallOrderService { ...@@ -34,7 +34,7 @@ public class LitemallOrderService {
public int count(Integer userId) { public int count(Integer userId) {
LitemallOrderExample example = new LitemallOrderExample(); LitemallOrderExample example = new LitemallOrderExample();
example.or().andUserIdEqualTo(userId).andDeletedEqualTo(false); example.or().andUserIdEqualTo(userId).andDeletedEqualTo(false);
return (int)litemallOrderMapper.countByExample(example); return (int) litemallOrderMapper.countByExample(example);
} }
public LitemallOrder findById(Integer orderId) { public LitemallOrder findById(Integer orderId) {
...@@ -52,10 +52,10 @@ public class LitemallOrderService { ...@@ -52,10 +52,10 @@ public class LitemallOrderService {
return sb.toString(); return sb.toString();
} }
public int countByOrderSn(Integer userId, String orderSn){ public int countByOrderSn(Integer userId, String orderSn) {
LitemallOrderExample example = new LitemallOrderExample(); LitemallOrderExample example = new LitemallOrderExample();
example.or().andUserIdEqualTo(userId).andOrderSnEqualTo(orderSn).andDeletedEqualTo(false); example.or().andUserIdEqualTo(userId).andOrderSnEqualTo(orderSn).andDeletedEqualTo(false);
return (int)litemallOrderMapper.countByExample(example); return (int) litemallOrderMapper.countByExample(example);
} }
// TODO 这里应该产生一个唯一的订单,但是实际上这里仍然存在两个订单相同的可能性 // TODO 这里应该产生一个唯一的订单,但是实际上这里仍然存在两个订单相同的可能性
...@@ -63,7 +63,7 @@ public class LitemallOrderService { ...@@ -63,7 +63,7 @@ public class LitemallOrderService {
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyyMMdd"); DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyyMMdd");
String now = df.format(LocalDate.now()); String now = df.format(LocalDate.now());
String orderSn = now + getRandomNum(6); String orderSn = now + getRandomNum(6);
while(countByOrderSn(userId, orderSn) != 0){ while (countByOrderSn(userId, orderSn) != 0) {
orderSn = getRandomNum(6); orderSn = getRandomNum(6);
} }
return orderSn; return orderSn;
...@@ -74,7 +74,7 @@ public class LitemallOrderService { ...@@ -74,7 +74,7 @@ public class LitemallOrderService {
example.setOrderByClause(LitemallOrder.Column.addTime.desc()); example.setOrderByClause(LitemallOrder.Column.addTime.desc());
LitemallOrderExample.Criteria criteria = example.or(); LitemallOrderExample.Criteria criteria = example.or();
criteria.andUserIdEqualTo(userId); criteria.andUserIdEqualTo(userId);
if(orderStatus != null) { if (orderStatus != null) {
criteria.andOrderStatusIn(orderStatus); criteria.andOrderStatusIn(orderStatus);
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
...@@ -85,24 +85,24 @@ public class LitemallOrderService { ...@@ -85,24 +85,24 @@ public class LitemallOrderService {
LitemallOrderExample example = new LitemallOrderExample(); LitemallOrderExample example = new LitemallOrderExample();
LitemallOrderExample.Criteria criteria = example.or(); LitemallOrderExample.Criteria criteria = example.or();
criteria.andUserIdEqualTo(userId); criteria.andUserIdEqualTo(userId);
if(orderStatus != null) { if (orderStatus != null) {
criteria.andOrderStatusIn(orderStatus); criteria.andOrderStatusIn(orderStatus);
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
return (int)litemallOrderMapper.countByExample(example); return (int) litemallOrderMapper.countByExample(example);
} }
public List<LitemallOrder> querySelective(Integer userId, String orderSn, List<Short> orderStatusArray, Integer page, Integer size, String sort, String order) { public List<LitemallOrder> querySelective(Integer userId, String orderSn, List<Short> orderStatusArray, Integer page, Integer size, String sort, String order) {
LitemallOrderExample example = new LitemallOrderExample(); LitemallOrderExample example = new LitemallOrderExample();
LitemallOrderExample.Criteria criteria = example.createCriteria(); LitemallOrderExample.Criteria criteria = example.createCriteria();
if(userId != null){ if (userId != null) {
criteria.andUserIdEqualTo(userId); criteria.andUserIdEqualTo(userId);
} }
if(!StringUtils.isEmpty(orderSn)){ if (!StringUtils.isEmpty(orderSn)) {
criteria.andOrderSnEqualTo(orderSn); criteria.andOrderSnEqualTo(orderSn);
} }
if(orderStatusArray != null && orderStatusArray.size() != 0){ if (orderStatusArray != null && orderStatusArray.size() != 0) {
criteria.andOrderStatusIn(orderStatusArray); criteria.andOrderStatusIn(orderStatusArray);
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
...@@ -119,15 +119,15 @@ public class LitemallOrderService { ...@@ -119,15 +119,15 @@ public class LitemallOrderService {
LitemallOrderExample example = new LitemallOrderExample(); LitemallOrderExample example = new LitemallOrderExample();
LitemallOrderExample.Criteria criteria = example.createCriteria(); LitemallOrderExample.Criteria criteria = example.createCriteria();
if(userId != null){ if (userId != null) {
criteria.andUserIdEqualTo(userId); criteria.andUserIdEqualTo(userId);
} }
if(!StringUtils.isEmpty(orderSn)){ if (!StringUtils.isEmpty(orderSn)) {
criteria.andOrderSnEqualTo(orderSn); criteria.andOrderSnEqualTo(orderSn);
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
return (int)litemallOrderMapper.countByExample(example); return (int) litemallOrderMapper.countByExample(example);
} }
public int updateWithOptimisticLocker(LitemallOrder order) { public int updateWithOptimisticLocker(LitemallOrder order) {
...@@ -143,7 +143,7 @@ public class LitemallOrderService { ...@@ -143,7 +143,7 @@ public class LitemallOrderService {
public int count() { public int count() {
LitemallOrderExample example = new LitemallOrderExample(); LitemallOrderExample example = new LitemallOrderExample();
example.or().andDeletedEqualTo(false); example.or().andDeletedEqualTo(false);
return (int)litemallOrderMapper.countByExample(example); return (int) litemallOrderMapper.countByExample(example);
} }
public List<LitemallOrder> queryUnpaid() { public List<LitemallOrder> queryUnpaid() {
...@@ -164,7 +164,7 @@ public class LitemallOrderService { ...@@ -164,7 +164,7 @@ public class LitemallOrderService {
return litemallOrderMapper.selectOneByExample(example); return litemallOrderMapper.selectOneByExample(example);
} }
public Map<Object, Object> orderInfo(Integer userId){ public Map<Object, Object> orderInfo(Integer userId) {
LitemallOrderExample example = new LitemallOrderExample(); LitemallOrderExample example = new LitemallOrderExample();
example.or().andUserIdEqualTo(userId).andDeletedEqualTo(false); example.or().andUserIdEqualTo(userId).andDeletedEqualTo(false);
List<LitemallOrder> orders = litemallOrderMapper.selectByExampleSelective(example, LitemallOrder.Column.orderStatus, LitemallOrder.Column.comments); List<LitemallOrder> orders = litemallOrderMapper.selectByExampleSelective(example, LitemallOrder.Column.orderStatus, LitemallOrder.Column.comments);
...@@ -173,20 +173,16 @@ public class LitemallOrderService { ...@@ -173,20 +173,16 @@ public class LitemallOrderService {
int unship = 0; int unship = 0;
int unrecv = 0; int unrecv = 0;
int uncomment = 0; int uncomment = 0;
for(LitemallOrder order : orders){ for (LitemallOrder order : orders) {
if(OrderUtil.isCreateStatus(order)){ if (OrderUtil.isCreateStatus(order)) {
unpaid++; unpaid++;
} } else if (OrderUtil.isPayStatus(order)) {
else if(OrderUtil.isPayStatus(order)){
unship++; unship++;
} } else if (OrderUtil.isShipStatus(order)) {
else if(OrderUtil.isShipStatus(order)){
unrecv++; unrecv++;
} } else if (OrderUtil.isConfirmStatus(order) || OrderUtil.isAutoConfirmStatus(order)) {
else if(OrderUtil.isConfirmStatus(order) || OrderUtil.isAutoConfirmStatus(order)){
uncomment += order.getComments(); uncomment += order.getComments();
} } else {
else {
// do nothing // do nothing
} }
} }
...@@ -202,7 +198,7 @@ public class LitemallOrderService { ...@@ -202,7 +198,7 @@ public class LitemallOrderService {
public List<LitemallOrder> queryComment() { public List<LitemallOrder> queryComment() {
LitemallOrderExample example = new LitemallOrderExample(); LitemallOrderExample example = new LitemallOrderExample();
example.or().andCommentsGreaterThan((short)0).andDeletedEqualTo(false); example.or().andCommentsGreaterThan((short) 0).andDeletedEqualTo(false);
return litemallOrderMapper.selectByExample(example); return litemallOrderMapper.selectByExample(example);
} }
} }
package org.linlinjava.litemall.db.service; package org.linlinjava.litemall.db.service;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import org.linlinjava.litemall.db.dao.*; import org.linlinjava.litemall.db.dao.LitemallRegionMapper;
import org.linlinjava.litemall.db.domain.LitemallRegion; import org.linlinjava.litemall.db.domain.LitemallRegion;
import org.linlinjava.litemall.db.domain.LitemallRegionExample; import org.linlinjava.litemall.db.domain.LitemallRegionExample;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -29,10 +29,10 @@ public class LitemallRegionService { ...@@ -29,10 +29,10 @@ public class LitemallRegionService {
LitemallRegionExample example = new LitemallRegionExample(); LitemallRegionExample example = new LitemallRegionExample();
LitemallRegionExample.Criteria criteria = example.createCriteria(); LitemallRegionExample.Criteria criteria = example.createCriteria();
if(!StringUtils.isEmpty(name)){ if (!StringUtils.isEmpty(name)) {
criteria.andNameLike("%" + name + "%"); criteria.andNameLike("%" + name + "%");
} }
if(!StringUtils.isEmpty(code)){ if (!StringUtils.isEmpty(code)) {
criteria.andCodeEqualTo(code); criteria.andCodeEqualTo(code);
} }
...@@ -48,12 +48,12 @@ public class LitemallRegionService { ...@@ -48,12 +48,12 @@ public class LitemallRegionService {
LitemallRegionExample example = new LitemallRegionExample(); LitemallRegionExample example = new LitemallRegionExample();
LitemallRegionExample.Criteria criteria = example.createCriteria(); LitemallRegionExample.Criteria criteria = example.createCriteria();
if(!StringUtils.isEmpty(name)){ if (!StringUtils.isEmpty(name)) {
criteria.andNameLike("%" + name + "%"); criteria.andNameLike("%" + name + "%");
} }
if(code != null){ if (code != null) {
criteria.andCodeEqualTo(code); criteria.andCodeEqualTo(code);
} }
return (int)regionMapper.countByExample(example); return (int) regionMapper.countByExample(example);
} }
} }
...@@ -39,11 +39,11 @@ public class LitemallSearchHistoryService { ...@@ -39,11 +39,11 @@ public class LitemallSearchHistoryService {
LitemallSearchHistoryExample example = new LitemallSearchHistoryExample(); LitemallSearchHistoryExample example = new LitemallSearchHistoryExample();
LitemallSearchHistoryExample.Criteria criteria = example.createCriteria(); LitemallSearchHistoryExample.Criteria criteria = example.createCriteria();
if(!StringUtils.isEmpty(userId)){ if (!StringUtils.isEmpty(userId)) {
criteria.andUserIdEqualTo(Integer.valueOf(userId)); criteria.andUserIdEqualTo(Integer.valueOf(userId));
} }
if(!StringUtils.isEmpty(keyword)){ if (!StringUtils.isEmpty(keyword)) {
criteria.andKeywordLike("%" + keyword + "%" ); criteria.andKeywordLike("%" + keyword + "%");
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
...@@ -59,14 +59,14 @@ public class LitemallSearchHistoryService { ...@@ -59,14 +59,14 @@ public class LitemallSearchHistoryService {
LitemallSearchHistoryExample example = new LitemallSearchHistoryExample(); LitemallSearchHistoryExample example = new LitemallSearchHistoryExample();
LitemallSearchHistoryExample.Criteria criteria = example.createCriteria(); LitemallSearchHistoryExample.Criteria criteria = example.createCriteria();
if(!StringUtils.isEmpty(userId)){ if (!StringUtils.isEmpty(userId)) {
criteria.andUserIdEqualTo(Integer.valueOf(userId)); criteria.andUserIdEqualTo(Integer.valueOf(userId));
} }
if(!StringUtils.isEmpty(keyword)){ if (!StringUtils.isEmpty(keyword)) {
criteria.andKeywordLike("%" + keyword + "%" ); criteria.andKeywordLike("%" + keyword + "%");
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
return (int)searchHistoryMapper.countByExample(example); return (int) searchHistoryMapper.countByExample(example);
} }
} }
...@@ -47,10 +47,10 @@ public class LitemallStorageService { ...@@ -47,10 +47,10 @@ public class LitemallStorageService {
LitemallStorageExample example = new LitemallStorageExample(); LitemallStorageExample example = new LitemallStorageExample();
LitemallStorageExample.Criteria criteria = example.createCriteria(); LitemallStorageExample.Criteria criteria = example.createCriteria();
if(!StringUtils.isEmpty(key)){ if (!StringUtils.isEmpty(key)) {
criteria.andKeyEqualTo(key); criteria.andKeyEqualTo(key);
} }
if(!StringUtils.isEmpty(name)){ if (!StringUtils.isEmpty(name)) {
criteria.andNameLike("%" + name + "%"); criteria.andNameLike("%" + name + "%");
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
...@@ -67,14 +67,14 @@ public class LitemallStorageService { ...@@ -67,14 +67,14 @@ public class LitemallStorageService {
LitemallStorageExample example = new LitemallStorageExample(); LitemallStorageExample example = new LitemallStorageExample();
LitemallStorageExample.Criteria criteria = example.createCriteria(); LitemallStorageExample.Criteria criteria = example.createCriteria();
if(!StringUtils.isEmpty(key)){ if (!StringUtils.isEmpty(key)) {
criteria.andKeyEqualTo(key); criteria.andKeyEqualTo(key);
} }
if(!StringUtils.isEmpty(name)){ if (!StringUtils.isEmpty(name)) {
criteria.andNameLike("%" + name + "%"); criteria.andNameLike("%" + name + "%");
} }
criteria.andDeletedEqualTo(false); criteria.andDeletedEqualTo(false);
return (int)storageMapper.countByExample(example); return (int) storageMapper.countByExample(example);
} }
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment