基本业务功能

server_five_liuyunhu
dongxiaodong 2024-03-27 22:43:38 +08:00
parent 68ced79707
commit 3be43f8fb6
22 changed files with 609 additions and 2 deletions

View File

@ -15,6 +15,7 @@ spring:
discovery:
# 服务注册地址
server-addr: 121.89.211.230:8848
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
config:
# 配置中心地址
server-addr: 121.89.211.230:8848
@ -23,3 +24,4 @@ spring:
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15

View File

@ -15,6 +15,7 @@ spring:
discovery:
# 服务注册地址
server-addr: 121.89.211.230:8848
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
config:
# 配置中心地址
server-addr: 121.89.211.230:8848
@ -23,3 +24,4 @@ spring:
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15

View File

@ -15,6 +15,7 @@ spring:
discovery:
# 服务注册地址
server-addr: 121.89.211.230:8848
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
config:
# 配置中心地址
server-addr: 121.89.211.230:8848
@ -23,3 +24,4 @@ spring:
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15

View File

@ -15,6 +15,7 @@ spring:
discovery:
# 服务注册地址
server-addr: 121.89.211.230:8848
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
config:
# 配置中心地址
server-addr: 121.89.211.230:8848
@ -23,3 +24,4 @@ spring:
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15

View File

@ -23,8 +23,7 @@ import java.util.Objects;
* @Date 2023-11-13 10:06
*/
@Service
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig>
implements SysConfigService {
public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig> implements SysConfigService {
@Autowired
private RedisService redisService;

View File

@ -15,6 +15,7 @@ spring:
discovery:
# 服务注册地址
server-addr: 121.89.211.230:8848
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
config:
# 配置中心地址
server-addr: 121.89.211.230:8848
@ -23,6 +24,7 @@ spring:
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
logging:
level:
com.couplet.system.mapper: DEBUG

View File

@ -0,0 +1,29 @@
<?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-trouble</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>
<dependencies>
<dependency>
<groupId>com.couplet</groupId>
<artifactId>couplet-modules-system</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,18 @@
package com.couplet.trouble;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* @author DongXiaoDong
* @version 1.0
* @date 2024/3/26 21:42
* @description
*/
@SpringBootApplication(scanBasePackages = "com.couplet.**")
public class CoupletTroubleApplication {
public static void main(String[] args) {
SpringApplication.run(CoupletTroubleApplication.class);
}
}

View File

@ -0,0 +1,68 @@
package com.couplet.trouble.controller;
import com.couplet.common.core.domain.Result;
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.enums.BusinessType;
import com.couplet.common.security.annotation.RequiresPermissions;
import com.couplet.common.security.utils.SecurityUtils;
import com.couplet.trouble.domain.Trouble;
import com.couplet.trouble.domain.req.TroubleAddReq;
import com.couplet.trouble.domain.req.TroubleUpdReq;
import com.couplet.trouble.service.SysTroubleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author DongXiaoDong
* @version 1.0
* @date 2024/3/26 22:36
* @description
*/
@RestController
public class SysTroubleController extends BaseController {
@Autowired
private SysTroubleService troubleService;
/**
*
*/
@GetMapping("/troubleList")
public Result<TableDataInfo<Trouble>> list(@RequestBody Trouble trouble) {
startPage();
List<Trouble> list = troubleService.selectTroubleList(trouble);
return getDataTable(list);
}
/**
*
*/
@Log(title = "新增故障码数据", businessType = BusinessType.INSERT)
@PostMapping("insertTrouble")
public Result<?> insert(@Validated @RequestBody TroubleAddReq troubleAddReq) {
return toAjax(troubleService.addTrouble(troubleAddReq));
}
/**
*
*/
@Log(title = "修改故障码数据",businessType = BusinessType.UPDATE)
@PostMapping("updateTrouble")
public Result<?> edit(@Validated @RequestBody TroubleUpdReq troubleUpdReq) {
return toAjax(troubleService.updateTrouble(troubleUpdReq));
}
/**
*
*/
@Log(title = "删除故障码",businessType = BusinessType.DELETE)
@GetMapping("/removeId/{troubleId}")
public Result<?> remove(@PathVariable Long troubleId) {
troubleService.removeById(troubleId);
return success();
}
}

View File

@ -0,0 +1,105 @@
package com.couplet.trouble.domain;
import com.couplet.common.core.annotation.Excel;
import com.couplet.common.core.web.domain.BaseEntity;
import lombok.*;
import lombok.experimental.SuperBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* @author DongXiaoDong
* @version 1.0
* @date 2024/3/26 21:49
* @description
*/
@Getter
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class Trouble extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* id
*/
@Excel(name = "故障码主键", cellType = Excel.ColumnType.NUMERIC)
private Integer troubleId;
/**
*
*/
@Excel(name = "故障码")
private String troubleCode;
/**
*
*/
@Excel(name = "故障位")
private String troublePosition;
/**
*
*/
@Excel(name = "故障值")
private String troubleValue;
/**
*
*/
@Excel(name = "故障标签")
private String troubleTag;
/**
* Id
*/
private Integer troubleTypeId;
/**
* Id
*/
private Integer troubleGradeId;
public void setTroubleId (Integer troubleId) {
this.troubleId = troubleId;
}
public void setTroubleCode (String troubleCode) {
this.troubleCode = troubleCode;
}
public void setTroublePosition (String troublePosition) {
this.troublePosition = troublePosition;
}
public void setTroubleValue (String troubleValue) {
this.troubleValue = troubleValue;
}
public void setTroubleTag (String troubleTag) {
this.troubleTag = troubleTag;
}
public void setTroubleTypeId (Integer troubleTypeId) {
this.troubleTypeId = troubleTypeId;
}
public void setTroubleGradeId (Integer troubleGradeId) {
this.troubleGradeId = troubleGradeId;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("troubleId", getTroubleId())
.append("troubleCode", getTroubleCode())
.append("troublePosition", getTroublePosition())
.append("troubleValue", getTroubleValue())
.append("troubleTag", getTroubleTag())
.append("troubleTypeId", getTroubleTypeId())
.append("troubleGradeId", getTroubleGradeId())
.toString();
}
}

View File

@ -0,0 +1,15 @@
package com.couplet.trouble.domain;
import lombok.Data;
/**
* @author DongXiaoDong
* @version 1.0
* @date 2024/3/26 21:49
* @description
*/
@Data
public class TroubleGrade {
private Integer gradeId;
private String gradeName;
}

View File

@ -0,0 +1,15 @@
package com.couplet.trouble.domain;
import lombok.Data;
/**
* @author DongXiaoDong
* @version 1.0
* @date 2024/3/26 21:50
* @description
*/
@Data
public class TroubleType {
private Integer typeId;
private String typeName;
}

View File

@ -0,0 +1,52 @@
package com.couplet.trouble.domain.req;
import com.couplet.common.core.annotation.Excel;
import com.couplet.common.core.web.domain.BaseEntity;
import lombok.*;
import lombok.experimental.SuperBuilder;
/**
* @author DongXiaoDong
* @version 1.0
* @date 2024/3/26 22:32
* @description
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class TroubleAddReq {
/**
*
*/
@Excel(name = "故障码")
private String troubleCode;
/**
*
*/
@Excel(name = "故障位")
private String troublePosition;
/**
*
*/
@Excel(name = "故障值")
private String troubleValue;
/**
*
*/
@Excel(name = "故障标签")
private String troubleTag;
/**
* Id
*/
private Integer troubleTypeId;
/**
* Id
*/
private Integer troubleGradeId;
}

View File

@ -0,0 +1,60 @@
package com.couplet.trouble.domain.req;
import com.couplet.common.core.annotation.Excel;
import com.couplet.common.core.web.domain.BaseEntity;
import com.couplet.common.system.domain.SysUser;
import com.couplet.trouble.domain.Trouble;
import lombok.*;
import lombok.experimental.SuperBuilder;
/**
* @author DongXiaoDong
* @version 1.0
* @date 2024/3/26 22:32
* @description
*/
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
public class TroubleUpdReq {
/**
* id
*/
@Excel(name = "故障码主键", cellType = Excel.ColumnType.NUMERIC)
private Integer troubleId;
/**
*
*/
@Excel(name = "故障码")
private String troubleCode;
/**
*
*/
@Excel(name = "故障位")
private String troublePosition;
/**
*
*/
@Excel(name = "故障值")
private String troubleValue;
/**
*
*/
@Excel(name = "故障标签")
private String troubleTag;
/**
* Id
*/
private Integer troubleTypeId;
/**
* Id
*/
private Integer troubleGradeId;
}

View File

@ -0,0 +1,24 @@
package com.couplet.trouble.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.couplet.trouble.domain.Trouble;
import com.couplet.trouble.domain.req.TroubleAddReq;
import com.couplet.trouble.domain.req.TroubleUpdReq;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author DongXiaoDong
* @version 1.0
* @date 2024/3/26 22:37
* @description
*/
@Mapper
public interface SysTroubleMapper extends BaseMapper<Trouble> {
List<Trouble> selectTroubleList(Trouble trouble);
int addTrouble(TroubleAddReq troubleAddReq);
int updateTrouble(TroubleUpdReq troubleUpdReq);
}

View File

@ -0,0 +1,24 @@
package com.couplet.trouble.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.couplet.trouble.domain.Trouble;
import com.couplet.trouble.domain.req.TroubleAddReq;
import com.couplet.trouble.domain.req.TroubleUpdReq;
import java.util.List;
/**
* @author DongXiaoDong
* @version 1.0
* @date 2024/3/26 22:38
* @description
*/
public interface SysTroubleService extends IService<Trouble> {
List<Trouble> selectTroubleList(Trouble trouble);
int addTrouble (TroubleAddReq troubleAddReq);
int updateTrouble(TroubleUpdReq troubleUpdReq);
}

View File

@ -0,0 +1,57 @@
package com.couplet.trouble.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.couplet.trouble.domain.Trouble;
import com.couplet.trouble.domain.req.TroubleAddReq;
import com.couplet.trouble.domain.req.TroubleUpdReq;
import com.couplet.trouble.mapper.SysTroubleMapper;
import com.couplet.trouble.service.SysTroubleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author DongXiaoDong
* @version 1.0
* @date 2024/3/26 22:38
* @description
*/
@Service
public class SysTroubleServiceImpl extends ServiceImpl<SysTroubleMapper, Trouble> implements SysTroubleService{
@Autowired
private SysTroubleMapper sysTroubleMapper;
/**
*
* @param trouble
* @return
*/
@Override
public List<Trouble> selectTroubleList(Trouble trouble) {
return sysTroubleMapper.selectTroubleList(trouble);
}
/**
*
* @param troubleAddReq
* @return
*/
@Override
public int addTrouble(TroubleAddReq troubleAddReq) {
return sysTroubleMapper.addTrouble(troubleAddReq);
}
/**
*
* @param troubleUpdReq
* @return
*/
@Override
public int updateTrouble(TroubleUpdReq troubleUpdReq) {
return sysTroubleMapper.updateTrouble(troubleUpdReq);
}
}

View File

@ -0,0 +1,30 @@
# Tomcat
server:
port: 9222
# Spring
spring:
application:
# 应用名称
name: couplet-trouble
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 121.89.211.230:8848
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
config:
# 配置中心地址
server-addr: 121.89.211.230:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
logging:
level:
com.couplet.trouble.mapper: DEBUG

View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.couplet.trouble.mapper.SysTroubleMapper">
<resultMap type="com.couplet.trouble.domain.Trouble" id="SysTroubleResult">
<id property="troubleId" column="trouble_id"/>
<result property="troubleCode" column="trouble_code"/>
<result property="troubleGradeId" column="trouble_gradeId"/>
<result property="troublePosition" column="trouble_position"/>
<result property="troubleTag" column="trouble_tag"/>
<result property="troubleTypeId" column="trouble_typeId"/>
<result property="troubleValue" column="trouble_value"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectTroubleVo">
select t.*,g.grade_name,y.type_name from dxd_trouble_code t
LEFT JOIN dxd_trouble_grade g on t.trouble_grade_id = g.grade_id
LEFT JOIN dxd_trouble_type y on t.trouble_type_id= y.type_id
</sql>
<insert id="addTrouble">
insert into dxd_trouble_code (trouble_code,trouble_position,trouble_value,trouble_tag,trouble_type_id,trouble_grade_id)
values (#{troubleCode},#{troublePosition},#{troubleValue},#{troubleTag},#{troubleTypeId},#{troubleGradeId})
</insert>
<update id="updateTrouble">
update dxd_trouble_code set
trouble_code = #{troubleCode},
trouble_position = #{troublePosition},
trouble_value = #{troubleValue},
trouble_tag = #{troubleTag},
trouble_type_id = #{troubleTypeId},
trouble_grade_id = #{troubleGradeId}
where trouble_id = #{troubleId}
</update>
<!-- <update id="updateTrouble" parameterType="com.couplet.trouble.domain.req.TroubleUpdReq">-->
<!-- update dxd_trouble_code-->
<!-- <set>-->
<!-- <if test="troubleCode != null and troubleCode != ''">trouble_code = #{troubleCode},</if>-->
<!-- <if test="troublePosition != null and troublePosition != ''">trouble_position = #{troublePosition},</if>-->
<!-- <if test="troubleTag != null and troubleTag != ''">trouble_tag = #{troubleTag},</if>-->
<!-- <if test="troubleTypeId != null">trouble_typeId = #{troubleTypeId},</if>-->
<!-- <if test="troubleValue != null and troubleValue != ''">trouble_value = #{troubleValue},</if>-->
<!-- <if test="troubleGradeId != null">trouble_gradeId = #{troubleGradeId},</if>-->
<!-- </set>-->
<!-- where trouble_id = #{troubleId}-->
<!-- </update>-->
<select id="selectTroubleList" parameterType="com.couplet.trouble.mapper.SysTroubleMapper" resultMap="SysTroubleResult">
<include refid="selectTroubleVo"/>
<where>
<if test="troubleCode != null and troubleCode != ''">
AND trouble_code = #{troubleCode}
</if>
<if test="troublePosition != null and troublePosition != ''">
AND trouble_position like concat('%', #{troublePosition}, '%')
</if>
</where>
order by trouble_position desc
</select>
<delete id="deleteDictDataById" parameterType="Long">
delete
from dxd_trouble_code
where dict_code = #{dictCode}
</delete>
<!-- <insert id="addTrouble" parameterType="com.couplet.trouble.domain.req.TroubleAddReq">-->
<!-- insert into dxd_trouble_code(-->
<!-- <if test="troubleCode != null and troubleCode != ''">trouble_code,</if>-->
<!-- <if test="troublePosition != null and troublePosition != ''">trouble_position,</if>-->
<!-- <if test="troubleTag != null and troubleTag != ''">trouble_tag,</if>-->
<!-- <if test="troubleTypeId != null">trouble_typeId,</if>-->
<!-- <if test="troubleValue != null and troubleValue != ''">trouble_value,</if>-->
<!-- <if test="troubleGradeId != null">trouble_gradeId</if>-->
<!-- )values(-->
<!-- <if test="troubleCode != null and troubleCode != ''">#{troubleCode},</if>-->
<!-- <if test="troublePosition != null and troublePosition != ''">#{troublePosition},</if>-->
<!-- <if test="troubleTag != null and troubleTag != ''">#{troubleTag},</if>-->
<!-- <if test="troubleTypeId != null">#{troubleTypeId},</if>-->
<!-- <if test="troubleValue != null and troubleValue != ''">#{troubleValue},</if>-->
<!-- <if test="troubleGradeId != null">#{troubleGradeId},</if>-->
<!-- )-->
<!-- </insert>-->
</mapper>

View File

@ -13,6 +13,7 @@
<module>couplet-gen</module>
<module>couplet-job</module>
<module>couplet-file</module>
<module>couplet-trouble</module>
</modules>
<artifactId>couplet-modules</artifactId>

View File

@ -15,6 +15,7 @@ spring:
discovery:
# 服务注册地址
server-addr: 121.89.211.230:8848
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15
config:
# 配置中心地址
server-addr: 121.89.211.230:8848
@ -23,3 +24,4 @@ spring:
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
namespace: a439ce3f-2c42-4b4c-9c4d-c8db49933c15

View File

@ -206,6 +206,12 @@
<version>${couplet.version}</version>
</dependency>
<dependency>
<groupId>com.couplet</groupId>
<artifactId>couplet-modules-system</artifactId>
<version>${couplet.version}</version>
</dependency>
</dependencies>
</dependencyManagement>