厨房设置
This commit is contained in:
parent
890357723c
commit
b94b21b26e
|
|
@ -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<KitchenSetting> 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<KitchenSetting> list = kitchenSettingService.selectKitchenSettingList(kitchenSetting);
|
||||
ExcelUtil<KitchenSetting> util = new ExcelUtil<KitchenSetting>(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<KitchenSetting> 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<KitchenSetting> 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));
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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<KitchenSetting> 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);
|
||||
}
|
||||
|
|
@ -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<KitchenSetting> selectKitchenSettingList(KitchenSetting kitchenSetting);
|
||||
|
||||
/**
|
||||
* 新增功能参数配置
|
||||
*
|
||||
* @param kitchenSetting 功能参数配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertKitchenSetting(KitchenSetting kitchenSetting);
|
||||
|
||||
/**
|
||||
* 修改功能参数配置
|
||||
*
|
||||
* @param kitchenSetting 功能参数配置
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateKitchenSetting(KitchenSetting kitchenSetting);
|
||||
|
||||
public int batchUpdateKitchenSetting(List<KitchenSetting> list);
|
||||
|
||||
public int batchToDefault(List<KitchenSetting> list);
|
||||
|
||||
/**
|
||||
* 批量删除功能参数配置
|
||||
*
|
||||
* @param ids 需要删除的功能参数配置主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteKitchenSettingByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除功能参数配置信息
|
||||
*
|
||||
* @param id 功能参数配置主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteKitchenSettingById(Long id);
|
||||
}
|
||||
|
|
@ -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<KitchenSetting> 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<KitchenSetting> 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<KitchenSetting> 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);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
<?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.KitchenSettingMapper">
|
||||
<resultMap type="com.bonus.canteen.core.kitchen.domain.KitchenSetting" id="KitchenSettingResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="itemName" column="item_name" />
|
||||
<result property="itemValue" column="item_value" />
|
||||
<result property="itemDescription" column="item_description" />
|
||||
<result property="usageType" column="usage_type" />
|
||||
<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="selectKitchenSettingVo">
|
||||
select id, item_name, item_value, item_description, usage_type, create_by, create_time, update_by, update_time
|
||||
from kitchen_setting
|
||||
</sql>
|
||||
|
||||
<select id="selectKitchenSettingList" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenSetting" resultMap="KitchenSettingResult">
|
||||
<include refid="selectKitchenSettingVo"/>
|
||||
<where>
|
||||
<if test="itemName != null and itemName != ''"> and item_name like concat('%', #{itemName}, '%')</if>
|
||||
<if test="itemValue != null and itemValue != ''"> and item_value = #{itemValue}</if>
|
||||
<if test="itemDescription != null and itemDescription != ''"> and item_description like concat('%', #{itemDescription}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectKitchenSettingById" parameterType="Long" resultMap="KitchenSettingResult">
|
||||
<include refid="selectKitchenSettingVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertKitchenSetting" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenSetting" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into kitchen_setting
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="itemName != null">item_name,</if>
|
||||
<if test="itemValue != null">item_value,</if>
|
||||
<if test="itemDescription != null">item_description,</if>
|
||||
<if test="usageType != null">usage_type,</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="itemName != null">#{itemName},</if>
|
||||
<if test="itemValue != null">#{itemValue},</if>
|
||||
<if test="itemDescription != null">#{itemDescription},</if>
|
||||
<if test="usageType != null">#{usageType},</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="updateKitchenSetting" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenSetting">
|
||||
update kitchen_setting
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="itemName != null">item_name = #{itemName},</if>
|
||||
<if test="itemValue != null">item_value = #{itemValue},</if>
|
||||
<if test="itemDescription != null">item_description = #{itemDescription},</if>
|
||||
<if test="usageType != null">usage_type = #{usageType},</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>
|
||||
|
||||
<update id="updateKitchenSettingByItemName" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenSetting">
|
||||
update kitchen_setting
|
||||
set item_value = #{itemValue}
|
||||
where item_name = #{itemName}
|
||||
</update>
|
||||
|
||||
<update id="batchToDefault" parameterType="com.bonus.canteen.core.kitchen.domain.KitchenSetting">
|
||||
update kitchen_setting
|
||||
set item_value = default_value
|
||||
where item_name = #{itemName}
|
||||
</update>
|
||||
|
||||
<delete id="deleteKitchenSettingById" parameterType="Long">
|
||||
delete from kitchen_setting where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteKitchenSettingByIds" parameterType="String">
|
||||
delete from kitchen_setting where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue