修改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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量插入商品分类与筛选属性关系表
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user