From 83a237a7e22ff2cd829034632d6d785d74c1789b Mon Sep 17 00:00:00 2001 From: 张晓波 <bingbo1993@126.com> Date: 星期二, 26 九月 2023 09:06:00 +0800 Subject: [PATCH] 点检信息 --- hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/controller/CheckDeviceController.java | 70 ++++ hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml | 2 hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/service/impl/CheckDeviceServiceImpl.java | 96 ++++++ hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/service/CheckDeviceService.java | 32 ++ hd/pipe/mobile/src/main/resources/mapping/CheckDeviceMapper.xml | 230 +++++++++++++++ hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDevice.java | 72 ++++ hd/pipe/mobile/src/main/resources/mapping/CheckDeviceFileMapper.xml | 113 +++++++ hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceAddDto.java | 68 ++++ hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/mapper/CheckDeviceFileMapper.java | 35 ++ hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceDto.java | 18 + hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/mapper/CheckDeviceMapper.java | 40 ++ hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceListVo.java | 80 +++++ hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceFile.java | 37 ++ 13 files changed, 892 insertions(+), 1 deletions(-) diff --git a/hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml b/hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml index 4680268..8ff8540 100644 --- a/hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml +++ b/hd/pipe/StaffManage/src/main/resources/mapping/PlatUserMapper.xml @@ -866,7 +866,7 @@ <select id="groupUserWorking" resultType="com.thhy.staff.modules.biz.platuser.entity.GroupWorking"> select sg.group_id as groupId,sg.group_name as groupName, - (select count(user_id) from sys_group_user where group_id = sg.group_id) as groupUserCount + (select count(user_id) from sys_group_user where and is_use = 1 and group_id = sg.group_id) as groupUserCount from sys_group sg left join sys_com_depart sd on sg.depart_id = sd.depart_id where sg.is_use = 1 and sd.company_id = #{companyId} diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/controller/CheckDeviceController.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/controller/CheckDeviceController.java new file mode 100644 index 0000000..81eb2cc --- /dev/null +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/controller/CheckDeviceController.java @@ -0,0 +1,70 @@ +package com.thhy.mobile.modules.biz.checkdevice.controller; + +import com.github.pagehelper.PageInfo; +import com.thhy.general.common.BasicResult; +import com.thhy.general.utils.PagingUtils; +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDevice; +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceAddDto; +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceDto; +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceListVo; +import com.thhy.mobile.modules.biz.checkdevice.service.CheckDeviceService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.List; + +/** + * @author zhang_xiao_bo + * @since 2023-09-25 16:02:35 + */ +@RestController +@RequestMapping("checkDevice") +public class CheckDeviceController { + + + @Autowired + private CheckDeviceService checkDeviceService; + + @RequestMapping("findList") + public BasicResult findList(@RequestBody(required = false) CheckDeviceDto checkDeviceDto, HttpServletRequest req){ + PagingUtils.setPageParam(req); + List<CheckDeviceListVo> checkDeviceList = checkDeviceService.findList(checkDeviceDto); + PageInfo<CheckDeviceListVo> pageInfo = new PageInfo<>(checkDeviceList); + return BasicResult.success(pageInfo); + } + + @RequestMapping("checkDeviceInfo") + public BasicResult checkDeviceInfo(@RequestBody(required = false) CheckDeviceDto checkDeviceDto){ + CheckDeviceListVo listVo = checkDeviceService.checkDeviceInfo(checkDeviceDto); + return BasicResult.success(listVo); + } + + @RequestMapping("addCheckDevice") + public BasicResult addCheckDevice(@RequestBody CheckDeviceAddDto checkDeviceAddDto){ + checkDeviceService.addCheckDevice(checkDeviceAddDto); + return BasicResult.success(); + } + + /** + @RequestMapping("update") + public BasicResult update(@RequestBody CheckDevice checkDevice){ + checkDeviceService.update(checkDevice); + return BasicResult.success(); + }**/ + + @RequestMapping("delete") + public BasicResult delete(@RequestBody CheckDevice checkDevice){ + checkDeviceService.delete(checkDevice.getId()); + return BasicResult.success(); + } + + @RequestMapping("deviceList") + public BasicResult deviceList(){ + List<HashMap<String,Object>> hashMapList = checkDeviceService.deviceList(); + return BasicResult.success(hashMapList); + } +} diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDevice.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDevice.java new file mode 100644 index 0000000..463be10 --- /dev/null +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDevice.java @@ -0,0 +1,72 @@ +package com.thhy.mobile.modules.biz.checkdevice.entity; + +import com.thhy.general.annotations.Idkey; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; +/** + * + * @author zhang_xiao_bo + * @since 2023-09-25 16:02:35 + */ +@Data +@Accessors(chain = true) +public class CheckDevice implements Serializable { + + + /** + * 责任人 + */ + + + private String adminUser; + + /** + * 点检内容 + */ + + + private String checkContent; + + /** + * 点检时间 + */ + + + private Date checkTime; + + /** + * 点检类型 字典表 + */ + + + private String checkType; + + /** + * 创建时间 + */ + + + private Date createTime; + + /** + * 设备ID + */ + + + private String deviceId; + + + @Idkey + private String id; + + + /** + * 1Y0N + */ + + + private Integer isUse; +} diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceAddDto.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceAddDto.java new file mode 100644 index 0000000..a6b17c5 --- /dev/null +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceAddDto.java @@ -0,0 +1,68 @@ +package com.thhy.mobile.modules.biz.checkdevice.entity; + +import com.thhy.general.annotations.Idkey; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +@Data +public class CheckDeviceAddDto implements Serializable { + + /** + * 责任人 + */ + + + private String adminUser; + + /** + * 点检内容 + */ + + + private String checkContent; + + /** + * 点检时间 + */ + + + private Date checkTime; + + /** + * 点检类型 字典表 + */ + + + private String checkType; + + /** + * 创建时间 + */ + + + private Date createTime; + + /** + * 设备ID + */ + + + private String deviceId; + + + @Idkey + private String id; + + + /** + * 1Y0N + */ + + + private Integer isUse; + + private List<CheckDeviceFile> fileList; +} diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceDto.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceDto.java new file mode 100644 index 0000000..b94e719 --- /dev/null +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceDto.java @@ -0,0 +1,18 @@ +package com.thhy.mobile.modules.biz.checkdevice.entity; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class CheckDeviceDto implements Serializable { + + private String bigDeviceName; + + private Date startTime; + + private Date endTime; + + private String id; +} diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceFile.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceFile.java new file mode 100644 index 0000000..ba25aa6 --- /dev/null +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceFile.java @@ -0,0 +1,37 @@ +package com.thhy.mobile.modules.biz.checkdevice.entity; + +import com.thhy.general.annotations.Idkey; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * + * @author zhang_xiao_bo + * @since 2023-09-25 16:03:58 + */ +@Data +@Accessors(chain = true) +public class CheckDeviceFile implements Serializable { + + + /** + * 点检ID + */ + + + private String checkId; + + /** + * 图片 + */ + + + private String file; + + + @Idkey + private String id; + +} diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceListVo.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceListVo.java new file mode 100644 index 0000000..19b3efd --- /dev/null +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/entity/CheckDeviceListVo.java @@ -0,0 +1,80 @@ +package com.thhy.mobile.modules.biz.checkdevice.entity; + +import com.thhy.general.annotations.Idkey; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +@Data +public class CheckDeviceListVo implements Serializable { + + /** + * 责任人 + */ + + + private String adminUser; + + private String adminUserName; + + private String adminUserPhone; + + /** + * 点检内容 + */ + + + private String checkContent; + + /** + * 点检时间 + */ + + + private Date checkTime; + + /** + * 点检类型 字典表 + */ + + + private String checkType; + + /** + * 创建时间 + */ + + + private Date createTime; + + /** + * 设备ID + */ + + + private String deviceId; + + + @Idkey + private String id; + + + /** + * 1Y0N + */ + + + private Integer isUse; + + private String bigDeviceId; + private String bigDeviceName; + private String bigDeviceModel; + private String bigNumber; + private String bigType; + private String bigTypeStr; + + private List<CheckDeviceFile> fileList; + +} diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/mapper/CheckDeviceFileMapper.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/mapper/CheckDeviceFileMapper.java new file mode 100644 index 0000000..15c177e --- /dev/null +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/mapper/CheckDeviceFileMapper.java @@ -0,0 +1,35 @@ +package com.thhy.mobile.modules.biz.checkdevice.mapper; + +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceFile; +import org.springframework.stereotype.Component; + +import java.io.Serializable; +import java.util.List; + +/** + * Mapper 接口 + * @author zhang_xiao_bo + * @since 2023-09-25 16:03:58 + */ +@Component +public interface CheckDeviceFileMapper { + + + CheckDeviceFile queryById(Serializable id); + + Integer queryVersionById(Serializable id); + + List<CheckDeviceFile> findList(CheckDeviceFile checkdevicefile); + + List<CheckDeviceFile> findAll(String checkId); + + void insert(CheckDeviceFile checkdevicefile); + + void update(CheckDeviceFile checkdevicefile); + + void deletelogic(Serializable id); + + void deleteById(Serializable id); + + void deleteByCheckId(String checkId); +} diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/mapper/CheckDeviceMapper.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/mapper/CheckDeviceMapper.java new file mode 100644 index 0000000..9786cbf --- /dev/null +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/mapper/CheckDeviceMapper.java @@ -0,0 +1,40 @@ +package com.thhy.mobile.modules.biz.checkdevice.mapper; + +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDevice; +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceDto; +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceListVo; +import org.springframework.stereotype.Component; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; + +/** + * Mapper 接口 + * @author zhang_xiao_bo + * @since 2023-09-25 16:02:35 + */ +@Component +public interface CheckDeviceMapper { + + + CheckDevice queryById(Serializable id); + + CheckDeviceListVo queryInfoById(String id); + + Integer queryVersionById(Serializable id); + + List<CheckDeviceListVo> findList(CheckDeviceDto checkDeviceDto); + + List<CheckDevice> findAll(); + + void insert(CheckDevice checkdevice); + + void update(CheckDevice checkdevice); + + void deletelogic(Serializable id); + + void deleteById(Serializable id); + + List<HashMap<String,Object>> deviceList(String companyId); +} diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/service/CheckDeviceService.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/service/CheckDeviceService.java new file mode 100644 index 0000000..83176e4 --- /dev/null +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/service/CheckDeviceService.java @@ -0,0 +1,32 @@ +package com.thhy.mobile.modules.biz.checkdevice.service; + +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDevice; +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceAddDto; +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceDto; +import com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceListVo; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; + +/** + * 服务类 + * @author zhang_xiao_bo + * @since 2023-09-25 16:02:35 + */ +public interface CheckDeviceService { + + CheckDevice get(Serializable id); + + List<CheckDeviceListVo> findList(CheckDeviceDto checkDeviceDto); + + CheckDeviceListVo checkDeviceInfo(CheckDeviceDto checkDeviceDto); + + void addCheckDevice(CheckDeviceAddDto checkDeviceAddDto); + + void update(CheckDevice checkDevice); + + void delete(Serializable id); + + List<HashMap<String,Object>> deviceList(); +} diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/service/impl/CheckDeviceServiceImpl.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/service/impl/CheckDeviceServiceImpl.java new file mode 100644 index 0000000..61f2810 --- /dev/null +++ b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/checkdevice/service/impl/CheckDeviceServiceImpl.java @@ -0,0 +1,96 @@ +package com.thhy.mobile.modules.biz.checkdevice.service.impl; + +import com.thhy.general.config.SysUserInfo; +import com.thhy.general.utils.DeepCopyUtils; +import com.thhy.general.utils.UserInfoUtils; +import com.thhy.mobile.modules.biz.checkdevice.entity.*; +import com.thhy.mobile.modules.biz.checkdevice.mapper.CheckDeviceFileMapper; +import com.thhy.mobile.modules.biz.checkdevice.mapper.CheckDeviceMapper; +import com.thhy.mobile.modules.biz.checkdevice.service.CheckDeviceService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; + +/** + * 服务实现类 + * @author zhang_xiao_bo + * @since 2023-09-25 16:02:35 + */ +@Service +public class CheckDeviceServiceImpl implements CheckDeviceService { + + + + @Autowired + private CheckDeviceMapper checkDeviceMapper; + + @Autowired + private CheckDeviceFileMapper fileMapper; + + public CheckDevice get(Serializable id){ + return checkDeviceMapper.queryById(id); + } + + public List<CheckDeviceListVo> findList(CheckDeviceDto checkDeviceDto){ + return checkDeviceMapper.findList(checkDeviceDto); + } + + public CheckDeviceListVo checkDeviceInfo(CheckDeviceDto checkDeviceDto){ + CheckDeviceListVo deviceListVo = checkDeviceMapper.queryInfoById(checkDeviceDto.getId()); + List<CheckDeviceFile> fileList = fileMapper.findAll(deviceListVo.getId()); + deviceListVo.setFileList(fileList); + return deviceListVo; + } + + /** + * 增加和修改 + * @param checkDeviceAddDto + */ + @Transactional + public void addCheckDevice(CheckDeviceAddDto checkDeviceAddDto){ + SysUserInfo userInfo = UserInfoUtils.getInstance().getUserInfo(); + List<CheckDeviceFile> fileList = checkDeviceAddDto.getFileList(); + CheckDevice checkDevice = new CheckDevice(); + DeepCopyUtils.copy(checkDeviceAddDto,checkDevice); + if(checkDevice.getId() == null){ + //增加操作 + checkDevice.setAdminUser(userInfo.getUserId()); + checkDeviceMapper.insert(checkDevice); + }else{ + //修改操作 + checkDeviceMapper.update(checkDevice); + fileMapper.deleteByCheckId(checkDevice.getId()); + } + for(CheckDeviceFile deviceFile : fileList){ + deviceFile.setCheckId(checkDevice.getId()); + fileMapper.insert(deviceFile); + } + + } + + /** + * 修改 + * @param checkDevice + */ + public void update(CheckDevice checkDevice){ + checkDeviceMapper.update(checkDevice); + } + + /** + * 删除 + * @param id + */ + public void delete(Serializable id){ + checkDeviceMapper.deletelogic(id); + } + + @Override + public List<HashMap<String, Object>> deviceList() { + SysUserInfo userInfo = UserInfoUtils.getInstance().getUserInfo(); + return checkDeviceMapper.deviceList(userInfo.getCompanyId()); + } +} diff --git a/hd/pipe/mobile/src/main/resources/mapping/CheckDeviceFileMapper.xml b/hd/pipe/mobile/src/main/resources/mapping/CheckDeviceFileMapper.xml new file mode 100644 index 0000000..3d1ab03 --- /dev/null +++ b/hd/pipe/mobile/src/main/resources/mapping/CheckDeviceFileMapper.xml @@ -0,0 +1,113 @@ +<?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.thhy.mobile.modules.biz.checkdevice.mapper.CheckDeviceFileMapper"> + + <!-- 通用查询结果列 --> + <sql id="Base_Column_List"> + t.id as id, + t.check_id as checkId, + t.file as file + </sql> + + <sql id="condition_query"> + <where> + <trim suffixOverrides=" AND "> + <if test="checkId!=null and checkId!=''"> + t.check_id = #{checkId} AND + </if> + <if test="file!=null and file!=''"> + t.file = #{file} AND + </if> + </trim> + </where> + </sql> + + <select id="queryById" resultType="com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceFile"> + select <include refid="Base_Column_List" /> + from t_check_device_file t + where t.id=#{id} + </select> + + <select id="queryVersionById" resultType="integer"> + select version from t_check_device_file + where id=#{id} + </select> + + <!--查询列表--> + <select id="findList" resultType="com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceFile"> + SELECT + <include refid="Base_Column_List" /> + from t_check_device_file t + <include refid="condition_query" /> + </select> + + <!--查询列表--> + <select id="findAll" resultType="com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceFile"> + SELECT + <include refid="Base_Column_List" /> + from t_check_device_file t + where t.check_id = #{checkId} + </select> + + <!--插入操作--> + <insert id="insert"> + insert into t_check_device_file + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="checkId != null"> + check_id, + </if> + <if test="file != null"> + file, + </if> + <if test="id != null"> + id, + </if> + </trim> + + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="checkId != null"> + #{checkId}, + </if> + <if test="file != null"> + #{file}, + </if> + <if test="id != null"> + #{id}, + </if> + </trim> + </insert> + + + <!--更新操作--> + <update id="update"> + update t_check_device_file + <set> + <if test="checkId != null"> + check_id=#{checkId}, + </if> + <if test="file != null"> + file=#{file}, + </if> + </set> + where id=#{id} + </update> + + <!--逻辑删除--> + <update id="deletelogic"> + update t_check_device_file + SET is_use = 0 + where id=#{id} + </update> + + <!--根据ID删除--> + <delete id="deleteById"> + delete from t_check_device_file + where id=#{id} + </delete> + + <delete id="deleteByCheckId"> + delete from t_check_device_file + where check_id=#{checkId} + </delete> + +</mapper> diff --git a/hd/pipe/mobile/src/main/resources/mapping/CheckDeviceMapper.xml b/hd/pipe/mobile/src/main/resources/mapping/CheckDeviceMapper.xml new file mode 100644 index 0000000..172cfdc --- /dev/null +++ b/hd/pipe/mobile/src/main/resources/mapping/CheckDeviceMapper.xml @@ -0,0 +1,230 @@ +<?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.thhy.mobile.modules.biz.checkdevice.mapper.CheckDeviceMapper"> + + <!-- 通用查询结果列 --> + <sql id="Base_Column_List"> + t.id as id, + t.admin_user as adminUser, + t.check_content as checkContent, + t.check_time as checkTime, + t.check_type as checkType, + t.create_time as createTime, + t.device_id as deviceId, + t.is_use as isUse + </sql> + + <sql id="condition_query"> + <where> + <trim suffixOverrides=" AND "> + <if test="adminUser!=null and adminUser!=''"> + t.admin_user = #{adminUser} AND + </if> + <if test="checkContent!=null and checkContent!=''"> + t.check_content = #{checkContent} AND + </if> + <if test="checkTime!=null"> + t.check_time = #{checkTime} AND + </if> + <if test="checkType!=null and checkType!=''"> + t.check_type = #{checkType} AND + </if> + <if test="createTime!=null"> + t.create_time = #{createTime} AND + </if> + <if test="deviceId!=null and deviceId!=''"> + t.device_id = #{deviceId} AND + </if> + <if test="isUse!=null"> + t.is_use = #{isUse} AND + </if> + </trim> + </where> + </sql> + + <select id="queryById" resultType="com.thhy.mobile.modules.biz.checkdevice.entity.CheckDevice"> + select <include refid="Base_Column_List" /> + from t_check_device t + where t.id=#{id} + </select> + + <select id="queryInfoById" resultType="com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceListVo"> + SELECT + t.id as id, + t.admin_user as adminUser, + t.check_content as checkContent, + t.check_time as checkTime, + t.check_type as checkType, + t.create_time as createTime, + t.device_id as deviceId, + bd.big_device_name as bigDeviceName, + bd.big_device_model as bigDeviceModel, + bd.big_number as bigNumber, + bd.big_type as bigType, + sd.dict_name as bigTypeStr, + su.real_name as adminUserName, + su.telphone as adminUserPhone + from t_check_device t + left join t_big_device bd on t.device_id = bd.big_device_id + left join sys_dict sd on sd.dict_id = bd.big_type + left join sys_users su on su.user_id = t.admin_user + where t.id = #{id} + </select> + + + + <select id="queryVersionById" resultType="integer"> + select version from t_check_device + where id=#{id} + </select> + + <!--查询列表--> + <select id="findList" resultType="com.thhy.mobile.modules.biz.checkdevice.entity.CheckDeviceListVo"> + SELECT + t.id as id, + t.admin_user as adminUser, + t.check_content as checkContent, + t.check_time as checkTime, + t.check_type as checkType, + t.create_time as createTime, + t.device_id as deviceId, + bd.big_device_name as bigDeviceName, + bd.big_device_model as bigDeviceModel, + bd.big_number as bigNumber, + bd.big_type as bigType, + sd.dict_name as bigTypeStr, + su.real_name as adminUserName, + su.telphone as adminUserPhone + from t_check_device t + left join t_big_device bd on t.device_id = bd.big_device_id + left join sys_dict sd on sd.dict_id = bd.big_type + left join sys_users su on su.user_id = t.admin_user + <where> + <trim suffixOverrides=" AND "> + <if test="bigDeviceName !=null and bigDeviceName !=''"> + bd.big_device_name LIKE concat('%',#{bigDeviceName},'%') + </if> + <if test="startTime !=null"> + t.check_time >= #{startTime} + </if> + <if test="endTime !=null"> + t.check_time <= #{endTime} + </if> + </trim> + </where> + </select> + + <!--查询列表--> + <select id="findAll" resultType="com.thhy.mobile.modules.biz.checkdevice.entity.CheckDevice"> + SELECT + <include refid="Base_Column_List" /> + from t_check_device t + </select> + + <!--插入操作--> + <insert id="insert" useGeneratedKeys="true" keyProperty="id"> + insert into t_check_device + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="adminUser != null"> + admin_user, + </if> + <if test="checkContent != null"> + check_content, + </if> + <if test="checkTime != null"> + check_time, + </if> + <if test="checkType != null"> + check_type, + </if> + <if test="createTime != null"> + create_time, + </if> + <if test="deviceId != null"> + device_id, + </if> + <if test="id != null"> + id, + </if> + <if test="isUse != null"> + is_use, + </if> + </trim> + + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="adminUser != null"> + #{adminUser}, + </if> + <if test="checkContent != null"> + #{checkContent}, + </if> + <if test="checkTime != null"> + #{checkTime}, + </if> + <if test="checkType != null"> + #{checkType}, + </if> + <if test="createTime != null"> + #{createTime}, + </if> + <if test="deviceId != null"> + #{deviceId}, + </if> + <if test="id != null"> + #{id}, + </if> + <if test="isUse != null"> + #{isUse}, + </if> + </trim> + </insert> + + + <!--更新操作--> + <update id="update"> + update t_check_device + <set> + <if test="adminUser != null"> + admin_user=#{adminUser}, + </if> + <if test="checkContent != null"> + check_content=#{checkContent}, + </if> + <if test="checkTime != null"> + check_time=#{checkTime}, + </if> + <if test="checkType != null"> + check_type=#{checkType}, + </if> + <if test="createTime != null"> + create_time=#{createTime}, + </if> + <if test="deviceId != null"> + device_id=#{deviceId}, + </if> + <if test="isUse != null"> + is_use=#{isUse}, + </if> + </set> + where id=#{id} + </update> + + <!--逻辑删除--> + <update id="deletelogic"> + update t_check_device + SET is_use = 0 + where id=#{id} + </update> + + <!--根据ID删除--> + <delete id="deleteById"> + delete from t_check_device + where id=#{id} + </delete> + + <select id="deviceList" resultType="hashmap"> + select big_device_id as bigDeviceId,big_device_name as bigDeviceName from t_big_device + where is_use = 1 and company_id = #{companyId} + </select> + +</mapper> -- Gitblit v1.9.3