记得上下班打卡 | git大法好,push需谨慎

Commit 97e9e40f authored by dongchun's avatar dongchun

Merge remote-tracking branch 'origin/dev_goblin' into dev_goblin

parents cc1a56b7 14591028
package com.liquidnet.client.admin.web.controller.zhengzai.goblin; package com.liquidnet.client.admin.web.controller.zhengzai.goblin;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.liquidnet.client.admin.common.annotation.Log;
import com.liquidnet.client.admin.common.core.controller.BaseController; import com.liquidnet.client.admin.common.core.controller.BaseController;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.common.core.page.TableDataInfo; import com.liquidnet.client.admin.common.core.page.TableDataInfo;
import com.liquidnet.client.admin.common.core.text.Convert;
import com.liquidnet.client.admin.common.enums.BusinessType;
import com.liquidnet.client.admin.common.utils.ShiroUtils;
import com.liquidnet.client.admin.zhengzai.goblin.service.IGoblinSelfGoodsCategoryService;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.goblin.entity.GoblinSelfGoodsCategory; import com.liquidnet.service.goblin.entity.GoblinSelfGoodsCategory;
import com.liquidnet.service.goblin.entity.GoblinStoreInfo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import java.time.LocalDateTime;
@Api(tags = "商品分类")
@Controller @Controller
@RequestMapping("goblin/category") @RequestMapping("goblin/category")
public class GoblinSelfCategoryController extends BaseController { public class GoblinSelfCategoryController extends BaseController {
private final String prefix = "zhengzai/goblin/category"; private final String prefix = "zhengzai/goblin/category";
@Autowired
IGoblinSelfGoodsCategoryService goblinSelfGoodsCategoryService;
@GetMapping() @GetMapping()
public String category() { public String category() {
...@@ -25,12 +40,53 @@ public class GoblinSelfCategoryController extends BaseController { ...@@ -25,12 +40,53 @@ public class GoblinSelfCategoryController extends BaseController {
} }
@RequiresPermissions("goblin:category:list") @RequiresPermissions("goblin:category:list")
@RequestMapping("/list") @RequestMapping("list")
@ResponseBody
public TableDataInfo list() {
PageHelper.startPage(0, 1000, "mid");
return getDataTable(goblinSelfGoodsCategoryService.listForForMultiGrade());
}
@ApiOperation(value = "新建")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "grade", value = "分类层级[1-一级|2-二级|3-三级]", allowableValues = "1,2,3"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "catePid", value = "分类父ID[30]"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "name", value = "分类名称[50]"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "icon", value = "分类图标[256]"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "neIsbn", value = "是否需要填写ISBN[0-否|1-是]", allowableValues = "0,1"),
@ApiImplicitParam(type = "form", required = false, dataType = "Integer", name = "sort", value = "排序[数值越小,排序越前]", example = "1"),
})
@Log(title = "店铺管理:商品分类:新建", businessType = BusinessType.INSERT)
@RequiresPermissions("goblin:category:add")
@PostMapping("addSave")
@ResponseBody
public AjaxResult addSave(GoblinSelfGoodsCategory selfGoodsCategory) {
// TODO: 2022/1/14 zhanggb valid
selfGoodsCategory.setCateId(IDGenerator.nextMilliId2());
selfGoodsCategory.setCreatedBy(ShiroUtils.getLoginName());
selfGoodsCategory.setCreatedAt(LocalDateTime.now());
return toAjax(goblinSelfGoodsCategoryService.save(selfGoodsCategory));
}
@Log(title = "店铺管理:商品分类:删除", businessType = BusinessType.DELETE)
@RequiresPermissions("goblin:category:rmv")
@PostMapping("rmv")
@ResponseBody @ResponseBody
public TableDataInfo list(GoblinStoreInfo storeInfo) { public AjaxResult rmv(String cateIds) {
LambdaQueryWrapper<GoblinSelfGoodsCategory> lambdaQueryWrapper = Wrappers.lambdaQuery(GoblinSelfGoodsCategory.class); String loginName = ShiroUtils.getLoginName();
lambdaQueryWrapper.eq(GoblinSelfGoodsCategory::getDelFlg, "0"); LocalDateTime now = LocalDateTime.now();
PageHelper.startPage(0, 1000, "mid desc"); String[] cateIdArr = Convert.toStrArray(cateIds);
return getDataTable(null); return toAjax(goblinSelfGoodsCategoryService.update(Wrappers.lambdaUpdate(GoblinSelfGoodsCategory.class)
.in(GoblinSelfGoodsCategory::getCateId, cateIdArr)
.in(GoblinSelfGoodsCategory::getCatePid, cateIdArr)
.set(GoblinSelfGoodsCategory::getDelFlg, "1")
.set(GoblinSelfGoodsCategory::getUpdatedBy, loginName)
.set(GoblinSelfGoodsCategory::getUpdatedAt, now)
.set(GoblinSelfGoodsCategory::getDeletedBy, loginName)
.set(GoblinSelfGoodsCategory::getDeletedAt, now)
));
} }
} }
...@@ -109,8 +109,9 @@ public class GoblinSelfExtagController extends BaseController { ...@@ -109,8 +109,9 @@ public class GoblinSelfExtagController extends BaseController {
@PostMapping("rmv") @PostMapping("rmv")
@ResponseBody @ResponseBody
public AjaxResult rmv(String extagIds) { public AjaxResult rmv(String extagIds) {
return toAjax(goblinSelfTagService.update( return toAjax(goblinSelfTagService.update(Wrappers.lambdaUpdate(GoblinSelfTag.class)
Wrappers.lambdaUpdate(GoblinSelfTag.class).in(GoblinSelfTag::getTagId, Convert.toStrArray(extagIds)).set(GoblinSelfTag::getDelFlg, "1") .in(GoblinSelfTag::getTagId, Convert.toStrArray(extagIds))
.set(GoblinSelfTag::getDelFlg, "1")
)); ));
} }
} }
...@@ -31,7 +31,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -31,7 +31,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@Api(tags = "标签管理") @Api(tags = "标签")
@Controller @Controller
@RequestMapping("goblin/tag") @RequestMapping("goblin/tag")
public class GoblinSelfTagController extends BaseController { public class GoblinSelfTagController extends BaseController {
...@@ -89,19 +89,18 @@ public class GoblinSelfTagController extends BaseController { ...@@ -89,19 +89,18 @@ public class GoblinSelfTagController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "tagName", value = "标签名称[50]"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "tagName", value = "标签名称[50]"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "tagPic", value = "标签图片[256]"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "tagPic", value = "标签图片[256]"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "tagType", value = "标签类型[1-音乐人|2-艺术家|3-品牌方|4-厂牌]", allowableValues = "1,2,3,4"),
}) })
@Log(title = "店铺管理:标签库:新建", businessType = BusinessType.INSERT) @Log(title = "店铺管理:标签库:新建", businessType = BusinessType.INSERT)
@RequiresPermissions("goblin:tag:add") @RequiresPermissions("goblin:tag:add")
@PostMapping("addSave") @PostMapping("addSave")
@ResponseBody @ResponseBody
public AjaxResult addSave(String tagName, String tagPic, String tagType) { public AjaxResult addSave(String tagName, String tagPic) {
GoblinSelfTag selfTag = new GoblinSelfTag(); GoblinSelfTag selfTag = new GoblinSelfTag();
selfTag.setTagId(IDGenerator.nextMilliId2()); selfTag.setTagId(IDGenerator.nextMilliId2());
selfTag.setTagName(tagName); selfTag.setTagName(tagName);
selfTag.setTagPic(tagPic); selfTag.setTagPic(tagPic);
selfTag.setTagType(tagType); selfTag.setTagType("0");
selfTag.setTagBelong("1"); selfTag.setTagBelong("1");
return toAjax(goblinSelfTagService.save(selfTag)); return toAjax(goblinSelfTagService.save(selfTag));
...@@ -129,8 +128,9 @@ public class GoblinSelfTagController extends BaseController { ...@@ -129,8 +128,9 @@ public class GoblinSelfTagController extends BaseController {
@PostMapping("rmv") @PostMapping("rmv")
@ResponseBody @ResponseBody
public AjaxResult rmv(String tagIds) { public AjaxResult rmv(String tagIds) {
return toAjax(goblinSelfTagService.update( return toAjax(goblinSelfTagService.update(Wrappers.lambdaUpdate(GoblinSelfTag.class)
Wrappers.lambdaUpdate(GoblinSelfTag.class).in(GoblinSelfTag::getTagId, Convert.toStrArray(tagIds)).set(GoblinSelfTag::getDelFlg, "1") .in(GoblinSelfTag::getTagId, Convert.toStrArray(tagIds))
.set(GoblinSelfTag::getDelFlg, "1")
)); ));
} }
} }
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('商品分类列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="role-form">
<div class="select-list">
<ul>
<li>
名称:<input type="text" name="tagName"/>
</li>
<li>
类型:<select name="tagType" th:with="type=${@dict.getType('zhengzai_store_cert_type')}">
<option value="">全部</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="" shiro:hasPermission="goblin:extag:add">
<i class="fa fa-plus"></i> 新增
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="goblin:extag:rmv">
<i class="fa fa-remove"></i> 删除
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
var rmvFlg = [[${@permission.hasPermi('goblin:category:rmv')}]];
var prefix = ctx + "goblin/extag";
$(function () {
var options = {
url: prefix + "/list",
removeUrl: prefix + "/rmv",
sortName: "mid",
modalName: "商品分类",
columns: [{
checkbox: true
},
{
field: 'fname',
title: '一级分类'
},
{
field: 'sname',
title: '二级分类'
},
{
field: 'tname',
title: '二级分类'
},
{
field: 'fcounts',
title: '关联商品数量'
},
{
title: '操作',
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-danger btn-xs ' + rmvFlg + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.fcateId + '\')"><i class="fa fa-trash"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>
\ No newline at end of file
package com.liquidnet.client.admin.zhengzai.goblin.service; package com.liquidnet.client.admin.zhengzai.goblin.service;
import com.liquidnet.service.goblin.dto.GoblinSelfGoodsCategoryDto;
import com.liquidnet.service.goblin.entity.GoblinSelfGoodsCategory; import com.liquidnet.service.goblin.entity.GoblinSelfGoodsCategory;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/** /**
* <p> * <p>
* 平台商品分类 服务类 * 平台商品分类 服务类
...@@ -13,4 +16,5 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -13,4 +16,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/ */
public interface IGoblinSelfGoodsCategoryService extends IService<GoblinSelfGoodsCategory> { public interface IGoblinSelfGoodsCategoryService extends IService<GoblinSelfGoodsCategory> {
List<GoblinSelfGoodsCategoryDto> listForForMultiGrade();
} }
...@@ -2,10 +2,14 @@ package com.liquidnet.client.admin.zhengzai.goblin.service.impl; ...@@ -2,10 +2,14 @@ package com.liquidnet.client.admin.zhengzai.goblin.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.client.admin.zhengzai.goblin.service.IGoblinSelfGoodsCategoryService; import com.liquidnet.client.admin.zhengzai.goblin.service.IGoblinSelfGoodsCategoryService;
import com.liquidnet.service.goblin.dto.GoblinSelfGoodsCategoryDto;
import com.liquidnet.service.goblin.entity.GoblinSelfGoodsCategory; import com.liquidnet.service.goblin.entity.GoblinSelfGoodsCategory;
import com.liquidnet.service.goblin.mapper.GoblinSelfGoodsCategoryMapper; import com.liquidnet.service.goblin.mapper.GoblinSelfGoodsCategoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* <p> * <p>
* 平台商品分类 服务实现类 * 平台商品分类 服务实现类
...@@ -16,5 +20,11 @@ import org.springframework.stereotype.Service; ...@@ -16,5 +20,11 @@ import org.springframework.stereotype.Service;
*/ */
@Service @Service
public class GoblinSelfGoodsCategoryServiceImpl extends ServiceImpl<GoblinSelfGoodsCategoryMapper, GoblinSelfGoodsCategory> implements IGoblinSelfGoodsCategoryService { public class GoblinSelfGoodsCategoryServiceImpl extends ServiceImpl<GoblinSelfGoodsCategoryMapper, GoblinSelfGoodsCategory> implements IGoblinSelfGoodsCategoryService {
@Autowired
private GoblinSelfGoodsCategoryMapper goblinSelfGoodsCategoryMapper;
@Override
public List<GoblinSelfGoodsCategoryDto> listForForMultiGrade() {
return goblinSelfGoodsCategoryMapper.listForForMultiGrade();
}
} }
package com.liquidnet.service.goblin.dto;
import lombok.Data;
import java.io.Serializable;
@Data
public class GoblinSelfGoodsCategoryDto implements Serializable {
private static final long serialVersionUID = -5441075103192460342L;
private String fcateId;
private String fname;
private String ficon;
private String fneIsbn;
private Integer fcounts;
private String scateId;
private String sname;
private String sicon;
private String sneIsbn;
private Integer scounts;
private String tcateId;
private String tname;
private String ticon;
private String tneIsbn;
private Integer tcounts;
}
package com.liquidnet.service.goblin.mapper; package com.liquidnet.service.goblin.mapper;
import com.liquidnet.service.goblin.dto.GoblinSelfGoodsCategoryDto;
import com.liquidnet.service.goblin.entity.GoblinSelfGoodsCategory; import com.liquidnet.service.goblin.entity.GoblinSelfGoodsCategory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/** /**
* <p> * <p>
...@@ -12,5 +16,29 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -12,5 +16,29 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @since 2021-12-27 * @since 2021-12-27
*/ */
public interface GoblinSelfGoodsCategoryMapper extends BaseMapper<GoblinSelfGoodsCategory> { public interface GoblinSelfGoodsCategoryMapper extends BaseMapper<GoblinSelfGoodsCategory> {
// SELECT cf.cate_id AS cateFid, cf.name AS fname, cf.icon AS ficon, cf.ne_isbn AS fneIsbn, cf.counts AS fcounts , cs.cate_id AS cateSid, cs.name AS sname, cs.icon AS sicon, cs.ne_isbn AS sneIsbn, cs.counts AS scounts , ct.cate_id AS cateTid, ct.name AS tname, ct.icon AS ticon, ct.ne_isbn AS tneIsbn, ct.counts AS tcounts FROM goblin_self_goods_category cf LEFT JOIN ( SELECT cate_id, name, icon, grade, ne_isbn , counts, cate_pid FROM goblin_self_goods_category WHERE grade = '2' AND del_flg = '0' ) cs ON cs.cate_pid = cf.cate_id LEFT JOIN ( SELECT cate_id, name, icon, grade, ne_isbn , counts, cate_pid FROM goblin_self_goods_category WHERE grade = '3' AND del_flg = '0' ) ct ON ct.cate_pid = cs.cate_id WHERE cf.grade = '1' AND del_flg = '0'
@Select({"select cf.cate_id cateFid,\n" +
" cf.name fname,\n" +
" cf.icon ficon,\n" +
" cf.ne_isbn fneIsbn,\n" +
" cf.counts fcounts,\n" +
" cs.cate_id cateSid,\n" +
" cs.name sname,\n" +
" cs.icon sicon,\n" +
" cs.ne_isbn sneIsbn,\n" +
" cs.counts scounts,\n" +
" ct.cate_id cateTid,\n" +
" ct.name tname,\n" +
" ct.icon ticon,\n" +
" ct.ne_isbn tneIsbn,\n" +
" ct.counts tcounts\n" +
"from goblin_self_goods_category cf\n" +
" left join (\n" +
" select cate_id, name, icon, grade, ne_isbn, counts, cate_pid from goblin_self_goods_category where grade = '2' and del_flg = '0'\n" +
") cs on cs.cate_pid = cf.cate_id\n" +
" left join (\n" +
" select cate_id, name, icon, grade, ne_isbn, counts, cate_pid from goblin_self_goods_category where grade = '3' and del_flg = '0'\n" +
") ct on ct.cate_pid = cs.cate_id\n" +
"where cf.grade = '1' and del_flg = '0'"})
List<GoblinSelfGoodsCategoryDto> listForForMultiGrade();
} }
Markdown is supported
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