Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
BudgetManagementSystem
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
王利雷
BudgetManagementSystem
Commits
2a71c759
Commit
2a71c759
authored
May 19, 2019
by
shj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
差旅费数据库添加数据
parent
d6679a63
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
6 deletions
+80
-6
budgetmanagementsystem-5-19.sql
database/budgetmanagementsystem-5-19.sql
+0
-0
DatabaseQueryHandler.java
src/main/java/handlers/DatabaseQueryHandler.java
+35
-4
budgetDetail.jsp
src/main/webapp/budgetDetail.jsp
+45
-2
No files found.
database/budgetmanagementsystem-5-19.sql
0 → 100644
View file @
2a71c759
This diff is collapsed.
Click to expand it.
src/main/java/handlers/DatabaseQueryHandler.java
View file @
2a71c759
package
handlers
;
import
beans.Budget
;
import
beans.Consultation
;
import
beans.Equipment
;
import
beans.Labour
;
import
beans.*
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
dao.IConsultationDao
;
import
dao.IEquipmentDao
;
import
dao.ILabourDao
;
import
dao.ITravelDao
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -104,4 +102,37 @@ public class DatabaseQueryHandler {
e
.
printStackTrace
();
}
}
@Autowired
private
ITravelDao
travelDao
;
@RequestMapping
(
"/Travel"
)
public
void
queryTravel
(
HttpServletRequest
request
,
HttpServletResponse
response
){
try
{
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setContentType
(
"text/html;charset=utf-8"
);
PrintWriter
writer
=
response
.
getWriter
();
JSONObject
object
=
new
JSONObject
();
List
<
Travel
>
travels
=
travelDao
.
selectAll
();
List
<
JSONObject
>
list
=
new
LinkedList
<>();
for
(
Travel
item
:
travels
)
{
JSONObject
obj
=
new
JSONObject
();
obj
.
put
(
"id"
,
item
.
getId
());
obj
.
put
(
"name"
,
item
.
getName
());
obj
.
put
(
"price"
,
item
.
getPrice
());
obj
.
put
(
"food"
,
item
.
getFood
());
obj
.
put
(
"traffic"
,
item
.
getTraffic
());
obj
.
put
(
"accommodation"
,
item
.
getAccommodation
());
obj
.
put
(
"people"
,
item
.
getPeople
());
obj
.
put
(
"days"
,
item
.
getDays
());
obj
.
put
(
"nums"
,
0
);
list
.
add
(
obj
);
}
object
.
put
(
"data"
,
list
);
writer
.
write
(
JSON
.
toJSONString
(
object
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
src/main/webapp/budgetDetail.jsp
View file @
2a71c759
...
...
@@ -290,6 +290,27 @@
<button
class=
"btn btn-success"
@
click=
"add(sample)"
>
添加
</button>
</td>
</tr>
<tr
class=
"info"
v-if=
"database.length>0"
>
<td>
<select
v-model=
"selectedIndex"
class=
"form-control"
>
<option
v-for=
"(record,i) in database"
:value=
"i"
>
{{record.name}}
</option>
</select>
</td>
<td>
<input
type=
"number"
v-model=
"database[selectedIndex].price"
class=
"form-control"
>
</td>
<td><input
type=
"number"
v-model=
"database[selectedIndex].food"
class=
"form-control"
></td>
<td><input
type=
"number"
v-model=
"database[selectedIndex].traffic"
class=
"form-control"
></td>
<td><input
type=
"number"
v-model=
"database[selectedIndex].accommodation"
class=
"form-control"
></td>
<td><input
type=
"number"
v-model=
"database[selectedIndex].people"
class=
"form-control"
></td>
<td><input
type=
"number"
v-model=
"database[selectedIndex].days"
class=
"form-control"
></td>
<td>
<button
class=
"btn btn-success"
@
click=
"add(database[selectedIndex])"
>
添加
</button>
</td>
</tr>
</tbody>
</table>
</div>
...
...
@@ -850,7 +871,9 @@
el
:
"#travel"
,
data
:
{
items
:
[],
sample
:
{
name
:
"sample"
,
price
:
0
,
food
:
0
,
accommodation
:
0
,
traffic
:
0
,
days
:
0
,
people
:
0
,
nums
:
0
}
sample
:
{
name
:
"sample"
,
price
:
0
,
food
:
0
,
accommodation
:
0
,
traffic
:
0
,
days
:
0
,
people
:
0
,
nums
:
0
},
database
:[{
name
:
"sample"
,
price
:
0
,
food
:
0
,
accommodation
:
0
,
traffic
:
0
,
days
:
0
,
people
:
0
,
nums
:
0
}],
selectedIndex
:
0
},
methods
:
{
update
:
function
(
item
)
{
...
...
@@ -867,7 +890,27 @@
function
(
data
)
{
this
.
items
=
data
.
body
.
data
;
console
.
log
(
"showlist"
);
updateBudgetPage
(
"travel"
)
updateBudgetPage
(
"travel"
);
this
.
showDatabase
();
},
function
(
error
)
{
console
.
log
(
error
)
}
)
},
showDatabase
:
function
(){
this
.
$http
.
get
(
"${pageContext.request.contextPath}/Database/Query/Travel"
).
then
(
function
(
data
)
{
var
tmp
=
data
.
body
.
data
;
for
(
var
i
=
0
;
i
<
tmp
.
length
;
i
++
)
{
if
(
inItems
(
tmp
[
i
],
this
.
items
)){
console
.
log
(
"inItems:true, "
+
tmp
[
i
].
name
);
tmp
.
splice
(
i
,
1
);
i
--
;
}
}
this
.
database
=
tmp
;
console
.
log
(
"show database"
);
},
function
(
error
)
{
console
.
log
(
error
)
}
...
...
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