You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
126 lines
3.6 KiB
126 lines
3.6 KiB
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<!-- namespace 用来找唯一的 Mapper 文件,一般是 domain 的全路径名 + Mapper -->
|
|
<mapper namespace="com.dims.mapper.AdminMapper">
|
|
<!-- 登录 -->
|
|
<select id="login" parameterType="User" resultType="Admin">
|
|
SELECT Ano, Aname, Asex, Aage, Apwd
|
|
FROM Admin
|
|
WHERE Ano = #{no} AND Apwd = #{pwd};
|
|
</select>
|
|
|
|
<!-- 统计量少的库存药品种数 -->
|
|
<select id="countLowInventoryDrugs" resultType="int">
|
|
SELECT COUNT(*)
|
|
FROM DrugView
|
|
WHERE PDnum <![CDATA[ <= ]]> 50;
|
|
</select>
|
|
|
|
<!-- 统计临期库存药品批数 -->
|
|
<select id="countClose2ExpiryPDbatches" resultType="int">
|
|
SELECT COUNT(*)
|
|
FROM InventoryDrugView
|
|
WHERE DATEDIFF(DAY, PDbatch, GETDATE()) >= (PDlife / 10 * 9);
|
|
</select>
|
|
|
|
<!-- 统计库存药品种数 -->
|
|
<select id="countInventoryDrugs" resultType="int">
|
|
SELECT COUNT(*)
|
|
FROM DrugView;
|
|
</select>
|
|
|
|
<!-- 统计库存药品批数 -->
|
|
<select id="countInventoryPDbatches" resultType="int">
|
|
SELECT COUNT(*)
|
|
FROM InventoryDrugView;
|
|
</select>
|
|
|
|
<!-- 统计销毁药品批数 -->
|
|
<select id="countDestroyedPDbatches" resultType="int">
|
|
SELECT COUNT(*)
|
|
FROM DestroyedDrugView;
|
|
</select>
|
|
|
|
<!-- 统计由该名库存管理员入库的库存药品批数 -->
|
|
<select id="countMyInventoryPDbatches" parameterType="Admin" resultType="int">
|
|
SELECT COUNT(*)
|
|
FROM InventoryDrugView
|
|
WHERE SAno = #{Ano};
|
|
</select>
|
|
|
|
<!-- 统计由该名库存管理员入库的药品总批数 -->
|
|
<select id="countMyPDbatches" parameterType="Admin" resultType="int">
|
|
SELECT COUNT(*)
|
|
FROM AllPDbatchView
|
|
WHERE SAno = #{Ano};
|
|
</select>
|
|
|
|
<!-- 统计由该名库存管理员销毁 (出库) 的销毁药品批数 -->
|
|
<select id="countMyDestoryedPDbatches" parameterType="Admin" resultType="int">
|
|
SELECT COUNT(*)
|
|
FROM DestroyedDrugView
|
|
WHERE DAno = #{Ano};
|
|
</select>
|
|
|
|
<!-- 查看药品库存列表 -->
|
|
<select id="queryAllDrugs" resultType="Drug">
|
|
SELECT *
|
|
FROM DrugView
|
|
ORDER BY PDname;
|
|
</select>
|
|
|
|
<!-- 查看某一药品的所有库存批次 -->
|
|
<select id="querySpecificPDbatches" parameterType="Drug" resultType="InventoryDrug">
|
|
SELECT *
|
|
FROM InventoryDrugView
|
|
WHERE PDno = #{PDno};
|
|
</select>
|
|
|
|
<!-- 查看已销毁药品批次列表 -->
|
|
<select id="queryAllDestroyedPDbatches" resultType="DestroyedDrug">
|
|
SELECT *
|
|
FROM DestroyedDrugView;
|
|
</select>
|
|
|
|
<!-- 参看某一药品的所有已销毁批次 -->
|
|
<select id="querySpecificDestroyedPDbatches" parameterType="Drug" resultType="DestroyedDrug">
|
|
SELECT *
|
|
FROM DestroyedDrugView
|
|
WHERE PDno = #{PDno};
|
|
</select>
|
|
|
|
<!-- 查看量少的库存药品列表 -->
|
|
<select id="queryLowInventoryDrugs" resultType="InventoryDrug">
|
|
SELECT *
|
|
FROM DrugView
|
|
WHERE PDnum <![CDATA[ <= ]]> 50;
|
|
</select>
|
|
|
|
<!-- 查看临期库存药品列表 -->
|
|
<select id="queryClose2ExpiryPDbatches" resultType="InventoryDrug">
|
|
SELECT *
|
|
FROM InventoryDrugView
|
|
WHERE DATEDIFF(DAY, PDbatch, GETDATE()) >= (PDlife / 10 * 9);
|
|
</select>
|
|
|
|
<!-- 查看药品供应商列表 -->
|
|
<select id="queryAllSuppliers" resultType="Supplier">
|
|
SELECT *
|
|
FROM Supplier
|
|
ORDER BY Sname;
|
|
</select>
|
|
|
|
<!-- 药品入库 / 添加一条库存药品记录 -->
|
|
<insert id="addNewPDbatch" parameterType="InventoryDrug">
|
|
INSERT INTO InventoryDrug(PDno, PDbatch, PDnum, Sno)
|
|
VALUES(#{PDno}, #{PDbatch}, #{PDnum}, #{Sno});
|
|
</insert>
|
|
|
|
<!-- 修改登陆密码 -->
|
|
<update id="changeApwd">
|
|
UPDATE Admin
|
|
SET Apwd = #{arg0}
|
|
WHERE Ano = #{arg1};
|
|
</update>
|
|
</mapper>
|