From 82de5a307466894bbb0258f8a63a26a7bb96d80d Mon Sep 17 00:00:00 2001 From: zhang <zc857179121@qq.com> Date: 星期四, 16 十月 2025 09:55:35 +0800 Subject: [PATCH] 13 --- src/main/java/com/zy/asrs/controller/RowLastnoTypeController.java | 52 ++++++++++++++++++++++++++++------------------------ 1 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/RowLastnoTypeController.java b/src/main/java/com/zy/asrs/controller/RowLastnoTypeController.java index 0347a53..d8b5341 100644 --- a/src/main/java/com/zy/asrs/controller/RowLastnoTypeController.java +++ b/src/main/java/com/zy/asrs/controller/RowLastnoTypeController.java @@ -1,22 +1,24 @@ package com.zy.asrs.controller; -import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.plugins.Page; -import com.core.common.DateUtils; -import com.zy.asrs.entity.RowLastnoType; -import com.zy.asrs.service.RowLastnoTypeService; import com.core.annotations.ManagerAuth; import com.core.common.BaseRes; import com.core.common.Cools; +import com.core.common.DateUtils; import com.core.common.R; +import com.zy.asrs.entity.RowLastnoType; +import com.zy.asrs.service.RowLastnoTypeService; import com.zy.common.web.BaseController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; @RestController public class RowLastnoTypeController extends BaseController { @@ -32,24 +34,26 @@ @RequestMapping(value = "/rowLastnoType/list/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(required = false)String condition, - @RequestParam Map<String, Object> param){ + public R list(@RequestParam(defaultValue = "1") Integer curr, + @RequestParam(defaultValue = "10") Integer limit, + @RequestParam(required = false) String orderByField, + @RequestParam(required = false) String orderByType, + @RequestParam(required = false) String condition, + @RequestParam Map<String, Object> param) { EntityWrapper<RowLastnoType> wrapper = new EntityWrapper<>(); excludeTrash(param); convert(param, wrapper); allLike(RowLastnoType.class, param.keySet(), wrapper, condition); - if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} + if (!Cools.isEmpty(orderByField)) { + wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); + } return R.ok(rowLastnoTypeService.selectPage(new Page<>(curr, limit), wrapper)); } - private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ - for (Map.Entry<String, Object> entry : map.entrySet()){ + private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { + for (Map.Entry<String, Object> entry : map.entrySet()) { String val = String.valueOf(entry.getValue()); - if (val.contains(RANGE_TIME_LINK)){ + if (val.contains(RANGE_TIME_LINK)) { String[] dates = val.split(RANGE_TIME_LINK); wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); @@ -66,10 +70,10 @@ return R.ok(); } - @RequestMapping(value = "/rowLastnoType/update/auth") - @ManagerAuth - public R update(RowLastnoType rowLastnoType){ - if (Cools.isEmpty(rowLastnoType) || null==rowLastnoType.getId()){ + @RequestMapping(value = "/rowLastnoType/update/auth") + @ManagerAuth + public R update(RowLastnoType rowLastnoType) { + if (Cools.isEmpty(rowLastnoType) || null == rowLastnoType.getId()) { return R.error(); } rowLastnoTypeService.updateById(rowLastnoType); @@ -78,8 +82,8 @@ @RequestMapping(value = "/rowLastnoType/delete/auth") @ManagerAuth - public R delete(@RequestParam(value="ids[]") Long[] ids){ - for (Long id : ids){ + public R delete(@RequestParam(value = "ids[]") Long[] ids) { + for (Long id : ids) { rowLastnoTypeService.deleteById(id); } return R.ok(); @@ -87,7 +91,7 @@ @RequestMapping(value = "/rowLastnoType/export/auth") @ManagerAuth - public R export(@RequestBody JSONObject param){ + public R export(@RequestBody JSONObject param) { EntityWrapper<RowLastnoType> wrapper = new EntityWrapper<>(); List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); Map<String, Object> map = excludeTrash(param.getJSONObject("rowLastnoType")); @@ -103,7 +107,7 @@ wrapper.like("id", condition); Page<RowLastnoType> page = rowLastnoTypeService.selectPage(new Page<>(0, 10), wrapper); List<Map<String, Object>> result = new ArrayList<>(); - for (RowLastnoType rowLastnoType : page.getRecords()){ + for (RowLastnoType rowLastnoType : page.getRecords()) { Map<String, Object> map = new HashMap<>(); map.put("id", rowLastnoType.getId()); map.put("value", rowLastnoType.getId()); @@ -116,7 +120,7 @@ @ManagerAuth public R query(@RequestBody JSONObject param) { Wrapper<RowLastnoType> wrapper = new EntityWrapper<RowLastnoType>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); - if (null != rowLastnoTypeService.selectOne(wrapper)){ + if (null != rowLastnoTypeService.selectOne(wrapper)) { return R.parse(BaseRes.REPEAT).add(getComment(RowLastnoType.class, String.valueOf(param.get("key")))); } return R.ok(); -- Gitblit v1.9.1