| package com.zy.asrs.common.sys.controller; | 
|   | 
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
| import com.zy.asrs.common.sys.entity.OperateLog; | 
| import com.zy.asrs.common.sys.service.OperateLogService; | 
| import com.zy.asrs.common.web.BaseController; | 
| import com.zy.asrs.framework.annotations.ManagerAuth; | 
| import com.zy.asrs.framework.common.Cools; | 
| import com.zy.asrs.framework.common.R; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.web.bind.annotation.PathVariable; | 
| import org.springframework.web.bind.annotation.RequestMapping; | 
| import org.springframework.web.bind.annotation.RequestParam; | 
| import org.springframework.web.bind.annotation.RestController; | 
|   | 
| import java.util.*; | 
|   | 
| @RestController | 
| public class OperateLogController extends BaseController { | 
|   | 
|     @Autowired | 
|     private OperateLogService operateLogService; | 
|   | 
|     @RequestMapping(value = "/operateLog/{id}/auth") | 
|     @ManagerAuth | 
|     public R get(@PathVariable("id") Long id) { | 
|         return R.ok(operateLogService.getById(String.valueOf(id))); | 
|     } | 
|   | 
|     @RequestMapping(value = "/operateLog/page/auth") | 
|     @ManagerAuth | 
|     public R list(@RequestParam(defaultValue = "1")Integer curr, | 
|                   @RequestParam(defaultValue = "10")Integer limit, | 
|                   @RequestParam(required = false)String orderByField, | 
|                   @RequestParam(required = false)String orderByType, | 
|                   @RequestParam Map<String, Object> param){ | 
|         LambdaQueryWrapper<OperateLog> wrapper = new LambdaQueryWrapper<>(); | 
|         return R.ok(operateLogService.page(new Page<>(curr, limit), wrapper)); | 
|     } | 
|   | 
|     @RequestMapping(value = "/operateLog/edit/auth") | 
|     @ManagerAuth | 
|     public R edit(OperateLog operateLog) { | 
|         if (Cools.isEmpty(operateLog)){ | 
|             return R.error(); | 
|         } | 
|         if (null == operateLog.getId()){ | 
|             operateLogService.save(operateLog); | 
|         } else { | 
|             operateLogService.updateById(operateLog); | 
|         } | 
|         return R.ok(); | 
|     } | 
|   | 
|     @RequestMapping(value = "/operateLog/add/auth") | 
|     @ManagerAuth | 
|     public R add(OperateLog operateLog) { | 
|         operateLogService.save(operateLog); | 
|         return R.ok(); | 
|     } | 
|   | 
|     @RequestMapping(value = "/operateLog/update/auth") | 
|     @ManagerAuth | 
|     public R update(OperateLog operateLog){ | 
|         if (Cools.isEmpty(operateLog) || null==operateLog.getId()){ | 
|             return R.error(); | 
|         } | 
|         operateLogService.updateById(operateLog); | 
|         return R.ok(); | 
|     } | 
|   | 
|     @RequestMapping(value = "/operateLog/delete/auth") | 
|     @ManagerAuth | 
|     public R delete(Integer[] ids){ | 
|         if (Cools.isEmpty(ids)){ | 
|             return R.error(); | 
|         } | 
|         operateLogService.removeByIds(Arrays.asList(ids)); | 
|         return R.ok(); | 
|     } | 
|   | 
|     @RequestMapping(value = "/operateLogQuery/auth") | 
|     @ManagerAuth | 
|     public R query(String condition) { | 
|         LambdaQueryWrapper<OperateLog> wrapper = new LambdaQueryWrapper<>(); | 
|         wrapper.like(OperateLog::getAction, condition); | 
|         Page<OperateLog> page = operateLogService.page(new Page<>(0, 10), wrapper); | 
|         List<Map<String, Object>> result = new ArrayList<>(); | 
|         for (OperateLog operateLog : page.getRecords()){ | 
|             Map<String, Object> map = new HashMap<>(); | 
|             map.put("id", operateLog.getId()); | 
|             map.put("value", operateLog.getId()); | 
|             result.add(map); | 
|         } | 
|         return R.ok(result); | 
|     } | 
|   | 
| } |