package tech.glinfo.enbao.modules.sh.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import tech.glinfo.enbao.modules.sh.entity.ShDeviceTimingEntity;

import java.util.List;

/**
 * 智能开关电量表
 * 
 * @author linzhenjie
 * @email linzhenjie@gltech.com
 * @date 2020-05-18 15:37:05
 */
@Mapper
public interface OtherShDeviceTimingDao extends BaseMapper<ShDeviceTimingEntity> {

    @Select("<script>" +
            "select * from sh_device_timing WHERE device_id = ${deviceId} order by (CASE LENGTH(time) WHEN 5 THEN time ELSE date_format(time,'%H:%i') END) ASC"
            + "</script>")
    List<ShDeviceTimingEntity> listById(Integer deviceId);


}
