新增oracle

main
lj-wsdj 2024-08-06 10:38:28 +08:00
parent a05e1a98f7
commit c156c907fe
49 changed files with 248 additions and 14 deletions

View File

@ -3,14 +3,18 @@ package conf
import (
"git.botann.com/tinycs/boomerang/tyconf"
"git.botann.com/tinycs/boomerang/tyconf/ini"
"git.botann.com/tinycs/boomerang/tyoracle"
"git.botann.com/tinycs/boomerang/tyoracle/basesql"
)
var APP AppConf
type AppConf struct {
tyconf.SuperConfig
OracleConfig basesql.OracleConfig `section:"oracle"`
}
func init() {
ini.LoadConfig("app.conf", &APP)
tyoracle.DB().OpenTyOracle(basesql.DriverName(), APP.OracleConfig.DSN())
}

View File

@ -20,13 +20,15 @@ func (s *SqlBuilder[T]) buildPaginateSql(sqls string) string {
if s.Driver == util.DriverMysql {
return fmt.Sprintf("%s limit %d offset %d", sqls, pageSize, (pageIndex-1)*pageSize)
} else if s.Driver == util.DriverOracle {
return fmt.Sprintf("select t.* from (%s) t where t.rownum > %d and t.rownum <= %d", sqls, (pageIndex-1)*pageSize, pageIndex*pageSize)
return fmt.Sprintf("select * from (select t.*, rownum rn from (%s) t where rownum <= %d) where rn > %d", sqls, pageIndex*pageSize, (pageIndex-1)*pageSize)
} else {
return fmt.Sprintf("%s limit %d offset %d", sqls, pageSize, (pageIndex-1)*pageSize)
}
}
func (s *SqlBuilder[T]) buildCountSql(sqls string) string {
return fmt.Sprintf("select count(1) from (%s) as t", sqls)
return fmt.Sprintf("select count(1) from (%s) t", sqls)
}
func (s *SqlBuilder[T]) buildSelect(symbol string, selects ...string) {

5
go.mod
View File

@ -5,10 +5,15 @@ go 1.21.5
require git.botann.com/tinycs/boomerang v1.4.7
require (
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/go-sql-driver/mysql v1.5.0 // indirect
github.com/godror/godror v0.44.2 // indirect
github.com/godror/knownpb v0.1.2 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/ini.v1 v1.66.6 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
)

28
go.sum
View File

@ -1,14 +1,26 @@
git.botann.com/tinycs/boomerang v1.4.6 h1:8RiTvF8lOqODmlHpvtVkkpfkObKRe4A+yg3Voh8OtTU=
git.botann.com/tinycs/boomerang v1.4.6/go.mod h1:Wq6dcPR0KIlV5J+b1PfGdx9HLBFjDD+tJp3hhrtmIaQ=
git.botann.com/tinycs/boomerang v1.4.7 h1:O3M38Y1i+Kl/U9ii4U124r0MKibVQcZ+a9IjOTpSOu4=
git.botann.com/tinycs/boomerang v1.4.7/go.mod h1:JA5Fu88ZdYmkWMXVLRe/bZ3GE/iWxPUUvi1hSsg3cOQ=
github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0=
github.com/BurntSushi/toml v1.2.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/UNO-SOFT/zlog v0.8.1 h1:TEFkGJHtUfTRgMkLZiAjLSHALjwSBdw6/zByMC5GJt4=
github.com/UNO-SOFT/zlog v0.8.1/go.mod h1:yqFOjn3OhvJ4j7ArJqQNA+9V+u6t9zSAyIZdWdMweWc=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4=
github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/godror/godror v0.44.2 h1:uacQ3BFwbqPisMNBcltqysXSbg6ZUGWkz15lcUBOahE=
github.com/godror/godror v0.44.2/go.mod h1:nlshc6+MRQqNP5tp9l5du20PXR62qo4SRO1cBYyedTM=
github.com/godror/knownpb v0.1.2 h1:icMyYsYVpGmzhoVA01xyd0o4EaubR31JPK1UxQWe4kM=
github.com/godror/knownpb v0.1.2/go.mod h1:zs9hH+lwj7mnPHPnKCcxdOGz38Axa9uT+97Ng+Nnu5s=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
@ -16,6 +28,8 @@ github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/oklog/ulid/v2 v2.0.2 h1:r4fFzBm+bv0wNKNh5eXTwU7i85y5x+uwkxCUTNVQqLc=
github.com/oklog/ulid/v2 v2.0.2/go.mod h1:mtBL0Qe/0HAx6/a4Z30qxVIAL1eQDweXq5lxOEiwQ68=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@ -37,6 +51,8 @@ go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8=
go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8=
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
@ -45,12 +61,18 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c=
golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@ -60,6 +82,8 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/ini.v1 v1.66.6 h1:LATuAqN/shcYAOkv3wl2L4rkaKqkcgTBQjOyYDvcPKI=

View File

@ -0,0 +1,137 @@
Your use of this Program is governed by the Oracle Free Distribution, Hosting,
and Use Terms and Conditions set forth below, unless you have received this
Program (alone or as part of another Oracle product) under an Oracle license
agreement (including but not limited to the Oracle Master Agreement), in which
case your use of this Program is governed solely by such license agreement with
Oracle.
Oracle Free Distribution, Hosting, and Use Terms and Conditions
Definitions
"Oracle" refers to Oracle America, Inc. "You" and "Your" refers to (a) a
company or organization (each an "Entity") accessing the Programs, if use of
the Programs will be on behalf of such Entity; or (b) an individual accessing
the Programs, if use of the Programs will not be on behalf of an
Entity. "Program(s)" refers to Oracle software provided by Oracle pursuant to
the following terms and any updates, error corrections, and/or Program
Documentation provided by Oracle. "Program Documentation" refers to Program
user manuals and Program installation manuals, if any. If available, Program
Documentation may be delivered with the Programs and/or may be accessed from
www.oracle.com/documentation. "Separate Terms" refers to separate license terms
that are specified in the Program Documentation, readmes or notice files and
that apply to Separately Licensed Technology. "Separately Licensed Technology"
refers to Oracle or third party technology that is licensed under Separate
Terms and not under the terms of this license.
Separately Licensed Technology
Oracle may provide certain notices to You in Program Documentation, readmes or
notice files in connection with Oracle or third party technology provided as or
with the Programs. If specified in the Program Documentation, readmes or notice
files, such technology will be licensed to You under Separate Terms. Your
rights to use Separately Licensed Technology under Separate Terms are not
restricted in any way by the terms herein. For clarity, notwithstanding the
existence of a notice, third party technology that is not Separately Licensed
Technology shall be deemed part of the Programs licensed to You under the terms
of this license.
Source Code for Open Source Software
For software that You receive from Oracle in binary form that is licensed under
an open source license that gives You the right to receive the source code for
that binary, You can obtain a copy of the applicable source code from
https://oss.oracle.com/sources/ or
http://www.oracle.com/goto/opensourcecode. If the source code for such software
was not provided to You with the binary, You can also receive a copy of the
source code on physical media by submitting a written request pursuant to the
instructions in the "Written Offer for Source Code" section of the latter
website.
-------------------------------------------------------------------------------
The following license terms apply to those Programs that are not provided to
You under Separate Terms.
License Rights and Restrictions
Oracle grants to You, as a recipient of this Program, a nonexclusive,
nontransferable, limited license to, subject to the conditions stated herein,
use the unmodified Programs, including, without limitation, for the purposes
of:
- developing, testing, prototyping and demonstrating applications;
- running the unmodified Programs for training, personal use, your business
operations, and the business operations of third parties;
- making the unmodified Programs available for use by third parties in your
hosted environment and in cloud services;
- redistributing unmodified Programs and Programs Documentation under the terms
of this License; and
- copying the unmodified Programs and Program Documentation to the extent
reasonably necessary to exercise the license rights granted herein and for
backup purposes.
For the purposes of this license, compiling, interpreting or configuring an
otherwise unmodified Program as necessary to run the Program shall not be
considered modification.
Your license is contingent on Your compliance with the following conditions:
- You include a copy of this license with any distribution by You of the
Programs;
- You do not charge your customers, end users, distributees or other third
parties any additional fees for the distribution or use of the Programs;
however, for clarity, if you comply with the foregoing condition,
distribution or use of the Program as part of your for-fee product or service
that adds substantial additional value is permitted;
- You do not remove markings or notices of either Oracle's or a licensor's
proprietary rights from the Programs or Program Documentation;
- You comply with all U.S. and applicable export control and economic sanctions
laws and regulations that govern Your use of the Programs (including
technical data); and
- You do not cause or permit reverse engineering, disassembly or decompilation
of the Programs (except as allowed by law) by You nor allow an associated
party to do so.
Any source code that may be included in the distribution with the Programs may
not be modified, unless such source code is under Separate Terms permitting
modification.
Ownership
Oracle or its licensors retain all ownership and intellectual property rights
to the Programs.
Information Collection
The Programs' installation and/or auto-update processes, if any, may transmit a
limited amount of data to Oracle or its service provider about those processes
to help Oracle understand and optimize them. Oracle does not associate the data
with personally identifiable information. Refer to Oracle's Privacy Policy at
www.oracle.com/privacy.
Disclaimer of Warranties; Limitation of Liability
THE PROGRAMS ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ORACLE FURTHER
DISCLAIMS ALL WARRANTIES, EXPRESS AND IMPLIED, INCLUDING WITHOUT LIMITATION,
ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
NONINFRINGEMENT.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL ORACLE BE LIABLE TO YOU FOR
DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT
LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED
BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
Version 1.0
Last updated: 28 June 2022

View File

@ -0,0 +1,19 @@
Basic Package Information
=========================
Thu 11 Jul 2024 23:58:50 PDT
Client Shared Library 64-bit - 23.3.0.23.09
System name: Darwin
Release: 22.6.0
Version: Darwin Kernel Version 22.6.0: Mon Feb 19 19:43:41 PST 2024; root:xnu-8796.141.3.704.6~1/RELEASE_ARM64_T8103
Machine: arm64
TIMEZONE INFORMATION
--------------------
Operating in ORACLE_HOME environment.
Small timezone file = timezone_43.dat
Large timezone file = timezlrg_43.dat

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
libclntsh.dylib.23.1

View File

@ -0,0 +1 @@
libclntsh.dylib.23.1

View File

@ -0,0 +1 @@
libclntsh.dylib.23.1

View File

@ -0,0 +1 @@
libclntsh.dylib.23.1

View File

@ -0,0 +1 @@
libclntsh.dylib.23.1

View File

@ -0,0 +1 @@
libclntsh.dylib.23.1

View File

@ -0,0 +1 @@
libclntsh.dylib.23.1

View File

@ -0,0 +1 @@
libclntsh.dylib.23.1

View File

@ -0,0 +1 @@
libclntsh.dylib.23.1

Binary file not shown.

View File

@ -0,0 +1 @@
libclntshcore.dylib.23.1

View File

@ -0,0 +1 @@
libclntshcore.dylib.23.1

View File

@ -0,0 +1 @@
libclntshcore.dylib.23.1

View File

@ -0,0 +1 @@
libclntshcore.dylib.23.1

View File

@ -0,0 +1 @@
libclntshcore.dylib.23.1

View File

@ -0,0 +1 @@
libclntshcore.dylib.23.1

View File

@ -0,0 +1 @@
libclntshcore.dylib.23.1

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
libocci.dylib.23.1

View File

@ -0,0 +1 @@
libocci.dylib.23.1

View File

@ -0,0 +1 @@
libocci.dylib.23.1

View File

@ -0,0 +1 @@
libocci.dylib.23.1

View File

@ -0,0 +1 @@
libocci.dylib.23.1

View File

@ -0,0 +1 @@
libocci.dylib.23.1

View File

@ -0,0 +1 @@
libocci.dylib.23.1

View File

@ -0,0 +1 @@
libocci.dylib.23.1

View File

@ -0,0 +1 @@
libocci.dylib.23.1

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,9 @@
============================================================================
This is the default directory for Oracle Network and Oracle Client
configuration files. You can place files such as tnsnames.ora, sqlnet.ora
and oraaccess.xml in this directory.
NOTE:
If you set an environment variable TNS_ADMIN to another directory containing
configuration files, they will be used instead of the files in this default
directory.
============================================================================

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -62,10 +62,19 @@ func TestMain(m *testing.M) {
HandlingNum int `json:"handling_num" export:"x:9,y:2"`
HandledNum int `json:"handled_num" export:"x:10,y:2"`
}
type Employye struct {
EmployeeId int `json:"employee_id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Email string `json:"email"`
Rn int
}
var data []PreliminaryProcedureResponse
company_id := 1
// var data []Employye
// company_id := 1
sqlb := DefaultSqlBuilder()
slqs := `select t1.autoseq,max(t1.establishment_time),max(t1.number),max(t1.name),max(t2.name) as project_unit,max(t3.name) as project_type,
// sqlb := OracleSqlBuilder()
sqls := `select t1.autoseq,max(t1.establishment_time),max(t1.number),max(t1.name),max(t2.name) as project_unit,max(t3.name) as project_type,
count(distinct t6.autoseq) all_num,
count(distinct case t6.state when 1 then t6.autoseq end) not_handle_num,
count(distinct case t6.state when 2 then t6.autoseq end) no_handle_num,
@ -77,15 +86,15 @@ func TestMain(m *testing.M) {
left join tpreliminary_procedures t6 on t1.autoseq = t6.project_id
where t1.del = 0 @c @c @c @c @c1
@g`
sqlb.Sql = slqs
if company_id != 0 {
sqlb.InsertConditions("@c1", "t2.autoseq = ?", company_id)
}
sqlb.Groups("group by t1.autoseq")
// sqls := `select employee_id,first_name,last_name,email from HR.employees`
sqlb.Sql = sqls
// if company_id != 0 {
// sqlb.InsertConditions("@c1", "t2.autoseq = ?", company_id)
// }
// sqlb.Groups("group by t1.autoseq")
var err error
page := Page{PageIndex: 2, PageSize: 10}
page := Page{PageIndex: 1, PageSize: 10}
err = sqlb.PaginateBySql(&data, &page)
fmt.Println(sqlb.Sql)
page.Data = &data
fmt.Println(err, page.Data)
}