#
Junjie
1 天以前 2d2fd991826837d7189cc488aee6f309a6f5e216
src/main/java/com/zy/asrs/controller/BasWrkIotypeController.java
@@ -2,9 +2,9 @@
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.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.annotations.ManagerAuth;
import com.core.common.BaseRes;
import com.core.common.Cools;
@@ -27,7 +27,7 @@
    @RequestMapping(value = "/basWrkIotype/{id}/auth")
    @ManagerAuth
    public R get(@PathVariable("id") Long id) {
        return R.ok(basWrkIotypeService.selectById(String.valueOf(id)));
        return R.ok(basWrkIotypeService.getById(String.valueOf(id)));
    }
    @RequestMapping(value = "/basWrkIotype/list/auth")
@@ -38,21 +38,22 @@
                  @RequestParam(required = false)String orderByType,
                  @RequestParam Map<String, Object> param){
        excludeTrash(param);
        EntityWrapper<BasWrkIotype> wrapper = new EntityWrapper<>();
        QueryWrapper<BasWrkIotype> wrapper = new QueryWrapper<>();
        convert(param, wrapper);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
        return R.ok(basWrkIotypeService.selectPage(new Page<>(curr, limit), wrapper));
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(true, "asc".equals(orderByType), humpToLine(orderByField));}
        return R.ok(basWrkIotypeService.page(new Page<>(curr, limit), wrapper));
    }
    private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){
    private <T> void convert(Map<String, Object> map, QueryWrapper<T> wrapper){
        for (Map.Entry<String, Object> entry : map.entrySet()){
            String val = String.valueOf(entry.getValue());
            String column = humpToLine(entry.getKey());
            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]));
                wrapper.ge(column, DateUtils.convert(dates[0]));
                wrapper.le(column, DateUtils.convert(dates[1]));
            } else {
                wrapper.like(entry.getKey(), val);
                wrapper.like(column, val);
            }
        }
    }
@@ -64,7 +65,7 @@
            return R.error();
        }
        if (null == basWrkIotype.getIoType()){
            basWrkIotypeService.insert(basWrkIotype);
            basWrkIotypeService.save(basWrkIotype);
        } else {
            basWrkIotypeService.updateById(basWrkIotype);
        }
@@ -78,7 +79,7 @@
        basWrkIotype.setModiTime(new Date());
        basWrkIotype.setAppeUser(getUserId());
        basWrkIotype.setAppeTime(new Date());
        basWrkIotypeService.insert(basWrkIotype);
        basWrkIotypeService.save(basWrkIotype);
        return R.ok();
    }
@@ -102,7 +103,7 @@
            return R.error();
        }
        for (BasWrkIotype entity : list){
            basWrkIotypeService.delete(new EntityWrapper<>(entity));
            basWrkIotypeService.remove(new QueryWrapper<>(entity));
        }
        return R.ok();
    }
@@ -111,19 +112,19 @@
    @ManagerAuth(memo = "入出库类型导出")
    public R export(@RequestBody JSONObject param){
        List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
        EntityWrapper<BasWrkIotype> wrapper = new EntityWrapper<>();
        QueryWrapper<BasWrkIotype> wrapper = new QueryWrapper<>();
        Map<String, Object> map = excludeTrash(param.getJSONObject("basWrkIotype"));
        convert(map, wrapper);
        List<BasWrkIotype> list = basWrkIotypeService.selectList(wrapper);
        List<BasWrkIotype> list = basWrkIotypeService.list(wrapper);
        return R.ok(exportSupport(list, fields));
    }
    @RequestMapping(value = "/basWrkIotypeQuery/auth")
    @ManagerAuth
    public R query(String condition) {
        EntityWrapper<BasWrkIotype> wrapper = new EntityWrapper<>();
        QueryWrapper<BasWrkIotype> wrapper = new QueryWrapper<>();
        wrapper.like("io_desc", condition);
        Page<BasWrkIotype> page = basWrkIotypeService.selectPage(new Page<>(0, 10), wrapper);
        Page<BasWrkIotype> page = basWrkIotypeService.page(new Page<>(0, 10), wrapper);
        List<Map<String, Object>> result = new ArrayList<>();
        for (BasWrkIotype basWrkIotype : page.getRecords()){
            Map<String, Object> map = new HashMap<>();
@@ -137,8 +138,8 @@
    @RequestMapping(value = "/basWrkIotype/check/column/auth")
    @ManagerAuth
    public R query(@RequestBody JSONObject param) {
        Wrapper<BasWrkIotype> wrapper = new EntityWrapper<BasWrkIotype>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val"));
        if (null != basWrkIotypeService.selectOne(wrapper)){
        QueryWrapper<BasWrkIotype> wrapper = new QueryWrapper<BasWrkIotype>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val"));
        if (null != basWrkIotypeService.getOne(wrapper)){
            return R.parse(BaseRes.REPEAT).add(getComment(BasWrkIotype.class, String.valueOf(param.get("key"))));
        }
        return R.ok();