Merge #85 into master from cc_20260331_material_blacklist
fix:小程序门店物料黑名单接口 * cc_20260331_material_blacklist: (1 commits squashed) - fix:小程序门店物料黑名单接口 Signed-off-by: 王非凡 <accounts_67eba0c5fee9c49c80c8e2b4@mail.teambition.com> Merged-by: 正新 <accounts_6964c7bcd2a2c377c5bbd01b@mail.teambition.com> CR-link: https://codeup.aliyun.com/692ea314dec569489f6f167c/hangzhou/java/custom_zxjp/change/85
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package com.cool.store.dao.store;
|
||||
|
||||
import com.cool.store.entity.store.StoreMaterialBlacklistDO;
|
||||
import com.cool.store.mapper.store.StoreMaterialBlacklistMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import tk.mybatis.mapper.entity.Example;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 门店物料黑名单
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/3/31
|
||||
*/
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class StoreMaterialBlacklistDAO {
|
||||
private final StoreMaterialBlacklistMapper storeMaterialBlacklistMapper;
|
||||
|
||||
public List<StoreMaterialBlacklistDO> getByStoreId(String storeId) {
|
||||
Example example = new Example(StoreMaterialBlacklistDO.class);
|
||||
example.createCriteria()
|
||||
.andEqualTo("storeId", storeId);
|
||||
example.setOrderByClause("create_time DESC");
|
||||
return storeMaterialBlacklistMapper.selectByExample(example);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.cool.store.mapper.store;
|
||||
|
||||
import com.cool.store.entity.store.StoreMaterialBlacklistDO;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @date 2026-03-30 09:31
|
||||
*/
|
||||
public interface StoreMaterialBlacklistMapper extends Mapper<StoreMaterialBlacklistDO> {
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.cool.store.entity.store;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 门店物料黑名单
|
||||
* @author wangff
|
||||
* @date 2026-03-30 09:31
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table(name = "store_material_blacklist_${enterpriseId}")
|
||||
public class StoreMaterialBlacklistDO implements Serializable {
|
||||
@ApiModelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("门店id")
|
||||
private String storeId;
|
||||
|
||||
@ApiModelProperty("限制物料")
|
||||
private String material;
|
||||
|
||||
@ApiModelProperty("限制原因")
|
||||
private String reason;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@ApiModelProperty("创建人id")
|
||||
private String createUserId;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.cool.store.request.store;
|
||||
|
||||
import com.cool.store.common.PageBasicInfo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 门店物料黑名单查询请求
|
||||
* @author wangff
|
||||
* @date 2026-03-30
|
||||
*/
|
||||
@Data
|
||||
public class StoreMaterialBlacklistQueryRequest extends PageBasicInfo {
|
||||
@ApiModelProperty("门店id")
|
||||
private String storeId;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.cool.store.vo.store;
|
||||
|
||||
import com.cool.store.annotation.DictField;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 门店物料黑名单VO
|
||||
* @author wangff
|
||||
* @date 2026-03-30
|
||||
*/
|
||||
@Data
|
||||
public class StoreMaterialBlacklistVO implements Serializable {
|
||||
@ApiModelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("门店id")
|
||||
private String storeId;
|
||||
|
||||
@ApiModelProperty("门店编码")
|
||||
private String storeNum;
|
||||
|
||||
@ApiModelProperty("门店名称")
|
||||
private String storeName;
|
||||
|
||||
@ApiModelProperty("所属大区名称")
|
||||
private String branchName;
|
||||
|
||||
@ApiModelProperty("限制物料")
|
||||
private String material;
|
||||
|
||||
@ApiModelProperty("限制物料名称")
|
||||
@DictField
|
||||
private String materialName;
|
||||
|
||||
@ApiModelProperty("限制原因")
|
||||
private String reason;
|
||||
|
||||
@ApiModelProperty("限制原因名称")
|
||||
@DictField
|
||||
private String reasonName;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.cool.store.service.store;
|
||||
|
||||
import com.cool.store.request.store.StoreMaterialBlacklistQueryRequest;
|
||||
import com.cool.store.vo.store.StoreMaterialBlacklistVO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
/**
|
||||
* 门店物料黑名单服务
|
||||
* @author wangff
|
||||
* @date 2026-03-30
|
||||
*/
|
||||
public interface StoreMaterialBlacklistService {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param request 查询请求
|
||||
* @return 分页结果
|
||||
*/
|
||||
PageInfo<StoreMaterialBlacklistVO> pageByStoreId(StoreMaterialBlacklistQueryRequest request);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.cool.store.service.store.impl;
|
||||
|
||||
import com.cool.store.dao.RegionDao;
|
||||
import com.cool.store.dao.StoreDao;
|
||||
import com.cool.store.dao.store.StoreMaterialBlacklistDAO;
|
||||
import com.cool.store.entity.RegionDO;
|
||||
import com.cool.store.entity.StoreDO;
|
||||
import com.cool.store.entity.store.StoreMaterialBlacklistDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.cool.store.request.store.StoreMaterialBlacklistQueryRequest;
|
||||
import com.cool.store.service.dict.impl.DictService;
|
||||
import com.cool.store.service.store.StoreMaterialBlacklistService;
|
||||
import com.cool.store.utils.BeanUtil;
|
||||
import com.cool.store.vo.store.StoreMaterialBlacklistVO;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 门店物料黑名单服务实现
|
||||
* @author wangff
|
||||
* @date 2026-03-30
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class StoreMaterialBlacklistServiceImpl implements StoreMaterialBlacklistService {
|
||||
|
||||
private final StoreMaterialBlacklistDAO storeMaterialBlacklistDAO;
|
||||
private final StoreDao storeDao;
|
||||
private final RegionDao regionDao;
|
||||
private final DictService dictService;
|
||||
|
||||
|
||||
@Override
|
||||
public PageInfo<StoreMaterialBlacklistVO> pageByStoreId(StoreMaterialBlacklistQueryRequest request) {
|
||||
StoreDO storeDO = storeDao.getByStoreId(request.getStoreId());
|
||||
if (Objects.isNull(storeDO)) {
|
||||
throw new ServiceException(ErrorCodeEnum.STORE_NOT_FIND);
|
||||
}
|
||||
PageHelper.startPage(request.getPageNum(), request.getPageSize());
|
||||
List<StoreMaterialBlacklistDO> list = storeMaterialBlacklistDAO.getByStoreId(request.getStoreId());
|
||||
PageInfo<StoreMaterialBlacklistDO> page = new PageInfo<>(list);
|
||||
|
||||
PageInfo<StoreMaterialBlacklistVO> result = BeanUtil.toPage(page, StoreMaterialBlacklistVO.class);
|
||||
RegionDO branch = regionDao.getRegionById(storeDO.getBranch());
|
||||
for (StoreMaterialBlacklistVO vo : result.getList()) {
|
||||
vo.setStoreNum(storeDO.getStoreNum());
|
||||
vo.setStoreName(storeDO.getStoreName());
|
||||
if (Objects.nonNull(branch)) {
|
||||
vo.setBranchName(branch.getName());
|
||||
}
|
||||
}
|
||||
dictService.fillDictField(result.getList());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.cool.store.controller.webc;
|
||||
|
||||
import com.cool.store.request.store.StoreMaterialBlacklistQueryRequest;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.store.StoreMaterialBlacklistService;
|
||||
import com.cool.store.vo.store.StoreMaterialBlacklistVO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 门店物料黑名单 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author wangff
|
||||
* @since 2026/3/31
|
||||
*/
|
||||
@Api(tags = "Mini门店物料黑名单")
|
||||
@RestController
|
||||
@RequestMapping("/mini/material/blacklist")
|
||||
@RequiredArgsConstructor
|
||||
public class MiniStoreMaterialBlacklistController {
|
||||
private final StoreMaterialBlacklistService storeMaterialBlacklistService;
|
||||
|
||||
@ApiOperation("根据门店查询黑名单")
|
||||
@GetMapping("/page")
|
||||
public ResponseResult<PageInfo<StoreMaterialBlacklistVO>> page(StoreMaterialBlacklistQueryRequest request) {
|
||||
return ResponseResult.success(storeMaterialBlacklistService.pageByStoreId(request));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user