Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rememberber committed Mar 1, 2017
0 parents commit f5c75ac
Show file tree
Hide file tree
Showing 134 changed files with 7,011 additions and 0 deletions.
Empty file added DB_Backup/Target/demo_back.sql
Empty file.
31 changes: 31 additions & 0 deletions DB_Backup/mysql_backup.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@echo off & setlocal ENABLEEXTENSIONS
set BACKUP_PATH=D:\workspaceDataSync\dataSync\DB_Backup\Target
set DATABASES=TEST_2017_M
set HOST=localhost
set USERNAME=root
set PASSWORD=123456S
set MYSQL=D:\MySQL
set path_bin_mysql=%MYSQL%\bin\
set YEAR=%date:~0,4%
set MONTH=%date:~5,2%
set DAY=%date:~8,2%
set HOUR=%time:~0,2%
set MINUTE=%time:~3,2%
set SECOND=%time:~6,2%
set DIR=%BACKUP_PATH%
set ADDON="%YEAR%%MONTH%%DAY%_%HOUR%%MINUTE%%SECOND%"
if not exist %DIR% (
mkdir %DIR%
)
if not exist %DIR% (
echo Backup path: %DIR% not exists, create dir failed.
goto exit
)
cd /d %DIR%
echo Start dump databases...
for %%D in (%DATABASES%) do (
echo Dumping database %%D ...
%path_bin_mysql%mysqldump -h%HOST% -u%USERNAME% -p%PASSWORD% --skip-lock-tables %%D > %%D_%ADDON%.sql
)
echo Done
:exit
11 changes: 11 additions & 0 deletions DB_Backup/mysql_table_backup.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
drop table if exists table_demo_a_bak;
create table table_demo_a_bak like table_demo_a;
insert into table_demo_a_bak select * from table_demo_a;

drop table if exists table_demo_b_bak;
create table table_demo_b_bak like table_demo_b;
insert into table_demo_b_bak select * from table_demo_b;

drop table if exists table_demo_c_bak;
create table table_demo_c_bak like table_demo_c;
insert into table_demo_c_bak select * from table_demo_c;
1 change: 1 addition & 0 deletions DataSync.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
start javaw -jar DataSync.jar
6 changes: 6 additions & 0 deletions TableField/init/my_role.DELETE.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
UPDATE my_role
SET UPDATE_DATE = '$SYS_DATE_TIME$',
UPDATE_USER = 2,
STATUS = '1'
WHERE
(ROLE_NAME = 'before.Name');
19 changes: 19 additions & 0 deletions TableField/init/my_role.INSERT.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
INSERT INTO my_role (
ROLE_NAME,
CREATE_DATE,
CREATE_USER,
UPDATE_DATE,
UPDATE_USER,
STATUS,
REMARK
)
VALUES
(
'this.Name',
'$SYS_DATE_TIME$',
2,
'',
2,
'2',
''
);
6 changes: 6 additions & 0 deletions TableField/init/my_role.UPDATE.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
UPDATE my_role
SET ROLE_NAME = 'this.Name',
UPDATE_DATE = '$SYS_DATE_TIME$',
UPDATE_USER = 2
WHERE
(ROLE_NAME = 'before.Name');
5 changes: 5 additions & 0 deletions TableField/init/my_user.DELETE.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
UPDATE my_user
SET STATUS = '1',
UPDATE_DATE = '$SYS_DATE_TIME$',
UPDATE_USER = 2
WHERE ID_CARD = 'before.IDCardID' ;
74 changes: 74 additions & 0 deletions TableField/init/my_user.INSERT.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
INSERT INTO my_user (
LOGIN_NAME,
PASSWORD,
REAL_NAME,
STATUS,
ADDRESS,
RMK,
CREATE_DATE,
CREATE_USER,
UPDATE_DATE,
UPDATE_USER,
LOGIN_IP,
MOBILE,
SYS_EMAIL,
TELPHONE,
LOGO_IMG,
PROVINCE,
CITY,
sbc_id,
EMP_CODE,
ID_CARD,
DEPT_CODE,
POSITION_CODE,
BANK_NUMBER
)
VALUES
(
'$PINYIN{this.Name}$@SUB(7,END){this.Telphone}@',
'#MD5PE{@SUB(12,END){this.IDCardID}@}#',
'this.Name',
'#CASE(1=2,2=1){this.Status}#',
'this.Address',
'',
'$SYS_DATE_TIME$',
2,
'',
null,
'',
'this.Telphone',
'this.EMail',
'',
'',
'',
'',
null,
'',
'this.IDCardID',
left('#REPLACE(".",""){@SUB(".",END){this.UnitCode}@}#',16),
(SELECT SP_POSITION_CODE FROM my_position WHERE SP_POSITION_NAME = '$SQL{SELECT PositionName FROM Info WHERE id = 'this.id'}$'),
'this.BankAccountNum'
);

INSERT INTO my_user_role (
USER_ID,
ROLE_ID,
STATUS,
CREATE_DATE,
CREATE_USER,
UPDATE_DATE,
UPDATE_USER,
REMARK
)
VALUES
(
(SELECT MAX(ID) FROM my_user),
(SELECT ID FROM my_role WHERE ROLE_NAME = 'test'),
'2',
'$SYS_DATE_TIME$',
2,
'',
null,
null
);

12 changes: 12 additions & 0 deletions TableField/init/my_user.UPDATE.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
UPDATE my_user
SET REAL_NAME = 'this.Name',
ADDRESS = 'this.Address',
UPDATE_DATE = '$SYS_DATE_TIME$',
UPDATE_USER = 2,
MOBILE = 'this.Telphone',
SYS_EMAIL = 'this.EMail',
ID_CARD = 'this.IDCardID',
DEPT_CODE = left('#REPLACE(".",""){@SUB(".",END){this.UnitCode}@}#',16),
POSITION_CODE = (SELECT SP_POSITION_CODE FROM my_position WHERE SP_POSITION_NAME = '$SQL{SELECT PositionName FROM Info WHERE id = 'this.id'}$'),
BANK_NUMBER = 'this.BankAccountNum'
WHERE ID_CARD = 'before.IDCardID' ;
6 changes: 6 additions & 0 deletions TableField/my_role.DELETE.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
UPDATE my_role
SET UPDATE_DATE = '$SYS_DATE_TIME$',
UPDATE_USER = 2,
STATUS = '1'
WHERE
(ROLE_NAME = 'before.Name');
19 changes: 19 additions & 0 deletions TableField/my_role.INSERT.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
INSERT INTO my_role (
ROLE_NAME,
CREATE_DATE,
CREATE_USER,
UPDATE_DATE,
UPDATE_USER,
STATUS,
REMARK
)
VALUES
(
'this.Name',
'$SYS_DATE_TIME$',
2,
'',
2,
'2',
''
);
6 changes: 6 additions & 0 deletions TableField/my_role.UPDATE.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
UPDATE my_role
SET ROLE_NAME = 'this.Name',
UPDATE_DATE = '$SYS_DATE_TIME$',
UPDATE_USER = 2
WHERE
(ROLE_NAME = 'before.Name');
5 changes: 5 additions & 0 deletions TableField/my_user.DELETE.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
UPDATE my_user
SET STATUS = '1',
UPDATE_DATE = '$SYS_DATE_TIME$',
UPDATE_USER = 2
WHERE ID_CARD = 'before.IDCardID' ;
74 changes: 74 additions & 0 deletions TableField/my_user.INSERT.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
INSERT INTO my_user (
LOGIN_NAME,
PASSWORD,
REAL_NAME,
STATUS,
ADDRESS,
RMK,
CREATE_DATE,
CREATE_USER,
UPDATE_DATE,
UPDATE_USER,
LOGIN_IP,
MOBILE,
SYS_EMAIL,
TELPHONE,
LOGO_IMG,
PROVINCE,
CITY,
sbc_id,
EMP_CODE,
ID_CARD,
DEPT_CODE,
POSITION_CODE,
BANK_NUMBER
)
VALUES
(
'$PINYIN{this.Name}$@SUB(7,END){this.Telphone}@',
'#MD5PE{@SUB(12,END){this.IDCardID}@}#',
'this.Name',
'#CASE(1=2,2=1){this.Status}#',
'this.Address',
'',
'$SYS_DATE_TIME$',
2,
'',
null,
'',
'this.Telphone',
'this.EMail',
'',
'',
'',
'',
null,
'',
'this.IDCardID',
left('#REPLACE(".",""){@SUB(".",END){this.UnitCode}@}#',16),
(SELECT SP_POSITION_CODE FROM my_position WHERE SP_POSITION_NAME = '$SQL{SELECT PositionName FROM Info WHERE id = 'this.id'}$'),
'this.BankAccountNum'
);

INSERT INTO my_user_role (
USER_ID,
ROLE_ID,
STATUS,
CREATE_DATE,
CREATE_USER,
UPDATE_DATE,
UPDATE_USER,
REMARK
)
VALUES
(
(SELECT MAX(ID) FROM my_user),
(SELECT ID FROM my_role WHERE ROLE_NAME = 'test'),
'2',
'$SYS_DATE_TIME$',
2,
'',
null,
null
);

12 changes: 12 additions & 0 deletions TableField/my_user.UPDATE.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
UPDATE my_user
SET REAL_NAME = 'this.Name',
ADDRESS = 'this.Address',
UPDATE_DATE = '$SYS_DATE_TIME$',
UPDATE_USER = 2,
MOBILE = 'this.Telphone',
SYS_EMAIL = 'this.EMail',
ID_CARD = 'this.IDCardID',
DEPT_CODE = left('#REPLACE(".",""){@SUB(".",END){this.UnitCode}@}#',16),
POSITION_CODE = (SELECT SP_POSITION_CODE FROM my_position WHERE SP_POSITION_NAME = '$SQL{SELECT PositionName FROM Info WHERE id = 'this.id'}$'),
BANK_NUMBER = 'this.BankAccountNum'
WHERE ID_CARD = 'before.IDCardID' ;
22 changes: 22 additions & 0 deletions TableField/公式说明.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
ע�⣺ͬ����ʽ�ݲ�֧��Ƕ�ף�

��һ����ʽ��
this.***��ȡ��ǰ���ո�����¼��ij�ֶ�ֵ
before.***��ȡԭ���ո�����¼��ij�ֶ�ֵ����UPDATE��DELETEʱ���õ���

�ڶ�����ʽ��
$INCREASE{POSITION_CODE}$�����������ڵij־û�����������*��config�ļ������ó־û�������
$PINYIN{}$�����������ڵĺ���תΪƴ��
$SYS_DATE_TIME$��ϵͳ����+ʱ�䣨2016-01-19 17:57:49��
$SQL{}$��ִ�д������ڵ��Ӳ�ѯsql�����ض�Ӧ�IJ�ѯ���������һ����

��������ʽ��
@SUB(5,8){}@�����������ڵ��ַ����ӵ�5���ַ���ȡ����8���ַ���ͬjava��substring���������󲻺��ң�
@SUB(5,END){}@�����������ڵ��ַ����ӵ�5���ַ���ȡ�����ͬjava��substring���������󲻺��ң�
@SUB(0,LAST"."){}@�����������ڵ��ַ����ӵ�0���ַ���ȡ�����һ��"."��ͬjava��substring���������󲻺��ң�
@SUB("a",LAST"a"){}@�����������ڵ��ַ����ӵ�1��"a"��ȡ�����һ��"a"�������󲻺��ң�

���ļ���ʽ��
#REPLACE("a","b"){}#�������������������е�"a"�滻Ϊ"b"
#CASE(a=b,c=d,e=f){}#�������������ߵ�������a�����滻Ϊb�����Ϊc�����滻Ϊd...
#MD5PE{}#�����������ڵ������ַ�������Md5PasswordEncoder��encodePassword����
10 changes: 10 additions & 0 deletions Trigger/Trigger.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

// 规则:快照名:<来源表>(主键){字段}[其他条件]=<目标表1>(主键){字段}[保留]=<目标表2>(主键){字段}[保留]...
// 多个以英文逗号隔开
// 注意:]=<等符号旁边不要有空格

// 示例:Snap_tableA:<table_a_from>(id){id,name,other}[WHERE status = '1' ORDER BY id]=<table_a_to>(id){id,real_name,password}

role:<position>(Name){Name}[WHERE IsDelete = 0 GROUP BY Name ORDER BY Name]=<my_role>(ID){ID,ROLE_NAME,CREATE_DATE,CREATE_USER,UPDATE_DATE,UPDATE_USER,STATUS,REMARK}[]

user:<user u LEFT Info i ON u.id = i.id>(id){u.id,u.Name,u.IDCardID,u.Telphone,u.Address,u.EMail,u.Status}[WHERE u.Status = 1 and u.IDCardID is not null and u.IDCardID != '' ORDER BY u.id]=<my_user>(ID){ID,LOGIN_NAME,PASSWORD,REAL_NAME,STATUS,ADDRESS,RMK,CREATE_DATE,CREATE_USER,UPDATE_DATE,UPDATE_USER,LOGIN_IP,MOBILE,SYS_EMAIL,TELPHONE,LOGO_IMG,PROVINCE,CITY,sbc_id,EMP_CODE,ID_CARD,DEPT_CODE,POSITION_CODE,BANK_NUMBER}[]
Loading

0 comments on commit f5c75ac

Please sign in to comment.