java集合体检套餐管理系统_基于ssm vue的综合项目 健康体检管理系统-第六章

移动端开发对体检预约进行的查询

211991542_1_20210103093310377

211991542_2_20210103093310807

当页面加载完毕时,利用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);

}

});

}

211991542_3_20210103093310947

根据套餐查询套餐信息和检查组、检查项的信息

点击套餐前台进行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

211991542_4_2021010309331141.png

传递到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)

211991542_5_20210103093311104.png

再将查询出来的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})

211991542_6_20210103093311182.png

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值