店铺相关模块完善

This commit is contained in:
SjS 2025-04-23 10:51:52 +08:00
parent ea53005a37
commit 5839f04950
21 changed files with 903 additions and 13 deletions

View File

@ -70,5 +70,7 @@ public interface BoothMapper
* @param boothIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteBoothByBoothIds(Long[] boothIds);
public int deleteBoothByBoothIds(@Param("ids") List<Long> boothIds);
List<Long> selectIdByQuery(@Param("query") BoothQuery query);
}

View File

@ -16,10 +16,14 @@ public interface BoothService
/**
* 查询卡座
*
* @param boothId 卡座主键
* @param id 卡座主键
* @return 卡座
*/
public BoothVO selectBoothByBoothId(Long boothId);
public BoothVO selectBoothByBoothId(Long id, boolean scope);
default BoothVO selectBoothByBoothId(Long id) {
return this.selectBoothByBoothId(id, false);
}
/**
* 查询卡座列表
@ -29,6 +33,12 @@ public interface BoothService
*/
public List<BoothVO> selectBoothList(BoothQuery booth);
/**
* 查询一个
*/
public BoothVO selectOne(BoothQuery query);
/**
* 新增卡座
*
@ -51,7 +61,7 @@ public interface BoothService
* @param boothIds 需要删除的卡座主键集合
* @return 结果
*/
public int deleteBoothByBoothIds(Long[] boothIds);
public int deleteBoothByBoothIds(List<Long> boothIds);
/**
* 删除卡座信息
@ -60,4 +70,6 @@ public interface BoothService
* @return 结果
*/
public int deleteBoothByBoothId(Long boothId);
Long getUserId(Booth booth);
}

View File

@ -0,0 +1,20 @@
package com.ruoyi.bst.booth.service;
import java.util.List;
public interface BoothValidator {
/**
* 当前用户是否可以编辑卡座
* @param boothId 卡座ID
* @return 是否可以编辑
*/
boolean canEdit(Long boothId);
/**
* 当前用户是否可以删除
* @param ids 卡座ID几何
* @return 是否可以删除
*/
boolean canDeleteAll(List<Long> ids);
}

View File

@ -1,7 +1,12 @@
package com.ruoyi.bst.booth.service.impl;
import java.util.List;
import com.github.pagehelper.PageHelper;
import com.ruoyi.bst.part.domain.PartVO;
import com.ruoyi.bst.part.service.PartService;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.collection.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bst.booth.mapper.BoothMapper;
@ -21,19 +26,33 @@ public class BoothServiceImpl implements BoothService
{
@Autowired
private BoothMapper boothMapper;
@Autowired
private PartService partService;
/**
* 查询卡座
*
* @param boothId 卡座主键
* @param scope 卡座主键
* @return 卡座
*/
@Override
public BoothVO selectBoothByBoothId(Long boothId)
public BoothVO selectBoothByBoothId(Long id, boolean scope)
{
return boothMapper.selectBoothByBoothId(boothId);
if (id == null) {
return null;
}
BoothQuery query = new BoothQuery();
query.setBoothId(id);
query.setScope(scope);
return this.selectOne(query);
}
@Override
public BoothVO selectOne(BoothQuery query) {
PageHelper.startPage(1, 1);
List<BoothVO> list = this.selectBoothList(query);
return CollectionUtils.firstElement(list);
}
/**
* 查询卡座列表
*
@ -78,7 +97,7 @@ public class BoothServiceImpl implements BoothService
* @return 结果
*/
@Override
public int deleteBoothByBoothIds(Long[] boothIds)
public int deleteBoothByBoothIds(List<Long> boothIds)
{
return boothMapper.deleteBoothByBoothIds(boothIds);
}
@ -94,4 +113,10 @@ public class BoothServiceImpl implements BoothService
{
return boothMapper.deleteBoothByBoothId(boothId);
}
@Override
public Long getUserId(Booth booth) {
PartVO part = partService.selectPartById(booth.getPartId());
return partService.getUserId(part);
}
}

View File

@ -0,0 +1,54 @@
package com.ruoyi.bst.booth.service.impl;
import com.ruoyi.bst.booth.domain.BoothQuery;
import com.ruoyi.bst.booth.mapper.BoothMapper;
import com.ruoyi.bst.booth.service.BoothValidator;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.collection.CollectionUtils;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
@Service
public class BoothValidatorImpl implements BoothValidator {
private final BoothMapper boothMapper;
public BoothValidatorImpl(BoothMapper boothMapper) {
this.boothMapper = boothMapper;
}
@Override
public boolean canEdit(Long boothId) {
return canOperate(Arrays.asList(boothId));
}
@Override
public boolean canDeleteAll(List<Long> ids) {
return canOperate(ids);
}
// 是否可以操作运营区
private boolean canOperate(List<Long> boothIds) {
return hasPermission(boothIds);
}
// 是否有运营区权限
private boolean hasPermission(List<Long> boothIds) {
if (SecurityUtils.isSysAdmin()) {
return true;
}
if (CollectionUtils.isEmptyElement(boothIds)) {
return true;
}
// 查询运营区
BoothQuery query = new BoothQuery();
query.setIds(boothIds);
query.setScope(true);
List<Long> boothIdList = boothMapper.selectIdByQuery(query);
return new HashSet<>(boothIdList).containsAll(boothIds);
}
}

View File

@ -0,0 +1,40 @@
package com.ruoyi.bst.floor.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* 楼层列表对象 bst_floor
*
* @author ruoyi
* @date 2025-04-22
*/
@Data
public class Floor extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Long floorId;
@Excel(name = "分区ID")
@ApiModelProperty("分区ID")
@NotNull(message = "分区ID不能为空")
private Long storeId;
@Excel(name = "楼层名称")
@ApiModelProperty("楼层名称")
@NotBlank(message = "楼层名称不能为空")
private String floorName;
@Excel(name = "楼层图片")
@ApiModelProperty("楼层图片")
private String picture;
}

View File

@ -0,0 +1,14 @@
package com.ruoyi.bst.floor.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class FloorQuery extends FloorVO{
@ApiModelProperty("楼层ID列表")
private List<Long> ids;
}

View File

@ -0,0 +1,17 @@
package com.ruoyi.bst.floor.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class FloorVO extends Floor{
@ApiModelProperty("楼层ID列表")
private List<Long> ids;
@ApiModelProperty("店铺名称")
private String storeName;
}

View File

@ -0,0 +1,77 @@
package com.ruoyi.bst.floor.mapper;
import java.util.List;
import com.ruoyi.bst.floor.domain.Floor;
import com.ruoyi.bst.floor.domain.FloorVO;
import com.ruoyi.bst.floor.domain.FloorQuery;
import com.ruoyi.bst.part.domain.PartQuery;
import org.apache.ibatis.annotations.Param;
/**
* 楼层列表Mapper接口
*
* @author ruoyi
* @date 2025-04-22
*/
public interface FloorMapper
{
/**
* 查询楼层列表
*
* @param floorId 楼层列表主键
* @return 楼层列表
*/
FloorVO selectFloorByFloorId(Long floorId);
/**
* 查询楼层列表列表
*
* @param query 楼层列表
* @return 楼层列表集合
*/
List<FloorVO> selectFloorList(@Param("query")FloorQuery query);
/**
* 新增楼层列表
*
* @param floor 楼层列表
* @return 结果
*/
int insertFloor(Floor floor);
/**
* 批量新增楼层列表
*/
int batchInsert(@Param("list") List<? extends Floor> list);
/**
* 批量修改楼层列表
*/
int batchUpdate(@Param("list") List<? extends Floor> list);
/**
* 修改楼层列表
*
* @param floor 楼层列表
* @return 结果
*/
public int updateFloor(@Param("data") Floor floor);
/**
* 删除楼层列表
*
* @param floorId 楼层列表主键
* @return 结果
*/
int deleteFloorByFloorId(Long floorId);
/**
* 批量删除楼层列表
*
* @param floorIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteFloorByFloorIds(List<Long> floorIds);
List<Long> selectIdByQuery(FloorQuery query);
}

View File

@ -0,0 +1,180 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.bst.floor.mapper.FloorMapper">
<resultMap type="FloorVO" id="FloorResult" autoMapping="true">
<result property="floorId" column="floor_id" />
<result property="storeId" column="store_id" />
<result property="floorName" column="floor_name" />
<result property="picture" column="picture" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectFloorVo">
select
bf.floor_id,
bf.store_id,
bf.floor_name,
bf.picture,
bf.create_time,
bs.user_id,
bs.store_name as storeName
<include refid="searchTables"/>
</sql>
<sql id="searchTables">
from bst_floor bf
left join bst_store bs on bf.store_id = bs.store_id
</sql>
<sql id="searchCondition">
<if test="query.storeId != null "> and store_id = #{query.storeId}</if>
<if test="query.floorName != null and query.floorName != ''"> and floor_name like concat('%', #{query.floorName}, '%')</if>
<if test="query.picture != null and query.picture != ''"> and picture = #{query.picture}</if>
<if test="query.storeName != null and query.storeName != ''"> and bs.store_name like concat('%', #{query.storeName}, '%') </if>
${@com.ruoyi.framework.util.DataScopeUtil@create(query.scope)
.userSetAlias("bs.user_id")
.build()
}
${query.params.dataScope}
</sql>
<select id="selectFloorList" parameterType="FloorQuery" resultMap="FloorResult">
<include refid="selectFloorVo"/>
<where>
<include refid="searchCondition"/>
</where>
</select>
<select id="selectFloorByFloorId" parameterType="Long" resultMap="FloorResult">
<include refid="selectFloorVo"/>
where floor_id = #{floorId}
</select>
<!-- selectIdByQuery -->
<select id="selectIdByQuery" resultType="Long">
select bf.floor_id <include refid="searchTables"/>
<where>
<include refid="searchCondition"/>
</where>
</select>
<insert id="insertFloor" parameterType="Floor" useGeneratedKeys="true" keyProperty="floorId">
insert into bst_floor
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="storeId != null">store_id,</if>
<if test="floorName != null">floor_name,</if>
<if test="picture != null">picture,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="storeId != null">#{storeId},</if>
<if test="floorName != null">#{floorName},</if>
<if test="picture != null">#{picture},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<insert id="batchInsert" parameterType="Floor" useGeneratedKeys="true" keyProperty="floorId">
insert into bst_floor
<trim prefix="(" suffix=")" suffixOverrides=",">
store_id,
floor_name,
picture,
create_time,
</trim>
values
<foreach collection="list" item="i" separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="i.storeId != null ">#{i.storeId},</if>
<if test="i.storeId == null ">default,</if>
<if test="i.floorName != null ">#{i.floorName},</if>
<if test="i.floorName == null ">default,</if>
<if test="i.picture != null ">#{i.picture},</if>
<if test="i.picture == null ">default,</if>
<if test="i.createTime != null ">#{i.createTime},</if>
<if test="i.createTime == null ">default,</if>
</trim>
</foreach>
</insert>
<update id="batchUpdate">
update bst_floor
<trim prefix="SET" suffixOverrides=",">
<foreach open="store_id = CASE floor_id" collection="list" item="item" close="END,">
<choose>
<when test="item.storeId != null ">
WHEN #{item.floor_id} THEN #{item.storeId}
</when>
<otherwise>
WHEN #{item.floor_id} THEN `store_id`
</otherwise>
</choose>
</foreach>
<foreach open="floor_name = CASE floor_id" collection="list" item="item" close="END,">
<choose>
<when test="item.floorName != null ">
WHEN #{item.floor_id} THEN #{item.floorName}
</when>
<otherwise>
WHEN #{item.floor_id} THEN `floor_name`
</otherwise>
</choose>
</foreach>
<foreach open="picture = CASE floor_id" collection="list" item="item" close="END,">
<choose>
<when test="item.picture != null ">
WHEN #{item.floor_id} THEN #{item.picture}
</when>
<otherwise>
WHEN #{item.floor_id} THEN `picture`
</otherwise>
</choose>
</foreach>
<foreach open="create_time = CASE floor_id" collection="list" item="item" close="END,">
<choose>
<when test="item.createTime != null ">
WHEN #{item.floor_id} THEN #{item.createTime}
</when>
<otherwise>
WHEN #{item.floor_id} THEN `create_time`
</otherwise>
</choose>
</foreach>
</trim>
where floor_id in
<foreach item="item" collection="list" open="(" separator="," close=")">
#{item.floorId}
</foreach>
</update>
<update id="updateFloor" parameterType="Floor">
update bst_floor
<trim prefix="SET" suffixOverrides=",">
<include refid="updateColumns"/>
</trim>
where floor_id = #{data.floorId}
</update>
<sql id="updateColumns">
<if test="data.storeId != null">store_id = #{data.storeId},</if>
<if test="data.floorName != null">floor_name = #{data.floorName},</if>
<if test="data.picture != null">picture = #{data.picture},</if>
<if test="data.createTime != null">create_time = #{data.createTime},</if>
</sql>
<delete id="deleteFloorByFloorId" parameterType="Long">
delete from bst_floor where floor_id = #{floorId}
</delete>
<delete id="deleteFloorByFloorIds" parameterType="String">
delete from bst_floor where floor_id in
<foreach item="floorId" collection="array" open="(" separator="," close=")">
#{floorId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,70 @@
package com.ruoyi.bst.floor.service;
import java.util.List;
import com.ruoyi.bst.floor.domain.Floor;
import com.ruoyi.bst.floor.domain.FloorVO;
import com.ruoyi.bst.floor.domain.FloorQuery;
/**
* 楼层列表Service接口
*
* @author ruoyi
* @date 2025-04-22
*/
public interface FloorService
{
/**
* 查询楼层列表
*
* @param id 楼层列表主键
* @return 楼层列表
*/
public FloorVO selectFloorByFloorId(Long id, boolean scope);
default FloorVO selectFloorByFloorId(Long id) {
return this.selectFloorByFloorId(id, false);
}
public FloorVO selectOne(FloorQuery floorQuery);
/**
* 查询楼层列表列表
*
* @param floor 楼层列表
* @return 楼层列表集合
*/
public List<FloorVO> selectFloorList(FloorQuery floor);
/**
* 新增楼层列表
*
* @param floor 楼层列表
* @return 结果
*/
public int insertFloor(Floor floor);
/**
* 修改楼层列表
*
* @param floor 楼层列表
* @return 结果
*/
public int updateFloor(Floor floor);
/**
* 批量删除楼层列表
*
* @param floorIds 需要删除的楼层列表主键集合
* @return 结果
*/
public int deleteFloorByFloorIds(List<Long> floorIds);
/**
* 删除楼层列表信息
*
* @param floorId 楼层列表主键
* @return 结果
*/
public int deleteFloorByFloorId(Long floorId);
}

View File

@ -0,0 +1,29 @@
package com.ruoyi.bst.floor.service;
import java.util.List;
public interface FloorValidator {
/**
* 判断当前用户是否可以选择楼层
* @param floorId 楼层ID
* @return 是否允许
*/
boolean canCheckForFloor(Long floorId);
/**
* 当前用户是否可以编辑楼层
* @param floorId 楼层ID
* @return 是否可以编辑
*/
boolean canEdit(Long floorId);
/**
* 当前用户是否可以删除楼层
* @param floorIds 楼层ID列表
* @return 是否可以删除
*/
boolean canDeleteAll(List<Long> floorIds);
}

View File

@ -0,0 +1,112 @@
package com.ruoyi.bst.floor.service.impl;
import java.util.List;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.collection.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.bst.floor.mapper.FloorMapper;
import com.ruoyi.bst.floor.domain.Floor;
import com.ruoyi.bst.floor.domain.FloorVO;
import com.ruoyi.bst.floor.domain.FloorQuery;
import com.ruoyi.bst.floor.service.FloorService;
/**
* 楼层列表Service业务层处理
*
* @author ruoyi
* @date 2025-04-22
*/
@Service
public class FloorServiceImpl implements FloorService
{
@Autowired
private FloorMapper floorMapper;
/**
* 查询楼层列表
*
* @param id 楼层列表主键
* @return 楼层列表
*/
@Override
public FloorVO selectFloorByFloorId(Long id, boolean scope)
{
if (id == null) {
return null;
}
FloorQuery query = new FloorQuery();
query.setFloorId(id);
query.setScope(scope);
return this.selectOne(query);
}
@Override
public FloorVO selectOne(FloorQuery query) {
PageHelper.startPage(1, 1);
List<FloorVO> list = floorMapper.selectFloorList(query);
return CollectionUtils.firstElement(list);
}
/**
* 查询楼层列表列表
*
* @param floor 楼层列表
* @return 楼层列表
*/
@Override
public List<FloorVO> selectFloorList(FloorQuery floor)
{
return floorMapper.selectFloorList(floor);
}
/**
* 新增楼层列表
*
* @param floor 楼层列表
* @return 结果
*/
@Override
public int insertFloor(Floor floor)
{
floor.setCreateTime(DateUtils.getNowDate());
return floorMapper.insertFloor(floor);
}
/**
* 修改楼层列表
*
* @param floor 楼层列表
* @return 结果
*/
@Override
public int updateFloor(Floor floor)
{
return floorMapper.updateFloor(floor);
}
/**
* 批量删除楼层列表
*
* @param floorIds 需要删除的楼层列表主键
* @return 结果
*/
@Override
public int deleteFloorByFloorIds(List<Long> floorIds)
{
return floorMapper.deleteFloorByFloorIds(floorIds);
}
/**
* 删除楼层列表信息
*
* @param floorId 楼层列表主键
* @return 结果
*/
@Override
public int deleteFloorByFloorId(Long floorId)
{
return floorMapper.deleteFloorByFloorId(floorId);
}
}

View File

@ -0,0 +1,62 @@
package com.ruoyi.bst.floor.service.impl;
import com.ruoyi.bst.floor.domain.FloorQuery;
import com.ruoyi.bst.floor.mapper.FloorMapper;
import com.ruoyi.bst.floor.service.FloorValidator;
import com.ruoyi.bst.part.domain.PartQuery;
import com.ruoyi.bst.part.mapper.PartMapper;
import com.ruoyi.bst.part.service.PartValidator;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.collection.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
@Service
public class FloorValidatorImpl implements FloorValidator {
@Autowired
private PartMapper partMapper;
@Autowired
private FloorMapper floorMapper;
@Override
public boolean canCheckForFloor(Long partId) {
return canOperate(Arrays.asList(partId));
}
@Override
public boolean canEdit(Long partId) {
return canOperate(Arrays.asList(partId));
}
@Override
public boolean canDeleteAll(List<Long> partIds) {
return canOperate(partIds);
}
// 是否可以操作运营区
private boolean canOperate(List<Long> partIds) {
return hasPermission(partIds);
}
// 是否有运营区权限
private boolean hasPermission(List<Long> partIds) {
if (SecurityUtils.isSysAdmin()) {
return true;
}
if (CollectionUtils.isEmptyElement(partIds)) {
return true;
}
// 查询运营区
FloorQuery query = new FloorQuery();
query.setIds(partIds);
query.setScope(true);
List<Long> floorList = floorMapper.selectIdByQuery(query);
return new HashSet<>(floorList).containsAll(partIds);
}
}

View File

@ -11,4 +11,9 @@ public class PartVO extends Part{
@ApiModelProperty("楼层名称")
private String floorName;
@Excel(name = "所属店铺")
@ApiModelProperty("所属店铺")
private String storeName;
}

View File

@ -21,7 +21,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bp.create_time,
bs.store_name,
bs.user_id,
bf.floor_name as floorName
bf.floor_name as floorName,
bs.store_name as storeName
<include refid="searchTables"/>
</sql>
@ -37,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.partName != null and query.partName != ''"> and part_name like concat('%', #{query.partName}, '%')</if>
<if test="query.picture != null and query.picture != ''"> and picture = #{query.picture}</if>
<if test="query.floorName != null and query.floorName != ''"> and bf.floor_name like concat('%', #{query.floorName}, '%') </if>
<if test="query.storeName != null and query.storeName != ''"> and bs.store_name like concat('%', #{query.storeName}, '%') </if>
${@com.ruoyi.framework.util.DataScopeUtil@create(query.scope)
.userSetAlias("bs.user_id")
.build()

View File

@ -73,6 +73,18 @@ public class Store extends BaseEntity
@NotBlank(message = "详细地址不能为空",groups = {ValidGroup.Create.class})
private String address;
@Excel(name = "")
@ApiModelProperty("")
private String province;
@Excel(name = "")
@ApiModelProperty("")
private String city;
@Excel(name = "区、县")
@ApiModelProperty("区、县")
private String county;
@Excel(name = "门店照片")
@ApiModelProperty("门店照片")
private String picture;

View File

@ -12,6 +12,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="phone" column="phone" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="province" column="province" />
<result property="city" column="city" />
<result property="county" column="county" />
<result property="longitude" column="longitude" />
<result property="latitude" column="latitude" />
<result property="address" column="address" />
@ -33,6 +36,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bs.latitude,
bs.address,
bs.picture,
bs.province,
bs.city,
bs.county,
bs.create_time
from bst_store bs
</sql>
@ -49,6 +55,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.latitude != null "> and latitude = #{query.latitude}</if>
<if test="query.address != null and query.address != ''"> and address like concat('%', #{query.address}, '%')</if>
<if test="query.picture != null and query.picture != ''"> and picture = #{query.picture}</if>
<if test="query.province != null and query.province != ''"> and province = #{query.province}</if>
<if test="query.city != null and query.city != ''"> and city = #{query.city}</if>
<if test="query.county != null and query.county != ''"> and county = #{query.county}</if>
<if test="query.deleted != null"> and deleted = #{query.deleted}</if>
${@com.ruoyi.framework.util.DataScopeUtil@create(query.scope)
.userSetAlias("bs.user_id")
@ -82,6 +91,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="latitude != null">latitude,</if>
<if test="address != null">address,</if>
<if test="picture != null">picture,</if>
<if test="province != null">province,</if>
<if test="city != null">city,</if>
<if test="county != null">county,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -95,6 +107,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="latitude != null">#{latitude},</if>
<if test="address != null">#{address},</if>
<if test="picture != null">#{picture},</if>
<if test="province != null">#{province},</if>
<if test="city != null">#{city},</if>
<if test="county != null">#{county},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
@ -282,6 +297,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="data.latitude != null">latitude = #{data.latitude},</if>
<if test="data.address != null">address = #{data.address},</if>
<if test="data.picture != null">picture = #{data.picture},</if>
<if test="data.province != null">province = #{data.province},</if>
<if test="data.city != null">city = #{data.city},</if>
<if test="data.county != null">county = #{data.county},</if>
<if test="data.createTime != null">create_time = #{data.createTime},</if>
</sql>

View File

@ -33,4 +33,5 @@ public interface UserValidator {
*/
boolean canView(List<Long> userIds);
}

View File

@ -4,12 +4,15 @@ import com.ruoyi.bst.booth.domain.Booth;
import com.ruoyi.bst.booth.domain.BoothQuery;
import com.ruoyi.bst.booth.domain.BoothVO;
import com.ruoyi.bst.booth.service.BoothService;
import com.ruoyi.bst.booth.service.BoothValidator;
import com.ruoyi.bst.part.service.PartValidator;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.user.service.UserValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@ -29,6 +32,10 @@ public class BoothController extends BaseController
{
@Autowired
private BoothService boothService;
@Autowired
private PartValidator partValidator;
@Autowired
private BoothValidator boothValidator;
/**
* 查询卡座列表
@ -39,6 +46,7 @@ public class BoothController extends BaseController
{
startPage();
startOrderBy();
query.setScope(true);
List<BoothVO> list = boothService.selectBoothList(query);
return getDataTable(list);
}
@ -51,6 +59,7 @@ public class BoothController extends BaseController
@PostMapping("/export")
public void export(HttpServletResponse response, BoothQuery query)
{
query.setScope(true);
List<BoothVO> list = boothService.selectBoothList(query);
ExcelUtil<BoothVO> util = new ExcelUtil<BoothVO>(BoothVO.class);
util.exportExcel(response, list, "卡座数据");
@ -63,7 +72,7 @@ public class BoothController extends BaseController
@GetMapping(value = "/{boothId}")
public AjaxResult getInfo(@PathVariable("boothId") Long boothId)
{
return success(boothService.selectBoothByBoothId(boothId));
return success(boothService.selectBoothByBoothId(boothId,true));
}
/**
@ -74,6 +83,10 @@ public class BoothController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody Booth booth)
{
// 判断用户能否选择分区
if (!partValidator.canCheckForPart(booth.getPartId())) {
return AjaxResult.error("您无权选择ID为" + booth.getPartId() + "的分区");
}
return toAjax(boothService.insertBooth(booth));
}
@ -85,6 +98,9 @@ public class BoothController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody Booth booth)
{
if (!boothValidator.canEdit(booth.getBoothId())) {
return AjaxResult.error("您没有权限修改ID为" + booth.getBoothId() + "的卡座");
}
return toAjax(boothService.updateBooth(booth));
}
@ -93,9 +109,12 @@ public class BoothController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('bst:booth:remove')")
@Log(title = "卡座", businessType = BusinessType.DELETE)
@DeleteMapping("/{boothIds}")
public AjaxResult remove(@PathVariable Long[] boothIds)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids)
{
return toAjax(boothService.deleteBoothByBoothIds(boothIds));
if (!boothValidator.canDeleteAll(ids)) {
return AjaxResult.error("您没有权限删除ID为" + ids + "的卡座");
}
return toAjax(boothService.deleteBoothByBoothIds(ids));
}
}

View File

@ -0,0 +1,119 @@
package com.ruoyi.web.bst;
import com.ruoyi.bst.floor.domain.Floor;
import com.ruoyi.bst.floor.domain.FloorQuery;
import com.ruoyi.bst.floor.domain.FloorVO;
import com.ruoyi.bst.floor.service.FloorService;
import com.ruoyi.bst.floor.service.FloorValidator;
import com.ruoyi.bst.store.service.StoreValidator;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 楼层列表Controller
*
* @author ruoyi
* @date 2025-04-22
*/
@RestController
@RequestMapping("/bst/floor")
public class FloorController extends BaseController
{
@Autowired
private FloorService floorService;
@Autowired
private StoreValidator storeValidator;
@Autowired
private FloorValidator floorValidator;
/**
* 查询楼层列表列表
*/
@PreAuthorize("@ss.hasPermi('bst:floor:list')")
@GetMapping("/list")
public TableDataInfo list(FloorQuery query)
{
startPage();
startOrderBy();
query.setScope(true);
List<FloorVO> list = floorService.selectFloorList(query);
return getDataTable(list);
}
/**
* 导出楼层列表列表
*/
@PreAuthorize("@ss.hasPermi('bst:floor:export')")
@Log(title = "楼层列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, FloorQuery query)
{
query.setScope(true);
List<FloorVO> list = floorService.selectFloorList(query);
ExcelUtil<FloorVO> util = new ExcelUtil<FloorVO>(FloorVO.class);
util.exportExcel(response, list, "楼层列表数据");
}
/**
* 获取楼层列表详细信息
*/
@PreAuthorize("@ss.hasPermi('bst:floor:query')")
@GetMapping(value = "/{floorId}")
public AjaxResult getInfo(@PathVariable("floorId") Long floorId)
{
return success(floorService.selectFloorByFloorId(floorId,true));
}
/**
* 新增楼层列表
*/
@PreAuthorize("@ss.hasPermi('bst:floor:add')")
@Log(title = "楼层列表", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody Floor floor)
{
// 判断能否选择店铺
if (!storeValidator.canCheckForStore(floor.getStoreId())) {
return AjaxResult.error("您无权选择ID为" + floor.getStoreId() + "的店铺");
}
return toAjax(floorService.insertFloor(floor));
}
/**
* 修改楼层列表
*/
@PreAuthorize("@ss.hasPermi('bst:floor:edit')")
@Log(title = "楼层列表", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody Floor floor)
{
if (!floorValidator.canEdit(floor.getFloorId())) {
return AjaxResult.error("您没有权限修改ID为" + floor.getFloorId() + "的楼层");
}
return toAjax(floorService.updateFloor(floor));
}
/**
* 删除楼层列表
*/
@PreAuthorize("@ss.hasPermi('bst:floor:remove')")
@Log(title = "楼层列表", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable List<Long> ids)
{
if (!floorValidator.canDeleteAll(ids)) {
return AjaxResult.error("您没有权限删除ID为" + ids + "的楼层");
}
return toAjax(floorService.deleteFloorByFloorIds(ids));
}
}