主页-我的课程
This commit is contained in:
@@ -132,7 +132,7 @@ public class BookLabelAndMarketController {
|
||||
}else {
|
||||
List<ShopProductBookLabel> labelList = labelService.list(new LambdaQueryWrapper<ShopProductBookLabel>().eq(ShopProductBookLabel::getPid,id));
|
||||
if (labelList.size() > 0) {
|
||||
return R.error("请先删除子集,设置成最后一集");
|
||||
return R.error("请先删除子集");
|
||||
}else {
|
||||
labelService.removeById(id);
|
||||
return R.ok();
|
||||
@@ -193,7 +193,7 @@ public class BookLabelAndMarketController {
|
||||
}else {
|
||||
List<ShopProductBookMarket> marketList = marketService.list(new LambdaQueryWrapper<ShopProductBookMarket>().eq(ShopProductBookMarket::getPid,id));
|
||||
if (marketList.size() > 0) {
|
||||
return R.error("请先删除子集,设置成最后一集");
|
||||
return R.error("请先删除子集");
|
||||
}else {
|
||||
marketService.removeById(id);
|
||||
return R.ok();
|
||||
|
||||
@@ -0,0 +1,357 @@
|
||||
package com.peanut.modules.common.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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.*;
|
||||
import com.peanut.modules.sys.service.SysDictDataService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController("commonMedicaldes")
|
||||
@RequestMapping("common/medicaldes")
|
||||
public class MedicaldesController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private MedicaldesLightService lightService;
|
||||
@Autowired
|
||||
private MedicaldesBookService medicaldesBookService;
|
||||
@Autowired
|
||||
private MedicaldesInheritService inheritService;
|
||||
@Autowired
|
||||
private MedicaldesInheritRelationService relationService;
|
||||
@Autowired
|
||||
private SysDictDataService sysDictDataService;
|
||||
@Autowired
|
||||
private BookService bookService;
|
||||
@Autowired
|
||||
private StringRedisTemplate redisTemplate;
|
||||
@Autowired
|
||||
private ProvinceService provinceService;
|
||||
@Autowired
|
||||
private CityService cityService;
|
||||
|
||||
|
||||
/**
|
||||
* 类型列表
|
||||
*/
|
||||
@RequestMapping(path = "/typeList")
|
||||
public R typeList(String label) {
|
||||
LambdaQueryWrapper<com.peanut.modules.book.entity.SysDictDataEntity> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(com.peanut.modules.book.entity.SysDictDataEntity::getDictLabel,label);
|
||||
return R.ok().put("result",sysDictDataService.list(wrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 书列表
|
||||
*/
|
||||
@RequestMapping(path = "/bookList")
|
||||
public R bookList() {
|
||||
LambdaQueryWrapper<BookEntity> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(BookEntity::getBookType,0);
|
||||
wrapper.orderByDesc(BookEntity::getCreateTime);
|
||||
return R.ok().put("result",bookService.list(wrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 专著出版关系列表
|
||||
*/
|
||||
@RequestMapping(path = "/bookRelationListByType")
|
||||
public R bookRelationListByType(@RequestBody Map map) {
|
||||
MPJLambdaWrapper<MedicaldesBook> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.selectAll(MedicaldesBook.class);
|
||||
wrapper.leftJoin(BookEntity.class,BookEntity::getId,MedicaldesBook::getBookId);
|
||||
wrapper.eq(BookEntity::getBookType,0);
|
||||
if (map.containsKey("dictType")&& StringUtils.isNotEmpty(map.get("dictType").toString())){
|
||||
wrapper.eq(MedicaldesBook::getTypeId,map.get("dictType"));
|
||||
}
|
||||
if (map.containsKey("bookName")&&StringUtils.isNotEmpty(map.get("bookName").toString())){
|
||||
wrapper.like(BookEntity::getName,map.get("bookName"));
|
||||
}
|
||||
wrapper.orderByAsc(MedicaldesBook::getSort);
|
||||
Page<MedicaldesBook> res = medicaldesBookService.page(new Page<MedicaldesBook>(
|
||||
Long.parseLong(map.get("current").toString()), Long.parseLong(map.get("limit").toString())), wrapper);
|
||||
List<MedicaldesBook> list = res.getRecords();
|
||||
if (list.size() > 0) {
|
||||
for (MedicaldesBook b : list) {
|
||||
b.setBook(bookService.getById(b.getBookId()));
|
||||
}
|
||||
res.setRecords(list);
|
||||
}
|
||||
return R.ok().put("result", res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 专著出版列表
|
||||
*/
|
||||
@RequestMapping(path = "/bookListByType")
|
||||
public R bookListByType(String type) {
|
||||
MPJLambdaWrapper<BookEntity> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.selectAll(BookEntity.class);
|
||||
wrapper.leftJoin(MedicaldesBook.class,MedicaldesBook::getBookId,BookEntity::getId);
|
||||
wrapper.eq(MedicaldesBook::getTypeId,type);
|
||||
wrapper.eq(BookEntity::getBookType,0);
|
||||
wrapper.orderByAsc(MedicaldesBook::getSort);
|
||||
List<BookEntity> list = bookService.list(wrapper);
|
||||
return R.ok().put("result", list);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/saveOrUpdateBookRelation")
|
||||
public R saveOrUpdateBookRelation(@RequestBody MedicaldesBook medicaldesBook) {
|
||||
MPJLambdaWrapper<MedicaldesBook> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.eq(MedicaldesBook::getBookId,medicaldesBook.getBookId());
|
||||
wrapper.eq(MedicaldesBook::getTypeId,medicaldesBook.getTypeId());
|
||||
if (medicaldesBookService.getOne(wrapper)!=null){
|
||||
medicaldesBookService.remove(wrapper);
|
||||
}
|
||||
medicaldesBookService.saveOrUpdate(medicaldesBook);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/delBookRelation")
|
||||
public R delBookRelation(String id) {
|
||||
medicaldesBookService.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 学术传承列表分页
|
||||
*/
|
||||
@RequestMapping(path = "/inheritListByPage")
|
||||
public R inheritListByPage(@RequestBody Map map) {
|
||||
MPJLambdaWrapper<MedicaldesInherit> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.leftJoin(MedicaldesInheritRelation.class,MedicaldesInheritRelation::getInheritId,MedicaldesInherit::getId);
|
||||
wrapper.leftJoin(City.class,City::getCityId,MedicaldesInherit::getCityId);
|
||||
wrapper.leftJoin(Province.class,Province::getProvId,City::getProvId);
|
||||
wrapper.selectAll(MedicaldesInherit.class);
|
||||
if (map.containsKey("dictType")&&StringUtils.isNotEmpty(map.get("dictType").toString())){
|
||||
wrapper.eq(MedicaldesInheritRelation::getTypeId,map.get("dictType"));
|
||||
}
|
||||
if (map.containsKey("name")&&StringUtils.isNotEmpty(map.get("name").toString())){
|
||||
wrapper.like(MedicaldesInherit::getName,map.get("name"));
|
||||
}
|
||||
wrapper.selectAs(MedicaldesInheritRelation::getTypeId,"type");
|
||||
wrapper.selectAs(MedicaldesInheritRelation::getSort,"sort");
|
||||
wrapper.orderByAsc(MedicaldesInheritRelation::getSort);
|
||||
Page<MedicaldesInherit> page = inheritService.page(new Page<>(
|
||||
Long.parseLong(map.get("current").toString()), Long.parseLong(map.get("limit").toString())),wrapper);
|
||||
return R.ok().put("result", page);
|
||||
}
|
||||
|
||||
//国际医师可能来自国外在省市里加入外国
|
||||
public List<com.peanut.modules.book.entity.SysDictDataEntity> getCounts() {
|
||||
LambdaQueryWrapper<com.peanut.modules.book.entity.SysDictDataEntity> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(com.peanut.modules.book.entity.SysDictDataEntity::getDictLabel,"inheritPro");
|
||||
List<com.peanut.modules.book.entity.SysDictDataEntity> dataList = sysDictDataService.list(wrapper);
|
||||
return dataList;
|
||||
}
|
||||
|
||||
public List getCityList(String cityName,int countId) {
|
||||
List<City> cityList = new ArrayList<>();
|
||||
City city = new City();
|
||||
city.setProvId((long)countId);
|
||||
city.setCityName(cityName);
|
||||
city.setCityId((long)countId);
|
||||
cityList.add(city);
|
||||
return cityList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 学术传承列表按类型、地区
|
||||
*/
|
||||
@RequestMapping(path = "/inheritListByTypeProvId")
|
||||
public R inheritListByTypeProvId(String type,String provId) {
|
||||
MPJLambdaWrapper<MedicaldesInherit> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.leftJoin(MedicaldesInheritRelation.class,MedicaldesInheritRelation::getInheritId,MedicaldesInherit::getId);
|
||||
wrapper.eq(MedicaldesInheritRelation::getTypeId,type);
|
||||
wrapper.leftJoin(City.class,City::getCityId,MedicaldesInherit::getCityId);
|
||||
wrapper.leftJoin(Province.class,Province::getProvId,City::getProvId);
|
||||
wrapper.selectAll(MedicaldesInherit.class);
|
||||
if ("0".equals(provId)){
|
||||
int[] val = new int[] {0};
|
||||
//未知地址
|
||||
if (getCounts()!=null&&getCounts().size() > 0){
|
||||
for (int i=1;i<=getCounts().size(); i++){
|
||||
val[i] = i;
|
||||
}
|
||||
}
|
||||
wrapper.in(MedicaldesInherit::getCityId,val);
|
||||
}else {
|
||||
wrapper.eq(Province::getProvId,provId);
|
||||
}
|
||||
wrapper.selectAs(MedicaldesInheritRelation::getSort,"sort");
|
||||
wrapper.orderByAsc(MedicaldesInheritRelation::getSort);
|
||||
List<MedicaldesInherit> list = inheritService.list(wrapper);
|
||||
return R.ok().put("result", list);
|
||||
}
|
||||
|
||||
//获取地址
|
||||
@RequestMapping(path = "/getMedicaldesProList")
|
||||
public R getMedicaldesProList() {
|
||||
String s = redisTemplate.opsForValue().get("Province");
|
||||
List<Province> provinceList = new ArrayList<>();
|
||||
if (getCounts() != null&&getCounts().size() > 0){
|
||||
for (int i=0;i<getCounts().size();i++){
|
||||
Province p = new Province();
|
||||
p.setProvName(getCounts().get(i).getDictValue());
|
||||
p.setProvId(Long.valueOf(getCounts().get(i).getDictType()));
|
||||
p.setCityList(getCityList(getCounts().get(i).getDictValue(),Integer.parseInt(getCounts().get(i).getDictType())));
|
||||
provinceList.add(p);
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(s)) {
|
||||
List<Object> redisData = JSONArray.parseArray(s);
|
||||
for (Object object : redisData) {
|
||||
Province ret = JSONObject.parseObject(object.toString(), Province.class);
|
||||
provinceList.add(ret);
|
||||
}
|
||||
return R.ok().put("provinceEntity", provinceList);
|
||||
}else {
|
||||
provinceList.addAll(provinceService.getCity());
|
||||
}
|
||||
return R.ok().put("provinceEntity", provinceList);
|
||||
}
|
||||
|
||||
//获取市列表
|
||||
@RequestMapping(path = "/getCityByPro")
|
||||
public R getCityByPro(@RequestParam("provId") Integer provId) {
|
||||
List<City> prov = new ArrayList<>();
|
||||
List<com.peanut.modules.book.entity.SysDictDataEntity> list = getCounts();
|
||||
boolean flag = false;
|
||||
if (list != null && list.size() > 0) {
|
||||
for (com.peanut.modules.book.entity.SysDictDataEntity data:list) {
|
||||
if (provId==Integer.parseInt(data.getDictType())){
|
||||
prov.addAll(getCityList(data.getDictValue(),Integer.parseInt(data.getDictType())));
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
prov = cityService.getBaseMapper().selectList(new QueryWrapper<City>()
|
||||
.eq("prov_id", provId));
|
||||
}
|
||||
return R.ok().put("prov", prov);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/getInheritById")
|
||||
public R getInheritById(String id) {
|
||||
MPJLambdaWrapper<MedicaldesInherit> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.eq(MedicaldesInherit::getId,id);
|
||||
wrapper.leftJoin(MedicaldesInheritRelation.class,MedicaldesInheritRelation::getInheritId,MedicaldesInherit::getId);
|
||||
wrapper.leftJoin(City.class,City::getCityId,MedicaldesInherit::getCityId);
|
||||
wrapper.leftJoin(Province.class,Province::getProvId,City::getProvId);
|
||||
wrapper.leftJoin(" (select dict_type,dict_value from sys_dict_data where dict_label = 'inheritPro') dd on dd.dict_type = t.city_id");
|
||||
wrapper.select("t.*,ifnull(t2.city_name,ifnull(dd.dict_value,'其他')) as city_name,ifnull(t3.prov_name,ifnull(dd.dict_value,'其他')) as prov_name,t1.sort as sort");
|
||||
Map<String,Object> inherit = inheritService.getMap(wrapper);
|
||||
return R.ok().put("result",inherit);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/saveOrUpdateInherit")
|
||||
public R addInherit(@RequestBody MedicaldesInherit inherit) {
|
||||
MedicaldesInheritRelation relation = null;
|
||||
if (inherit.getId()==null) {
|
||||
relation = new MedicaldesInheritRelation();
|
||||
}else {
|
||||
LambdaQueryWrapper<MedicaldesInheritRelation> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(MedicaldesInheritRelation::getInheritId,inherit.getId());
|
||||
relation = relationService.getOne(wrapper);
|
||||
}
|
||||
inheritService.saveOrUpdate(inherit);
|
||||
relation.setTypeId(inherit.getType());
|
||||
relation.setInheritId(inherit.getId());
|
||||
relation.setSort(inherit.getSort());
|
||||
relationService.saveOrUpdate(relation);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/delInherit")
|
||||
public R delInherit(String id) {
|
||||
inheritService.removeById(id);
|
||||
LambdaQueryWrapper<MedicaldesInheritRelation> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(MedicaldesInheritRelation::getInheritId,id);
|
||||
relationService.removeById(relationService.getOne(wrapper));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/getList")
|
||||
public List<Map<String,Object>> getList(String type) {
|
||||
MPJLambdaWrapper<MedicaldesInherit> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.select("count(1) count,ifnull(t3.prov_id,ifnull(dd.dict_type,'0')) AS prov_id,ifnull(t3.prov_name,ifnull(dd.dict_value,'其他')) AS prov_name ");
|
||||
wrapper.leftJoin(MedicaldesInheritRelation.class,MedicaldesInheritRelation::getInheritId,MedicaldesInherit::getId);
|
||||
wrapper.eq(MedicaldesInheritRelation::getTypeId,type);
|
||||
wrapper.leftJoin(City.class,City::getCityId,MedicaldesInherit::getCityId);
|
||||
wrapper.leftJoin(Province.class,Province::getProvId,City::getProvId);
|
||||
wrapper.leftJoin(" (select dict_type,dict_value from sys_dict_data where dict_label = 'inheritPro') dd on dd.dict_type = t.city_id");
|
||||
wrapper.groupBy("prov_name","dict_value");
|
||||
wrapper.orderByAsc("t3.region_code","dict_value");
|
||||
List<Map<String,Object>> list = inheritService.listMaps(wrapper);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 吴门之光列表
|
||||
*/
|
||||
@RequestMapping(path = "/lightListByType")
|
||||
public R lightListByType(String type) {
|
||||
LambdaQueryWrapper<MedicaldesLight> wrapper = new LambdaQueryWrapper();
|
||||
if (StringUtils.isNotEmpty(type)){
|
||||
wrapper.eq(MedicaldesLight::getType,type);
|
||||
}
|
||||
wrapper.orderByAsc(MedicaldesLight::getSort);
|
||||
List<MedicaldesLight> list = lightService.list(wrapper);
|
||||
return R.ok().put("result", list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 吴门之光列表
|
||||
*/
|
||||
@RequestMapping(path = "/lightListByPage")
|
||||
public R lightListByPage(@RequestBody Map map) {
|
||||
LambdaQueryWrapper<MedicaldesLight> wrapper = new LambdaQueryWrapper();
|
||||
if (map.containsKey("type")&&StringUtils.isNotEmpty(map.get("type").toString())){
|
||||
wrapper.eq(MedicaldesLight::getType,map.get("type"));
|
||||
}
|
||||
if (map.containsKey("name")&&StringUtils.isNotEmpty(map.get("name").toString())){
|
||||
wrapper.like(MedicaldesLight::getName,map.get("name"));
|
||||
}
|
||||
wrapper.orderByAsc(MedicaldesLight::getSort);
|
||||
Page<MedicaldesLight> page = lightService.page(new Page<>(
|
||||
Long.parseLong(map.get("current").toString()), Long.parseLong(map.get("limit").toString())),wrapper);
|
||||
return R.ok().put("result", page);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/getLightById")
|
||||
public R getLightById(String id) {
|
||||
return R.ok().put("result",lightService.getById(id));
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/saveOrUpdateLight")
|
||||
public R addLight(@RequestBody MedicaldesLight light) {
|
||||
lightService.saveOrUpdate(light);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/delLight")
|
||||
public R delLight(String id) {
|
||||
lightService.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.common.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.peanut.modules.common.entity.ShopProductMedicineLabel;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ShopProductMedicineLabelDao extends BaseMapper<ShopProductMedicineLabel> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.common.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.peanut.modules.common.entity.ShopProductMedicineMarket;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ShopProductMedicineMarketDao extends BaseMapper<ShopProductMedicineMarket> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.common.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.peanut.modules.common.entity.ShopProductSociologyLabel;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ShopProductSociologyLabelDao extends BaseMapper<ShopProductSociologyLabel> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.common.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.peanut.modules.common.entity.ShopProductSociologyMarket;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ShopProductSociologyMarketDao extends BaseMapper<ShopProductSociologyMarket> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.common.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.peanut.modules.common.entity.ShopProductToMedicineLabel;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ShopProductToMedicineLabelDao extends BaseMapper<ShopProductToMedicineLabel> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.common.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.peanut.modules.common.entity.ShopProductToMedicineMarket;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ShopProductToMedicineMarketDao extends BaseMapper<ShopProductToMedicineMarket> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.common.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.peanut.modules.common.entity.ShopProductToSociologyLabel;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ShopProductToSociologyLabelDao extends BaseMapper<ShopProductToSociologyLabel> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.common.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.peanut.modules.common.entity.ShopProductToSociologyMarket;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ShopProductToSociologyMarketDao extends BaseMapper<ShopProductToSociologyMarket> {
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.peanut.modules.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@TableName("shop_product_medicine_label")
|
||||
public class ShopProductMedicineLabel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 父id
|
||||
*/
|
||||
private Integer pid;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 0否1是
|
||||
*/
|
||||
private Integer isLast;
|
||||
|
||||
/**
|
||||
* 权重
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<ShopProductMedicineLabel> children;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.peanut.modules.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@TableName("shop_product_medicine_market")
|
||||
public class ShopProductMedicineMarket implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 父id
|
||||
*/
|
||||
private Integer pid;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 0否1是
|
||||
*/
|
||||
private Integer isLast;
|
||||
|
||||
/**
|
||||
* 权重
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<ShopProductMedicineMarket> children;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.peanut.modules.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@TableName("shop_product_sociology_label")
|
||||
public class ShopProductSociologyLabel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 父id
|
||||
*/
|
||||
private Integer pid;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 0否1是
|
||||
*/
|
||||
private Integer isLast;
|
||||
|
||||
/**
|
||||
* 权重
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<ShopProductSociologyLabel> children;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.peanut.modules.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@TableName("shop_product_sociology_market")
|
||||
public class ShopProductSociologyMarket implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 父id
|
||||
*/
|
||||
private Integer pid;
|
||||
|
||||
/**
|
||||
* 标题
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 0否1是
|
||||
*/
|
||||
private Integer isLast;
|
||||
|
||||
/**
|
||||
* 权重
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<ShopProductSociologyMarket> children;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.peanut.modules.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("shop_product_to_medicine_label")
|
||||
public class ShopProductToMedicineLabel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
private Integer productId;
|
||||
|
||||
private Integer medicineLabelId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private ShopProduct product;
|
||||
@TableField(exist = false)
|
||||
private ShopProductToMedicineLabel label;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.peanut.modules.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("shop_product_to_medicine_market")
|
||||
public class ShopProductToMedicineMarket implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
private Integer productId;
|
||||
|
||||
private Integer medicineMarketId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private ShopProduct product;
|
||||
@TableField(exist = false)
|
||||
private ShopProductToMedicineMarket market;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.peanut.modules.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("shop_product_to_sociology_label")
|
||||
public class ShopProductToSociologyLabel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
private Integer productId;
|
||||
|
||||
private Integer sociologyLabelId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private ShopProduct product;
|
||||
@TableField(exist = false)
|
||||
private ShopProductSociologyLabel label;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.peanut.modules.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("shop_product_to_sociology_market")
|
||||
public class ShopProductToSociologyMarket implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
private Integer productId;
|
||||
|
||||
private Integer sociologyMarketId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private ShopProduct product;
|
||||
@TableField(exist = false)
|
||||
private ShopProductSociologyMarket market;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.common.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.BookEntity;
|
||||
|
||||
public interface BookService extends IService<BookEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.common.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.MedicaldesBook;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public interface MedicaldesBookService extends IService<MedicaldesBook> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.common.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.MedicaldesInheritRelation;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public interface MedicaldesInheritRelationService extends IService<MedicaldesInheritRelation> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.common.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.MedicaldesInherit;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public interface MedicaldesInheritService extends IService<MedicaldesInherit> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.common.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.MedicaldesLight;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public interface MedicaldesLightService extends IService<MedicaldesLight> {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.common.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.BookDao;
|
||||
import com.peanut.modules.common.entity.BookEntity;
|
||||
import com.peanut.modules.common.service.BookService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service("commonBookService")
|
||||
public class BookServiceImpl extends ServiceImpl<BookDao, BookEntity> implements BookService {
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.peanut.modules.common.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.MedicaldesBookDao;
|
||||
import com.peanut.modules.common.entity.MedicaldesBook;
|
||||
import com.peanut.modules.common.service.MedicaldesBookService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service("commonMedicaldesBookService")
|
||||
public class MedicaldesBookServiceImpl extends ServiceImpl<MedicaldesBookDao, MedicaldesBook> implements MedicaldesBookService {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.peanut.modules.common.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.MedicaldesInheritRelationDao;
|
||||
import com.peanut.modules.common.entity.MedicaldesInheritRelation;
|
||||
import com.peanut.modules.common.service.MedicaldesInheritRelationService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service("commonMedicaldesInheritRelationService")
|
||||
public class MedicaldesInheritRelationServiceImpl extends ServiceImpl<MedicaldesInheritRelationDao, MedicaldesInheritRelation> implements MedicaldesInheritRelationService {
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.peanut.modules.common.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.MedicaldesInheritDao;
|
||||
import com.peanut.modules.common.entity.MedicaldesInherit;
|
||||
import com.peanut.modules.common.service.MedicaldesInheritService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service("commonMedicaldesInheritService")
|
||||
public class MedicaldesInheritServiceImpl extends ServiceImpl<MedicaldesInheritDao, MedicaldesInherit> implements MedicaldesInheritService {
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.peanut.modules.common.service.impl;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.MedicaldesLightDao;
|
||||
import com.peanut.modules.common.entity.MedicaldesLight;
|
||||
import com.peanut.modules.common.service.MedicaldesLightService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service("commonMedicaldesLightService")
|
||||
public class MedicaldesLightServiceImpl extends ServiceImpl<MedicaldesLightDao, MedicaldesLight> implements MedicaldesLightService {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.peanut.modules.master.controller;
|
||||
|
||||
public class MedicineLabelAndMarketController {
|
||||
}
|
||||
@@ -0,0 +1,359 @@
|
||||
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("masterSociologyLabelAndMarket")
|
||||
@RequestMapping("master/sociologyLabelAndMarket")
|
||||
public class SociologyLabelAndMarketController {
|
||||
|
||||
@Autowired
|
||||
private ShopProductSociologyLabelService labelService;
|
||||
@Autowired
|
||||
private ShopProductSociologyMarketService marketService;
|
||||
@Autowired
|
||||
private ShopProductToSociologyLabelService toLabelService;
|
||||
@Autowired
|
||||
private ShopProductToSociologyMarketService toMarketService;
|
||||
@Autowired
|
||||
private ShopProductService productService;
|
||||
|
||||
/**
|
||||
* 标签树
|
||||
*/
|
||||
@RequestMapping(path = "/labelTree")
|
||||
public R labelTree() {
|
||||
List<ShopProductSociologyLabel> labelsTree = labelService.labelTree();
|
||||
return R.ok().put("result", labelsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取标签列表
|
||||
*/
|
||||
@RequestMapping(path = "/getLabelListByPid")
|
||||
public R getLabelListByPid(String pid) {
|
||||
LambdaQueryWrapper<ShopProductSociologyLabel> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(ShopProductSociologyLabel::getPid,pid);
|
||||
wrapper.orderByAsc(ShopProductSociologyLabel::getSort);
|
||||
wrapper.orderByAsc(ShopProductSociologyLabel::getCreateTime);
|
||||
List<ShopProductSociologyLabel> labelTopList = labelService.list(wrapper);
|
||||
return R.ok().put("result", labelTopList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 营销标签树
|
||||
*/
|
||||
@RequestMapping(path = "/marketTree")
|
||||
public R marketTree() {
|
||||
List<ShopProductSociologyMarket> marketsTree = marketService.marketTree();
|
||||
return R.ok().put("result", marketsTree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取营销标签列表
|
||||
*/
|
||||
@RequestMapping(path = "/getMakertListByPid")
|
||||
public R getMakertListByPid(String pid) {
|
||||
LambdaQueryWrapper<ShopProductSociologyMarket> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(ShopProductSociologyMarket::getPid,pid);
|
||||
wrapper.orderByAsc(ShopProductSociologyMarket::getSort);
|
||||
wrapper.orderByAsc(ShopProductSociologyMarket::getCreateTime);
|
||||
List<ShopProductSociologyMarket> 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 ShopProductSociologyLabel label) {
|
||||
if (label.getId()==null){
|
||||
if(label.getPid()==0){
|
||||
labelService.save(label);
|
||||
return R.ok().put("result",label);
|
||||
}else {
|
||||
ShopProductSociologyLabel 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<ShopProductSociologyLabel>()
|
||||
.eq(ShopProductSociologyLabel::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) {
|
||||
ShopProductSociologyLabel label = labelService.getById(id);
|
||||
if (label.getIsLast()==1){
|
||||
MPJLambdaWrapper<ShopProductToSociologyLabel> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.eq(ShopProductToSociologyLabel::getSociologyLabelId,id);
|
||||
List<ShopProductToSociologyLabel> tolables = toLabelService.list(wrapper);
|
||||
if (tolables.size()>0){
|
||||
return R.error("请先移除商品");
|
||||
}else {
|
||||
labelService.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
}else {
|
||||
List<ShopProductSociologyLabel> labelList = labelService.list(new LambdaQueryWrapper<ShopProductSociologyLabel>().eq(ShopProductSociologyLabel::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 ShopProductSociologyMarket market) {
|
||||
if (market.getId()==null){
|
||||
if(market.getPid()==0){
|
||||
marketService.save(market);
|
||||
return R.ok().put("result",market);
|
||||
}else {
|
||||
ShopProductSociologyMarket 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<ShopProductSociologyMarket>()
|
||||
.eq(ShopProductSociologyMarket::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) {
|
||||
ShopProductSociologyMarket market = marketService.getById(id);
|
||||
if (market.getIsLast()==1){
|
||||
MPJLambdaWrapper<ShopProductToSociologyMarket> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.eq(ShopProductToSociologyMarket::getSociologyMarketId,id);
|
||||
List<ShopProductToSociologyMarket> tomarkets = toMarketService.list(wrapper);
|
||||
if (tomarkets.size()>0){
|
||||
return R.error("请先移除商品");
|
||||
}else {
|
||||
marketService.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
}else {
|
||||
List<ShopProductSociologyMarket> marketList = marketService.list(new LambdaQueryWrapper<ShopProductSociologyMarket>().eq(ShopProductSociologyMarket::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("sociologyLabelId")&&!"".equals(params.get("sociologyLabelId").toString())){
|
||||
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);
|
||||
}
|
||||
if (params.containsKey("bookMarketId")&&!"".equals(params.get("bookMarketId").toString())){
|
||||
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);
|
||||
}
|
||||
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<ShopProductToSociologyLabel> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.selectAll(ShopProductToSociologyLabel.class);
|
||||
wrapper.leftJoin(ShopProduct.class,ShopProduct::getProductId,ShopProductToSociologyLabel::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(ShopProductToSociologyLabel::getProductId,params.get("productId").toString());
|
||||
}
|
||||
if (params.containsKey("sociologyLabelId")&&!"".equals(params.get("sociologyLabelId").toString())){
|
||||
wrapper.eq(ShopProductToSociologyLabel::getSociologyLabelId,params.get("sociologyLabelId").toString());
|
||||
}
|
||||
Page<ShopProductToSociologyLabel> page = toLabelService.page(new Page<>(
|
||||
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
|
||||
List<ShopProductToSociologyLabel> res = page.getRecords();
|
||||
if (res.size() > 0) {
|
||||
for (ShopProductToSociologyLabel item : res) {
|
||||
item.setProduct(productService.getById(item.getProductId()));
|
||||
item.setLabel(labelService.getById(item.getSociologyLabelId()));
|
||||
}
|
||||
}
|
||||
page.setRecords(res);
|
||||
return R.ok().put("result", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取营销标签列表
|
||||
*/
|
||||
@RequestMapping("/getToMarketList")
|
||||
public R getToMarketList(@RequestBody Map params){
|
||||
MPJLambdaWrapper<ShopProductToSociologyMarket> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.selectAll(ShopProductToSociologyMarket.class);
|
||||
wrapper.leftJoin(ShopProduct.class,ShopProduct::getProductId,ShopProductToSociologyMarket::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("sociologyMarketId")&&!"".equals(params.get("sociologyMarketId").toString())){
|
||||
wrapper.eq(ShopProductToSociologyMarket::getSociologyMarketId,params.get("sociologyMarketId").toString());
|
||||
}
|
||||
Page<ShopProductToSociologyMarket> page = toMarketService.page(new Page<>(
|
||||
Long.parseLong(params.get("current").toString()), Long.parseLong(params.get("limit").toString())),wrapper);
|
||||
List<ShopProductToSociologyMarket> res = page.getRecords();
|
||||
if (res.size() > 0) {
|
||||
for (ShopProductToSociologyMarket item : res) {
|
||||
item.setProduct(productService.getById(item.getProductId()));
|
||||
item.setMarket(marketService.getById(item.getSociologyMarketId()));
|
||||
}
|
||||
}
|
||||
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) {
|
||||
ShopProductToSociologyLabel toLabel = new ShopProductToSociologyLabel();
|
||||
toLabel.setSociologyLabelId(Integer.parseInt(params.get("sociologyLabelId").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) {
|
||||
ShopProductToSociologyMarket toMarket = new ShopProductToSociologyMarket();
|
||||
toMarket.setSociologyMarketId(Integer.parseInt(params.get("sociologyMarketId").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<ShopProductToSociologyLabel> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(ShopProductToSociologyLabel::getSociologyLabelId,lableId);
|
||||
wrapper.eq(ShopProductToSociologyLabel::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<ShopProductToSociologyMarket> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(ShopProductToSociologyMarket::getSociologyMarketId,marketId);
|
||||
wrapper.eq(ShopProductToSociologyMarket::getProductId,id);
|
||||
toMarketService.remove(wrapper);
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.peanut.modules.master.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.ShopProductMedicineLabel;
|
||||
|
||||
public interface ShopProductMedicineLabelService extends IService<ShopProductMedicineLabel> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.peanut.modules.master.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.ShopProductMedicineMarket;
|
||||
|
||||
public interface ShopProductMedicineMarketService extends IService<ShopProductMedicineMarket> {
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.peanut.modules.master.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.ShopProductSociologyLabel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ShopProductSociologyLabelService extends IService<ShopProductSociologyLabel> {
|
||||
|
||||
List<ShopProductSociologyLabel> labelTree();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.peanut.modules.master.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.ShopProductSociologyMarket;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ShopProductSociologyMarketService extends IService<ShopProductSociologyMarket> {
|
||||
|
||||
List<ShopProductSociologyMarket> marketTree();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.peanut.modules.master.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.ShopProductToMedicineLabel;
|
||||
|
||||
public interface ShopProductToMedicineLabelService extends IService<ShopProductToMedicineLabel> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.peanut.modules.master.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.ShopProductToMedicineMarket;
|
||||
|
||||
public interface ShopProductToMedicineMarketService extends IService<ShopProductToMedicineMarket> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.peanut.modules.master.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.ShopProductToSociologyLabel;
|
||||
|
||||
public interface ShopProductToSociologyLabelService extends IService<ShopProductToSociologyLabel> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.peanut.modules.master.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.ShopProductToSociologyMarket;
|
||||
|
||||
public interface ShopProductToSociologyMarketService extends IService<ShopProductToSociologyMarket> {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.ShopProductMedicineLabelDao;
|
||||
import com.peanut.modules.common.entity.ShopProductMedicineLabel;
|
||||
import com.peanut.modules.medical.service.ShopProductMedicineLabelService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service("medicineShopProductMedicineLabelService")
|
||||
public class ShopProductMedicineLabelServiceImpl extends ServiceImpl<ShopProductMedicineLabelDao, ShopProductMedicineLabel> implements ShopProductMedicineLabelService {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.ShopProductMedicineMarketDao;
|
||||
import com.peanut.modules.common.entity.ShopProductMedicineMarket;
|
||||
import com.peanut.modules.medical.service.ShopProductMedicineMarketService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service("medicineShopProductMedicineMarketService")
|
||||
public class ShopProductMedicineMarketServiceImpl extends ServiceImpl<ShopProductMedicineMarketDao, ShopProductMedicineMarket> implements ShopProductMedicineMarketService {
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
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.peanut.modules.common.dao.ShopProductSociologyLabelDao;
|
||||
import com.peanut.modules.common.entity.ShopProductSociologyLabel;
|
||||
import com.peanut.modules.master.service.ShopProductSociologyLabelService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service("sociologyShopProductSociologyLabelService")
|
||||
public class ShopProductSociologyLabelServiceImpl extends ServiceImpl<ShopProductSociologyLabelDao, ShopProductSociologyLabel> implements ShopProductSociologyLabelService {
|
||||
|
||||
@Autowired
|
||||
private ShopProductSociologyLabelDao labelDao;
|
||||
|
||||
@Override
|
||||
public List<ShopProductSociologyLabel> labelTree() {
|
||||
List<ShopProductSociologyLabel> labels = labelDao.selectList(new QueryWrapper<>());
|
||||
List<ShopProductSociologyLabel> labelsTree = labels.stream().filter((shopProductSociologyLabel) ->
|
||||
shopProductSociologyLabel.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<ShopProductSociologyLabel> getLabelChildrens(ShopProductSociologyLabel root,List<ShopProductSociologyLabel> all){
|
||||
List<ShopProductSociologyLabel> children = all.stream().filter(shopProductSociologyLabel -> {
|
||||
return root.getId().equals(shopProductSociologyLabel.getPid());
|
||||
}).map(shopProductSociologyLabel -> {
|
||||
shopProductSociologyLabel.setChildren(getLabelChildrens(shopProductSociologyLabel, all));
|
||||
return shopProductSociologyLabel;
|
||||
}).sorted((label1,label2)->{
|
||||
return (label1.getSort()==null?0:label1.getSort()) - (label2.getSort()==null?0:label2.getSort());
|
||||
}).collect(Collectors.toList());
|
||||
return children;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
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.peanut.modules.common.dao.ShopProductSociologyMarketDao;
|
||||
import com.peanut.modules.common.entity.ShopProductSociologyMarket;
|
||||
import com.peanut.modules.master.service.ShopProductSociologyMarketService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service("sociologyShopProductSociologyMarketService")
|
||||
public class ShopProductSociologyMarketServiceImpl extends ServiceImpl<ShopProductSociologyMarketDao, ShopProductSociologyMarket> implements ShopProductSociologyMarketService {
|
||||
|
||||
@Autowired
|
||||
private ShopProductSociologyMarketDao marketDao;
|
||||
|
||||
@Override
|
||||
public List<ShopProductSociologyMarket> marketTree() {
|
||||
List<ShopProductSociologyMarket> markets = marketDao.selectList(new QueryWrapper<>());
|
||||
List<ShopProductSociologyMarket> marketsTree = markets.stream().filter((shopProductSociologyMarket) ->
|
||||
shopProductSociologyMarket.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<ShopProductSociologyMarket> getMarketChildrens(ShopProductSociologyMarket root,List<ShopProductSociologyMarket> all){
|
||||
List<ShopProductSociologyMarket> children = all.stream().filter(shopProductSociologyMarket -> {
|
||||
return root.getId().equals(shopProductSociologyMarket.getPid());
|
||||
}).map(shopProductSociologyMarket -> {
|
||||
shopProductSociologyMarket.setChildren(getMarketChildrens(shopProductSociologyMarket, all));
|
||||
return shopProductSociologyMarket;
|
||||
}).sorted((sort1,sort2)->{
|
||||
return (sort1.getSort()==null?0:sort1.getSort()) - (sort2.getSort()==null?0:sort2.getSort());
|
||||
}).collect(Collectors.toList());
|
||||
return children;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.ShopProductToMedicineLabelDao;
|
||||
import com.peanut.modules.common.entity.ShopProductToMedicineLabel;
|
||||
import com.peanut.modules.medical.service.ShopProductToMedicineLabelService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service("medicineShopProductToMedicineLabelService")
|
||||
public class ShopProductToMedicineLabelServiceImpl extends ServiceImpl<ShopProductToMedicineLabelDao, ShopProductToMedicineLabel> implements ShopProductToMedicineLabelService {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.ShopProductToMedicineMarketDao;
|
||||
import com.peanut.modules.common.entity.ShopProductToMedicineMarket;
|
||||
import com.peanut.modules.medical.service.ShopProductToMedicineMarketService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service("medicineShopProductToMedicineMarketService")
|
||||
public class ShopProductToMedicineMarketServiceImpl extends ServiceImpl<ShopProductToMedicineMarketDao, ShopProductToMedicineMarket> implements ShopProductToMedicineMarketService {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.ShopProductToSociologyLabelDao;
|
||||
import com.peanut.modules.common.entity.ShopProductToSociologyLabel;
|
||||
import com.peanut.modules.master.service.ShopProductToSociologyLabelService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service("sociologyShopProductToSociologyLabelService")
|
||||
public class ShopProductToSociologyLabelServiceImpl extends ServiceImpl<ShopProductToSociologyLabelDao, ShopProductToSociologyLabel> implements ShopProductToSociologyLabelService {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.master.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.ShopProductToSociologyMarketDao;
|
||||
import com.peanut.modules.common.entity.ShopProductToSociologyMarket;
|
||||
import com.peanut.modules.master.service.ShopProductToSociologyMarketService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service("sociologyShopProductToSociologyMarketService")
|
||||
public class ShopProductToSociologyMarketServiceImpl extends ServiceImpl<ShopProductToSociologyMarketDao, ShopProductToSociologyMarket> implements ShopProductToSociologyMarketService {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.peanut.modules.medical.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.ShopProductMedicineLabel;
|
||||
|
||||
public interface ShopProductMedicineLabelService extends IService<ShopProductMedicineLabel> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.peanut.modules.medical.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.ShopProductMedicineMarket;
|
||||
|
||||
public interface ShopProductMedicineMarketService extends IService<ShopProductMedicineMarket> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.peanut.modules.medical.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.ShopProductToMedicineLabel;
|
||||
import com.peanut.modules.common.entity.ShopProductToSociologyLabel;
|
||||
|
||||
public interface ShopProductToMedicineLabelService extends IService<ShopProductToMedicineLabel> {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.peanut.modules.medical.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.ShopProductToMedicineMarket;
|
||||
import com.peanut.modules.common.entity.ShopProductToSociologyMarket;
|
||||
|
||||
public interface ShopProductToMedicineMarketService extends IService<ShopProductToMedicineMarket> {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.medical.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.ShopProductMedicineLabelDao;
|
||||
import com.peanut.modules.common.entity.ShopProductMedicineLabel;
|
||||
import com.peanut.modules.medical.service.ShopProductMedicineLabelService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service("medicineShopProductMedicineLabelService")
|
||||
public class ShopProductMedicineLabelServiceImpl extends ServiceImpl<ShopProductMedicineLabelDao, ShopProductMedicineLabel> implements ShopProductMedicineLabelService {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.medical.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.ShopProductMedicineMarketDao;
|
||||
import com.peanut.modules.common.entity.ShopProductMedicineMarket;
|
||||
import com.peanut.modules.medical.service.ShopProductMedicineMarketService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service("medicineShopProductMedicineMarketService")
|
||||
public class ShopProductMedicineMarketServiceImpl extends ServiceImpl<ShopProductMedicineMarketDao, ShopProductMedicineMarket> implements ShopProductMedicineMarketService {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.medical.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.ShopProductToMedicineLabelDao;
|
||||
import com.peanut.modules.common.entity.ShopProductToMedicineLabel;
|
||||
import com.peanut.modules.medical.service.ShopProductToMedicineLabelService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service("medicineShopProductToMedicineLabelService")
|
||||
public class ShopProductToMedicineLabelServiceImpl extends ServiceImpl<ShopProductToMedicineLabelDao, ShopProductToMedicineLabel> implements ShopProductToMedicineLabelService {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.medical.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.ShopProductToMedicineMarketDao;
|
||||
import com.peanut.modules.common.entity.ShopProductToMedicineMarket;
|
||||
import com.peanut.modules.medical.service.ShopProductToMedicineMarketService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service("medicineShopProductToMedicineMarketService")
|
||||
public class ShopProductToMedicineMarketServiceImpl extends ServiceImpl<ShopProductToMedicineMarketDao, ShopProductToMedicineMarket> implements ShopProductToMedicineMarketService {
|
||||
}
|
||||
@@ -12,7 +12,7 @@ public interface VerifyReceiptConstant {
|
||||
String APP_BUNDLE_IDENTIFIER = "com.cn.nuttyreading";
|
||||
|
||||
String URL_SANDBOX = "https://sandbox.itunes.apple.com/verifyReceipt";
|
||||
String URL_VERIFY = "https://sandbox.itunes.apple.com/verifyReceipt";
|
||||
String URL_VERIFY = "https://buy.itunes.apple.com/verifyReceipt";
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
package com.peanut.modules.sociology.controller;
|
||||
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.CourseEntity;
|
||||
import com.peanut.modules.sociology.service.CourseService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController("sociologyCourse")
|
||||
@RequestMapping("sociology/course")
|
||||
public class CourseController {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.peanut.modules.sociology.controller;
|
||||
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.common.entity.CourseEntity;
|
||||
import com.peanut.modules.sociology.service.CourseService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController("sociologyHome")
|
||||
@RequestMapping("sociology/home")
|
||||
public class HomeController {
|
||||
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
|
||||
//首页-我的课程
|
||||
@RequestMapping("/getMyCourse")
|
||||
public R getMyCourse(String userId){
|
||||
List<CourseEntity> courseList = courseService.getMyCourse(userId);
|
||||
return R.ok().put("myCourse",courseList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.peanut.modules.sociology.controller;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Slf4j
|
||||
@RestController("sociologyShopProductSociology")
|
||||
@RequestMapping("sociology/shopProductSociology")
|
||||
public class ShopProductSociologyController {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,14 @@
|
||||
package com.peanut.modules.sociology.service;
|
||||
|
||||
public interface CourseService {
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.CourseEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CourseService extends IService<CourseEntity> {
|
||||
|
||||
List<CourseEntity> getMyCourse(String userId);
|
||||
|
||||
List<CourseEntity> getCourseListBySociology(String sociologyId);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.peanut.modules.sociology.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.ShopProductSociologyLabel;
|
||||
|
||||
public interface ShopProductSociologyLabelService extends IService<ShopProductSociologyLabel> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.peanut.modules.sociology.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.ShopProductSociologyMarket;
|
||||
|
||||
public interface ShopProductSociologyMarketService extends IService<ShopProductSociologyMarket> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.peanut.modules.sociology.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.ShopProductToSociologyLabel;
|
||||
|
||||
public interface ShopProductToSociologyLabelService extends IService<ShopProductToSociologyLabel> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.peanut.modules.sociology.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.common.entity.ShopProductToSociologyMarket;
|
||||
|
||||
public interface ShopProductToSociologyMarketService extends IService<ShopProductToSociologyMarket> {
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.peanut.modules.sociology.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.modules.common.dao.CourseDao;
|
||||
import com.peanut.modules.common.dao.CourseToSociologyDao;
|
||||
import com.peanut.modules.common.dao.UserToCourseDao;
|
||||
import com.peanut.modules.common.entity.CourseEntity;
|
||||
import com.peanut.modules.common.entity.CourseToSociologyEntity;
|
||||
import com.peanut.modules.common.entity.UserToCourseEntity;
|
||||
import com.peanut.modules.sociology.service.CourseService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service("sociologyCourseService")
|
||||
public class CourseServiceImpl extends ServiceImpl<CourseDao, CourseEntity> implements CourseService {
|
||||
|
||||
@Autowired
|
||||
public UserToCourseDao userToCourseDao;
|
||||
@Autowired
|
||||
public CourseToSociologyDao courseToSociologyDao;
|
||||
|
||||
//我的课程
|
||||
@Override
|
||||
public List<CourseEntity> getMyCourse(String userId) {
|
||||
MPJLambdaWrapper<UserToCourseEntity> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.selectAll(CourseEntity.class);
|
||||
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId,UserToCourseEntity::getCourseId);
|
||||
wrapper.groupBy(UserToCourseEntity::getCourseId);
|
||||
wrapper.eq(UserToCourseEntity::getUserId,userId);
|
||||
List courseList = userToCourseDao.selectMaps(wrapper);
|
||||
return courseList;
|
||||
}
|
||||
|
||||
//根据标签获取课程列表
|
||||
@Override
|
||||
public List<CourseEntity> getCourseListBySociology(String sociologyId) {
|
||||
MPJLambdaWrapper<CourseToSociologyEntity> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.selectAll(CourseEntity.class);
|
||||
wrapper.leftJoin(CourseEntity.class,CourseEntity::getId,CourseToSociologyEntity::getCourseId);
|
||||
List courseList = courseToSociologyDao.selectMaps(wrapper);
|
||||
return courseList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.sociology.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.ShopProductSociologyLabelDao;
|
||||
import com.peanut.modules.common.entity.ShopProductSociologyLabel;
|
||||
import com.peanut.modules.sociology.service.ShopProductSociologyLabelService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service("sociologyShopProductSociologyLabelService")
|
||||
public class ShopProductSociologyLabelServiceImpl extends ServiceImpl<ShopProductSociologyLabelDao, ShopProductSociologyLabel> implements ShopProductSociologyLabelService {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.sociology.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.ShopProductSociologyMarketDao;
|
||||
import com.peanut.modules.common.entity.ShopProductSociologyMarket;
|
||||
import com.peanut.modules.sociology.service.ShopProductSociologyMarketService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service("sociologyShopProductSociologyMarketService")
|
||||
public class ShopProductSociologyMarketServiceImpl extends ServiceImpl<ShopProductSociologyMarketDao, ShopProductSociologyMarket> implements ShopProductSociologyMarketService {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.sociology.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.ShopProductToSociologyLabelDao;
|
||||
import com.peanut.modules.common.entity.ShopProductToSociologyLabel;
|
||||
import com.peanut.modules.sociology.service.ShopProductToSociologyLabelService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service("sociologyShopProductToSociologyLabelService")
|
||||
public class ShopProductToSociologyLabelServiceImpl extends ServiceImpl<ShopProductToSociologyLabelDao, ShopProductToSociologyLabel> implements ShopProductToSociologyLabelService {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.peanut.modules.sociology.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.common.dao.ShopProductToSociologyMarketDao;
|
||||
import com.peanut.modules.common.entity.ShopProductToSociologyMarket;
|
||||
import com.peanut.modules.sociology.service.ShopProductToSociologyMarketService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service("sociologyShopProductToSociologyMarketService")
|
||||
public class ShopProductToSociologyMarketServiceImpl extends ServiceImpl<ShopProductToSociologyMarketDao, ShopProductToSociologyMarket> implements ShopProductToSociologyMarketService {
|
||||
}
|
||||
Reference in New Issue
Block a user