健康管理系统第二天(预约管理之检查项的增删改和分页展示)

一、需求分析

编易健康管理系统是一款应用于健康管理机构的业务系统,实现健康管理机构工作内容 可视化、患者管理专业化、健康评估数字化、健康干预流程化、知识库集成化,从而提 高健康管理师的工作效率,加强与患者间的互动,增强管理者对健康管理机构运营情况 的了解。
编易健康后台系统提供给健康管理机 构内部人员(包括系统管理员、健康管理师等)使用

# 源码资料
链接:https://pan.baidu.com/s/16iuNUlR2bgJeIF5MwjrcDw 
提取码:jsdg 
复制这段内容后打开百度网盘手机App,操作更方便哦

1.本项目功能架构图:

通过上面的功能架构图可以看到,编易健康后台管理系统有会员管理、预约管理、健康 评估、健康干预等功能。移动端有会员管理、体检预约、体检报告等功能。后台系统和 移动端应用都会通过Dubbo调用服务层发布的服务来完成具体的操作。本项目属于典型的SOA(面向服务)架构形式。
本章节完成的功能开发是预约管理功能,包括检查项管理、检查组管理、体检套餐管理、预约设置等(参见产品原型)。预约管理属于系统的基础功能,主要就是管理一些体检的基础数据。

二、基础环境搭建

1.根据资料中提供的health.pdm文件导出SQL脚本

链接:https://pan.baidu.com/s/1qnj2ojxD1dSS24DQ7ViXXg 
提取码:c1c1

2.导入预约管理模块实体类、所需公共资源

链接:https://pan.baidu.com/s/1xkA2ZGZn2ctwBpuvA7DWXA 
提取码:wzua


3.导入html、js、css、图片等静态资源到health_backend工程中,注意:后续随着项目开发还会陆续导入其他一些公共资源

链接:https://pan.baidu.com/s/1iCfJOV0R7dIJWKl2NwZOpQ 
提取码:8pxl


4.启动测试,查看页面效果
由于子模块中的代码进行了更新,所以在项目启动之前,先对父工程进行clean。

然后重新install

启动health_backend模块
点击如下标识:

然后使用tomcat7插件(tomcat7:run)的指令启动

在控制台运行效果如下:
访问main.html主页面:http://localhost:82/pages/main.html

三、检查项分页

本项目所有分页功能都是基于ajax的异步请求来完成的,请求参数和后台响应数据格式都使用json数据格式。
请求参数包括页码、每页显示记录数、查询条件。
请求参数的json格式为:{currentPage:1,pageSize:10,queryString:’‘itcast’’}
后台响应数据包括总记录数、当前页需要展示的数据集合。
响应数据的json格式为:{total:1000,rows:[]}

1.整个分页查询的执行流程

2.完善CheckItemController
package com.oracle.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.oracle.constant.MessageConstant;
import com.oracle.entity.PageResult;
import com.oracle.entity.QueryPageBean;
import com.oracle.entity.Result;
import com.oracle.pojo.CheckItem;
import com.oracle.service.CheckItemService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/checkitem")
public class CheckItemController {

    @Reference
    CheckItemService checkItemService;

    @RequestMapping("/findPage")
    public PageResult findPage(@RequestBody QueryPageBean queryPageBean){
        return checkItemService.findPage(queryPageBean);
    }
}
3.CheckItemService接口定义
package com.oracle.service;

import com.oracle.entity.PageResult;
import com.oracle.entity.QueryPageBean;
import com.oracle.pojo.CheckItem;

public interface CheckItemService {
    /*分页查询检查预约管理中的检查项管理*/
    PageResult findPage(QueryPageBean queryPageBean);
}
4.CheckItemService实现类
package com.oracle.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.oracle.dao.CheckItemDao;
import com.oracle.entity.PageResult;
import com.oracle.entity.QueryPageBean;
import com.oracle.pojo.CheckItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

@Service(interfaceClass = CheckItemService.class)
@Transactional //使用事务管理业务类
public class CheckItemServiceImpl implements CheckItemService {

    @Autowired
    CheckItemDao checkItemDao;

    @Override
    public PageResult findPage(QueryPageBean queryPageBean) {
        /*当前页数*/
        Integer currentPage = queryPageBean.getCurrentPage();
        /*每页条数*/
        Integer pageSize = queryPageBean.getPageSize();
        /*查询条件*/
        String queryString = queryPageBean.getQueryString();
        PageHelper.startPage(currentPage,pageSize);
        Page<CheckItem> checkItemPage = checkItemDao.selectByCondition(queryString);
        return new PageResult(checkItemPage.getTotal(),checkItemPage);
    }
}
5.CheckItemDao接口
package com.oracle.dao;

import com.github.pagehelper.Page;
import com.oracle.pojo.CheckItem;
import org.springframework.stereotype.Repository;

@Repository
public interface CheckItemDao {
    /*根据查询条件,调用分页插件进行分页展示*/
    Page<CheckItem> selectByCondition(String queryString);
}
6.Mybatis的mapper映射文件---CheckItemDao.xml
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.oracle.dao.CheckItemDao">
    <!--根据查询条件,调用分页插件进行分页展示-->
    <select id="selectByCondition" parameterType="String" resultType="com.oracle.pojo.CheckItem">
        select * from t_checkitem
        <if test="value !=null and value.length>0">
            where code=#{value} or name=#{value}
        </if>
    </select>
</mapper>
7.界面测试

四、新增检查项
1.CheckItem.html发送添加请求的流程

2.完善CheckItemController
package com.oracle.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.oracle.constant.MessageConstant;
import com.oracle.entity.PageResult;
import com.oracle.entity.QueryPageBean;
import com.oracle.entity.Result;
import com.oracle.pojo.CheckItem;
import com.oracle.service.CheckItemService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/checkitem")
public class CheckItemController {

    @Reference
    CheckItemService checkItemService;
    
	@RequestMapping("/findPage")
    public PageResult findPage(@RequestBody QueryPageBean queryPageBean){
        return checkItemService.findPage(queryPageBean);
    }

    @RequestMapping("/add")
    public Result addItem(@RequestBody CheckItem checkItem){
        try {
            checkItemService.addItem(checkItem); //新增成功
        } catch (Exception e) {
            //新增失败
            e.printStackTrace();
            //服务调用失败    Result是对于新增操作结果的封装
            return new Result(false, MessageConstant.ADD_CHECKITEM_FAIL);
        }
        return  new Result(true, MessageConstant.ADD_CHECKITEM_SUCCESS);
    }
}
3.CheckItemService接口
package com.oracle.service;

import com.oracle.entity.PageResult;
import com.oracle.entity.QueryPageBean;
import com.oracle.pojo.CheckItem;

public interface CheckItemService {
    /*分页查询检查预约管理中的检查项管理*/
    PageResult findPage(QueryPageBean queryPageBean);
    /*添加检查项*/
    void addItem(CheckItem checkItem);
}
4.CheckItemServiceImpl实现类
package com.oracle.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.oracle.dao.CheckItemDao;
import com.oracle.entity.PageResult;
import com.oracle.entity.QueryPageBean;
import com.oracle.pojo.CheckItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

@Service(interfaceClass = CheckItemService.class)
@Transactional //使用事务管理业务类
public class CheckItemServiceImpl implements CheckItemService {

    @Autowired
    CheckItemDao checkItemDao;

    @Override
    public PageResult findPage(QueryPageBean queryPageBean) {
        /*当前页数*/
        Integer currentPage = queryPageBean.getCurrentPage();
        /*每页条数*/
        Integer pageSize = queryPageBean.getPageSize();
        /*查询条件*/
        String queryString = queryPageBean.getQueryString();
        PageHelper.startPage(currentPage,pageSize);
        Page<CheckItem> checkItemPage = checkItemDao.selectByCondition(queryString);
        return new PageResult(checkItemPage.getTotal(),checkItemPage);
    }

    @Override
    public void addItem(CheckItem checkItem) {
        checkItemDao.addItem(checkItem);
    }
}
5.CheckItemDao
package com.oracle.dao;

import com.github.pagehelper.Page;
import com.oracle.pojo.CheckItem;
import org.springframework.stereotype.Repository;

@Repository
public interface CheckItemDao {
    /*根据查询条件,调用分页插件进行分页展示*/
    Page<CheckItem> selectByCondition(String queryString);
    /*添加检查项*/
    void addItem(CheckItem checkItem);
}
6.Mybatis的mapper映射文件---CheckItemDao.xml
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.oracle.dao.CheckItemDao">
    <!--根据查询条件,调用分页插件进行分页展示-->
    <select id="selectByCondition" parameterType="String" resultType="com.oracle.pojo.CheckItem">
        select * from t_checkitem
        <if test="value !=null and value.length>0">
            where code=#{value} or name=#{value}
        </if>
    </select>
    <!--添加检查项-->
    <insert id="addItem" parameterType="com.oracle.pojo.CheckItem">
        insert into t_checkitem values(null,#{code},#{name},#{sex},#{age},#{price},#{type},#{attention},#{remark})
    </insert>
</mapper>
7.界面测试


五、删除检查项

删除检查项的时候和查询、修改的流程一致的,但是删除数据库中的检查项时,如果删除的检查项和检查组没有关联时,可以直接删除检查项,如果删除的检查项和检查组有关联时,必须先删除检查组和检查项之间的关联表数据,然后再删除检查项的内容。

1.CheckItem.html发送删除请求的流程

2.完善CheckItemController
package com.oracle.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.oracle.constant.MessageConstant;
import com.oracle.entity.PageResult;
import com.oracle.entity.QueryPageBean;
import com.oracle.entity.Result;
import com.oracle.pojo.CheckItem;
import com.oracle.service.CheckItemService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/checkitem")
public class CheckItemController {

    @Reference
    CheckItemService checkItemService;

    @RequestMapping("/findPage")
    public PageResult findPage(@RequestBody QueryPageBean queryPageBean){
        return checkItemService.findPage(queryPageBean);
    }

    @RequestMapping("/add")
    public Result addItem(@RequestBody CheckItem checkItem){
        try {
            checkItemService.addItem(checkItem); //新增成功
        } catch (Exception e) {
            //新增失败
            e.printStackTrace();
            //服务调用失败    Result是对于新增操作结果的封装
            return new Result(false, MessageConstant.ADD_CHECKITEM_FAIL);
        }
        return  new Result(true, MessageConstant.ADD_CHECKITEM_SUCCESS);
    }

    @RequestMapping("/delete")
    public Result deleteCheckItem(Integer id){
        try {
            checkItemService.deleteCheckItem(id);
        } catch (Exception e) {
            //删除失败
            e.printStackTrace();
            //服务调用失败    Result是对于新增操作结果的封装
            return new Result(false, MessageConstant.DELETE_CHECKITEM_FAIL);
        }
        return  new Result(true, MessageConstant.DELETE_CHECKITEM_SUCCESS);
    }
}
3.CheckItemService接口
package com.oracle.service;

import com.oracle.entity.PageResult;
import com.oracle.entity.QueryPageBean;
import com.oracle.pojo.CheckItem;

public interface CheckItemService {
    /*分页查询检查预约管理中的检查项管理*/
    PageResult findPage(QueryPageBean queryPageBean);
    /*添加检查项*/
    void addItem(CheckItem checkItem);
    /*删除检查项*/
    void deleteCheckItem(Integer id);
}
4.CheckItemServiceImpl实现类
package com.oracle.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.oracle.dao.CheckItemDao;
import com.oracle.entity.PageResult;
import com.oracle.entity.QueryPageBean;
import com.oracle.pojo.CheckItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

@Service(interfaceClass = CheckItemService.class)
@Transactional //使用事务管理业务类
public class CheckItemServiceImpl implements CheckItemService {

    @Autowired
    CheckItemDao checkItemDao;

    @Override
    public PageResult findPage(QueryPageBean queryPageBean) {
        /*当前页数*/
        Integer currentPage = queryPageBean.getCurrentPage();
        /*每页条数*/
        Integer pageSize = queryPageBean.getPageSize();
        /*查询条件*/
        String queryString = queryPageBean.getQueryString();
        PageHelper.startPage(currentPage,pageSize);
        Page<CheckItem> checkItemPage = checkItemDao.selectByCondition(queryString);
        return new PageResult(checkItemPage.getTotal(),checkItemPage);
    }

    @Override
    public void addItem(CheckItem checkItem) {
        checkItemDao.addItem(checkItem);
    }

    @Override
    public void deleteCheckItem(Integer id) {
        /*先判断有没有与之对应的关联数据,如果没有就删除,如果有就先删除关联表中的数据,然后再删除checkitem中对应的数据*/
        /**
         * 由于t_checkItem表与t_checkGroup表之间是多对多的关系,所以不能之间删除里面的记录
         * 必须先删除关联表中的数据,然后再删除CheckItem中的记录
         */
        Integer count = checkItemDao.findCountById(id);
        if(count>0){
            /*先删除关联表中的记录*/
            checkItemDao.deleteCheckGroup_CheckItem(id);
        }
        checkItemDao.deleteCheckItem(id);
    }
}
5.CheckItemDao
package com.oracle.dao;

import com.github.pagehelper.Page;
import com.oracle.pojo.CheckItem;
import org.springframework.stereotype.Repository;

@Repository
public interface CheckItemDao {
    /*根据查询条件,调用分页插件进行分页展示*/
    Page<CheckItem> selectByCondition(String queryString);
    /*添加检查项*/
    void addItem(CheckItem checkItem);

    /*查询关联表中是否存在id的关联数据*/
    Integer findCountById(Integer id);
    /*先删除关联表中的记录*/
    void deleteCheckGroup_CheckItem(Integer id);
    /*删除检查项*/
    void deleteCheckItem(Integer id);
}
6.Mybatis的mapper映射文件---CheckItemDao.xml
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.oracle.dao.CheckItemDao">
    <!--根据查询条件,调用分页插件进行分页展示-->
    <select id="selectByCondition" parameterType="String" resultType="com.oracle.pojo.CheckItem">
        select * from t_checkitem
        <if test="value !=null and value.length>0">
            where code=#{value} or name=#{value}
        </if>
    </select>
    
    <!--添加检查项-->
    <insert id="addItem" parameterType="com.oracle.pojo.CheckItem">
        insert into t_checkitem values(null,#{code},#{name},#{sex},#{age},#{price},#{type},#{attention},#{remark})
    </insert>

    <!--先判断t_checkgroup_checkItem有没有与之对应的管理数据-->
    <select id="findCountById" parameterType="Integer" resultType="Integer">
        select count(*) from t_checkgroup_checkitem where checkitem_id = #{id}
    </select>
    <!--先删除关联表中的记录-->
    <delete id="deleteCheckGroup_CheckItem" parameterType="Integer">
        delete from t_checkgroup_checkitem where checkitem_id = #{id}
    </delete>
    <!--然后再删除检查项-->
    <delete id="deleteCheckItem" parameterType="Integer">
        delete from t_checkitem where id = #{id}
    </delete>
</mapper>
7.界面测试


六、编辑检查项
1.CheckItem.html发送编辑请求的流程

2.完善CheckItemController

前端发送了两个请求:一个是点击编辑按钮之后的数据回显,另一个是点击确定之后的编辑的数据的更新

package com.oracle.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.oracle.constant.MessageConstant;
import com.oracle.entity.PageResult;
import com.oracle.entity.QueryPageBean;
import com.oracle.entity.Result;
import com.oracle.pojo.CheckItem;
import com.oracle.service.CheckItemService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/checkitem")
public class CheckItemController {

    @Reference
    CheckItemService checkItemService;

    @RequestMapping("/findPage")
    public PageResult findPage(@RequestBody QueryPageBean queryPageBean){
        return checkItemService.findPage(queryPageBean);
    }

    @RequestMapping("/add")
    public Result addItem(@RequestBody CheckItem checkItem){
        try {
            checkItemService.addItem(checkItem); //新增成功
        } catch (Exception e) {
            //新增失败
            e.printStackTrace();
            //服务调用失败    Result是对于新增操作结果的封装
            return new Result(false, MessageConstant.ADD_CHECKITEM_FAIL);
        }
        return  new Result(true, MessageConstant.ADD_CHECKITEM_SUCCESS);
    }

    @RequestMapping("/delete")
    public Result deleteCheckItem(Integer id){
        try {
            checkItemService.deleteCheckItem(id);
        } catch (Exception e) {
            //删除失败
            e.printStackTrace();
            //服务调用失败    Result是对于新增操作结果的封装
            return new Result(false, MessageConstant.DELETE_CHECKITEM_FAIL);
        }
        return  new Result(true, MessageConstant.DELETE_CHECKITEM_SUCCESS);
    }


	@RequestMapping("/findById")
    public Result findCheckItemById(Integer id){
        CheckItem checkItem=null;
        try {
            checkItem = checkItemService.findCheckItemById(id);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false, MessageConstant.QUERY_CHECKITEM_FAIL);
        }
        return new Result(true, MessageConstant.QUERY_CHECKITEM_SUCCESS,checkItem);
    }

    @RequestMapping("/edit")
    public Result editCheckItem_Submit(@RequestBody CheckItem checkItem){
        try {
            checkItemService.editCheckItem_Submit(checkItem);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false, MessageConstant.EDIT_CHECKITEM_FAIL);
        }
        return new Result(true, MessageConstant.EDIT_CHECKITEM_SUCCESS);
    }
}
3.CheckItemService接口
package com.oracle.service;

import com.oracle.entity.PageResult;
import com.oracle.entity.QueryPageBean;
import com.oracle.pojo.CheckItem;

public interface CheckItemService {
    /*分页查询检查预约管理中的检查项管理*/
    PageResult findPage(QueryPageBean queryPageBean);
    /*添加检查项*/
    void addItem(CheckItem checkItem);
    /*删除检查项*/
    void deleteCheckItem(Integer id);
    /*编辑检查项时先进行数据回显*/
    CheckItem findCheckItemById(Integer id);
    /*编辑完检查项之后提交检查项*/
    void editCheckItem_Submit(CheckItem checkItem);
}
4.CheckItemServiceImpl实现类
package com.oracle.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.oracle.dao.CheckItemDao;
import com.oracle.entity.PageResult;
import com.oracle.entity.QueryPageBean;
import com.oracle.pojo.CheckItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

@Service(interfaceClass = CheckItemService.class)
@Transactional //使用事务管理业务类
public class CheckItemServiceImpl implements CheckItemService {

    @Autowired
    CheckItemDao checkItemDao;

    @Override
    public PageResult findPage(QueryPageBean queryPageBean) {
        /*当前页数*/
        Integer currentPage = queryPageBean.getCurrentPage();
        /*每页条数*/
        Integer pageSize = queryPageBean.getPageSize();
        /*查询条件*/
        String queryString = queryPageBean.getQueryString();
        PageHelper.startPage(currentPage,pageSize);
        Page<CheckItem> checkItemPage = checkItemDao.selectByCondition(queryString);
        return new PageResult(checkItemPage.getTotal(),checkItemPage);
    }

    @Override
    public void addItem(CheckItem checkItem) {
        checkItemDao.addItem(checkItem);
    }

    @Override
    public void deleteCheckItem(Integer id) {
        /*先判断有没有与之对应的关联数据,如果没有就删除,如果有就先删除关联表中的数据,然后再删除checkitem中对应的数据*/
        /**
         * 由于t_checkItem表与t_checkGroup表之间是多对多的关系,所以不能之间删除里面的记录
         * 必须先删除关联表中的数据,然后再删除CheckItem中的记录
         */
        Integer count = checkItemDao.findCountById(id);
        if(count>0){
            /*先删除关联表中的记录*/
            checkItemDao.deleteCheckGroup_CheckItem(id);
        }
        checkItemDao.deleteCheckItem(id);
    }
    
	@Override
    public CheckItem findCheckItemById(Integer id) {
        return checkItemDao.findCheckItemById(id);
    }

    @Override
    public void editCheckItem_Submit(CheckItem checkItem) {
        checkItemDao.editCheckItem_Submit(checkItem);
    }
}
5.CheckItemDao
package com.oracle.dao;

import com.github.pagehelper.Page;
import com.oracle.pojo.CheckItem;
import org.springframework.stereotype.Repository;

@Repository
public interface CheckItemDao {
    /*根据查询条件,调用分页插件进行分页展示*/
    Page<CheckItem> selectByCondition(String queryString);
    /*添加检查项*/
    void addItem(CheckItem checkItem);

    /*查询关联表中是否存在id的关联数据*/
    Integer findCountById(Integer id);
    /*先删除关联表中的记录*/
    void deleteCheckGroup_CheckItem(Integer id);
    /*删除检查项*/
    void deleteCheckItem(Integer id);

	/*检查项数据回显*/
    CheckItem findCheckItemById(Integer id);
    /*编辑完检查项之后提交检查项*/
    void editCheckItem_Submit(CheckItem checkItem);
}
6.Mybatis的mapper映射文件---CheckItemDao.xml
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.oracle.dao.CheckItemDao">
    <!--根据查询条件,调用分页插件进行分页展示-->
    <select id="selectByCondition" parameterType="String" resultType="com.oracle.pojo.CheckItem">
        select * from t_checkitem
        <if test="value !=null and value.length>0">
            where code=#{value} or name=#{value}
        </if>
    </select>
    
    <!--添加检查项-->
    <insert id="addItem" parameterType="com.oracle.pojo.CheckItem">
        insert into t_checkitem values(null,#{code},#{name},#{sex},#{age},#{price},#{type},#{attention},#{remark})
    </insert>

    <!--先判断t_checkgroup_checkItem有没有与之对应的管理数据-->
    <select id="findCountById" parameterType="Integer" resultType="Integer">
        select count(*) from t_checkgroup_checkitem where checkitem_id = #{id}
    </select>
    <!--先删除关联表中的记录-->
    <delete id="deleteCheckGroup_CheckItem" parameterType="Integer">
        delete from t_checkgroup_checkitem where checkitem_id = #{id}
    </delete>
    <!--然后再删除检查项-->
    <delete id="deleteCheckItem" parameterType="Integer">
        delete from t_checkitem where id = #{id}
    </delete>

    <!--检查项数据回显-->
    <select id="findCheckItemById" parameterType="Integer" resultType="com.oracle.pojo.CheckItem">
        select * from t_checkItem where id =#{id}
    </select>
    <!--提交检查项编辑之后的数据-->
    <insert id="editCheckItem_Submit" parameterType="com.oracle.pojo.CheckItem">
        update t_checkitem
        <set>
            <if test="code!=null">
                code=#{code},
            </if>
            <if test="name!=null">
                name=#{name},
            </if>
            <if test="sex!=null">
                sex=#{sex},
            </if>
            <if test="age!=null">
                age=#{age},
            </if>
            <if test="price!=null">
                price=#{price},
            </if>
            <if test="type!=null">
                type=#{type},
            </if>
            <if test="attention!=null">
                attention=#{attention},
            </if>
            <if test="remark!=null">
                remark=#{remark}
            </if>
            <where>
                id = #{id}
            </where>
        </set>
    </insert>
</mapper>
7.界面测试



评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值