master:档口首页更新常用功能;
parent
9046a31afc
commit
1f3e7400b1
|
|
@ -1,18 +1,26 @@
|
|||
package com.ruoyi.web.controller.xkt;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.XktBaseController;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.domain.vo.menu.SysMenuDTO;
|
||||
import com.ruoyi.system.service.ISysMenuService;
|
||||
import com.ruoyi.web.controller.xkt.vo.storeQuickFunction.StoreQuickFuncVO;
|
||||
import com.ruoyi.xkt.domain.StoreQuickFunction;
|
||||
import com.ruoyi.xkt.dto.storeQuickFunction.StoreQuickFuncDTO;
|
||||
import com.ruoyi.xkt.service.IStoreQuickFunctionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -22,10 +30,40 @@ import java.util.List;
|
|||
* @date 2025-03-26
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/rest/v1/quick-funcs")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/rest/v1/quick-functions")
|
||||
public class StoreQuickFunctionController extends XktBaseController {
|
||||
@Autowired
|
||||
private IStoreQuickFunctionService storeQuickFunctionService;
|
||||
|
||||
final IStoreQuickFunctionService storeQuickFuncService;
|
||||
final ISysMenuService menuService;
|
||||
|
||||
/**
|
||||
* 查看当前档口已绑定的所有快捷菜单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:function:list')")
|
||||
@GetMapping("/menus/{storeId}")
|
||||
public StoreQuickFuncVO getMenus(@PathVariable Long storeId) {
|
||||
// 找到当前档口所有的快捷菜单
|
||||
List<StoreQuickFuncDTO.DetailDTO> checkedList = storeQuickFuncService.getCheckedMenuList(storeId);
|
||||
// 找到系统所有的二级菜单
|
||||
List<SysMenuDTO> sysMenuList = menuService.selectMenuListByRoleIdAndMenuType(2L, "C");
|
||||
return StoreQuickFuncVO.builder().storeId(storeId)
|
||||
.checkedList(CollectionUtils.isEmpty(checkedList) ? new ArrayList<>() : BeanUtil.copyToList(checkedList, StoreQuickFuncVO.QuickFuncDetailVO.class))
|
||||
.menuList(CollectionUtils.isEmpty(sysMenuList) ? new ArrayList<>() : BeanUtil.copyToList(sysMenuList, StoreQuickFuncVO.QuickFuncDetailVO.class))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改档口快捷功能
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:function:edit')")
|
||||
@Log(title = "档口快捷功能", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/checked")
|
||||
public R editCheckedList( @Validated @RequestBody StoreQuickFuncVO quickFuncVO) {
|
||||
storeQuickFuncService.updateCheckedList(BeanUtil.toBean(quickFuncVO, StoreQuickFuncDTO.class));
|
||||
return success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询档口快捷功能列表
|
||||
|
|
@ -34,7 +72,7 @@ public class StoreQuickFunctionController extends XktBaseController {
|
|||
@GetMapping("/list")
|
||||
public TableDataInfo list(StoreQuickFunction storeQuickFunction) {
|
||||
startPage();
|
||||
List<StoreQuickFunction> list = storeQuickFunctionService.selectStoreQuickFunctionList(storeQuickFunction);
|
||||
List<StoreQuickFunction> list = storeQuickFuncService.selectStoreQuickFunctionList(storeQuickFunction);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
|
@ -45,7 +83,7 @@ public class StoreQuickFunctionController extends XktBaseController {
|
|||
@Log(title = "档口快捷功能", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, StoreQuickFunction storeQuickFunction) {
|
||||
List<StoreQuickFunction> list = storeQuickFunctionService.selectStoreQuickFunctionList(storeQuickFunction);
|
||||
List<StoreQuickFunction> list = storeQuickFuncService.selectStoreQuickFunctionList(storeQuickFunction);
|
||||
ExcelUtil<StoreQuickFunction> util = new ExcelUtil<StoreQuickFunction>(StoreQuickFunction.class);
|
||||
util.exportExcel(response, list, "档口快捷功能数据");
|
||||
}
|
||||
|
|
@ -56,7 +94,7 @@ public class StoreQuickFunctionController extends XktBaseController {
|
|||
@PreAuthorize("@ss.hasPermi('system:function:query')")
|
||||
@GetMapping(value = "/{storeQuickFuncId}")
|
||||
public R getInfo(@PathVariable("storeQuickFuncId") Long storeQuickFuncId) {
|
||||
return success(storeQuickFunctionService.selectStoreQuickFunctionByStoreQuickFuncId(storeQuickFuncId));
|
||||
return success(storeQuickFuncService.selectStoreQuickFunctionByStoreQuickFuncId(storeQuickFuncId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -66,7 +104,7 @@ public class StoreQuickFunctionController extends XktBaseController {
|
|||
@Log(title = "档口快捷功能", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public R add(@RequestBody StoreQuickFunction storeQuickFunction) {
|
||||
return success(storeQuickFunctionService.insertStoreQuickFunction(storeQuickFunction));
|
||||
return success(storeQuickFuncService.insertStoreQuickFunction(storeQuickFunction));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -76,7 +114,7 @@ public class StoreQuickFunctionController extends XktBaseController {
|
|||
@Log(title = "档口快捷功能", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public R edit(@RequestBody StoreQuickFunction storeQuickFunction) {
|
||||
return success(storeQuickFunctionService.updateStoreQuickFunction(storeQuickFunction));
|
||||
return success(storeQuickFuncService.updateStoreQuickFunction(storeQuickFunction));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -86,6 +124,7 @@ public class StoreQuickFunctionController extends XktBaseController {
|
|||
@Log(title = "档口快捷功能", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{storeQuickFuncIds}")
|
||||
public R remove(@PathVariable Long[] storeQuickFuncIds) {
|
||||
return success(storeQuickFunctionService.deleteStoreQuickFunctionByStoreQuickFuncIds(storeQuickFuncIds));
|
||||
return success(storeQuickFuncService.deleteStoreQuickFunctionByStoreQuickFuncIds(storeQuickFuncIds));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
package com.ruoyi.web.controller.xkt.vo.storeQuickFunction;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel("档口快捷功能")
|
||||
@Data
|
||||
@Builder
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class StoreQuickFuncVO {
|
||||
|
||||
@ApiModelProperty(name = "档口ID")
|
||||
@NotNull(message = "档口ID不能为空!")
|
||||
private Long storeId;
|
||||
@ApiModelProperty(name = "档口勾选的快捷功能")
|
||||
@NotNull(message = "档口勾选的快捷功能不能为空!")
|
||||
private List<QuickFuncDetailVO> checkedList;
|
||||
@ApiModelProperty(name = "系统所有的二级菜单列表")
|
||||
private List<QuickFuncDetailVO> menuList;
|
||||
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public static class QuickFuncDetailVO {
|
||||
@ApiModelProperty(name = "菜单名称")
|
||||
private String menuName;
|
||||
@ApiModelProperty(name = "显示顺序")
|
||||
private Integer orderNum;
|
||||
@ApiModelProperty(name = "路由地址")
|
||||
private String path;
|
||||
@ApiModelProperty(name = "组件路径")
|
||||
private String component;
|
||||
@ApiModelProperty(name = "菜单图标")
|
||||
private String icon;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.ruoyi.system.domain.vo.menu;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class SysMenuDTO {
|
||||
|
||||
private String menuName;
|
||||
private Integer orderNum;
|
||||
private String path;
|
||||
private String component;
|
||||
private String icon;
|
||||
|
||||
}
|
||||
|
|
@ -1,16 +1,17 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.ruoyi.common.core.domain.entity.SysMenu;
|
||||
import com.ruoyi.system.domain.vo.menu.SysMenuDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜单表 数据层
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface SysMenuMapper
|
||||
{
|
||||
public interface SysMenuMapper {
|
||||
/**
|
||||
* 查询系统菜单列表
|
||||
*
|
||||
|
|
@ -36,7 +37,7 @@ public interface SysMenuMapper
|
|||
|
||||
/**
|
||||
* 根据角色ID查询权限
|
||||
*
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @return 权限列表
|
||||
*/
|
||||
|
|
@ -67,8 +68,8 @@ public interface SysMenuMapper
|
|||
|
||||
/**
|
||||
* 根据角色ID查询菜单树信息
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param menuCheckStrictly 菜单树选择项是否关联显示
|
||||
* @return 选中菜单列表
|
||||
*/
|
||||
|
|
@ -122,4 +123,7 @@ public interface SysMenuMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public SysMenu checkMenuNameUnique(@Param("menuName") String menuName, @Param("parentId") Long parentId);
|
||||
|
||||
List<SysMenuDTO> selectMenuListByRoleIdAndMenuType(@Param("roleId") Long roleId, @Param("menuType") String menuType);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import java.util.Set;
|
|||
import com.ruoyi.common.core.domain.TreeSelect;
|
||||
import com.ruoyi.common.core.domain.entity.SysMenu;
|
||||
import com.ruoyi.system.domain.vo.RouterVo;
|
||||
import com.ruoyi.system.domain.vo.menu.SysMenuDTO;
|
||||
|
||||
/**
|
||||
* 菜单 业务层
|
||||
|
|
@ -21,6 +22,14 @@ public interface ISysMenuService
|
|||
*/
|
||||
public List<SysMenu> selectMenuList(Long userId);
|
||||
|
||||
/**
|
||||
* 根据角色获取菜单列表
|
||||
* @param roleId 角色ID
|
||||
* @param menuType 菜单类型
|
||||
* @return List<SysMenuDTO>
|
||||
*/
|
||||
public List<SysMenuDTO> selectMenuListByRoleIdAndMenuType(Long roleId, String menuType);
|
||||
|
||||
/**
|
||||
* 根据用户查询系统菜单列表
|
||||
*
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.ruoyi.system.domain.vo.menu.SysMenuDTO;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
|
|
@ -44,6 +48,19 @@ public class SysMenuServiceImpl implements ISysMenuService
|
|||
@Autowired
|
||||
private SysRoleMenuMapper roleMenuMapper;
|
||||
|
||||
/**
|
||||
* 根据角色获取菜单列表
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param menuType 菜单类型
|
||||
* @return List<SysMenuDTO>
|
||||
*/
|
||||
@Override
|
||||
public List<SysMenuDTO> selectMenuListByRoleIdAndMenuType(Long roleId, String menuType) {
|
||||
return this.menuMapper.selectMenuListByRoleIdAndMenuType(roleId, menuType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户查询系统菜单列表
|
||||
*
|
||||
|
|
|
|||
|
|
@ -203,4 +203,20 @@
|
|||
delete from sys_menu where menu_id = #{menuId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
<select id="selectMenuListByRoleIdAndMenuType" resultType="com.ruoyi.system.domain.vo.menu.SysMenuDTO">
|
||||
SELECT
|
||||
sm.menu_name AS menuName,
|
||||
sm.path ,
|
||||
sm.component ,
|
||||
sm.icon ,
|
||||
sm.order_num AS orderNum
|
||||
FROM
|
||||
sys_role_menu srm
|
||||
LEFT JOIN sys_menu sm ON srm.menu_id = sm.menu_id
|
||||
WHERE
|
||||
sm.`status` = 0
|
||||
AND sm.menu_type = #{menuType}
|
||||
AND srm.role_id = #{roleId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -5,6 +5,7 @@ import com.ruoyi.common.annotation.Excel;
|
|||
import com.ruoyi.common.core.domain.XktBaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
|
|
@ -35,19 +36,19 @@ public class StoreQuickFunction extends XktBaseEntity {
|
|||
* 快捷功能名称
|
||||
*/
|
||||
@Excel(name = "快捷功能名称")
|
||||
private String funcName;
|
||||
private String menuName;
|
||||
|
||||
/**
|
||||
* 快捷功能图标
|
||||
*/
|
||||
@Excel(name = "快捷功能图标")
|
||||
private String funcIcon;
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 快捷功能路径
|
||||
*/
|
||||
@Excel(name = "快捷功能路径")
|
||||
private String funcUrl;
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
|
|
@ -61,9 +62,9 @@ public class StoreQuickFunction extends XktBaseEntity {
|
|||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("storeId", getStoreId())
|
||||
.append("funcName", getFuncName())
|
||||
.append("funcIcon", getFuncIcon())
|
||||
.append("funcUrl", getFuncUrl())
|
||||
.append("menuName", getMenuName())
|
||||
.append("icon", getIcon())
|
||||
.append("path", getPath())
|
||||
.append("orderNum", getOrderNum())
|
||||
.append("version", getVersion())
|
||||
.append("delFlag", getDelFlag())
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -26,10 +27,11 @@ public class StoreProdFuzzyResDTO {
|
|||
@ApiModelProperty(name = "商品货号")
|
||||
private String prodArtNum;
|
||||
@ApiModelProperty("商品下颜色列表")
|
||||
private List<StoreProdFuzzyColorResVO> colorList;
|
||||
private List<StoreProdFuzzyColorResDTO> colorList;
|
||||
|
||||
@Data
|
||||
public static class StoreProdFuzzyColorResVO {
|
||||
@RequiredArgsConstructor
|
||||
public static class StoreProdFuzzyColorResDTO {
|
||||
@ApiModelProperty("档口颜色ID")
|
||||
private Long storeColorId;
|
||||
@ApiModelProperty("颜色名称")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
package com.ruoyi.xkt.dto.storeQuickFunction;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liujiang
|
||||
* @version v1.0
|
||||
* @date 2025/3/27 15:12
|
||||
*/
|
||||
@ApiModel("档口快捷功能")
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class StoreQuickFuncDTO {
|
||||
|
||||
@ApiModelProperty(name = "档口ID")
|
||||
private Long storeId;
|
||||
@ApiModelProperty(name = "档口勾选的快捷功能")
|
||||
List<DetailDTO> checkedList;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public static class DetailDTO {
|
||||
@ApiModelProperty(name = "菜单名称")
|
||||
private String menuName;
|
||||
@ApiModelProperty(name = "显示顺序")
|
||||
private Integer orderNum;
|
||||
@ApiModelProperty(name = "路由地址")
|
||||
private String path;
|
||||
@ApiModelProperty(name = "组件路径")
|
||||
private String component;
|
||||
@ApiModelProperty(name = "菜单图标")
|
||||
private String icon;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,8 @@ package com.ruoyi.xkt.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.xkt.domain.StoreProduct;
|
||||
import com.ruoyi.xkt.dto.storeProduct.StoreProdFuzzyResDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
|||
|
|
@ -59,4 +59,7 @@ public interface StoreQuickFunctionMapper extends BaseMapper<StoreQuickFunction>
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteStoreQuickFunctionByStoreQuickFuncIds(Long[] storeQuickFuncIds);
|
||||
|
||||
void updateDelFlagByStoreId(Long storeId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.xkt.service;
|
||||
|
||||
import com.ruoyi.xkt.domain.StoreQuickFunction;
|
||||
import com.ruoyi.xkt.dto.storeQuickFunction.StoreQuickFuncDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -58,4 +59,19 @@ public interface IStoreQuickFunctionService {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteStoreQuickFunctionByStoreQuickFuncId(Long storeQuickFuncId);
|
||||
|
||||
/**
|
||||
* 获取当前档口绑定的快捷功能
|
||||
* @param storeId 当前档口ID
|
||||
* @return List<StoreQuickFuncDTO.DetailDTO>
|
||||
*/
|
||||
List<StoreQuickFuncDTO.DetailDTO> getCheckedMenuList(Long storeId);
|
||||
|
||||
/**
|
||||
* 更新档口绑定的快捷功能
|
||||
* @param storeQuickFuncDTO 绑定档口快捷功能的DTO
|
||||
* @return
|
||||
*/
|
||||
void updateCheckedList(StoreQuickFuncDTO storeQuickFuncDTO);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ public class StoreProductBarcodeMatchServiceImpl implements IStoreProductBarcode
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int deleteStoreProductBarcodeMatchByStoreProdBarcodeMatchIds(Long[] storeProdBarcodeMatchIds) {
|
||||
return storeProductBarcodeMatchMapper.deleteStoreProductBarcodeMatchByStoreProdBarcodeMatchIds(storeProdBarcodeMatchIds);
|
||||
}
|
||||
|
|
@ -88,12 +89,18 @@ public class StoreProductBarcodeMatchServiceImpl implements IStoreProductBarcode
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public int deleteStoreProductBarcodeMatchByStoreProdBarcodeMatchId(Long storeProdBarcodeMatchId) {
|
||||
return storeProductBarcodeMatchMapper.deleteStoreProductBarcodeMatchByStoreProdBarcodeMatchId(storeProdBarcodeMatchId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int updateBarcodeMatch(BarcodeMatchDTO barcodeMatchDTO) {
|
||||
// 找到当前商品颜色所有的尺码,并转换为map
|
||||
|
||||
// 如果已经扫码过一次了,则更新,如果没有扫码过,则插入
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import com.ruoyi.xkt.dto.storeProdProcess.StoreProdProcessDTO;
|
|||
import com.ruoyi.xkt.dto.storeProdSvc.StoreProdSvcDTO;
|
||||
import com.ruoyi.xkt.dto.storeProduct.*;
|
||||
import com.ruoyi.xkt.dto.storeProductFile.StoreProdFileDTO;
|
||||
import com.ruoyi.xkt.dto.storeProductFile.StoreProdFilePicSpaceResDTO;
|
||||
import com.ruoyi.xkt.dto.storeProductFile.StoreProdFileResDTO;
|
||||
import com.ruoyi.xkt.dto.storeProductFile.StoreProdMainPicDTO;
|
||||
import com.ruoyi.xkt.mapper.*;
|
||||
|
|
@ -300,17 +299,42 @@ public class StoreProductServiceImpl implements IStoreProductService {
|
|||
* @param prodArtNum 商品货号
|
||||
* @return List<String>
|
||||
*/
|
||||
/**
|
||||
* 根据商店ID和产品货号模糊查询产品列表
|
||||
*
|
||||
* @param storeId 商店ID,用于查询特定商店的产品
|
||||
* @param prodArtNum 产品货号,用于模糊匹配产品
|
||||
* @return 返回一个包含模糊查询结果的列表,每个元素包含产品信息和颜色信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<StoreProdFuzzyResDTO> fuzzyQueryList(Long storeId, String prodArtNum) {
|
||||
/* LambdaQueryWrapper<StoreProduct> queryWrapper = new LambdaQueryWrapper<StoreProduct>()
|
||||
// 初始化查询条件,确保查询的是指定商店且未删除的产品
|
||||
LambdaQueryWrapper<StoreProduct> queryWrapper = new LambdaQueryWrapper<StoreProduct>()
|
||||
.eq(StoreProduct::getStoreId, storeId).eq(StoreProduct::getDelFlag, "0");
|
||||
// 如果产品货号非空,添加模糊查询条件
|
||||
if (StringUtils.isNotBlank(prodArtNum)) {
|
||||
queryWrapper.like(StoreProduct::getProdArtNum, prodArtNum);
|
||||
}
|
||||
// 执行查询,获取产品列表
|
||||
List<StoreProduct> storeProdList = this.storeProdMapper.selectList(queryWrapper);
|
||||
return CollectionUtils.isEmpty(storeProdList) ? new ArrayList<>()
|
||||
: storeProdList.stream().map(StoreProduct::getProdArtNum).distinct().collect(Collectors.toList());*/
|
||||
return null;
|
||||
// 如果查询结果为空,直接返回空列表
|
||||
if (CollectionUtils.isEmpty(storeProdList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// 提取查询结果中的产品ID列表
|
||||
List<Long> storeProdIdList = storeProdList.stream().map(StoreProduct::getId).distinct().collect(Collectors.toList());
|
||||
// 查询与产品ID列表关联的颜色信息
|
||||
List<StoreProductColor> colorList = this.storeProdColorMapper.selectList(new LambdaQueryWrapper<StoreProductColor>()
|
||||
.in(StoreProductColor::getStoreProdId, storeProdIdList).eq(StoreProductColor::getDelFlag, "0"));
|
||||
// 将颜色信息按产品ID分组,并转换为所需的颜色DTO列表
|
||||
Map<Long, List<StoreProdFuzzyResDTO.StoreProdFuzzyColorResDTO>> colorMap = CollectionUtils.isEmpty(colorList) ? new HashMap<>()
|
||||
: colorList.stream().collect(Collectors.groupingBy(StoreProductColor::getStoreProdId, Collectors
|
||||
.collectingAndThen(Collectors.toList(), list -> list.stream().map(y -> BeanUtil.toBean(y, StoreProdFuzzyResDTO.StoreProdFuzzyColorResDTO.class))
|
||||
.collect(Collectors.toList()))));
|
||||
// 将产品列表转换为所需的产品DTO列表,并关联颜色信息
|
||||
return storeProdList.stream().map(x -> BeanUtil.toBean(x, StoreProdFuzzyResDTO.class).setStoreProdId(x.getId())
|
||||
.setColorList(colorMap.getOrDefault(x.getId(), new ArrayList<>()))).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,18 @@
|
|||
package com.ruoyi.xkt.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.xkt.domain.StoreQuickFunction;
|
||||
import com.ruoyi.xkt.dto.storeQuickFunction.StoreQuickFuncDTO;
|
||||
import com.ruoyi.xkt.mapper.StoreQuickFunctionMapper;
|
||||
import com.ruoyi.xkt.service.IStoreQuickFunctionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -17,9 +22,34 @@ import java.util.List;
|
|||
* @date 2025-03-26
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class StoreQuickFunctionServiceImpl implements IStoreQuickFunctionService {
|
||||
@Autowired
|
||||
private StoreQuickFunctionMapper storeQuickFunctionMapper;
|
||||
|
||||
final StoreQuickFunctionMapper storeQuickFuncMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<StoreQuickFuncDTO.DetailDTO> getCheckedMenuList(Long storeId) {
|
||||
List<StoreQuickFunction> storeQuickFuncList = storeQuickFuncMapper.selectList(new LambdaQueryWrapper<StoreQuickFunction>()
|
||||
.eq(StoreQuickFunction::getStoreId,storeId).eq(StoreQuickFunction::getDelFlag,"0"));
|
||||
return CollectionUtils.isEmpty(storeQuickFuncList) ? new ArrayList<>() : BeanUtil.copyToList(storeQuickFuncList, StoreQuickFuncDTO.DetailDTO.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新档口绑定的快捷功能
|
||||
*
|
||||
* @param storeQuickFuncDTO 绑定档口快捷功能的DTO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void updateCheckedList(StoreQuickFuncDTO storeQuickFuncDTO) {
|
||||
// 先将旧的绑定关系置为无效
|
||||
this.storeQuickFuncMapper.updateDelFlagByStoreId(storeQuickFuncDTO.getStoreId());
|
||||
// 新增档口的快捷功能
|
||||
List<StoreQuickFunction> checkedList = BeanUtil.copyToList(storeQuickFuncDTO.getCheckedList(), StoreQuickFunction.class);
|
||||
checkedList.forEach(x -> x.setStoreId(storeQuickFuncDTO.getStoreId()));
|
||||
this.storeQuickFuncMapper.insert(checkedList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询档口快捷功能
|
||||
|
|
@ -30,7 +60,7 @@ public class StoreQuickFunctionServiceImpl implements IStoreQuickFunctionService
|
|||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public StoreQuickFunction selectStoreQuickFunctionByStoreQuickFuncId(Long storeQuickFuncId) {
|
||||
return storeQuickFunctionMapper.selectStoreQuickFunctionByStoreQuickFuncId(storeQuickFuncId);
|
||||
return storeQuickFuncMapper.selectStoreQuickFunctionByStoreQuickFuncId(storeQuickFuncId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -42,7 +72,7 @@ public class StoreQuickFunctionServiceImpl implements IStoreQuickFunctionService
|
|||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<StoreQuickFunction> selectStoreQuickFunctionList(StoreQuickFunction storeQuickFunction) {
|
||||
return storeQuickFunctionMapper.selectStoreQuickFunctionList(storeQuickFunction);
|
||||
return storeQuickFuncMapper.selectStoreQuickFunctionList(storeQuickFunction);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -55,7 +85,7 @@ public class StoreQuickFunctionServiceImpl implements IStoreQuickFunctionService
|
|||
@Transactional
|
||||
public int insertStoreQuickFunction(StoreQuickFunction storeQuickFunction) {
|
||||
storeQuickFunction.setCreateTime(DateUtils.getNowDate());
|
||||
return storeQuickFunctionMapper.insertStoreQuickFunction(storeQuickFunction);
|
||||
return storeQuickFuncMapper.insertStoreQuickFunction(storeQuickFunction);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -68,7 +98,7 @@ public class StoreQuickFunctionServiceImpl implements IStoreQuickFunctionService
|
|||
@Transactional
|
||||
public int updateStoreQuickFunction(StoreQuickFunction storeQuickFunction) {
|
||||
storeQuickFunction.setUpdateTime(DateUtils.getNowDate());
|
||||
return storeQuickFunctionMapper.updateStoreQuickFunction(storeQuickFunction);
|
||||
return storeQuickFuncMapper.updateStoreQuickFunction(storeQuickFunction);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -80,7 +110,7 @@ public class StoreQuickFunctionServiceImpl implements IStoreQuickFunctionService
|
|||
@Override
|
||||
@Transactional
|
||||
public int deleteStoreQuickFunctionByStoreQuickFuncIds(Long[] storeQuickFuncIds) {
|
||||
return storeQuickFunctionMapper.deleteStoreQuickFunctionByStoreQuickFuncIds(storeQuickFuncIds);
|
||||
return storeQuickFuncMapper.deleteStoreQuickFunctionByStoreQuickFuncIds(storeQuickFuncIds);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -92,6 +122,8 @@ public class StoreQuickFunctionServiceImpl implements IStoreQuickFunctionService
|
|||
@Override
|
||||
@Transactional
|
||||
public int deleteStoreQuickFunctionByStoreQuickFuncId(Long storeQuickFuncId) {
|
||||
return storeQuickFunctionMapper.deleteStoreQuickFunctionByStoreQuickFuncId(storeQuickFuncId);
|
||||
return storeQuickFuncMapper.deleteStoreQuickFunctionByStoreQuickFuncId(storeQuickFuncId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<resultMap type="StoreQuickFunction" id="StoreQuickFunctionResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="storeId" column="store_id" />
|
||||
<result property="funcName" column="func_name" />
|
||||
<result property="funcIcon" column="func_icon" />
|
||||
<result property="funcUrl" column="func_url" />
|
||||
<result property="menuName" column="menu_name" />
|
||||
<result property="icon" column="icon" />
|
||||
<result property="path" column="path" />
|
||||
<result property="orderNum" column="order_num" />
|
||||
<result property="version" column="version" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
|
|
@ -20,16 +20,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectStoreQuickFunctionVo">
|
||||
select id, store_id, func_name, func_icon, func_url, order_num, version, del_flag, create_by, create_time, update_by, update_time from store_quick_function
|
||||
select id, store_id, menu_name, icon, path, order_num, version, del_flag, create_by, create_time, update_by, update_time from store_quick_function
|
||||
</sql>
|
||||
|
||||
<select id="selectStoreQuickFunctionList" parameterType="StoreQuickFunction" resultMap="StoreQuickFunctionResult">
|
||||
<include refid="selectStoreQuickFunctionVo"/>
|
||||
<where>
|
||||
<if test="storeId != null "> and store_id = #{storeId}</if>
|
||||
<if test="funcName != null and funcName != ''"> and func_name like concat('%', #{funcName}, '%')</if>
|
||||
<if test="funcIcon != null and funcIcon != ''"> and func_icon = #{funcIcon}</if>
|
||||
<if test="funcUrl != null and funcUrl != ''"> and func_url = #{funcUrl}</if>
|
||||
<if test="menuName != null and menuName != ''"> and menu_name like concat('%', #{menuName}, '%')</if>
|
||||
<if test="icon != null and icon != ''"> and icon = #{icon}</if>
|
||||
<if test="path != null and path != ''"> and path = #{path}</if>
|
||||
<if test="orderNum != null "> and order_num = #{orderNum}</if>
|
||||
<if test="version != null "> and version = #{version}</if>
|
||||
</where>
|
||||
|
|
@ -44,9 +44,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
insert into store_quick_function
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="storeId != null">store_id,</if>
|
||||
<if test="funcName != null">func_name,</if>
|
||||
<if test="funcIcon != null">func_icon,</if>
|
||||
<if test="funcUrl != null">func_url,</if>
|
||||
<if test="menuName != null">menu_name,</if>
|
||||
<if test="icon != null">icon,</if>
|
||||
<if test="path != null">path,</if>
|
||||
<if test="orderNum != null">order_num,</if>
|
||||
<if test="version != null">version,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
|
|
@ -57,9 +57,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="storeId != null">#{storeId},</if>
|
||||
<if test="funcName != null">#{funcName},</if>
|
||||
<if test="funcIcon != null">#{funcIcon},</if>
|
||||
<if test="funcUrl != null">#{funcUrl},</if>
|
||||
<if test="menuName != null">#{menuName},</if>
|
||||
<if test="icon != null">#{icon},</if>
|
||||
<if test="path != null">#{path},</if>
|
||||
<if test="orderNum != null">#{orderNum},</if>
|
||||
<if test="version != null">#{version},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
|
|
@ -74,9 +74,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
update store_quick_function
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="storeId != null">store_id = #{storeId},</if>
|
||||
<if test="funcName != null">func_name = #{funcName},</if>
|
||||
<if test="funcIcon != null">func_icon = #{funcIcon},</if>
|
||||
<if test="funcUrl != null">func_url = #{funcUrl},</if>
|
||||
<if test="menuName != null">menu_name = #{menuName},</if>
|
||||
<if test="icon != null">icon = #{icon},</if>
|
||||
<if test="path != null">path = #{path},</if>
|
||||
<if test="orderNum != null">order_num = #{orderNum},</if>
|
||||
<if test="version != null">version = #{version},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
|
|
@ -98,4 +98,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateDelFlagByStoreId" parameterType="Long">
|
||||
UPDATE store_quick_function SET del_flag = 2 WHERE store_id = #{storeId}
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue