作业十一

这篇博客主要探讨了DrugManagerMapper在数据库操作中的应用,详细解析了DrugManagerMapper.xml文件的内容和作用,涵盖了相关映射配置及SQL查询语句。
摘要由CSDN通过智能技术生成

在这里插入图片描述
DrugManagerMapper

package com.ping.pharmacy.drugManager.mapper;

import com.ping.pojo.Allocating;
import com.ping.pojo.Drug;
import com.ping.pojo.DrugReportedloss;

public interface DrugManagerMapper {
    //    登录

    //    退出登录

    //    修改密码
    public Boolean changePassword(String userName, String oldUserPwd, String newUserPwd);


    //    添加药品信息
    public Boolean addDrugInfo(Drug drug);

    //    修改药品信息
    public Boolean updateDrugInfo(String drugName, double inventory);

    //    查询药品信息
    public Boolean getDrugInfo(String drugName);

    //    记录报损单信息
    public Boolean addDrugReportedloss(DrugReportedloss drugReportedloss);

    //   查询报损信息
    public DrugReportedloss getDrugReportedlossInfo(String drugName);

    //    添加调拨单信息
    public Allocating getAllocatingInfo(String drugNumber);

}

DrugManagerMapper.xml

<!--  注册-->
    <insert id="regist">
        insert into loginuser(userName,userPwd)values(#{userName},#{userPwd})
    </insert>

    <!--   登录-->
    <select id="doLogin" resultType="User">
        select * from loginuser u
        <trim prefix="where" prefixOverrides="and|or">
            <if test="userName!=null">
                and u.userName=#{userName}
            </if>
            <if test="userPwd!=null">
                and u.userPwd=#{userPwd}
            </if>
        </trim>
    </select>

    <!-- 修改密码-->
    <update id="updateUserPwd">
        update loginuser set userPwd=#{userPwd} where userName=#{userName}
    </update>

    <!--  挂单号的录入-->
    <insert id="addRegistOrder">
        insert into sickinfo(sickId,hospId,sickRegistType,sickName,sickSex,sickAge,sickData,registerId)
        value(#{sickId},#{hospId},#{sickRegistType},#{sickName},#{sickSex},#{sickAge},#{sickData},#{registerId})
    </insert>

    <!--  挂号单查询-->
    <select id="getRegist" resultMap="info1">
        select si.sickId,d.departmentType,s.staffName,si.sickData from departmentinfo d,staffinfo s,sickinfo si
        where s.departmentId=d.departmentId
        <if test="sickId=!null">
            and si.sickId like concat('%',#{sickId},'%')
        </if>
        <if test="staffName!=null">
            and s.staffName like concat('%',#{staffName},'%')
        </if>
        <if test="departmentType!=null">
            and d.departmentType like concat('%',#{departmentType},'%')
        </if>
        <if test="startTime!=null &amp;&amp; endTime!=null">
            and si.sickData between year(#{startTime}) and year(#{endTime})
        </if>
    </select>
    <resultMap id="info1" type="Sick">
        <result property="s.staffName" column="staffName"/>
        <result property="d.departmentType" column="departmentType"/>
    </resultMap>

    <!-- 结算-->
    <select id="settlement" resultMap="info2">
        select s.sickIdb,s.sickName,c.chargesPay from sickinfo s,charges c
        where c.sickIdb=s.sickId
        <if test="sickId!=null">
            and s.sickId like concat('%',#{sickId},'%')
        </if>
        <if test="userName!=null">
            and s.userName like concat('%',#{userName},'%')
        </if>
    </select>
    <resultMap id="info2" type="Charges">
        <result property="sickName" column="sickName"/>
    </resultMap>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值