Commit 4450c729 by 钱炳权

参数配置开发:访问数据库搭建、列表查询、id查询

parent cc73d18d
package com.example.fuzzControll.aop;
import com.example.fuzzControll.annotion.NeedCutAround;
import com.example.fuzzControll.annotion.NeedCutBefore;
import com.example.fuzzControll.constents.MissionStateEnum;
import com.example.fuzzControll.constents.TableClassEnum;
import com.example.fuzzControll.constants.MissionStateEnum;
import com.example.fuzzControll.constants.TableClassEnum;
import com.example.fuzzControll.domain.po.MissionInfo;
import com.example.fuzzControll.exception.mysqlException.MysqlException;
import com.example.fuzzControll.exception.testException.AflnetException;
......@@ -11,7 +10,6 @@ import com.example.fuzzControll.exception.testException.KittyException;
import com.example.fuzzControll.tools.system.GlobalClass;
import com.example.fuzzControll.tools.system.SystemRunningParams;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
......
package com.example.fuzzControll.aop;
import com.example.fuzzControll.annotion.NeedCutBefore;
import com.example.fuzzControll.constents.CmdConstent;
import com.example.fuzzControll.constents.MissionStateEnum;
import com.example.fuzzControll.constents.TableClassEnum;
import com.example.fuzzControll.constants.CmdConstent;
import com.example.fuzzControll.constants.MissionStateEnum;
import com.example.fuzzControll.constants.TableClassEnum;
import com.example.fuzzControll.domain.po.MissionInfo;
import com.example.fuzzControll.exception.mysqlException.MysqlException;
import com.example.fuzzControll.exception.testException.AflnetException;
......@@ -13,9 +13,7 @@ import com.example.fuzzControll.tools.system.SystemRunningParams;
import com.example.fuzzControll.tools.test.SingleCmdTools;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
......@@ -23,9 +21,7 @@ import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
......
package com.example.fuzzControll.constents;
package com.example.fuzzControll.constants;
import com.example.fuzzControll.tools.system.GlobalClass;
......
package com.example.fuzzControll.constants;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@Getter
@Setter
public class FuzzParams {
private int id;
private String params;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date editTime;
}
package com.example.fuzzControll.controller.dataController;
import com.example.fuzzControll.constants.FuzzParams;
import com.example.fuzzControll.domain.vo.AjaxResult;
import com.example.fuzzControll.domain.vo.KittyResult;
import com.example.fuzzControll.service.FuzzParamsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/fuzzParams")
@Slf4j
public class FuzzParamsController {
@Autowired
FuzzParamsService fuzzParamsService;
/**
* 获取参数列表
*/
@RequestMapping(value = "/list", method = RequestMethod.GET)
public AjaxResult list() {
List<FuzzParams> results;
try {
results = fuzzParamsService.getFuzzParamsList();
} catch (Exception e) {
log.error("Get params of fuzz error:{}", e.getMessage());
return AjaxResult.error();
}
return AjaxResult.success(results);
}
/**
* 跟据id获取参数
*/
@RequestMapping(value = "/getParam/{id}", method = RequestMethod.GET)
public AjaxResult getById(@PathVariable("id") int id) {
FuzzParams result;
try {
result = fuzzParamsService.getFuzzParamById(id);
} catch (Exception e) {
log.error("Get params of fuzz with id error:{}", e.getMessage());
return AjaxResult.error();
}
return AjaxResult.success(result);
}
/**
* 跟据id修改参数
*/
@RequestMapping(value = "/editParam", method = RequestMethod.POST)
public AjaxResult editById(@RequestBody FuzzParams fuzzParams) {
boolean flag = false;
try {
flag = fuzzParamsService.editFuzzParams(fuzzParams);
} catch (Exception e) {
log.error("Edit params with id error:{}", e.getMessage());
return AjaxResult.error();
}
return AjaxResult.success(flag);
}
}
package com.example.fuzzControll.mapper;
import com.example.fuzzControll.constants.FuzzParams;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
import java.util.List;
@Mapper
@Component("FuzzParamsMapper")
public interface FuzzParamsMapper {
void saveFuzzParams(FuzzParams fuzzParams);
List<FuzzParams> getFuzzParamsList();
FuzzParams getFuzzParamsById(int id);
boolean editFuzzParams(FuzzParams fuzzParams);
}
package com.example.fuzzControll.service;
import com.example.fuzzControll.constants.FuzzParams;
import java.util.List;
public interface FuzzParamsService {
List<FuzzParams> getFuzzParamsList();
FuzzParams getFuzzParamById(int id);
//todo 使用切面在运行时插入参数
boolean saveFuzzParams(FuzzParams fuzzParams);
boolean editFuzzParams(FuzzParams fuzzParams);
}
package com.example.fuzzControll.service.impl;
import com.example.fuzzControll.conf.AflnetProperties;
import com.example.fuzzControll.constents.TableClassEnum;
import com.example.fuzzControll.exception.mysqlException.MysqlException;
import com.example.fuzzControll.mapper.AflnetMapper;
import com.example.fuzzControll.mapper.MissionInfoMapper;
import com.example.fuzzControll.domain.vo.AflnetResult;
import com.example.fuzzControll.domain.po.MissionInfo;
import com.example.fuzzControll.service.AflnetPersistenceService;
import com.example.fuzzControll.tools.file.FileTools;
import com.example.fuzzControll.tools.system.SystemRunningParams;
......@@ -15,8 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
@Slf4j
@Service("AflnetPersistenceService")
public class AflnetPersistenceServiceImpl implements AflnetPersistenceService {
......
package com.example.fuzzControll.service.impl;
import com.example.fuzzControll.constants.FuzzParams;
import com.example.fuzzControll.mapper.FuzzParamsMapper;
import com.example.fuzzControll.service.FuzzParamsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Slf4j
@Service("FuzzParamsService")
public class FuzzParamsServiceImpl implements FuzzParamsService {
@Autowired
FuzzParamsMapper fuzzParamsMapper;
@Override
public List<FuzzParams> getFuzzParamsList() {
List<FuzzParams> list = null;
try {
list = fuzzParamsMapper.getFuzzParamsList();
} catch (Exception e) {
log.error("FuzzParamsService.getFuzzParamsList error:{}",e.getMessage());
throw new RuntimeException(e);
}
return list;
}
@Override
public FuzzParams getFuzzParamById(int id) {
FuzzParams fuzzParams = null;
try {
fuzzParams = fuzzParamsMapper.getFuzzParamsById(id);
} catch (Exception e) {
log.error("FuzzParamsService.getFuzzParamById error:{}",e.getMessage());
throw new RuntimeException(e);
}
return fuzzParams;
}
@Override
public boolean saveFuzzParams(FuzzParams fuzzParams) {
return false;
}
@Override
public boolean editFuzzParams(FuzzParams fuzzParams) {
return fuzzParamsMapper.editFuzzParams(fuzzParams);
}
}
package com.example.fuzzControll.service.impl;
import com.example.fuzzControll.conf.KittyProperties;
import com.example.fuzzControll.constents.CmdConstent;
import com.example.fuzzControll.constants.CmdConstent;
import com.example.fuzzControll.exception.mysqlException.MysqlException;
import com.example.fuzzControll.mapper.KittyMapper;
import com.example.fuzzControll.domain.bo.KittyDataParams;
......
package com.example.fuzzControll.service.impl;
import com.example.fuzzControll.annotion.NeedCutAfter;
import com.example.fuzzControll.annotion.NeedCutAround;
import com.example.fuzzControll.annotion.NeedCutBefore;
import com.example.fuzzControll.conf.KittyProperties;
import com.example.fuzzControll.constents.MutationConstent;
import com.example.fuzzControll.constants.MutationConstent;
import com.example.fuzzControll.exception.testException.CmdException;
import com.example.fuzzControll.exception.testException.FuzzException;
import com.example.fuzzControll.domain.bo.TestEntity;
......
......@@ -2,10 +2,9 @@ package com.example.fuzzControll.service.impl;
import com.example.fuzzControll.annotion.NeedCutAround;
import com.example.fuzzControll.annotion.NeedCutBefore;
import com.example.fuzzControll.conf.KittyProperties;
import com.example.fuzzControll.constents.CmdConstent;
import com.example.fuzzControll.constents.ProtocolConstent;
import com.example.fuzzControll.constants.CmdConstent;
import com.example.fuzzControll.constants.ProtocolConstent;
import com.example.fuzzControll.exception.testException.CmdException;
import com.example.fuzzControll.exception.testException.FuzzException;
import com.example.fuzzControll.domain.bo.TestEntity;
......
package com.example.fuzzControll.service.impl;
import com.example.fuzzControll.conf.AflnetProperties;
import com.example.fuzzControll.constents.CmdConstent;
import com.example.fuzzControll.constants.CmdConstent;
import com.example.fuzzControll.exception.testException.CmdException;
import com.example.fuzzControll.exception.fileExcption.FileException;
import com.example.fuzzControll.service.SeedFileService;
......
......@@ -2,7 +2,7 @@ package com.example.fuzzControll.service.impl;
import com.example.fuzzControll.annotion.NeedCutBefore;
import com.example.fuzzControll.conf.AflnetProperties;
import com.example.fuzzControll.constents.CmdConstent;
import com.example.fuzzControll.constants.CmdConstent;
import com.example.fuzzControll.exception.testException.AflnetException;
import com.example.fuzzControll.exception.testException.CmdException;
import com.example.fuzzControll.domain.bo.CmdStartParams;
......
<?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.example.fuzzControll.mapper.FuzzParamsMapper">
<resultMap type="com.example.fuzzControll.constants.FuzzParams" id="fuzzParams">
<result property="id" column="id" />
<result property="params" column="params" />
<result property="editTime" column="editTime" />
</resultMap>
<sql id="selectFuzzParams">
select id, params,editTime from fuzz_params
</sql>
<insert id="saveFuzzParams">
insert into fuzz_params(id, params,editTime) values(#{id}, #{params},#{editTime})
</insert>
<update id="editFuzzParams">
</update>
<select id="getFuzzParamsById" resultMap="fuzzParams">
<include refid="selectFuzzParams"/>
where id = #{id}
</select>
<select id="getFuzzParamsList" resultMap="fuzzParams">
<include refid="selectFuzzParams"/>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment