From daf6a95086087ec99232eea8b4648b7541881f7c Mon Sep 17 00:00:00 2001 From: kongdeqiang <123456> Date: 星期五, 16 十二月 2022 17:44:28 +0800 Subject: [PATCH] 增加service --- src/main/java/com/wgcloud/service/FailureLoggingService.java | 14 +++ src/main/java/com/wgcloud/service/InspectionTaskService.java | 24 ++++++ src/main/java/com/wgcloud/service/TaskInfoService.java | 31 +++++++ src/main/java/com/wgcloud/mapper/FailureLoggingMapper.java | 18 ++++ src/main/resources/mybatis/mapper/FailureLoggingMapper.xml | 125 +++++++++++++++++++++++++++++++ 5 files changed, 212 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/wgcloud/mapper/FailureLoggingMapper.java b/src/main/java/com/wgcloud/mapper/FailureLoggingMapper.java new file mode 100644 index 0000000..723658d --- /dev/null +++ b/src/main/java/com/wgcloud/mapper/FailureLoggingMapper.java @@ -0,0 +1,18 @@ +package com.wgcloud.mapper; + +import com.wgcloud.entity.FailureLogging; +import com.wgcloud.entity.WorkLogging; +import org.springframework.stereotype.Repository; + +/** + * @author kdq + * @version 1.0.0 + * @ClassName FailureLoggingMapper.java + * @Description TODO + * @createTime 2022骞�12鏈�16鏃� 17:32:00 + */ +@Repository +public interface FailureLoggingMapper { + + public void save(FailureLogging failureLogging) throws Exception; +} diff --git a/src/main/java/com/wgcloud/service/FailureLoggingService.java b/src/main/java/com/wgcloud/service/FailureLoggingService.java new file mode 100644 index 0000000..ea3c351 --- /dev/null +++ b/src/main/java/com/wgcloud/service/FailureLoggingService.java @@ -0,0 +1,14 @@ +package com.wgcloud.service; + +import org.springframework.stereotype.Service; + +/** + * @author kdq + * @version 1.0.0 + * @ClassName FailureLoggingService.java + * @Description TODO + * @createTime 2022骞�12鏈�16鏃� 17:32:00 + */ +@Service +public class FailureLoggingService { +} diff --git a/src/main/java/com/wgcloud/service/InspectionTaskService.java b/src/main/java/com/wgcloud/service/InspectionTaskService.java new file mode 100644 index 0000000..d9eff80 --- /dev/null +++ b/src/main/java/com/wgcloud/service/InspectionTaskService.java @@ -0,0 +1,24 @@ +package com.wgcloud.service; + +import com.wgcloud.entity.InspectionTask; +import com.wgcloud.entity.TaskInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * @author kdq + * @version 1.0.0 + * @ClassName InspectionTaskService.java + * @Description TODO + * @createTime 2022骞�12鏈�16鏃� 16:52:00 + */ +@Service +public class InspectionTaskService { + + @Autowired + private InspectionTaskService inspectionTaskService; + + public void save(InspectionTask inspectionTask) throws Exception { + inspectionTaskService.save(inspectionTask); + } +} diff --git a/src/main/java/com/wgcloud/service/TaskInfoService.java b/src/main/java/com/wgcloud/service/TaskInfoService.java new file mode 100644 index 0000000..11706e8 --- /dev/null +++ b/src/main/java/com/wgcloud/service/TaskInfoService.java @@ -0,0 +1,31 @@ +package com.wgcloud.service; + +import com.wgcloud.entity.FailureLogging; +import com.wgcloud.entity.TaskInfo; +import com.wgcloud.mapper.TaskInfoMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author kdq + * @version 1.0.0 + * @ClassName TaskInfoService.java + * @Description TODO + * @createTime 2022骞�12鏈�16鏃� 15:50:00 + */ +@Service +public class TaskInfoService { + + @Autowired + private TaskInfoMapper taskInfoMapper; + + public void save(TaskInfo taskInfo) throws Exception { + taskInfoMapper.save(taskInfo); + } + + public void saveAll(List<TaskInfo> taskInfos) throws Exception { + taskInfoMapper.insertList(taskInfos); + } +} diff --git a/src/main/resources/mybatis/mapper/FailureLoggingMapper.xml b/src/main/resources/mybatis/mapper/FailureLoggingMapper.xml new file mode 100644 index 0000000..c0d6601 --- /dev/null +++ b/src/main/resources/mybatis/mapper/FailureLoggingMapper.xml @@ -0,0 +1,125 @@ +<?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.wgcloud.mapper.FailureLoggingMapper"> + <resultMap id="resultMap" type="com.wgcloud.entity.FailureLogging"> + <id column="ID" property="id" jdbcType="CHAR" /> + <result column="OLD_DEVICE_NAME" property="oldDeviceName" jdbcType="CHAR" /> + <result column="OLD_DEVICE_IP" property="oldDeviceIp" jdbcType="CHAR" /> + <result column="OLD_DEVICE_MODEL" property="oldDeviceModel" jdbcType="CHAR" /> + <result column="NEW_DEVICE_NAME" property="newDeviceName" jdbcType="CHAR" /> + <result column="NEW_DEVICE_IP" property="newDeviceIp" jdbcType="CHAR" /> + <result column="NEW_DEVICE_MODEL" property="newDeviceModel" jdbcType="CHAR" /> + <result column="PERSON_NAME" property="personName" jdbcType="CHAR" /> + <result column="PERSON_DATE" property="personDate" jdbcType="TIMESTAMP" /> + </resultMap> + + <sql id="tableColumnList"> + ID,OLD_DEVICE_NAME, OLD_DEVICE_IP,OLD_DEVICE_MODEL,NEW_DEVICE_NAME,NEW_DEVICE_IP,NEW_DEVICE_MODEL,PERSON_NAME,PERSON_DATE + </sql> + + <select id="selectById" resultMap="resultMap" parameterType="java.lang.String"> + SELECT + <include refid="tableColumnList" /> + FROM FAILURE_LOGGING + WHERE ID=#{id} + </select> + + + <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> + DELETE FROM FAILURE_LOGGING + WHERE ID = #{id} + </delete> + + <delete id="deleteById" parameterType="java.lang.String"> + DELETE FROM + FAILURE_LOGGING + WHERE ID IN + <foreach item="item" index="index" collection="array" open="(" separator="," close=")"> + #{item} + </foreach> + </delete> + + <insert id="save" parameterType="com.wgcloud.entity.WorkLogging"> + INSERT INTO FAILURE_LOGGING + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="id != null" >ID,</if> + <if test="oldDeviceName != null" >OLD_DEVICE_NAME,</if> + <if test="oldDeviceIp != null" >OLD_DEVICE_IP,</if> + <if test="oldDeviceModel != null" >OLD_DEVICE_MODEL,</if> + <if test="newDeviceName != null" >NEW_DEVICE_NAME,</if> + <if test="newDeviceIp != null" >NEW_DEVICE_IP,</if> + <if test="newDeviceModel != null" >NEW_DEVICE_MODEL,</if> + <if test="personName != null" >PERSON_NAME,</if> + <if test="personDate != null" >PERSON_DATE</if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="id != null" >#{id},</if> + <if test="oldDeviceName != null" >#{oldDeviceName},</if> + <if test="oldDeviceIp != null" >#{oldDeviceIp},</if> + <if test="oldDeviceModel != null" >#{oldDeviceModel},</if> + <if test="newDeviceName != null" >#{newDeviceName},</if> + <if test="newDeviceIp != null" >#{newDeviceIp},</if> + <if test="newDeviceModel != null" >#{newDeviceModel},</if> + <if test="personName != null" >#{personName},</if> + <if test="personDate != null" >#{personDate}</if> + </trim> + </insert> + + <insert id="insertList" parameterType="java.util.List" > + <choose> + <when test="_databaseId == 'oracle'"> + begin + <foreach collection="list" item="item" index="index"> + INSERT INTO FAILURE_LOGGING (ID,OLD_DEVICE_NAME, OLD_DEVICE_IP,OLD_DEVICE_MODEL,NEW_DEVICE_NAME,NEW_DEVICE_IP,NEW_DEVICE_MODEL,PERSON_NAME,PERSON_DATE) VALUES + (#{item.id},#{item.oldDeviceName},#{item.oldDeviceIp},#{item.oldDeviceModel},#{item.newDeviceName},#{item.newDeviceIp},#{item.newDeviceModel},#{item.personName},#{item.personDate}); + </foreach> + end; + </when> + <otherwise> + INSERT INTO FAILURE_LOGGING (ID,OLD_DEVICE_NAME, OLD_DEVICE_IP,OLD_DEVICE_MODEL,NEW_DEVICE_NAME,NEW_DEVICE_IP,NEW_DEVICE_MODEL,PERSON_NAME,PERSON_DATE) VALUES + <foreach collection="list" item="item" index="index" separator="," > + (#{item.id},#{item.oldDeviceName},#{item.oldDeviceIp},#{item.oldDeviceModel},#{item.newDeviceName},#{item.newDeviceIp},#{item.newDeviceModel},#{item.personName},#{item.personDate}); + </foreach> + </otherwise> + </choose> + </insert> + + + <select id="countByParams" parameterType="map" resultType="java.lang.Integer"> + SELECT count(*) FROM FAILURE_LOGGING t + <where> + <include refid="queryByParams" /> + </where> + </select> + + + <select id="selectAllByParams" parameterType="map" resultMap="resultMap"> + SELECT + <include refid="tableColumnList" /> + FROM FAILURE_LOGGING t + <where> + <include refid="queryByParams" /> + </where> + ORDER BY ID DESC + </select> + + <select id="selectByParams" parameterType="map" resultMap="resultMap"> + SELECT + <include refid="tableColumnList" /> + FROM FAILURE_LOGGING + <where> + <include refid="queryByParams" /> + </where> + <choose> + <when test="orderBy !=null and orderBy != ''"> + <![CDATA[ ORDER BY ${orderBy} ${orderType}]]> + </when> + <otherwise> + ORDER BY ID DESC + </otherwise> + </choose> + + </select> + + +</mapper> -- Gitblit v1.9.1