| | |
| | | <parent> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-parent</artifactId> |
| | | <version>2.5.14</version> |
| | | <version>3.5.11</version> |
| | | <relativePath/> <!-- lookup parent from repository --> |
| | | </parent> |
| | | <groupId>com.zy</groupId> |
| | |
| | | <packaging>war</packaging> |
| | | |
| | | <properties> |
| | | <java.version>1.8</java.version> |
| | | <java.version>17</java.version> |
| | | <cool.version>3.4.0</cool.version> |
| | | <mysql-driver.version>5.1.47</mysql-driver.version> |
| | | <mybatis-plus.version>2.3.2</mybatis-plus.version> |
| | | <mybatis-plus.version>3.5.14</mybatis-plus.version> |
| | | <spring-ai.version>1.1.2</spring-ai.version> |
| | | <fastjson.version>1.2.83</fastjson.version> |
| | | <springfox.version>2.7.0</springfox.version> |
| | | </properties> |
| | | |
| | | <dependencyManagement> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.springframework.ai</groupId> |
| | | <artifactId>spring-ai-bom</artifactId> |
| | | <version>${spring-ai.version}</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | </dependencyManagement> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | |
| | | <version>${cool.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>mysql</groupId> |
| | | <artifactId>mysql-connector-java</artifactId> |
| | | <version>5.1.46</version> |
| | | <groupId>com.mysql</groupId> |
| | | <artifactId>mysql-connector-j</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.microsoft.sqlserver</groupId> |
| | | <artifactId>mssql-jdbc</artifactId> |
| | | <version>8.2.2.jre8</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-boot-starter</artifactId> |
| | | <artifactId>mybatis-plus-spring-boot3-starter</artifactId> |
| | | <version>${mybatis-plus.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-jsqlparser</artifactId> |
| | | <version>${mybatis-plus.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | |
| | | <version>${fastjson.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger2</artifactId> |
| | | <version>${springfox.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger-ui</artifactId> |
| | | <version>${springfox.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.github.xiaoymin</groupId> |
| | | <artifactId>swagger-bootstrap-ui</artifactId> |
| | | <version>1.8.9</version> |
| | | <groupId>io.swagger.core.v3</groupId> |
| | | <artifactId>swagger-annotations-jakarta</artifactId> |
| | | <version>2.2.39</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.google.zxing</groupId> |
| | |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <version>1.16.22</version> |
| | | <scope>provided</scope> |
| | | </dependency> |
| | | <!-- okHttp3 --> |
| | |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-aop</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.ai</groupId> |
| | | <artifactId>spring-ai-client-chat</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | 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.Wrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | |
| | | @RequestMapping(value = "/apiLog/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") String id) { |
| | | return R.ok(apiLogService.selectById(String.valueOf(id))); |
| | | return R.ok(apiLogService.getById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/apiLog/list/auth") |
| | |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam(required = false)String condition, |
| | | @RequestParam Map<String, Object> param){ |
| | | EntityWrapper<ApiLog> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<ApiLog> wrapper = new QueryWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | allLike(ApiLog.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} else { |
| | | wrapper.orderBy("create_time", false); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(true, "asc".equals(orderByType), humpToLine(orderByField));} else { |
| | | wrapper.orderBy(true, false, "create_time"); |
| | | } |
| | | return R.ok(apiLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | return R.ok(apiLogService.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)){ |
| | |
| | | @RequestMapping(value = "/apiLog/add/auth") |
| | | @ManagerAuth |
| | | public R add(ApiLog apiLog) { |
| | | apiLogService.insert(apiLog); |
| | | apiLogService.save(apiLog); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | apiLogService.deleteById(id); |
| | | apiLogService.removeById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | @RequestMapping(value = "/apiLog/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | EntityWrapper<ApiLog> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<ApiLog> wrapper = new QueryWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("apiLog")); |
| | | convert(map, wrapper); |
| | | List<ApiLog> list = apiLogService.selectList(wrapper); |
| | | List<ApiLog> list = apiLogService.list(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/apiLogQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<ApiLog> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<ApiLog> wrapper = new QueryWrapper<>(); |
| | | wrapper.like("uuid", condition); |
| | | Page<ApiLog> page = apiLogService.selectPage(new Page<>(0, 10), wrapper); |
| | | Page<ApiLog> page = apiLogService.page(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (ApiLog apiLog : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | @RequestMapping(value = "/apiLog/check/column/auth") |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<ApiLog> wrapper = new EntityWrapper<ApiLog>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != apiLogService.selectOne(wrapper)){ |
| | | Wrapper<ApiLog> wrapper = new QueryWrapper<ApiLog>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != apiLogService.getOne(wrapper)){ |
| | | return R.parse(BaseRes.REPEAT).add(getComment(ApiLog.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | 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.Cools; |
| | | import com.core.common.DateUtils; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | |
| | | @RequestMapping(value = "/apkBuildTask/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok(apkBuildTaskService.selectById(id)); |
| | | return R.ok(apkBuildTaskService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | excludeTrash(param); |
| | | EntityWrapper<ApkBuildTask> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<ApkBuildTask> wrapper = new QueryWrapper<>(); |
| | | convert(param, wrapper); |
| | | |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(orderByField, "asc".equalsIgnoreCase(orderByType)); |
| | | wrapper.orderBy(true, "asc".equalsIgnoreCase(orderByType), orderByField); |
| | | } else { |
| | | wrapper.orderBy("id", false); |
| | | wrapper.orderBy(true, false, "id"); |
| | | } |
| | | |
| | | return R.ok(apkBuildTaskService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | return R.ok(apkBuildTaskService.page(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | /** |
| | | * 搜索参数转换 |
| | | */ |
| | | private void convert(Map<String, Object> map, EntityWrapper<ApkBuildTask> wrapper) { |
| | | private void convert(Map<String, Object> map, QueryWrapper<ApkBuildTask> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String key = entry.getKey(); |
| | | Object value = entry.getValue(); |
| | |
| | | try { |
| | | int count = apkBuildTaskService.refreshAllPendingTasks(); |
| | | // 返回所有任务列表 |
| | | EntityWrapper<ApkBuildTask> wrapper = new EntityWrapper<>(); |
| | | wrapper.orderBy("id", false); |
| | | List<ApkBuildTask> tasks = apkBuildTaskService.selectList(wrapper); |
| | | QueryWrapper<ApkBuildTask> wrapper = new QueryWrapper<>(); |
| | | wrapper.orderBy(true, false, "id"); |
| | | List<ApkBuildTask> tasks = apkBuildTaskService.list(wrapper); |
| | | Map<String, Object> result = new HashMap<>(); |
| | | result.put("tasks", tasks); |
| | | result.put("refreshedCount", count); |
| | |
| | | if (ids == null || ids.length == 0) { |
| | | return R.error(); |
| | | } |
| | | apkBuildTaskService.deleteBatchIds(Arrays.asList(ids)); |
| | | apkBuildTaskService.removeByIds(Arrays.asList(ids)); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | |
| | | 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.Wrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.asrs.entity.BasStation; |
| | | import com.zy.asrs.service.BasStationService; |
| | |
| | | @RequestMapping(value = "/basStation/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") String id) { |
| | | return R.ok(basStationService.selectById(String.valueOf(id))); |
| | | return R.ok(basStationService.getById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basStation/list/auth") |
| | |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam(required = false)String condition, |
| | | @RequestParam Map<String, Object> param){ |
| | | EntityWrapper<BasStation> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<BasStation> wrapper = new QueryWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | allLike(BasStation.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | return R.ok(basStationService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(true, "asc".equals(orderByType), humpToLine(orderByField));} |
| | | return R.ok(basStationService.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)){ |
| | |
| | | @RequestMapping(value = "/basStation/add/auth") |
| | | @ManagerAuth |
| | | public R add(BasStation basStation) { |
| | | basStationService.insert(basStation); |
| | | basStationService.save(basStation); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Integer[] ids){ |
| | | for (Integer id : ids){ |
| | | basStationService.deleteById(id); |
| | | basStationService.removeById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | @RequestMapping(value = "/basStation/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | EntityWrapper<BasStation> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<BasStation> wrapper = new QueryWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("basStation")); |
| | | convert(map, wrapper); |
| | | List<BasStation> list = basStationService.selectList(wrapper); |
| | | List<BasStation> list = basStationService.list(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/basStationQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<BasStation> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<BasStation> wrapper = new QueryWrapper<>(); |
| | | wrapper.like("station_id", condition); |
| | | Page<BasStation> page = basStationService.selectPage(new Page<>(0, 10), wrapper); |
| | | Page<BasStation> page = basStationService.page(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (BasStation basStation : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | @RequestMapping(value = "/basStation/check/column/auth") |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<BasStation> wrapper = new EntityWrapper<BasStation>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != basStationService.selectOne(wrapper)){ |
| | | Wrapper<BasStation> wrapper = new QueryWrapper<BasStation>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != basStationService.getOne(wrapper)){ |
| | | return R.parse(BaseRes.REPEAT).add(getComment(BasStation.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.R; |
| | | import com.core.controller.AbstractBaseController; |
| | |
| | | public R getData() { |
| | | // 1. 获取所有站点 |
| | | List<BasStation> stations = basStationService |
| | | .selectList(new EntityWrapper<BasStation>().orderBy("station_id", true)); |
| | | .list(new QueryWrapper<BasStation>().orderBy(true, true, "station_id")); |
| | | |
| | | // 2. 获取所有电视机 (按名称排序) |
| | | List<TvDevice> tvs = tvDeviceService.selectList(new EntityWrapper<TvDevice>().orderBy("name", true)); |
| | | List<TvDevice> tvs = tvDeviceService.list(new QueryWrapper<TvDevice>().orderBy(true, true, "name")); |
| | | |
| | | // 3. 获取所有绑定关系 |
| | | List<BasStationTv> relations = basStationTvService.selectList(new EntityWrapper<>()); |
| | | List<BasStationTv> relations = basStationTvService.list(new QueryWrapper<>()); |
| | | |
| | | Map<String, Object> data = new HashMap<>(); |
| | | data.put("stations", stations); |
| | |
| | | |
| | | // 全量替换策略:先删除所有旧关系,再插入新关系 |
| | | // 注意:这里没有事务控制,如果要求严格一致性,建议在Service层加@Transactional |
| | | basStationTvService.delete(new EntityWrapper<>()); |
| | | basStationTvService.remove(new QueryWrapper<>()); |
| | | |
| | | if (relations != null && !relations.isEmpty()) { |
| | | basStationTvService.insertBatch(relations); |
| | | basStationTvService.saveBatch(relations); |
| | | } |
| | | |
| | | return R.ok(); |
| | |
| | | |
| | | 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.Wrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.core.common.DateUtils; |
| | | import com.zy.asrs.entity.HttpRequestLog; |
| | | import com.zy.asrs.service.HttpRequestLogService; |
| | |
| | | @RequestMapping(value = "/httpRequestLog/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") String id) { |
| | | return R.ok(httpRequestLogService.selectById(String.valueOf(id))); |
| | | return R.ok(httpRequestLogService.getById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/httpRequestLog/list/auth") |
| | |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam(required = false)String condition, |
| | | @RequestParam Map<String, Object> param){ |
| | | EntityWrapper<HttpRequestLog> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<HttpRequestLog> wrapper = new QueryWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | allLike(HttpRequestLog.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | wrapper.orderBy("create_time desc"); |
| | | return R.ok(httpRequestLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(true, "asc".equals(orderByType), humpToLine(orderByField));} |
| | | wrapper.orderByDesc("create_time"); |
| | | return R.ok(httpRequestLogService.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)){ |
| | |
| | | @RequestMapping(value = "/httpRequestLog/add/auth") |
| | | @ManagerAuth |
| | | public R add(HttpRequestLog httpRequestLog) { |
| | | httpRequestLogService.insert(httpRequestLog); |
| | | httpRequestLogService.save(httpRequestLog); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Integer[] ids){ |
| | | for (Integer id : ids){ |
| | | httpRequestLogService.deleteById(id); |
| | | httpRequestLogService.removeById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | @RequestMapping(value = "/httpRequestLog/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | EntityWrapper<HttpRequestLog> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<HttpRequestLog> wrapper = new QueryWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("httpRequestLog")); |
| | | convert(map, wrapper); |
| | | List<HttpRequestLog> list = httpRequestLogService.selectList(wrapper); |
| | | List<HttpRequestLog> list = httpRequestLogService.list(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/httpRequestLogQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<HttpRequestLog> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<HttpRequestLog> wrapper = new QueryWrapper<>(); |
| | | wrapper.like("id", condition); |
| | | Page<HttpRequestLog> page = httpRequestLogService.selectPage(new Page<>(0, 10), wrapper); |
| | | Page<HttpRequestLog> page = httpRequestLogService.page(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (HttpRequestLog httpRequestLog : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | @RequestMapping(value = "/httpRequestLog/check/column/auth") |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<HttpRequestLog> wrapper = new EntityWrapper<HttpRequestLog>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != httpRequestLogService.selectOne(wrapper)){ |
| | | Wrapper<HttpRequestLog> wrapper = new QueryWrapper<HttpRequestLog>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != httpRequestLogService.getOne(wrapper)){ |
| | | return R.parse(BaseRes.REPEAT).add(getComment(HttpRequestLog.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | |
| | | public R getLedInfos(HttpServletRequest request) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | String remoteAddr = request.getRemoteAddr(); |
| | | TvDevice tvDevice = tvDeviceService.selectOne( |
| | | new EntityWrapper<TvDevice>().eq("ip", remoteAddr)); |
| | | TvDevice tvDevice = tvDeviceService.getOne( |
| | | new QueryWrapper<TvDevice>().eq("ip", remoteAddr)); |
| | | if (tvDevice == null) { |
| | | return R.error("未找到IP对应的电视机设备: " + remoteAddr); |
| | | } |
| | | map.put("deviceName", tvDevice.getName()); |
| | | |
| | | List<BasStationTv> relations = basStationTvService |
| | | .selectList(new EntityWrapper<BasStationTv>().eq("tv_id", tvDevice.getId())); |
| | | .list(new QueryWrapper<BasStationTv>().eq("tv_id", tvDevice.getId())); |
| | | if (relations == null || relations.isEmpty()) { |
| | | map.put("data", new ArrayList<>()); |
| | | return R.ok().add(map); |
| | |
| | | } |
| | | |
| | | String remoteAddr = request.getRemoteAddr(); |
| | | TvDevice tvDevice = tvDeviceService.selectOne( |
| | | new EntityWrapper<TvDevice>().eq("ip", remoteAddr)); |
| | | TvDevice tvDevice = tvDeviceService.getOne( |
| | | new QueryWrapper<TvDevice>().eq("ip", remoteAddr)); |
| | | if (tvDevice != null) { |
| | | List<BasStationTv> relations = basStationTvService |
| | | .selectList(new EntityWrapper<BasStationTv>().eq("tv_id", tvDevice.getId())); |
| | | .list(new QueryWrapper<BasStationTv>().eq("tv_id", tvDevice.getId())); |
| | | if (relations != null && !relations.isEmpty()) { |
| | | for (BasStationTv relation : relations) { |
| | | WcsStationDto wcsStationDto = stationUtils.stationMap.get(relation.getStationId()); |
| | |
| | | |
| | | @GetMapping("/announcement") |
| | | public R top5(){ |
| | | EntityWrapper<Announcement> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Announcement> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("status", 1); |
| | | wrapper.orderBy("create_time", false); |
| | | wrapper.orderBy(true, false, "create_time"); |
| | | wrapper.last("limit 5"); |
| | | return R.ok(announcementService.selectList(wrapper)); |
| | | return R.ok(announcementService.list(wrapper)); |
| | | } |
| | | |
| | | /** |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | 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.Cools; |
| | | import com.core.common.R; |
| | |
| | | @RequestMapping(value = "/tvDevice/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok(tvDeviceService.selectById(id)); |
| | | return R.ok(tvDeviceService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam Map<String, Object> param) { |
| | | excludeTrash(param); |
| | | EntityWrapper<TvDevice> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<TvDevice> wrapper = new QueryWrapper<>(); |
| | | |
| | | for (Map.Entry<String, Object> entry : param.entrySet()) { |
| | | String key = entry.getKey(); |
| | |
| | | } |
| | | } |
| | | |
| | | wrapper.orderBy("id", false); |
| | | return R.ok(tvDeviceService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | wrapper.orderBy(true, false, "id"); |
| | | return R.ok(tvDeviceService.page(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @RequestMapping(value = "/tvDevice/all/auth") |
| | | @ManagerAuth |
| | | public R listAll() { |
| | | EntityWrapper<TvDevice> wrapper = new EntityWrapper<>(); |
| | | wrapper.orderBy("name", true); |
| | | return R.ok(tvDeviceService.selectList(wrapper)); |
| | | QueryWrapper<TvDevice> wrapper = new QueryWrapper<>(); |
| | | wrapper.orderBy(true, true, "name"); |
| | | return R.ok(tvDeviceService.list(wrapper)); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | // 检查IP是否已存在 |
| | | EntityWrapper<TvDevice> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<TvDevice> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("ip", device.getIp()); |
| | | if (tvDeviceService.selectCount(wrapper) > 0) { |
| | | if (tvDeviceService.count(wrapper) > 0) { |
| | | return R.error("该IP已存在"); |
| | | } |
| | | |
| | |
| | | device.setStatus((short) 0); |
| | | device.setCreateTime(new Date()); |
| | | device.setUpdateTime(new Date()); |
| | | tvDeviceService.insert(device); |
| | | tvDeviceService.save(device); |
| | | return R.ok(device); |
| | | } |
| | | |
| | |
| | | |
| | | // 检查IP是否已被其他设备使用 |
| | | if (!Cools.isEmpty(device.getIp())) { |
| | | EntityWrapper<TvDevice> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<TvDevice> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("ip", device.getIp()).ne("id", device.getId()); |
| | | if (tvDeviceService.selectCount(wrapper) > 0) { |
| | | if (tvDeviceService.count(wrapper) > 0) { |
| | | return R.error("该IP已被其他设备使用"); |
| | | } |
| | | } |
| | |
| | | if (ids == null || ids.length == 0) { |
| | | return R.error(); |
| | | } |
| | | tvDeviceService.deleteBatchIds(Arrays.asList(ids)); |
| | | tvDeviceService.removeByIds(Arrays.asList(ids)); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | String result = tvDeviceService.testConnection(id); |
| | | Map<String, Object> data = new HashMap<>(); |
| | | data.put("result", result); |
| | | data.put("device", tvDeviceService.selectById(id)); |
| | | data.put("device", tvDeviceService.getById(id)); |
| | | return R.ok(data); |
| | | } catch (Exception e) { |
| | | return R.error("连接失败: " + e.getMessage()); |
| | |
| | | return R.error("请选择安装设备"); |
| | | } |
| | | |
| | | ApkBuildTask task = apkBuildTaskService.selectById(taskId); |
| | | ApkBuildTask task = apkBuildTaskService.getById(taskId); |
| | | if (task == null) { |
| | | return R.error("打包任务不存在"); |
| | | } |
| | |
| | | String result = tvDeviceService.launchApp(id, packageName); |
| | | Map<String, Object> data = new HashMap<>(); |
| | | data.put("result", result); |
| | | data.put("device", tvDeviceService.selectById(id)); |
| | | data.put("device", tvDeviceService.getById(id)); |
| | | return R.ok(data); |
| | | } catch (Exception e) { |
| | | return R.error("启动失败: " + e.getMessage()); |
| | |
| | | String base64Image = tvDeviceService.captureScreen(id); |
| | | Map<String, Object> data = new HashMap<>(); |
| | | data.put("image", base64Image); |
| | | data.put("device", tvDeviceService.selectById(id)); |
| | | data.put("device", tvDeviceService.getById(id)); |
| | | return R.ok(data); |
| | | } catch (Exception e) { |
| | | return R.error("截图失败: " + e.getMessage()); |
| | |
| | | String result = tvDeviceService.restartApp(id, packageName); |
| | | Map<String, Object> data = new HashMap<>(); |
| | | data.put("result", result); |
| | | data.put("device", tvDeviceService.selectById(id)); |
| | | data.put("device", tvDeviceService.getById(id)); |
| | | return R.ok(data); |
| | | } catch (Exception e) { |
| | | return R.error("重启失败: " + e.getMessage()); |
| | |
| | | package com.zy.asrs.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.core.common.Cools; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | |
| | | /** |
| | | * ID |
| | | */ |
| | | @ApiModelProperty(value= "ID") |
| | | @Schema(description = "ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 日志编号 |
| | | */ |
| | | @ApiModelProperty(value= "日志编号") |
| | | @Schema(description = "日志编号") |
| | | private String uuid; |
| | | |
| | | /** |
| | | * 名称空间 |
| | | */ |
| | | @ApiModelProperty(value= "名称空间") |
| | | @Schema(description = "名称空间") |
| | | private String namespace; |
| | | |
| | | /** |
| | | * 接口地址 |
| | | */ |
| | | @ApiModelProperty(value= "接口地址") |
| | | @Schema(description = "接口地址") |
| | | private String url; |
| | | |
| | | /** |
| | | * 平台密钥 |
| | | */ |
| | | @ApiModelProperty(value= "平台密钥") |
| | | @Schema(description = "平台密钥") |
| | | private String appkey; |
| | | |
| | | /** |
| | | * 时间戳 |
| | | */ |
| | | @ApiModelProperty(value= "时间戳") |
| | | @Schema(description = "时间戳") |
| | | private String timestamp; |
| | | |
| | | /** |
| | | * 客户端IP |
| | | */ |
| | | @ApiModelProperty(value= "客户端IP") |
| | | @Schema(description = "客户端IP") |
| | | @TableField("client_ip") |
| | | private String clientIp; |
| | | |
| | | /** |
| | | * 请求内容 |
| | | */ |
| | | @ApiModelProperty(value= "请求内容") |
| | | @Schema(description = "请求内容") |
| | | private String request; |
| | | |
| | | /** |
| | | * 响应内容 |
| | | */ |
| | | @ApiModelProperty(value= "响应内容") |
| | | @Schema(description = "响应内容") |
| | | private String response; |
| | | |
| | | /** |
| | | * 异常内容 |
| | | */ |
| | | @ApiModelProperty(value= "异常内容") |
| | | @Schema(description = "异常内容") |
| | | private String err; |
| | | |
| | | /** |
| | | * 结果 1: 成功 0: 失败 |
| | | */ |
| | | @ApiModelProperty(value= "结果 1: 成功 0: 失败 ") |
| | | @Schema(description = "结果 1: 成功 0: 失败 ") |
| | | private Integer result; |
| | | |
| | | /** |
| | | * 状态 1: 正常 0: 禁用 |
| | | */ |
| | | @ApiModelProperty(value= "状态 1: 正常 0: 禁用 ") |
| | | @Schema(description = "状态 1: 正常 0: 禁用 ") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @ApiModelProperty(value= "添加时间") |
| | | @Schema(description = "添加时间") |
| | | @TableField("create_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @ApiModelProperty(value= "修改时间") |
| | | @Schema(description = "修改时间") |
| | | @TableField("update_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value= "备注") |
| | | @Schema(description = "备注") |
| | | private String memo; |
| | | |
| | | public ApiLog() {} |
| | |
| | | package com.zy.asrs.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | |
| | | package com.zy.asrs.entity; |
| | | |
| | | import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.core.common.Cools;import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @ApiModelProperty(value= "编号") |
| | | @Schema(description = "编号") |
| | | @TableId(value = "station_id", type = IdType.INPUT) |
| | | @TableField("station_id") |
| | | private Integer stationId; |
| | |
| | | /** |
| | | * 状态 1: 正常 0: 禁用 |
| | | */ |
| | | @ApiModelProperty(value= "状态 1: 正常 0: 禁用 ") |
| | | @Schema(description = "状态 1: 正常 0: 禁用 ") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 工作号 |
| | | */ |
| | | @ApiModelProperty(value= "工作号") |
| | | @Schema(description = "工作号") |
| | | @TableField("wrk_no") |
| | | private Integer wrkNo; |
| | | |
| | | /** |
| | | * 可入(checkBox) |
| | | */ |
| | | @ApiModelProperty(value= "可入(checkBox)") |
| | | @Schema(description = "可入(checkBox)") |
| | | @TableField("in_enable") |
| | | private String inEnable; |
| | | |
| | | /** |
| | | * 可出(checkBox) |
| | | */ |
| | | @ApiModelProperty(value= "可出(checkBox)") |
| | | @Schema(description = "可出(checkBox)") |
| | | @TableField("out_enable") |
| | | private String outEnable; |
| | | |
| | | /** |
| | | * 创建人员 |
| | | */ |
| | | @ApiModelProperty(value= "创建人员") |
| | | @Schema(description = "创建人员") |
| | | @TableField("create_by") |
| | | private Long createBy; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @ApiModelProperty(value= "创建时间") |
| | | @Schema(description = "创建时间") |
| | | @TableField("create_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @ApiModelProperty(value= "修改人员") |
| | | @Schema(description = "修改人员") |
| | | @TableField("update_by") |
| | | private Long updateBy; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @ApiModelProperty(value= "修改时间") |
| | | @Schema(description = "修改时间") |
| | | @TableField("update_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value= "备注") |
| | | @Schema(description = "备注") |
| | | private String memo; |
| | | |
| | | public BasStation() {} |
| | |
| | | package com.zy.asrs.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | import java.io.Serializable; |
| | | |
| | |
| | | package com.zy.asrs.entity; |
| | | |
| | | import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.core.common.Cools;import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @Schema(description = "") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @Schema(description = "") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @Schema(description = "") |
| | | private String request; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @Schema(description = "") |
| | | private String response; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @Schema(description = "") |
| | | @TableField("create_time") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty(value= "") |
| | | @Schema(description = "") |
| | | private Integer result; |
| | | |
| | | public HttpRequestLog() {} |
| | |
| | | package com.zy.asrs.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zy.asrs.entity.ApiLog; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zy.asrs.entity.ApkBuildTask; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.zy.asrs.entity.BasStation; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zy.asrs.entity.BasStationTv; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.zy.asrs.entity.HttpRequestLog; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zy.asrs.entity.TvDevice; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.entity.ApiLog; |
| | | |
| | | public interface ApiLogService extends IService<ApiLog> { |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.entity.ApkBuildTask; |
| | | |
| | | import java.util.List; |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.zy.asrs.entity.BasStation; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | public interface BasStationService extends IService<BasStation> { |
| | | |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.entity.BasStationTv; |
| | | |
| | | /** |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.zy.asrs.entity.HttpRequestLog; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | public interface HttpRequestLogService extends IService<HttpRequestLog> { |
| | | |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.entity.TvDevice; |
| | | |
| | | import java.util.List; |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.core.common.SnowflakeIdWorker; |
| | | import com.zy.asrs.entity.ApiLog; |
| | | import com.zy.asrs.mapper.ApiLogMapper; |
| | |
| | | null, // 修改时间 |
| | | null // 备注 |
| | | ); |
| | | if (!this.insert(apiLog)) { |
| | | if (!this.save(apiLog)) { |
| | | log.error("接口调用日志保存失败!"); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.asrs.entity.ApkBuildTask; |
| | | import com.zy.asrs.mapper.ApkBuildTaskMapper; |
| | | import com.zy.asrs.service.ApkBuildTaskService; |
| | |
| | | task.setQueueSize(queueSize); |
| | | task.setCreatedAt(new Date()); |
| | | |
| | | this.insert(task); |
| | | this.save(task); |
| | | return task; |
| | | } |
| | | |
| | | @Override |
| | | public ApkBuildTask refreshStatus(Long id) throws Exception { |
| | | ApkBuildTask task = this.selectById(id); |
| | | ApkBuildTask task = this.getById(id); |
| | | if (task == null) { |
| | | throw new RuntimeException("任务不存在"); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public String downloadApk(Long id) throws Exception { |
| | | ApkBuildTask task = this.selectById(id); |
| | | ApkBuildTask task = this.getById(id); |
| | | if (task == null) { |
| | | throw new RuntimeException("任务不存在"); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public String installApk(Long id, String deviceIp) throws Exception { |
| | | ApkBuildTask task = this.selectById(id); |
| | | ApkBuildTask task = this.getById(id); |
| | | if (task == null) { |
| | | throw new RuntimeException("任务不存在"); |
| | | } |
| | |
| | | import com.zy.asrs.mapper.BasStationMapper; |
| | | import com.zy.asrs.entity.BasStation; |
| | | import com.zy.asrs.service.BasStationService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("basStationService") |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.asrs.entity.BasStationTv; |
| | | import com.zy.asrs.mapper.BasStationTvMapper; |
| | | import com.zy.asrs.service.BasStationTvService; |
| | |
| | | import com.zy.asrs.mapper.HttpRequestLogMapper; |
| | | import com.zy.asrs.entity.HttpRequestLog; |
| | | import com.zy.asrs.service.HttpRequestLogService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service("httpRequestLogService") |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.asrs.entity.TvDevice; |
| | | import com.zy.asrs.mapper.TvDeviceMapper; |
| | | import com.zy.asrs.service.TvDeviceService; |
| | |
| | | |
| | | @Override |
| | | public String testConnection(Long id) throws Exception { |
| | | TvDevice device = this.selectById(id); |
| | | TvDevice device = this.getById(id); |
| | | if (device == null) { |
| | | throw new RuntimeException("设备不存在"); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public int refreshAllStatus() { |
| | | List<TvDevice> devices = this.selectList(null); |
| | | List<TvDevice> devices = this.list(new QueryWrapper<>()); |
| | | int count = 0; |
| | | for (TvDevice device : devices) { |
| | | try { |
| | |
| | | |
| | | @Override |
| | | public String installApk(Long deviceId, String apkPath) throws Exception { |
| | | TvDevice device = this.selectById(deviceId); |
| | | TvDevice device = this.getById(deviceId); |
| | | if (device == null) { |
| | | throw new RuntimeException("设备不存在"); |
| | | } |
| | |
| | | public List<String> batchInstallApk(List<Long> deviceIds, String apkPath) { |
| | | List<String> results = new ArrayList<>(); |
| | | for (Long deviceId : deviceIds) { |
| | | TvDevice device = this.selectById(deviceId); |
| | | TvDevice device = this.getById(deviceId); |
| | | String deviceName = device != null ? device.getName() : "ID:" + deviceId; |
| | | try { |
| | | String result = installApk(deviceId, apkPath); |
| | |
| | | |
| | | @Override |
| | | public List<TvDevice> getOnlineDevices() { |
| | | return this.selectList(new EntityWrapper<TvDevice>().eq("status", 1)); |
| | | return this.list(new QueryWrapper<TvDevice>().eq("status", 1)); |
| | | } |
| | | |
| | | @Override |
| | | public String launchApp(Long deviceId, String packageName) throws Exception { |
| | | TvDevice device = this.selectById(deviceId); |
| | | TvDevice device = this.getById(deviceId); |
| | | if (device == null) { |
| | | throw new RuntimeException("设备不存在"); |
| | | } |
| | |
| | | public List<String> batchLaunchApp(List<Long> deviceIds, String packageName) { |
| | | List<String> results = new ArrayList<>(); |
| | | for (Long deviceId : deviceIds) { |
| | | TvDevice device = this.selectById(deviceId); |
| | | TvDevice device = this.getById(deviceId); |
| | | String deviceName = device != null ? device.getName() : "ID:" + deviceId; |
| | | try { |
| | | String result = launchApp(deviceId, packageName); |
| | |
| | | |
| | | @Override |
| | | public String captureScreen(Long deviceId) throws Exception { |
| | | TvDevice device = this.selectById(deviceId); |
| | | TvDevice device = this.getById(deviceId); |
| | | if (device == null) { |
| | | throw new RuntimeException("设备不存在"); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public String stopApp(Long deviceId, String packageName) throws Exception { |
| | | TvDevice device = this.selectById(deviceId); |
| | | TvDevice device = this.getById(deviceId); |
| | | if (device == null) { |
| | | throw new RuntimeException("设备不存在"); |
| | | } |
| | |
| | | public List<String> batchRestartApp(List<Long> deviceIds, String packageName) { |
| | | List<String> results = new ArrayList<>(); |
| | | for (Long deviceId : deviceIds) { |
| | | TvDevice device = this.selectById(deviceId); |
| | | TvDevice device = this.getById(deviceId); |
| | | String deviceName = device != null ? device.getName() : "ID:" + deviceId; |
| | | try { |
| | | String result = restartApp(deviceId, packageName); |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.zy.asrs.entity.BasStation; |
| | | import com.zy.asrs.entity.dto.WcsStationDto; |
| | | import com.zy.asrs.service.BasStationService; |
| | |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | public synchronized void execute() { |
| | | Config wcsStationUrlConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "wcsStationUrl")); |
| | | Config wcsStationUrlConfig = configService.getOne(new QueryWrapper<Config>().eq("code", "wcsStationUrl")); |
| | | if (wcsStationUrlConfig == null) { |
| | | return; |
| | | } |
| | |
| | | HashMap<String, Object> requestParam = new HashMap<>(); |
| | | |
| | | List<Integer> list = new ArrayList<>(); |
| | | List<BasStation> basStations = basStationService.selectList(new EntityWrapper<>()); |
| | | List<BasStation> basStations = basStationService.list(new QueryWrapper<>()); |
| | | for (BasStation basStation : basStations) { |
| | | list.add(basStation.getStationId()); |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.BasStation; |
| | | import com.zy.asrs.entity.dto.*; |
| | |
| | | //WMS任务查询接口 |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | public synchronized void taskQuery() { |
| | | Config wmsTaskQueryUrlConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "wmsTaskQueryUrl")); |
| | | Config wmsTaskQueryUrlConfig = configService.getOne(new QueryWrapper<Config>().eq("code", "wmsTaskQueryUrl")); |
| | | if (wmsTaskQueryUrlConfig == null) { |
| | | return; |
| | | } |
| | |
| | | try { |
| | | HashMap<String, Object> requestParam = new HashMap<>(); |
| | | |
| | | List<BasStation> basStations = basStationService.selectList(new EntityWrapper<BasStation>().eq("out_enable", "Y")); |
| | | List<BasStation> basStations = basStationService.list(new QueryWrapper<BasStation>().eq("out_enable", "Y")); |
| | | for (BasStation basStation : basStations) { |
| | | WcsStationDto wcsStationDto = stationUtils.stationMap.get(basStation.getStationId()); |
| | | if (wcsStationDto == null) { |
| | |
| | | //WMS入库任务查询接口 |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | public synchronized void inTaskQuery() { |
| | | Config wmsCombQueryUrlConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "wmsCombQueryUrl")); |
| | | Config wmsCombQueryUrlConfig = configService.getOne(new QueryWrapper<Config>().eq("code", "wmsCombQueryUrl")); |
| | | if (wmsCombQueryUrlConfig == null) { |
| | | return; |
| | | } |
| | |
| | | try { |
| | | HashMap<String, Object> requestParam = new HashMap<>(); |
| | | |
| | | List<BasStation> basStations = basStationService.selectList(new EntityWrapper<BasStation>().eq("in_enable", "Y")); |
| | | List<BasStation> basStations = basStationService.list(new QueryWrapper<BasStation>().eq("in_enable", "Y")); |
| | | for (BasStation basStation : basStations) { |
| | | WcsStationDto wcsStationDto = stationUtils.stationMap.get(basStation.getStationId()); |
| | | if (wcsStationDto == null) { |
| | |
| | | @Synchronized |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | public void locQuery() { |
| | | Config wmsUrlConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "wmsLocQueryUrl")); |
| | | Config wmsUrlConfig = configService.getOne(new QueryWrapper<Config>().eq("code", "wmsLocQueryUrl")); |
| | | if (wmsUrlConfig == null) { |
| | | return; |
| | | } |
| | |
| | | @Synchronized |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | public void inOutLineCharts() { |
| | | Config wmsUrlConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "wmsInOutLineChartsQueryUrl")); |
| | | Config wmsUrlConfig = configService.getOne(new QueryWrapper<Config>().eq("code", "wmsInOutLineChartsQueryUrl")); |
| | | if (wmsUrlConfig == null) { |
| | | return; |
| | | } |
| | |
| | | @Synchronized |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | public void locDetlStatistics() { |
| | | Config wmsUrlConfig = configService.selectOne(new EntityWrapper<Config>().eq("code", "wmsLocDetlStatisticsQueryUrl")); |
| | | Config wmsUrlConfig = configService.getOne(new QueryWrapper<Config>().eq("code", "wmsLocDetlStatisticsQueryUrl")); |
| | | if (wmsUrlConfig == null) { |
| | | return; |
| | | } |
| | |
| | | package com.zy.common.config; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.method.HandlerMethod; |
| | | import org.springframework.web.servlet.ModelAndView; |
| | | import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; |
| | | import org.springframework.web.servlet.HandlerInterceptor; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.lang.reflect.Method; |
| | | |
| | | /** |
| | | * Created by vincent on 2019-06-13 |
| | | */ |
| | | @Component |
| | | public class AdminInterceptor extends HandlerInterceptorAdapter { |
| | | public class AdminInterceptor implements HandlerInterceptor { |
| | | |
| | | @Value("${super.pwd}") |
| | | private String superPwd; |
| | |
| | | // if (obj instanceof OperateLog) { |
| | | // OperateLog operate = (OperateLog) obj; |
| | | // operate.setResponse(String.valueOf(response.getStatus())); |
| | | // operateLogService.insert(operate); |
| | | // operateLogService.save(operate); |
| | | // } |
| | | } |
| | | |
| | | private boolean check(HttpServletRequest request, HttpServletResponse response, String memo) { |
| | | try { |
| | | String token = request.getHeader("token"); |
| | | UserLogin userLogin = userLoginService.selectOne(new EntityWrapper<UserLogin>().eq("token", token).eq("system", "WCS")); |
| | | UserLogin userLogin = userLoginService.getOne(new QueryWrapper<UserLogin>().eq("token", token).eq("system", "WCS")); |
| | | if (null == userLogin){ |
| | | Http.response(response, BaseRes.DENIED); |
| | | return false; |
| | | } |
| | | User user = userService.selectById(userLogin.getUserId()); |
| | | User user = userService.getById(userLogin.getUserId()); |
| | | String deToken = Cools.deTokn(token, user.getPassword()); |
| | | long timestamp = Long.parseLong(deToken.substring(0, 13)); |
| | | // 1天后过期 |
| | |
| | | operateLog.setUserId(user.getId()); |
| | | operateLog.setRequest(JSON.toJSONString(request.getParameterMap())); |
| | | operateLog.setResponse(JSON.toJSONString(request.getRequestURI())); |
| | | operateLogService.insert(operateLog); |
| | | operateLogService.save(operateLog); |
| | | // 请求缓存 |
| | | request.setAttribute("userId", user.getId()); |
| | | // request.setAttribute("operateLog", operateLog); |
| | |
| | | Permission permission = new Permission(); |
| | | permission.setAction(action); |
| | | permission.setStatus((short) 1); |
| | | Permission one = permissionService.selectOne(new EntityWrapper<>(permission)); |
| | | Permission one = permissionService.getOne(new QueryWrapper<>(permission)); |
| | | if (!Cools.isEmpty(one)) { |
| | | RolePermission rolePermission = rolePermissionService.selectOne(new EntityWrapper<>(new RolePermission(user.getRoleId(), permission.getId()))); |
| | | RolePermission rolePermission = rolePermissionService.getOne(new QueryWrapper<>(new RolePermission(user.getRoleId(), permission.getId()))); |
| | | return !Cools.isEmpty(rolePermission); |
| | | } |
| | | return true; |
| | |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.lang.reflect.Method; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | |
| | | } |
| | | |
| | | private void saveLog(ProceedingJoinPoint joinPoint, HttpServletRequest request, Object result, String memo) { |
| | | apiLogService.insert(new ApiLog( |
| | | apiLogService.save(new ApiLog( |
| | | null, |
| | | memo, |
| | | request != null ? Optional.ofNullable(String.valueOf(request.getRequestURI())).orElse(null) : null, |
| | |
| | | |
| | | private void saveErrLog(ProceedingJoinPoint joinPoint, HttpServletRequest request, Object response, Throwable ex, |
| | | String memo) { |
| | | apiLogService.insert(new ApiLog( |
| | | apiLogService.save(new ApiLog( |
| | | null, |
| | | memo, |
| | | request != null ? Optional.ofNullable(String.valueOf(request.getRequestURI())).orElse(null) : null, |
| New file |
| | |
| | | package com.zy.common.config; |
| | | |
| | | import com.core.common.SnowflakeIdWorker; |
| | | import com.core.common.SpringUtils; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | @Configuration |
| | | public class CoreCompatConfig { |
| | | |
| | | @Bean |
| | | public SnowflakeIdWorker snowflakeIdWorker() { |
| | | return new SnowflakeIdWorker(); |
| | | } |
| | | |
| | | @Bean |
| | | public SpringUtils springUtils() { |
| | | return new SpringUtils(); |
| | | } |
| | | } |
| New file |
| | |
| | | package com.zy.common.config; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.DbType; |
| | | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | @Configuration |
| | | @MapperScan({"com.zy.asrs.mapper", "com.zy.system.mapper"}) |
| | | public class MybatisPlusConfig { |
| | | |
| | | @Bean |
| | | public MybatisPlusInterceptor mybatisPlusInterceptor() { |
| | | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); |
| | | interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); |
| | | return interceptor; |
| | | } |
| | | } |
| | |
| | | package com.zy.common.entity; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.system.entity.Config; |
| | |
| | | */ |
| | | public static Parameter reset() { |
| | | ConfigService configService = SpringUtils.getBean(ConfigService.class); |
| | | List<Config> configs = configService.selectList(new EntityWrapper<Config>().eq("status", "1")); |
| | | List<Config> configs = configService.list(new QueryWrapper<Config>().eq("status", "1")); |
| | | Map<String, Object> data = new HashMap<>(); |
| | | for (Config config : configs) { |
| | | if (config.getType() == 1) { |
| | |
| | | package com.zy.common.model; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | |
| | | /** |
| | | * 分页参数 |
| | |
| | | */ |
| | | public class PageParam { |
| | | |
| | | @ApiModelProperty(value="分页索引",required=true) |
| | | @Schema(description = "分页索引", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | private int page = 1; |
| | | |
| | | @ApiModelProperty(value="单页数量",required=true) |
| | | @Schema(description = "单页数量", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | private int size = 10; |
| | | |
| | | public Integer getPage() { |
| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.core.common.R; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | |
| | | /** |
| | |
| | | package com.zy.common.utils; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.awt.*; |
| | | import java.awt.image.BufferedImage; |
| | | import java.util.Map; |
| | |
| | | package com.zy.common.web; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | res.put("token", Cools.enToken(System.currentTimeMillis() + mobile, superPwd)); |
| | | return R.ok(res); |
| | | } |
| | | EntityWrapper<User> userWrapper = new EntityWrapper<>(); |
| | | QueryWrapper<User> userWrapper = new QueryWrapper<>(); |
| | | userWrapper.eq("mobile", mobile); |
| | | User user = userService.selectOne(userWrapper); |
| | | User user = userService.getOne(userWrapper); |
| | | if (Cools.isEmpty(user)){ |
| | | return R.parse(CodeRes.USER_10001); |
| | | } |
| | |
| | | return R.parse(CodeRes.USER_10003); |
| | | } |
| | | String token = Cools.enToken(System.currentTimeMillis() + mobile, user.getPassword()); |
| | | userLoginService.delete(new EntityWrapper<UserLogin>().eq("user_id", user.getId()).eq("system", "WCS")); |
| | | userLoginService.remove(new QueryWrapper<UserLogin>().eq("user_id", user.getId()).eq("system", "WCS")); |
| | | UserLogin userLogin = new UserLogin(); |
| | | userLogin.setUserId(user.getId()); |
| | | userLogin.setToken(token); |
| | | userLogin.setSystem("WCS"); |
| | | userLoginService.insert(userLogin); |
| | | userLoginService.save(userLogin); |
| | | Map<String, Object> res = new HashMap<>(); |
| | | res.put("username", user.getUsername()); |
| | | res.put("token", token); |
| | |
| | | @RequestMapping("/user/detail/auth") |
| | | @ManagerAuth |
| | | public R userDetail(){ |
| | | return R.ok(userService.selectById(getUserId())); |
| | | return R.ok(userService.getById(getUserId())); |
| | | } |
| | | |
| | | @RequestMapping("/menu/auth") |
| | | @ManagerAuth(memo = "首页菜单") |
| | | public R menu(){ |
| | | // 获取所有一级菜单 |
| | | List<Resource> oneLevel = resourceService.selectList(new EntityWrapper<Resource>().eq("level", 1).eq("status", 1).orderBy("sort")); |
| | | List<Resource> oneLevel = resourceService.list(new QueryWrapper<Resource>().eq("level", 1).eq("status", 1).orderByAsc("sort")); |
| | | User user = null; |
| | | Wrapper<Resource> resourceWrapper; |
| | | if (getUserId() == 9527) { |
| | | resourceWrapper = new EntityWrapper<Resource>().eq("level", 2).eq("status", 1).orderBy("sort"); |
| | | resourceWrapper = new QueryWrapper<Resource>().eq("level", 2).eq("status", 1).orderByAsc("sort"); |
| | | } else { |
| | | // 获取当前用户的所有二级菜单 |
| | | user = userService.selectById(getUserId()); |
| | | List<RoleResource> roleResources = roleResourceService.selectList(new EntityWrapper<RoleResource>().eq("role_id", user.getRoleId())); |
| | | user = userService.getById(getUserId()); |
| | | List<RoleResource> roleResources = roleResourceService.list(new QueryWrapper<RoleResource>().eq("role_id", user.getRoleId())); |
| | | List<Long> resourceIds = new ArrayList<>(); |
| | | roleResources.forEach(roleResource -> resourceIds.add(roleResource.getResourceId())); |
| | | if (resourceIds.isEmpty()){ |
| | | return R.ok(); |
| | | } |
| | | resourceWrapper = new EntityWrapper<Resource>().in("id", resourceIds).eq("level", 2).eq("status", 1).orderBy("sort"); |
| | | resourceWrapper = new QueryWrapper<Resource>().in("id", resourceIds).eq("level", 2).eq("status", 1).orderByAsc("sort"); |
| | | } |
| | | List<Resource> twoLevel = resourceService.selectList(resourceWrapper); |
| | | List<Resource> twoLevel = resourceService.list(resourceWrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (Resource menu : oneLevel) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | |
| | | // 是否拥有查看权限 |
| | | if (getUserId() != 9527) { |
| | | Resource view = resourceService.selectOne(new EntityWrapper<Resource>().eq("resource_id", resource.getId()).like("code", "view")); |
| | | Resource view = resourceService.getOne(new QueryWrapper<Resource>().eq("resource_id", resource.getId()).like("code", "view")); |
| | | if (!Cools.isEmpty(view)){ |
| | | RoleResource param = new RoleResource(); |
| | | param.setResourceId(view.getId()); |
| | | param.setRoleId(user.getRoleId()); |
| | | if (null == roleResourceService.selectOne(new EntityWrapper<>(param))){ |
| | | if (null == roleResourceService.getOne(new QueryWrapper<>(param))){ |
| | | continue; |
| | | } |
| | | } |
| | |
| | | @RequestMapping("/power/list/auth") |
| | | @ManagerAuth |
| | | public R powerList(){ |
| | | List<Resource> oneLevels = resourceService.selectList(new EntityWrapper<Resource>().eq("level", 1).eq("status", 1).orderBy("sort")); |
| | | List<Resource> oneLevels = resourceService.list(new QueryWrapper<Resource>().eq("level", 1).eq("status", 1).orderByAsc("sort")); |
| | | List<Map> result = new ArrayList<>(); |
| | | // 一级 |
| | | for (Resource oneLevel : oneLevels){ |
| | |
| | | oneLevelMap.put("id", oneLevel.getId()); |
| | | oneLevelMap.put("spread", true); |
| | | oneLevelMap.put("children", twoLevelsList); |
| | | List<Resource> twoLevels = resourceService.selectList(new EntityWrapper<Resource>().eq("resource_id", oneLevel.getId()).eq("level", 2).eq("status", 1).orderBy("sort")); |
| | | List<Resource> twoLevels = resourceService.list(new QueryWrapper<Resource>().eq("resource_id", oneLevel.getId()).eq("level", 2).eq("status", 1).orderByAsc("sort")); |
| | | // 二级 |
| | | for (Resource twoLevel : twoLevels){ |
| | | Map<String, Object> twoLevelMap = new HashMap<>(); |
| | |
| | | List<Map> threeLevelsList = new ArrayList<>(); |
| | | twoLevelMap.put("children", threeLevelsList); |
| | | // 三级 |
| | | List<Resource> threeLevels = resourceService.selectList(new EntityWrapper<Resource>().eq("resource_id", twoLevel.getId()).eq("level", 3).eq("status", 1).orderBy("sort")); |
| | | List<Resource> threeLevels = resourceService.list(new QueryWrapper<Resource>().eq("resource_id", twoLevel.getId()).eq("level", 3).eq("status", 1).orderByAsc("sort")); |
| | | for (Resource threeLevel : threeLevels){ |
| | | Map<String, Object> threeLevelMap = new HashMap<>(); |
| | | threeLevelMap.put("title", threeLevel.getName()); |
| | |
| | | functions.put("spread", true); |
| | | List<Map> funcs = new ArrayList<>(); |
| | | functions.put("children", funcs); |
| | | List<Permission> permissions = permissionService.selectList(new EntityWrapper<Permission>().eq("status", 1)); |
| | | List<Permission> permissions = permissionService.list(new QueryWrapper<Permission>().eq("status", 1)); |
| | | for (Permission permission : permissions) { |
| | | Map<String, Object> func = new HashMap<>(); |
| | | func.put("title", permission.getName()); |
| | |
| | | public R get(@PathVariable("roleId") Long roleId) { |
| | | List<Object> result = new ArrayList<>(); |
| | | // 菜单 |
| | | List<RoleResource> roleResources = roleResourceService.selectList(new EntityWrapper<RoleResource>().eq("role_id", roleId)); |
| | | List<RoleResource> roleResources = roleResourceService.list(new QueryWrapper<RoleResource>().eq("role_id", roleId)); |
| | | for (RoleResource roleResource : roleResources){ |
| | | Resource resource = resourceService.selectById(roleResource.getResourceId()); |
| | | Resource resource = resourceService.getById(roleResource.getResourceId()); |
| | | if (!Cools.isEmpty(resource)){ |
| | | if (resource.getLevel() == 3){ |
| | | result.add(resource.getId()); |
| | |
| | | } |
| | | } |
| | | // 功能 |
| | | List<RolePermission> rolePermissions = rolePermissionService.selectList(new EntityWrapper<RolePermission>().eq("role_id", roleId)); |
| | | List<RolePermission> rolePermissions = rolePermissionService.list(new QueryWrapper<RolePermission>().eq("role_id", roleId)); |
| | | for (RolePermission rolePermission : rolePermissions){ |
| | | Permission permission = permissionService.selectById(rolePermission.getPermissionId()); |
| | | Permission permission = permissionService.getById(rolePermission.getPermissionId()); |
| | | if (!Cools.isEmpty(permission)){ |
| | | result.add(permission.getAction()); |
| | | } |
| | |
| | | @ManagerAuth(memo = "授权") |
| | | @Transactional |
| | | public R power(Long roleId, String powers){ |
| | | Role role = roleService.selectById(roleId); |
| | | Role role = roleService.getById(roleId); |
| | | Long leaderId = role.getLeader(); |
| | | roleResourceService.delete(new EntityWrapper<RoleResource>().eq("role_id", roleId)); |
| | | rolePermissionService.delete(new EntityWrapper<RolePermission>().eq("role_id", roleId)); |
| | | roleResourceService.remove(new QueryWrapper<RoleResource>().eq("role_id", roleId)); |
| | | rolePermissionService.remove(new QueryWrapper<RolePermission>().eq("role_id", roleId)); |
| | | if (!Cools.isEmpty(powers)){ |
| | | List<PowerDto> dtos = JSON.parseArray(powers, PowerDto.class); |
| | | for (PowerDto dto : dtos) { |
| | | Resource resource = resourceService.selectOne(new EntityWrapper<Resource>().eq("id", dto.getTwo()).eq("level", 2)); |
| | | Resource resource = resourceService.getOne(new QueryWrapper<Resource>().eq("id", dto.getTwo()).eq("level", 2)); |
| | | if (!Cools.isEmpty(resource)) { |
| | | // 校验上级权限 |
| | | if (leaderId != null) { |
| | | RoleResource roleResource = roleResourceService.selectOne(new EntityWrapper<RoleResource>().eq("role_id", leaderId).eq("resource_id", resource.getId())); |
| | | RoleResource roleResource = roleResourceService.getOne(new QueryWrapper<RoleResource>().eq("role_id", leaderId).eq("resource_id", resource.getId())); |
| | | if (null == roleResource) { |
| | | throw new CoolException(resource.getName().concat("无法授权给").concat(role.getName())); |
| | | } |
| | |
| | | RoleResource roleResource = new RoleResource(); |
| | | roleResource.setRoleId(roleId); |
| | | roleResource.setResourceId(resource.getId()); |
| | | roleResourceService.insert(roleResource); |
| | | roleResourceService.save(roleResource); |
| | | } else { |
| | | Permission permission = permissionService.selectOne(new EntityWrapper<Permission>().eq("action", dto.getTwo())); |
| | | Permission permission = permissionService.getOne(new QueryWrapper<Permission>().eq("action", dto.getTwo())); |
| | | if (!Cools.isEmpty(permission)){ |
| | | RolePermission rolePermission = new RolePermission(); |
| | | rolePermission.setRoleId(roleId); |
| | | rolePermission.setPermissionId(permission.getId()); |
| | | rolePermissionService.insert(rolePermission); |
| | | rolePermissionService.save(rolePermission); |
| | | } |
| | | } |
| | | for (String three : dto.getThree()){ |
| | | Resource resource1 = resourceService.selectOne(new EntityWrapper<Resource>().eq("id", three).eq("level", 3)); |
| | | Resource resource1 = resourceService.getOne(new QueryWrapper<Resource>().eq("id", three).eq("level", 3)); |
| | | if (!Cools.isEmpty(resource1)) { |
| | | // 校验上级权限 |
| | | if (leaderId != null) { |
| | | RoleResource roleResource = roleResourceService.selectOne(new EntityWrapper<RoleResource>().eq("role_id", leaderId).eq("resource_id", resource1.getId())); |
| | | RoleResource roleResource = roleResourceService.getOne(new QueryWrapper<RoleResource>().eq("role_id", leaderId).eq("resource_id", resource1.getId())); |
| | | if (null == roleResource) { |
| | | throw new CoolException(resource.getName().concat("的").concat(resource1.getName().concat("无法授权给").concat(role.getName()))); |
| | | } |
| | |
| | | RoleResource roleResource = new RoleResource(); |
| | | roleResource.setRoleId(roleId); |
| | | roleResource.setResourceId(resource1.getId()); |
| | | roleResourceService.insert(roleResource); |
| | | roleResourceService.save(roleResource); |
| | | } |
| | | } |
| | | } |
| | |
| | | public R buttonResource(@PathVariable("resourceId") Long resourceId) { |
| | | List<Resource> resources; |
| | | if (getUserId() == 9527) { |
| | | resources = resourceService.selectList(new EntityWrapper<Resource>().eq("level", 3).eq("resource_id", resourceId)); |
| | | resources = resourceService.list(new QueryWrapper<Resource>().eq("level", 3).eq("resource_id", resourceId)); |
| | | } else { |
| | | resources = roleResourceService.getMenuButtomResource(resourceId, getUserId()); |
| | | } |
| | |
| | | package com.zy.common.web; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.controller.AbstractBaseController; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.system.entity.User; |
| | | import com.zy.system.service.UserService; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import java.lang.reflect.Field; |
| | | import java.lang.reflect.Modifier; |
| | | import java.util.ArrayList; |
| | |
| | | } |
| | | |
| | | protected User getUser(){ |
| | | User user = userService.selectById(getUserId()); |
| | | User user = userService.getById(getUserId()); |
| | | if (null == user) { |
| | | throw new CoolException(BaseRes.DENIED); |
| | | } |
| | |
| | | Field[] fields = Cools.getAllFields(cls); |
| | | for (Field field : fields){ |
| | | if (fieldName.equals(field.getName())){ |
| | | return field.getAnnotation(ApiModelProperty.class).value(); |
| | | Schema schema = field.getAnnotation(Schema.class); |
| | | return schema == null ? "" : schema.description(); |
| | | } |
| | | } |
| | | return ""; |
| | |
| | | * @param set 排除字段集合 |
| | | * @param condition 搜索内容 |
| | | */ |
| | | protected <T> void allLike(Class<T> cls, Set<String> set, EntityWrapper<T> wrapper, String condition){ |
| | | protected <T> void allLike(Class<T> cls, Set<String> set, QueryWrapper<T> wrapper, String condition){ |
| | | if (Cools.isEmpty(condition)) { |
| | | return; |
| | | } |
| | |
| | | if (columns.isEmpty()) { |
| | | return; |
| | | } |
| | | for (int i=0;i<columns.size();i++){ |
| | | if (i==0){ |
| | | wrapper.andNew(); |
| | | } else { |
| | | wrapper.or(); |
| | | wrapper.and(inner -> { |
| | | for (int i = 0; i < columns.size(); i++) { |
| | | if (i > 0) { |
| | | inner.or(); |
| | | } |
| | | inner.like(columns.get(i), condition); |
| | | } |
| | | wrapper.like(columns.get(i), condition); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | |
| | |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * Created by vincent on 2019-07-30 |
| | |
| | | package com.zy.system.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | 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.Cools; |
| | | import com.core.common.DateUtils; |
| | |
| | | @RequestMapping(value = "/announcement/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok(announcementService.selectById(String.valueOf(id))); |
| | | return R.ok(announcementService.getById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/announcement/list/auth") |
| | |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | excludeTrash(param); |
| | | EntityWrapper<Announcement> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Announcement> wrapper = new QueryWrapper<>(); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){ |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | wrapper.orderBy(true, "asc".equals(orderByType), humpToLine(orderByField)); |
| | | } |
| | | return R.ok(announcementService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | return R.ok(announcementService.page(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper){ |
| | | private void convert(Map<String, Object> map, QueryWrapper wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | if ("status".equals(entry.getKey())) { |
| | | wrapper.eq(entry.getKey(), entry.getValue()); |
| | |
| | | if (null == announcement.getId()){ |
| | | announcement.setCreateTime(new Date()); |
| | | announcement.setUpdateTime(new Date()); |
| | | announcementService.insert(announcement); |
| | | announcementService.save(announcement); |
| | | } else { |
| | | announcement.setUpdateTime(new Date()); |
| | | announcementService.updateById(announcement); |
| | |
| | | public R add(Announcement announcement) { |
| | | announcement.setCreateTime(new Date()); |
| | | announcement.setUpdateTime(new Date()); |
| | | announcementService.insert(announcement); |
| | | announcementService.save(announcement); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | if (Cools.isEmpty(ids)){ |
| | | return R.error(); |
| | | } |
| | | announcementService.deleteBatchIds(Arrays.asList(ids)); |
| | | announcementService.removeByIds(Arrays.asList(ids)); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<Announcement> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Announcement> wrapper = new QueryWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("announcement")); |
| | | convert(map, wrapper); |
| | | List<Announcement> list = announcementService.selectList(wrapper); |
| | | List<Announcement> list = announcementService.list(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @GetMapping("/announcement/top5") |
| | | public R top5(){ |
| | | EntityWrapper<Announcement> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Announcement> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("status", 1); |
| | | wrapper.orderBy("create_time", false); |
| | | wrapper.orderBy(true, false, "create_time"); |
| | | wrapper.last("limit 5"); |
| | | return R.ok(announcementService.selectList(wrapper)); |
| | | return R.ok(announcementService.list(wrapper)); |
| | | } |
| | | } |
| | |
| | | package com.zy.system.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | 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.Cools; |
| | | import com.core.common.DateUtils; |
| | |
| | | @RequestMapping(value = "/api/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok(apiService.selectById(String.valueOf(id))); |
| | | return R.ok(apiService.getById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/api/list/auth") |
| | |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | excludeTrash(param); |
| | | EntityWrapper<Api> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Api> wrapper = new QueryWrapper<>(); |
| | | convert(param, wrapper); |
| | | wrapper.orderBy("id", false); |
| | | return R.ok(apiService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | wrapper.orderBy(true, false, "id"); |
| | | return R.ok(apiService.page(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper){ |
| | | private void convert(Map<String, Object> map, QueryWrapper wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | if (entry.getKey().endsWith(">")) { |
| | | wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue()))); |
| | |
| | | return R.error(); |
| | | } |
| | | if (null == api.getId()){ |
| | | apiService.insert(api); |
| | | apiService.save(api); |
| | | } else { |
| | | apiService.updateById(api); |
| | | } |
| | |
| | | @RequestMapping(value = "/api/add/auth") |
| | | @ManagerAuth |
| | | public R add(Api api) { |
| | | apiService.insert(api); |
| | | apiService.save(api); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | if (Cools.isEmpty(ids)){ |
| | | return R.error(); |
| | | } |
| | | apiService.deleteBatchIds(Arrays.asList(ids)); |
| | | apiService.removeByIds(Arrays.asList(ids)); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<Api> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Api> wrapper = new QueryWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("api")); |
| | | convert(map, wrapper); |
| | | List<Api> list = apiService.selectList(wrapper); |
| | | List<Api> list = apiService.list(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/apiQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<Api> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Api> wrapper = new QueryWrapper<>(); |
| | | wrapper.like("id", condition); |
| | | Page<Api> page = apiService.selectPage(new Page<>(0, 10), wrapper); |
| | | Page<Api> page = apiService.page(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (Api api : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | 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.Cools; |
| | | import com.core.common.DateUtils; |
| | |
| | | @RequestMapping(value = "/config/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok(configService.selectById(String.valueOf(id))); |
| | | return R.ok(configService.getById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/config/list/auth") |
| | |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | excludeTrash(param); |
| | | EntityWrapper<Config> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Config> wrapper = new QueryWrapper<>(); |
| | | convert(param, wrapper); |
| | | wrapper.orderBy("id", false); |
| | | return R.ok(configService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | wrapper.orderBy(true, false, "id"); |
| | | return R.ok(configService.page(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/config/listAll/auth") |
| | | @ManagerAuth |
| | | public R listAll(){ |
| | | EntityWrapper<Config> wrapper = new EntityWrapper<>(); |
| | | wrapper.orderBy("id", false); |
| | | return R.ok(configService.selectList(wrapper)); |
| | | QueryWrapper<Config> wrapper = new QueryWrapper<>(); |
| | | wrapper.orderBy(true, false, "id"); |
| | | return R.ok(configService.list(wrapper)); |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper){ |
| | | private void convert(Map<String, Object> map, QueryWrapper wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | if (entry.getKey().endsWith(">")) { |
| | | wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue()))); |
| | |
| | | } |
| | | } |
| | | if (null == config.getId()){ |
| | | configService.insert(config); |
| | | configService.save(config); |
| | | } else { |
| | | configService.updateById(config); |
| | | Parameter.reset(); |
| | |
| | | return R.error("json解析失败"); |
| | | } |
| | | } |
| | | configService.insert(config); |
| | | configService.save(config); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | if (Cools.isEmpty(ids)){ |
| | | return R.error(); |
| | | } |
| | | configService.deleteBatchIds(Arrays.asList(ids)); |
| | | configService.removeByIds(Arrays.asList(ids)); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<Config> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Config> wrapper = new QueryWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("config")); |
| | | convert(map, wrapper); |
| | | List<Config> list = configService.selectList(wrapper); |
| | | List<Config> list = configService.list(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/configQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<Config> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Config> wrapper = new QueryWrapper<>(); |
| | | wrapper.like("id", condition); |
| | | Page<Config> page = configService.selectPage(new Page<>(0, 10), wrapper); |
| | | Page<Config> page = configService.page(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (Config config : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | @RequestMapping(value = "/config/getSelectTypes") |
| | | @ManagerAuth |
| | | public R getSelectTypes() { |
| | | EntityWrapper<Config> wrapper = new EntityWrapper<>(); |
| | | wrapper.setSqlSelect("DISTINCT select_type as selectType"); |
| | | QueryWrapper<Config> wrapper = new QueryWrapper<>(); |
| | | wrapper.select("DISTINCT select_type as selectType"); |
| | | wrapper.isNotNull("select_type"); |
| | | List<Map<String, Object>> maps = configService.selectMaps(wrapper); |
| | | List<Map<String, Object>> maps = configService.listMaps(wrapper); |
| | | List<String> types = new ArrayList<>(); |
| | | for (Map<String, Object> map : maps) { |
| | | if (map != null && map.get("selectType") != null) { |
| | |
| | | package com.zy.system.controller; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Arith; |
| | | import com.core.common.R; |
| | |
| | | @RequestMapping("/top") |
| | | @ManagerAuth |
| | | public R top(){ |
| | | int logTotal = operateLogService.selectCount(new EntityWrapper<>()); |
| | | long logTotal = operateLogService.count(new QueryWrapper<>()); |
| | | int logWeek = operateLogService.selectCountByCurrentWeek(); |
| | | int userTotal = userService.selectCount(new EntityWrapper<>()); |
| | | long userTotal = userService.count(new QueryWrapper<>()); |
| | | int loginWeek = userLoginService.selectCountByCurrentWeek(); |
| | | |
| | | Map<String, Object> result = new HashMap<>(); |
| | |
| | | package com.zy.system.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | 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.Cools; |
| | | import com.core.common.DateUtils; |
| | |
| | | @RequestMapping(value = "/host/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok(hostService.selectById(String.valueOf(id))); |
| | | return R.ok(hostService.getById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/host/list/auth") |
| | |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | excludeTrash(param); |
| | | EntityWrapper<Host> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Host> wrapper = new QueryWrapper<>(); |
| | | convert(param, wrapper); |
| | | wrapper.orderBy("id", false); |
| | | return R.ok(hostService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | wrapper.orderBy(true, false, "id"); |
| | | return R.ok(hostService.page(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper){ |
| | | private void convert(Map<String, Object> map, QueryWrapper wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | if (entry.getKey().endsWith(">")) { |
| | | wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue()))); |
| | |
| | | return R.error(); |
| | | } |
| | | if (null == host.getId()){ |
| | | hostService.insert(host); |
| | | hostService.save(host); |
| | | } else { |
| | | hostService.updateById(host); |
| | | } |
| | |
| | | @RequestMapping(value = "/host/add/auth") |
| | | @ManagerAuth |
| | | public R add(Host host) { |
| | | hostService.insert(host); |
| | | hostService.save(host); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | if (Cools.isEmpty(ids)){ |
| | | return R.error(); |
| | | } |
| | | hostService.deleteBatchIds(Arrays.asList(ids)); |
| | | hostService.removeByIds(Arrays.asList(ids)); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<Host> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Host> wrapper = new QueryWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("host")); |
| | | convert(map, wrapper); |
| | | List<Host> list = hostService.selectList(wrapper); |
| | | List<Host> list = hostService.list(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/hostQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<Host> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Host> wrapper = new QueryWrapper<>(); |
| | | wrapper.like("name", condition); |
| | | Page<Host> page = hostService.selectPage(new Page<>(0, 10), wrapper); |
| | | Page<Host> page = hostService.page(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (Host host : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | package com.zy.system.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | 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.Cools; |
| | | import com.core.common.DateUtils; |
| | |
| | | @RequestMapping(value = "/operateLog/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok(operateLogService.selectById(String.valueOf(id))); |
| | | return R.ok(operateLogService.getById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/operateLog/list/auth") |
| | |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | excludeTrash(param); |
| | | EntityWrapper<OperateLog> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<OperateLog> wrapper = new QueryWrapper<>(); |
| | | convert(param, wrapper); |
| | | wrapper.orderBy("id", false); |
| | | return R.ok(operateLogService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | wrapper.orderBy(true, false, "id"); |
| | | return R.ok(operateLogService.page(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper){ |
| | | private void convert(Map<String, Object> map, QueryWrapper wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | if (entry.getKey().endsWith(">")) { |
| | | wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue()))); |
| | |
| | | return R.error(); |
| | | } |
| | | if (null == operateLog.getId()){ |
| | | operateLogService.insert(operateLog); |
| | | operateLogService.save(operateLog); |
| | | } else { |
| | | operateLogService.updateById(operateLog); |
| | | } |
| | |
| | | @RequestMapping(value = "/operateLog/add/auth") |
| | | @ManagerAuth |
| | | public R add(OperateLog operateLog) { |
| | | operateLogService.insert(operateLog); |
| | | operateLogService.save(operateLog); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | if (Cools.isEmpty(ids)){ |
| | | return R.error(); |
| | | } |
| | | operateLogService.deleteBatchIds(Arrays.asList(ids)); |
| | | operateLogService.removeByIds(Arrays.asList(ids)); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<OperateLog> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<OperateLog> wrapper = new QueryWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("operateLog")); |
| | | convert(map, wrapper); |
| | | List<OperateLog> list = operateLogService.selectList(wrapper); |
| | | List<OperateLog> list = operateLogService.list(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/operateLogQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<OperateLog> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<OperateLog> wrapper = new QueryWrapper<>(); |
| | | wrapper.like("id", condition); |
| | | Page<OperateLog> page = operateLogService.selectPage(new Page<>(0, 10), wrapper); |
| | | 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<>(); |
| | |
| | | package com.zy.system.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | 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.Cools; |
| | | import com.core.common.DateUtils; |
| | |
| | | @RequestMapping(value = "/permission/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok(permissionService.selectById(String.valueOf(id))); |
| | | return R.ok(permissionService.getById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/permission/list/auth") |
| | |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | excludeTrash(param); |
| | | EntityWrapper<Permission> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Permission> wrapper = new QueryWrapper<>(); |
| | | convert(param, wrapper); |
| | | wrapper.orderBy("id", false); |
| | | return R.ok(permissionService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | wrapper.orderBy(true, false, "id"); |
| | | return R.ok(permissionService.page(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper){ |
| | | private void convert(Map<String, Object> map, QueryWrapper wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | if (entry.getKey().endsWith(">")) { |
| | | wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue()))); |
| | |
| | | return R.error(); |
| | | } |
| | | if (null == permission.getId()){ |
| | | permissionService.insert(permission); |
| | | permissionService.save(permission); |
| | | } else { |
| | | permissionService.updateById(permission); |
| | | } |
| | |
| | | @RequestMapping(value = "/permission/add/auth") |
| | | @ManagerAuth |
| | | public R add(Permission permission) { |
| | | permissionService.insert(permission); |
| | | permissionService.save(permission); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | if (Cools.isEmpty(ids)){ |
| | | return R.error(); |
| | | } |
| | | permissionService.deleteBatchIds(Arrays.asList(ids)); |
| | | permissionService.removeByIds(Arrays.asList(ids)); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<Permission> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Permission> wrapper = new QueryWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("permission")); |
| | | convert(map, wrapper); |
| | | List<Permission> list = permissionService.selectList(wrapper); |
| | | List<Permission> list = permissionService.list(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/permissionQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<Permission> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Permission> wrapper = new QueryWrapper<>(); |
| | | wrapper.like("name", condition); |
| | | Page<Permission> page = permissionService.selectPage(new Page<>(0, 10), wrapper); |
| | | Page<Permission> page = permissionService.page(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (Permission permission : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | package com.zy.system.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | 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.Cools; |
| | | import com.core.common.DateUtils; |
| | |
| | | @RequestMapping(value = "/resource/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok(resourceService.selectById(String.valueOf(id))); |
| | | return R.ok(resourceService.getById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/resource/list/auth") |
| | |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | excludeTrash(param); |
| | | EntityWrapper<Resource> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Resource> wrapper = new QueryWrapper<>(); |
| | | convert(param, wrapper); |
| | | wrapper.orderBy("id", false); |
| | | return R.ok(resourceService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | wrapper.orderBy(true, false, "id"); |
| | | return R.ok(resourceService.page(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper){ |
| | | private void convert(Map<String, Object> map, QueryWrapper wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | if (entry.getKey().endsWith(">")) { |
| | | wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue()))); |
| | |
| | | if (resource.getSort() == null){ |
| | | resource.setSort(999); |
| | | } |
| | | resourceService.insert(resource); |
| | | resourceService.save(resource); |
| | | } else { |
| | | resourceService.updateById(resource); |
| | | } |
| | |
| | | @RequestMapping(value = "/resource/add/auth") |
| | | @ManagerAuth(memo = "菜单添加") |
| | | public R add(Resource resource) { |
| | | resourceService.insert(resource); |
| | | resourceService.save(resource); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @ManagerAuth(memo = "菜单删除") |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | resourceService.deleteById(id); |
| | | resourceService.removeById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | @ManagerAuth(memo = "菜单导出") |
| | | public R export(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<Resource> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Resource> wrapper = new QueryWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("resource")); |
| | | convert(map, wrapper); |
| | | List<Resource> list = resourceService.selectList(wrapper); |
| | | List<Resource> list = resourceService.list(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/resourceQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<Resource> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Resource> wrapper = new QueryWrapper<>(); |
| | | wrapper.like("name", condition); |
| | | Page<Resource> page = resourceService.selectPage(new Page<>(0, 10), wrapper); |
| | | Page<Resource> page = resourceService.page(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (Resource resource : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | @RequestParam(required = false)String orderByField, |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | EntityWrapper<Resource> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Resource> wrapper = new QueryWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(true, "asc".equals(orderByType), humpToLine(orderByField));} |
| | | else { |
| | | wrapper.orderBy("sort"); |
| | | wrapper.orderByAsc("sort"); |
| | | } |
| | | return R.parse("0-操作成功").add(resourceService.selectList(wrapper)); |
| | | return R.parse("0-操作成功").add(resourceService.list(wrapper)); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.zy.system.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | 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.Cools; |
| | | import com.core.common.DateUtils; |
| | |
| | | @RequestMapping(value = "/role/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok(roleService.selectById(String.valueOf(id))); |
| | | return R.ok(roleService.getById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/role/list/auth") |
| | |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | excludeTrash(param); |
| | | EntityWrapper<Role> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Role> wrapper = new QueryWrapper<>(); |
| | | convert(param, wrapper); |
| | | wrapper.orderBy("id", false); |
| | | wrapper.orderBy(true, false, "id"); |
| | | |
| | | if (9527 == getUserId()) { |
| | | return R.ok(roleService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | return R.ok(roleService.page(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | Long roleId = getUser().getRoleId(); |
| | | Role role = roleService.selectById(roleId); |
| | | Role role = roleService.getById(roleId); |
| | | Long leaderId = role.getLeader(); |
| | | if (null != leaderId) { |
| | | List<Long> leaderIds = new ArrayList<>(); |
| | | leaderIds.add(roleId); |
| | | while (leaderId != null) { |
| | | Role leader = roleService.selectById(leaderId); |
| | | Role leader = roleService.getById(leaderId); |
| | | leaderIds.add(leader.getId()); |
| | | leaderId = leader.getLeader(); |
| | | } |
| | |
| | | // if (null != role.getLevel()) { |
| | | // wrapper.gt("level", role.getLevel()); |
| | | // } |
| | | return R.ok(roleService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | return R.ok(roleService.page(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper){ |
| | | private void convert(Map<String, Object> map, QueryWrapper wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | if (entry.getKey().endsWith(">")) { |
| | | wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue()))); |
| | |
| | | return R.error(); |
| | | } |
| | | if (null == role.getId()){ |
| | | roleService.insert(role); |
| | | roleService.save(role); |
| | | } else { |
| | | roleService.updateById(role); |
| | | } |
| | |
| | | @RequestMapping(value = "/role/add/auth") |
| | | @ManagerAuth(memo = "角色添加") |
| | | public R add(Role role) { |
| | | roleService.insert(role); |
| | | roleService.save(role); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | if (Cools.isEmpty(ids)){ |
| | | return R.error(); |
| | | } |
| | | roleService.deleteBatchIds(Arrays.asList(ids)); |
| | | roleService.removeByIds(Arrays.asList(ids)); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @ManagerAuth(memo = "角色导出") |
| | | public R export(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<Role> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Role> wrapper = new QueryWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("role")); |
| | | convert(map, wrapper); |
| | | List<Role> list = roleService.selectList(wrapper); |
| | | List<Role> list = roleService.list(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/roleQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<Role> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<Role> wrapper = new QueryWrapper<>(); |
| | | wrapper.like("name", condition); |
| | | // 上下级管理 |
| | | if (9527 != getUserId()) { |
| | | Long roleId = getUser().getRoleId(); |
| | | Role role = roleService.selectById(roleId); |
| | | Role role = roleService.getById(roleId); |
| | | Long leaderId = role.getLeader(); |
| | | if (null != leaderId) { |
| | | List<Long> leaderIds = new ArrayList<>(); |
| | | while (leaderId != null) { |
| | | Role leader = roleService.selectById(leaderId); |
| | | Role leader = roleService.getById(leaderId); |
| | | leaderIds.add(leader.getId()); |
| | | leaderId = leader.getLeader(); |
| | | } |
| | |
| | | // } |
| | | } |
| | | |
| | | Page<Role> page = roleService.selectPage(new Page<>(0, 10), wrapper); |
| | | Page<Role> page = roleService.page(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (Role role : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | package com.zy.system.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | 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.Cools; |
| | | import com.core.common.DateUtils; |
| | |
| | | @RequestMapping(value = "/user/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok(userService.selectById(String.valueOf(id))); |
| | | return R.ok(userService.getById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/user/list/auth") |
| | |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | excludeTrash(param); |
| | | EntityWrapper<User> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<User> wrapper = new QueryWrapper<>(); |
| | | convert(param, wrapper); |
| | | wrapper.orderBy("id", false); |
| | | wrapper.orderBy(true, false, "id"); |
| | | if (9527 == getUserId()) { |
| | | return R.ok(userService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | return R.ok(userService.page(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | Long roleId = getUser().getRoleId(); |
| | | Role role = roleService.selectById(roleId); |
| | | Role role = roleService.getById(roleId); |
| | | Long leaderId = role.getLeader(); |
| | | if (null != leaderId) { |
| | | List<Long> leaderIds = new ArrayList<>(); |
| | | leaderIds.add(role.getId()); |
| | | while (leaderId != null) { |
| | | Role leader = roleService.selectById(leaderId); |
| | | Role leader = roleService.getById(leaderId); |
| | | leaderIds.add(leader.getId()); |
| | | leaderId = leader.getLeader(); |
| | | } |
| | | wrapper.notIn("role_id", leaderIds); |
| | | } |
| | | |
| | | return R.ok(userService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | return R.ok(userService.page(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper){ |
| | | private void convert(Map<String, Object> map, QueryWrapper wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | if (entry.getKey().endsWith(">")) { |
| | | wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue()))); |
| | |
| | | return R.error(); |
| | | } |
| | | if (null == user.getId()){ |
| | | userService.insert(user); |
| | | userService.save(user); |
| | | } else { |
| | | userService.updateById(user); |
| | | } |
| | |
| | | @RequestMapping(value = "/user/add/auth") |
| | | @ManagerAuth(memo = "系统用户添加") |
| | | public R add(User user) { |
| | | userService.insert(user); |
| | | userService.save(user); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | if (Cools.isEmpty(user) || null==user.getId()){ |
| | | return R.error(); |
| | | } |
| | | User entity = userService.selectById(user.getId()); |
| | | User entity = userService.getById(user.getId()); |
| | | if (user.getPassword()!=null) { |
| | | entity.setPassword(user.getPassword()); |
| | | } |
| | |
| | | @ManagerAuth(memo = "系统用户删除") |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | userService.deleteById(id); |
| | | userService.removeById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | @ManagerAuth(memo = "系统用户导出") |
| | | public R export(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<User> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<User> wrapper = new QueryWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("user")); |
| | | convert(map, wrapper); |
| | | List<User> list = userService.selectList(wrapper); |
| | | List<User> list = userService.list(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/userQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<User> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<User> wrapper = new QueryWrapper<>(); |
| | | wrapper.like("username", condition); |
| | | Page<User> page = userService.selectPage(new Page<>(0, 10), wrapper); |
| | | Page<User> page = userService.page(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (User user : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | package com.zy.system.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | 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.Cools; |
| | | import com.core.common.DateUtils; |
| | |
| | | @RequestMapping(value = "/userLogin/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok(userLoginService.selectById(String.valueOf(id))); |
| | | return R.ok(userLoginService.getById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/userLogin/list/auth") |
| | |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam Map<String, Object> param){ |
| | | excludeTrash(param); |
| | | EntityWrapper<UserLogin> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<UserLogin> wrapper = new QueryWrapper<>(); |
| | | convert(param, wrapper); |
| | | wrapper.orderBy("id", false); |
| | | return R.ok(userLoginService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | wrapper.orderBy(true, false, "id"); |
| | | return R.ok(userLoginService.page(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private void convert(Map<String, Object> map, EntityWrapper wrapper){ |
| | | private void convert(Map<String, Object> map, QueryWrapper wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | if (entry.getKey().endsWith(">")) { |
| | | wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue()))); |
| | |
| | | return R.error(); |
| | | } |
| | | if (null == userLogin.getId()){ |
| | | userLoginService.insert(userLogin); |
| | | userLoginService.save(userLogin); |
| | | } else { |
| | | userLoginService.updateById(userLogin); |
| | | } |
| | |
| | | @RequestMapping(value = "/userLogin/add/auth") |
| | | @ManagerAuth |
| | | public R add(UserLogin userLogin) { |
| | | userLoginService.insert(userLogin); |
| | | userLoginService.save(userLogin); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | if (Cools.isEmpty(ids)){ |
| | | return R.error(); |
| | | } |
| | | userLoginService.deleteBatchIds(Arrays.asList(ids)); |
| | | userLoginService.removeByIds(Arrays.asList(ids)); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | EntityWrapper<UserLogin> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<UserLogin> wrapper = new QueryWrapper<>(); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("userLogin")); |
| | | convert(map, wrapper); |
| | | List<UserLogin> list = userLoginService.selectList(wrapper); |
| | | List<UserLogin> list = userLoginService.list(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/userLoginQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<UserLogin> wrapper = new EntityWrapper<>(); |
| | | QueryWrapper<UserLogin> wrapper = new QueryWrapper<>(); |
| | | wrapper.like("token", condition); |
| | | Page<UserLogin> page = userLoginService.selectPage(new Page<>(0, 10), wrapper); |
| | | Page<UserLogin> page = userLoginService.page(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (UserLogin userLogin : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | package com.zy.system.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.core.common.Cools; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | package com.zy.system.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.core.common.Cools; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | package com.zy.system.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | |
| | | package com.zy.system.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.core.common.Cools; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | package com.zy.system.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.core.common.Cools; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.system.service.UserService; |
| | |
| | | |
| | | public String getUserId$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.selectById(this.userId); |
| | | User user = service.getById(this.userId); |
| | | if (!Cools.isEmpty(user)){ |
| | | return user.getUsername(); |
| | | } |
| | |
| | | package com.zy.system.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.core.common.Cools; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.system.service.ResourceService; |
| | |
| | | |
| | | public String getResourceName(){ |
| | | ResourceService service = SpringUtils.getBean(ResourceService.class); |
| | | Resource resource = service.selectById(this.resourceId); |
| | | Resource resource = service.getById(this.resourceId); |
| | | if (!Cools.isEmpty(resource)){ |
| | | return resource.getName(); |
| | | } |
| | |
| | | package com.zy.system.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.core.common.Cools; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.system.service.ResourceService; |
| | |
| | | |
| | | public String getResourceName(){ |
| | | ResourceService service = SpringUtils.getBean(ResourceService.class); |
| | | Resource resource = service.selectById(this.resourceId); |
| | | Resource resource = service.getById(this.resourceId); |
| | | if (!Cools.isEmpty(resource)){ |
| | | return resource.getName(); |
| | | } |
| | |
| | | package com.zy.system.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.core.common.Cools; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.system.service.RoleService; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @ApiModelProperty(value= "编号") |
| | | @Schema(description = "编号") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 编码 |
| | | */ |
| | | @ApiModelProperty(value= "编码") |
| | | @Schema(description = "编码") |
| | | private String code; |
| | | |
| | | /** |
| | | * 名称 |
| | | */ |
| | | @ApiModelProperty(value= "名称") |
| | | @Schema(description = "名称") |
| | | private String name; |
| | | |
| | | /** |
| | | * 上级 |
| | | */ |
| | | @ApiModelProperty(value= "上级") |
| | | @Schema(description = "上级") |
| | | private Long leader; |
| | | |
| | | /** |
| | | * 角色等级 1: 一级 2: 二级 3: 三级 4: 四级 5: 五级 |
| | | */ |
| | | @ApiModelProperty(value= "角色等级 1: 一级 2: 二级 3: 三级 4: 四级 5: 五级 ") |
| | | @Schema(description = "角色等级 1: 一级 2: 二级 3: 三级 4: 四级 5: 五级 ") |
| | | private Short level; |
| | | |
| | | public Role() {} |
| | |
| | | |
| | | public String getLeader$(){ |
| | | RoleService service = SpringUtils.getBean(RoleService.class); |
| | | Role role = service.selectById(this.leader); |
| | | Role role = service.getById(this.leader); |
| | | if (!Cools.isEmpty(role)){ |
| | | return String.valueOf(role.getName()); |
| | | } |
| | |
| | | package com.zy.system.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.core.common.Cools; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.system.service.PermissionService; |
| | |
| | | |
| | | public String getRoleName(){ |
| | | RoleService service = SpringUtils.getBean(RoleService.class); |
| | | Role role = service.selectById(this.roleId); |
| | | Role role = service.getById(this.roleId); |
| | | if (!Cools.isEmpty(role)){ |
| | | return role.getName(); |
| | | } |
| | |
| | | |
| | | public String getPermissionName(){ |
| | | PermissionService service = SpringUtils.getBean(PermissionService.class); |
| | | Permission permission = service.selectById(this.permissionId); |
| | | Permission permission = service.getById(this.permissionId); |
| | | if (!Cools.isEmpty(permission)){ |
| | | return permission.getName(); |
| | | } |
| | |
| | | package com.zy.system.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | |
| | | package com.zy.system.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.core.common.Cools; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.system.service.HostService; |
| | |
| | | |
| | | public String getHostName() { |
| | | HostService service = SpringUtils.getBean(HostService.class); |
| | | Host host = service.selectById(this.hostId); |
| | | Host host = service.getById(this.hostId); |
| | | if (!Cools.isEmpty(host)){ |
| | | return host.getName(); |
| | | } |
| | |
| | | |
| | | public String getRoleName(){ |
| | | RoleService service = SpringUtils.getBean(RoleService.class); |
| | | Role role = service.selectById(this.roleId); |
| | | Role role = service.getById(this.roleId); |
| | | if (!Cools.isEmpty(role)){ |
| | | return role.getName(); |
| | | } |
| | |
| | | package com.zy.system.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.core.common.Cools; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.system.service.UserService; |
| | |
| | | |
| | | public String getUserUsername(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.selectById(this.userId); |
| | | User user = service.getById(this.userId); |
| | | if (!Cools.isEmpty(user)){ |
| | | return user.getUsername(); |
| | | } |
| | |
| | | package com.zy.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zy.system.entity.Announcement; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | |
| | | package com.zy.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zy.system.entity.Api; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | |
| | | package com.zy.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zy.system.entity.Config; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | |
| | | package com.zy.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zy.system.entity.Host; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | |
| | | package com.zy.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zy.system.entity.OperateLog; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | package com.zy.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zy.system.entity.Permission; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | |
| | | package com.zy.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zy.system.entity.Resource; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | |
| | | package com.zy.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zy.system.entity.Role; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | |
| | | package com.zy.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zy.system.entity.RolePermission; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | |
| | | package com.zy.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zy.system.entity.Resource; |
| | | import com.zy.system.entity.RoleResource; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | |
| | | package com.zy.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zy.system.entity.UserLogin; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Select; |
| | |
| | | package com.zy.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.zy.system.entity.User; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | |
| | | package com.zy.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.system.entity.Announcement; |
| | | |
| | | public interface AnnouncementService extends IService<Announcement> { |
| | |
| | | package com.zy.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.system.entity.Api; |
| | | |
| | | public interface ApiService extends IService<Api> { |
| | |
| | | package com.zy.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.system.entity.Config; |
| | | |
| | | public interface ConfigService extends IService<Config> { |
| | |
| | | package com.zy.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.system.entity.Host; |
| | | |
| | | public interface HostService extends IService<Host> { |
| | |
| | | package com.zy.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.system.entity.OperateLog; |
| | | |
| | | import java.util.List; |
| | |
| | | package com.zy.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.system.entity.Permission; |
| | | |
| | | public interface PermissionService extends IService<Permission> { |
| | |
| | | package com.zy.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.system.entity.Resource; |
| | | |
| | | public interface ResourceService extends IService<Resource> { |
| | |
| | | package com.zy.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.system.entity.RolePermission; |
| | | |
| | | public interface RolePermissionService extends IService<RolePermission> { |
| | |
| | | package com.zy.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.system.entity.Resource; |
| | | import com.zy.system.entity.RoleResource; |
| | | |
| | |
| | | package com.zy.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.system.entity.Role; |
| | | |
| | | public interface RoleService extends IService<Role> { |
| | |
| | | package com.zy.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.system.entity.UserLogin; |
| | | |
| | | public interface UserLoginService extends IService<UserLogin> { |
| | |
| | | package com.zy.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.system.entity.User; |
| | | |
| | | public interface UserService extends IService<User> { |
| | |
| | | package com.zy.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.system.entity.Announcement; |
| | | import com.zy.system.mapper.AnnouncementMapper; |
| | | import com.zy.system.service.AnnouncementService; |
| | |
| | | package com.zy.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.system.entity.Api; |
| | | import com.zy.system.mapper.ApiMapper; |
| | | import com.zy.system.service.ApiService; |
| | |
| | | package com.zy.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.system.entity.Config; |
| | | import com.zy.system.mapper.ConfigMapper; |
| | | import com.zy.system.service.ConfigService; |
| | |
| | | package com.zy.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.system.entity.Host; |
| | | import com.zy.system.mapper.HostMapper; |
| | | import com.zy.system.service.HostService; |
| | |
| | | package com.zy.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.core.common.Cools; |
| | | import com.zy.system.entity.OperateLog; |
| | | import com.zy.system.mapper.OperateLogMapper; |
| | |
| | | package com.zy.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.system.entity.Permission; |
| | | import com.zy.system.mapper.PermissionMapper; |
| | | import com.zy.system.service.PermissionService; |
| | |
| | | package com.zy.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.system.entity.Resource; |
| | | import com.zy.system.mapper.ResourceMapper; |
| | | import com.zy.system.service.ResourceService; |
| | |
| | | package com.zy.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.system.entity.RolePermission; |
| | | import com.zy.system.mapper.RolePermissionMapper; |
| | | import com.zy.system.service.RolePermissionService; |
| | |
| | | package com.zy.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.system.entity.Resource; |
| | | import com.zy.system.entity.RoleResource; |
| | | import com.zy.system.mapper.RoleResourceMapper; |
| | |
| | | package com.zy.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.system.entity.Role; |
| | | import com.zy.system.mapper.RoleMapper; |
| | | import com.zy.system.service.RoleService; |
| | |
| | | package com.zy.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.system.entity.UserLogin; |
| | | import com.zy.system.mapper.UserLoginMapper; |
| | | import com.zy.system.service.UserLoginService; |
| | |
| | | package com.zy.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.system.entity.User; |
| | | import com.zy.system.mapper.UserMapper; |
| | | import com.zy.system.service.UserService; |
| | |
| | | hikari: |
| | | validation-timeout: 3000 |
| | | connection-test-query: select 1 |
| | | driver-class-name: com.mysql.jdbc.Driver |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://127.0.0.1:3306/monitor?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: root |
| | | password: root |
| | | mvc: |
| | | static-path-pattern: /** |
| | | redis: |
| | | host: 127.0.0.1 |
| | | port: 6379 |
| | | database: 6 |
| | | # password: 123456 |
| | | data: |
| | | redis: |
| | | host: 127.0.0.1 |
| | | port: 6379 |
| | | database: 0 |
| | | # password: 123456 |
| | | servlet: |
| | | multipart: |
| | | max-file-size: 100MB |
| | |
| | | |
| | | logging: |
| | | file: |
| | | path: /stock/out/@pom.build.finalName@/logs |
| | | path: ./stock/out/@pom.build.finalName@/logs |
| | | |
| | | super: |
| | | pwd: xltys1995 |
| | |
| | | default-package: com.zy |
| | | |
| | | file: |
| | | upload-path: D:/zy_monitor_files/upload_files/ |
| | | upload-path: D:/zy_monitor_files/upload_files/ |