厨房员工设备权限

This commit is contained in:
sxu 2025-06-17 10:31:16 +08:00
parent 68f64358e2
commit da5b94380f
6 changed files with 469 additions and 0 deletions

View File

@ -0,0 +1,119 @@
package com.bonus.canteen.core.kitchen.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.bonus.common.log.enums.OperaType;
//import com.bonus.canteen.core.kitchen.common.annotation.PreventRepeatSubmit;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.security.annotation.RequiresPermissions;
import com.bonus.canteen.core.kitchen.domain.KitchenStaffDevicePrivilege;
import com.bonus.canteen.core.kitchen.service.IKitchenStaffDevicePrivilegeService;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.page.TableDataInfo;
/**
* 厨房员工设备权限Controller
*
* @author xsheng
* @date 2025-06-17
*/
@Api(tags = "厨房员工设备权限接口")
@RestController
@RequestMapping("/kitchen_staff_device_privilege")
public class KitchenStaffDevicePrivilegeController extends BaseController {
@Autowired
private IKitchenStaffDevicePrivilegeService kitchenStaffDevicePrivilegeService;
/**
* 查询厨房员工设备权限列表
*/
@ApiOperation(value = "查询厨房员工设备权限列表")
//@RequiresPermissions("kitchen:privilege:list")
@GetMapping("/list")
public TableDataInfo list(KitchenStaffDevicePrivilege kitchenStaffDevicePrivilege) {
startPage();
List<KitchenStaffDevicePrivilege> list = kitchenStaffDevicePrivilegeService.selectKitchenStaffDevicePrivilegeList(kitchenStaffDevicePrivilege);
return getDataTable(list);
}
/**
* 导出厨房员工设备权限列表
*/
@ApiOperation(value = "导出厨房员工设备权限列表")
//@PreventRepeatSubmit
//@RequiresPermissions("kitchen:privilege:export")
@SysLog(title = "厨房员工设备权限", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出厨房员工设备权限")
@PostMapping("/export")
public void export(HttpServletResponse response, KitchenStaffDevicePrivilege kitchenStaffDevicePrivilege) {
List<KitchenStaffDevicePrivilege> list = kitchenStaffDevicePrivilegeService.selectKitchenStaffDevicePrivilegeList(kitchenStaffDevicePrivilege);
ExcelUtil<KitchenStaffDevicePrivilege> util = new ExcelUtil<KitchenStaffDevicePrivilege>(KitchenStaffDevicePrivilege.class);
util.exportExcel(response, list, "厨房员工设备权限数据");
}
/**
* 获取厨房员工设备权限详细信息
*/
@ApiOperation(value = "获取厨房员工设备权限详细信息")
//@RequiresPermissions("kitchen:privilege:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(kitchenStaffDevicePrivilegeService.selectKitchenStaffDevicePrivilegeById(id));
}
/**
* 新增厨房员工设备权限
*/
@ApiOperation(value = "新增厨房员工设备权限")
//@PreventRepeatSubmit
//@RequiresPermissions("kitchen:privilege:add")
@SysLog(title = "厨房员工设备权限", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增厨房员工设备权限")
@PostMapping
public AjaxResult add(@RequestBody KitchenStaffDevicePrivilege kitchenStaffDevicePrivilege) {
try {
return toAjax(kitchenStaffDevicePrivilegeService.insertKitchenStaffDevicePrivilege(kitchenStaffDevicePrivilege));
} catch (Exception e) {
return error(e.getMessage());
}
}
/**
* 修改厨房员工设备权限
*/
@ApiOperation(value = "修改厨房员工设备权限")
//@PreventRepeatSubmit
//@RequiresPermissions("kitchen:privilege:edit")
@SysLog(title = "厨房员工设备权限", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改厨房员工设备权限")
@PostMapping("/edit")
public AjaxResult edit(@RequestBody KitchenStaffDevicePrivilege kitchenStaffDevicePrivilege) {
try {
return toAjax(kitchenStaffDevicePrivilegeService.updateKitchenStaffDevicePrivilege(kitchenStaffDevicePrivilege));
} catch (Exception e) {
return error(e.getMessage());
}
}
/**
* 删除厨房员工设备权限
*/
@ApiOperation(value = "删除厨房员工设备权限")
//@PreventRepeatSubmit
//@RequiresPermissions("kitchen:privilege:remove")
@SysLog(title = "厨房员工设备权限", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除厨房员工设备权限")
@PostMapping("/del/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(kitchenStaffDevicePrivilegeService.deleteKitchenStaffDevicePrivilegeByIds(ids));
}
}

View File

@ -0,0 +1,46 @@
package com.bonus.canteen.core.kitchen.domain;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
/**
* 厨房员工设备权限对象 kitchen_staff_device_privilege
*
* @author xsheng
* @date 2025-06-17
*/
@Data
@ToString
public class KitchenStaffDevicePrivilege extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键id */
private Long id;
/** 食堂员工id */
@Excel(name = "食堂员工id")
@ApiModelProperty(value = "食堂员工id")
private Long staffId;
/** 食堂设备id */
@Excel(name = "食堂设备id")
@ApiModelProperty(value = "食堂设备id")
private Long deviceId;
/** 权限名称 */
@Excel(name = "权限名称")
@ApiModelProperty(value = "权限名称")
private String privilegeName;
/** 权限值 */
@Excel(name = "权限值")
@ApiModelProperty(value = "权限值")
private String privilegeValue;
}

View File

@ -0,0 +1,60 @@
package com.bonus.canteen.core.kitchen.mapper;
import java.util.List;
import com.bonus.canteen.core.kitchen.domain.KitchenStaffDevicePrivilege;
/**
* 厨房员工设备权限Mapper接口
*
* @author xsheng
* @date 2025-06-17
*/
public interface KitchenStaffDevicePrivilegeMapper {
/**
* 查询厨房员工设备权限
*
* @param id 厨房员工设备权限主键
* @return 厨房员工设备权限
*/
public KitchenStaffDevicePrivilege selectKitchenStaffDevicePrivilegeById(Long id);
/**
* 查询厨房员工设备权限列表
*
* @param kitchenStaffDevicePrivilege 厨房员工设备权限
* @return 厨房员工设备权限集合
*/
public List<KitchenStaffDevicePrivilege> selectKitchenStaffDevicePrivilegeList(KitchenStaffDevicePrivilege kitchenStaffDevicePrivilege);
/**
* 新增厨房员工设备权限
*
* @param kitchenStaffDevicePrivilege 厨房员工设备权限
* @return 结果
*/
public int insertKitchenStaffDevicePrivilege(KitchenStaffDevicePrivilege kitchenStaffDevicePrivilege);
/**
* 修改厨房员工设备权限
*
* @param kitchenStaffDevicePrivilege 厨房员工设备权限
* @return 结果
*/
public int updateKitchenStaffDevicePrivilege(KitchenStaffDevicePrivilege kitchenStaffDevicePrivilege);
/**
* 删除厨房员工设备权限
*
* @param id 厨房员工设备权限主键
* @return 结果
*/
public int deleteKitchenStaffDevicePrivilegeById(Long id);
/**
* 批量删除厨房员工设备权限
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteKitchenStaffDevicePrivilegeByIds(Long[] ids);
}

View File

@ -0,0 +1,60 @@
package com.bonus.canteen.core.kitchen.service;
import java.util.List;
import com.bonus.canteen.core.kitchen.domain.KitchenStaffDevicePrivilege;
/**
* 厨房员工设备权限Service接口
*
* @author xsheng
* @date 2025-06-17
*/
public interface IKitchenStaffDevicePrivilegeService {
/**
* 查询厨房员工设备权限
*
* @param id 厨房员工设备权限主键
* @return 厨房员工设备权限
*/
public KitchenStaffDevicePrivilege selectKitchenStaffDevicePrivilegeById(Long id);
/**
* 查询厨房员工设备权限列表
*
* @param kitchenStaffDevicePrivilege 厨房员工设备权限
* @return 厨房员工设备权限集合
*/
public List<KitchenStaffDevicePrivilege> selectKitchenStaffDevicePrivilegeList(KitchenStaffDevicePrivilege kitchenStaffDevicePrivilege);
/**
* 新增厨房员工设备权限
*
* @param kitchenStaffDevicePrivilege 厨房员工设备权限
* @return 结果
*/
public int insertKitchenStaffDevicePrivilege(KitchenStaffDevicePrivilege kitchenStaffDevicePrivilege);
/**
* 修改厨房员工设备权限
*
* @param kitchenStaffDevicePrivilege 厨房员工设备权限
* @return 结果
*/
public int updateKitchenStaffDevicePrivilege(KitchenStaffDevicePrivilege kitchenStaffDevicePrivilege);
/**
* 批量删除厨房员工设备权限
*
* @param ids 需要删除的厨房员工设备权限主键集合
* @return 结果
*/
public int deleteKitchenStaffDevicePrivilegeByIds(Long[] ids);
/**
* 删除厨房员工设备权限信息
*
* @param id 厨房员工设备权限主键
* @return 结果
*/
public int deleteKitchenStaffDevicePrivilegeById(Long id);
}

View File

@ -0,0 +1,98 @@
package com.bonus.canteen.core.kitchen.service.impl;
import java.util.List;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.canteen.core.kitchen.mapper.KitchenStaffDevicePrivilegeMapper;
import com.bonus.canteen.core.kitchen.domain.KitchenStaffDevicePrivilege;
import com.bonus.canteen.core.kitchen.service.IKitchenStaffDevicePrivilegeService;
/**
* 厨房员工设备权限Service业务层处理
*
* @author xsheng
* @date 2025-06-17
*/
@Service
public class KitchenStaffDevicePrivilegeServiceImpl implements IKitchenStaffDevicePrivilegeService {
@Autowired
private KitchenStaffDevicePrivilegeMapper kitchenStaffDevicePrivilegeMapper;
/**
* 查询厨房员工设备权限
*
* @param id 厨房员工设备权限主键
* @return 厨房员工设备权限
*/
@Override
public KitchenStaffDevicePrivilege selectKitchenStaffDevicePrivilegeById(Long id) {
return kitchenStaffDevicePrivilegeMapper.selectKitchenStaffDevicePrivilegeById(id);
}
/**
* 查询厨房员工设备权限列表
*
* @param kitchenStaffDevicePrivilege 厨房员工设备权限
* @return 厨房员工设备权限
*/
@Override
public List<KitchenStaffDevicePrivilege> selectKitchenStaffDevicePrivilegeList(KitchenStaffDevicePrivilege kitchenStaffDevicePrivilege) {
return kitchenStaffDevicePrivilegeMapper.selectKitchenStaffDevicePrivilegeList(kitchenStaffDevicePrivilege);
}
/**
* 新增厨房员工设备权限
*
* @param kitchenStaffDevicePrivilege 厨房员工设备权限
* @return 结果
*/
@Override
public int insertKitchenStaffDevicePrivilege(KitchenStaffDevicePrivilege kitchenStaffDevicePrivilege) {
kitchenStaffDevicePrivilege.setCreateTime(DateUtils.getNowDate());
try {
return kitchenStaffDevicePrivilegeMapper.insertKitchenStaffDevicePrivilege(kitchenStaffDevicePrivilege);
} catch (Exception e) {
throw new ServiceException(e.getMessage());
}
}
/**
* 修改厨房员工设备权限
*
* @param kitchenStaffDevicePrivilege 厨房员工设备权限
* @return 结果
*/
@Override
public int updateKitchenStaffDevicePrivilege(KitchenStaffDevicePrivilege kitchenStaffDevicePrivilege) {
kitchenStaffDevicePrivilege.setUpdateTime(DateUtils.getNowDate());
try {
return kitchenStaffDevicePrivilegeMapper.updateKitchenStaffDevicePrivilege(kitchenStaffDevicePrivilege);
} catch (Exception e) {
throw new ServiceException(e.getMessage());
}
}
/**
* 批量删除厨房员工设备权限
*
* @param ids 需要删除的厨房员工设备权限主键
* @return 结果
*/
@Override
public int deleteKitchenStaffDevicePrivilegeByIds(Long[] ids) {
return kitchenStaffDevicePrivilegeMapper.deleteKitchenStaffDevicePrivilegeByIds(ids);
}
/**
* 删除厨房员工设备权限信息
*
* @param id 厨房员工设备权限主键
* @return 结果
*/
@Override
public int deleteKitchenStaffDevicePrivilegeById(Long id) {
return kitchenStaffDevicePrivilegeMapper.deleteKitchenStaffDevicePrivilegeById(id);
}
}

View File

@ -0,0 +1,86 @@
<?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.bonus.canteen.core.kitchen.mapper.KitchenStaffDevicePrivilegeMapper">
<resultMap type="com.bonus.canteen.core.kitchen.domain.KitchenStaffDevicePrivilege" id="KitchenStaffDevicePrivilegeResult">
<result property="id" column="id" />
<result property="staffId" column="staff_id" />
<result property="deviceId" column="device_id" />
<result property="privilegeName" column="privilege_name" />
<result property="privilegeValue" column="privilege_value" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectKitchenStaffDevicePrivilegeVo">
select id, staff_id, device_id, privilege_name, privilege_value, create_by, create_time, update_by, update_time from kitchen_staff_device_privilege
</sql>
<select id="selectKitchenStaffDevicePrivilegeList" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenStaffDevicePrivilege" resultMap="KitchenStaffDevicePrivilegeResult">
<include refid="selectKitchenStaffDevicePrivilegeVo"/>
<where>
<if test="staffId != null "> and staff_id = #{staffId}</if>
<if test="deviceId != null "> and device_id = #{deviceId}</if>
<if test="privilegeName != null and privilegeName != ''"> and privilege_name like concat('%', #{privilegeName}, '%')</if>
<if test="privilegeValue != null and privilegeValue != ''"> and privilege_value = #{privilegeValue}</if>
</where>
</select>
<select id="selectKitchenStaffDevicePrivilegeById" parameterType="Long" resultMap="KitchenStaffDevicePrivilegeResult">
<include refid="selectKitchenStaffDevicePrivilegeVo"/>
where id = #{id}
</select>
<insert id="insertKitchenStaffDevicePrivilege" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenStaffDevicePrivilege" useGeneratedKeys="true" keyProperty="id">
insert into kitchen_staff_device_privilege
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="staffId != null">staff_id,</if>
<if test="deviceId != null">device_id,</if>
<if test="privilegeName != null">privilege_name,</if>
<if test="privilegeValue != null">privilege_value,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="staffId != null">#{staffId},</if>
<if test="deviceId != null">#{deviceId},</if>
<if test="privilegeName != null">#{privilegeName},</if>
<if test="privilegeValue != null">#{privilegeValue},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateKitchenStaffDevicePrivilege" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenStaffDevicePrivilege">
update kitchen_staff_device_privilege
<trim prefix="SET" suffixOverrides=",">
<if test="staffId != null">staff_id = #{staffId},</if>
<if test="deviceId != null">device_id = #{deviceId},</if>
<if test="privilegeName != null">privilege_name = #{privilegeName},</if>
<if test="privilegeValue != null">privilege_value = #{privilegeValue},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteKitchenStaffDevicePrivilegeById" parameterType="Long">
delete from kitchen_staff_device_privilege where id = #{id}
</delete>
<delete id="deleteKitchenStaffDevicePrivilegeByIds" parameterType="String">
delete from kitchen_staff_device_privilege where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>