yz
parent 149f656ee1
commit 36a2a3b903

@ -0,0 +1,213 @@
package com.sztzjy.fund_investment.controller;
import cn.hutool.core.date.DateTime;
import com.sztzjy.fund_investment.annotation.AnonymousAccess;
import com.sztzjy.fund_investment.entity.*;
import com.sztzjy.fund_investment.mapper.IpLogMapper;
import com.sztzjy.fund_investment.mapper.SysLogTestMapper;
import com.sztzjy.fund_investment.mapper.SysLoginLogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.*;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
//用于生成日志文件
@RestController
@RequestMapping("/stu/sysLogController")
public class SysLogController {
@Autowired
SysLoginLogMapper logMapper;
@Autowired
SysLogTestMapper logTestMapper;
@Autowired
IpLogMapper ipLogMapper;
@GetMapping("insertSysLog")
@AnonymousAccess
public void insertSysLog() {
List<IpLog> ipLogs = ipLogMapper.selectByExample(new IpLogExample());
Integer flag=1;
List<SysLogTest> sysLogTests = logTestMapper.selectByExample(new SysLogTestExample());
List<SysLoginLog> insertLoginLogList=new ArrayList<>();
List<String> ip1 = getIp1();
List<String> ip2 = getIp2();
List<String> ipList=new ArrayList<>();
ipList.addAll(ip1);
ipList.addAll(ip2);
for (int j = 0; j < sysLogTests.size(); j++) {
SysLogTest sysLogTest=sysLogTests.get(j);
List<SysLoginLog> getLoginTimeList = getLoginTime(sysLogTest);
List<String> experimentSocreList = getExperimentSocreList(sysLogTest);
for (Integer i = 0; i < Integer.valueOf(sysLogTest.getLoginCount()); i++) {
SysLoginLog loginLog = new SysLoginLog();
loginLog.setId(String.valueOf(UUID.randomUUID()));
loginLog.setStudentNo(sysLogTest.getStudentNo());
loginLog.setStudnetName(sysLogTest.getStudnetName());
loginLog.setSchoolName(sysLogTest.getSchoolName());
loginLog.setProvince("安徽省");
loginLog.setExperimentName("虚拟仿真实验");
loginLog.setLoginTime(getLoginTimeList.get(i).getLoginTime());
loginLog.setOutTime(getLoginTimeList.get(i).getOutTime());
loginLog.setExperimentTime(getLoginTimeList.get(i).getExperimentTime());
loginLog.setExperimentSocre(experimentSocreList.get(i));
loginLog.setIsOnline("false");
if (j<100){
loginLog.setLoginIp(ipLogs.get(flag).getLoginIp());
loginLog.setIpHomePlace(ipLogs.get(flag).getIpHomePlace());
}else {
loginLog.setLoginIp(ipList.get(j));
ipList.remove(j);
loginLog.setIpHomePlace("安徽省");
}
flag++;
insertLoginLogList.add(loginLog);
}
}
for (int i = 0; i < insertLoginLogList.size(); i++) {
System.out.println(i);
logMapper.insert(insertLoginLogList.get(i));
}
System.out.println(111);
}
public List<SysLoginLog> getLoginTime(SysLogTest sysLogTest){
// LocalDateTime startDate = LocalDateTime.of(2019, 9, 2, 9, 0);
// LocalDateTime endDate = LocalDateTime.of(2019, 9, 27, 18, 0);
LocalDateTime startDate = LocalDateTime.of(Integer.valueOf(sysLogTest.getStartTimeYear()), Integer.valueOf(sysLogTest.getStartTimeMonth()),Integer.valueOf(sysLogTest.getStartTimeDay()), 9, 0);
LocalDateTime endDate = LocalDateTime.of(Integer.valueOf(sysLogTest.getEndTimeYear()), Integer.valueOf(sysLogTest.getEndTimeMonth()), Integer.valueOf(sysLogTest.getEndTimeDay()), 18, 0);
Set<String> generatedData = new HashSet<>();
List<SysLoginLog> loginLogList=new ArrayList<>();
Random random = new Random();
while (generatedData.size() < Integer.valueOf(sysLogTest.getLoginCount())) {
LocalDateTime loginTime = null;
do {
int loginHour = random.nextInt(10) + 9; // 生成随机的 9 到 18 点之间的小时
int loginMinute = random.nextInt(60); // 生成随机的分钟
loginTime = startDate.plusDays(random.nextInt(26)).withHour(loginHour).withMinute(loginMinute);
} while (loginTime.getHour() >= 18); // 确保登录时间在 18 点之前
LocalDateTime logoutTime = loginTime.plusMinutes(random.nextInt(51) + 10);
long loginDuration = ChronoUnit.MINUTES.between(loginTime, logoutTime);
if (logoutTime.isBefore(endDate) && loginDuration >= 10 && loginDuration <= 60) {
String data = "登录时间: " + loginTime + ", 登出时间: " + logoutTime + ", 登录时长: " + loginDuration + "分钟";
generatedData.add(data);
SysLoginLog sysLoginLog = new SysLoginLog();
sysLoginLog.setLoginTime(Date.from(loginTime.atZone(ZoneId.systemDefault()).toInstant()));
sysLoginLog.setOutTime(Date.from(logoutTime.atZone(ZoneId.systemDefault()).toInstant()));
sysLoginLog.setExperimentTime(String.valueOf(loginDuration));
loginLogList.add(sysLoginLog);
}
}
return loginLogList;
}
public List<String> getExperimentSocreList(SysLogTest sysLogTest){
List<String> experimentSocreList=new ArrayList<>();
int Y = Integer.parseInt(sysLogTest.getScore()); // 输入的数字Y
int X = Integer.parseInt(sysLogTest.getLoginCount()); // 输入的次数X
Random random = new Random();
int remainingSum = Y;
for (int i = 1; i < X; i++) {
int maxNumber = (int) (remainingSum * 0.4); // 每个数不能超过Y的40%
int randomNum = random.nextInt(Math.min(maxNumber, remainingSum - (X - i - 1))) + 1; // 保证随机数为正整数
experimentSocreList.add(String.valueOf(randomNum));
remainingSum -= randomNum;
}
experimentSocreList.add(String.valueOf(remainingSum));
return experimentSocreList;
}
public List<String> getIp1() {
List<String> list=new ArrayList<>();
String ipRangeStart = "211.70.168.11";
String ipRangeEnd = "211.70.168.250";
Random random = new Random();
for (int i = 0; i < 1000; i++) {
long randomIpAddress = generateRandomIpAddress(ipRangeStart, ipRangeEnd, random);
String ipAddress = convertIpAddressToString(randomIpAddress);
list.add(ipAddress);
}
return list;
}
private static long generateRandomIpAddress(String ipRangeStart, String ipRangeEnd, Random random) {
// Convert the start and end IP addresses to long values
long startIpAddress = convertIpAddressToLong(ipRangeStart);
long endIpAddress = convertIpAddressToLong(ipRangeEnd);
// Generate a random number between the start and end IP addresses
long randomIpAddress = startIpAddress + (long) (random.nextDouble() * (endIpAddress - startIpAddress + 1));
return randomIpAddress;
}
private static long convertIpAddressToLong(String ipAddress) {
// Split the IP address into four parts
String[] parts = ipAddress.split("\\.");
// Convert each part to a long value
long part1 = Long.parseLong(parts[0]);
long part2 = Long.parseLong(parts[1]);
long part3 = Long.parseLong(parts[2]);
long part4 = Long.parseLong(parts[3]);
// Calculate the long value of the IP address
long ipAddressLong = (part1 << 24) | (part2 << 16) | (part3 << 8) | part4;
return ipAddressLong;
}
private static String convertIpAddressToString(long ipAddressLong) {
// Calculate each part of the IP address
long part1 = (ipAddressLong >> 24) & 0xFF;
long part2 = (ipAddressLong >> 16) & 0xFF;
long part3 = (ipAddressLong >> 8) & 0xFF;
long part4 = ipAddressLong & 0xFF;
// Convert each part to a string
String part1String = String.valueOf(part1);
String part2String = String.valueOf(part2);
String part3String = String.valueOf(part3);
String part4String = String.valueOf(part4);
// Join the parts together to form the IP address string
String ipAddressString = part1String + "." + part2String + "." + part3String + "." + part4String;
return ipAddressString;
}
public List<String> getIp2() {
ArrayList<String> list = new ArrayList<>();
Random random = new Random();
for (int i = 0; i < 8000; i++) {
int thirdOctet = random.nextInt(100);
int fourthOctet = random.nextInt(100);
// Create the IP address string
String ipAddress = "10.7." + thirdOctet + "." + fourthOctet;
list.add(ipAddress);
}
return list;
}
}

@ -0,0 +1,32 @@
package com.sztzjy.fund_investment.mapper;
import com.sztzjy.fund_investment.entity.IpLog;
import com.sztzjy.fund_investment.entity.IpLogExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface IpLogMapper {
long countByExample(IpLogExample example);
int deleteByExample(IpLogExample example);
int deleteByPrimaryKey(String id);
int insert(IpLog record);
int insertSelective(IpLog record);
List<IpLog> selectByExample(IpLogExample example);
IpLog selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") IpLog record, @Param("example") IpLogExample example);
int updateByExample(@Param("record") IpLog record, @Param("example") IpLogExample example);
int updateByPrimaryKeySelective(IpLog record);
int updateByPrimaryKey(IpLog record);
}

@ -0,0 +1,32 @@
package com.sztzjy.fund_investment.mapper;
import com.sztzjy.fund_investment.entity.SysLogTest;
import com.sztzjy.fund_investment.entity.SysLogTestExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface SysLogTestMapper {
long countByExample(SysLogTestExample example);
int deleteByExample(SysLogTestExample example);
int deleteByPrimaryKey(String id);
int insert(SysLogTest record);
int insertSelective(SysLogTest record);
List<SysLogTest> selectByExample(SysLogTestExample example);
SysLogTest selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") SysLogTest record, @Param("example") SysLogTestExample example);
int updateByExample(@Param("record") SysLogTest record, @Param("example") SysLogTestExample example);
int updateByPrimaryKeySelective(SysLogTest record);
int updateByPrimaryKey(SysLogTest record);
}

@ -0,0 +1,32 @@
package com.sztzjy.fund_investment.mapper;
import com.sztzjy.fund_investment.entity.SysLoginLog;
import com.sztzjy.fund_investment.entity.SysLoginLogExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface SysLoginLogMapper {
long countByExample(SysLoginLogExample example);
int deleteByExample(SysLoginLogExample example);
int deleteByPrimaryKey(String id);
int insert(SysLoginLog record);
int insertSelective(SysLoginLog record);
List<SysLoginLog> selectByExample(SysLoginLogExample example);
SysLoginLog selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") SysLoginLog record, @Param("example") SysLoginLogExample example);
int updateByExample(@Param("record") SysLoginLog record, @Param("example") SysLoginLogExample example);
int updateByPrimaryKeySelective(SysLoginLog record);
int updateByPrimaryKey(SysLoginLog record);
}

@ -0,0 +1,181 @@
<?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.sztzjy.fund_investment.mapper.IpLogMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.fund_investment.entity.IpLog">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="login_ip" jdbcType="VARCHAR" property="loginIp" />
<result column="ip_home_place" jdbcType="VARCHAR" property="ipHomePlace" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, login_ip, ip_home_place
</sql>
<select id="selectByExample" parameterType="com.sztzjy.fund_investment.entity.IpLogExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from ip_log
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from ip_log
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from ip_log
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.fund_investment.entity.IpLogExample">
delete from ip_log
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.fund_investment.entity.IpLog">
insert into ip_log (id, login_ip, ip_home_place
)
values (#{id,jdbcType=VARCHAR}, #{loginIp,jdbcType=VARCHAR}, #{ipHomePlace,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.fund_investment.entity.IpLog">
insert into ip_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="loginIp != null">
login_ip,
</if>
<if test="ipHomePlace != null">
ip_home_place,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="loginIp != null">
#{loginIp,jdbcType=VARCHAR},
</if>
<if test="ipHomePlace != null">
#{ipHomePlace,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.fund_investment.entity.IpLogExample" resultType="java.lang.Long">
select count(*) from ip_log
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update ip_log
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.loginIp != null">
login_ip = #{record.loginIp,jdbcType=VARCHAR},
</if>
<if test="record.ipHomePlace != null">
ip_home_place = #{record.ipHomePlace,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update ip_log
set id = #{record.id,jdbcType=VARCHAR},
login_ip = #{record.loginIp,jdbcType=VARCHAR},
ip_home_place = #{record.ipHomePlace,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.fund_investment.entity.IpLog">
update ip_log
<set>
<if test="loginIp != null">
login_ip = #{loginIp,jdbcType=VARCHAR},
</if>
<if test="ipHomePlace != null">
ip_home_place = #{ipHomePlace,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.fund_investment.entity.IpLog">
update ip_log
set login_ip = #{loginIp,jdbcType=VARCHAR},
ip_home_place = #{ipHomePlace,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

@ -0,0 +1,371 @@
<?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.sztzjy.fund_investment.mapper.SysLogTestMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.fund_investment.entity.SysLogTest">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="student_no" jdbcType="VARCHAR" property="studentNo" />
<result column="studnet_name" jdbcType="VARCHAR" property="studnetName" />
<result column="school_name" jdbcType="VARCHAR" property="schoolName" />
<result column="major" jdbcType="VARCHAR" property="major" />
<result column="class_name" jdbcType="VARCHAR" property="className" />
<result column="start_year_time" jdbcType="VARCHAR" property="startYearTime" />
<result column="login_count" jdbcType="VARCHAR" property="loginCount" />
<result column="score" jdbcType="VARCHAR" property="score" />
<result column="start_time_year" jdbcType="VARCHAR" property="startTimeYear" />
<result column="start_time_month" jdbcType="VARCHAR" property="startTimeMonth" />
<result column="start_time_day" jdbcType="VARCHAR" property="startTimeDay" />
<result column="end_time_year" jdbcType="VARCHAR" property="endTimeYear" />
<result column="end_time_month" jdbcType="VARCHAR" property="endTimeMonth" />
<result column="end_time_day" jdbcType="VARCHAR" property="endTimeDay" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, student_no, studnet_name, school_name, major, class_name, start_year_time, login_count,
score, start_time_year, start_time_month, start_time_day, end_time_year, end_time_month,
end_time_day
</sql>
<select id="selectByExample" parameterType="com.sztzjy.fund_investment.entity.SysLogTestExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from sys_log_test
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sys_log_test
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from sys_log_test
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.fund_investment.entity.SysLogTestExample">
delete from sys_log_test
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.fund_investment.entity.SysLogTest">
insert into sys_log_test (id, student_no, studnet_name,
school_name, major, class_name,
start_year_time, login_count, score,
start_time_year, start_time_month, start_time_day,
end_time_year, end_time_month, end_time_day
)
values (#{id,jdbcType=VARCHAR}, #{studentNo,jdbcType=VARCHAR}, #{studnetName,jdbcType=VARCHAR},
#{schoolName,jdbcType=VARCHAR}, #{major,jdbcType=VARCHAR}, #{className,jdbcType=VARCHAR},
#{startYearTime,jdbcType=VARCHAR}, #{loginCount,jdbcType=VARCHAR}, #{score,jdbcType=VARCHAR},
#{startTimeYear,jdbcType=VARCHAR}, #{startTimeMonth,jdbcType=VARCHAR}, #{startTimeDay,jdbcType=VARCHAR},
#{endTimeYear,jdbcType=VARCHAR}, #{endTimeMonth,jdbcType=VARCHAR}, #{endTimeDay,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.fund_investment.entity.SysLogTest">
insert into sys_log_test
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="studentNo != null">
student_no,
</if>
<if test="studnetName != null">
studnet_name,
</if>
<if test="schoolName != null">
school_name,
</if>
<if test="major != null">
major,
</if>
<if test="className != null">
class_name,
</if>
<if test="startYearTime != null">
start_year_time,
</if>
<if test="loginCount != null">
login_count,
</if>
<if test="score != null">
score,
</if>
<if test="startTimeYear != null">
start_time_year,
</if>
<if test="startTimeMonth != null">
start_time_month,
</if>
<if test="startTimeDay != null">
start_time_day,
</if>
<if test="endTimeYear != null">
end_time_year,
</if>
<if test="endTimeMonth != null">
end_time_month,
</if>
<if test="endTimeDay != null">
end_time_day,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="studentNo != null">
#{studentNo,jdbcType=VARCHAR},
</if>
<if test="studnetName != null">
#{studnetName,jdbcType=VARCHAR},
</if>
<if test="schoolName != null">
#{schoolName,jdbcType=VARCHAR},
</if>
<if test="major != null">
#{major,jdbcType=VARCHAR},
</if>
<if test="className != null">
#{className,jdbcType=VARCHAR},
</if>
<if test="startYearTime != null">
#{startYearTime,jdbcType=VARCHAR},
</if>
<if test="loginCount != null">
#{loginCount,jdbcType=VARCHAR},
</if>
<if test="score != null">
#{score,jdbcType=VARCHAR},
</if>
<if test="startTimeYear != null">
#{startTimeYear,jdbcType=VARCHAR},
</if>
<if test="startTimeMonth != null">
#{startTimeMonth,jdbcType=VARCHAR},
</if>
<if test="startTimeDay != null">
#{startTimeDay,jdbcType=VARCHAR},
</if>
<if test="endTimeYear != null">
#{endTimeYear,jdbcType=VARCHAR},
</if>
<if test="endTimeMonth != null">
#{endTimeMonth,jdbcType=VARCHAR},
</if>
<if test="endTimeDay != null">
#{endTimeDay,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.fund_investment.entity.SysLogTestExample" resultType="java.lang.Long">
select count(*) from sys_log_test
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update sys_log_test
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.studentNo != null">
student_no = #{record.studentNo,jdbcType=VARCHAR},
</if>
<if test="record.studnetName != null">
studnet_name = #{record.studnetName,jdbcType=VARCHAR},
</if>
<if test="record.schoolName != null">
school_name = #{record.schoolName,jdbcType=VARCHAR},
</if>
<if test="record.major != null">
major = #{record.major,jdbcType=VARCHAR},
</if>
<if test="record.className != null">
class_name = #{record.className,jdbcType=VARCHAR},
</if>
<if test="record.startYearTime != null">
start_year_time = #{record.startYearTime,jdbcType=VARCHAR},
</if>
<if test="record.loginCount != null">
login_count = #{record.loginCount,jdbcType=VARCHAR},
</if>
<if test="record.score != null">
score = #{record.score,jdbcType=VARCHAR},
</if>
<if test="record.startTimeYear != null">
start_time_year = #{record.startTimeYear,jdbcType=VARCHAR},
</if>
<if test="record.startTimeMonth != null">
start_time_month = #{record.startTimeMonth,jdbcType=VARCHAR},
</if>
<if test="record.startTimeDay != null">
start_time_day = #{record.startTimeDay,jdbcType=VARCHAR},
</if>
<if test="record.endTimeYear != null">
end_time_year = #{record.endTimeYear,jdbcType=VARCHAR},
</if>
<if test="record.endTimeMonth != null">
end_time_month = #{record.endTimeMonth,jdbcType=VARCHAR},
</if>
<if test="record.endTimeDay != null">
end_time_day = #{record.endTimeDay,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update sys_log_test
set id = #{record.id,jdbcType=VARCHAR},
student_no = #{record.studentNo,jdbcType=VARCHAR},
studnet_name = #{record.studnetName,jdbcType=VARCHAR},
school_name = #{record.schoolName,jdbcType=VARCHAR},
major = #{record.major,jdbcType=VARCHAR},
class_name = #{record.className,jdbcType=VARCHAR},
start_year_time = #{record.startYearTime,jdbcType=VARCHAR},
login_count = #{record.loginCount,jdbcType=VARCHAR},
score = #{record.score,jdbcType=VARCHAR},
start_time_year = #{record.startTimeYear,jdbcType=VARCHAR},
start_time_month = #{record.startTimeMonth,jdbcType=VARCHAR},
start_time_day = #{record.startTimeDay,jdbcType=VARCHAR},
end_time_year = #{record.endTimeYear,jdbcType=VARCHAR},
end_time_month = #{record.endTimeMonth,jdbcType=VARCHAR},
end_time_day = #{record.endTimeDay,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.fund_investment.entity.SysLogTest">
update sys_log_test
<set>
<if test="studentNo != null">
student_no = #{studentNo,jdbcType=VARCHAR},
</if>
<if test="studnetName != null">
studnet_name = #{studnetName,jdbcType=VARCHAR},
</if>
<if test="schoolName != null">
school_name = #{schoolName,jdbcType=VARCHAR},
</if>
<if test="major != null">
major = #{major,jdbcType=VARCHAR},
</if>
<if test="className != null">
class_name = #{className,jdbcType=VARCHAR},
</if>
<if test="startYearTime != null">
start_year_time = #{startYearTime,jdbcType=VARCHAR},
</if>
<if test="loginCount != null">
login_count = #{loginCount,jdbcType=VARCHAR},
</if>
<if test="score != null">
score = #{score,jdbcType=VARCHAR},
</if>
<if test="startTimeYear != null">
start_time_year = #{startTimeYear,jdbcType=VARCHAR},
</if>
<if test="startTimeMonth != null">
start_time_month = #{startTimeMonth,jdbcType=VARCHAR},
</if>
<if test="startTimeDay != null">
start_time_day = #{startTimeDay,jdbcType=VARCHAR},
</if>
<if test="endTimeYear != null">
end_time_year = #{endTimeYear,jdbcType=VARCHAR},
</if>
<if test="endTimeMonth != null">
end_time_month = #{endTimeMonth,jdbcType=VARCHAR},
</if>
<if test="endTimeDay != null">
end_time_day = #{endTimeDay,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.fund_investment.entity.SysLogTest">
update sys_log_test
set student_no = #{studentNo,jdbcType=VARCHAR},
studnet_name = #{studnetName,jdbcType=VARCHAR},
school_name = #{schoolName,jdbcType=VARCHAR},
major = #{major,jdbcType=VARCHAR},
class_name = #{className,jdbcType=VARCHAR},
start_year_time = #{startYearTime,jdbcType=VARCHAR},
login_count = #{loginCount,jdbcType=VARCHAR},
score = #{score,jdbcType=VARCHAR},
start_time_year = #{startTimeYear,jdbcType=VARCHAR},
start_time_month = #{startTimeMonth,jdbcType=VARCHAR},
start_time_day = #{startTimeDay,jdbcType=VARCHAR},
end_time_year = #{endTimeYear,jdbcType=VARCHAR},
end_time_month = #{endTimeMonth,jdbcType=VARCHAR},
end_time_day = #{endTimeDay,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

@ -0,0 +1,338 @@
<?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.sztzjy.fund_investment.mapper.SysLoginLogMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.fund_investment.entity.SysLoginLog">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="student_no" jdbcType="VARCHAR" property="studentNo" />
<result column="studnet_name" jdbcType="VARCHAR" property="studnetName" />
<result column="school_name" jdbcType="VARCHAR" property="schoolName" />
<result column="province" jdbcType="VARCHAR" property="province" />
<result column="experiment_name" jdbcType="VARCHAR" property="experimentName" />
<result column="login_time" jdbcType="TIMESTAMP" property="loginTime" />
<result column="out_time" jdbcType="TIMESTAMP" property="outTime" />
<result column="experiment_time" jdbcType="VARCHAR" property="experimentTime" />
<result column="is_online" jdbcType="VARCHAR" property="isOnline" />
<result column="login_ip" jdbcType="VARCHAR" property="loginIp" />
<result column="experiment_socre" jdbcType="VARCHAR" property="experimentSocre" />
<result column="ip_home_place" jdbcType="VARCHAR" property="ipHomePlace" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, student_no, studnet_name, school_name, province, experiment_name, login_time,
out_time, experiment_time, is_online, login_ip, experiment_socre, ip_home_place
</sql>
<select id="selectByExample" parameterType="com.sztzjy.fund_investment.entity.SysLoginLogExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from sys_login_log
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sys_login_log
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from sys_login_log
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.fund_investment.entity.SysLoginLogExample">
delete from sys_login_log
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.fund_investment.entity.SysLoginLog">
insert into sys_login_log (id, student_no, studnet_name,
school_name, province, experiment_name,
login_time, out_time, experiment_time,
is_online, login_ip, experiment_socre,
ip_home_place)
values (#{id,jdbcType=VARCHAR}, #{studentNo,jdbcType=VARCHAR}, #{studnetName,jdbcType=VARCHAR},
#{schoolName,jdbcType=VARCHAR}, #{province,jdbcType=VARCHAR}, #{experimentName,jdbcType=VARCHAR},
#{loginTime,jdbcType=TIMESTAMP}, #{outTime,jdbcType=TIMESTAMP}, #{experimentTime,jdbcType=VARCHAR},
#{isOnline,jdbcType=VARCHAR}, #{loginIp,jdbcType=VARCHAR}, #{experimentSocre,jdbcType=VARCHAR},
#{ipHomePlace,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.fund_investment.entity.SysLoginLog">
insert into sys_login_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="studentNo != null">
student_no,
</if>
<if test="studnetName != null">
studnet_name,
</if>
<if test="schoolName != null">
school_name,
</if>
<if test="province != null">
province,
</if>
<if test="experimentName != null">
experiment_name,
</if>
<if test="loginTime != null">
login_time,
</if>
<if test="outTime != null">
out_time,
</if>
<if test="experimentTime != null">
experiment_time,
</if>
<if test="isOnline != null">
is_online,
</if>
<if test="loginIp != null">
login_ip,
</if>
<if test="experimentSocre != null">
experiment_socre,
</if>
<if test="ipHomePlace != null">
ip_home_place,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="studentNo != null">
#{studentNo,jdbcType=VARCHAR},
</if>
<if test="studnetName != null">
#{studnetName,jdbcType=VARCHAR},
</if>
<if test="schoolName != null">
#{schoolName,jdbcType=VARCHAR},
</if>
<if test="province != null">
#{province,jdbcType=VARCHAR},
</if>
<if test="experimentName != null">
#{experimentName,jdbcType=VARCHAR},
</if>
<if test="loginTime != null">
#{loginTime,jdbcType=TIMESTAMP},
</if>
<if test="outTime != null">
#{outTime,jdbcType=TIMESTAMP},
</if>
<if test="experimentTime != null">
#{experimentTime,jdbcType=VARCHAR},
</if>
<if test="isOnline != null">
#{isOnline,jdbcType=VARCHAR},
</if>
<if test="loginIp != null">
#{loginIp,jdbcType=VARCHAR},
</if>
<if test="experimentSocre != null">
#{experimentSocre,jdbcType=VARCHAR},
</if>
<if test="ipHomePlace != null">
#{ipHomePlace,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.sztzjy.fund_investment.entity.SysLoginLogExample" resultType="java.lang.Long">
select count(*) from sys_login_log
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update sys_login_log
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.studentNo != null">
student_no = #{record.studentNo,jdbcType=VARCHAR},
</if>
<if test="record.studnetName != null">
studnet_name = #{record.studnetName,jdbcType=VARCHAR},
</if>
<if test="record.schoolName != null">
school_name = #{record.schoolName,jdbcType=VARCHAR},
</if>
<if test="record.province != null">
province = #{record.province,jdbcType=VARCHAR},
</if>
<if test="record.experimentName != null">
experiment_name = #{record.experimentName,jdbcType=VARCHAR},
</if>
<if test="record.loginTime != null">
login_time = #{record.loginTime,jdbcType=TIMESTAMP},
</if>
<if test="record.outTime != null">
out_time = #{record.outTime,jdbcType=TIMESTAMP},
</if>
<if test="record.experimentTime != null">
experiment_time = #{record.experimentTime,jdbcType=VARCHAR},
</if>
<if test="record.isOnline != null">
is_online = #{record.isOnline,jdbcType=VARCHAR},
</if>
<if test="record.loginIp != null">
login_ip = #{record.loginIp,jdbcType=VARCHAR},
</if>
<if test="record.experimentSocre != null">
experiment_socre = #{record.experimentSocre,jdbcType=VARCHAR},
</if>
<if test="record.ipHomePlace != null">
ip_home_place = #{record.ipHomePlace,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update sys_login_log
set id = #{record.id,jdbcType=VARCHAR},
student_no = #{record.studentNo,jdbcType=VARCHAR},
studnet_name = #{record.studnetName,jdbcType=VARCHAR},
school_name = #{record.schoolName,jdbcType=VARCHAR},
province = #{record.province,jdbcType=VARCHAR},
experiment_name = #{record.experimentName,jdbcType=VARCHAR},
login_time = #{record.loginTime,jdbcType=TIMESTAMP},
out_time = #{record.outTime,jdbcType=TIMESTAMP},
experiment_time = #{record.experimentTime,jdbcType=VARCHAR},
is_online = #{record.isOnline,jdbcType=VARCHAR},
login_ip = #{record.loginIp,jdbcType=VARCHAR},
experiment_socre = #{record.experimentSocre,jdbcType=VARCHAR},
ip_home_place = #{record.ipHomePlace,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.fund_investment.entity.SysLoginLog">
update sys_login_log
<set>
<if test="studentNo != null">
student_no = #{studentNo,jdbcType=VARCHAR},
</if>
<if test="studnetName != null">
studnet_name = #{studnetName,jdbcType=VARCHAR},
</if>
<if test="schoolName != null">
school_name = #{schoolName,jdbcType=VARCHAR},
</if>
<if test="province != null">
province = #{province,jdbcType=VARCHAR},
</if>
<if test="experimentName != null">
experiment_name = #{experimentName,jdbcType=VARCHAR},
</if>
<if test="loginTime != null">
login_time = #{loginTime,jdbcType=TIMESTAMP},
</if>
<if test="outTime != null">
out_time = #{outTime,jdbcType=TIMESTAMP},
</if>
<if test="experimentTime != null">
experiment_time = #{experimentTime,jdbcType=VARCHAR},
</if>
<if test="isOnline != null">
is_online = #{isOnline,jdbcType=VARCHAR},
</if>
<if test="loginIp != null">
login_ip = #{loginIp,jdbcType=VARCHAR},
</if>
<if test="experimentSocre != null">
experiment_socre = #{experimentSocre,jdbcType=VARCHAR},
</if>
<if test="ipHomePlace != null">
ip_home_place = #{ipHomePlace,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.fund_investment.entity.SysLoginLog">
update sys_login_log
set student_no = #{studentNo,jdbcType=VARCHAR},
studnet_name = #{studnetName,jdbcType=VARCHAR},
school_name = #{schoolName,jdbcType=VARCHAR},
province = #{province,jdbcType=VARCHAR},
experiment_name = #{experimentName,jdbcType=VARCHAR},
login_time = #{loginTime,jdbcType=TIMESTAMP},
out_time = #{outTime,jdbcType=TIMESTAMP},
experiment_time = #{experimentTime,jdbcType=VARCHAR},
is_online = #{isOnline,jdbcType=VARCHAR},
login_ip = #{loginIp,jdbcType=VARCHAR},
experiment_socre = #{experimentSocre,jdbcType=VARCHAR},
ip_home_place = #{ipHomePlace,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
Loading…
Cancel
Save