java集合体检套餐管理系统_基于ssm vue的综合项目 健康体检管理系统-第六章
移動端開發對體檢預約進行的查詢
當頁面加載完畢時,利用vue的鉤子函數
已加載頁面就直接查詢數據將數據進行渲染
created() {
axios.post("/setmeal/getSetmeal.do").then((response) => {
if (response.data.flag) {
this.setmealList = response.data.data;
} else {
this.$message.error(response.data.message);
}
});
}
根據套餐查詢套餐信息和檢查組、檢查項的信息
點擊套餐前臺進行js截取id以及傳遞的參數傳遞給后臺
后臺接受到數據就進行查詢
由于傳遞到后臺的只有一個id
這里需要多表查詢需要使用到mybatis的高級特性
/**
* 查詢套餐的基礎信息
* @param id 套餐的id
* @return 套餐實體類
*/
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
查詢套餐的基礎信息,將查詢出來的結果的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})
根據套餐的id查詢套餐和檢查組的中間表的檢查組的id
然后在根據檢查組的id查詢檢查組的信息
SELECT * FROM t_checkgroup WHERE id in(SELECT checkgroup_id FROM t_setmeal_checkgroup where setmeal_id=12)
再將查詢出來的id帶到檢查項去查詢檢查項的信息
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.創建freemarker的配置
Freemarker為了兼容不同版本,使用配置類的構造方法來創建不同的運行環境2.3.23
*/
Configuration configuration = new Configuration(Configuration.VERSION_2_3_23);
/*
2.對配置進行配置 (配置模板的指定目錄,使用類加載器獲取ftl目錄的路徑)
*/
String ftlDirectory = FreemarkerTest.class.getResource("/ftl/").getPath();
//3.設置模板所在的目錄
configuration.setDirectoryForTemplateLoading(new File(ftlDirectory));
//4.配置模板文件的默認字符集
configuration.setDefaultEncoding("utf-8");
//5.獲取指定模板文件的對象
Template template = configuration.getTemplate("freemarkertest.ftl");
//6.構建出數據模型
Map map = new HashMap();
map.put("name", "kobe");
map.put("address", "beijing");
//7.生成靜態化文件
FileWriter fileWriter = new FileWriter("d:/index.html");
template.process(map, fileWriter);
//釋放資源
fileWriter.close();
}
freemarker入門案例你好${name},歡迎來到${address}。
來源:https://www.icode9.com/content-4-808601.html
總結
以上是生活随笔為你收集整理的java集合体检套餐管理系统_基于ssm vue的综合项目 健康体检管理系统-第六章的全部內容,希望文章能夠幫你解決所遇到的問題。
                            
                        - 上一篇: mybatis的resultMap配置详
 - 下一篇: java 文件checksum_计算文件