Bonus-Cloud-JYY-Smart-Canteen/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/android/DeviceMapper.xml

63 lines
3.3 KiB
XML
Raw Normal View History

2025-05-29 15:19:00 +08:00
<?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="com.bonus.canteen.core.android.mapper.DeviceMapper">
<select id="getDeviceInfo" resultType="com.bonus.canteen.core.android.vo.DeviceInfoVo">
SELECT di.device_number AS deviceNum,
di.device_name AS deviceName,
dr.recipe_id AS recipeId,
dr.recipe_name AS recipeName,
CONCAT(aaa.area_name, '/', aa.area_name) AS areaName,
aa.area_id AS areaId,
ac.canteen_name AS canteenName,
ac.canteen_id AS canteenId,
ast.stall_name AS stallName,
ast.stall_id AS stallId,
di.device_pwd as devicePwd
FROM device_info di
LEFT JOIN device_bind db ON di.device_id = db.device_id
left join basic_area aa on db.area_id = aa.area_id
left join basic_area aaa on aaa.area_id = aa.parent_id
LEFT JOIN basic_canteen ac ON db.canteen_id = ac.canteen_id
LEFT JOIN basic_stall ast ON db.stall_id = ast.stall_id
LEFT JOIN (SELECT dr.device_id, mr.recipe_name,mr.recipe_id
FROM cook_recipe_bind_device dr
LEFT JOIN cook_recipe mr ON dr.recipe_id = mr.recipe_id) dr
ON di.device_id = dr.device_id
where di.device_sn = #{deviceSn}
GROUP BY di.device_id
</select>
<select id="getAppVersion" resultType="com.bonus.canteen.core.android.vo.AppVersionVo">
select
version as id,
version as version,
version_name as versionName,
apk_name as apkName,
apk_path as apkPath,
update_content as updateContent,
deploy_time as deployTime,
deploy_user as deployUser
from device_app_version
where canteen_type = #{type} and version > #{id}
</select>
<select id="getParamInfo" resultType="com.bonus.canteen.core.android.vo.ParamVO">
public int insertCookNutrition(CookNutrition cookNutrition) {
cookNutrition.setCreateTime(DateUtils.getNowDate());
try {
if (StringUtils.isBlank(cookNutrition.getNutritionName())){
throw new ServiceException("食材名称不能为空!");
}
if (StringUtils.isNull(cookNutrition.getNutritionTypeId()) || cookNutrition.getNutritionTypeId() == 0){
throw new ServiceException("食材类别不能为空!");
}
if (cookNutritionMapper.checkIsExistByName(cookNutrition.getNutritionName(),null) > 0) {
throw new ServiceException("该食材营养基础信息已存在!");
}
return cookNutritionMapper.insertCookNutrition(cookNutrition);
} catch (Exception e) {
throw new ServiceException(e.getMessage());
}
}
</select>
</mapper>