Merge remote-tracking branch 'origin/zcc'
This commit is contained in:
@@ -279,19 +279,26 @@ public class MyUserController {
|
|||||||
String email = map.get("email").toString();
|
String email = map.get("email").toString();
|
||||||
String code = map.get("code").toString();
|
String code = map.get("code").toString();
|
||||||
Integer id = Integer.valueOf(map.get("id").toString());
|
Integer id = Integer.valueOf(map.get("id").toString());
|
||||||
String redisCode = redisTemplate.opsForValue().get("RegistCode"+email);
|
//查询是否存在当前邮箱
|
||||||
if(StringUtils.isEmpty(redisCode)){
|
LambdaQueryWrapper<MyUserEntity> wrapper = new LambdaQueryWrapper();
|
||||||
return R.error("验证码已过期,请重试");
|
wrapper.eq(MyUserEntity::getEmail,email);
|
||||||
|
MyUserEntity userEntity = userService.getOne(wrapper);
|
||||||
|
if (userEntity == null) {
|
||||||
|
String redisCode = redisTemplate.opsForValue().get("RegistCode"+email);
|
||||||
|
if(StringUtils.isEmpty(redisCode)){
|
||||||
|
return R.error("验证码已过期,请重试");
|
||||||
|
}
|
||||||
|
String lcode = redisCode.split("_")[0];
|
||||||
|
if (!lcode.equals(code)) {
|
||||||
|
return R.error("短信验证码不符!");
|
||||||
|
}
|
||||||
|
MyUserEntity userInfo = userService.getById(id);
|
||||||
|
userInfo.setEmail(email);
|
||||||
|
userService.updateById(userInfo);
|
||||||
|
return R.ok();
|
||||||
|
}else {
|
||||||
|
return R.error("邮箱已被绑定!");
|
||||||
}
|
}
|
||||||
String lcode = redisCode.split("_")[0];
|
|
||||||
if (!lcode.equals(code)) {
|
|
||||||
return R.error("短信验证码不符!");
|
|
||||||
}
|
|
||||||
MyUserEntity userInfo = userService.getById(id);
|
|
||||||
userInfo.setEmail(email);
|
|
||||||
userService.updateById(userInfo);
|
|
||||||
return R.ok();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/register")
|
@RequestMapping("/register")
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class ShopProductToMedicineLabel implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private ShopProduct product;
|
private ShopProduct product;
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private ShopProductToMedicineLabel label;
|
private ShopProductMedicineLabel label;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@@ -32,7 +31,7 @@ public class ShopProductToMedicineMarket implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private ShopProduct product;
|
private ShopProduct product;
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private ShopProductToMedicineMarket market;
|
private ShopProductMedicineMarket market;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,355 @@
|
|||||||
package com.peanut.modules.master.controller;
|
package com.peanut.modules.master.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.peanut.common.utils.R;
|
||||||
|
import com.peanut.modules.common.entity.*;
|
||||||
|
import com.peanut.modules.master.service.*;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 吴门医述医学商品标签、营销标签管理
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController("masterMedicineLabelAndMarket")
|
||||||
|
@RequestMapping("master/medicineLabelAndMarket")
|
||||||
public class MedicineLabelAndMarketController {
|
public class MedicineLabelAndMarketController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ShopProductMedicineLabelService labelService;
|
||||||
|
@Autowired
|
||||||
|
private ShopProductMedicineMarketService marketService;
|
||||||
|
@Autowired
|
||||||
|
private ShopProductToMedicineLabelService toLabelService;
|
||||||
|
@Autowired
|
||||||
|
private ShopProductToMedicineMarketService toMarketService;
|
||||||
|
@Autowired
|
||||||
|
private ShopProductService productService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标签树
|
||||||
|
*/
|
||||||
|
@RequestMapping(path = "/labelTree")
|
||||||
|
public R labelTree() {
|
||||||
|
List<ShopProductMedicineLabel> labelsTree = labelService.labelTree();
|
||||||
|
return R.ok().put("result", labelsTree);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取标签列表
|
||||||
|
*/
|
||||||
|
@RequestMapping(path = "/getLabelListByPid")
|
||||||
|
public R getLabelListByPid(String pid) {
|
||||||
|
LambdaQueryWrapper<ShopProductMedicineLabel> wrapper = new LambdaQueryWrapper();
|
||||||
|
wrapper.eq(ShopProductMedicineLabel::getPid,pid);
|
||||||
|
wrapper.orderByAsc(ShopProductMedicineLabel::getSort);
|
||||||
|
wrapper.orderByAsc(ShopProductMedicineLabel::getCreateTime);
|
||||||
|
List<ShopProductMedicineLabel> labelTopList = labelService.list(wrapper);
|
||||||
|
return R.ok().put("result", labelTopList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营销标签树
|
||||||
|
*/
|
||||||
|
@RequestMapping(path = "/marketTree")
|
||||||
|
public R marketTree() {
|
||||||
|
List<ShopProductMedicineMarket> marketsTree = marketService.marketTree();
|
||||||
|
return R.ok().put("result", marketsTree);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取营销标签列表
|
||||||
|
*/
|
||||||
|
@RequestMapping(path = "/getMakertListByPid")
|
||||||
|
public R getMakertListByPid(String pid) {
|
||||||
|
LambdaQueryWrapper<ShopProductMedicineMarket> wrapper = new LambdaQueryWrapper();
|
||||||
|
wrapper.eq(ShopProductMedicineMarket::getPid,pid);
|
||||||
|
wrapper.orderByAsc(ShopProductMedicineMarket::getSort);
|
||||||
|
wrapper.orderByAsc(ShopProductMedicineMarket::getCreateTime);
|
||||||
|
List<ShopProductMedicineMarket> marketTopList = marketService.list(wrapper);
|
||||||
|
return R.ok().put("result", marketTopList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(path = "/getLabelById")
|
||||||
|
public R getLabelById(String id) {
|
||||||
|
return R.ok().put("result",labelService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(path = "/saveOrUpdateLabel")
|
||||||
|
public R saveOrUpdateLabel(@RequestBody ShopProductMedicineLabel label) {
|
||||||
|
if (label.getId()==null){
|
||||||
|
if(label.getPid()==0){
|
||||||
|
labelService.save(label);
|
||||||
|
return R.ok().put("result",label);
|
||||||
|
}else {
|
||||||
|
ShopProductMedicineLabel l = labelService.getById(label.getPid());
|
||||||
|
if (l.getIsLast()==1){
|
||||||
|
return R.error("请将父标签设置为非最后一集");
|
||||||
|
}else {
|
||||||
|
labelService.save(label);
|
||||||
|
return R.ok().put("result",label);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if (label.getIsLast() == 1){
|
||||||
|
List llast = labelService.list(new LambdaQueryWrapper<ShopProductMedicineLabel>()
|
||||||
|
.eq(ShopProductMedicineLabel::getPid,label.getId()));
|
||||||
|
if (llast.size()>0){
|
||||||
|
return R.error("请先删除子集,再设置为最后一集");
|
||||||
|
}else {
|
||||||
|
labelService.saveOrUpdate(label);
|
||||||
|
return R.ok().put("result",label);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
labelService.saveOrUpdate(label);
|
||||||
|
return R.ok().put("result",label);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(path = "/delLabel")
|
||||||
|
public R delLabel(String id) {
|
||||||
|
ShopProductMedicineLabel label = labelService.getById(id);
|
||||||
|
if (label.getIsLast()==1){
|
||||||
|
MPJLambdaWrapper<ShopProductToMedicineLabel> wrapper = new MPJLambdaWrapper();
|
||||||
|
wrapper.eq(ShopProductToMedicineLabel::getMedicineLabelId,id);
|
||||||
|
List<ShopProductToMedicineLabel> tolables = toLabelService.list(wrapper);
|
||||||
|
if (tolables.size()>0){
|
||||||
|
return R.error("请先移除商品");
|
||||||
|
}else {
|
||||||
|
labelService.removeById(id);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
List<ShopProductMedicineLabel> labelList = labelService.list(new LambdaQueryWrapper<ShopProductMedicineLabel>().eq(ShopProductMedicineLabel::getPid,id));
|
||||||
|
if (labelList.size() > 0) {
|
||||||
|
return R.error("请先删除子集");
|
||||||
|
}else {
|
||||||
|
labelService.removeById(id);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(path = "/getMarketById")
|
||||||
|
public R getMarketById(String id) {
|
||||||
|
return R.ok().put("result",marketService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(path = "/saveOrUpdateMarket")
|
||||||
|
public R saveOrUpdateMarket(@RequestBody ShopProductMedicineMarket market) {
|
||||||
|
if (market.getId()==null){
|
||||||
|
if(market.getPid()==0){
|
||||||
|
marketService.save(market);
|
||||||
|
return R.ok().put("result",market);
|
||||||
|
}else {
|
||||||
|
ShopProductMedicineMarket m = marketService.getById(market.getPid());
|
||||||
|
if (m.getIsLast()==1){
|
||||||
|
return R.error("请将父标签设置为非最后一集");
|
||||||
|
}else {
|
||||||
|
marketService.save(market);
|
||||||
|
return R.ok().put("result",market);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if (market.getIsLast() == 1){
|
||||||
|
List mList = marketService.list(new LambdaQueryWrapper<ShopProductMedicineMarket>()
|
||||||
|
.eq(ShopProductMedicineMarket::getPid,market.getId()));
|
||||||
|
if (mList.size()>0){
|
||||||
|
return R.error("请先删除子集,再设置为最后一集");
|
||||||
|
}else {
|
||||||
|
marketService.saveOrUpdate(market);
|
||||||
|
return R.ok().put("result",market);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
marketService.saveOrUpdate(market);
|
||||||
|
return R.ok().put("result",market);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(path = "/delMarket")
|
||||||
|
public R delMarket(String id) {
|
||||||
|
ShopProductMedicineMarket market = marketService.getById(id);
|
||||||
|
if (market.getIsLast()==1){
|
||||||
|
MPJLambdaWrapper<ShopProductToMedicineMarket> wrapper = new MPJLambdaWrapper();
|
||||||
|
wrapper.eq(ShopProductToMedicineMarket::getMedicineMarketId,id);
|
||||||
|
List<ShopProductToMedicineMarket> tomarkets = toMarketService.list(wrapper);
|
||||||
|
if (tomarkets.size()>0){
|
||||||
|
return R.error("请先移除商品");
|
||||||
|
}else {
|
||||||
|
marketService.removeById(id);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
List<ShopProductMedicineMarket> marketList = marketService.list(new LambdaQueryWrapper<ShopProductMedicineMarket>().eq(ShopProductMedicineMarket::getPid,id));
|
||||||
|
if (marketList.size() > 0) {
|
||||||
|
return R.error("请先删除子集");
|
||||||
|
}else {
|
||||||
|
marketService.removeById(id);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取未关联商品列表
|
||||||
|
*/
|
||||||
|
@RequestMapping("/getNotToLabelList")
|
||||||
|
public R getNotToLabelList(@RequestBody Map params){
|
||||||
|
LambdaQueryWrapper<ShopProduct> wrapper = new LambdaQueryWrapper();
|
||||||
|
if (params.containsKey("goodsType")&&!"".equals(params.get("goodsType").toString())){
|
||||||
|
wrapper.eq(ShopProduct::getGoodsType,params.get("goodsType").toString());
|
||||||
|
}
|
||||||
|
if (params.containsKey("productName")&&!"".equals(params.get("productName").toString())){
|
||||||
|
wrapper.like(ShopProduct::getProductName,params.get("productName").toString());
|
||||||
|
}
|
||||||
|
if (params.containsKey("medicineLabelId")&&!"".equals(params.get("medicineLabelId").toString())){
|
||||||
|
String sql = "select product_id from shop_product_to_medicine_label where del_flag = 0 and medicine_label_id = "+params.get("medicineLabelId");
|
||||||
|
wrapper.notInSql(ShopProduct::getProductId,sql);
|
||||||
|
}
|
||||||
|
if (params.containsKey("medicineMarketId")&&!"".equals(params.get("medicineMarketId").toString())){
|
||||||
|
String sql = "select product_id from shop_product_to_medicine_market where del_flag = 0 and medicine_market_id = "+params.get("medicineMarketId");
|
||||||
|
wrapper.notInSql(ShopProduct::getProductId,sql);
|
||||||
|
}
|
||||||
|
Page<ShopProduct> page = productService.page(new Page<>(
|
||||||
|
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
|
||||||
|
return R.ok().put("result", page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取书标签列表
|
||||||
|
*/
|
||||||
|
@RequestMapping("/getToLabelList")
|
||||||
|
public R getToLabelList(@RequestBody Map params){
|
||||||
|
MPJLambdaWrapper<ShopProductToMedicineLabel> wrapper = new MPJLambdaWrapper();
|
||||||
|
wrapper.selectAll(ShopProductToMedicineLabel.class);
|
||||||
|
wrapper.leftJoin(ShopProduct.class,ShopProduct::getProductId,ShopProductToMedicineLabel::getProductId);
|
||||||
|
if (params.containsKey("productName")&&!"".equals(params.get("productName").toString())){
|
||||||
|
wrapper.like(ShopProduct::getProductName,params.get("productName").toString());
|
||||||
|
}
|
||||||
|
if (params.containsKey("goodsType")&&!"".equals(params.get("goodsType").toString())){
|
||||||
|
wrapper.eq(ShopProduct::getGoodsType,params.get("goodsType").toString());
|
||||||
|
}
|
||||||
|
if (params.containsKey("productId")&&!"".equals(params.get("productId").toString())){
|
||||||
|
wrapper.eq(ShopProductToMedicineLabel::getProductId,params.get("productId").toString());
|
||||||
|
}
|
||||||
|
if (params.containsKey("medicineLabelId")&&!"".equals(params.get("medicineLabelId").toString())){
|
||||||
|
wrapper.eq(ShopProductToMedicineLabel::getMedicineLabelId,params.get("medicineLabelId").toString());
|
||||||
|
}
|
||||||
|
Page<ShopProductToMedicineLabel> page = toLabelService.page(new Page<>(
|
||||||
|
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
|
||||||
|
List<ShopProductToMedicineLabel> res = page.getRecords();
|
||||||
|
if (res.size() > 0) {
|
||||||
|
for (ShopProductToMedicineLabel item : res) {
|
||||||
|
item.setProduct(productService.getById(item.getProductId()));
|
||||||
|
item.setLabel(labelService.getById(item.getMedicineLabelId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
page.setRecords(res);
|
||||||
|
return R.ok().put("result", page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取营销标签列表
|
||||||
|
*/
|
||||||
|
@RequestMapping("/getToMarketList")
|
||||||
|
public R getToMarketList(@RequestBody Map params){
|
||||||
|
MPJLambdaWrapper<ShopProductToMedicineMarket> wrapper = new MPJLambdaWrapper();
|
||||||
|
wrapper.selectAll(ShopProductToMedicineMarket.class);
|
||||||
|
wrapper.leftJoin(ShopProduct.class,ShopProduct::getProductId,ShopProductToMedicineMarket::getProductId);
|
||||||
|
if (params.containsKey("productName")&&!"".equals(params.get("productName").toString())){
|
||||||
|
wrapper.like(ShopProduct::getProductName,params.get("productName").toString());
|
||||||
|
}
|
||||||
|
if (params.containsKey("goodsType")&&!"".equals(params.get("goodsType").toString())){
|
||||||
|
wrapper.eq(ShopProduct::getGoodsType,params.get("goodsType").toString());
|
||||||
|
}
|
||||||
|
if (params.containsKey("productId")&&!"".equals(params.get("productId").toString())){
|
||||||
|
wrapper.eq(ShopProductToBookMarket::getProductId,params.get("productId").toString());
|
||||||
|
}
|
||||||
|
if (params.containsKey("medicineMarketId")&&!"".equals(params.get("medicineMarketId").toString())){
|
||||||
|
wrapper.eq(ShopProductToMedicineMarket::getMedicineMarketId,params.get("medicineMarketId").toString());
|
||||||
|
}
|
||||||
|
Page<ShopProductToMedicineMarket> page = toMarketService.page(new Page<>(
|
||||||
|
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
|
||||||
|
List<ShopProductToMedicineMarket> res = page.getRecords();
|
||||||
|
if (res.size() > 0) {
|
||||||
|
for (ShopProductToMedicineMarket item : res) {
|
||||||
|
item.setProduct(productService.getById(item.getProductId()));
|
||||||
|
item.setMarket(marketService.getById(item.getMedicineMarketId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
page.setRecords(res);
|
||||||
|
return R.ok().put("result", page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(path = "/saveToLabel")
|
||||||
|
public R saveToLabel(@RequestBody Map params) {
|
||||||
|
if (!StringUtils.isEmpty(params.get("productId").toString())){
|
||||||
|
String[] ids = params.get("productId").toString().split(",");
|
||||||
|
if (ids.length > 0) {
|
||||||
|
for (String id : ids) {
|
||||||
|
ShopProductToMedicineLabel toLabel = new ShopProductToMedicineLabel();
|
||||||
|
toLabel.setMedicineLabelId(Integer.parseInt(params.get("medicineLabelId").toString()));
|
||||||
|
toLabel.setProductId(Integer.parseInt(id));
|
||||||
|
toLabelService.save(toLabel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(path = "/saveToMarket")
|
||||||
|
public R saveToMarket(@RequestBody Map params) {
|
||||||
|
if (!StringUtils.isEmpty(params.get("productId").toString())){
|
||||||
|
String[] ids = params.get("productId").toString().split(",");
|
||||||
|
if (ids.length > 0) {
|
||||||
|
for (String id : ids) {
|
||||||
|
ShopProductToMedicineMarket toMarket = new ShopProductToMedicineMarket();
|
||||||
|
toMarket.setMedicineMarketId(Integer.parseInt(params.get("medicineMarketId").toString()));
|
||||||
|
toMarket.setProductId(Integer.parseInt(id));
|
||||||
|
toMarketService.save(toMarket);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(path = "/delToLable")
|
||||||
|
public R delToLable(String lableId,String productId) {
|
||||||
|
if(StringUtils.isNotEmpty(productId)){
|
||||||
|
String[] productIds = productId.split(",");
|
||||||
|
for(String id : productIds){
|
||||||
|
LambdaQueryWrapper<ShopProductToMedicineLabel> wrapper = new LambdaQueryWrapper();
|
||||||
|
wrapper.eq(ShopProductToMedicineLabel::getMedicineLabelId,lableId);
|
||||||
|
wrapper.eq(ShopProductToMedicineLabel::getProductId,id);
|
||||||
|
toLabelService.remove(wrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(path = "/delToMarket")
|
||||||
|
public R delToMarket(String marketId,String productId) {
|
||||||
|
if(StringUtils.isNotEmpty(productId)){
|
||||||
|
String[] productIds = productId.split(",");
|
||||||
|
for(String id : productIds){
|
||||||
|
LambdaQueryWrapper<ShopProductToMedicineMarket> wrapper = new LambdaQueryWrapper();
|
||||||
|
wrapper.eq(ShopProductToMedicineMarket::getMedicineMarketId,marketId);
|
||||||
|
wrapper.eq(ShopProductToMedicineMarket::getProductId,id);
|
||||||
|
toMarketService.remove(wrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ public class SociologyLabelAndMarketController {
|
|||||||
String sql = "select product_id from shop_product_to_sociology_label where del_flag = 0 and sociology_label_id = "+params.get("sociologyLabelId");
|
String sql = "select product_id from shop_product_to_sociology_label where del_flag = 0 and sociology_label_id = "+params.get("sociologyLabelId");
|
||||||
wrapper.notInSql(ShopProduct::getProductId,sql);
|
wrapper.notInSql(ShopProduct::getProductId,sql);
|
||||||
}
|
}
|
||||||
if (params.containsKey("bookMarketId")&&!"".equals(params.get("bookMarketId").toString())){
|
if (params.containsKey("sociologyMarketId")&&!"".equals(params.get("sociologyMarketId").toString())){
|
||||||
String sql = "select product_id from shop_product_to_sociology_market where del_flag = 0 and sociology_market_id = "+params.get("sociologyMarketId");
|
String sql = "select product_id from shop_product_to_sociology_market where del_flag = 0 and sociology_market_id = "+params.get("sociologyMarketId");
|
||||||
wrapper.notInSql(ShopProduct::getProductId,sql);
|
wrapper.notInSql(ShopProduct::getProductId,sql);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ package com.peanut.modules.master.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.peanut.modules.common.entity.ShopProductMedicineLabel;
|
import com.peanut.modules.common.entity.ShopProductMedicineLabel;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface ShopProductMedicineLabelService extends IService<ShopProductMedicineLabel> {
|
public interface ShopProductMedicineLabelService extends IService<ShopProductMedicineLabel> {
|
||||||
|
|
||||||
|
List<ShopProductMedicineLabel> labelTree();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package com.peanut.modules.master.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.peanut.modules.common.entity.ShopProductMedicineMarket;
|
import com.peanut.modules.common.entity.ShopProductMedicineMarket;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface ShopProductMedicineMarketService extends IService<ShopProductMedicineMarket> {
|
public interface ShopProductMedicineMarketService extends IService<ShopProductMedicineMarket> {
|
||||||
|
|
||||||
|
List<ShopProductMedicineMarket> marketTree();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,9 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> impl
|
|||||||
public Page getCourseListCanSociology(ParamTo param) {
|
public Page getCourseListCanSociology(ParamTo param) {
|
||||||
List<Integer> collect = courseToSociologyDao.selectList(new LambdaQueryWrapper<CourseToSociologyEntity>().eq(CourseToSociologyEntity::getSociologyId, param.getId())).stream().map(CourseToSociologyEntity::getCourseId).collect(Collectors.toList());
|
List<Integer> collect = courseToSociologyDao.selectList(new LambdaQueryWrapper<CourseToSociologyEntity>().eq(CourseToSociologyEntity::getSociologyId, param.getId())).stream().map(CourseToSociologyEntity::getCourseId).collect(Collectors.toList());
|
||||||
LambdaQueryWrapper<CourseEntity> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CourseEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.notIn(CourseEntity::getId,collect);
|
if (collect.size() != 0){
|
||||||
|
wrapper.notIn(CourseEntity::getId,collect);
|
||||||
|
}
|
||||||
wrapper.like(StringUtils.isNotBlank(param.getKeywords()),CourseEntity::getTitle,param.getKeywords());
|
wrapper.like(StringUtils.isNotBlank(param.getKeywords()),CourseEntity::getTitle,param.getKeywords());
|
||||||
Page<CourseEntity> page = this.page(new Page<>(param.getPage(), param.getLimit()), wrapper);
|
Page<CourseEntity> page = this.page(new Page<>(param.getPage(), param.getLimit()), wrapper);
|
||||||
return page;
|
return page;
|
||||||
|
|||||||
@@ -1,13 +1,45 @@
|
|||||||
package com.peanut.modules.master.service.impl;
|
package com.peanut.modules.master.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.peanut.modules.common.dao.ShopProductMedicineLabelDao;
|
import com.peanut.modules.common.dao.ShopProductMedicineLabelDao;
|
||||||
import com.peanut.modules.common.entity.ShopProductMedicineLabel;
|
import com.peanut.modules.common.entity.ShopProductMedicineLabel;
|
||||||
import com.peanut.modules.medical.service.ShopProductMedicineLabelService;
|
import com.peanut.modules.master.service.ShopProductMedicineLabelService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service("masterShopProductMedicineLabelService")
|
@Service("masterShopProductMedicineLabelService")
|
||||||
public class ShopProductMedicineLabelServiceImpl extends ServiceImpl<ShopProductMedicineLabelDao, ShopProductMedicineLabel> implements ShopProductMedicineLabelService {
|
public class ShopProductMedicineLabelServiceImpl extends ServiceImpl<ShopProductMedicineLabelDao, ShopProductMedicineLabel> implements ShopProductMedicineLabelService {
|
||||||
|
@Autowired
|
||||||
|
private ShopProductMedicineLabelDao labelDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ShopProductMedicineLabel> labelTree() {
|
||||||
|
List<ShopProductMedicineLabel> labels = labelDao.selectList(new QueryWrapper<>());
|
||||||
|
List<ShopProductMedicineLabel> labelsTree = labels.stream().filter((shopProductMedicineLabel) ->
|
||||||
|
shopProductMedicineLabel.getPid() == 0
|
||||||
|
).map((label)->{
|
||||||
|
label.setChildren(getLabelChildrens(label,labels));
|
||||||
|
return label;
|
||||||
|
}).sorted((label1,label2)->{
|
||||||
|
return (label1.getSort() == null? 0 : label1.getSort()) - (label2.getSort()==null?0:label2.getSort());
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return labelsTree;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ShopProductMedicineLabel> getLabelChildrens(ShopProductMedicineLabel root,List<ShopProductMedicineLabel> all){
|
||||||
|
List<ShopProductMedicineLabel> children = all.stream().filter(shopProductMedicineLabel -> {
|
||||||
|
return root.getId().equals(shopProductMedicineLabel.getPid());
|
||||||
|
}).map(shopProductMedicineLabel -> {
|
||||||
|
shopProductMedicineLabel.setChildren(getLabelChildrens(shopProductMedicineLabel, all));
|
||||||
|
return shopProductMedicineLabel;
|
||||||
|
}).sorted((label1,label2)->{
|
||||||
|
return (label1.getSort()==null?0:label1.getSort()) - (label2.getSort()==null?0:label2.getSort());
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return children;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,45 @@
|
|||||||
package com.peanut.modules.master.service.impl;
|
package com.peanut.modules.master.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.peanut.modules.common.dao.ShopProductMedicineMarketDao;
|
import com.peanut.modules.common.dao.ShopProductMedicineMarketDao;
|
||||||
import com.peanut.modules.common.entity.ShopProductMedicineMarket;
|
import com.peanut.modules.common.entity.ShopProductMedicineMarket;
|
||||||
import com.peanut.modules.medical.service.ShopProductMedicineMarketService;
|
import com.peanut.modules.master.service.ShopProductMedicineMarketService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service("masterShopProductMedicineMarketService")
|
@Service("masterShopProductMedicineMarketService")
|
||||||
public class ShopProductMedicineMarketServiceImpl extends ServiceImpl<ShopProductMedicineMarketDao, ShopProductMedicineMarket> implements ShopProductMedicineMarketService {
|
public class ShopProductMedicineMarketServiceImpl extends ServiceImpl<ShopProductMedicineMarketDao, ShopProductMedicineMarket> implements ShopProductMedicineMarketService {
|
||||||
|
@Autowired
|
||||||
|
private ShopProductMedicineMarketDao marketDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ShopProductMedicineMarket> marketTree() {
|
||||||
|
List<ShopProductMedicineMarket> markets = marketDao.selectList(new QueryWrapper<>());
|
||||||
|
List<ShopProductMedicineMarket> marketsTree = markets.stream().filter((shopProductMedicineMarket) ->
|
||||||
|
shopProductMedicineMarket.getPid() == 0
|
||||||
|
).map((market)->{
|
||||||
|
market.setChildren(getMarketChildrens(market,markets));
|
||||||
|
return market;
|
||||||
|
}).sorted((sort1,sort2)->{
|
||||||
|
return (sort1.getSort() == null? 0 : sort1.getSort()) - (sort2.getSort()==null?0:sort2.getSort());
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return marketsTree;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<ShopProductMedicineMarket> getMarketChildrens(ShopProductMedicineMarket root,List<ShopProductMedicineMarket> all){
|
||||||
|
List<ShopProductMedicineMarket> children = all.stream().filter(shopProductMedicineMarket -> {
|
||||||
|
return root.getId().equals(shopProductMedicineMarket.getPid());
|
||||||
|
}).map(shopProductMedicineMarket -> {
|
||||||
|
shopProductMedicineMarket.setChildren(getMarketChildrens(shopProductMedicineMarket, all));
|
||||||
|
return shopProductMedicineMarket;
|
||||||
|
}).sorted((sort1,sort2)->{
|
||||||
|
return (sort1.getSort()==null?0:sort1.getSort()) - (sort2.getSort()==null?0:sort2.getSort());
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return children;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.peanut.modules.master.service.impl;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.peanut.modules.common.dao.ShopProductToMedicineLabelDao;
|
import com.peanut.modules.common.dao.ShopProductToMedicineLabelDao;
|
||||||
import com.peanut.modules.common.entity.ShopProductToMedicineLabel;
|
import com.peanut.modules.common.entity.ShopProductToMedicineLabel;
|
||||||
import com.peanut.modules.medical.service.ShopProductToMedicineLabelService;
|
import com.peanut.modules.master.service.ShopProductToMedicineLabelService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.peanut.modules.master.service.impl;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.peanut.modules.common.dao.ShopProductToMedicineMarketDao;
|
import com.peanut.modules.common.dao.ShopProductToMedicineMarketDao;
|
||||||
import com.peanut.modules.common.entity.ShopProductToMedicineMarket;
|
import com.peanut.modules.common.entity.ShopProductToMedicineMarket;
|
||||||
import com.peanut.modules.medical.service.ShopProductToMedicineMarketService;
|
import com.peanut.modules.master.service.ShopProductToMedicineMarketService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user