心灵空间
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
package com.peanut.modules.master.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.CourseEntity;
|
||||
import com.peanut.modules.common.entity.CoursePsyche;
|
||||
import com.peanut.modules.common.entity.CourseToPsyche;
|
||||
import com.peanut.modules.common.service.CoursePsycheService;
|
||||
import com.peanut.modules.common.service.CourseToPsycheService;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
import com.peanut.modules.master.service.CourseService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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;
|
||||
|
||||
@Slf4j
|
||||
@RestController("masterCoursePsyche")
|
||||
@RequestMapping("master/coursePsyche")
|
||||
public class CoursePsycheController {
|
||||
@Autowired
|
||||
private CoursePsycheService coursePsycheService;
|
||||
@Autowired
|
||||
private CourseToPsycheService courseToPsycheService;
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
|
||||
@RequestMapping("/getCoursePsycheList")
|
||||
public R getCoursePsycheList(){
|
||||
List<CoursePsyche> coursePsycheList = coursePsycheService.getCoursePsycheList();
|
||||
return R.ok().put("Psyches",coursePsycheList);
|
||||
}
|
||||
|
||||
@RequestMapping("/addCoursePsyche")
|
||||
public R addCoursePsyche(@RequestBody CoursePsyche coursePsyche){
|
||||
coursePsycheService.save(coursePsyche);
|
||||
return R.ok().put("Psyche",coursePsyche);
|
||||
}
|
||||
|
||||
@RequestMapping("/delCoursePsyche")
|
||||
public R delCoursePsyche(@RequestBody ParamTo param){
|
||||
return coursePsycheService.delCoursePsyche(param.getId());
|
||||
}
|
||||
|
||||
@RequestMapping("/editCoursePsyche")
|
||||
public R editCoursePsyche(@RequestBody CoursePsyche coursePsyche){
|
||||
return coursePsycheService.editCoursePsyche(coursePsyche);
|
||||
}
|
||||
|
||||
@RequestMapping("/getCourseListForPsyche")
|
||||
public R getCourseListForPsyche(@RequestBody ParamTo param){
|
||||
List<CourseEntity> courseListForPsyche = courseService.getCourseListForPsyche(param.getId());
|
||||
return R.ok().put("courseList",courseListForPsyche);
|
||||
}
|
||||
|
||||
@RequestMapping("/getCourseListCanPsyche")
|
||||
public R getCourseListCanPsyche(@RequestBody ParamTo param){
|
||||
Page courseListCanPsyche = courseService.getCourseListCanPsyche(param);
|
||||
return R.ok().put("page",courseListCanPsyche);
|
||||
}
|
||||
|
||||
@RequestMapping("/bindCourseAndPsyche")
|
||||
public R bindCourseAndPsyche(@RequestBody CourseToPsyche courseToPsyche){
|
||||
return courseToPsycheService.bindCourseAndPsyche(courseToPsyche);
|
||||
}
|
||||
|
||||
@RequestMapping("/unbindCourseAndPsyche")
|
||||
public R unbindCourseAndPsyche(@RequestBody CourseToPsyche courseToPsyche){
|
||||
boolean b = courseToPsycheService.removeById(courseToPsyche.getId());
|
||||
if(b){
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error("error");
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/updateCourseToPsycheSort")
|
||||
public R updateCourseToPsycheSort(@RequestBody CourseToPsyche courseToPsyche){
|
||||
courseToPsycheService.updateById(courseToPsyche);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
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.CourseEntity;
|
||||
import com.peanut.modules.common.entity.CoursePsycheMarket;
|
||||
import com.peanut.modules.common.entity.CourseToPsycheMarket;
|
||||
import com.peanut.modules.common.service.CoursePsycheMarketService;
|
||||
import com.peanut.modules.common.service.CourseToPsycheMarketService;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
import com.peanut.modules.master.service.CourseService;
|
||||
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;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@RestController("masterCoursePsycheMarket")
|
||||
@RequestMapping("master/coursePsycheMarket")
|
||||
public class CoursePsycheMarketController {
|
||||
|
||||
@Autowired
|
||||
private CoursePsycheMarketService marketService;
|
||||
@Autowired
|
||||
private CourseToPsycheMarketService toMarketService;
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
|
||||
/**
|
||||
* 营销标签树
|
||||
*/
|
||||
@RequestMapping(path = "/marketTree")
|
||||
public R marketTree() {
|
||||
List<CoursePsycheMarket> coursePsycheMarketEntities = marketService.marketTree();
|
||||
return R.ok().put("result", coursePsycheMarketEntities);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/getMarketById")
|
||||
public R getMarketById(@RequestBody Map<String,Integer> map) {
|
||||
int id = map.get("id");
|
||||
return R.ok().put("result",marketService.getById(id));
|
||||
}
|
||||
|
||||
@RequestMapping("/addPsycheMarket")
|
||||
public R addPsycheMarket(@RequestBody CoursePsycheMarket coursePsycheMarket){
|
||||
marketService.save(coursePsycheMarket);
|
||||
return R.ok().put("market",coursePsycheMarket);
|
||||
}
|
||||
|
||||
@RequestMapping("/editPsycheMarket")
|
||||
public R editPsycheMarket(@RequestBody CoursePsycheMarket coursePsycheMarket){
|
||||
CoursePsycheMarket old = marketService.getById(coursePsycheMarket.getId());
|
||||
if(coursePsycheMarket.getIsLast()==1&&old.getIsLast()==0){//非终节点到终结点,要排除是否存在子集
|
||||
Integer integer = marketService.getBaseMapper().selectCount(new LambdaQueryWrapper<CoursePsycheMarket>().eq(CoursePsycheMarket::getPid, coursePsycheMarket.getId()));
|
||||
if(integer>0){
|
||||
return R.error("请先清空子集再操作!");
|
||||
}
|
||||
}
|
||||
|
||||
if(coursePsycheMarket.getIsLast()==0&&old.getIsLast()==1){
|
||||
Integer integer = toMarketService.getBaseMapper().selectCount(new LambdaQueryWrapper<CourseToPsycheMarket>().eq(CourseToPsycheMarket::getPsycheMarketId, coursePsycheMarket.getId()));
|
||||
if(integer>0){
|
||||
return R.error("请先清空绑定的课程后,再操作");
|
||||
}
|
||||
}
|
||||
marketService.updateById(coursePsycheMarket);
|
||||
return R.ok().put("market",coursePsycheMarket);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/delMarket")
|
||||
public R delMarket(@RequestBody Map<String ,Integer> map) {
|
||||
int id = map.get("id");
|
||||
CoursePsycheMarket market = marketService.getById(id);
|
||||
if (market.getIsLast()==1){
|
||||
MPJLambdaWrapper<CourseToPsycheMarket> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.eq(CourseToPsycheMarket::getPsycheMarketId,id);
|
||||
List<CourseToPsycheMarket> tomarkets = toMarketService.list(wrapper);
|
||||
if (tomarkets.size()>0){
|
||||
return R.error("请先移除课程");
|
||||
}else {
|
||||
marketService.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
}else {
|
||||
List<CoursePsycheMarket> marketList = marketService.list(new LambdaQueryWrapper<CoursePsycheMarket>().eq(CoursePsycheMarket::getPid,id));
|
||||
if (marketList.size() > 0) {
|
||||
return R.error("请先删除子集");
|
||||
}else {
|
||||
marketService.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/editMarketSort")
|
||||
public R editMarketSort(@RequestBody Map<String,Integer> map){
|
||||
CourseToPsycheMarket info = toMarketService.getOne(new LambdaQueryWrapper<CourseToPsycheMarket>()
|
||||
.eq(CourseToPsycheMarket::getPsycheMarketId, map.get("marketId"))
|
||||
.eq(CourseToPsycheMarket::getCourseId, map.get("courseId")), false);
|
||||
info.setSort(map.get("sort"));
|
||||
toMarketService.updateById(info);
|
||||
return R.ok().put("result",info);
|
||||
}
|
||||
|
||||
@RequestMapping("/getCourseListByMarketId")
|
||||
public R getCourseListByMarketId(@RequestBody Map<String,Integer> map){
|
||||
List<CourseToPsycheMarket> marketId = toMarketService.getCourseListByMarketId(map.get("marketId"));
|
||||
return R.ok().put("list",marketId);
|
||||
}
|
||||
|
||||
@RequestMapping("/getNotToMarketList")
|
||||
public R getNotToMarketList(@RequestBody ParamTo param){
|
||||
List<Integer> collect = toMarketService.getBaseMapper().selectList(new LambdaQueryWrapper<CourseToPsycheMarket>().eq(CourseToPsycheMarket::getPsycheMarketId, param.getId())).stream().map(CourseToPsycheMarket::getCourseId).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<CourseEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.notIn(collect.size()>0,CourseEntity::getId,collect);
|
||||
wrapper.like(StringUtils.isNotBlank(param.getKeywords()),CourseEntity::getTitle,param.getKeywords());
|
||||
Page<CourseEntity> page = courseService.page(new Page<>(param.getPage(), param.getLimit()), wrapper);
|
||||
return R.ok().put("page",page);
|
||||
}
|
||||
|
||||
@RequestMapping("/bindCourseAndPsycheMarket")
|
||||
public R bindCourseAndPsycheMarket(@RequestBody Map<String,Integer> map){
|
||||
int marketId = map.get("marketId");
|
||||
int courseId = map.get("courseId");
|
||||
Integer integer = toMarketService.getBaseMapper().selectCount(new LambdaQueryWrapper<CourseToPsycheMarket>().eq(CourseToPsycheMarket::getPsycheMarketId, marketId).eq(CourseToPsycheMarket::getCourseId, courseId));
|
||||
if(integer>0){
|
||||
return R.error("不可重复绑定");
|
||||
}
|
||||
CourseToPsycheMarket courseToPsycheMarket = new CourseToPsycheMarket();
|
||||
courseToPsycheMarket.setPsycheMarketId(marketId);
|
||||
courseToPsycheMarket.setCourseId(courseId);
|
||||
toMarketService.save(courseToPsycheMarket);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping("/unbindCourseAndPsycheMarket")
|
||||
public R unbindCourseAndPsycheMarket(@RequestBody Map<String,Integer> map){
|
||||
int marketId = map.get("marketId");
|
||||
int courseId = map.get("courseId");
|
||||
toMarketService.getBaseMapper().delete(new LambdaQueryWrapper<CourseToPsycheMarket>().eq(CourseToPsycheMarket::getPsycheMarketId,marketId).eq(CourseToPsycheMarket::getCourseId,courseId));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -35,10 +35,12 @@ public class MessageController {
|
||||
}
|
||||
if (StringUtils.isNotEmpty(params.get("isBook").toString())||
|
||||
StringUtils.isNotEmpty(params.get("isMedical").toString())||
|
||||
StringUtils.isNotEmpty(params.get("isSociology").toString())) {
|
||||
StringUtils.isNotEmpty(params.get("isSociology").toString())||
|
||||
StringUtils.isNotEmpty(params.get("isPsyche").toString())) {
|
||||
wrapper.and(t->t.eq("1".equals(params.get("isBook").toString()),Message::getIsBook,params.get("isBook"))
|
||||
.or().eq("1".equals(params.get("isMedical").toString()),Message::getIsMedical,params.get("isMedical"))
|
||||
.or().eq("1".equals(params.get("isSociology").toString()),Message::getIsSociology,params.get("isSociology")));
|
||||
.or().eq("1".equals(params.get("isSociology").toString()),Message::getIsSociology,params.get("isSociology"))
|
||||
.or().eq("1".equals(params.get("isPsyche").toString()),Message::getIsPsyche,params.get("isPsyche")));
|
||||
}
|
||||
wrapper.orderByDesc(Message::getCreateTime);
|
||||
Page<Message> page = messageService.page(new Page<>(
|
||||
|
||||
@@ -0,0 +1,371 @@
|
||||
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.common.service.ShopProductPsycheLabelService;
|
||||
import com.peanut.modules.common.service.ShopProductPsycheMarketService;
|
||||
import com.peanut.modules.common.service.ShopProductToPsycheLabelService;
|
||||
import com.peanut.modules.common.service.ShopProductToPsycheMarketService;
|
||||
import com.peanut.modules.master.service.ShopProductService;
|
||||
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("masterPsycheLabelAndMarket")
|
||||
@RequestMapping("master/psycheLabelAndMarket")
|
||||
public class PsycheLabelAndMarketController {
|
||||
|
||||
@Autowired
|
||||
private ShopProductPsycheLabelService labelService;
|
||||
@Autowired
|
||||
private ShopProductPsycheMarketService marketService;
|
||||
@Autowired
|
||||
private ShopProductToPsycheLabelService toLabelService;
|
||||
@Autowired
|
||||
private ShopProductToPsycheMarketService toMarketService;
|
||||
@Autowired
|
||||
private ShopProductService productService;
|
||||
|
||||
/**
|
||||
* 标签树
|
||||
*/
|
||||
@RequestMapping(path = "/labelTree")
|
||||
public R labelTree() {
|
||||
List<ShopProductPsycheLabel> labelsTree = labelService.labelTree();
|
||||
return R.ok().put("result", labelsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取标签列表
|
||||
*/
|
||||
@RequestMapping(path = "/getLabelListByPid")
|
||||
public R getLabelListByPid(String pid) {
|
||||
LambdaQueryWrapper<ShopProductPsycheLabel> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(ShopProductPsycheLabel::getPid,pid);
|
||||
wrapper.orderByAsc(ShopProductPsycheLabel::getSort);
|
||||
wrapper.orderByAsc(ShopProductPsycheLabel::getCreateTime);
|
||||
List<ShopProductPsycheLabel> labelTopList = labelService.list(wrapper);
|
||||
return R.ok().put("result", labelTopList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 营销标签树
|
||||
*/
|
||||
@RequestMapping(path = "/marketTree")
|
||||
public R marketTree() {
|
||||
List<ShopProductPsycheMarket> marketsTree = marketService.marketTree();
|
||||
return R.ok().put("result", marketsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取营销标签列表
|
||||
*/
|
||||
@RequestMapping(path = "/getMakertListByPid")
|
||||
public R getMakertListByPid(String pid) {
|
||||
LambdaQueryWrapper<ShopProductPsycheMarket> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(ShopProductPsycheMarket::getPid,pid);
|
||||
wrapper.orderByAsc(ShopProductPsycheMarket::getSort);
|
||||
wrapper.orderByAsc(ShopProductPsycheMarket::getCreateTime);
|
||||
List<ShopProductPsycheMarket> 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 ShopProductPsycheLabel label) {
|
||||
if (label.getId()==null){
|
||||
if(label.getPid()==0){
|
||||
labelService.save(label);
|
||||
return R.ok().put("result",label);
|
||||
}else {
|
||||
ShopProductPsycheLabel 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<ShopProductPsycheLabel>()
|
||||
.eq(ShopProductPsycheLabel::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) {
|
||||
ShopProductPsycheLabel label = labelService.getById(id);
|
||||
if (label.getIsLast()==1){
|
||||
MPJLambdaWrapper<ShopProductToPsycheLabel> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.eq(ShopProductToPsycheLabel::getPsycheLabelId,id);
|
||||
List<ShopProductToPsycheLabel> tolables = toLabelService.list(wrapper);
|
||||
if (tolables.size()>0){
|
||||
return R.error("请先移除商品");
|
||||
}else {
|
||||
labelService.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
}else {
|
||||
List<ShopProductPsycheLabel> labelList = labelService.list(new LambdaQueryWrapper<ShopProductPsycheLabel>().eq(ShopProductPsycheLabel::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 ShopProductPsycheMarket market) {
|
||||
if (market.getId()==null){
|
||||
if(market.getPid()==0){
|
||||
marketService.save(market);
|
||||
return R.ok().put("result",market);
|
||||
}else {
|
||||
ShopProductPsycheMarket 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<ShopProductPsycheMarket>()
|
||||
.eq(ShopProductPsycheMarket::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) {
|
||||
ShopProductPsycheMarket market = marketService.getById(id);
|
||||
if (market.getIsLast()==1){
|
||||
MPJLambdaWrapper<ShopProductToPsycheMarket> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.eq(ShopProductToPsycheMarket::getPsycheMarketId,id);
|
||||
List<ShopProductToPsycheMarket> tomarkets = toMarketService.list(wrapper);
|
||||
if (tomarkets.size()>0){
|
||||
return R.error("请先移除商品");
|
||||
}else {
|
||||
marketService.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
}else {
|
||||
List<ShopProductPsycheMarket> marketList = marketService.list(new LambdaQueryWrapper<ShopProductPsycheMarket>().eq(ShopProductPsycheMarket::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("psycheLabelId")&&!"".equals(params.get("psycheLabelId").toString())){
|
||||
String sql = "select product_id from shop_product_to_psyche_label where del_flag = 0 and psyche_label_id = "+params.get("psycheLabelId");
|
||||
wrapper.notInSql(ShopProduct::getProductId,sql);
|
||||
}
|
||||
if (params.containsKey("psycheMarketId")&&!"".equals(params.get("psycheMarketId").toString())){
|
||||
String sql = "select product_id from shop_product_to_psyche_market where del_flag = 0 and psyche_market_id = "+params.get("psycheMarketId");
|
||||
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("/editMarketSort")
|
||||
public R editMarketSort(@RequestBody Map<String,Integer> map){
|
||||
ShopProductToPsycheMarket toMarket = toMarketService.getById(map.get("id"));
|
||||
toMarket.setSort(map.get("sort"));
|
||||
toMarketService.updateById(toMarket);
|
||||
return R.ok().put("market",toMarket);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取书标签列表
|
||||
*/
|
||||
@RequestMapping("/getToLabelList")
|
||||
public R getToLabelList(@RequestBody Map params){
|
||||
MPJLambdaWrapper<ShopProductToPsycheLabel> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.selectAll(ShopProductToPsycheLabel.class);
|
||||
wrapper.leftJoin(ShopProduct.class,ShopProduct::getProductId,ShopProductToPsycheLabel::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(ShopProductToPsycheLabel::getProductId,params.get("productId").toString());
|
||||
}
|
||||
if (params.containsKey("psycheLabelId")&&!"".equals(params.get("psycheLabelId").toString())){
|
||||
wrapper.eq(ShopProductToPsycheLabel::getPsycheLabelId,params.get("psycheLabelId").toString());
|
||||
}
|
||||
Page<ShopProductToPsycheLabel> page = toLabelService.page(new Page<>(
|
||||
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
|
||||
List<ShopProductToPsycheLabel> res = page.getRecords();
|
||||
if (res.size() > 0) {
|
||||
for (ShopProductToPsycheLabel item : res) {
|
||||
item.setProduct(productService.getById(item.getProductId()));
|
||||
item.setLabel(labelService.getById(item.getPsycheLabelId()));
|
||||
}
|
||||
}
|
||||
page.setRecords(res);
|
||||
return R.ok().put("result", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取营销标签列表
|
||||
*/
|
||||
@RequestMapping("/getToMarketList")
|
||||
public R getToMarketList(@RequestBody Map params){
|
||||
MPJLambdaWrapper<ShopProductToPsycheMarket> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.selectAll(ShopProductToPsycheMarket.class);
|
||||
wrapper.leftJoin(ShopProduct.class,ShopProduct::getProductId,ShopProductToPsycheMarket::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("psycheMarketId")&&!"".equals(params.get("psycheMarketId").toString())){
|
||||
wrapper.eq(ShopProductToPsycheMarket::getPsycheMarketId,params.get("psycheMarketId").toString());
|
||||
}
|
||||
wrapper.orderByAsc(ShopProductToPsycheMarket::getSort);
|
||||
Page<ShopProductToPsycheMarket> page = toMarketService.page(new Page<>(
|
||||
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
|
||||
List<ShopProductToPsycheMarket> res = page.getRecords();
|
||||
if (res.size() > 0) {
|
||||
for (ShopProductToPsycheMarket item : res) {
|
||||
item.setProduct(productService.getById(item.getProductId()));
|
||||
item.setMarket(marketService.getById(item.getPsycheMarketId()));
|
||||
}
|
||||
}
|
||||
page.setRecords(res);
|
||||
return R.ok().put("result", page);
|
||||
}
|
||||
|
||||
@RequestMapping("/editToMarketSort")
|
||||
public R editToMarketSort(@RequestBody Map<String,Integer> map){
|
||||
toMarketService.editToMarketSort(map);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@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) {
|
||||
ShopProductToPsycheLabel toLabel = new ShopProductToPsycheLabel();
|
||||
toLabel.setPsycheLabelId(Integer.parseInt(params.get("psycheLabelId").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) {
|
||||
ShopProductToPsycheMarket toMarket = new ShopProductToPsycheMarket();
|
||||
toMarket.setPsycheMarketId(Integer.parseInt(params.get("psycheMarketId").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<ShopProductToPsycheLabel> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(ShopProductToPsycheLabel::getPsycheLabelId,lableId);
|
||||
wrapper.eq(ShopProductToPsycheLabel::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<ShopProductToPsycheMarket> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(ShopProductToPsycheMarket::getPsycheMarketId,marketId);
|
||||
wrapper.eq(ShopProductToPsycheMarket::getProductId,id);
|
||||
toMarketService.remove(wrapper);
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user