3/28Dxd提交2
parent
21045e1d5a
commit
77045a3977
|
@ -0,0 +1,34 @@
|
||||||
|
package com.couplet.common.core.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DongZl
|
||||||
|
* @description: 列表返回结果集
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PageResult<T> implements Serializable {
|
||||||
|
/**
|
||||||
|
* 总条数
|
||||||
|
*/
|
||||||
|
private long total;
|
||||||
|
/**
|
||||||
|
* 结果集合
|
||||||
|
*/
|
||||||
|
private List<T> list;
|
||||||
|
public PageResult() {
|
||||||
|
}
|
||||||
|
public PageResult(long total, List<T> list) {
|
||||||
|
this.total = total;
|
||||||
|
this.list = list;
|
||||||
|
}
|
||||||
|
public static <T> PageResult<T> toPageResult(long total, List<T> list){
|
||||||
|
return new PageResult(total , list);
|
||||||
|
}
|
||||||
|
public static <T> Result<PageResult<T>> toResult(long total, List<T> list){
|
||||||
|
return Result.success(PageResult.toPageResult(total,list));
|
||||||
|
}
|
||||||
|
}
|
|
@ -58,6 +58,7 @@ public class BaseEntity implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package com.couplet.common.system.domain;
|
package com.couplet.common.system.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.couplet.common.core.web.domain.BaseEntity;
|
import com.couplet.common.core.web.domain.BaseEntity;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -82,11 +85,13 @@ public class SysDept extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 父部门名称
|
* 父部门名称
|
||||||
*/
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
private String parentName;
|
private String parentName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 子部门
|
* 子部门
|
||||||
*/
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
private List<SysDept> children = new ArrayList<SysDept>();
|
private List<SysDept> children = new ArrayList<SysDept>();
|
||||||
|
|
||||||
public Long getDeptId () {
|
public Long getDeptId () {
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.couplet</groupId>
|
||||||
|
<artifactId>couplet-modules</artifactId>
|
||||||
|
<version>3.6.3</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>couplet-msg</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.couplet.msg;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DongXiaoDong
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2024/3/30 14:40
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
public class Msg {
|
||||||
|
private static final List<String> hexDataList = new ArrayList<String>() {{
|
||||||
|
add("56 49 4e 31 32 33 34 35 36 37 38 39 44 49 4a 45 34 31 37 31 31 37 36 34 31 30 34 35 30 36 31 31 36 2e 36 36 34 33 38 30 30 33 39 2e 35 33 31 39 39 30 30 37 32 2e 30 30 30 33 31 2e 33 37 36 30 30 30 30 30 32 32 30 30 30 30 32 32 30 30 30 38 35 32 30 30 30 30 30 30 44 30 30 38 30 39 2e 36 30 30 39 34 30 30 30 30 35 38 39 30 36 36 37 39 30 39 33 30 30 30 30 32 30 33 30 30 32 30 33 30 30 30 30 30 34 34 32 38 32 2e 35 35 30 30 30 30 31 34 30 30 30 30 38 30 37 30 30 30 30 37 34 34 30 30 30 33 30 30 30 34 30 30 30 39 35 30 30 30 30 35 38 30 30 30 30 35 34 30 30 30 30 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 24");
|
||||||
|
}};
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
for (String hexData : hexDataList) {
|
||||||
|
int checksum = calculateChecksum(hexData);
|
||||||
|
System.out.println("Checksum: " + Integer.toHexString(checksum & 0xFF).toUpperCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int calculateChecksum(String hexData) {
|
||||||
|
// 将空格删除并将字符串转换为字符数组
|
||||||
|
String[] hexArray = hexData.replaceAll("\\s", "").split("");
|
||||||
|
|
||||||
|
// 将十六进制字符转换为字节数组
|
||||||
|
byte[] bytes = new byte[hexArray.length / 2];
|
||||||
|
for (int i = 0; i < hexArray.length; i += 2) {
|
||||||
|
String hex = hexArray[i] + hexArray[i + 1];
|
||||||
|
bytes[i / 2] = (byte) Integer.parseInt(hex, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算校验和
|
||||||
|
int sum = 0;
|
||||||
|
for (byte b : bytes) {
|
||||||
|
sum += b;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取低位字节
|
||||||
|
return sum & 0xFF;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.couplet.msg;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DongXiaoDong
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2024/3/30 11:39
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
public class ParsingMsg {
|
||||||
|
private static final List<String> msgList = new ArrayList<>(){{
|
||||||
|
add("7E 56 49 4e 31 32 33 34 35 36 37 38 39 44 49 4a 45 34 31 37 31 31 37 36 34 31 30 34 35 30 36 31 31 36 2e 36 36 34 33 38 30 30 33 39 2e 35 33 31 39 39 30 30 37 32 2e 30 30 30 33 31 2e 33 37 36 30 30 30 30 30 32 32 30 30 30 30 32 32 30 30 30 38 35 32 30 30 30 30 30 30 44 30 30 38 30 39 2e 36 30 30 39 34 30 30 30 30 35 38 39 30 36 36 37 39 30 39 33 30 30 30 30 32 30 33 30 30 32 30 33 30 30 30 30 30 34 34 32 38 32 2e 35 35 30 30 30 30 31 34 30 30 30 30 38 30 37 30 30 30 30 37 34 34 30 30 30 33 30 30 30 34 30 30 30 39 35 30 30 30 30 35 38 30 30 30 30 35 34 30 30 30 30 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 24 7E");
|
||||||
|
}};
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
for (String string : msgList) {
|
||||||
|
String substring = string.substring(2, string.length() - 2);
|
||||||
|
System.out.println(substring);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// private static String decodeHexString(String hexString) {
|
||||||
|
// //将第一个和最后一个字符删除
|
||||||
|
// hexString = hexString.substring(2, hexString.length() - 2);
|
||||||
|
//
|
||||||
|
// //将十六进制字符转换为字节数组
|
||||||
|
//// byte[] bytes = new byte[hexArray.length / 2];
|
||||||
|
//// for (int i = 0; i < hexArray.length; i +=2) {
|
||||||
|
//// String hex = hexArray[i] + hexArray[i + 1];
|
||||||
|
//// bytes[i / 2] = (byte) Integer.parseInt(hex, 16);
|
||||||
|
//// }
|
||||||
|
// return new String(hexString);
|
||||||
|
// }
|
||||||
|
}
|
|
@ -1,18 +1,19 @@
|
||||||
package com.couplet.trouble.controller;
|
package com.couplet.trouble.controller;
|
||||||
|
|
||||||
|
import com.couplet.common.core.domain.PageResult;
|
||||||
import com.couplet.common.core.domain.Result;
|
import com.couplet.common.core.domain.Result;
|
||||||
import com.couplet.common.core.web.controller.BaseController;
|
import com.couplet.common.core.web.controller.BaseController;
|
||||||
import com.couplet.common.core.web.page.TableDataInfo;
|
|
||||||
import com.couplet.common.log.annotation.Log;
|
import com.couplet.common.log.annotation.Log;
|
||||||
import com.couplet.common.log.enums.BusinessType;
|
import com.couplet.common.log.enums.BusinessType;
|
||||||
import com.couplet.trouble.domain.coupletTroubleCode;
|
import com.couplet.trouble.domain.CoupletTroubleCode;
|
||||||
import com.couplet.trouble.domain.req.TroubleUpdReq;
|
import com.couplet.trouble.domain.CoupletTroubleGrade;
|
||||||
|
import com.couplet.trouble.domain.CoupletTroubleType;
|
||||||
|
import com.couplet.trouble.domain.resp.TroubleResp;
|
||||||
import com.couplet.trouble.service.SysTroubleService;
|
import com.couplet.trouble.service.SysTroubleService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,13 +29,28 @@ public class SysTroubleController extends BaseController {
|
||||||
private SysTroubleService troubleService;
|
private SysTroubleService troubleService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障管理列表
|
* 故障码管理列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/troubleList")
|
@GetMapping("/troubleList")
|
||||||
public Result<TableDataInfo<coupletTroubleCode>> list(@RequestBody coupletTroubleCode trouble) {
|
public Result<PageResult<CoupletTroubleCode>> list(TroubleResp troubleReq) {
|
||||||
startPage();
|
PageResult<CoupletTroubleCode> result = troubleService.selectTroubleList(troubleReq);
|
||||||
List<coupletTroubleCode> list = troubleService.selectTroubleList(trouble);
|
return Result.success(result);
|
||||||
return getDataTable(list);
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障类型信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/troubleTypeList")
|
||||||
|
public List<CoupletTroubleType> listType() {
|
||||||
|
return troubleService.selectTroubleListByType();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 故障等级信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/troubleGradeList")
|
||||||
|
public List<CoupletTroubleGrade> listGrade() {
|
||||||
|
return troubleService.selectTroubleListByGrade();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,16 +58,16 @@ public class SysTroubleController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@Log(title = "新增故障码数据", businessType = BusinessType.INSERT)
|
@Log(title = "新增故障码数据", businessType = BusinessType.INSERT)
|
||||||
@PostMapping("insertTrouble")
|
@PostMapping("insertTrouble")
|
||||||
public Result<?> insert(@Validated @RequestBody coupletTroubleCode troubleAddReq) {
|
public Result<?> insert(@Validated @RequestBody CoupletTroubleCode troubleAddReq) {
|
||||||
return toAjax(troubleService.save(troubleAddReq));
|
return toAjax(troubleService.save(troubleAddReq));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改保存故障码数据
|
* 修改故障码数据
|
||||||
*/
|
*/
|
||||||
@Log(title = "修改故障码数据",businessType = BusinessType.UPDATE)
|
@Log(title = "修改故障码数据",businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("updateTrouble")
|
@PostMapping("updateTrouble")
|
||||||
public Result<?> edit(@Validated @RequestBody coupletTroubleCode troubleUpdReq) {
|
public Result<?> edit(@Validated @RequestBody CoupletTroubleCode troubleUpdReq) {
|
||||||
return toAjax(troubleService.updateById(troubleUpdReq));
|
return toAjax(troubleService.updateById(troubleUpdReq));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +76,7 @@ public class SysTroubleController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@Log(title = "删除故障码",businessType = BusinessType.DELETE)
|
@Log(title = "删除故障码",businessType = BusinessType.DELETE)
|
||||||
@GetMapping("/remove/{troubleId}")
|
@GetMapping("/remove/{troubleId}")
|
||||||
public Result<?> remove(@PathVariable Long troubleId) {
|
public Result<?> remove(@PathVariable Integer troubleId) {
|
||||||
troubleService.removeById(troubleId);
|
troubleService.removeById(troubleId);
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.couplet.trouble.domain;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.couplet.common.core.annotation.Excel;
|
import com.couplet.common.core.annotation.Excel;
|
||||||
import com.couplet.common.core.web.domain.BaseEntity;
|
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
@ -18,7 +17,7 @@ import lombok.experimental.SuperBuilder;
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class coupletTroubleCode {
|
public class CoupletTroubleCode {
|
||||||
/**
|
/**
|
||||||
* 主键id
|
* 主键id
|
||||||
*/
|
*/
|
||||||
|
@ -53,10 +52,12 @@ public class coupletTroubleCode {
|
||||||
/**
|
/**
|
||||||
* 故障类型Id
|
* 故障类型Id
|
||||||
*/
|
*/
|
||||||
private Integer troubleTypeId;
|
@Excel(name = "故障类型Id")
|
||||||
|
private Integer typeId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 故障等级Id
|
* 故障等级Id
|
||||||
*/
|
*/
|
||||||
private Integer troubleGradeId;
|
@Excel(name = "故障等级Id")
|
||||||
|
private Integer gradeId;
|
||||||
}
|
}
|
|
@ -9,7 +9,7 @@ import lombok.Data;
|
||||||
* @description
|
* @description
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class coupletTroubleGrade {
|
public class CoupletTroubleGrade {
|
||||||
private Integer gradeId;
|
private Integer gradeId;
|
||||||
private String gradeName;
|
private String gradeName;
|
||||||
}
|
}
|
|
@ -9,7 +9,7 @@ import lombok.Data;
|
||||||
* @description
|
* @description
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class coupletTroubleType {
|
public class CoupletTroubleType {
|
||||||
private Integer typeId;
|
private Integer typeId;
|
||||||
private String typeName;
|
private String typeName;
|
||||||
}
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.couplet.trouble.domain.resp;
|
||||||
|
|
||||||
|
import com.couplet.trouble.domain.CoupletTroubleCode;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DongXiaoDong
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2024/3/30 19:22
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class TroubleResp extends CoupletTroubleCode implements Serializable {
|
||||||
|
private Integer pageNum=1;
|
||||||
|
private Integer pageSize=5;
|
||||||
|
private String troubleCode;
|
||||||
|
private String troublePosition;
|
||||||
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
package com.couplet.trouble.mapper;
|
package com.couplet.trouble.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.couplet.trouble.domain.coupletTroubleCode;
|
import com.couplet.trouble.domain.CoupletTroubleCode;
|
||||||
import com.couplet.trouble.domain.req.TroubleAddReq;
|
import com.couplet.trouble.domain.CoupletTroubleGrade;
|
||||||
import com.couplet.trouble.domain.req.TroubleUpdReq;
|
import com.couplet.trouble.domain.CoupletTroubleType;
|
||||||
|
import com.couplet.trouble.domain.resp.TroubleResp;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -15,8 +16,12 @@ import java.util.List;
|
||||||
* @description
|
* @description
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SysTroubleMapper extends BaseMapper<coupletTroubleCode> {
|
public interface SysTroubleMapper extends BaseMapper<CoupletTroubleCode> {
|
||||||
List<coupletTroubleCode> selectTroubleList(coupletTroubleCode trouble);
|
List<CoupletTroubleCode> selectTroubleList(TroubleResp troubleReq);
|
||||||
|
|
||||||
|
List<CoupletTroubleType> selectTroubleListByType();
|
||||||
|
|
||||||
|
List<CoupletTroubleGrade> selectTroubleListByGrade();
|
||||||
|
|
||||||
// int addTrouble(TroubleAddReq troubleAddReq);
|
// int addTrouble(TroubleAddReq troubleAddReq);
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package com.couplet.trouble.service;
|
package com.couplet.trouble.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.couplet.trouble.domain.coupletTroubleCode;
|
import com.couplet.common.core.domain.PageResult;
|
||||||
import com.couplet.trouble.domain.req.TroubleAddReq;
|
import com.couplet.trouble.domain.CoupletTroubleCode;
|
||||||
import com.couplet.trouble.domain.req.TroubleUpdReq;
|
import com.couplet.trouble.domain.CoupletTroubleGrade;
|
||||||
|
import com.couplet.trouble.domain.CoupletTroubleType;
|
||||||
|
import com.couplet.trouble.domain.resp.TroubleResp;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -13,8 +15,12 @@ import java.util.List;
|
||||||
* @date 2024/3/26 22:38
|
* @date 2024/3/26 22:38
|
||||||
* @description
|
* @description
|
||||||
*/
|
*/
|
||||||
public interface SysTroubleService extends IService<coupletTroubleCode> {
|
public interface SysTroubleService extends IService<CoupletTroubleCode> {
|
||||||
List<coupletTroubleCode> selectTroubleList(coupletTroubleCode trouble);
|
PageResult<CoupletTroubleCode> selectTroubleList(TroubleResp troubleReq);
|
||||||
|
|
||||||
|
List<CoupletTroubleType> selectTroubleListByType();
|
||||||
|
|
||||||
|
List<CoupletTroubleGrade> selectTroubleListByGrade();
|
||||||
|
|
||||||
// int addTrouble (TroubleAddReq troubleAddReq);
|
// int addTrouble (TroubleAddReq troubleAddReq);
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
package com.couplet.trouble.service.impl;
|
package com.couplet.trouble.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.couplet.trouble.domain.coupletTroubleCode;
|
import com.couplet.common.core.domain.PageResult;
|
||||||
import com.couplet.trouble.domain.req.TroubleAddReq;
|
import com.couplet.trouble.domain.CoupletTroubleCode;
|
||||||
import com.couplet.trouble.domain.req.TroubleUpdReq;
|
import com.couplet.trouble.domain.CoupletTroubleGrade;
|
||||||
|
import com.couplet.trouble.domain.CoupletTroubleType;
|
||||||
|
import com.couplet.trouble.domain.resp.TroubleResp;
|
||||||
import com.couplet.trouble.mapper.SysTroubleMapper;
|
import com.couplet.trouble.mapper.SysTroubleMapper;
|
||||||
import com.couplet.trouble.service.SysTroubleService;
|
import com.couplet.trouble.service.SysTroubleService;
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -18,19 +22,32 @@ import java.util.List;
|
||||||
* @description
|
* @description
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SysTroubleServiceImpl extends ServiceImpl<SysTroubleMapper, coupletTroubleCode> implements SysTroubleService{
|
public class SysTroubleServiceImpl extends ServiceImpl<SysTroubleMapper, CoupletTroubleCode> implements SysTroubleService{
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysTroubleMapper sysTroubleMapper;
|
private SysTroubleMapper sysTroubleMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询故障码列表
|
* 查询故障码列表
|
||||||
* @param trouble
|
* @param troubleReq
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<coupletTroubleCode> selectTroubleList(coupletTroubleCode trouble) {
|
public PageResult<CoupletTroubleCode> selectTroubleList(TroubleResp troubleReq) {
|
||||||
return sysTroubleMapper.selectTroubleList(trouble);
|
PageHelper.startPage(troubleReq.getPageNum(), troubleReq.getPageSize());
|
||||||
|
List<CoupletTroubleCode> troubleList = sysTroubleMapper.selectTroubleList(troubleReq);
|
||||||
|
PageInfo<CoupletTroubleCode> info = new PageInfo<>(troubleList);
|
||||||
|
return PageResult.toPageResult(info.getTotal(),troubleList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CoupletTroubleType> selectTroubleListByType() {
|
||||||
|
return sysTroubleMapper.selectTroubleListByType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CoupletTroubleGrade> selectTroubleListByGrade() {
|
||||||
|
return sysTroubleMapper.selectTroubleListByGrade();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -4,20 +4,20 @@
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.couplet.trouble.mapper.SysTroubleMapper">
|
<mapper namespace="com.couplet.trouble.mapper.SysTroubleMapper">
|
||||||
|
|
||||||
<resultMap type="com.couplet.trouble.domain.coupletTroubleCode" id="SysTroubleResult">
|
<resultMap type="com.couplet.trouble.domain.CoupletTroubleCode" id="SysTroubleResult">
|
||||||
<id property="troubleId" column="trouble_id"/>
|
<id property="troubleId" column="trouble_id"/>
|
||||||
<result property="troubleCode" column="trouble_code"/>
|
<result property="troubleCode" column="trouble_code"/>
|
||||||
<result property="troubleGradeId" column="trouble_gradeId"/>
|
<result property="troubleValue" column="trouble_value"/>
|
||||||
<result property="troublePosition" column="trouble_position"/>
|
<result property="troublePosition" column="trouble_position"/>
|
||||||
<result property="troubleTag" column="trouble_tag"/>
|
<result property="troubleTag" column="trouble_tag"/>
|
||||||
<result property="troubleTypeId" column="trouble_typeId"/>
|
<result property="typeId" column="type_id"/>
|
||||||
<result property="troubleValue" column="trouble_value"/>
|
<result property="gradeId" column="grade_id"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectTroubleVo">
|
<sql id="selectTroubleVo">
|
||||||
select t.*,g.grade_name,y.type_name from couplet_trouble_code t
|
select t.*,g.grade_name,y.type_name from couplet_trouble_code t
|
||||||
LEFT JOIN couplet_trouble_grade g on t.trouble_grade_id = g.grade_id
|
LEFT JOIN couplet_trouble_grade g on t.grade_id = g.grade_id
|
||||||
LEFT JOIN couplet_trouble_type y on t.trouble_type_id= y.type_id
|
LEFT JOIN couplet_trouble_type y on t.type_id= y.type_id
|
||||||
</sql>
|
</sql>
|
||||||
<!-- <insert id="addTrouble">-->
|
<!-- <insert id="addTrouble">-->
|
||||||
<!-- insert into couplet_trouble_code (trouble_code,trouble_position,trouble_value,trouble_tag,trouble_type_id,trouble_grade_id)-->
|
<!-- insert into couplet_trouble_code (trouble_code,trouble_position,trouble_value,trouble_tag,trouble_type_id,trouble_grade_id)-->
|
||||||
|
@ -56,7 +56,12 @@
|
||||||
AND trouble_position like concat('%', #{troublePosition}, '%')
|
AND trouble_position like concat('%', #{troublePosition}, '%')
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by trouble_position desc
|
</select>
|
||||||
|
<select id="selectTroubleListByType" resultType="com.couplet.trouble.domain.CoupletTroubleType">
|
||||||
|
select * from couplet_trouble_type
|
||||||
|
</select>
|
||||||
|
<select id="selectTroubleListByGrade" resultType="com.couplet.trouble.domain.CoupletTroubleGrade">
|
||||||
|
select * from couplet_trouble_grade
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
<module>couplet-modules-vehicle</module>
|
<module>couplet-modules-vehicle</module>
|
||||||
<module>couplet-modules-mqtt</module>
|
<module>couplet-modules-mqtt</module>
|
||||||
<module>couplet-enterprisemanagement</module>
|
<module>couplet-enterprisemanagement</module>
|
||||||
|
<module>couplet-msg</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<artifactId>couplet-modules</artifactId>
|
<artifactId>couplet-modules</artifactId>
|
||||||
|
|
Loading…
Reference in New Issue