Junjie
昨天 a4f07b2a0ddb6c210e05afbbb491feeb466203e7
src/main/java/com/zy/asrs/controller/WrkLastnoController.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 = "/wrkLastno/{id}/auth")
    @ManagerAuth
    public R get(@PathVariable("id") String id) {
        return R.ok(wrkLastnoService.selectById(String.valueOf(id)));
        return R.ok(wrkLastnoService.getById(String.valueOf(id)));
    }
    @RequestMapping(value = "/wrkLastno/list/auth")
@@ -38,13 +38,13 @@
                  @RequestParam(required = false)String orderByType,
                  @RequestParam Map<String, Object> param){
        excludeTrash(param);
        EntityWrapper<WrkLastno> wrapper = new EntityWrapper<>();
        QueryWrapper<WrkLastno> wrapper = new QueryWrapper<>();
        convert(param, wrapper);
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
        return R.ok(wrkLastnoService.selectPage(new Page<>(curr, limit), wrapper));
        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(true, "asc".equals(orderByType), humpToLine(orderByField));}
        return R.ok(wrkLastnoService.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());
            if (val.contains(RANGE_TIME_LINK)){
@@ -64,7 +64,7 @@
        wrkLastno.setModiTime(new Date());
        wrkLastno.setAppeUser(getUserId());
        wrkLastno.setAppeTime(new Date());
        wrkLastnoService.insert(wrkLastno);
        wrkLastnoService.save(wrkLastno);
        return R.ok();
    }
@@ -88,7 +88,7 @@
            return R.error();
        }
        for (WrkLastno entity : list){
            wrkLastnoService.delete(new EntityWrapper<>(entity));
            wrkLastnoService.remove(new QueryWrapper<>(entity));
        }
        return R.ok();
    }
@@ -97,19 +97,19 @@
    @ManagerAuth(memo = "工作序号导出")
    public R export(@RequestBody JSONObject param){
        List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class);
        EntityWrapper<WrkLastno> wrapper = new EntityWrapper<>();
        QueryWrapper<WrkLastno> wrapper = new QueryWrapper<>();
        Map<String, Object> map = excludeTrash(param.getJSONObject("wrkLastno"));
        convert(map, wrapper);
        List<WrkLastno> list = wrkLastnoService.selectList(wrapper);
        List<WrkLastno> list = wrkLastnoService.list(wrapper);
        return R.ok(exportSupport(list, fields));
    }
    @RequestMapping(value = "/wrkLastnoQuery/auth")
    @ManagerAuth
    public R query(String condition) {
        EntityWrapper<WrkLastno> wrapper = new EntityWrapper<>();
        QueryWrapper<WrkLastno> wrapper = new QueryWrapper<>();
        wrapper.like("wrk_mk", condition);
        Page<WrkLastno> page = wrkLastnoService.selectPage(new Page<>(0, 10), wrapper);
        Page<WrkLastno> page = wrkLastnoService.page(new Page<>(0, 10), wrapper);
        List<Map<String, Object>> result = new ArrayList<>();
        for (WrkLastno wrkLastno : page.getRecords()){
            Map<String, Object> map = new HashMap<>();
@@ -123,8 +123,8 @@
    @RequestMapping(value = "/wrkLastno/check/column/auth")
    @ManagerAuth
    public R query(@RequestBody JSONObject param) {
        Wrapper<WrkLastno> wrapper = new EntityWrapper<WrkLastno>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val"));
        if (null != wrkLastnoService.selectOne(wrapper)){
        QueryWrapper<WrkLastno> wrapper = new QueryWrapper<WrkLastno>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val"));
        if (null != wrkLastnoService.getOne(wrapper)){
            return R.parse(BaseRes.REPEAT).add(getComment(WrkLastno.class, String.valueOf(param.get("key"))));
        }
        return R.ok();