1、属性分组和品牌管理页面条件查询优化

2、右上角消息提示优化
pull/254/head
xjs 4 years ago
parent b3feae4fa2
commit 32abbd5ad5

@ -19,39 +19,40 @@
<table style="text-align: center" v-loading="loading"> <table style="text-align: center" v-loading="loading">
<td v-for="(cast,index) in forecastWeatherData.casts" width="100px"> <td v-for="(cast,index) in forecastWeatherData.casts" width="100px">
<tr v-if="index===0"> <tr v-if="index===0">
今天({{cast.week}}) 今天({{ cast.week }})
</tr> </tr>
<tr v-if="index===1"> <tr v-if="index===1">
明天({{cast.week}}) 明天({{ cast.week }})
</tr> </tr>
<tr v-if="index===2"> <tr v-if="index===2">
后天({{cast.week}}) 后天({{ cast.week }})
</tr> </tr>
<tr v-if="index===3"> <tr v-if="index===3">
大后天({{cast.week}}) 大后天({{ cast.week }})
</tr> </tr>
<tr>{{cast.dayweather}}</tr> <tr>{{ cast.dayweather }}</tr>
<tr> <tr>
{{cast.nighttemp+"℃~"+cast.daytemp+"℃"}} {{ cast.nighttemp + "℃~" + cast.daytemp + "℃" }}
</tr> </tr>
</td> </td>
</table> </table>
<div class="right-menu-item weather" @click="getForecastWeather()" slot="reference"> <div class="right-menu-item weather" @click="getForecastWeather()" slot="reference">
<img :src="weather" class="img"> <img :src="weather" class="img">
<span class="span1"> <span class="span1">
{{ nowWeatherData.temperature + "℃" }} {{ nowWeatherData.temperature + "℃" }}
</span> </span>
<span class="span2"> <span class="span2">
{{ nowWeatherData.weather }} {{ nowWeatherData.weather }}
</span> </span>
</div> </div>
</el-popover> </el-popover>
<!--预警--> <!--预警-->
<el-badge :value="warnData.count" class=" hover-effect share-button" v-hasPermi="['warning:warning:handle']"> <el-badge :max="99" :value="warnData.count" class=" hover-effect share-button"
v-hasPermi="['warning:warning:handle']">
<el-popover <el-popover
placement="bottom" placement="bottom"
width="220" width="220"
@ -60,11 +61,11 @@
<div style="text-align: right; margin: 0"> <div style="text-align: right; margin: 0">
<el-button type="primary" size="mini" @click="haveRead"></el-button> <el-button type="primary" size="mini" @click="haveRead"></el-button>
</div> </div>
<el-button type="info" icon="el-icon-check"
circle style="max-width: 22px;max-height: 22px;" <div slot="reference">
@click="" <svg-icon class-name="wechat-icon" icon-class="wechat" style="height: 28px"/>
slot="reference" </div>
></el-button>
</el-popover> </el-popover>
</el-badge> </el-badge>
@ -145,7 +146,7 @@ export default {
forecastWeatherData: {}, forecastWeatherData: {},
visible: false, visible: false,
weatherVisible:false, weatherVisible: false,
weather, weather,
} }
@ -238,7 +239,7 @@ export default {
if (json.warningMessage !== undefined) { if (json.warningMessage !== undefined) {
// this.visible = true // this.visible = true
return json.warningMessage return json.warningMessage
}else { } else {
return '暂无提示!!!' return '暂无提示!!!'
} }
} }

@ -8,7 +8,7 @@
<div class="mod-config"> <div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item> <el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable></el-input> <el-input v-model="dataForm.key" placeholder="请输入组名、描述、分类id等" style="width: 300px" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button-group> <el-button-group>
@ -25,6 +25,7 @@
:disabled="dataListSelections.length <= 0" :disabled="dataListSelections.length <= 0"
>批量删除 >批量删除
</el-button> </el-button>
<el-button icon="el-icon-refresh" @click="resetQuery"></el-button>
</el-button-group> </el-button-group>
</el-form-item> </el-form-item>
@ -183,7 +184,19 @@ export default {
this.getDataList(); this.getDataList();
}) })
}); });
} },
/** 重置按钮操作 */
resetQuery() {
this.dataForm={}
this.handleQuery();
},
/** 搜索按钮操作 */
handleQuery() {
this.pageIndex = 1;
this.getDataList();
},
} }
}; };
</script> </script>

@ -58,7 +58,7 @@
<script> <script>
import CategoryCascader from '../../../components/mall/category-cascader' import CategoryCascader from '../../../components/mall/category-cascader'
import {addAttrGroup, getAttrGroup} from "@/api/mall/product/attr-group"; import {addAttrGroup, getAttrGroup,editAttrGroup} from "@/api/mall/product/attr-group";
import IconSelect from "@/components/IconSelect"; import IconSelect from "@/components/IconSelect";
export default { export default {

@ -2,11 +2,11 @@
<div class="app-container"> <div class="app-container">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item> <el-form-item>
<el-input size="mini" v-model="dataForm.key" placeholder="参数名" clearable></el-input> <el-input size="mini" v-model="dataForm.key" placeholder="请输入品牌名、介绍、检索首字母等" clearable style="width: 300px"></el-input>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button-group> <el-button-group>
<el-button size="mini" @click="getDataList()"></el-button> <el-button size="mini" @click="handleQuery()"></el-button>
<el-button <el-button
type="primary" type="primary"
size="mini" size="mini"
@ -20,6 +20,7 @@
:disabled="dataListSelections.length <= 0" :disabled="dataListSelections.length <= 0"
>批量删除 >批量删除
</el-button> </el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-button-group> </el-button-group>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -232,7 +233,19 @@ export default {
this.$modal.closeLoading() this.$modal.closeLoading()
}) })
}); });
} },
/** 重置按钮操作 */
resetQuery() {
this.dataForm={}
this.handleQuery();
},
/** 搜索按钮操作 */
handleQuery() {
this.pageIndex = 1;
this.getDataList();
},
} }
}; };
</script> </script>

@ -24,6 +24,8 @@ import java.util.Map;
*/ */
public class Query<T> { public class Query<T> {
public static final String KEY_NAME= "key";
public IPage<T> getPage(Map<String, Object> params) { public IPage<T> getPage(Map<String, Object> params) {
return this.getPage(params, null, false); return this.getPage(params, null, false);
} }

@ -1,10 +1,14 @@
package com.xjs.mall.product.controller; package com.xjs.mall.product.controller;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.xjs.mall.product.entity.AttrGroupEntity; import com.xjs.mall.product.entity.AttrGroupEntity;
import com.xjs.mall.product.service.AttrGroupService; import com.xjs.mall.product.service.AttrGroupService;
import com.xjs.mall.product.service.CategoryService; import com.xjs.mall.product.service.CategoryService;
import com.xjs.utils.PageUtils; import com.xjs.utils.PageUtils;
import com.xjs.utils.R; import com.xjs.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -23,6 +27,7 @@ import java.util.stream.Collectors;
*/ */
@RestController @RestController
@RequestMapping("product/attrgroup") @RequestMapping("product/attrgroup")
@Api(tags = "商城-商品-属性分组")
public class AttrGroupController { public class AttrGroupController {
@Autowired @Autowired
private AttrGroupService attrGroupService; private AttrGroupService attrGroupService;
@ -32,7 +37,8 @@ public class AttrGroupController {
/** /**
* *
*/ */
@RequestMapping("/list/{catelogId}") @GetMapping("/list/{catelogId}")
@ApiOperation("列表")
public R list(@RequestParam Map<String, Object> params,Long catelogId){ public R list(@RequestParam Map<String, Object> params,Long catelogId){
PageUtils page =attrGroupService.queryPage(params,catelogId); PageUtils page =attrGroupService.queryPage(params,catelogId);
@ -44,7 +50,8 @@ public class AttrGroupController {
/** /**
* *
*/ */
@RequestMapping("/info/{attrGroupId}") @GetMapping("/info/{attrGroupId}")
@ApiOperation("信息")
public R info(@PathVariable("attrGroupId") Long attrGroupId){ public R info(@PathVariable("attrGroupId") Long attrGroupId){
AttrGroupEntity attrGroup = attrGroupService.getById(attrGroupId); AttrGroupEntity attrGroup = attrGroupService.getById(attrGroupId);
@ -59,7 +66,9 @@ public class AttrGroupController {
/** /**
* *
*/ */
@RequestMapping("/save") @PostMapping("/save")
@ApiOperation("保存")
@Log(title = "属性分组", businessType = BusinessType.INSERT)
public R save(@RequestBody AttrGroupEntity attrGroup){ public R save(@RequestBody AttrGroupEntity attrGroup){
attrGroupService.save(attrGroup); attrGroupService.save(attrGroup);
@ -69,7 +78,9 @@ public class AttrGroupController {
/** /**
* *
*/ */
@RequestMapping("/update") @PutMapping("/update")
@ApiOperation("修改")
@Log(title = "属性分组", businessType = BusinessType.UPDATE)
public R update(@RequestBody AttrGroupEntity attrGroup){ public R update(@RequestBody AttrGroupEntity attrGroup){
attrGroupService.updateById(attrGroup); attrGroupService.updateById(attrGroup);
@ -79,7 +90,9 @@ public class AttrGroupController {
/** /**
* *
*/ */
@RequestMapping("/delete") @DeleteMapping("/delete")
@ApiOperation("删除")
@Log(title = "属性分组", businessType = BusinessType.DELETE)
public R delete(@RequestBody Long[] attrGroupIds){ public R delete(@RequestBody Long[] attrGroupIds){
attrGroupService.removeByIds(Arrays.asList(attrGroupIds)); attrGroupService.removeByIds(Arrays.asList(attrGroupIds));

@ -10,6 +10,7 @@ import com.xjs.validation.group.AddGroup;
import com.xjs.validation.group.SelectGroup; import com.xjs.validation.group.SelectGroup;
import com.xjs.validation.group.UpdateGroup; import com.xjs.validation.group.UpdateGroup;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -37,6 +38,7 @@ public class BrandController {
* *
*/ */
@GetMapping("/list") @GetMapping("/list")
@ApiOperation("列表")
public R list(@Validated(SelectGroup.class) @RequestParam Map<String, Object> params){ public R list(@Validated(SelectGroup.class) @RequestParam Map<String, Object> params){
PageUtils page = brandService.queryPage(params); PageUtils page = brandService.queryPage(params);
@ -48,6 +50,7 @@ public class BrandController {
* *
*/ */
@GetMapping("/info/{brandId}") @GetMapping("/info/{brandId}")
@ApiOperation("信息")
public R info(@PathVariable("brandId") Long brandId){ public R info(@PathVariable("brandId") Long brandId){
BrandEntity brand = brandService.getById(brandId); BrandEntity brand = brandService.getById(brandId);
@ -58,6 +61,7 @@ public class BrandController {
* *
*/ */
@PostMapping("/save") @PostMapping("/save")
@ApiOperation("保存")
@Log(title = "品牌管理", businessType = BusinessType.INSERT) @Log(title = "品牌管理", businessType = BusinessType.INSERT)
public R save(@Validated(AddGroup.class) @RequestBody BrandEntity brand){ public R save(@Validated(AddGroup.class) @RequestBody BrandEntity brand){
brandService.save(brand); brandService.save(brand);
@ -69,6 +73,7 @@ public class BrandController {
* *
*/ */
@PutMapping("/update") @PutMapping("/update")
@ApiOperation("修改")
@Log(title = "品牌管理", businessType = BusinessType.UPDATE) @Log(title = "品牌管理", businessType = BusinessType.UPDATE)
public R update(@Validated(UpdateGroup.class) @RequestBody BrandEntity brand){ public R update(@Validated(UpdateGroup.class) @RequestBody BrandEntity brand){
brandService.updateById(brand); brandService.updateById(brand);
@ -80,6 +85,7 @@ public class BrandController {
* *
*/ */
@DeleteMapping("/delete") @DeleteMapping("/delete")
@ApiOperation("删除")
@Log(title = "品牌管理", businessType = BusinessType.DELETE) @Log(title = "品牌管理", businessType = BusinessType.DELETE)
public R delete(@RequestBody Long[] brandIds){ public R delete(@RequestBody Long[] brandIds){
brandService.removeByIds(Arrays.asList(brandIds)); brandService.removeByIds(Arrays.asList(brandIds));

@ -30,12 +30,14 @@ public class AttrGroupServiceImpl extends ServiceImpl<AttrGroupDao, AttrGroupEnt
@Override @Override
public PageUtils queryPage(Map<String, Object> params, Long categoryId) { public PageUtils queryPage(Map<String, Object> params, Long categoryId) {
String key = (String) params.get("key"); String key = (String) params.get(Query.KEY_NAME);
//select * from pms_attr_group where catelog_id=? and (attr_group_id=key or attr_group_name like %key%)
LambdaQueryWrapper<AttrGroupEntity> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<AttrGroupEntity> wrapper = new LambdaQueryWrapper<>();
if(!StringUtils.isEmpty(key)){ if(!StringUtils.isEmpty(key)){
wrapper.and((obj)->{ wrapper.and((obj)->{
obj.eq(AttrGroupEntity::getAttrGroupId,key).or().like(AttrGroupEntity::getAttrGroupName,key); obj.eq(AttrGroupEntity::getAttrGroupId,key)
.or().like(AttrGroupEntity::getDescript,key)
.or().like(AttrGroupEntity::getAttrGroupName,key);
}); });
} }
@ -53,4 +55,4 @@ public class AttrGroupServiceImpl extends ServiceImpl<AttrGroupDao, AttrGroupEnt
} }
} }

@ -1,16 +1,17 @@
package com.xjs.mall.product.service.impl; package com.xjs.mall.product.service.impl;
import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xjs.utils.PageUtils;
import com.xjs.utils.Query;
import com.xjs.mall.product.dao.BrandDao; import com.xjs.mall.product.dao.BrandDao;
import com.xjs.mall.product.entity.BrandEntity; import com.xjs.mall.product.entity.BrandEntity;
import com.xjs.mall.product.service.BrandService; import com.xjs.mall.product.service.BrandService;
import com.xjs.utils.PageUtils;
import com.xjs.utils.Query;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service("brandService") @Service("brandService")
@ -18,12 +19,21 @@ public class BrandServiceImpl extends ServiceImpl<BrandDao, BrandEntity> impleme
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
String key = (String) params.get(Query.KEY_NAME);
LambdaQueryWrapper<BrandEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.and(StringUtils.isNotEmpty(key), obj ->{
obj.like(BrandEntity::getName, key)
.or().like(BrandEntity::getDescript, key)
.or().eq(BrandEntity::getFirstLetter, key);
});
IPage<BrandEntity> page = this.page( IPage<BrandEntity> page = this.page(
new Query<BrandEntity>().getPage(params), new Query<BrandEntity>().getPage(params),
new QueryWrapper<BrandEntity>() wrapper
); );
return new PageUtils(page); return new PageUtils(page);
} }
} }

Loading…
Cancel
Save