| | |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.enums.SqlLike; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | |
| | | @RequestParam Map<String, Object> param){ |
| | | excludeTrash(param); |
| | | EntityWrapper<AgvWrkMast> wrapper = new EntityWrapper<>(); |
| | | convert(param, wrapper); |
| | | convert2(param, wrapper); |
| | | allLike(AgvWrkMast.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){ |
| | | if (orderByField.endsWith("$")){ |
| | |
| | | } |
| | | } |
| | | |
| | | private <T> void convert2(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)) { |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); |
| | | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); |
| | | } else { |
| | | String key = entry.getKey(); |
| | | if (key.startsWith("%") && key.endsWith("%")) { |
| | | wrapper.like(entry.getKey().replaceAll("%", ""), val); |
| | | } else if (key.startsWith("%")) { |
| | | wrapper.like(entry.getKey().replace("%", ""), val, SqlLike.LEFT); |
| | | } else if (key.endsWith("%")) { |
| | | wrapper.like(entry.getKey().replace("%", ""), val, SqlLike.RIGHT); |
| | | } else { |
| | | wrapper.eq(entry.getKey(), val); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/wrkMast/add/auth") |
| | | @ManagerAuth(memo = "工作档添加") |
| | | public R add(AgvWrkMast wrkMast) { |