From b94b21b26ee7ff3f9059524081114333ea52ffc6 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Thu, 19 Jun 2025 18:14:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=A8=E6=88=BF=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/KitchenSettingController.java | 139 ++++++++++++++++++ .../core/kitchen/domain/KitchenSetting.java | 42 ++++++ .../kitchen/mapper/KitchenSettingMapper.java | 64 ++++++++ .../service/IKitchenSettingService.java | 64 ++++++++ .../impl/KitchenSettingServiceImpl.java | 131 +++++++++++++++++ .../mapper/kitchen/KitchenSettingMapper.xml | 98 ++++++++++++ 6 files changed, 538 insertions(+) create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/controller/KitchenSettingController.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenSetting.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/mapper/KitchenSettingMapper.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/IKitchenSettingService.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenSettingServiceImpl.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenSettingMapper.xml diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/controller/KitchenSettingController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/controller/KitchenSettingController.java new file mode 100644 index 0000000..878aa73 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/controller/KitchenSettingController.java @@ -0,0 +1,139 @@ +package com.bonus.canteen.core.kitchen.controller; + +import com.bonus.canteen.core.kitchen.domain.KitchenSetting; +import com.bonus.canteen.core.kitchen.service.IKitchenSettingService; +import com.bonus.common.core.utils.poi.ExcelUtil; +import com.bonus.common.core.web.controller.BaseController; +import com.bonus.common.core.web.domain.AjaxResult; +import com.bonus.common.core.web.page.TableDataInfo; +import com.bonus.common.log.annotation.SysLog; +import com.bonus.common.log.enums.OperaType; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * 功能参数配置Controller + * + * @author xsheng + * @date 2025-05-25 + */ +@Api(tags = "功能参数配置接口") +@RestController +@RequestMapping("/kitchen_setting") +public class KitchenSettingController extends BaseController { + @Autowired + private IKitchenSettingService kitchenSettingService; + + /** + * 查询功能参数配置列表 + */ + @ApiOperation(value = "查询功能参数配置列表") + //@RequiresPermissions("kitchen:setting:list") + @GetMapping("/list") + public TableDataInfo list(KitchenSetting kitchenSetting) { + startPage(); + List list = kitchenSettingService.selectKitchenSettingList(kitchenSetting); + return getDataTable(list); + } + + /** + * 导出功能参数配置列表 + */ + @ApiOperation(value = "导出功能参数配置列表") + //@PreventRepeatSubmit + //@RequiresPermissions("kitchen:setting:export") + @SysLog(title = "功能参数配置", businessType = OperaType.EXPORT, logType = 1,module = "食堂管理->导出功能参数配置") + @PostMapping("/export") + public void export(HttpServletResponse response, KitchenSetting kitchenSetting) { + List list = kitchenSettingService.selectKitchenSettingList(kitchenSetting); + ExcelUtil util = new ExcelUtil(KitchenSetting.class); + util.exportExcel(response, list, "功能参数配置数据"); + } + + /** + * 获取功能参数配置详细信息 + */ + @ApiOperation(value = "获取功能参数配置详细信息") + //@RequiresPermissions("kitchen:setting:query") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return success(kitchenSettingService.selectKitchenSettingById(id)); + } + + /** + * 新增功能参数配置 + */ + @ApiOperation(value = "新增功能参数配置") + //@PreventRepeatSubmit + //@RequiresPermissions("kitchen:setting:add") + @SysLog(title = "功能参数配置", businessType = OperaType.INSERT, logType = 1,module = "食堂管理->新增功能参数配置") + @PostMapping + public AjaxResult add(@RequestBody KitchenSetting kitchenSetting) { + try { + return toAjax(kitchenSettingService.insertKitchenSetting(kitchenSetting)); + } catch (Exception e) { + return error(e.getMessage()); + } + } + + /** + * 修改功能参数配置 + */ + @ApiOperation(value = "修改功能参数配置") + //@PreventRepeatSubmit + //@RequiresPermissions("kitchen:setting:edit") + @SysLog(title = "功能参数配置", businessType = OperaType.UPDATE, logType = 1,module = "食堂管理->修改功能参数配置") + @PostMapping("/edit") + public AjaxResult edit(@RequestBody KitchenSetting kitchenSetting) { + try { + return toAjax(kitchenSettingService.updateKitchenSetting(kitchenSetting)); + } catch (Exception e) { + return error(e.getMessage()); + } + } + + @ApiOperation(value = "修改功能参数配置") + //@PreventRepeatSubmit + //@RequiresPermissions("kitchen:setting:edit") + @SysLog(title = "功能参数配置", businessType = OperaType.UPDATE, logType = 1,module = "食堂管理->修改功能参数配置") + @PostMapping("/batchEdit") + public AjaxResult batchEdit(@RequestBody List list) { + try { + return toAjax(kitchenSettingService.batchUpdateKitchenSetting(list)); + } catch (Exception e) { + return error(e.getMessage()); + } + } + + /** + * 修改功能参数配置 + */ + @ApiOperation(value = "恢复默认值") + //@PreventRepeatSubmit + //@RequiresPermissions("kitchen:setting:edit") + @SysLog(title = "恢复默认值", businessType = OperaType.UPDATE, logType = 1,module = "食堂管理->恢复默认值") + @PostMapping("/batchToDefault") + public AjaxResult batchToDefault(@RequestBody List list) { + try { + return toAjax(kitchenSettingService.batchToDefault(list)); + } catch (Exception e) { + return error(e.getMessage()); + } + } + + /** + * 删除功能参数配置 + */ + @ApiOperation(value = "删除功能参数配置") + //@PreventRepeatSubmit + //@RequiresPermissions("kitchen:setting:remove") + @SysLog(title = "功能参数配置", businessType = OperaType.DELETE, logType = 1,module = "食堂管理->删除功能参数配置") + @PostMapping("/del/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(kitchenSettingService.deleteKitchenSettingByIds(ids)); + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenSetting.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenSetting.java new file mode 100644 index 0000000..6e400e7 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/domain/KitchenSetting.java @@ -0,0 +1,42 @@ +package com.bonus.canteen.core.kitchen.domain; + +import com.bonus.common.core.annotation.Excel; +import com.bonus.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +/** + * 功能参数配置对象 kitchen_setting + * + * @author xsheng + * @date 2025-05-25 + */ + + +@Data +@ToString +public class KitchenSetting extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 主键id */ + private Long id; + + /** 参数键名 */ + @Excel(name = "参数键名") + @ApiModelProperty(value = "参数键名") + private String itemName; + + /** 参数主键 */ + @Excel(name = "参数主键") + @ApiModelProperty(value = "参数主键") + private String itemValue; + + @ApiModelProperty(value = "参数描述") + private String itemDescription; + + /** 用途类型(1-后台;2-APP;3-双屏消费机) */ + @Excel(name = "用途类型(1-后台;2-APP;3-双屏消费机)") + @ApiModelProperty(value = "用途类型(1-后台;2-APP;3-双屏消费机)") + private String usageType; +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/mapper/KitchenSettingMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/mapper/KitchenSettingMapper.java new file mode 100644 index 0000000..8f98fb1 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/mapper/KitchenSettingMapper.java @@ -0,0 +1,64 @@ +package com.bonus.canteen.core.kitchen.mapper; + +import com.bonus.canteen.core.kitchen.domain.KitchenSetting; +import java.util.List; + +/** + * 功能参数配置Mapper接口 + * + * @author xsheng + * @date 2025-05-25 + */ +public interface KitchenSettingMapper { + /** + * 查询功能参数配置 + * + * @param id 功能参数配置主键 + * @return 功能参数配置 + */ + public KitchenSetting selectKitchenSettingById(Long id); + + /** + * 查询功能参数配置列表 + * + * @param kitchenSetting 功能参数配置 + * @return 功能参数配置集合 + */ + public List selectKitchenSettingList(KitchenSetting kitchenSetting); + + /** + * 新增功能参数配置 + * + * @param kitchenSetting 功能参数配置 + * @return 结果 + */ + public int insertKitchenSetting(KitchenSetting kitchenSetting); + + /** + * 修改功能参数配置 + * + * @param kitchenSetting 功能参数配置 + * @return 结果 + */ + public int updateKitchenSetting(KitchenSetting kitchenSetting); + + public int updateKitchenSettingByItemName(KitchenSetting kitchenSetting); + + public int batchToDefault(KitchenSetting kitchenSetting); + + /** + * 删除功能参数配置 + * + * @param id 功能参数配置主键 + * @return 结果 + */ + public int deleteKitchenSettingById(Long id); + + /** + * 批量删除功能参数配置 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteKitchenSettingByIds(Long[] ids); +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/IKitchenSettingService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/IKitchenSettingService.java new file mode 100644 index 0000000..6098c2a --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/IKitchenSettingService.java @@ -0,0 +1,64 @@ +package com.bonus.canteen.core.kitchen.service; + +import com.bonus.canteen.core.kitchen.domain.KitchenSetting; +import java.util.List; + +/** + * 功能参数配置Service接口 + * + * @author xsheng + * @date 2025-05-25 + */ +public interface IKitchenSettingService { + /** + * 查询功能参数配置 + * + * @param id 功能参数配置主键 + * @return 功能参数配置 + */ + public KitchenSetting selectKitchenSettingById(Long id); + + /** + * 查询功能参数配置列表 + * + * @param kitchenSetting 功能参数配置 + * @return 功能参数配置集合 + */ + public List selectKitchenSettingList(KitchenSetting kitchenSetting); + + /** + * 新增功能参数配置 + * + * @param kitchenSetting 功能参数配置 + * @return 结果 + */ + public int insertKitchenSetting(KitchenSetting kitchenSetting); + + /** + * 修改功能参数配置 + * + * @param kitchenSetting 功能参数配置 + * @return 结果 + */ + public int updateKitchenSetting(KitchenSetting kitchenSetting); + + public int batchUpdateKitchenSetting(List list); + + public int batchToDefault(List list); + + /** + * 批量删除功能参数配置 + * + * @param ids 需要删除的功能参数配置主键集合 + * @return 结果 + */ + public int deleteKitchenSettingByIds(Long[] ids); + + /** + * 删除功能参数配置信息 + * + * @param id 功能参数配置主键 + * @return 结果 + */ + public int deleteKitchenSettingById(Long id); +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenSettingServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenSettingServiceImpl.java new file mode 100644 index 0000000..f9ad5ab --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/kitchen/service/impl/KitchenSettingServiceImpl.java @@ -0,0 +1,131 @@ +package com.bonus.canteen.core.kitchen.service.impl; + +import com.bonus.canteen.core.kitchen.domain.KitchenSetting; +import com.bonus.canteen.core.kitchen.mapper.KitchenSettingMapper; +import com.bonus.canteen.core.kitchen.service.IKitchenSettingService; +import com.bonus.common.core.exception.ServiceException; +import com.bonus.common.core.utils.DateUtils; +import com.bonus.common.security.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.List; + +/** + * 功能参数配置Service业务层处理 + * + * @author xsheng + * @date 2025-05-25 + */ +@Service +public class KitchenSettingServiceImpl implements IKitchenSettingService { + @Autowired + private KitchenSettingMapper kitchenSettingMapper; + + /** + * 查询功能参数配置 + * + * @param id 功能参数配置主键 + * @return 功能参数配置 + */ + @Override + public KitchenSetting selectKitchenSettingById(Long id) { + return kitchenSettingMapper.selectKitchenSettingById(id); + } + + /** + * 查询功能参数配置列表 + * + * @param kitchenSetting 功能参数配置 + * @return 功能参数配置 + */ + @Override + public List selectKitchenSettingList(KitchenSetting kitchenSetting) { + return kitchenSettingMapper.selectKitchenSettingList(kitchenSetting); + } + + /** + * 新增功能参数配置 + * + * @param kitchenSetting 功能参数配置 + * @return 结果 + */ + @Override + public int insertKitchenSetting(KitchenSetting kitchenSetting) { + kitchenSetting.setCreateTime(DateUtils.getNowDate()); + kitchenSetting.setCreateBy(SecurityUtils.getUsername()); + try { + return kitchenSettingMapper.insertKitchenSetting(kitchenSetting); + } catch (Exception e) { + throw new ServiceException(e.getMessage()); + } + } + + /** + * 修改功能参数配置 + * + * @param kitchenSetting 功能参数配置 + * @return 结果 + */ + @Override + public int updateKitchenSetting(KitchenSetting kitchenSetting) { + kitchenSetting.setUpdateTime(DateUtils.getNowDate()); + kitchenSetting.setUpdateBy(SecurityUtils.getUsername()); + try { + return kitchenSettingMapper.updateKitchenSetting(kitchenSetting); + } catch (Exception e) { + throw new ServiceException(e.getMessage()); + } + } + + @Override + public int batchUpdateKitchenSetting(List list) { + int count = 0; + for (KitchenSetting kitchenSetting : list) { + kitchenSetting.setUpdateTime(DateUtils.getNowDate()); + kitchenSetting.setUpdateBy(SecurityUtils.getUsername()); + try { + count += kitchenSettingMapper.updateKitchenSettingByItemName(kitchenSetting); + } catch (Exception e) { + throw new ServiceException(e.getMessage()); + } + } + return count; + } + + @Override + public int batchToDefault(List list) { + int count = 0; + for (KitchenSetting kitchenSetting : list) { + kitchenSetting.setUpdateTime(DateUtils.getNowDate()); + kitchenSetting.setUpdateBy(SecurityUtils.getUsername()); + try { + count += kitchenSettingMapper.batchToDefault(kitchenSetting); + } catch (Exception e) { + throw new ServiceException(e.getMessage()); + } + } + return count; + } + + /** + * 批量删除功能参数配置 + * + * @param ids 需要删除的功能参数配置主键 + * @return 结果 + */ + @Override + public int deleteKitchenSettingByIds(Long[] ids) { + return kitchenSettingMapper.deleteKitchenSettingByIds(ids); + } + + /** + * 删除功能参数配置信息 + * + * @param id 功能参数配置主键 + * @return 结果 + */ + @Override + public int deleteKitchenSettingById(Long id) { + return kitchenSettingMapper.deleteKitchenSettingById(id); + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenSettingMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenSettingMapper.xml new file mode 100644 index 0000000..c300308 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/kitchen/KitchenSettingMapper.xml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + select id, item_name, item_value, item_description, usage_type, create_by, create_time, update_by, update_time + from kitchen_setting + + + + + + + + insert into kitchen_setting + + item_name, + item_value, + item_description, + usage_type, + create_by, + create_time, + update_by, + update_time, + + + #{itemName}, + #{itemValue}, + #{itemDescription}, + #{usageType}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update kitchen_setting + + item_name = #{itemName}, + item_value = #{itemValue}, + item_description = #{itemDescription}, + usage_type = #{usageType}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where id = #{id} + + + + update kitchen_setting + set item_value = #{itemValue} + where item_name = #{itemName} + + + + update kitchen_setting + set item_value = default_value + where item_name = #{itemName} + + + + delete from kitchen_setting where id = #{id} + + + + delete from kitchen_setting where id in + + #{id} + + + \ No newline at end of file