增加sqlserver数据库支持
This commit is contained in:
parent
27e85b00ec
commit
0633a5e63d
File diff suppressed because one or more lines are too long
|
@ -17,6 +17,7 @@ import org.activiti.engine.TaskService;
|
|||
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||
import org.activiti.spring.ProcessEngineFactoryBean;
|
||||
import org.activiti.spring.SpringProcessEngineConfiguration;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
@ -30,6 +31,9 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
|
|||
@Configuration
|
||||
public class ActivitiConfig {
|
||||
|
||||
@Value("${dataType}")
|
||||
private String dataType;
|
||||
|
||||
/**
|
||||
* spring 集成 activiti
|
||||
*/
|
||||
|
@ -40,7 +44,7 @@ public class ActivitiConfig {
|
|||
//表不存在创建表
|
||||
processEngineConfiguration.setDatabaseSchemaUpdate("true");
|
||||
//指定数据库
|
||||
processEngineConfiguration.setDatabaseType("mysql");
|
||||
processEngineConfiguration.setDatabaseType(dataType);
|
||||
processEngineConfiguration.setTransactionManager(transactionManager);
|
||||
//历史变量
|
||||
processEngineConfiguration.setHistory("full");
|
||||
|
|
|
@ -27,9 +27,6 @@
|
|||
where sid = #{sid,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.len.entity.ActAssignee">
|
||||
<selectKey resultType="String" keyProperty="id" order="BEFORE">
|
||||
select replace(uuid(),"-","") from dual
|
||||
</selectKey>
|
||||
insert into act_assignee (id, sid, assignee,
|
||||
role_id, assignee_type, activti_name
|
||||
)
|
||||
|
@ -38,9 +35,6 @@
|
|||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.len.entity.ActAssignee">
|
||||
<selectKey resultType="String" keyProperty="id" order="BEFORE">
|
||||
select replace(uuid(),"-","") from dual
|
||||
</selectKey>
|
||||
insert into act_assignee
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
|
|
|
@ -31,9 +31,6 @@
|
|||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.len.entity.UserLeave">
|
||||
<selectKey resultType="String" keyProperty="id" order="BEFORE">
|
||||
select replace(uuid(),"-","") from dual
|
||||
</selectKey>
|
||||
insert into user_leave (id, user_id, user_name,
|
||||
begin_time, end_time, reason,
|
||||
days, process_instance_Id, status,
|
||||
|
@ -46,9 +43,6 @@
|
|||
#{updateBy,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.len.entity.UserLeave">
|
||||
<selectKey resultType="String" keyProperty="id" order="BEFORE">
|
||||
select replace(uuid(),"-","") from dual
|
||||
</selectKey>
|
||||
insert into user_leave
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
|
|
|
@ -27,5 +27,13 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/javax.mail/mail -->
|
||||
<dependency>
|
||||
<groupId>javax.mail</groupId>
|
||||
<artifactId>mail</artifactId>
|
||||
<version>1.5.0-b01</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.io.Serializable;
|
|||
import java.lang.reflect.Field;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
|
@ -35,6 +36,11 @@ public abstract class BaseServiceImpl<T, E extends Serializable> implements Base
|
|||
|
||||
private static final String UPDATE_DATE = "updateDate";
|
||||
|
||||
//系统默认 id 如果主键为其他字段 则需要自己手动 生成 写入 id
|
||||
private static final String ID = "id";
|
||||
|
||||
private static final String STR = "java.lang.String";
|
||||
|
||||
public abstract BaseMapper<T, E> getMappser();
|
||||
|
||||
@Override
|
||||
|
@ -62,12 +68,21 @@ public abstract class BaseServiceImpl<T, E extends Serializable> implements Base
|
|||
String operator, operateDate;
|
||||
try {
|
||||
if (flag) {
|
||||
//添加 id uuid支持
|
||||
Field idField = clazz.getDeclaredField(ID);
|
||||
idField.setAccessible(true);
|
||||
Object o = idField.get(record);
|
||||
Class<?> type = idField.getType();
|
||||
String name = type.getName();
|
||||
if ((o == null) && STR.equals(name)) {
|
||||
//已经有值的情况下 不覆盖
|
||||
idField.set(record, UUID.randomUUID().toString().replace("-", "").toLowerCase());
|
||||
}
|
||||
operator = CREATE_BY;
|
||||
operateDate = CREATE_DATE;
|
||||
} else {
|
||||
operator = UPDATE_BY;
|
||||
operateDate = UPDATE_DATE;
|
||||
|
||||
}
|
||||
Field field = clazz.getDeclaredField(operator);
|
||||
field.setAccessible(true);
|
||||
|
|
|
@ -3,141 +3,131 @@ package com.len.core.quartz;
|
|||
import com.len.core.annotation.Log;
|
||||
import com.len.core.annotation.Log.LOG_TYPE;
|
||||
import com.len.entity.SysJob;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.quartz.CronScheduleBuilder;
|
||||
import org.quartz.CronTrigger;
|
||||
import org.quartz.JobBuilder;
|
||||
import org.quartz.JobDetail;
|
||||
import org.quartz.JobKey;
|
||||
import org.quartz.Scheduler;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.quartz.Trigger;
|
||||
import org.quartz.TriggerBuilder;
|
||||
import org.quartz.TriggerKey;
|
||||
import org.quartz.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* @author zhuxiaomeng
|
||||
* @date 2018/1/5.
|
||||
* @email 154040976@qq.com
|
||||
*
|
||||
* <p>
|
||||
* 定时任务类 增删改 可参考api:http://www.quartz-scheduler.org/api/2.2.1/
|
||||
*
|
||||
* <p>
|
||||
* 任务名称 默认为 SysJob 类 id
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class JobTask {
|
||||
|
||||
@Autowired
|
||||
SchedulerFactoryBean schedulerFactoryBean;
|
||||
@Autowired
|
||||
SchedulerFactoryBean schedulerFactoryBean;
|
||||
|
||||
/**
|
||||
* true 存在 false 不存在
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public boolean checkJob(SysJob job){
|
||||
Scheduler scheduler = schedulerFactoryBean.getScheduler();
|
||||
TriggerKey triggerKey = TriggerKey.triggerKey(job.getId(), Scheduler.DEFAULT_GROUP);
|
||||
try {
|
||||
if(scheduler.checkExists(triggerKey)){
|
||||
return true;
|
||||
}
|
||||
} catch (SchedulerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启
|
||||
*/
|
||||
@Log(desc = "开启定时任务")
|
||||
public boolean startJob(SysJob job) {
|
||||
Scheduler scheduler = schedulerFactoryBean.getScheduler();
|
||||
try {
|
||||
Class clazz = Class.forName(job.getClazzPath());
|
||||
JobDetail jobDetail = JobBuilder.newJob(clazz).build();
|
||||
// 触发器
|
||||
TriggerKey triggerKey = TriggerKey.triggerKey(job.getId(), Scheduler.DEFAULT_GROUP);
|
||||
CronTrigger trigger = TriggerBuilder.newTrigger()
|
||||
.withIdentity(triggerKey)
|
||||
.withSchedule(CronScheduleBuilder.cronSchedule(job.getCron())).build();
|
||||
scheduler.scheduleJob(jobDetail, trigger);
|
||||
// 启动
|
||||
if (!scheduler.isShutdown()) {
|
||||
scheduler.start();
|
||||
log.info("---任务[" + triggerKey.getName() + "]启动成功-------");
|
||||
return true;
|
||||
}else{
|
||||
log.info("---任务[" + triggerKey.getName() + "]已经运行,请勿再次启动-------");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
@Log(desc = "更新定时任务", type = LOG_TYPE.UPDATE)
|
||||
public boolean updateJob(SysJob job) {
|
||||
Scheduler scheduler = schedulerFactoryBean.getScheduler();
|
||||
String createTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
TriggerKey triggerKey = TriggerKey.triggerKey(job.getId(), Scheduler.DEFAULT_GROUP);
|
||||
try {
|
||||
if (scheduler.checkExists(triggerKey)) {
|
||||
/**
|
||||
* true 存在 false 不存在
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public boolean checkJob(SysJob job) {
|
||||
Scheduler scheduler = schedulerFactoryBean.getScheduler();
|
||||
TriggerKey triggerKey = TriggerKey.triggerKey(job.getId(), Scheduler.DEFAULT_GROUP);
|
||||
try {
|
||||
if (scheduler.checkExists(triggerKey)) {
|
||||
return true;
|
||||
}
|
||||
} catch (SchedulerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
JobKey jobKey = JobKey.jobKey(job.getId(), Scheduler.DEFAULT_GROUP);
|
||||
|
||||
CronScheduleBuilder schedBuilder = CronScheduleBuilder.cronSchedule(job.getCron())
|
||||
.withMisfireHandlingInstructionDoNothing();
|
||||
CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(triggerKey)
|
||||
.withDescription(createTime).withSchedule(schedBuilder).build();
|
||||
Class clazz = null;
|
||||
JobDetail jobDetail = scheduler.getJobDetail(jobKey);
|
||||
HashSet<Trigger> triggerSet = new HashSet<>();
|
||||
triggerSet.add(trigger);
|
||||
scheduler.scheduleJob(jobDetail, triggerSet, true);
|
||||
log.info("---任务["+triggerKey.getName()+"]更新成功-------");
|
||||
return true;
|
||||
} catch (SchedulerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@Log(desc = "删除定时任务", type = LOG_TYPE.DEL)
|
||||
public boolean remove(SysJob job) {
|
||||
Scheduler scheduler = schedulerFactoryBean.getScheduler();
|
||||
TriggerKey triggerKey = TriggerKey.triggerKey(job.getId(), Scheduler.DEFAULT_GROUP);
|
||||
try {
|
||||
if (checkJob(job)) {
|
||||
scheduler.pauseTrigger(triggerKey);
|
||||
scheduler.unscheduleJob(triggerKey);
|
||||
scheduler.deleteJob(JobKey.jobKey(job.getId(), Scheduler.DEFAULT_GROUP));
|
||||
log.info("---任务[" + triggerKey.getName() + "]删除成功-------");
|
||||
return true;
|
||||
}
|
||||
} catch (SchedulerException e) {
|
||||
e.printStackTrace();
|
||||
/**
|
||||
* 开启
|
||||
*/
|
||||
@Log(desc = "开启定时任务")
|
||||
public boolean startJob(SysJob job) {
|
||||
Scheduler scheduler = schedulerFactoryBean.getScheduler();
|
||||
try {
|
||||
Class clazz = Class.forName(job.getClazzPath());
|
||||
JobDetail jobDetail = JobBuilder.newJob(clazz).build();
|
||||
// 触发器
|
||||
TriggerKey triggerKey = TriggerKey.triggerKey(job.getId(), Scheduler.DEFAULT_GROUP);
|
||||
CronTrigger trigger = TriggerBuilder.newTrigger()
|
||||
.withIdentity(triggerKey)
|
||||
.withSchedule(CronScheduleBuilder.cronSchedule(job.getCron())).build();
|
||||
scheduler.scheduleJob(jobDetail, trigger);
|
||||
// 启动
|
||||
if (!scheduler.isShutdown()) {
|
||||
scheduler.start();
|
||||
log.info("---任务[" + triggerKey.getName() + "]启动成功-------");
|
||||
return true;
|
||||
} else {
|
||||
log.info("---任务[" + triggerKey.getName() + "]已经运行,请勿再次启动-------");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*/
|
||||
@Log(desc = "更新定时任务", type = LOG_TYPE.UPDATE)
|
||||
public boolean updateJob(SysJob job) {
|
||||
Scheduler scheduler = schedulerFactoryBean.getScheduler();
|
||||
String createTime = DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
TriggerKey triggerKey = TriggerKey.triggerKey(job.getId(), Scheduler.DEFAULT_GROUP);
|
||||
try {
|
||||
if (scheduler.checkExists(triggerKey)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JobKey jobKey = JobKey.jobKey(job.getId(), Scheduler.DEFAULT_GROUP);
|
||||
|
||||
CronScheduleBuilder schedBuilder = CronScheduleBuilder.cronSchedule(job.getCron())
|
||||
.withMisfireHandlingInstructionDoNothing();
|
||||
CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(triggerKey)
|
||||
.withDescription(createTime).withSchedule(schedBuilder).build();
|
||||
Class clazz = null;
|
||||
JobDetail jobDetail = scheduler.getJobDetail(jobKey);
|
||||
HashSet<Trigger> triggerSet = new HashSet<>();
|
||||
triggerSet.add(trigger);
|
||||
scheduler.scheduleJob(jobDetail, triggerSet, true);
|
||||
log.info("---任务[" + triggerKey.getName() + "]更新成功-------");
|
||||
return true;
|
||||
} catch (SchedulerException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@Log(desc = "删除定时任务", type = LOG_TYPE.DEL)
|
||||
public boolean remove(SysJob job) {
|
||||
Scheduler scheduler = schedulerFactoryBean.getScheduler();
|
||||
TriggerKey triggerKey = TriggerKey.triggerKey(job.getId(), Scheduler.DEFAULT_GROUP);
|
||||
try {
|
||||
if (checkJob(job)) {
|
||||
scheduler.pauseTrigger(triggerKey);
|
||||
scheduler.unscheduleJob(triggerKey);
|
||||
scheduler.deleteJob(JobKey.jobKey(job.getId(), Scheduler.DEFAULT_GROUP));
|
||||
log.info("---任务[" + triggerKey.getName() + "]删除成功-------");
|
||||
return true;
|
||||
}
|
||||
} catch (SchedulerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package com.len.mapper;
|
||||
|
||||
import com.len.base.BaseMapper;
|
||||
import com.len.entity.SysJob;
|
||||
import com.len.entity.SysLog;
|
||||
import java.util.List;
|
||||
|
||||
public interface SysLogMapper {
|
||||
public interface SysLogMapper extends BaseMapper<SysLog, String> {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(SysLog record);
|
||||
|
|
|
@ -28,9 +28,6 @@
|
|||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.len.entity.SysJob">
|
||||
<selectKey resultType="String" keyProperty="id" order="BEFORE">
|
||||
select replace(uuid(),'-','') from dual
|
||||
</selectKey>
|
||||
insert into sys_job (id, job_name, cron,
|
||||
status, clazz_path, job_desc,
|
||||
create_by, create_date, update_by,
|
||||
|
@ -41,9 +38,6 @@
|
|||
#{updateDate,jdbcType=TIMESTAMP})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.len.entity.SysJob">
|
||||
<selectKey resultType="String" keyProperty="id" order="BEFORE">
|
||||
select replace(uuid(),'-','') from dual
|
||||
</selectKey>
|
||||
insert into sys_job
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
|
@ -160,9 +154,9 @@
|
|||
SELECT <include refid="Base_Column_List"/>
|
||||
from sys_job
|
||||
<where>
|
||||
<if test="jobName!=null and jobName!=''"> and job_name like "%" #{job_name} "%"</if>
|
||||
<if test="clazzPath!=null and clazzPath!=''"> and clazz_path like "%" #{clazz_path} "%"</if>
|
||||
<if test="jobDesc!=null and jobDesc!=''"> and job_desc like "%" #{job_desc} "%"</if>
|
||||
<if test="jobName!=null and jobName!=''"> and job_name like '%${job_name}%'</if>
|
||||
<if test="clazzPath!=null and clazzPath!=''"> and clazz_path like '%${clazz_path}%'</if>
|
||||
<if test="jobDesc!=null and jobDesc!=''"> and job_desc like '%${job_desc}%'</if>
|
||||
<if test="status!=null and status!=''"> and status =#{status}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.len.entity.SysLog">
|
||||
insert into sys_log (id, user_name, ip,
|
||||
insert into sys_log (user_name, ip,
|
||||
type, text,param,create_time
|
||||
)
|
||||
values (#{id,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, #{ip,jdbcType=VARCHAR},
|
||||
values (#{userName,jdbcType=VARCHAR}, #{ip,jdbcType=VARCHAR},
|
||||
#{type,jdbcType=VARCHAR}, #{text,jdbcType=VARCHAR},#{param,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=TIMESTAMP}
|
||||
)
|
||||
|
@ -35,9 +35,6 @@
|
|||
<insert id="insertSelective" parameterType="com.len.entity.SysLog">
|
||||
insert into sys_log
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="userName != null">
|
||||
user_name,
|
||||
</if>
|
||||
|
@ -58,9 +55,6 @@
|
|||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="userName != null">
|
||||
#{userName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
@ -120,8 +114,8 @@
|
|||
SELECT <include refid="Base_Column_List"/>
|
||||
from sys_log
|
||||
<where>
|
||||
<if test="userName!=null and userName!=''"> and user_name like "%" #{userName} "%"</if>
|
||||
<if test="type!=null and type!=''"> and type like "%" #{type} "%"</if>
|
||||
<if test="userName!=null and userName!=''"> and user_name like '%${userName}%'</if>
|
||||
<if test="type!=null and type!=''"> and type like '%${type}%'</if>
|
||||
</where>
|
||||
ORDER BY create_time desc
|
||||
</select>
|
||||
|
|
|
@ -49,9 +49,6 @@
|
|||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.len.entity.SysMenu">
|
||||
<selectKey order="BEFORE" keyProperty="id" resultType="java.lang.String">
|
||||
select replace(uuid(),'-','') from dual
|
||||
</selectKey>
|
||||
insert into sys_menu (id, name, p_id,
|
||||
url, order_num, icon,
|
||||
create_by, create_date, update_by,
|
||||
|
@ -64,9 +61,6 @@
|
|||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.len.entity.SysMenu">
|
||||
<selectKey order="BEFORE" keyProperty="id" resultType="java.lang.String">
|
||||
select replace(uuid(),'-','') from dual
|
||||
</selectKey>
|
||||
insert into sys_menu
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
|
|
|
@ -32,9 +32,6 @@
|
|||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.len.entity.SysRole">
|
||||
<selectKey resultType="String" keyProperty="id" order="BEFORE">
|
||||
select replace(uuid(),"-","") from dual
|
||||
</selectKey>
|
||||
insert into sys_role
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
|
@ -121,8 +118,8 @@
|
|||
SELECT <include refid="Base_Column_List"/>
|
||||
from sys_role
|
||||
<where>
|
||||
<if test="roleName!=null and roleName!=''">and role_name like "%" #{roleName} "%"</if>
|
||||
<if test="remark!=null and remark!=''">and remark like "%" #{remark} "%"</if>
|
||||
<if test="roleName!=null and roleName!=''">and role_name like '%${roleName}%'</if>
|
||||
<if test="remark!=null and remark!=''">and remark like '%${remark}%'</if>
|
||||
</where>
|
||||
order by create_date desc
|
||||
</select>
|
||||
|
|
|
@ -125,9 +125,6 @@
|
|||
</trim>
|
||||
</sql>
|
||||
<insert id="insertSelective" parameterType="com.len.entity.SysUser">
|
||||
<selectKey resultType="String" keyProperty="id" order="BEFORE">
|
||||
select replace(uuid(),"-","") from dual
|
||||
</selectKey>
|
||||
insert into sys_user
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
|
@ -301,17 +298,14 @@
|
|||
from sys_user
|
||||
<where>
|
||||
del_flag=0
|
||||
<if test="username!=null and username!=''"> and username like "%" #{username} "%"</if>
|
||||
<if test="email!=null and email!=''"> and email like "%" #{email} "%"</if>
|
||||
<if test="username!=null and username!=''"> and username like '%${username}%'</if>
|
||||
<if test="email!=null and email!=''"> and email like '%${email}%'</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="count" resultType="java.lang.Integer">
|
||||
select count(*) from sys_user
|
||||
</select>
|
||||
<insert id="add" parameterType="com.len.entity.SysUser" >
|
||||
<selectKey resultType="String" keyProperty="id" order="BEFORE">
|
||||
select replace(uuid(),"-","") from dual
|
||||
</selectKey>
|
||||
insert into sys_user(
|
||||
<include refid="userColumn"/>
|
||||
) values (
|
||||
|
|
|
@ -3,13 +3,16 @@ server:
|
|||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://localhost:3306/lenos?useUnicode=true&characterEncoding=UTF-8
|
||||
# url: jdbc:sqlserver://103.46.128.47:48632;DatabaseName=lenos
|
||||
# username: sa
|
||||
username: root
|
||||
# password: 123456
|
||||
password: 123456
|
||||
# password: 123
|
||||
# password: l123456
|
||||
# 使用druid数据源
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
# type: com.alibaba.druid.pool.DruidDataSource
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
# driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
filters: stat
|
||||
maxActive: 20
|
||||
initialSize: 1
|
||||
|
@ -41,7 +44,7 @@ mapper:
|
|||
mappers:
|
||||
- com.len.base.BaseMapper
|
||||
not-empty: false
|
||||
identity: MYSQL
|
||||
identity: mysql
|
||||
|
||||
|
||||
# PageHelperConfig 可以替代此方案
|
||||
|
@ -60,4 +63,6 @@ lenosp:
|
|||
logging:
|
||||
file: ./logs/lenosp-log.log
|
||||
level:
|
||||
com.len.mapper: debug
|
||||
com.len.mapper: debug
|
||||
|
||||
dataType: mysql
|
|
@ -0,0 +1,63 @@
|
|||
server:
|
||||
port: 8081
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:sqlserver://localhost:1433;DatabaseName=lenos
|
||||
username: sa
|
||||
password: 123
|
||||
# 使用druid数据源
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
filters: stat
|
||||
maxActive: 20
|
||||
initialSize: 1
|
||||
maxWait: 60000
|
||||
minIdle: 1
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
validationQuery: select 'x'
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
poolPreparedStatements: true
|
||||
maxOpenPreparedStatements: 20
|
||||
http:
|
||||
encoding:
|
||||
force: true
|
||||
boot:
|
||||
admin:
|
||||
client:
|
||||
prefer-ip: true
|
||||
url: http://localhost:8082
|
||||
|
||||
mybatis:
|
||||
type-aliases-package: com.len.entity
|
||||
mapper-locations: classpath*:mapper/*.xml
|
||||
check-config-location: true
|
||||
|
||||
mapper:
|
||||
mappers:
|
||||
- com.len.base.BaseMapper
|
||||
not-empty: false
|
||||
identity: sqlserver
|
||||
|
||||
|
||||
# PageHelperConfig 可以替代此方案
|
||||
pagehelper:
|
||||
helperDialect: sqlserver
|
||||
reasonable: true
|
||||
supportMethodsArguments: true
|
||||
params: count=countSql
|
||||
|
||||
lenosp:
|
||||
uploadPath: ./file/
|
||||
isDayType: false
|
||||
|
||||
imagePath: ./image/
|
||||
|
||||
logging:
|
||||
file: ./logs/lenosp-log.log
|
||||
level:
|
||||
com.len.mapper: debug
|
||||
|
||||
dataType: mssql
|
|
@ -1,3 +1,5 @@
|
|||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
active: mysql-dev
|
||||
# 可切换sqlserver
|
||||
# active: sqlserver-dev
|
19
pom.xml
19
pom.xml
|
@ -90,11 +90,20 @@
|
|||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.6</version>
|
||||
</dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>org.apache.tomcat</groupId>
|
||||
<artifactId>tomcat-jdbc</artifactId>
|
||||
<version>8.0.15</version>
|
||||
</dependency>-->
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/sqljdbc4 -->
|
||||
<dependency>
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>sqljdbc4</artifactId>
|
||||
<version>4.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>
|
||||
<groupId>org.apache.tomcat</groupId>
|
||||
<artifactId>tomcat-jdbc</artifactId>
|
||||
<version>8.0.15</version>
|
||||
</dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
|
|
Loading…
Reference in New Issue