Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hp-smart
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
platform
hp-smart
Commits
6673ca54
Commit
6673ca54
authored
Jan 09, 2024
by
wuwenlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
动态下拉枚举;
客户档案; 供应商档案;
parent
e19a741e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
158 additions
and
362 deletions
+158
-362
DdynamicEnum.java
src/main/java/com/baosight/iplat4j/common/DdynamicEnum.java
+68
-0
HPConstants.java
src/main/java/com/baosight/iplat4j/common/HPConstants.java
+4
-1
THppz005.java
.../java/com/baosight/iplat4j/common/hp/domain/THppz005.java
+0
-242
tHppz005.xml
...main/java/com/baosight/iplat4j/common/hp/sql/tHppz005.xml
+0
-118
HPPZ002.xml
src/main/java/com/baosight/iplat4j/hp/pz/sql/HPPZ002.xml
+18
-1
CommonMethod.java
src/main/java/com/baosight/iplat4j/util/CommonMethod.java
+68
-0
No files found.
src/main/java/com/baosight/iplat4j/common/DdynamicEnum.java
0 → 100644
View file @
6673ca54
package
com
.
baosight
.
iplat4j
.
common
;
/**
* @Author wwl
* @Date 2024/1/9 19:35
* 将给定的查询条件用来查表 给结果集中添加block块 查询参数传入
*CommonMethod.initBlock(outInfo,
*Arrays.asList(DdynamicEnum.SUPPLIER_RECORD_BLOCK_ID,
*DropDownBoxEnum.XXXXXXXX_BLOCK_ID,
*DropDownBoxEnum.XXXXXXXX_BLOCK_ID),
*new HashMap<String, String>(1){{
*put(HPConstants.SQL_FIELD_COMPANYCODE,companyCode);
*put(sqlQueryParamName,sqlQueryParamValue);
*}});
*/
public
enum
DdynamicEnum
{
/**
* 模块:供应商档案
* 用途:供应商档案下拉框.
* 编写:wwl.
*/
SUPPLIER_RECORD_BLOCK_ID
(
"supplier_record_block_id"
,
"CUST_CODE"
,
"CUST_NAME"
,
"HPPZ002.queryComboBox"
),
/**
* 模块:客户档案
* 用途:客户档案下拉框.
* 编写:wwl.
*/
CUSTOMER_RECORD_BLOCK_ID
(
"customer_record_block_id"
,
"CUST_CODE"
,
"CUST_NAME"
,
"HPPZ003.queryComboBox"
);
/** 将结果集放入的块名 */
private
final
String
blockId
;
/** 字段名 */
private
final
String
value
;
/** 字段描述 */
private
final
String
text
;
/** 数据源 */
private
final
String
dbSource
;
DdynamicEnum
(
String
blockId
,
String
value
,
String
text
,
String
dbSource
){
this
.
blockId
=
blockId
;
this
.
value
=
value
;
this
.
text
=
text
;
this
.
dbSource
=
dbSource
;
}
public
String
getDbSource
()
{
return
dbSource
;
}
public
String
getBlockId
()
{
return
blockId
;
}
public
String
getValue
()
{
return
value
;
}
public
String
getText
()
{
return
text
;
}
}
src/main/java/com/baosight/iplat4j/common/HPConstants.java
View file @
6673ca54
...
...
@@ -24,8 +24,11 @@ public class HPConstants {
//代碼名字分隔符
public
static
final
String
SPLICING_SYMBOL
=
"-"
;
/** 前后台交互下拉框字段 字段名 dzg */
public
static
final
String
TEXT_FIELD
=
"textField"
;
/** 前后台交互下拉框字段 字段名 dzg */
public
static
final
String
VALUE_FIELD
=
"valueField"
;
}
src/main/java/com/baosight/iplat4j/common/hp/domain/THppz005.java
deleted
100644 → 0
View file @
e19a741e
/**
* Generate time : 2024-01-09 11:10:02
* Version : 1.0
*/
package
com
.
baosight
.
iplat4j
.
common
.
hp
.
domain
;
import
com.baosight.iplat4j.core.util.NumberUtils
;
import
com.baosight.iplat4j.core.ei.EiColumn
;
import
com.baosight.iplat4j.core.data.DaoEPBase
;
import
java.util.HashMap
;
import
java.util.Map
;
import
com.baosight.iplat4j.core.util.StringUtils
;
/**
* THppz005
*
*/
public
class
THppz005
extends
DaoEPBase
{
private
Integer
id
=
0
;
private
String
companyCode
=
" "
;
/* 企业编码 预留*/
private
String
inventCode
=
" "
;
/* 类型编码*/
private
String
inventName
=
" "
;
/* 存货类型*/
private
Boolean
status
;
/* 状态 0未启用 1启用*/
private
String
createdTime
=
" "
;
/* 创建时间*/
private
String
createdBy
=
" "
;
/* 创建人*/
private
String
updatedBy
=
" "
;
/* 修改人*/
private
String
updatedTime
=
" "
;
/* 修改时间*/
/**
* initialize the metadata
*/
public
void
initMetaData
()
{
EiColumn
eiColumn
;
eiColumn
=
new
EiColumn
(
"id"
);
eiColumn
.
setPrimaryKey
(
true
);
eiColumn
.
setDescName
(
" "
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
"companyCode"
);
eiColumn
.
setDescName
(
"企业编码 预留"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
"inventCode"
);
eiColumn
.
setDescName
(
"类型编码"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
"inventName"
);
eiColumn
.
setDescName
(
"存货类型"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
"status"
);
eiColumn
.
setDescName
(
"状态 0未启用 1启用"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
"createdTime"
);
eiColumn
.
setDescName
(
"创建时间"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
"createdBy"
);
eiColumn
.
setDescName
(
"创建人"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
"updatedBy"
);
eiColumn
.
setDescName
(
"修改人"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
"updatedTime"
);
eiColumn
.
setDescName
(
"修改时间"
);
eiMetadata
.
addMeta
(
eiColumn
);
}
/**
* the constructor
*/
public
THppz005
()
{
initMetaData
();
}
/**
* get the id
* @return the id
*/
public
Integer
getId
()
{
return
this
.
id
;
}
/**
* set the id
*/
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
/**
* get the companyCode - 企业编码 预留
* @return the companyCode
*/
public
String
getCompanyCode
()
{
return
this
.
companyCode
;
}
/**
* set the companyCode - 企业编码 预留
*/
public
void
setCompanyCode
(
String
companyCode
)
{
this
.
companyCode
=
companyCode
;
}
/**
* get the inventCode - 类型编码
* @return the inventCode
*/
public
String
getInventCode
()
{
return
this
.
inventCode
;
}
/**
* set the inventCode - 类型编码
*/
public
void
setInventCode
(
String
inventCode
)
{
this
.
inventCode
=
inventCode
;
}
/**
* get the inventName - 存货类型
* @return the inventName
*/
public
String
getInventName
()
{
return
this
.
inventName
;
}
/**
* set the inventName - 存货类型
*/
public
void
setInventName
(
String
inventName
)
{
this
.
inventName
=
inventName
;
}
/**
* get the status - 状态 0未启用 1启用
* @return the status
*/
public
Boolean
getStatus
()
{
return
this
.
status
;
}
/**
* set the status - 状态 0未启用 1启用
*/
public
void
setStatus
(
Boolean
status
)
{
this
.
status
=
status
;
}
/**
* get the createdTime - 创建时间
* @return the createdTime
*/
public
String
getCreatedTime
()
{
return
this
.
createdTime
;
}
/**
* set the createdTime - 创建时间
*/
public
void
setCreatedTime
(
String
createdTime
)
{
this
.
createdTime
=
createdTime
;
}
/**
* get the createdBy - 创建人
* @return the createdBy
*/
public
String
getCreatedBy
()
{
return
this
.
createdBy
;
}
/**
* set the createdBy - 创建人
*/
public
void
setCreatedBy
(
String
createdBy
)
{
this
.
createdBy
=
createdBy
;
}
/**
* get the updatedBy - 修改人
* @return the updatedBy
*/
public
String
getUpdatedBy
()
{
return
this
.
updatedBy
;
}
/**
* set the updatedBy - 修改人
*/
public
void
setUpdatedBy
(
String
updatedBy
)
{
this
.
updatedBy
=
updatedBy
;
}
/**
* get the updatedTime - 修改时间
* @return the updatedTime
*/
public
String
getUpdatedTime
()
{
return
this
.
updatedTime
;
}
/**
* set the updatedTime - 修改时间
*/
public
void
setUpdatedTime
(
String
updatedTime
)
{
this
.
updatedTime
=
updatedTime
;
}
/**
* get the value from Map
*/
public
void
fromMap
(
Map
map
)
{
setId
(
NumberUtils
.
toInteger
(
StringUtils
.
toString
(
map
.
get
(
"id"
)),
id
));
setCompanyCode
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
"companyCode"
)),
companyCode
));
setInventCode
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
"inventCode"
)),
inventCode
));
setInventName
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
"inventName"
)),
inventName
));
setStatus
(
NumberUtils
.
toBoolean
(
StringUtils
.
toString
(
map
.
get
(
"status"
)),
status
));
setCreatedTime
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
"createdTime"
)),
createdTime
));
setCreatedBy
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
"createdBy"
)),
createdBy
));
setUpdatedBy
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
"updatedBy"
)),
updatedBy
));
setUpdatedTime
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
"updatedTime"
)),
updatedTime
));
}
/**
* set the value to Map
*/
public
Map
toMap
()
{
Map
map
=
new
HashMap
();
map
.
put
(
"id"
,
StringUtils
.
toString
(
id
,
eiMetadata
.
getMeta
(
"id"
)));
map
.
put
(
"companyCode"
,
StringUtils
.
toString
(
companyCode
,
eiMetadata
.
getMeta
(
"companyCode"
)));
map
.
put
(
"inventCode"
,
StringUtils
.
toString
(
inventCode
,
eiMetadata
.
getMeta
(
"inventCode"
)));
map
.
put
(
"inventName"
,
StringUtils
.
toString
(
inventName
,
eiMetadata
.
getMeta
(
"inventName"
)));
map
.
put
(
"status"
,
StringUtils
.
toString
(
status
,
eiMetadata
.
getMeta
(
"status"
)));
map
.
put
(
"createdTime"
,
StringUtils
.
toString
(
createdTime
,
eiMetadata
.
getMeta
(
"createdTime"
)));
map
.
put
(
"createdBy"
,
StringUtils
.
toString
(
createdBy
,
eiMetadata
.
getMeta
(
"createdBy"
)));
map
.
put
(
"updatedBy"
,
StringUtils
.
toString
(
updatedBy
,
eiMetadata
.
getMeta
(
"updatedBy"
)));
map
.
put
(
"updatedTime"
,
StringUtils
.
toString
(
updatedTime
,
eiMetadata
.
getMeta
(
"updatedTime"
)));
return
map
;
}
}
\ No newline at end of file
src/main/java/com/baosight/iplat4j/common/hp/sql/tHppz005.xml
deleted
100644 → 0
View file @
e19a741e
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<!-- table information
Generate time : 2024-01-09 11:10:02
Version : 1.0
tableName :hpjx.t_hppz005
ID INTEGER NOT NULL primarykey,
COMPANY_CODE VARCHAR NOT NULL,
INVENT_CODE VARCHAR NOT NULL,
INVENT_NAME VARCHAR NOT NULL,
STATUS TINYINT NOT NULL,
CREATED_TIME VARCHAR,
CREATED_BY VARCHAR,
UPDATED_BY VARCHAR,
UPDATED_TIME VARCHAR
-->
<sqlMap
namespace=
"tHppz005"
>
<select
id=
"query"
parameterClass=
"java.util.HashMap"
resultClass=
"com.baosight.iplat4j.common.hp.domain.THppz005"
>
SELECT
ID as "id",
COMPANY_CODE as "companyCode",
<!-- 企业编码 预留 -->
INVENT_CODE as "inventCode",
<!-- 类型编码 -->
INVENT_NAME as "inventName",
<!-- 存货类型 -->
STATUS as "status",
<!-- 状态 0未启用 1启用 -->
CREATED_TIME as "createdTime",
<!-- 创建时间 -->
CREATED_BY as "createdBy",
<!-- 创建人 -->
UPDATED_BY as "updatedBy",
<!-- 修改人 -->
UPDATED_TIME as "updatedTime"
<!-- 修改时间 -->
FROM hpjx.t_hppz005 WHERE 1=1
<isNotEmpty
prepend=
" AND "
property=
"id"
>
ID = #id#
</isNotEmpty>
<dynamic
prepend=
"ORDER BY"
>
<isNotEmpty
property=
"orderBy"
>
$orderBy$
</isNotEmpty>
<isEmpty
property=
"orderBy"
>
ID asc
</isEmpty>
</dynamic>
</select>
<select
id=
"count"
resultClass=
"int"
>
SELECT COUNT(*) FROM hpjx.t_hppz005 WHERE 1=1
<isNotEmpty
prepend=
" AND "
property=
"id"
>
ID = #id#
</isNotEmpty>
</select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status">
STATUS = #status#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
-->
<insert
id=
"insert"
>
INSERT INTO hpjx.t_hppz005 (ID,
COMPANY_CODE,
<!-- 企业编码 预留 -->
INVENT_CODE,
<!-- 类型编码 -->
INVENT_NAME,
<!-- 存货类型 -->
STATUS,
<!-- 状态 0未启用 1启用 -->
CREATED_TIME,
<!-- 创建时间 -->
CREATED_BY,
<!-- 创建人 -->
UPDATED_BY,
<!-- 修改人 -->
UPDATED_TIME
<!-- 修改时间 -->
)
VALUES (#id#, #companyCode#, #inventCode#, #inventName#, #status#, #createdTime#, #createdBy#, #updatedBy#, #updatedTime#)
</insert>
<delete
id=
"delete"
>
DELETE FROM hpjx.t_hppz005 WHERE
ID = #id#
</delete>
<update
id=
"update"
>
UPDATE hpjx.t_hppz005
SET
COMPANY_CODE = #companyCode#,
<!-- 企业编码 预留 -->
INVENT_CODE = #inventCode#,
<!-- 类型编码 -->
INVENT_NAME = #inventName#,
<!-- 存货类型 -->
STATUS = #status#,
<!-- 状态 0未启用 1启用 -->
CREATED_TIME = #createdTime#,
<!-- 创建时间 -->
CREATED_BY = #createdBy#,
<!-- 创建人 -->
UPDATED_BY = #updatedBy#,
<!-- 修改人 -->
UPDATED_TIME = #updatedTime#
<!-- 修改时间 -->
WHERE
ID = #id#
</update>
</sqlMap>
\ No newline at end of file
src/main/java/com/baosight/iplat4j/hp/pz/sql/HPPZ002.xml
View file @
6673ca54
...
...
@@ -130,5 +130,21 @@
WHERE
ID = #id#
</update>
<select
id=
"queryComboBox"
parameterClass=
"java.util.HashMap"
resultClass=
"java.util.HashMap"
>
SELECT DISTINCT
CUST_CODE as "custCode",
CUST_NAME as "custName"
FROM hpjx.t_hppz002 WHERE 1=1
<isNotEmpty
prepend=
" AND "
property=
"companyCode"
>
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"custType"
>
CUST_TYPE = #custType#
</isNotEmpty>
ORDER BY CUST_CODE
</select>
</sqlMap>
\ No newline at end of file
src/main/java/com/baosight/iplat4j/util/CommonMethod.java
View file @
6673ca54
package
com
.
baosight
.
iplat4j
.
util
;
import
com.baosight.iplat4j.common.HPConstants
;
import
com.baosight.iplat4j.common.DdynamicEnum
;
import
com.baosight.iplat4j.core.data.DaoEPBase
;
import
com.baosight.iplat4j.core.data.ibatis.dao.Dao
;
import
com.baosight.iplat4j.core.ei.EiBlock
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext
;
import
com.baosight.iplat4j.core.util.DateUtils
;
import
com.baosight.iplat4j.core.web.threadlocal.UserSession
;
import
org.apache.commons.lang.StringUtils
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author xuao
...
...
@@ -12,6 +22,64 @@ import com.baosight.iplat4j.core.web.threadlocal.UserSession;
*/
public
class
CommonMethod
{
protected
static
Dao
dao
=
(
Dao
)
PlatApplicationContext
.
getBean
(
"dao"
);
/**
* @param inInfo 前后台交互对象
* @param tableParams 表信息
* @param selectParams 筛选条件
* 公用下拉方法
*/
public
static
void
initBlock
(
EiInfo
inInfo
,
List
<
DdynamicEnum
>
tableParams
,
Map
<
String
,
String
>
selectParams
){
initBlock
(
inInfo
,
tableParams
,
selectParams
,
true
);
}
/**
* @param inInfo 前后台交互对象
* @param tableParams 表信息
* @param selectParams 筛选条件
* 公用下拉方法
*/
public
static
void
initBlock
(
EiInfo
inInfo
,
List
<
DdynamicEnum
>
tableParams
,
Map
<
String
,
String
>
selectParams
,
Boolean
isSplicingSymbol
){
/* 新建一个块 将每个表查询到的结果放入单独的块中 */
EiBlock
eiBlock
;
/* 行数据 将每个数据源查询到的数据放到每个模块的行数据中 */
Map
<
String
,
String
>
row
;
/* 每个数据源查询到的结果暂存在这个变量中 */
List
results
;
/* 将结果集中的每个结果暂存然后 强转为map */
Map
tryValue
;
/* 如果数据源为空就抛异常 原则上不允许出现这个问题!!! */
if
(
tableParams
.
size
()
<=
0
)
{
throw
new
NullPointerException
();
}
/* 遍历每个数据源 */
for
(
DdynamicEnum
tableParam
:
tableParams
)
{
/* 编辑块名称 */
eiBlock
=
new
EiBlock
(
tableParam
.
getBlockId
());
/* 将所有查询到的结果放到暂存变量中 */
results
=
dao
.
query
(
tableParam
.
getDbSource
(),
selectParams
,
EiConstant
.
defaultOffset
,-
999999
);
for
(
Object
result
:
results
)
{
row
=
new
HashMap
<>(
3
);
try
{
tryValue
=
(
Map
)
result
;
}
catch
(
ClassCastException
e
){
tryValue
=
((
DaoEPBase
)
result
).
toMap
();
}
row
.
put
(
HPConstants
.
VALUE_FIELD
,
String
.
valueOf
(
tryValue
.
get
(
tableParam
.
getValue
())));
if
(
isSplicingSymbol
)
{
row
.
put
(
HPConstants
.
TEXT_FIELD
,
(
tryValue
.
get
(
tableParam
.
getValue
())
+
HPConstants
.
SPLICING_SYMBOL
+
tryValue
.
get
(
tableParam
.
getText
())));
}
else
{
row
.
put
(
HPConstants
.
TEXT_FIELD
,
String
.
valueOf
(
tryValue
.
get
(
tableParam
.
getText
())));
}
eiBlock
.
addRow
(
row
);
}
inInfo
.
setBlock
(
eiBlock
);
}
}
public
static
void
creatorInfo
(
EiInfo
eiInfo
,
String
resultBlock
){
EiBlock
block
=
eiInfo
.
getBlock
(
resultBlock
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment