修改3-15问题
This commit is contained in:
@@ -7,6 +7,7 @@ import com.zscat.mallplus.annotation.SysLog;
|
||||
import com.zscat.mallplus.build.entity.BuildWuyeCompany;
|
||||
import com.zscat.mallplus.enums.StatusEnum;
|
||||
import com.zscat.mallplus.util.EasyPoiUtils;
|
||||
import com.zscat.mallplus.util.StringUtils;
|
||||
import com.zscat.mallplus.utils.CommonResult;
|
||||
import com.zscat.mallplus.utils.ValidatorUtils;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -45,7 +46,11 @@ public class BuildWuyeCompanyController {
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
|
||||
) {
|
||||
try {
|
||||
return new CommonResult().success(IBuildWuyeCompanyService.page(new Page<BuildWuyeCompany>(pageNum, pageSize), new QueryWrapper<>(entity)));
|
||||
QueryWrapper<BuildWuyeCompany> qw = new QueryWrapper<>();
|
||||
if(StringUtils.isNotBlank(entity.getKeyword())){
|
||||
qw.like("name",entity.getKeyword());
|
||||
}
|
||||
return new CommonResult().success(IBuildWuyeCompanyService.page(new Page<BuildWuyeCompany>(pageNum, pageSize), qw));
|
||||
} catch (Exception e) {
|
||||
log.error("根据条件查询所有物业公司表列表:%s", e.getMessage(), e);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class PmsProductAttributeCategoryController {
|
||||
@SysLog(MODULE = "pms", REMARK = "保存产品属性分类表")
|
||||
@ApiOperation("保存产品属性分类表")
|
||||
@PostMapping(value = "/create")
|
||||
@PreAuthorize("hasAuthority('pms:PmsProductAttributeCategory:create')")
|
||||
// @PreAuthorize("hasAuthority('pms:PmsProductAttributeCategory:create')")
|
||||
public Object create(@RequestParam String name,
|
||||
@RequestParam(value = "pic", required = false) String pic,
|
||||
@RequestParam(value = "showIndex", required = false) Integer showIndex,
|
||||
|
||||
@@ -66,6 +66,13 @@ public class PmsProductCategoryController {
|
||||
@PreAuthorize("hasAuthority('pms:PmsProductCategory:create')")
|
||||
public Object savePmsProductCategory(@RequestBody PmsProductCategory entity) {
|
||||
try {
|
||||
//查询是否存在相同级别的相同名称的分类
|
||||
Long parentId = entity.getParentId();
|
||||
String name = entity.getName();
|
||||
int count = IPmsProductCategoryService.selectCountByNameAndLevel(parentId,name);
|
||||
if(count>0){
|
||||
return new CommonResult().failed("该分类已存在");
|
||||
}
|
||||
if (IPmsProductCategoryService.saveAnd(entity)) {
|
||||
return new CommonResult().success();
|
||||
}
|
||||
@@ -82,6 +89,14 @@ public class PmsProductCategoryController {
|
||||
@PreAuthorize("hasAuthority('pms:PmsProductCategory:update')")
|
||||
public Object updatePmsProductCategory(@RequestBody PmsProductCategory entity) {
|
||||
try {
|
||||
//查询是否存在相同级别的相同名称的分类
|
||||
Long parentId = entity.getParentId();
|
||||
String name = entity.getName();
|
||||
Long id = entity.getId();
|
||||
int count = IPmsProductCategoryService.selectCountByNameAndLevelId(parentId,name,id);
|
||||
if(count>0){
|
||||
return new CommonResult().failed("该分类已存在");
|
||||
}
|
||||
if (IPmsProductCategoryService.updateAnd(entity)) {
|
||||
return new CommonResult().success();
|
||||
}
|
||||
|
||||
@@ -27,4 +27,8 @@ public interface IPmsProductCategoryService extends IService<PmsProductCategory>
|
||||
boolean updateAnd(PmsProductCategory entity);
|
||||
|
||||
boolean saveAnd(PmsProductCategory entity);
|
||||
|
||||
int selectCountByNameAndLevel(Long parentId, String name);
|
||||
|
||||
int selectCountByNameAndLevelId(Long parentId, String name, Long id);
|
||||
}
|
||||
|
||||
@@ -103,6 +103,16 @@ public class PmsProductCategoryServiceImpl extends ServiceImpl<PmsProductCategor
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int selectCountByNameAndLevel(Long parentId, String name) {
|
||||
return baseMapper.selectCountByNameAndLevel(parentId,name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int selectCountByNameAndLevelId(Long parentId, String name, Long id) {
|
||||
return baseMapper.selectCountByNameAndLevelId(parentId,name,id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量插入商品分类与筛选属性关系表
|
||||
*
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -65,5 +66,9 @@ public class BuildWuyeCompany implements Serializable {
|
||||
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty("关键字")
|
||||
@TableField(exist = false)
|
||||
private String keyword;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.zscat.mallplus.pms.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zscat.mallplus.pms.entity.PmsProductCategory;
|
||||
import com.zscat.mallplus.pms.vo.PmsProductCategoryWithChildrenItem;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -17,4 +18,8 @@ import java.util.List;
|
||||
public interface PmsProductCategoryMapper extends BaseMapper<PmsProductCategory> {
|
||||
|
||||
List<PmsProductCategoryWithChildrenItem> listWithChildren();
|
||||
|
||||
int selectCountByNameAndLevel(@Param("parentId") Long parentId, @Param("name") String name);
|
||||
|
||||
int selectCountByNameAndLevelId(@Param("parentId") Long parentId, @Param("name") String name, @Param("id") Long id);
|
||||
}
|
||||
|
||||
@@ -39,4 +39,12 @@
|
||||
from pms_product_category c1 left join pms_product_category c2 on c1.id = c2.parent_id
|
||||
where c1.parent_id = 0
|
||||
</select>
|
||||
|
||||
<select id="selectCountByNameAndLevel" resultType="int">
|
||||
select count(*) from pms_product_category where parent_id = #{parentId} and name = #{name}
|
||||
</select>
|
||||
|
||||
<select id="selectCountByNameAndLevelId" resultType="int">
|
||||
select count(*) from pms_product_category where parent_id = #{parentId} and name = #{name} and id <> #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -171,13 +171,21 @@ public class PmsProductServiceImpl extends ServiceImpl<PmsProductMapper, PmsProd
|
||||
List<PmsProductAttributeValue> valueList = productAttributeValueMapper.selectList(new QueryWrapper<PmsProductAttributeValue>().eq("product_id", goods.getId()));
|
||||
List<PmsProductAttributeValue> productAttributeValueList = new ArrayList<>();
|
||||
List<PmsProductAttributeValue> attributeValueList = new ArrayList<>();
|
||||
for (PmsProductAttributeValue attributeValue : valueList) {
|
||||
if (attributeValue.getType() == 1) {
|
||||
productAttributeValueList.add(attributeValue);
|
||||
} else {
|
||||
attributeValueList.add(attributeValue);
|
||||
valueList.removeAll(Collections.singleton(null));
|
||||
if(!valueList.isEmpty()){
|
||||
for (PmsProductAttributeValue attributeValue : valueList) {
|
||||
if(attributeValue.getType() != null){
|
||||
if (attributeValue.getType() == 1) {
|
||||
productAttributeValueList.add(attributeValue);
|
||||
} else {
|
||||
attributeValueList.add(attributeValue);
|
||||
}
|
||||
}else{
|
||||
attributeValueList.add(attributeValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
param.setProductAttributeValueList(productAttributeValueList);
|
||||
param.setProductCanShuValueList(attributeValueList);
|
||||
|
||||
|
||||
@@ -909,7 +909,11 @@ public class SingePmsController extends ApiBaseAction {
|
||||
List<Long> ids = new ArrayList<>();
|
||||
ids.add(1L);
|
||||
ids.add(0L);
|
||||
List<PmsProductCategory> categories = categoryMapper.selectList(new QueryWrapper<PmsProductCategory>().in("level", ids));
|
||||
QueryWrapper<PmsProductCategory> qw = new QueryWrapper<>();
|
||||
qw.in("level", ids);
|
||||
qw.orderByAsc("sort");
|
||||
qw.eq("show_status",1);
|
||||
List<PmsProductCategory> categories = categoryMapper.selectList(qw);
|
||||
for (PmsProductCategory v : categories) {
|
||||
if (v.getLevel() == 0) {
|
||||
ProductTypeVo vo = new ProductTypeVo();
|
||||
|
||||
Reference in New Issue
Block a user