diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/store/controller/ShopAddressLabelController.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/store/controller/ShopAddressLabelController.java new file mode 100644 index 00000000..f2689c4e --- /dev/null +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/store/controller/ShopAddressLabelController.java @@ -0,0 +1,58 @@ +package com.skyeye.store.controller; + +import com.skyeye.annotation.api.Api; +import com.skyeye.annotation.api.ApiImplicitParam; +import com.skyeye.annotation.api.ApiImplicitParams; +import com.skyeye.annotation.api.ApiOperation; +import com.skyeye.common.entity.search.CommonPageInfo; +import com.skyeye.common.object.InputObject; +import com.skyeye.common.object.OutputObject; +import com.skyeye.store.entity.ShopAddressLabel; +import com.skyeye.store.service.ShopAddressLabelService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@Api(value = "收件地址标签管理", tags = "收件地址标签管理", modelName = "收件地址标签管理") +public class ShopAddressLabelController { + + @Autowired + private ShopAddressLabelService shopAddressLabelService; + + @ApiOperation(id = "writeShopAddressLabel", value = "新增/编辑收件地址标签信息", method = "POST", allUse = "2") + @ApiImplicitParams(classBean = ShopAddressLabel.class) + @RequestMapping("/post/ShopAddressLabelController/writeShopAddressLabel") + public void writeShopAddressLabel(InputObject inputObject, OutputObject outputObject) { + shopAddressLabelService.saveOrUpdateEntity(inputObject, outputObject); + } + + @ApiOperation(id = "deleteShopAddressLabelByIds", value = "批量删除收件地址标签信息", method = "DELETE", allUse = "2") + @ApiImplicitParams({ + @ApiImplicitParam(id = "ids", name = "ids", value = "主键id列表,多个id用逗号分隔", required = "required")}) + @RequestMapping("/post/ShopAddressLabelController/deleteShopAddressLabelByIds") + public void deleteShopAddressLabelByIds(InputObject inputObject, OutputObject outputObject) { + shopAddressLabelService.deleteById(inputObject, outputObject); + } + + @ApiOperation(id = "queryShopAddressLabelList", value = "获取自己的收件地址标签信息", method = "POST", allUse = "2") + @RequestMapping("/post/ShopAddressLabelController/queryShopAddressLabelList") + public void queryShopAddressLabelList(InputObject inputObject, OutputObject outputObject) { + shopAddressLabelService.queryList(inputObject, outputObject); + } + + @ApiOperation(id = "queryShopAddressLabelPageList", value = "分页获取收件地址标签信息", method = "POST", allUse = "2") + @ApiImplicitParams(classBean = CommonPageInfo.class) + @RequestMapping("/post/ShopAddressLabelController/queryShopAddressLabelPageList") + public void queryShopAddressLabelPageList(InputObject inputObject, OutputObject outputObject) { + shopAddressLabelService.queryPageList(inputObject, outputObject); + } + + @ApiOperation(id = "selectShopAddressLabelById", value = "根据id查询收件地址标签信息", method = "POST", allUse = "2") + @ApiImplicitParams({ + @ApiImplicitParam(id = "id", name = "id", value = "主键id", required = "required")}) + @RequestMapping("/post/ShopAddressLabelController/selectShopAddressLabelById") + public void selectShopAddressLabelById(InputObject inputObject, OutputObject outputObject) { + shopAddressLabelService.selectById(inputObject, outputObject); + } +} \ No newline at end of file diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/store/dao/ShopAddressLabelDao.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/store/dao/ShopAddressLabelDao.java new file mode 100644 index 00000000..2b36ea0d --- /dev/null +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/store/dao/ShopAddressLabelDao.java @@ -0,0 +1,7 @@ +package com.skyeye.store.dao; + +import com.skyeye.eve.dao.SkyeyeBaseMapper; +import com.skyeye.store.entity.ShopAddressLabel; + +public interface ShopAddressLabelDao extends SkyeyeBaseMapper { +} diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/store/entity/ShopAddressLabel.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/store/entity/ShopAddressLabel.java new file mode 100644 index 00000000..47507a86 --- /dev/null +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/store/entity/ShopAddressLabel.java @@ -0,0 +1,23 @@ +package com.skyeye.store.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.skyeye.annotation.api.ApiModel; +import com.skyeye.annotation.api.ApiModelProperty; +import com.skyeye.common.entity.features.OperatorUserInfo; +import lombok.Data; + +@Data +@TableName(value = "shop_address_label") +@ApiModel("收件地址标签管理实体类") +public class ShopAddressLabel extends OperatorUserInfo { + + @TableId("id") + @ApiModelProperty("主键id。为空时新增,不为空时编辑") + private String id; + + @TableField("content") + @ApiModelProperty(value = "标签内容", required = "required", fuzzyLike = true) + private String content; +} diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/store/service/ShopAddressLabelService.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/store/service/ShopAddressLabelService.java new file mode 100644 index 00000000..66a96aed --- /dev/null +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/store/service/ShopAddressLabelService.java @@ -0,0 +1,7 @@ +package com.skyeye.store.service; + +import com.skyeye.base.business.service.SkyeyeBusinessService; +import com.skyeye.store.entity.ShopAddressLabel; + +public interface ShopAddressLabelService extends SkyeyeBusinessService { +} diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/store/service/impl/ShopAddressLabelServiceImpl.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/store/service/impl/ShopAddressLabelServiceImpl.java new file mode 100644 index 00000000..77ea8b23 --- /dev/null +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/store/service/impl/ShopAddressLabelServiceImpl.java @@ -0,0 +1,61 @@ +package com.skyeye.store.service.impl; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.json.JSONUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.skyeye.annotation.service.SkyeyeService; +import com.skyeye.base.business.service.impl.SkyeyeBusinessServiceImpl; +import com.skyeye.common.constans.CommonCharConstants; +import com.skyeye.common.constans.CommonConstants; +import com.skyeye.common.entity.search.CommonPageInfo; +import com.skyeye.common.object.InputObject; +import com.skyeye.common.object.OutputObject; +import com.skyeye.common.util.mybatisplus.MybatisPlusUtil; +import com.skyeye.store.dao.ShopAddressLabelDao; +import com.skyeye.store.entity.ShopAddressLabel; +import com.skyeye.store.service.ShopAddressLabelService; +import org.apache.poi.ss.formula.functions.T; +import org.springframework.stereotype.Service; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +@Service +@SkyeyeService(name = "收件地址标签管理", groupName = "收件地址标签管理") +public class ShopAddressLabelServiceImpl extends SkyeyeBusinessServiceImpl implements ShopAddressLabelService { + + @Override + public void validatorEntity(ShopAddressLabel shopAddressLabel) { + super.validatorEntity(shopAddressLabel); + String userId = InputObject.getLogParamsStatic().get("id").toString(); + QueryWrapper queryWrapper = new QueryWrapper<>(); + //更新时排除本身 + if (StrUtil.isNotEmpty(shopAddressLabel.getId())) { + queryWrapper.ne(CommonConstants.ID, shopAddressLabel.getId()); + } + queryWrapper.eq(MybatisPlusUtil.toColumns(ShopAddressLabel::getCreateId), userId); + List list = list(queryWrapper); + //排除重复的标签 + for (ShopAddressLabel addressLabel : list) { + if (addressLabel.getContent().equals(shopAddressLabel.getContent())) { + throw new RuntimeException("标签重复"); + } + } + } + + @Override + public void deleteById(InputObject inputObject, OutputObject outputObject) { + String ids = inputObject.getParams().get("ids").toString(); + List idList = Arrays.asList(ids.split(CommonCharConstants.COMMA_MARK)); + super.deleteById(idList); + } + + @Override + public List> queryDataList(InputObject inputObject) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq(MybatisPlusUtil.toColumns(ShopAddressLabel::getCreateId), inputObject.getLogParams().get("id").toString()); + List list = list(queryWrapper); + return JSONUtil.toList(JSONUtil.toJsonStr(list), null); + } +} \ No newline at end of file