Browse Source

Merge remote-tracking branch 'origin/master'

hym 4 years ago
parent
commit
c1126d7230

+ 12 - 6
sms_water/src/main/java/com/huaxu/controller/DeviceParmController.java

@@ -35,6 +35,18 @@ public class DeviceParmController {
         return new AjaxMessage<>(ResultStatus.OK, deviceParmService.selectById(id));
     }
 
+    @RequestMapping(value="getByDeviceId" , method = RequestMethod.GET)
+    @ApiOperation(value = "查询单个设备参数信息(参数设置页面)")
+    public AjaxMessage<List<DeviceParmEntity>> getByDeviceId(@ApiParam(value = "设备id") @RequestParam Integer id){
+        return new AjaxMessage<>(ResultStatus.OK, deviceParmService.selectByDeviceId(id));
+    }
+    @RequestMapping(value="batchEdit" , method = RequestMethod.POST)
+    @ApiOperation(value = "批量保存设备参数信息(参数设置页面)")
+    public AjaxMessage<Integer> batchEdit( @ApiParam(value = "设备参数信息") @RequestBody List<DeviceParmEntity> deviceParmEntities){
+        deviceParmService.saveOrUpdateBatch(deviceParmEntities);
+        return new AjaxMessage<>(ResultStatus.OK,1 );
+    }
+
     @RequestMapping(value="selectPage" , method = RequestMethod.GET)
     @ApiOperation(value = "分页查询设备参数信息")
     public AjaxMessage<Pagination<DeviceParmEntity>> selectPage(
@@ -66,12 +78,6 @@ public class DeviceParmController {
     public AjaxMessage<Integer> edit( @ApiParam(value = "设备参数信息") @RequestBody DeviceParmEntity deviceParmEntity){
         return new AjaxMessage<>(ResultStatus.OK, deviceParmService.update(deviceParmEntity));
     }
-    @RequestMapping(value="batchEdit" , method = RequestMethod.POST)
-    @ApiOperation(value = "批量修改设备参数信息")
-    public AjaxMessage<Integer> batchEdit( @ApiParam(value = "设备参数信息") @RequestBody List<DeviceParmEntity> deviceParmEntities){
-        deviceParmService.batchUpdate(deviceParmEntities);
-        return new AjaxMessage<>(ResultStatus.OK,1 );
-    }
 
     @RequestMapping(value="delete" , method = RequestMethod.DELETE)
     @ApiOperation(value = "单个删除设备参数信息")

+ 40 - 0
sms_water/src/main/java/com/huaxu/controller/DeviceTypeController.java

@@ -0,0 +1,40 @@
+package com.huaxu.controller;
+
+
+import com.huaxu.dto.TreeDataDto;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.ui.ModelMap;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Date;
+import org.springframework.web.bind.annotation.*;
+import com.huaxu.entity.DeviceTypeEntity;
+import com.huaxu.service.DeviceTypeService;
+
+/**
+ * 设备型号页面控制器
+ * @author WYY
+ * @date 2020-11-18 08:21
+ */
+@RestController
+@RequestMapping("/devicetype")
+@Api(tags = "设备类型管理")
+public class DeviceTypeController {
+
+    @Autowired
+    private DeviceTypeService deviceTypeService;
+
+    @ApiOperation(value = "查询设备类型")
+    @RequestMapping(value = "/selectList", method = RequestMethod.POST)
+    @ResponseBody
+    public List<TreeDataDto> getTreeData(String name) {
+        List<TreeDataDto> treeDataDtos = deviceTypeService.getTreeData(name);
+        return treeDataDtos;
+    }
+
+}

+ 1 - 1
sms_water/src/main/java/com/huaxu/controller/SceneController.java

@@ -32,7 +32,7 @@ import org.springframework.web.multipart.MultipartFile;
  * @date 2020-11-17 21:15
  */
 @RestController
-@RequestMapping("/scene/scene")
+@RequestMapping("/scene")
 @Api(tags = "场景管理")
 public class SceneController {
     @Autowired

+ 1 - 1
sms_water/src/main/java/com/huaxu/controller/SceneTypeController.java

@@ -26,7 +26,7 @@ import com.huaxu.service.SceneTypeService;
  * @date 2020-11-17 19:31
  */
 @Controller
-@RequestMapping("/scenetype/scenetype")
+@RequestMapping("/scenetype")
 @Api(tags = "场景类型管理")
 public class SceneTypeController {
 

+ 5 - 1
sms_water/src/main/java/com/huaxu/dao/DeviceParmMapper.java

@@ -1,7 +1,9 @@
 package com.huaxu.dao;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.huaxu.entity.DeviceParmEntity;
+import com.huaxu.entity.SceneTypeEntity;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -13,7 +15,7 @@ import java.util.List;
  * @data 2020-11-17 10:57
  */
 @Mapper
-public interface DeviceParmMapper {
+public interface DeviceParmMapper  {
 
     /**
      * 查询单个设备
@@ -63,4 +65,6 @@ public interface DeviceParmMapper {
      * @return
      */
     IPage<DeviceParmEntity> selectPage(IPage<DeviceParmEntity> page, DeviceParmEntity deviceParmEntity);
+
+    List<DeviceParmEntity> selectByDeviceId(Integer id);
 }

+ 33 - 0
sms_water/src/main/java/com/huaxu/dao/DeviceTypeMapper.java

@@ -0,0 +1,33 @@
+package com.huaxu.dao;
+
+import java.io.Serializable;
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.huaxu.entity.DeviceTypeEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+/**
+ *
+ * sms_device_typeDAO接口
+ * @author: WYY
+ * @date 2020-11-18 08:21
+ */
+@Mapper
+public interface DeviceTypeMapper extends BaseMapper<DeviceTypeEntity> {
+
+	/**
+     * 自定义分页查询
+     * @param  page 
+     * @param  deviceTypeEntity 实体类
+     */
+     Page<DeviceTypeEntity> findPage(IPage<DeviceTypeEntity> page, @Param("deviceType") DeviceTypeEntity deviceTypeEntity);
+
+     DeviceTypeEntity findDeviceTypeById(Serializable id);
+
+
+     List<DeviceTypeEntity> findList(DeviceTypeEntity deviceTypeEntity);
+
+     /**删除相关方法  使用mybatis-plus集成的 **/
+}

+ 23 - 0
sms_water/src/main/java/com/huaxu/dto/TreeDataDto.java

@@ -0,0 +1,23 @@
+package com.huaxu.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+import java.util.Objects;
+
+@Data
+public class TreeDataDto {
+    @ApiModelProperty(value = "id", position = 1)
+    private Long id;
+
+    @ApiModelProperty(value = "标签", position = 3)
+    private String label;
+
+    @ApiModelProperty(value = "值", position = 3)
+    private String value;
+
+    @ApiModelProperty(value = "子类", position = 5)
+    private List<TreeDataDto> children;
+}

+ 1 - 1
sms_water/src/main/java/com/huaxu/entity/DeviceParmEntity.java

@@ -28,7 +28,7 @@ public class DeviceParmEntity implements Serializable {
     @ApiModelProperty("设备属性id")
     private Integer attributeId;
     @ApiModelProperty("设备属性名称")
-    private Integer attributeName;
+    private String attributeName;
     @ApiModelProperty("是否地图悬浮显示")
     private Integer isSuspension;
     @ApiModelProperty("是否统计报表参数")

+ 65 - 0
sms_water/src/main/java/com/huaxu/entity/DeviceTypeEntity.java

@@ -0,0 +1,65 @@
+package com.huaxu.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * sms_device_type
+ * @author: WYY
+ * @date 2020-11-18 08:21
+ */
+@Data
+@TableName("sms_device_type")
+public class DeviceTypeEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */ 
+	@TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键")
+    private Long id;
+
+    /** 厂商名称 */
+    @ApiModelProperty(value = "厂商名称")
+    private String manufacturerName;
+
+    /** 厂商ID */
+    @ApiModelProperty(value = "厂商ID")
+    private String manufacturerId;
+
+    /** 设备类型 */
+    @ApiModelProperty(value = "设备类型")
+    private String deviceType;
+
+    /** 设备型号 */
+    @ApiModelProperty(value = "设备型号")
+    private String deviceMode;
+
+    /** 数据删除标记 */
+    @TableLogic
+    @ApiModelProperty(value = "数据删除标记")
+    private Integer status;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "2020-12-12 12:12:12")
+    @ApiModelProperty(value = "创建时间",example = "2020-12-12 12:12:12")
+    private Date dateCreate;
+
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+
+    /** 更新者 */
+    @ApiModelProperty(value = "更新者")
+    private String updateBy;
+    /** 更新时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "2020-12-12 12:12:12")
+    @ApiModelProperty(value = "更新时间",example = "2020-12-12 12:12:12")
+    private Date dateUpdate;
+}

+ 11 - 0
sms_water/src/main/java/com/huaxu/service/DeviceParmService.java

@@ -3,6 +3,7 @@ package com.huaxu.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.huaxu.entity.DeviceParmEntity;
 
+import java.util.Collection;
 import java.util.List;
 
 /**
@@ -16,6 +17,11 @@ public interface DeviceParmService {
      * @return
      */
     DeviceParmEntity selectById(Integer id);
+    /**
+     * 查询单个设备参数信息
+     * @return
+     */
+    List<DeviceParmEntity> selectByDeviceId(Integer id);
     /**
      * 添加设备参数
      * @return
@@ -44,6 +50,11 @@ public interface DeviceParmService {
      * @return
      */
     void batchUpdate(List<DeviceParmEntity> deviceParmEntities);
+    /**
+     * 批量保存设备参数信息
+     * @return
+     */
+    boolean saveOrUpdateBatch(Collection<DeviceParmEntity> entityList);
 
     /**
      * 查询设备参数信息

+ 129 - 0
sms_water/src/main/java/com/huaxu/service/DeviceTypeService.java

@@ -0,0 +1,129 @@
+package com.huaxu.service;
+
+
+import com.huaxu.dao.DeviceTypeMapper;
+import com.huaxu.dto.TreeDataDto;
+import com.huaxu.entity.DeviceTypeEntity;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+
+import javax.annotation.Resource;
+
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.List;
+import java.util.Arrays;
+import java.util.stream.Collectors;
+import static com.google.common.collect.Lists.newArrayList;
+/**
+ * 设备型号Service接口
+ *
+ * @author: WYY
+ * @date 2020-11-18 08:21
+ */
+@Service
+public class DeviceTypeService extends ServiceImpl<DeviceTypeMapper, DeviceTypeEntity> {
+
+    @Resource
+    private DeviceTypeMapper deviceTypeMapper;
+
+    /**
+     * 查列表
+     */
+    public List<DeviceTypeEntity> findList(DeviceTypeEntity deviceTypeEntity) {
+        return deviceTypeMapper.findList(deviceTypeEntity);
+    }
+
+    /**
+     * 批量删除
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public boolean delDeviceTypeByIds(Long[] ids) {
+        return this.removeByIds(Arrays.asList(ids));
+
+    }
+
+    /**
+     * 单个删除
+     */
+    public boolean delDeviceTypeById(Long id) {
+        return this.removeById(id);
+
+    }
+
+    /**
+     * 保存
+     */
+    public boolean addDeviceType(DeviceTypeEntity deviceType) {
+        if (this.save(deviceType)) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * 修改根居ID
+     */
+    public boolean updateDeviceTypeById(DeviceTypeEntity deviceType) {
+        if (this.updateById(deviceType)) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * 根居ID获取对象
+     */
+    public DeviceTypeEntity findDeviceTypeById(Long id) {
+        return deviceTypeMapper.findDeviceTypeById(id);
+    }
+
+    public List<TreeDataDto> getTreeData(String  name)
+    {
+        DeviceTypeEntity deviceTypeEntity = new DeviceTypeEntity();
+        deviceTypeEntity.setManufacturerName(name);
+        List<DeviceTypeEntity> list = deviceTypeMapper.findList(deviceTypeEntity);
+
+        List<TreeDataDto> datalist = new ArrayList<>();
+
+        Map<String, List<DeviceTypeEntity>> manufacturerNameGroupBy = list.stream().collect(Collectors.groupingBy(DeviceTypeEntity::getManufacturerName));
+        for (String manufacturerNameKey:manufacturerNameGroupBy.keySet()){
+            List<DeviceTypeEntity> manufacturerNameList = manufacturerNameGroupBy.get(manufacturerNameKey);
+            TreeDataDto manufacturerNameTreeDataDto = new TreeDataDto();
+            manufacturerNameTreeDataDto.setLabel(manufacturerNameKey);
+            manufacturerNameTreeDataDto.setValue(manufacturerNameKey);
+            datalist.add(manufacturerNameTreeDataDto);
+
+            Map<String, List<DeviceTypeEntity>> equipmentTypeGroupBy = manufacturerNameList.stream().collect(Collectors.groupingBy(DeviceTypeEntity::getDeviceType));
+            for (String equipmentTypeKey:equipmentTypeGroupBy.keySet()){
+                TreeDataDto equipmentTypeTreeDataDto = new TreeDataDto();
+                equipmentTypeTreeDataDto.setLabel(equipmentTypeKey);
+                equipmentTypeTreeDataDto.setValue(equipmentTypeKey);
+                if (manufacturerNameTreeDataDto.getChildren() != null) {
+                    manufacturerNameTreeDataDto.getChildren().add(equipmentTypeTreeDataDto);
+                }else {
+                    manufacturerNameTreeDataDto.setChildren(newArrayList(equipmentTypeTreeDataDto));
+                }
+
+                List<DeviceTypeEntity> equipmentTypeKeyList = equipmentTypeGroupBy.get(equipmentTypeKey);
+                for (DeviceTypeEntity deviceTypeDto : equipmentTypeKeyList) {
+                    TreeDataDto modelTreeDataDto = new TreeDataDto();
+                    modelTreeDataDto.setId(deviceTypeDto.getId());
+                    modelTreeDataDto.setLabel(deviceTypeDto.getDeviceMode());
+                    modelTreeDataDto.setValue(deviceTypeDto.getDeviceMode());
+
+                    if (equipmentTypeTreeDataDto.getChildren() != null) {
+                        equipmentTypeTreeDataDto.getChildren().add(modelTreeDataDto);
+                    }else {
+                        equipmentTypeTreeDataDto.setChildren(newArrayList(modelTreeDataDto));
+                    }
+                }
+            }
+        }
+        return datalist;
+    }
+}

+ 21 - 4
sms_water/src/main/java/com/huaxu/service/SceneService.java

@@ -60,12 +60,12 @@ public class SceneService extends ServiceImpl<SceneMapper, SceneEntity> {
         //分页查询父级节点的信息
         Page<SceneEntity> sceneEntityPage = sceneMapper.findPage(page, sceneEntity);
         //查询子节点的信息
+        List<SceneEntity> sceneEntities = newArrayList();
         for (SceneEntity item : sceneEntityPage.getRecords()) {
-            SceneEntity parentItem = new SceneEntity();
-            parentItem.setParentSceneId(item.getId());
-            List<SceneEntity> sceneEntities = findList(parentItem);
-            item.setChildren(sceneEntities);
+             sceneEntities.addAll(findByParentLike(item.getId()));
         }
+        List<SceneEntity> sceneTree = getSceneTree(sceneEntities, Long.valueOf(0), 1);
+        sceneEntityPage.setRecords(sceneTree);
         return sceneEntityPage;
     }
 
@@ -182,6 +182,23 @@ public class SceneService extends ServiceImpl<SceneMapper, SceneEntity> {
         }
         return false;
     }
+    /**
+     * 根据父级ID查询所有子节点及本身
+     */
+    public  List<SceneEntity> findByParentLike(Long id) {
+        LoginUser currentUser = UserUtil.getCurrentUser();
+        SceneEntity scene = new SceneEntity();
+        if (id != null)
+            scene.setParentSceneIds("%," + id + ",%");
+        scene.setTenantId(currentUser.getTenantId());
+        scene.setStatus(1);
+        scene.setProgramItems(currentUser.getProgramItemList());
+        scene.setUserType(currentUser.getType());
+        //1是公司,2是公司及以下,3部门,4部门及以下,5自定义
+        scene.setPermissonType(currentUser.getPermissonType());
+        List<SceneEntity> list = sceneMapper.findByParentIdsLike(scene);
+        return list;
+    }
     /**
      * 根据父级ID查询所有子节点及本身
      */

+ 28 - 1
sms_water/src/main/java/com/huaxu/service/impl/DeviceParmServiceImpl.java

@@ -1,6 +1,7 @@
 package com.huaxu.service.impl;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.huaxu.dao.DeviceParmMapper;
 import com.huaxu.entity.DeviceParmEntity;
 import com.huaxu.model.LoginUser;
@@ -9,6 +10,7 @@ import com.huaxu.util.UserUtil;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.Collection;
 import java.util.Date;
 import java.util.List;
 
@@ -18,7 +20,7 @@ import java.util.List;
  * @data 2020-11-17 11:02
  */
 @Service
-public class DeviceParmServiceImpl implements DeviceParmService {
+public class DeviceParmServiceImpl  implements DeviceParmService  {
 
     @Resource
     private DeviceParmMapper deviceParmMapper;
@@ -28,8 +30,20 @@ public class DeviceParmServiceImpl implements DeviceParmService {
         return deviceParmMapper.selectById(id);
     }
 
+    @Override
+    public List<DeviceParmEntity> selectByDeviceId(Integer id) {
+        return deviceParmMapper.selectByDeviceId(id);
+    }
+
     @Override
     public Integer insert(DeviceParmEntity deviceParmEntity) {
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        deviceParmEntity.setDateUpdate(new Date());
+        deviceParmEntity.setUpdateBy(loginUser.getUsername());
+        deviceParmEntity.setDateCreate(new Date());
+        deviceParmEntity.setCreateBy(loginUser.getUsername());
+        deviceParmEntity.setStatus(1);
+        deviceParmEntity.setTenantId(loginUser.getTenantId());
         return deviceParmMapper.insert(deviceParmEntity);
     }
 
@@ -67,6 +81,18 @@ public class DeviceParmServiceImpl implements DeviceParmService {
         }
     }
 
+    @Override
+    public boolean saveOrUpdateBatch(Collection<DeviceParmEntity> entityList) {
+        for (DeviceParmEntity item : entityList) {
+            if (item.getId() == null) {
+                this.insert(item);
+            } else {
+                this.update(item);
+            }
+        }
+        return true;
+    }
+
     @Override
     public List<DeviceParmEntity> selectList(DeviceParmEntity deviceParmEntity) {
         return deviceParmMapper.selectList(deviceParmEntity);
@@ -76,4 +102,5 @@ public class DeviceParmServiceImpl implements DeviceParmService {
     public IPage<DeviceParmEntity> selectPage(IPage<DeviceParmEntity> page, DeviceParmEntity deviceParmEntity) {
         return deviceParmMapper.selectPage(page,deviceParmEntity);
     }
+
 }

+ 26 - 1
sms_water/src/main/resources/mapper/DeviceParmMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="com.huaxu.dao.DeviceParmMapper">
 
     <sql id="Base_Column_List">
-            p.ID as "id"
+             p.ID as "id"
             ,p.TENANT_ID as "tenantId"
             ,p.DEVICE_ID as "deviceId"
             ,p.ATTRIBUTE_ID as "attributeId"
@@ -25,6 +25,31 @@
     <sql id="deviceParmJoins">
         left join sms_device_attribute t on t.id= p.ATTRIBUTE_ID
     </sql>
+
+    <select id="selectByDeviceId" resultType="com.huaxu.entity.DeviceParmEntity">
+        select      p.ID as "id"
+                    ,p.TENANT_ID as "tenantId"
+                    ,p.DEVICE_ID as "deviceId"
+                    ,b.id  as "attributeId"
+                    ,p.IS_SUSPENSION as "isSuspension"
+                    ,p.IS_REPORT as "isReport"
+                    ,p.IS_CHART as "isChart"
+                    ,p.IS_MAP as "isMap"
+                    ,p.IS_ALARM as "isAlarm"
+                    ,p.IS_ARTWORK as "isArtwork"
+                    ,p.REMARK as "remark"
+                    ,p.STATUS as "status"
+                    ,p.DATE_CREATE as "dateCreate"
+                    ,p.CREATE_BY as "createBy"
+                    ,p.DATE_UPDATE as "dateUpdate"
+                    ,p.UPDATE_BY as "updateBy"
+                    ,b.`NAME` as "attributeName"
+        from sms_device  a
+        left join sms_device_attribute b on a.DEVICE_TYPE_ID=b.DEVICE_TYPE_ID and b.`STATUS`=1
+        left join sms_device_parm p on p.DEVICE_ID=a.id and p.ATTRIBUTE_ID=b.ID and p.`STATUS`=1
+        where a.id=#{id}
+    </select>
+
     <select id="selectById" resultType="com.huaxu.entity.DeviceParmEntity">
         select
         <include refid="Base_Column_List"/>

+ 66 - 0
sms_water/src/main/resources/mapper/DeviceTypeMapper.xml

@@ -0,0 +1,66 @@
+<?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.huaxu.dao.DeviceTypeMapper">
+
+
+    <resultMap type="DeviceTypeEntity" id="DeviceTypeResult">
+        <result property="id" column="id"/>
+        <result property="manufacturerName" column="manufacturer_name"/>
+        <result property="manufacturerId" column="manufacturer_id"/>
+        <result property="deviceType" column="device_type"/>
+        <result property="deviceMode" column="device_mode"/>
+        <result property="status" column="status"/>
+        <result property="dateCreate" column="date_create"/>
+        <result property="createBy" column="create_by"/>
+        <result property="dateUpdate" column="date_update"/>
+        <result property="updateBy" column="update_by"/>
+    </resultMap>
+
+    <!--  实体栏位  -->
+    <sql id="deviceTypeColumns">
+         a.id as "id" ,
+         a.manufacturer_name as "manufacturerName" ,
+         a.manufacturer_id as "manufacturerId" ,
+         a.device_type as "deviceType" ,
+         a.device_mode as "deviceMode" ,
+         a.status as "status" ,
+         a.date_create as "dateCreate" ,
+         a.create_by as "createBy" ,
+         a.date_update as "dateUpdate" ,
+         a.update_by as "updateBy" 
+     </sql>
+
+    <!--  根据主键获取实体   -->
+    <select id="findDeviceTypeById" resultType="com.huaxu.entity.DeviceTypeEntity">
+        SELECT
+        <include refid="deviceTypeColumns"/>
+        FROM sms_device_type a
+        WHERE a.id = #{id}
+    </select>
+
+    <!--  根据获取实体List   -->
+    <select id="findList" resultType="com.huaxu.entity.DeviceTypeEntity">
+        SELECT
+        <include refid="deviceTypeColumns"/>
+        FROM sms_device_type a
+        <where>
+            <if test="manufacturerName != null  and manufacturerName != ''">
+                and a.manufacturer_name LIKE concat('%',#{manufacturerName},'%')
+            </if>
+        </where>
+    </select>
+
+    <!--  根据获取实体 page   -->
+    <select id="findPage" resultType="com.huaxu.entity.DeviceTypeEntity">
+        SELECT
+        <include refid="deviceTypeColumns"/>
+        FROM sms_device_type a
+        <where>
+            <if test="deviceType.manufacturerName != null  and deviceType.manufacturerName != ''">
+                and a.manufacturer_name LIKE concat('%',#{deviceType.manufacturerName},'%')
+            </if>
+        </where>
+    </select>
+</mapper>