| @@ -0,0 +1,241 @@ | |||||
| package com.iformall.domain.po; | |||||
| import javax.persistence.Id; | |||||
| import javax.persistence.Table; | |||||
| import javax.persistence.Transient; | |||||
| import java.io.Serializable; | |||||
| import java.util.ArrayList; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @Table(name = "wx_device") | |||||
| public class WxDevice implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Id | |||||
| protected Long id; | |||||
| @Transient | |||||
| protected List<Long> ids; | |||||
| @Transient | |||||
| protected String sortColumns; | |||||
| public Long getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(Long id) { | |||||
| this.id = id; | |||||
| } | |||||
| public String getSortColumns() { | |||||
| return sortColumns; | |||||
| } | |||||
| public List<Long> getIds() { | |||||
| return ids; | |||||
| } | |||||
| public void setIds(List<Long> ids) { | |||||
| this.ids = ids; | |||||
| } | |||||
| /**租户id**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId") | |||||
| private String tenantId; | |||||
| /**设备id**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="设备id",name="deviceId") | |||||
| private Integer deviceId; | |||||
| /**设备类型**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="设备类型",name="type") | |||||
| private Integer type; | |||||
| /**设备状态**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="设备状态",name="status") | |||||
| private Integer status; | |||||
| /**版本号信息**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="版本号信息",name="version") | |||||
| private String version; | |||||
| /**创建时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||||
| private Date createDate; | |||||
| /**更新时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||||
| private Date updateDate; | |||||
| /**在线状态**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="在线状态",name="onlineStatus") | |||||
| private Integer onlineStatus; | |||||
| /**第一次连线时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="第一次连线时间",name="firstHbTime") | |||||
| private Date firstHbTime; | |||||
| /**最后一次在线时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="最后一次在线时间",name="lastHbTime") | |||||
| private Date lastHbTime; | |||||
| /**需要执行的命令**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="最后一次在线时间",name="hbCmd") | |||||
| private Date hbCmd; | |||||
| public String getTenantId() { | |||||
| return tenantId; | |||||
| } | |||||
| public void setTenantId(String _tenantId) { | |||||
| tenantId = _tenantId; | |||||
| } | |||||
| public Integer getDeviceId() { | |||||
| return deviceId; | |||||
| } | |||||
| public void setDeviceId(Integer deviceId) { | |||||
| this.deviceId = deviceId; | |||||
| } | |||||
| public Integer getType() { | |||||
| return type; | |||||
| } | |||||
| public void setType(Integer type) { | |||||
| this.type = type; | |||||
| } | |||||
| public Integer getStatus() { | |||||
| return status; | |||||
| } | |||||
| public void setStatus(Integer status) { | |||||
| this.status = status; | |||||
| } | |||||
| public String getVersion() { | |||||
| return version; | |||||
| } | |||||
| public void setVersion(String version) { | |||||
| this.version = version; | |||||
| } | |||||
| public Date getCreateDate() { | |||||
| return createDate; | |||||
| } | |||||
| public void setCreateDate(Date createDate) { | |||||
| this.createDate = createDate; | |||||
| } | |||||
| public Date getUpdateDate() { | |||||
| return updateDate; | |||||
| } | |||||
| public void setUpdateDate(Date updateDate) { | |||||
| this.updateDate = updateDate; | |||||
| } | |||||
| public Integer getOnlineStatus() { | |||||
| return onlineStatus; | |||||
| } | |||||
| public void setOnlineStatus(Integer onlineStatus) { | |||||
| this.onlineStatus = onlineStatus; | |||||
| } | |||||
| public Date getFirstHbTime() { | |||||
| return firstHbTime; | |||||
| } | |||||
| public void setFirstHbTime(Date firstHbTime) { | |||||
| this.firstHbTime = firstHbTime; | |||||
| } | |||||
| public Date getLastHbTime() { | |||||
| return lastHbTime; | |||||
| } | |||||
| public void setLastHbTime(Date lastHbTime) { | |||||
| this.lastHbTime = lastHbTime; | |||||
| } | |||||
| public Date getHbCmd() { | |||||
| return hbCmd; | |||||
| } | |||||
| public void setHbCmd(Date hbCmd) { | |||||
| this.hbCmd = hbCmd; | |||||
| } | |||||
| public static enum Field | |||||
| { | |||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||||
| ,DeviceId_ASC("`device_id` ASC"),DeviceId_DESC("`device_id` DESC") | |||||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | |||||
| ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | |||||
| ,Version_ASC("`version` ASC"),Version_DESC("`version` DESC") | |||||
| ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") | |||||
| ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") | |||||
| ,LastHbTime_ASC("`last_hb_time` ASC"),LastHbTime_DESC("`last_hb_time` DESC") | |||||
| ,FirstHbTime_ASC("`first_hb_time` ASC"),FirstHbTime_DESC("`first_hb_time` DESC") | |||||
| ,OnlineStatus_ASC("`online_status` ASC"),OnlineStatus_DESC("`online_status` DESC") | |||||
| ,HbCmd_ASC("`hb_cmd` ASC"),HbCmd_DESC("`hb_cmd` DESC") | |||||
| ; | |||||
| private String value; | |||||
| Field(String value){ | |||||
| this.value = value; | |||||
| } | |||||
| public String getValue() { | |||||
| return value; | |||||
| } | |||||
| public void setCol(String value) { | |||||
| this.value = value; | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return this.getValue(); | |||||
| } | |||||
| } | |||||
| public void setSortColumns(WxDevice.Field... fields) | |||||
| { | |||||
| if (fields == null || fields.length == 0) { | |||||
| return; | |||||
| } | |||||
| for (int k = 0; k < fields.length; k++) { | |||||
| if (fields[k] == null) { | |||||
| return; | |||||
| } | |||||
| } | |||||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||||
| for (int k = 1; k < fields.length; k++) { | |||||
| sb.append(","); | |||||
| sb.append(fields[k].toString()); | |||||
| } | |||||
| this.sortColumns = sb.toString(); | |||||
| } | |||||
| public void setSortColumns(String sortColumns) | |||||
| { | |||||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||||
| return; | |||||
| } | |||||
| if (sortColumns.contains(",")) { | |||||
| String[] cols = sortColumns.split(","); | |||||
| List<Field> fList = new ArrayList(); | |||||
| for (int k = 0; k < cols.length; k++) { | |||||
| fList.add(Field.valueOf(cols[k])); | |||||
| } | |||||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||||
| } else { | |||||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,176 @@ | |||||
| package com.iformall.domain.po; | |||||
| import javax.persistence.Id; | |||||
| import javax.persistence.Table; | |||||
| import javax.persistence.Transient; | |||||
| import java.io.Serializable; | |||||
| import java.util.ArrayList; | |||||
| import java.util.Date; | |||||
| import java.util.List; | |||||
| @Table(name = "wx_screen_ad") | |||||
| public class WxScreenAd implements Serializable { | |||||
| private static final long serialVersionUID = 1L; | |||||
| @Id | |||||
| protected Long id; | |||||
| @Transient | |||||
| protected List<Long> ids; | |||||
| @Transient | |||||
| protected String sortColumns; | |||||
| public Long getId() { | |||||
| return id; | |||||
| } | |||||
| public void setId(Long id) { | |||||
| this.id = id; | |||||
| } | |||||
| public String getSortColumns() { | |||||
| return sortColumns; | |||||
| } | |||||
| public List<Long> getIds() { | |||||
| return ids; | |||||
| } | |||||
| public void setIds(List<Long> ids) { | |||||
| this.ids = ids; | |||||
| } | |||||
| /**租户id**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId") | |||||
| private String tenantId; | |||||
| /**广告类型**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="广告类型",name="type") | |||||
| private Integer type; | |||||
| /**广告状态**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="设备状态",name="status") | |||||
| private Integer status; | |||||
| /**创建时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||||
| private Date createDate; | |||||
| /**更新时间**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||||
| private Date updateDate; | |||||
| /**封面**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="封面",name="coverImg") | |||||
| private String coverImg; | |||||
| public String getTenantId() { | |||||
| return tenantId; | |||||
| } | |||||
| public void setTenantId(String tenantId) { | |||||
| this.tenantId = tenantId; | |||||
| } | |||||
| public Integer getType() { | |||||
| return type; | |||||
| } | |||||
| public void setType(Integer type) { | |||||
| this.type = type; | |||||
| } | |||||
| public Integer getStatus() { | |||||
| return status; | |||||
| } | |||||
| public void setStatus(Integer status) { | |||||
| this.status = status; | |||||
| } | |||||
| public Date getCreateDate() { | |||||
| return createDate; | |||||
| } | |||||
| public void setCreateDate(Date createDate) { | |||||
| this.createDate = createDate; | |||||
| } | |||||
| public Date getUpdateDate() { | |||||
| return updateDate; | |||||
| } | |||||
| public void setUpdateDate(Date updateDate) { | |||||
| this.updateDate = updateDate; | |||||
| } | |||||
| public String getCoverImg() { | |||||
| return coverImg; | |||||
| } | |||||
| public void setCoverImg(String coverImg) { | |||||
| this.coverImg = coverImg; | |||||
| } | |||||
| public static enum Field | |||||
| { | |||||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||||
| ,Type_ASC("`type` ASC"),Type_DESC("`type` DESC") | |||||
| ,Status_ASC("`status` ASC"),Status_DESC("`status` DESC") | |||||
| ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") | |||||
| ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") | |||||
| ; | |||||
| private String value; | |||||
| Field(String value){ | |||||
| this.value = value; | |||||
| } | |||||
| public String getValue() { | |||||
| return value; | |||||
| } | |||||
| public void setCol(String value) { | |||||
| this.value = value; | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return this.getValue(); | |||||
| } | |||||
| } | |||||
| public void setSortColumns(WxScreenAd.Field... fields) | |||||
| { | |||||
| if (fields == null || fields.length == 0) { | |||||
| return; | |||||
| } | |||||
| for (int k = 0; k < fields.length; k++) { | |||||
| if (fields[k] == null) { | |||||
| return; | |||||
| } | |||||
| } | |||||
| StringBuilder sb = new StringBuilder(fields[0].toString()); | |||||
| for (int k = 1; k < fields.length; k++) { | |||||
| sb.append(","); | |||||
| sb.append(fields[k].toString()); | |||||
| } | |||||
| this.sortColumns = sb.toString(); | |||||
| } | |||||
| public void setSortColumns(String sortColumns) | |||||
| { | |||||
| if (sortColumns == null || "".equals(sortColumns.trim())) { | |||||
| return; | |||||
| } | |||||
| if (sortColumns.contains(",")) { | |||||
| String[] cols = sortColumns.split(","); | |||||
| List<Field> fList = new ArrayList(); | |||||
| for (int k = 0; k < cols.length; k++) { | |||||
| fList.add(Field.valueOf(cols[k])); | |||||
| } | |||||
| this.setSortColumns(fList.toArray(new Field[fList.size()])); | |||||
| } else { | |||||
| this.setSortColumns(Field.valueOf(sortColumns)); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,34 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumDeviceHbCmd { | |||||
| CMD_NULL(0, "无"), | |||||
| CMD_POWER_OFF(1, "关机"); | |||||
| public static EnumDeviceHbCmd getEnum(Integer code) { | |||||
| for (EnumDeviceHbCmd value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumDeviceHbCmd(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,34 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumDeviceOnlineStatus { | |||||
| OFFLINE(0, "离线"), | |||||
| ONLINE(1, "在线"); | |||||
| public static EnumDeviceOnlineStatus getEnum(Integer code) { | |||||
| for (EnumDeviceOnlineStatus value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumDeviceOnlineStatus(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,35 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumDeviceStatus { | |||||
| INIT(0, "初始化"), | |||||
| VALID(1, "有效"), | |||||
| INVALID(2, "无效"); | |||||
| public static EnumDeviceStatus getEnum(Integer code) { | |||||
| for (EnumDeviceStatus value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumDeviceStatus(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,33 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumDeviceType { | |||||
| SCREEN(0, "广告屏"); | |||||
| public static EnumDeviceType getEnum(Integer code) { | |||||
| for (EnumDeviceType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumDeviceType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,34 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumScreenAdStatus { | |||||
| VALID(0, "有效"), | |||||
| INVALID(1, "无效"); | |||||
| public static EnumScreenAdStatus getEnum(Integer code) { | |||||
| for (EnumScreenAdStatus value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumScreenAdStatus(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,34 @@ | |||||
| package com.iformall.enums; | |||||
| /** | |||||
| * Created by Stormeye on 2018/08/09. | |||||
| */ | |||||
| public enum EnumScreenAdType { | |||||
| COUPON(0, "券"), | |||||
| CAMPAIGN(1, "宣传页"); | |||||
| public static EnumScreenAdType getEnum(Integer code) { | |||||
| for (EnumScreenAdType value : values()) { | |||||
| if (value.getCode().equals(code)) { | |||||
| return value; | |||||
| } | |||||
| } | |||||
| return null; | |||||
| } | |||||
| private Integer code; | |||||
| private String message; | |||||
| EnumScreenAdType(Integer code, String message) { | |||||
| this.code = code; | |||||
| this.message = message; | |||||
| } | |||||
| public Integer getCode() { | |||||
| return code; | |||||
| } | |||||
| public String getMessage() { | |||||
| return message; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,12 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxDevice; | |||||
| import java.util.List; | |||||
| public interface WxDeviceMapper extends CommonMapper<WxDevice, Long> { | |||||
| List<WxDevice> findList(WxDevice wxDevice); | |||||
| } | |||||
| @@ -0,0 +1,13 @@ | |||||
| package com.iformall.mapper; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxScreenAd; | |||||
| import java.util.List; | |||||
| public interface WxScreenAdMapper extends CommonMapper<WxScreenAd, Long> { | |||||
| List<WxScreenAd> findList(WxScreenAd wxScreenAd); | |||||
| } | |||||
| @@ -0,0 +1,58 @@ | |||||
| package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxDevice; | |||||
| import java.util.List; | |||||
| public interface WxDeviceService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxDevice> listAsPage(WxDevice record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| WxDevice getById(Long id); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void saveOrUpdate(WxDevice record); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void deleteById(Long id); | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| List<WxDevice> findList(WxDevice record); | |||||
| } | |||||
| @@ -0,0 +1,58 @@ | |||||
| package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.domain.po.WxScreenAd; | |||||
| import java.util.List; | |||||
| public interface WxScreenAdService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | |||||
| */ | |||||
| PageInfo<WxScreenAd> listAsPage(WxScreenAd record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| WxScreenAd getById(Long id); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| void saveOrUpdate(WxScreenAd record); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void deleteById(Long id); | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| List<WxScreenAd> findList(WxScreenAd record); | |||||
| } | |||||
| @@ -0,0 +1,55 @@ | |||||
| package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.domain.po.WxDevice; | |||||
| import com.iformall.mapper.WxDeviceMapper; | |||||
| import com.iformall.service.WxDeviceService; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.util.List; | |||||
| @Service | |||||
| public class WxDeviceServiceImpl implements WxDeviceService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| WxDeviceMapper wxDeviceMapper; | |||||
| @Override | |||||
| public PageInfo<WxDevice> listAsPage(WxDevice record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxDeviceMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public WxDevice getById(Long id) { | |||||
| return wxDeviceMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxDevice record) { | |||||
| if (record.getId() == null) { | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| wxDeviceMapper.insertSelective(record); | |||||
| } else { | |||||
| wxDeviceMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| wxDeviceMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public List<WxDevice> findList(WxDevice wxDevice) { | |||||
| return wxDeviceMapper.findList(wxDevice); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,55 @@ | |||||
| package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.domain.po.WxScreenAd; | |||||
| import com.iformall.mapper.WxScreenAdMapper; | |||||
| import com.iformall.service.WxScreenAdService; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.util.List; | |||||
| @Service | |||||
| public class WxScreenAdServiceImpl implements WxScreenAdService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| WxScreenAdMapper wxScreenAdMapper; | |||||
| @Override | |||||
| public PageInfo<WxScreenAd> listAsPage(WxScreenAd record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxScreenAdMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public WxScreenAd getById(Long id) { | |||||
| return wxScreenAdMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void saveOrUpdate(WxScreenAd record) { | |||||
| if (record.getId() == null) { | |||||
| //record.setId(UUID.randomUUID().toString().replaceAll("-", "")); | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| wxScreenAdMapper.insertSelective(record); | |||||
| } else { | |||||
| wxScreenAdMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| wxScreenAdMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public List<WxScreenAd> findList(WxScreenAd wxTagsType) { | |||||
| return wxScreenAdMapper.findList(wxTagsType); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,92 @@ | |||||
| <?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.iformall.mapper.WxDeviceMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxDevice"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="device_id" jdbcType="VARCHAR" property="deviceId"/> | |||||
| <result column="version" jdbcType="VARCHAR" property="version"/> | |||||
| <result column="type" jdbcType="INTEGER" property="type"/> | |||||
| <result column="status" jdbcType="INTEGER" property="status"/> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate"/> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/> | |||||
| <result column="online_status" jdbcType="INTEGER" property="onlineStatus"/> | |||||
| <result column="first_hb_time" jdbcType="TIMESTAMP" property="firstHbTime"/> | |||||
| <result column="last_hb_time" jdbcType="TIMESTAMP" property="lastHbTime"/> | |||||
| <result column="hb_cmd" jdbcType="INTEGER" property="hbCmd"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`, `tenant_id`, `device_id`, `type`, `status`, `version`, `create_date`, `update_date`, `online_status`, `first_hb_time`, `last_hb_time`, `hb_cmd` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != deviceId "> | |||||
| and `device_id` = #{deviceId} | |||||
| </if> | |||||
| <if test=" null != type "> | |||||
| and `type` = #{type} | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and `status` = #{status} | |||||
| </if> | |||||
| <if test=" null != version "> | |||||
| and `version` = #{version} | |||||
| </if> | |||||
| <if test=" null != createDate "> | |||||
| and `create_date` = #{createDate} | |||||
| </if> | |||||
| <if test=" null != updateDate "> | |||||
| and `update_date` = #{updateDate} | |||||
| </if> | |||||
| <if test=" null != onlineStatus "> | |||||
| and `online_status` = #{onlineStatus} | |||||
| </if> | |||||
| <if test=" null != firstHbTime "> | |||||
| and `first_hb_time` = #{firstHbTime} | |||||
| </if> | |||||
| <if test=" null != lastHbTime "> | |||||
| and `last_hb_time` = #{lastHbTime} | |||||
| </if> | |||||
| <if test=" null != hbCmd "> | |||||
| and `hb_cmd` = #{hbCmd} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxDevice" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_device | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| </mapper> | |||||