Commit eb1f1ccf by shj

优化导出的费用清单和费用说明

parent d7d1d941
...@@ -6,4 +6,8 @@ import java.util.List; ...@@ -6,4 +6,8 @@ import java.util.List;
public interface IPowerDao { public interface IPowerDao {
List<Power> selectAll(); List<Power> selectAll();
void insertPower(Power power);
void deletePower(Power power);
} }
...@@ -5,4 +5,10 @@ ...@@ -5,4 +5,10 @@
<select id="selectAll" resultType="beans.Power"> <select id="selectAll" resultType="beans.Power">
select * from power select * from power
</select> </select>
<insert id="insertPower" useGeneratedKeys="true" keyProperty="id">
insert into power(name,price) values (#{name},#{price})
</insert>
<delete id="deletePower">
delete from power where id=#{id}
</delete>
</mapper> </mapper>
\ No newline at end of file
...@@ -10,14 +10,14 @@ ...@@ -10,14 +10,14 @@
</select> </select>
<insert id="insertTravel"> <insert id="insertTravel">
insert into budgetmanagementsystem.travel(name, price, food, traffic, accommodation) insert into budgetmanagementsystem.travel(name, price, food, traffic, accommodation)
values (#{dest},#{price},#{food},#{traffic},#{accommodation}) values (#{name},#{price},#{food},#{traffic},#{accommodation})
</insert> </insert>
<delete id="deleteTravel"> <delete id="deleteTravel">
delete from budgetmanagementsystem.travel where id=#{id} delete from budgetmanagementsystem.travel where id=#{id}
</delete> </delete>
<update id="updateTravel"> <update id="updateTravel">
update budgetmanagementsystem.travel update budgetmanagementsystem.travel
set name=#{dest},price=#{price},food=#{food},traffic=#{traffic},accommodation=#{accommodation} set name=#{name},price=#{price},food=#{food},traffic=#{traffic},accommodation=#{accommodation}
where id=#{id} where id=#{id}
</update> </update>
</mapper> </mapper>
\ No newline at end of file
...@@ -103,6 +103,32 @@ public class DatabaseQueryHandler { ...@@ -103,6 +103,32 @@ public class DatabaseQueryHandler {
} }
@Autowired @Autowired
private IPowerDao powerDao;
@RequestMapping("/Power")
public void queryPower(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<Power> powers = powerDao.selectAll();
List<JSONObject> list=new LinkedList<>();
for (Power item : powers) {
JSONObject obj=new JSONObject();
obj.put("id",item.getId());
obj.put("name",item.getName());
obj.put("price",item.getPrice());
obj.put("nums",0);
list.add(obj);
}
object.put("data",list);
writer.write(JSON.toJSONString(object));
} catch (IOException e) {
e.printStackTrace();
}
}
@Autowired
private ILabourDao labourDao; private ILabourDao labourDao;
@RequestMapping("/Labour") @RequestMapping("/Labour")
public void queryLabour(HttpServletRequest request, HttpServletResponse response){ public void queryLabour(HttpServletRequest request, HttpServletResponse response){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment