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
dc5fc768
Commit
dc5fc768
authored
Aug 27, 2019
by
hanfeng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master-bug-vmodel' into dev
parents
f6dac7cc
7c415ff5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
18 deletions
+43
-18
VehicleModel.java
...n/java/com/xxfc/platform/vehicle/entity/VehicleModel.java
+4
-0
VehicleModelVo.java
...n/java/com/xxfc/platform/vehicle/pojo/VehicleModelVo.java
+4
-0
VehicleModelController.java
...om/xxfc/platform/vehicle/rest/VehicleModelController.java
+35
-18
No files found.
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/entity/VehicleModel.java
View file @
dc5fc768
...
...
@@ -156,4 +156,8 @@ public class VehicleModel implements Serializable {
@Column
(
name
=
"poster_background"
)
@ApiModelProperty
(
value
=
"海报背景"
)
private
String
posterBackground
;
@Column
(
name
=
"sort"
)
@ApiModelProperty
(
value
=
"排序"
)
private
Integer
sort
;
}
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/VehicleModelVo.java
View file @
dc5fc768
...
...
@@ -168,6 +168,10 @@ public class VehicleModelVo extends VehicleModel implements Serializable {
@ApiModelProperty
(
value
=
"品牌"
)
private
String
brandName
;
@Column
(
name
=
"sort"
)
@ApiModelProperty
(
value
=
"排序"
)
private
Integer
sort
;
// @Column(name = "status")
// @ApiModelProperty(value = "状态 0--下架;1--上架")
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/VehicleModelController.java
View file @
dc5fc768
...
...
@@ -28,11 +28,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.web.bind.annotation.*
;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.weekend.WeekendSqls
;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -199,6 +200,7 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
vm
.
setCrtHost
(
host
);
vm
.
setIsdel
(
0
);
vm
.
setStatus
(
0
);
vm
.
setSort
(
0
);
vm
.
setVioDeposit
(
BigDecimal
.
valueOf
(
500
));
try
{
//插入数据到车型并返回id
...
...
@@ -259,18 +261,22 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
// 删除车型对应的标签
vehicleCataBiz
.
delete
(
vcDelete
);
ArrayList
<
VehicleCata
>
vcs
=
new
ArrayList
<>();
//从新插入车型对应的标签
// 获取cataid
String
[]
config
=
vm
.
getConfig
().
split
(
","
);
for
(
String
con
:
config
)
{
VehicleCata
vc
=
new
VehicleCata
();
vc
.
setCataId
(
Integer
.
parseInt
(
con
));
vc
.
setVehicleModelId
(
vm
.
getId
());
vc
.
setCrtTime
(
System
.
currentTimeMillis
());
vcs
.
add
(
vc
);
if
(
vm
.
getConfig
()!=
null
)
{
ArrayList
<
VehicleCata
>
vcs
=
new
ArrayList
<>();
String
[]
config
=
vm
.
getConfig
().
split
(
","
);
for
(
String
con
:
config
)
{
VehicleCata
vc
=
new
VehicleCata
();
vc
.
setCataId
(
Integer
.
parseInt
(
con
));
vc
.
setVehicleModelId
(
vm
.
getId
());
vc
.
setCrtTime
(
System
.
currentTimeMillis
());
vcs
.
add
(
vc
);
}
vehicleCataBiz
.
inserts
(
vcs
);
}
vehicleCataBiz
.
inserts
(
vcs
);
}
return
ObjectRestResponse
.
succ
();
}
catch
(
NumberFormatException
e
)
{
...
...
@@ -291,7 +297,6 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
if
(
id
==
1
||
id
==
14
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"The label cannot be deleted"
);
}
//2.进行逻辑删除
VehicleModel
vm
=
new
VehicleModel
();
vm
.
setId
(
id
);
...
...
@@ -308,13 +313,25 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
}
// @ApiOperation("查询所有")
// @RequestMapping(value = "/findAll", method = RequestMethod.GET)
// @ResponseBody
// public ObjectRestResponse findAll() {
// VehicleModel vehicleModel = new VehicleModel();
// vehicleModel.setIsdel(0);
// return ObjectRestResponse.succ(baseBiz.selectList(vehicleModel));
// }
@ApiOperation
(
"查询所有"
)
@RequestMapping
(
value
=
"/findAll"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ObjectRestResponse
findAll
()
{
VehicleModel
vehicleModel
=
new
VehicleModel
();
vehicleModel
.
setIsdel
(
0
);
return
ObjectRestResponse
.
succ
(
baseBiz
.
selectList
(
vehicleModel
));
public
ObjectRestResponse
getList
()
{
Example
exa
=
Example
.
builder
(
VehicleModel
.
class
).
where
(
WeekendSqls
.<
VehicleModel
>
custom
()
.
andEqualTo
(
VehicleModel:
:
getIsdel
,
0
)
).
orderByAsc
(
"sort"
).
build
();
return
ObjectRestResponse
.
succ
(
baseBiz
.
selectByExample
(
exa
));
}
/**
...
...
@@ -324,12 +341,13 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
* @param limit
* @return
*/
@ApiOperation
(
"优质车型"
)
@ApiOperation
(
"优质车型"
)
@GetMapping
(
value
=
"/goodList"
)
@IgnoreUserToken
public
ObjectRestResponse
<
List
<
GoodDataVO
>>
goodList
(
@RequestParam
(
value
=
"page"
)
Integer
page
,
@RequestParam
(
value
=
"limit"
)
Integer
limit
)
{
public
ObjectRestResponse
<
List
<
GoodDataVO
>>
goodList
(
@RequestParam
(
value
=
"page"
)
Integer
page
,
@RequestParam
(
value
=
"limit"
)
Integer
limit
)
{
return
ObjectRestResponse
.
succ
(
baseBiz
.
goodList
(
page
,
limit
));
}
@ApiOperation
(
"上下架"
)
@PutMapping
(
value
=
"/setStatus/{id}/{status}"
)
@Transactional
...
...
@@ -362,7 +380,6 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
e
.
printStackTrace
();
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
throw
new
BaseException
(
ResultCode
.
UPDATE_VEHICLE_FAIL
);
}
}
}
\ No newline at end of file
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