设置的批量修改和恢复
This commit is contained in:
parent
282f9bb0f3
commit
c87b610bb9
|
|
@ -3,20 +3,16 @@ package com.bonus.canteen.core.basic.controller;
|
|||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
//import com.bonus.canteen.core.basic.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.basic.domain.BasicSetting;
|
||||
import com.bonus.canteen.core.basic.service.IBasicSettingService;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
|
|
@ -55,7 +51,7 @@ public class BasicSettingController extends BaseController {
|
|||
@ApiOperation(value = "导出功能参数配置列表")
|
||||
//@PreventRepeatSubmit
|
||||
//@RequiresPermissions("basic:setting:export")
|
||||
@SysLog(title = "功能参数配置", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出功能参数配置")
|
||||
@SysLog(title = "功能参数配置", businessType = OperaType.EXPORT, logType = 1,module = "食堂管理->导出功能参数配置")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BasicSetting basicSetting) {
|
||||
List<BasicSetting> list = basicSettingService.selectBasicSettingList(basicSetting);
|
||||
|
|
@ -79,7 +75,7 @@ public class BasicSettingController extends BaseController {
|
|||
@ApiOperation(value = "新增功能参数配置")
|
||||
//@PreventRepeatSubmit
|
||||
//@RequiresPermissions("basic:setting:add")
|
||||
@SysLog(title = "功能参数配置", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增功能参数配置")
|
||||
@SysLog(title = "功能参数配置", businessType = OperaType.INSERT, logType = 1,module = "食堂管理->新增功能参数配置")
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BasicSetting basicSetting) {
|
||||
try {
|
||||
|
|
@ -95,7 +91,7 @@ public class BasicSettingController extends BaseController {
|
|||
@ApiOperation(value = "修改功能参数配置")
|
||||
//@PreventRepeatSubmit
|
||||
//@RequiresPermissions("basic:setting:edit")
|
||||
@SysLog(title = "功能参数配置", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改功能参数配置")
|
||||
@SysLog(title = "功能参数配置", businessType = OperaType.UPDATE, logType = 1,module = "食堂管理->修改功能参数配置")
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody BasicSetting basicSetting) {
|
||||
try {
|
||||
|
|
@ -105,13 +101,42 @@ public class BasicSettingController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改功能参数配置")
|
||||
//@PreventRepeatSubmit
|
||||
//@RequiresPermissions("basic:setting:edit")
|
||||
@SysLog(title = "功能参数配置", businessType = OperaType.UPDATE, logType = 1,module = "食堂管理->修改功能参数配置")
|
||||
@PostMapping("/batchEdit")
|
||||
public AjaxResult batchEdit(@RequestBody List<BasicSetting> list) {
|
||||
try {
|
||||
return toAjax(basicSettingService.batchUpdateBasicSetting(list));
|
||||
} catch (Exception e) {
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改功能参数配置
|
||||
*/
|
||||
@ApiOperation(value = "恢复默认值")
|
||||
//@PreventRepeatSubmit
|
||||
//@RequiresPermissions("basic:setting:edit")
|
||||
@SysLog(title = "恢复默认值", businessType = OperaType.UPDATE, logType = 1,module = "食堂管理->恢复默认值")
|
||||
@PostMapping("/batchToDefault")
|
||||
public AjaxResult batchToDefault(@RequestBody List<BasicSetting> list) {
|
||||
try {
|
||||
return toAjax(basicSettingService.batchToDefault(list));
|
||||
} catch (Exception e) {
|
||||
return error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除功能参数配置
|
||||
*/
|
||||
@ApiOperation(value = "删除功能参数配置")
|
||||
//@PreventRepeatSubmit
|
||||
//@RequiresPermissions("basic:setting:remove")
|
||||
@SysLog(title = "功能参数配置", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除功能参数配置")
|
||||
@SysLog(title = "功能参数配置", businessType = OperaType.DELETE, logType = 1,module = "食堂管理->删除功能参数配置")
|
||||
@PostMapping("/del/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(basicSettingService.deleteBasicSettingByIds(ids));
|
||||
|
|
|
|||
|
|
@ -42,6 +42,10 @@ public interface BasicSettingMapper {
|
|||
*/
|
||||
public int updateBasicSetting(BasicSetting basicSetting);
|
||||
|
||||
public int updateBasicSettingByItemName(BasicSetting basicSetting);
|
||||
|
||||
public int batchToDefault(BasicSetting basicSetting);
|
||||
|
||||
/**
|
||||
* 删除功能参数配置
|
||||
*
|
||||
|
|
|
|||
|
|
@ -42,6 +42,10 @@ public interface IBasicSettingService {
|
|||
*/
|
||||
public int updateBasicSetting(BasicSetting basicSetting);
|
||||
|
||||
public int batchUpdateBasicSetting(List<BasicSetting> list);
|
||||
|
||||
public int batchToDefault(List<BasicSetting> list);
|
||||
|
||||
/**
|
||||
* 批量删除功能参数配置
|
||||
*
|
||||
|
|
|
|||
|
|
@ -77,6 +77,36 @@ public class BasicSettingServiceImpl implements IBasicSettingService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchUpdateBasicSetting(List<BasicSetting> list) {
|
||||
int count = 0;
|
||||
for (BasicSetting basicSetting : list) {
|
||||
basicSetting.setUpdateTime(DateUtils.getNowDate());
|
||||
basicSetting.setUpdateBy(SecurityUtils.getUsername());
|
||||
try {
|
||||
count += basicSettingMapper.updateBasicSettingByItemName(basicSetting);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchToDefault(List<BasicSetting> list) {
|
||||
int count = 0;
|
||||
for (BasicSetting basicSetting : list) {
|
||||
basicSetting.setUpdateTime(DateUtils.getNowDate());
|
||||
basicSetting.setUpdateBy(SecurityUtils.getUsername());
|
||||
try {
|
||||
count += basicSettingMapper.batchToDefault(basicSetting);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除功能参数配置
|
||||
*
|
||||
|
|
|
|||
|
|
@ -72,6 +72,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateBasicSettingByItemName" parameterType="com.bonus.canteen.core.basic.domain.BasicSetting">
|
||||
update basic_setting
|
||||
set item_value = #{itemValue}
|
||||
where item_name = #{itemName}
|
||||
</update>
|
||||
|
||||
<update id="batchToDefault" parameterType="com.bonus.canteen.core.basic.domain.BasicSetting">
|
||||
update basic_setting
|
||||
set item_value = default_value
|
||||
where item_name = #{itemName}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBasicSettingById" parameterType="Long">
|
||||
delete from basic_setting where id = #{id}
|
||||
</delete>
|
||||
|
|
|
|||
Loading…
Reference in New Issue