java集合体检套餐管理系统_基于ssm vue的综合项目 健康体检管理系统-第六章
移動(dòng)端開發(fā)對(duì)體檢預(yù)約進(jìn)行的查詢
當(dāng)頁(yè)面加載完畢時(shí),利用vue的鉤子函數(shù)
已加載頁(yè)面就直接查詢數(shù)據(jù)將數(shù)據(jù)進(jìn)行渲染
created() {
axios.post("/setmeal/getSetmeal.do").then((response) => {
if (response.data.flag) {
this.setmealList = response.data.data;
} else {
this.$message.error(response.data.message);
}
});
}
根據(jù)套餐查詢套餐信息和檢查組、檢查項(xiàng)的信息
點(diǎn)擊套餐前臺(tái)進(jìn)行js截取id以及傳遞的參數(shù)傳遞給后臺(tái)
后臺(tái)接受到數(shù)據(jù)就進(jìn)行查詢
由于傳遞到后臺(tái)的只有一個(gè)id
這里需要多表查詢需要使用到mybatis的高級(jí)特性
/**
* 查詢套餐的基礎(chǔ)信息
* @param id 套餐的id
* @return 套餐實(shí)體類
*/
Setmeal findAssociationById(Integer id);
property="checkGroups"
ofType="com.itheima.pojo.CheckGroup"
javaType="java.util.List"
column="id"
select="com.itheima.dao.CheckgroupDao.findCheckgroupBySetmealId"/>
select id,
name,
code,
helpCode,
sex,
age,
price,
remark,
attention,
img
from t_setmeal where id=#{id}
select * from t_setmeal
查詢套餐的基礎(chǔ)信息,將查詢出來的結(jié)果的id
傳遞到CheckgroupDao的findCheckgroupBySetmealId
CheckGroup findCheckgroupBySetmealId(Integer id);
property="checkItems"
javaType="java.util.List"
ofType="com.itheima.pojo.CheckItem"
column="id"
select="com.itheima.dao.CheckItemDao.findCheckitemByCheckgroup"/>
select id, code, name, helpCode, sex, remark, attention
from t_checkgroup
where id in (select checkgroup_id from t_setmeal_checkgroup where setmeal_id = #{id})
根據(jù)套餐的id查詢套餐和檢查組的中間表的檢查組的id
然后在根據(jù)檢查組的id查詢檢查組的信息
SELECT * FROM t_checkgroup WHERE id in(SELECT checkgroup_id FROM t_setmeal_checkgroup where setmeal_id=12)
再將查詢出來的id帶到檢查項(xiàng)去查詢檢查項(xiàng)的信息
select id,
code,
name,
sex,
age,
price,
type,
attention,
remark
from t_checkitem
where id in (select checkitem_id from t_checkgroup_checkitem where checkgroup_id = #{id})
Freemaker入門案例
@Test
public void test1() throws Exception {
/*
1.創(chuàng)建freemarker的配置
Freemarker為了兼容不同版本,使用配置類的構(gòu)造方法來創(chuàng)建不同的運(yùn)行環(huán)境2.3.23
*/
Configuration configuration = new Configuration(Configuration.VERSION_2_3_23);
/*
2.對(duì)配置進(jìn)行配置 (配置模板的指定目錄,使用類加載器獲取ftl目錄的路徑)
*/
String ftlDirectory = FreemarkerTest.class.getResource("/ftl/").getPath();
//3.設(shè)置模板所在的目錄
configuration.setDirectoryForTemplateLoading(new File(ftlDirectory));
//4.配置模板文件的默認(rèn)字符集
configuration.setDefaultEncoding("utf-8");
//5.獲取指定模板文件的對(duì)象
Template template = configuration.getTemplate("freemarkertest.ftl");
//6.構(gòu)建出數(shù)據(jù)模型
Map map = new HashMap();
map.put("name", "kobe");
map.put("address", "beijing");
//7.生成靜態(tài)化文件
FileWriter fileWriter = new FileWriter("d:/index.html");
template.process(map, fileWriter);
//釋放資源
fileWriter.close();
}
freemarker入門案例你好${name},歡迎來到${address}。
來源:https://www.icode9.com/content-4-808601.html
總結(jié)
以上是生活随笔為你收集整理的java集合体检套餐管理系统_基于ssm vue的综合项目 健康体检管理系统-第六章的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mybatis的resultMap配置详
- 下一篇: Vue实战篇三十一:实现一个改进版的头条