食堂:菜品管理详情信息、设备管理、上传apk
This commit is contained in:
parent
3c08b4b234
commit
6998d34ae8
|
|
@ -64,7 +64,7 @@ public class CookDishesController extends BaseController {
|
|||
* 获取菜品信息详细信息
|
||||
*/
|
||||
@ApiOperation(value = "获取菜品信息详细信息")
|
||||
@GetMapping(value = "/{dishesId}")
|
||||
@GetMapping(value = "/getInfo/{dishesId}")
|
||||
public AjaxResult getInfo(@PathVariable("dishesId") Long dishesId) {
|
||||
return success(cookDishesService.selectCookDishesByDishesId(dishesId));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,9 @@ public class CookDishesMaterial extends BaseEntity {
|
|||
@Excel(name = "食材id")
|
||||
@ApiModelProperty(value = "食材id")
|
||||
private Long materialId;
|
||||
|
||||
@Excel(name = "食材名称")
|
||||
@ApiModelProperty(value = "食材名称")
|
||||
private String materialName;
|
||||
/** 食材重量(g) */
|
||||
@Excel(name = "食材重量(g)")
|
||||
@ApiModelProperty(value = "食材重量(g)")
|
||||
|
|
|
|||
|
|
@ -124,4 +124,12 @@ public interface CookDishesMapper {
|
|||
* @param dishesIds 菜品id
|
||||
*/
|
||||
void deleteCookDishesByDishPlanDetailIds(@Param("detailIdList") List<Long> detailIdList,@Param("dishesIds") Long[] dishesIds);
|
||||
|
||||
/**
|
||||
* 根据菜品id查询菜品材料信息
|
||||
*
|
||||
* @param cookDishes 菜品id
|
||||
* @return 菜品材料信息
|
||||
*/
|
||||
List<CookDishesMaterial> selectCookDishesMaterialList(CookDishes cookDishes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,10 @@ public class CookDishesServiceImpl implements ICookDishesService {
|
|||
*/
|
||||
@Override
|
||||
public CookDishes selectCookDishesByDishesId(Long dishesId) {
|
||||
return cookDishesMapper.selectCookDishesByDishesId(dishesId);
|
||||
CookDishes cookDishes = cookDishesMapper.selectCookDishesByDishesId(dishesId);
|
||||
List<CookDishesMaterial> dishesMaterialList = cookDishesMapper.selectCookDishesMaterialList(cookDishes);
|
||||
cookDishes.setDishesMaterialList(dishesMaterialList);
|
||||
return cookDishes;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package com.bonus.canteen.core.device.controller;
|
|||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.bonus.canteen.core.device.domain.ApkDTO;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
//import com.bonus.canteen.core.device.common.annotation.PreventRepeatSubmit;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -77,8 +80,6 @@ public class DeviceAppVersionController extends BaseController {
|
|||
* 新增版本
|
||||
*/
|
||||
@ApiOperation(value = "新增版本")
|
||||
//@PreventRepeatSubmit
|
||||
//@RequiresPermissions("device:version:add")
|
||||
@SysLog(title = "版本", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增版本")
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody DeviceAppVersion deviceAppVersion) {
|
||||
|
|
@ -116,4 +117,11 @@ public class DeviceAppVersionController extends BaseController {
|
|||
public AjaxResult remove(@PathVariable Integer[] ids) {
|
||||
return toAjax(deviceAppVersionService.deleteDeviceAppVersionByIds(ids));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "上传APK")
|
||||
@PostMapping({"/uploadApk"})
|
||||
public AjaxResult uploadApk(@RequestBody @Valid ApkDTO dto) {
|
||||
return this.deviceAppVersionService.uploadApk(dto);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ public class DeviceInfoController extends BaseController {
|
|||
* 查询设备资料列表
|
||||
*/
|
||||
@ApiOperation(value = "查询设备资料列表")
|
||||
//@RequiresPermissions("device:info:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(DeviceInfo deviceInfo) {
|
||||
startPage();
|
||||
|
|
@ -53,8 +52,6 @@ public class DeviceInfoController extends BaseController {
|
|||
* 导出设备资料列表
|
||||
*/
|
||||
@ApiOperation(value = "导出设备资料列表")
|
||||
//@PreventRepeatSubmit
|
||||
//@RequiresPermissions("device:info:export")
|
||||
@SysLog(title = "设备资料", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出设备资料")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, DeviceInfo deviceInfo) {
|
||||
|
|
@ -67,7 +64,6 @@ public class DeviceInfoController extends BaseController {
|
|||
* 获取设备资料详细信息
|
||||
*/
|
||||
@ApiOperation(value = "获取设备资料详细信息")
|
||||
//@RequiresPermissions("device:info:query")
|
||||
@GetMapping(value = "/{deviceId}")
|
||||
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) {
|
||||
return success(deviceInfoService.selectDeviceInfoByDeviceId(deviceId));
|
||||
|
|
@ -77,10 +73,8 @@ public class DeviceInfoController extends BaseController {
|
|||
* 新增设备资料
|
||||
*/
|
||||
@ApiOperation(value = "新增设备资料")
|
||||
//@PreventRepeatSubmit
|
||||
//@RequiresPermissions("device:info:add")
|
||||
@SysLog(title = "设备资料", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增设备资料")
|
||||
@PostMapping
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody DeviceInfo deviceInfo) {
|
||||
try {
|
||||
return toAjax(deviceInfoService.insertDeviceInfo(deviceInfo));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.bonus.canteen.core.device.domain;
|
||||
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author 19814
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class ApkDTO extends BaseEntity {
|
||||
private String version;
|
||||
private String versionName;
|
||||
private String apkName;
|
||||
private String apkPath;
|
||||
private String updateContent;
|
||||
private String deployUser;
|
||||
private String type;
|
||||
private String canteenType;
|
||||
}
|
||||
|
|
@ -210,4 +210,12 @@ public class DeviceInfo extends BaseEntity {
|
|||
private Long lastUpdateTime;
|
||||
|
||||
|
||||
private String areaId;
|
||||
private String areaName;
|
||||
private String canteenId;
|
||||
private String canteenName;
|
||||
private String stallId;
|
||||
private String stallName;
|
||||
private String recipeId;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
package com.bonus.canteen.core.device.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.canteen.core.device.domain.ApkDTO;
|
||||
import com.bonus.canteen.core.device.domain.DeviceAppVersion;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 版本Mapper接口
|
||||
|
|
@ -57,4 +60,11 @@ public interface DeviceAppVersionMapper {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceAppVersionByIds(Integer[] ids);
|
||||
|
||||
|
||||
ApkDTO getApkByType(@Param("type") String type, @Param("version") String version);
|
||||
|
||||
int updateApk(ApkDTO dto);
|
||||
|
||||
int insertApk(ApkDTO dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.canteen.core.device.mapper;
|
|||
|
||||
import java.util.List;
|
||||
import com.bonus.canteen.core.device.domain.DeviceInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 设备资料Mapper接口
|
||||
|
|
@ -56,5 +57,83 @@ public interface DeviceInfoMapper {
|
|||
* @param deviceIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceInfoByDeviceIds(Long[] deviceIds);
|
||||
public int deleteDeviceInfoByDeviceIds(@Param("deviceIds") Long[] deviceIds);
|
||||
|
||||
/**
|
||||
* 校验设备名称是否唯一
|
||||
*
|
||||
* @param deviceInfo 设备名称
|
||||
* @return 结果
|
||||
*/
|
||||
int checkDeviceNameUnique(DeviceInfo deviceInfo);
|
||||
|
||||
/**
|
||||
* 校验设备编号是否唯一
|
||||
*
|
||||
* @param deviceInfo 设备编号
|
||||
* @return 结果
|
||||
*/
|
||||
int checkDeviceNumberUnique(DeviceInfo deviceInfo);
|
||||
|
||||
/**
|
||||
* 校验设备序列号是否唯一
|
||||
*
|
||||
* @param deviceInfo 设备序列号
|
||||
* @return 结果
|
||||
*/
|
||||
int checkDeviceSnUnique(DeviceInfo deviceInfo);
|
||||
|
||||
/**
|
||||
* 新增设备绑定关系
|
||||
*
|
||||
* @param deviceInfo 设备绑定关系
|
||||
* @return 结果
|
||||
*/
|
||||
int insertDeviceBinding(DeviceInfo deviceInfo);
|
||||
|
||||
/**
|
||||
* 修改设备绑定关系
|
||||
*
|
||||
* @param deviceInfo 设备绑定关系
|
||||
* @return 结果
|
||||
*/
|
||||
int updateDeviceBinding(DeviceInfo deviceInfo);
|
||||
|
||||
/**
|
||||
* 新增设备菜谱关系
|
||||
*
|
||||
* @param deviceInfo 设备菜谱关系
|
||||
* @return 结果
|
||||
*/
|
||||
int insertDeviceRecipeBinding(DeviceInfo deviceInfo);
|
||||
|
||||
/**
|
||||
* 修改设备菜谱关系
|
||||
*
|
||||
* @param deviceInfo 设备菜谱关系
|
||||
* @return 结果
|
||||
*/
|
||||
int updateDeviceRecipeBinding(DeviceInfo deviceInfo);
|
||||
|
||||
/**
|
||||
* 查询设备菜谱关系
|
||||
*
|
||||
* @param deviceInfo 设备菜谱关系
|
||||
* @return 结果
|
||||
*/
|
||||
String selectDeviceRecipeBinding(DeviceInfo deviceInfo);
|
||||
|
||||
/**
|
||||
* 批量删除设备绑定关系
|
||||
*
|
||||
* @param deviceIds 需要删除的数据主键集合
|
||||
*/
|
||||
void deleteDeviceBinding(@Param("deviceIds") Long[] deviceIds);
|
||||
|
||||
/**
|
||||
* 批量删除设备菜谱关系
|
||||
*
|
||||
* @param deviceIds 需要删除的数据主键集合
|
||||
*/
|
||||
void deleteDeviceRecipeBinding(@Param("deviceIds") Long[] deviceIds);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
package com.bonus.canteen.core.device.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.canteen.core.device.domain.ApkDTO;
|
||||
import com.bonus.canteen.core.device.domain.DeviceAppVersion;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 版本Service接口
|
||||
|
|
@ -57,4 +62,6 @@ public interface IDeviceAppVersionService {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceAppVersionById(Integer id);
|
||||
|
||||
AjaxResult uploadApk(@Valid ApkDTO dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
package com.bonus.canteen.core.device.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.canteen.core.device.domain.ApkDTO;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.canteen.core.device.mapper.DeviceAppVersionMapper;
|
||||
|
|
@ -95,4 +98,24 @@ public class DeviceAppVersionServiceImpl implements IDeviceAppVersionService {
|
|||
public int deleteDeviceAppVersionById(Integer id) {
|
||||
return deviceAppVersionMapper.deleteDeviceAppVersionById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult uploadApk(ApkDTO dto) {
|
||||
try {
|
||||
ApkDTO apkDTO = deviceAppVersionMapper.getApkByType(dto.getCanteenType(), dto.getVersion());
|
||||
if (apkDTO != null) {
|
||||
//检查最新的一条版本是否相同
|
||||
ApkDTO lastBean = deviceAppVersionMapper.getApkByType(dto.getCanteenType(), null);
|
||||
if (lastBean != null && !lastBean.getVersion().equals(dto.getVersion())){
|
||||
return AjaxResult.error("该版本已存在");
|
||||
}
|
||||
deviceAppVersionMapper.updateApk(dto);
|
||||
} else {
|
||||
deviceAppVersionMapper.insertApk(dto);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("操作失败");
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,14 @@ package com.bonus.canteen.core.device.service.impl;
|
|||
import java.util.List;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.houqin.constant.GlobalConstants;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.bonus.canteen.core.device.mapper.DeviceInfoMapper;
|
||||
import com.bonus.canteen.core.device.domain.DeviceInfo;
|
||||
import com.bonus.canteen.core.device.service.IDeviceInfoService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 设备资料Service业务层处理
|
||||
|
|
@ -49,10 +52,14 @@ public class DeviceInfoServiceImpl implements IDeviceInfoService {
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int insertDeviceInfo(DeviceInfo deviceInfo) {
|
||||
deviceInfo.setCreateTime(DateUtils.getNowDate());
|
||||
try {
|
||||
return deviceInfoMapper.insertDeviceInfo(deviceInfo);
|
||||
checkParam(deviceInfo,false);
|
||||
deviceInfoMapper.insertDeviceInfo(deviceInfo);
|
||||
deviceInfoMapper.insertDeviceRecipeBinding(deviceInfo);
|
||||
return deviceInfoMapper.insertDeviceBinding(deviceInfo);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
|
|
@ -65,15 +72,62 @@ public class DeviceInfoServiceImpl implements IDeviceInfoService {
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateDeviceInfo(DeviceInfo deviceInfo) {
|
||||
deviceInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
try {
|
||||
return deviceInfoMapper.updateDeviceInfo(deviceInfo);
|
||||
checkParam(deviceInfo,true);
|
||||
deviceInfoMapper.updateDeviceInfo(deviceInfo);
|
||||
deviceInfoMapper.updateDeviceRecipeBinding(deviceInfo);
|
||||
return deviceInfoMapper.updateDeviceBinding(deviceInfo);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void checkParam(DeviceInfo deviceInfo, boolean isUpdate) throws Exception {
|
||||
deviceInfo.setTenantId(GlobalConstants.TENANT_ID);
|
||||
if (isUpdate){
|
||||
if (deviceInfo.getDeviceId() == null) {
|
||||
throw new Exception("设备ID不能为空");
|
||||
}
|
||||
}
|
||||
if (deviceInfo.getDeviceType() == null) {
|
||||
throw new Exception("设备类型不能为空");
|
||||
}
|
||||
if (deviceInfo.getDeviceType() == 1L){
|
||||
if (deviceInfo.getAreaId() == null || StringUtils.isBlank(deviceInfo.getAreaId())) {
|
||||
throw new Exception("区域不能为空");
|
||||
}
|
||||
if (deviceInfo.getCanteenId() == null || StringUtils.isBlank(deviceInfo.getCanteenId())) {
|
||||
throw new Exception("食堂不能为空");
|
||||
}
|
||||
if (deviceInfo.getStallId() == null || StringUtils.isBlank(deviceInfo.getStallId())) {
|
||||
throw new Exception("档口不能为空");
|
||||
}
|
||||
}
|
||||
if (deviceInfo.getDeviceName() == null || StringUtils.isBlank(deviceInfo.getDeviceName())) {
|
||||
throw new Exception("设备名称不能为空");
|
||||
}
|
||||
if (deviceInfo.getDeviceNumber() == null || StringUtils.isBlank(deviceInfo.getDeviceNumber())) {
|
||||
throw new Exception("设备编号不能为空");
|
||||
}
|
||||
if (deviceInfoMapper.checkDeviceNameUnique(deviceInfo) > 0) {
|
||||
throw new Exception("设备名称已存在");
|
||||
}
|
||||
if (deviceInfoMapper.checkDeviceNumberUnique(deviceInfo) > 0) {
|
||||
throw new Exception("设备编号已存在");
|
||||
}
|
||||
if (deviceInfoMapper.checkDeviceSnUnique(deviceInfo) > 0) {
|
||||
throw new Exception("设备SN已存在");
|
||||
}
|
||||
//查询是否档口已经绑定菜谱
|
||||
String recipeId = deviceInfoMapper.selectDeviceRecipeBinding(deviceInfo);
|
||||
if (StringUtils.isNotBlank(recipeId)){
|
||||
deviceInfo.setRecipeId(recipeId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除设备资料
|
||||
*
|
||||
|
|
@ -81,7 +135,10 @@ public class DeviceInfoServiceImpl implements IDeviceInfoService {
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteDeviceInfoByDeviceIds(Long[] deviceIds) {
|
||||
deviceInfoMapper.deleteDeviceBinding(deviceIds);
|
||||
deviceInfoMapper.deleteDeviceRecipeBinding(deviceIds);
|
||||
return deviceInfoMapper.deleteDeviceInfoByDeviceIds(deviceIds);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -186,6 +186,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectDishPlanDetailIdByDishId" resultType="java.lang.Long">
|
||||
select recipe_detail_id from cook_recipe_detail where apply_date <![CDATA[ >= ]]> #{applyDate} and detail_type = '2'
|
||||
</select>
|
||||
<select id="selectCookDishesMaterialList"
|
||||
resultType="com.bonus.canteen.core.cook.domain.CookDishesMaterial">
|
||||
select
|
||||
cdm.id,
|
||||
cdm.dishes_id as dishesId,
|
||||
cdm.material_id as materialId,
|
||||
cm.material_name as materialName,
|
||||
cdm.weight,
|
||||
cdm.material_type as materialType
|
||||
from cook_dishes_material cdm
|
||||
left join cook_material cm on cdm.material_id = cm.material_id
|
||||
where cdm.dishes_id = #{dishesId}
|
||||
</select>
|
||||
|
||||
<insert id="insertCookDishes" parameterType="com.bonus.canteen.core.cook.domain.CookDishes" useGeneratedKeys="true" keyProperty="dishesId">
|
||||
insert into cook_dishes
|
||||
|
|
|
|||
|
|
@ -103,4 +103,49 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="getApkByType" resultType="com.bonus.canteen.core.device.domain.ApkDTO">
|
||||
select *
|
||||
from device_app_version
|
||||
where 1 = 1
|
||||
<if test="version != null and version != ''">
|
||||
and version = #{version}
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
and canteen_type = #{type}
|
||||
</if>
|
||||
order by version desc
|
||||
limit 1
|
||||
</select>
|
||||
<update id="updateApk">
|
||||
update device_app_version
|
||||
<set>
|
||||
<if test="version != null and version != ''">
|
||||
version = #{version},
|
||||
</if>
|
||||
<if test="versionName != null and versionName != ''">
|
||||
version_name = #{versionName},
|
||||
</if>
|
||||
<if test="apkName != null and apkName != ''">
|
||||
apk_name = #{apkName},
|
||||
</if>
|
||||
<if test="apkPath != null and apkPath != ''">
|
||||
apk_path = #{apkPath},
|
||||
</if>
|
||||
<if test="updateContent != null and updateContent != ''">
|
||||
update_content = #{updateContent},
|
||||
</if>
|
||||
<if test="deployUser != null and deployUser != ''">
|
||||
deploy_user = #{deployUser},
|
||||
</if>
|
||||
<if test="type != null and type != ''">
|
||||
canteen_type = #{type},
|
||||
</if>
|
||||
</set>
|
||||
where version = #{version}
|
||||
</update>
|
||||
<insert id="insertApk">
|
||||
insert into device_app_version(version, version_name, apk_name, apk_path, update_content, deploy_user, canteen_type)
|
||||
values (#{version}, #{versionName}, #{apkName}, #{apkPath}, #{updateContent}, #{deployUser}, #{type})
|
||||
</insert>
|
||||
</mapper>
|
||||
|
|
@ -47,58 +47,64 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="areaId" column="area_id" />
|
||||
<result property="areaName" column="area_name" />
|
||||
<result property="canteenId" column="canteen_id" />
|
||||
<result property="canteenName" column="canteen_name" />
|
||||
<result property="stallId" column="stall_id" />
|
||||
<result property="stallName" column="stall_name" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeviceInfoVo">
|
||||
select device_id, device_name, parent_id, parent_type, tenant_id, online_state, version_code, version_name, consume_mode, communicate_mode, device_ip, device_mask, device_mac, device_gateway, dns_primary, dns_backup, device_sn, device_number, device_model, device_type, device_pwd, device_addr, device_key, device_service_ip, device_service_port, if_quota_limit, if_discount, if_time_limit, if_use_call_num, if_off_line_pay, if_use, img_url, data_transfer_status, print_status, print_key, device_state, device_protocol, heart_beat_time, last_update_time, create_by, create_time, update_by, update_time from device_info
|
||||
select di.device_id, device_name, di.parent_id, parent_type, tenant_id, online_state, version_code,
|
||||
version_name, consume_mode, communicate_mode, device_ip, device_mask, device_mac,
|
||||
device_gateway, dns_primary, dns_backup, device_sn, device_number, device_model,
|
||||
device_type, device_pwd, device_addr, device_key, device_service_ip, device_service_port,
|
||||
if_quota_limit, if_discount, if_time_limit, if_use_call_num, if_off_line_pay, if_use,
|
||||
di.img_url, data_transfer_status, print_status, print_key, device_state, device_protocol,
|
||||
heart_beat_time, last_update_time, di.create_by, di.create_time, di.update_by, di.update_time,
|
||||
db.area_id, ba.area_name, db.canteen_id, bc.canteen_name, db.stall_id, bs.stall_name
|
||||
from device_info di
|
||||
left join device_bind db on di.device_id = db.device_id
|
||||
left join basic_area ba on db.area_id = ba.area_id
|
||||
left join basic_canteen bc on db.canteen_id = bc.canteen_id
|
||||
left join basic_stall bs on db.stall_id = bs.stall_id
|
||||
</sql>
|
||||
|
||||
<select id="selectDeviceInfoList" parameterType="com.bonus.canteen.core.device.domain.DeviceInfo" resultMap="DeviceInfoResult">
|
||||
<include refid="selectDeviceInfoVo"/>
|
||||
<where>
|
||||
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
|
||||
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
||||
<if test="parentType != null and parentType != ''"> and parent_type = #{parentType}</if>
|
||||
<if test="onlineState != null "> and online_state = #{onlineState}</if>
|
||||
<if test="versionCode != null "> and version_code = #{versionCode}</if>
|
||||
<if test="versionName != null and versionName != ''"> and version_name like concat('%', #{versionName}, '%')</if>
|
||||
<if test="consumeMode != null "> and consume_mode = #{consumeMode}</if>
|
||||
<if test="communicateMode != null "> and communicate_mode = #{communicateMode}</if>
|
||||
<if test="deviceIp != null and deviceIp != ''"> and device_ip = #{deviceIp}</if>
|
||||
<if test="deviceMask != null and deviceMask != ''"> and device_mask = #{deviceMask}</if>
|
||||
<if test="deviceMac != null and deviceMac != ''"> and device_mac = #{deviceMac}</if>
|
||||
<if test="deviceGateway != null and deviceGateway != ''"> and device_gateway = #{deviceGateway}</if>
|
||||
<if test="dnsPrimary != null and dnsPrimary != ''"> and dns_primary = #{dnsPrimary}</if>
|
||||
<if test="dnsBackup != null and dnsBackup != ''"> and dns_backup = #{dnsBackup}</if>
|
||||
<if test="deviceSn != null and deviceSn != ''"> and device_sn = #{deviceSn}</if>
|
||||
<if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
|
||||
<if test="deviceModel != null and deviceModel != ''"> and device_model = #{deviceModel}</if>
|
||||
<if test="deviceType != null "> and device_type = #{deviceType}</if>
|
||||
<if test="devicePwd != null and devicePwd != ''"> and device_pwd = #{devicePwd}</if>
|
||||
<if test="deviceAddr != null and deviceAddr != ''"> and device_addr = #{deviceAddr}</if>
|
||||
<if test="deviceKey != null and deviceKey != ''"> and device_key = #{deviceKey}</if>
|
||||
<if test="deviceServiceIp != null and deviceServiceIp != ''"> and device_service_ip = #{deviceServiceIp}</if>
|
||||
<if test="deviceServicePort != null and deviceServicePort != ''"> and device_service_port = #{deviceServicePort}</if>
|
||||
<if test="ifQuotaLimit != null "> and if_quota_limit = #{ifQuotaLimit}</if>
|
||||
<if test="ifDiscount != null "> and if_discount = #{ifDiscount}</if>
|
||||
<if test="ifTimeLimit != null "> and if_time_limit = #{ifTimeLimit}</if>
|
||||
<if test="ifUseCallNum != null "> and if_use_call_num = #{ifUseCallNum}</if>
|
||||
<if test="ifOffLinePay != null "> and if_off_line_pay = #{ifOffLinePay}</if>
|
||||
<if test="ifUse != null "> and if_use = #{ifUse}</if>
|
||||
<if test="imgUrl != null and imgUrl != ''"> and img_url = #{imgUrl}</if>
|
||||
<if test="dataTransferStatus != null "> and data_transfer_status = #{dataTransferStatus}</if>
|
||||
<if test="printStatus != null "> and print_status = #{printStatus}</if>
|
||||
<if test="printKey != null and printKey != ''"> and print_key = #{printKey}</if>
|
||||
<if test="deviceState != null "> and device_state = #{deviceState}</if>
|
||||
<if test="deviceProtocol != null "> and device_protocol = #{deviceProtocol}</if>
|
||||
<if test="heartBeatTime != null "> and heart_beat_time = #{heartBeatTime}</if>
|
||||
<if test="lastUpdateTime != null "> and last_update_time = #{lastUpdateTime}</if>
|
||||
<if test="areaId != null and areaId != ''"> and db.area_id = #{areaId}</if>
|
||||
<if test="canteenId != null and canteenId != ''"> and db.canteen_id = #{canteenId}</if>
|
||||
<if test="stallId != null and stallId != ''"> and db.stall_id = #{stallId}</if>
|
||||
<if test="searchValue != null and searchValue != ''">
|
||||
and (di.device_name like concat('%', #{searchValue}, '%')
|
||||
or di.device_sn like concat('%', #{searchValue}, '%')
|
||||
or di.device_number like concat('%', #{searchValue}, '%')
|
||||
</if>
|
||||
</where>
|
||||
order by di.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectDeviceInfoByDeviceId" parameterType="Long" resultMap="DeviceInfoResult">
|
||||
<include refid="selectDeviceInfoVo"/>
|
||||
where device_id = #{deviceId}
|
||||
where di.device_id = #{deviceId}
|
||||
</select>
|
||||
<select id="checkDeviceNameUnique" resultType="java.lang.Integer">
|
||||
select count(1) from device_info where device_name = #{deviceName}
|
||||
<if test="deviceId != null">and device_id != #{deviceId}</if>
|
||||
</select>
|
||||
<select id="checkDeviceNumberUnique" resultType="java.lang.Integer">
|
||||
select count(1) from device_info where device_number = #{deviceNumber}
|
||||
<if test="deviceId != null">and device_id != #{deviceId}</if>
|
||||
</select>
|
||||
<select id="checkDeviceSnUnique" resultType="java.lang.Integer">
|
||||
select count(1) from device_info where device_sn = #{deviceSn}
|
||||
<if test="deviceId != null">and device_id != #{deviceId}</if>
|
||||
</select>
|
||||
<select id="selectDeviceRecipeBinding" resultType="java.lang.String">
|
||||
select recipe_id from cook_recipe_bind_device where stall_id = #{stallId} and recipe_id is not null
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertDeviceInfo" parameterType="com.bonus.canteen.core.device.domain.DeviceInfo" useGeneratedKeys="true" keyProperty="deviceId">
|
||||
|
|
@ -192,6 +198,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertDeviceBinding">
|
||||
insert into device_bind(device_id, area_id, canteen_id, stall_id,create_by, create_time)
|
||||
values (#{deviceId}, #{areaId}, #{canteenId}, #{stallId},
|
||||
#{createBy}, #{createTime})
|
||||
</insert>
|
||||
<insert id="insertDeviceRecipeBinding">
|
||||
insert into cook_recipe_bind_device(device_id, canteen_id, stall_id,recipe_id,create_by, create_time)
|
||||
values (#{deviceId}, #{canteenId}, #{stallId},#{recipeId},
|
||||
#{createBy}, #{createTime})
|
||||
</insert>
|
||||
|
||||
<update id="updateDeviceInfo" parameterType="com.bonus.canteen.core.device.domain.DeviceInfo">
|
||||
update device_info
|
||||
|
|
@ -241,6 +257,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
where device_id = #{deviceId}
|
||||
</update>
|
||||
<update id="updateDeviceBinding">
|
||||
update device_bind
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="areaId != null and areaId != ''">area_id = #{areaId},</if>
|
||||
<if test="canteenId != null and canteenId != ''">canteen_id = #{canteenId},</if>
|
||||
<if test="stallId != null and stallId != ''">stall_id = #{stallId},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where device_id = #{deviceId}
|
||||
</update>
|
||||
<update id="updateDeviceRecipeBinding">
|
||||
update cook_recipe_bind_device
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="canteenId != null and canteenId != ''">canteen_id = #{canteenId},</if>
|
||||
<if test="stallId != null and stallId != ''">stall_id = #{stallId},</if>
|
||||
<if test="recipeId != null and recipeId != ''">recipe_id = #{recipeId},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where device_id = #{deviceId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDeviceInfoByDeviceId" parameterType="Long">
|
||||
delete from device_info where device_id = #{deviceId}
|
||||
|
|
@ -248,7 +286,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<delete id="deleteDeviceInfoByDeviceIds" parameterType="String">
|
||||
delete from device_info where device_id in
|
||||
<foreach item="deviceId" collection="array" open="(" separator="," close=")">
|
||||
<foreach item="deviceId" collection="deviceIds" open="(" separator="," close=")">
|
||||
#{deviceId}
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="deleteDeviceBinding">
|
||||
delete from device_bind where device_id in
|
||||
<foreach item="deviceId" collection="deviceIds" open="(" separator="," close=")">
|
||||
#{deviceId}
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="deleteDeviceRecipeBinding">
|
||||
delete from cook_recipe_bind_device where device_id in
|
||||
<foreach item="deviceId" collection="deviceIds" open="(" separator="," close=")">
|
||||
#{deviceId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
|
|
|||
Loading…
Reference in New Issue