Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
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
youjj
cloud-platform
Commits
c8a1f811
Commit
c8a1f811
authored
Aug 25, 2020
by
hezhen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master_tiande_company' into dev-tiande
parents
70d5d840
4eb15b24
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
218 additions
and
30 deletions
+218
-30
BaseBiz.java
.../java/com/github/wxiaoqi/security/common/biz/BaseBiz.java
+85
-0
BaseController.java
...m/github/wxiaoqi/security/common/rest/BaseController.java
+20
-1
BranchCompany.java
.../java/com/xxfc/platform/vehicle/entity/BranchCompany.java
+10
-0
CompanySearchDTO.java
...java/com/xxfc/platform/vehicle/pojo/CompanySearchDTO.java
+12
-5
CompanySearchVO.java
.../java/com/xxfc/platform/vehicle/pojo/CompanySearchVO.java
+2
-0
BranchCompanyBiz.java
.../java/com/xxfc/platform/vehicle/biz/BranchCompanyBiz.java
+8
-2
BranchCompanyMapper.java
...com/xxfc/platform/vehicle/mapper/BranchCompanyMapper.java
+3
-1
BranchCompanyController.java
...m/xxfc/platform/vehicle/rest/BranchCompanyController.java
+0
-6
AdminBranchCompanyController.java
...form/vehicle/rest/admin/AdminBranchCompanyController.java
+46
-0
CompanyInfoController.java
...fc/platform/vehicle/rest/admin/CompanyInfoController.java
+2
-2
BranchCompanyMapper.xml
...-server/src/main/resources/mapper/BranchCompanyMapper.xml
+30
-13
No files found.
ace-common/src/main/java/com/github/wxiaoqi/security/common/biz/BaseBiz.java
View file @
c8a1f811
...
...
@@ -2,13 +2,16 @@ package com.github.wxiaoqi.security.common.biz;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.TableResultResponse
;
import
com.github.wxiaoqi.security.common.util.EntityUtils
;
import
com.github.wxiaoqi.security.common.util.Query
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
tk.mybatis.mapper.common.Mapper
;
import
tk.mybatis.mapper.entity.Example
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.ParameterizedType
;
import
java.util.Collection
;
import
java.util.List
;
...
...
@@ -125,6 +128,88 @@ public abstract class BaseBiz<M extends Mapper<T>, T> {
return
new
TableResultResponse
<
T
>(
result
.
getTotal
(),
list
);
}
public
TableResultResponse
<
T
>
selectPageByQuery
(
Query
query
)
{
Class
<
T
>
clazz
=
(
Class
<
T
>)
((
ParameterizedType
)
getClass
().
getGenericSuperclass
()).
getActualTypeArguments
()[
1
];
Example
example
=
new
Example
(
clazz
);
Example
.
Criteria
criteria
=
null
;
if
(
checkFieldName
(
clazz
,
"isDel"
)){
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"isDel"
,
0
);
}
if
(
checkFieldName
(
clazz
,
"isDelete"
)){
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"isDelete"
,
0
);
}
if
(
query
.
entrySet
().
size
()>
0
)
{
if
(
criteria
==
null
){
criteria
=
example
.
createCriteria
();
}
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
query
.
entrySet
())
{
if
(
null
!=
entry
.
getValue
())
{
criteria
.
andLike
(
entry
.
getKey
(),
"%"
+
entry
.
getValue
().
toString
()
+
"%"
);
}
}
}
if
(
checkFieldName
(
clazz
,
"sortOrder"
))
{
example
.
setOrderByClause
(
"sort_order desc"
);
}
else
if
(
checkFieldName
(
clazz
,
"rank"
)){
example
.
setOrderByClause
(
"rank desc"
);
}
else
{
example
.
setOrderByClause
(
"id desc"
);
}
Page
<
Object
>
result
=
PageHelper
.
startPage
(
query
.
getPage
(),
query
.
getLimit
());
List
<
T
>
list
=
mapper
.
selectByExample
(
example
);
return
new
TableResultResponse
<
T
>(
result
.
getTotal
(),
list
);
}
public
ObjectRestResponse
selectAll
(){
List
<
T
>
list
=
selectListAlls
();
return
ObjectRestResponse
.
succ
(
list
);
}
public
List
<
T
>
selectListAlls
(){
Class
<
T
>
clazz
=
(
Class
<
T
>)
((
ParameterizedType
)
getClass
().
getGenericSuperclass
()).
getActualTypeArguments
()[
1
];
Example
example
=
new
Example
(
clazz
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
if
(
checkFieldName
(
clazz
,
"isDel"
)){
criteria
.
andEqualTo
(
"isDel"
,
0
);
}
if
(
checkFieldName
(
clazz
,
"sortOrder"
)){
example
.
setOrderByClause
(
"sort_order desc"
);
}
else
if
(
checkFieldName
(
clazz
,
"rank"
)){
example
.
setOrderByClause
(
"rank desc"
);
}
else
{
example
.
setOrderByClause
(
"id desc"
);
}
return
mapper
.
selectByExample
(
example
);
}
public
List
<
T
>
getList
(
String
appId
)
throws
Exception
{
Class
<
T
>
clazz
=
(
Class
<
T
>)
((
ParameterizedType
)
getClass
().
getGenericSuperclass
()).
getActualTypeArguments
()[
1
];
Example
example
=
new
Example
(
clazz
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
if
(
checkFieldName
(
clazz
,
"isDel"
)){
criteria
.
andEqualTo
(
"isDel"
,
0
);
}
example
.
setOrderByClause
(
"id desc"
);
return
mapper
.
selectByExample
(
example
);
}
public
boolean
checkFieldName
(
Class
<
T
>
clazz
,
String
fieldname
){
Field
[]
fields
=
clazz
.
getDeclaredFields
();
boolean
flag
=
false
;
for
(
int
i
=
0
;
i
<
fields
.
length
;
i
++)
{
if
(
fields
[
i
].
getName
().
equals
(
fieldname
))
{
flag
=
true
;
break
;
}
}
return
flag
;
}
}
ace-common/src/main/java/com/github/wxiaoqi/security/common/rest/BaseController.java
View file @
c8a1f811
...
...
@@ -5,6 +5,7 @@ import com.github.wxiaoqi.security.common.context.BaseContextHandler;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.TableResultResponse
;
import
com.github.wxiaoqi.security.common.util.Query
;
import
com.github.wxiaoqi.security.common.util.ReflectionUtils
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -76,7 +77,7 @@ public class BaseController<Biz extends BaseBiz,Entity> extends CommonBaseContro
public
TableResultResponse
<
Entity
>
list
(
@RequestParam
Map
<
String
,
Object
>
params
){
//查询列表数据
Query
query
=
new
Query
(
params
);
return
baseBiz
.
selectByQuery
(
query
);
return
baseBiz
.
select
Page
ByQuery
(
query
);
}
@ApiOperation
(
"根据参数查询,等于"
)
...
...
@@ -88,4 +89,22 @@ public class BaseController<Biz extends BaseBiz,Entity> extends CommonBaseContro
}
@ApiOperation
(
"查询所有"
)
@RequestMapping
(
value
=
"/alls"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ObjectRestResponse
alls
(){
return
baseBiz
.
selectAll
();
}
@ApiOperation
(
"删除"
)
@RequestMapping
(
value
=
"/del"
,
method
=
RequestMethod
.
DELETE
)
@ResponseBody
public
ObjectRestResponse
del
(
Entity
entity
){
ReflectionUtils
.
setFieldValue
(
entity
,
"isDel"
,
1
);
baseBiz
.
updateSelectiveById
(
entity
);
return
ObjectRestResponse
.
succ
();
}
}
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/entity/BranchCompany.java
View file @
c8a1f811
...
...
@@ -22,12 +22,22 @@ public class BranchCompany {
@ApiModelProperty
(
"主键id"
)
private
Integer
companyBaseId
;
@Column
(
name
=
"company_id"
)
@ApiModelProperty
(
"公司id"
)
private
Long
companyId
;
/**
* 分公司名称
*/
@ApiModelProperty
(
"分公司名称"
)
private
String
name
;
@Column
(
name
=
"short_name"
)
@ApiModelProperty
(
"简称"
)
private
String
shortName
;
/**
* 分支机构类型
*/
...
...
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/CompanySearchDTO.java
View file @
c8a1f811
package
com
.
xxfc
.
platform
.
vehicle
.
pojo
;
import
com.github.wxiaoqi.security.common.vo.PageParam
;
import
lombok.Data
;
@Data
public
class
CompanySearchDTO
{
Integer
page
;
Integer
limit
;
public
class
CompanySearchDTO
extends
PageParam
{
Integer
addrCity
;
String
lon
;
String
lat
;
Integer
state
;
Integer
isShow
=
1
;
Integer
isDel
=
0
;
Integer
isShow
;
Integer
isDel
;
Integer
addrProvince
;
Long
companyId
;
String
name
;
Integer
id
;
}
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/CompanySearchVO.java
View file @
c8a1f811
...
...
@@ -8,4 +8,6 @@ import java.math.BigDecimal;
@Data
public
class
CompanySearchVO
extends
BranchCompany
{
BigDecimal
distance
;
String
companyName
;
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/BranchCompanyBiz.java
View file @
c8a1f811
...
...
@@ -24,6 +24,7 @@ import com.xxfc.platform.vehicle.mapper.BranchCompanyMapper;
import
com.xxfc.platform.vehicle.pojo.BranchCompanyVo
;
import
com.xxfc.platform.vehicle.pojo.CompanyDetail
;
import
com.xxfc.platform.vehicle.pojo.CompanySearchDTO
;
import
com.xxfc.platform.vehicle.pojo.CompanySearchVO
;
import
com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO
;
import
com.xxfc.platform.vehicle.pojo.dto.BranchCompanyFindDTO
;
import
com.xxfc.platform.vehicle.pojo.dto.BranchCompanyListDTO
;
...
...
@@ -214,13 +215,18 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
return
PageDataVO
.
pageInfo
(
branchCompanyPageInfo
);
}
public
PageDataVO
<
BranchCompany
>
search
(
CompanySearchDTO
vo
)
{
public
PageDataVO
<
CompanySearchVO
>
search
(
CompanySearchDTO
vo
)
{
PageHelper
.
startPage
(
vo
.
getPage
(),
vo
.
getLimit
());
PageInfo
<
BranchCompany
>
branchCompanyPageInfo
=
new
PageInfo
<>(
mapper
.
search
(
vo
.
getLon
(),
vo
.
getLat
(),
vo
.
getAddrCity
(),
vo
.
getState
(),
vo
.
getIsShow
(),
vo
.
getIsDel
()
));
PageInfo
<
CompanySearchVO
>
branchCompanyPageInfo
=
new
PageInfo
<>(
getList
(
vo
));
return
PageDataVO
.
pageInfo
(
branchCompanyPageInfo
);
}
public
List
<
CompanySearchVO
>
getList
(
CompanySearchDTO
vo
){
return
mapper
.
search
(
vo
);
}
@Cache
(
key
=
RedisKey
.
BRANCH_COMPANY_CACHE_ALL
)
public
List
<
BranchCompany
>
getAll
()
{
Example
example
=
new
Example
(
BranchCompany
.
class
);
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/mapper/BranchCompanyMapper.java
View file @
c8a1f811
...
...
@@ -2,6 +2,8 @@ package com.xxfc.platform.vehicle.mapper;
import
com.alibaba.fastjson.JSONObject
;
import
com.xxfc.platform.vehicle.entity.BranchCompany
;
import
com.xxfc.platform.vehicle.pojo.CompanySearchDTO
;
import
com.xxfc.platform.vehicle.pojo.CompanySearchVO
;
import
com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO
;
import
com.xxfc.platform.vehicle.pojo.dto.BranchCompanyListDTO
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -13,7 +15,7 @@ import java.util.List;
import
java.util.Map
;
public
interface
BranchCompanyMapper
extends
Mapper
<
BranchCompany
>,
SelectByIdListMapper
<
BranchCompany
,
Integer
>
{
List
<
BranchCompany
>
search
(
@Param
(
"lon"
)
String
lon
,
@Param
(
"lat"
)
String
lat
,
@Param
(
"addrCity"
)
Integer
addrCity
,
Integer
state
,
Integer
isShow
,
Integer
isDel
);
List
<
CompanySearchVO
>
search
(
CompanySearchDTO
companySearchDTO
);
List
<
BranchCompany
>
selectByZoneId
(
Map
<
String
,
Object
>
param
);
List
<
Integer
>
findCompanyIdsByAreaId
(
@Param
(
"areaId"
)
Integer
areaId
);
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/BranchCompanyController.java
View file @
c8a1f811
...
...
@@ -74,12 +74,6 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> {
return
RestResponse
.
data
(
baseBiz
.
getAll
(
page
,
limit
,
addrProvince
,
addrCity
,
addrTown
,
null
,
null
));
}
@RequestMapping
(
value
=
"/search"
,
method
=
RequestMethod
.
GET
)
@IgnoreUserToken
@IgnoreClientToken
public
RestResponse
<
PageDataVO
<
BranchCompany
>>
search
(
@Validated
CompanySearchDTO
vo
)
{
return
RestResponse
.
data
(
baseBiz
.
search
(
vo
));
}
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
GET
)
public
RestResponse
<
List
<
BranchCompany
>>
getAll
()
{
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/admin/AdminBranchCompanyController.java
0 → 100644
View file @
c8a1f811
package
com
.
xxfc
.
platform
.
vehicle
.
rest
.
admin
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.xxfc.platform.vehicle.biz.BranchCompanyBiz
;
import
com.xxfc.platform.vehicle.common.RestResponse
;
import
com.xxfc.platform.vehicle.entity.BranchCompany
;
import
com.xxfc.platform.vehicle.pojo.CompanySearchDTO
;
import
com.xxfc.platform.vehicle.pojo.CompanySearchVO
;
import
io.swagger.annotations.Api
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
@RestController
@RequestMapping
(
"admin/branchCompany"
)
@Slf4j
@IgnoreClientToken
@IgnoreUserToken
@Api
(
value
=
"公司controller"
,
tags
={
"公司操作接口"
})
public
class
AdminBranchCompanyController
extends
BaseController
<
BranchCompanyBiz
,
BranchCompany
>
{
@RequestMapping
(
value
=
"/search"
,
method
=
RequestMethod
.
GET
)
public
RestResponse
<
PageDataVO
<
CompanySearchVO
>>
search
(
@Validated
CompanySearchDTO
vo
)
{
return
RestResponse
.
data
(
baseBiz
.
search
(
vo
));
}
@RequestMapping
(
value
=
"/details"
,
method
=
RequestMethod
.
GET
)
public
RestResponse
details
(
@Validated
CompanySearchDTO
vo
)
{
List
<
CompanySearchVO
>
list
=
baseBiz
.
getList
(
vo
);
CompanySearchVO
companySearchVO
=
new
CompanySearchVO
();
if
(
list
.
size
()
>
0
){
companySearchVO
=
list
.
get
(
0
);
}
return
RestResponse
.
data
(
companySearchVO
);
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/admin/CompanyInfoController.java
View file @
c8a1f811
...
...
@@ -2,8 +2,8 @@ package com.xxfc.platform.vehicle.rest.admin;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.xxfc.platform.vehicle.biz.CompanyInfoBiz
;
import
com.xxfc.platform.vehicle.common.BaseController
;
import
com.xxfc.platform.vehicle.entity.CompanyInfo
;
import
com.xxfc.platform.vehicle.pojo.dto.CompanyInfoFindDTO
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping
(
"company/info"
)
public
class
CompanyInfoController
extends
BaseController
<
CompanyInfoBiz
>
{
public
class
CompanyInfoController
extends
BaseController
<
CompanyInfoBiz
,
CompanyInfo
>
{
...
...
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/BranchCompanyMapper.xml
View file @
c8a1f811
...
...
@@ -7,6 +7,7 @@
-->
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"name"
property=
"name"
jdbcType=
"VARCHAR"
/>
<result
column=
"short_name"
property=
"shortName"
jdbcType=
"VARCHAR"
/>
<result
column=
"branch_type"
property=
"branchType"
jdbcType=
"INTEGER"
/>
<result
column=
"subordinate_branch"
property=
"subordinateBranch"
jdbcType=
"INTEGER"
/>
<result
column=
"addr_province"
property=
"addrProvince"
jdbcType=
"INTEGER"
/>
...
...
@@ -23,32 +24,48 @@
<result
column=
"state"
property=
"state"
/>
</resultMap>
<select
id=
"search"
resultType=
"com.xxfc.platform.vehicle.pojo.CompanySearchVO"
>
select
*
<select
id=
"search"
parameterType=
"com.xxfc.platform.vehicle.pojo.CompanySearchDTO"
resultType=
"com.xxfc.platform.vehicle.pojo.CompanySearchVO"
>
select
c.*,i.name as companyName
<if
test=
"lon != null and lat != null"
>
, st_distance_sphere(point(#{lon}, #{lat}), point(
longitude,
latitude)) as distance
, st_distance_sphere(point(#{lon}, #{lat}), point(
c.longitude, c.
latitude)) as distance
</if>
from branch_company
from branch_company c
LEFT JOIN company_info i on c.company_id=i.id
<where>
c.is_del = 0
<if
test=
"id != null"
>
and c.id = #{id}
</if>
<if
test=
"addrCity != null"
>
and (addr_city = #{addrCity} or addr_province = #{addrCity} or addr_town = #{addrCity})
and (c.addr_city = #{addrCity} or c.addr_province = #{addrCity} or c.addr_town = #{addrCity})
</if>
<if
test=
"addrProvince != null"
>
and c.addr_province = #{addrCity}
</if>
<if
test=
"lon != null and lat != null"
>
and
longitude is not null and
latitude is not null
and
c.longitude is not null and c.
latitude is not null
</if>
<if
test=
"state != null"
>
and state = #{state}
and c.state = #{state}
</if>
<if
test=
"companyId != null"
>
and c.company_id = #{companyId}
</if>
<if
test=
"isShow != null"
>
and is_show = #{isShow}
and
c.
is_show = #{isShow}
</if>
<if
test=
"
isDel != null
"
>
and
is_del = #{isDel}
<if
test=
"
name != null and name != ''
"
>
and
( c.name like concat('%',#{name},'%') or c.short_name like concat('%',#{name},'%') )
</if>
</where>
<if
test=
"lon != null and lat != null"
>
order by distance asc
</if>
<choose>
<when
test=
"lon != null and lat != null"
>
order by c.distance asc
</when>
<otherwise>
order by c.id desc
</otherwise>
</choose>
</select>
<select
id=
"selectByZoneId"
parameterType=
"java.util.Map"
resultType=
"com.xxfc.platform.vehicle.entity.BranchCompany"
>
...
...
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