<?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">
<mapper namespace="org.springblade.consumption.mapper.ConsumptionMachineMapper">
<select id="getAccountByPersonCode" resultType="java.lang.String">
select u.account from blade_employee_basic_information a left join blade_user u on a.id=u.id where a.person_code=#{PersonCode} and u.is_deleted=0
</select>
<!--根据餐别 和时间获取报餐列表-->
<select id="getMealComparison" resultType="org.springblade.consumption.entity.ConsumptionMeal">
select * from blade_meal_employee where is_deleted=0
<if test="mealType !=null and mealType !=‘‘ ">
and meal_type_name=#{mealType}
</if>
<if test="posoptime !=null ">
and meal_date =#{posoptime}
</if>
</select>
<!--根据餐别 和时间获取报餐列表 根据区间-->
<select id="getMealComparisonByStartEnd" resultType="org.springblade.consumption.entity.ConsumptionMeal">
select * from blade_meal_employee where is_deleted=0
<if test="mealType !=null and mealType !=‘‘ ">
and meal_type_name=#{mealType}
</if>
<if test="startDate1 !=null ">
and meal_date >= #{startDate1}
</if>
<if test="endDate1 !=null ">
and meal_date <= #{endDate1}
</if>
</select>
<!--根据时间和餐别查询 消费机信息表-->
<select id="getConsumptionMachineList" resultType="org.springblade.consumption.entity.ConsumptionMachine">
select * from cm_consumption_machine where (posoptime between #{startDate} and #{endDate})
<if test="mealType !=null and mealType !=‘‘ ">
and meal_type=#{mealType}
</if>
</select>
<!--获取部门id-->
<select id="getDeptId" resultType="java.lang.String">
select dept_id from blade_user where tenant_id=#{tenantId} and account=#{account}
</select>
<!--根据租户id和部门id获取部门名称-->
<select id="getDeptName" resultType="java.lang.String">
select dept_name from blade_dept where tenant_id=#{tenantId} and id=#{id}
</select>
<!--根据时间和餐别查询 消费机信息表 获取要导出的信息-->
<select id="getExcelConsumptionMachineList" resultType="org.springblade.consumption.entity.ExcelConsumptionMachine">
select * from cm_consumption_machine where (posoptime between #{startDate} and #{endDate})
<if test="mealType !=null and mealType !=‘‘ ">
and meal_type=#{mealType}
</if>
</select>
<select id="getPersonCode" resultType="java.lang.String">
select a.person_code from blade_employee_basic_information a left join blade_user b on a.id=b.id where b.account=#{account} and b.tenant_id=#{tenantId} and a.is_deleted=0
</select>
</mapper>
原文:https://www.cnblogs.com/xianz666/p/14763320.html