From 1c6fb0320ba354ec40faaad9dcc52e758f5c838f Mon Sep 17 00:00:00 2001 From: xufenglei <xufenglei@blit.7drlb.com> Date: Tue, 24 Oct 2017 10:48:14 +0800 Subject: [PATCH] 大屏登录接口 --- src/main/java/com/moral/monitor/controller/ScreenApiController.java | 80 ++ src/main/java/com/moral/monitor/service/impl/ScreenServiceImpl.java | 25 src/main/java/com/moral/monitor/dao/AccountEntityMapper.java | 30 + src/main/java/com/moral/monitor/entity/AccountEntityExample.java | 951 ++++++++++++++++++++++++++++++++++++ src/main/java/com/moral/monitor/entity/AccountEntity.java | 115 ++++ src/main/java/com/moral/monitor/service/ScreenService.java | 11 src/main/resources/mapper/AccountEntityMapper.xml | 305 +++++++++++ 7 files changed, 1,500 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/moral/monitor/controller/ScreenApiController.java b/src/main/java/com/moral/monitor/controller/ScreenApiController.java index 37b8ebc..9aba7e9 100644 --- a/src/main/java/com/moral/monitor/controller/ScreenApiController.java +++ b/src/main/java/com/moral/monitor/controller/ScreenApiController.java @@ -1,27 +1,41 @@ package com.moral.monitor.controller; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; + import com.alibaba.fastjson.JSON; +import com.moral.monitor.entity.AccountEntity; import com.moral.monitor.entity.Equipment; import com.moral.monitor.entity.State; import com.moral.monitor.service.ScreenApiService; +import com.moral.monitor.service.ScreenService; +import com.moral.monitor.util.Crypto; import com.moral.monitor.util.ScreenApiData; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import javax.annotation.Resource; -import java.util.LinkedHashMap; -import java.util.List; /** * Created by a on 2017/7/12. */ -@Controller +@RestController @RequestMapping(value = "screen") public class ScreenApiController { - @Resource + @Autowired ScreenApiService screenApiService; + @Autowired + private ScreenService screenService; /** * ������������/������������ ��������������������������������������������������������������������� * @param area ������������������������ ������������������������������ @@ -132,13 +146,45 @@ } - - - - - - - - - + + /** + * Screen login. + * + * @param request the request + * @return the map + */ + @RequestMapping(value = "/login", method = RequestMethod.POST) + public Map<String, Object> screenLogin(HttpServletRequest request) { + Map<String, Object> resultMap = new HashMap<String, Object>(); + String msg = ""; + Integer accountId = -1; + String account = request.getParameter("account"); + String password = request.getParameter("password"); + if (StringUtils.isBlank(account) || StringUtils.isBlank(password)) { + msg = "������������������������������������"; + } else { + try { + password = Crypto.md5(password); + List<AccountEntity> accountLists = screenService.getAccountLists(account, password); + if (CollectionUtils.isEmpty(accountLists) || accountLists.size() != 1) { + msg = "���������������������������������"; + } else { + AccountEntity accountEntity = accountLists.get(0); + if ("1".equals(accountEntity.getEnable())) { + msg = "���������������"; + accountId = accountEntity.getId(); + } else { + msg = "���������������������������������������������"; + } + } + } catch (Exception e) { + e.printStackTrace(); + msg = "���������������������������������"; + } + } + resultMap.put("msg", msg); + resultMap.put("accountId", accountId); + return resultMap; + } + } diff --git a/src/main/java/com/moral/monitor/dao/AccountEntityMapper.java b/src/main/java/com/moral/monitor/dao/AccountEntityMapper.java new file mode 100644 index 0000000..40407ce --- /dev/null +++ b/src/main/java/com/moral/monitor/dao/AccountEntityMapper.java @@ -0,0 +1,30 @@ +package com.moral.monitor.dao; + +import com.moral.monitor.entity.AccountEntity; +import com.moral.monitor.entity.AccountEntityExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface AccountEntityMapper { + int countByExample(AccountEntityExample example); + + int deleteByExample(AccountEntityExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(AccountEntity record); + + int insertSelective(AccountEntity record); + + List<AccountEntity> selectByExample(AccountEntityExample example); + + AccountEntity selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") AccountEntity record, @Param("example") AccountEntityExample example); + + int updateByExample(@Param("record") AccountEntity record, @Param("example") AccountEntityExample example); + + int updateByPrimaryKeySelective(AccountEntity record); + + int updateByPrimaryKey(AccountEntity record); +} \ No newline at end of file diff --git a/src/main/java/com/moral/monitor/entity/AccountEntity.java b/src/main/java/com/moral/monitor/entity/AccountEntity.java new file mode 100644 index 0000000..0451d91 --- /dev/null +++ b/src/main/java/com/moral/monitor/entity/AccountEntity.java @@ -0,0 +1,115 @@ +package com.moral.monitor.entity; + +import java.util.Date; + +public class AccountEntity { + private Integer id; + + private String account; + + private String password; + + private String name; + + private String sex; + + private String organization; + + private String email; + + private String mobile; + + private String weixin; + + private Date time; + + private String enable; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getAccount() { + return account; + } + + public void setAccount(String account) { + this.account = account; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public String getOrganization() { + return organization; + } + + public void setOrganization(String organization) { + this.organization = organization; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getMobile() { + return mobile; + } + + public void setMobile(String mobile) { + this.mobile = mobile; + } + + public String getWeixin() { + return weixin; + } + + public void setWeixin(String weixin) { + this.weixin = weixin; + } + + public Date getTime() { + return time; + } + + public void setTime(Date time) { + this.time = time; + } + + public String getEnable() { + return enable; + } + + public void setEnable(String enable) { + this.enable = enable; + } +} \ No newline at end of file diff --git a/src/main/java/com/moral/monitor/entity/AccountEntityExample.java b/src/main/java/com/moral/monitor/entity/AccountEntityExample.java new file mode 100644 index 0000000..85bbd47 --- /dev/null +++ b/src/main/java/com/moral/monitor/entity/AccountEntityExample.java @@ -0,0 +1,951 @@ +package com.moral.monitor.entity; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class AccountEntityExample { + protected String orderByClause; + + protected boolean distinct; + + protected List<Criteria> oredCriteria; + + public AccountEntityExample() { + oredCriteria = new ArrayList<Criteria>(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List<Criteria> getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List<Criterion> criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<Criterion>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List<Criterion> getAllCriteria() { + return criteria; + } + + public List<Criterion> getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List<Integer> values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List<Integer> values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andAccountIsNull() { + addCriterion("account is null"); + return (Criteria) this; + } + + public Criteria andAccountIsNotNull() { + addCriterion("account is not null"); + return (Criteria) this; + } + + public Criteria andAccountEqualTo(String value) { + addCriterion("account =", value, "account"); + return (Criteria) this; + } + + public Criteria andAccountNotEqualTo(String value) { + addCriterion("account <>", value, "account"); + return (Criteria) this; + } + + public Criteria andAccountGreaterThan(String value) { + addCriterion("account >", value, "account"); + return (Criteria) this; + } + + public Criteria andAccountGreaterThanOrEqualTo(String value) { + addCriterion("account >=", value, "account"); + return (Criteria) this; + } + + public Criteria andAccountLessThan(String value) { + addCriterion("account <", value, "account"); + return (Criteria) this; + } + + public Criteria andAccountLessThanOrEqualTo(String value) { + addCriterion("account <=", value, "account"); + return (Criteria) this; + } + + public Criteria andAccountLike(String value) { + addCriterion("account like", value, "account"); + return (Criteria) this; + } + + public Criteria andAccountNotLike(String value) { + addCriterion("account not like", value, "account"); + return (Criteria) this; + } + + public Criteria andAccountIn(List<String> values) { + addCriterion("account in", values, "account"); + return (Criteria) this; + } + + public Criteria andAccountNotIn(List<String> values) { + addCriterion("account not in", values, "account"); + return (Criteria) this; + } + + public Criteria andAccountBetween(String value1, String value2) { + addCriterion("account between", value1, value2, "account"); + return (Criteria) this; + } + + public Criteria andAccountNotBetween(String value1, String value2) { + addCriterion("account not between", value1, value2, "account"); + return (Criteria) this; + } + + public Criteria andPasswordIsNull() { + addCriterion("password is null"); + return (Criteria) this; + } + + public Criteria andPasswordIsNotNull() { + addCriterion("password is not null"); + return (Criteria) this; + } + + public Criteria andPasswordEqualTo(String value) { + addCriterion("password =", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordNotEqualTo(String value) { + addCriterion("password <>", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordGreaterThan(String value) { + addCriterion("password >", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordGreaterThanOrEqualTo(String value) { + addCriterion("password >=", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordLessThan(String value) { + addCriterion("password <", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordLessThanOrEqualTo(String value) { + addCriterion("password <=", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordLike(String value) { + addCriterion("password like", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordNotLike(String value) { + addCriterion("password not like", value, "password"); + return (Criteria) this; + } + + public Criteria andPasswordIn(List<String> values) { + addCriterion("password in", values, "password"); + return (Criteria) this; + } + + public Criteria andPasswordNotIn(List<String> values) { + addCriterion("password not in", values, "password"); + return (Criteria) this; + } + + public Criteria andPasswordBetween(String value1, String value2) { + addCriterion("password between", value1, value2, "password"); + return (Criteria) this; + } + + public Criteria andPasswordNotBetween(String value1, String value2) { + addCriterion("password not between", value1, value2, "password"); + return (Criteria) this; + } + + public Criteria andNameIsNull() { + addCriterion("name is null"); + return (Criteria) this; + } + + public Criteria andNameIsNotNull() { + addCriterion("name is not null"); + return (Criteria) this; + } + + public Criteria andNameEqualTo(String value) { + addCriterion("name =", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotEqualTo(String value) { + addCriterion("name <>", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThan(String value) { + addCriterion("name >", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThanOrEqualTo(String value) { + addCriterion("name >=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThan(String value) { + addCriterion("name <", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThanOrEqualTo(String value) { + addCriterion("name <=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLike(String value) { + addCriterion("name like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotLike(String value) { + addCriterion("name not like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameIn(List<String> values) { + addCriterion("name in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameNotIn(List<String> values) { + addCriterion("name not in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameBetween(String value1, String value2) { + addCriterion("name between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andNameNotBetween(String value1, String value2) { + addCriterion("name not between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andSexIsNull() { + addCriterion("sex is null"); + return (Criteria) this; + } + + public Criteria andSexIsNotNull() { + addCriterion("sex is not null"); + return (Criteria) this; + } + + public Criteria andSexEqualTo(String value) { + addCriterion("sex =", value, "sex"); + return (Criteria) this; + } + + public Criteria andSexNotEqualTo(String value) { + addCriterion("sex <>", value, "sex"); + return (Criteria) this; + } + + public Criteria andSexGreaterThan(String value) { + addCriterion("sex >", value, "sex"); + return (Criteria) this; + } + + public Criteria andSexGreaterThanOrEqualTo(String value) { + addCriterion("sex >=", value, "sex"); + return (Criteria) this; + } + + public Criteria andSexLessThan(String value) { + addCriterion("sex <", value, "sex"); + return (Criteria) this; + } + + public Criteria andSexLessThanOrEqualTo(String value) { + addCriterion("sex <=", value, "sex"); + return (Criteria) this; + } + + public Criteria andSexLike(String value) { + addCriterion("sex like", value, "sex"); + return (Criteria) this; + } + + public Criteria andSexNotLike(String value) { + addCriterion("sex not like", value, "sex"); + return (Criteria) this; + } + + public Criteria andSexIn(List<String> values) { + addCriterion("sex in", values, "sex"); + return (Criteria) this; + } + + public Criteria andSexNotIn(List<String> values) { + addCriterion("sex not in", values, "sex"); + return (Criteria) this; + } + + public Criteria andSexBetween(String value1, String value2) { + addCriterion("sex between", value1, value2, "sex"); + return (Criteria) this; + } + + public Criteria andSexNotBetween(String value1, String value2) { + addCriterion("sex not between", value1, value2, "sex"); + return (Criteria) this; + } + + public Criteria andOrganizationIsNull() { + addCriterion("organization is null"); + return (Criteria) this; + } + + public Criteria andOrganizationIsNotNull() { + addCriterion("organization is not null"); + return (Criteria) this; + } + + public Criteria andOrganizationEqualTo(String value) { + addCriterion("organization =", value, "organization"); + return (Criteria) this; + } + + public Criteria andOrganizationNotEqualTo(String value) { + addCriterion("organization <>", value, "organization"); + return (Criteria) this; + } + + public Criteria andOrganizationGreaterThan(String value) { + addCriterion("organization >", value, "organization"); + return (Criteria) this; + } + + public Criteria andOrganizationGreaterThanOrEqualTo(String value) { + addCriterion("organization >=", value, "organization"); + return (Criteria) this; + } + + public Criteria andOrganizationLessThan(String value) { + addCriterion("organization <", value, "organization"); + return (Criteria) this; + } + + public Criteria andOrganizationLessThanOrEqualTo(String value) { + addCriterion("organization <=", value, "organization"); + return (Criteria) this; + } + + public Criteria andOrganizationLike(String value) { + addCriterion("organization like", value, "organization"); + return (Criteria) this; + } + + public Criteria andOrganizationNotLike(String value) { + addCriterion("organization not like", value, "organization"); + return (Criteria) this; + } + + public Criteria andOrganizationIn(List<String> values) { + addCriterion("organization in", values, "organization"); + return (Criteria) this; + } + + public Criteria andOrganizationNotIn(List<String> values) { + addCriterion("organization not in", values, "organization"); + return (Criteria) this; + } + + public Criteria andOrganizationBetween(String value1, String value2) { + addCriterion("organization between", value1, value2, "organization"); + return (Criteria) this; + } + + public Criteria andOrganizationNotBetween(String value1, String value2) { + addCriterion("organization not between", value1, value2, "organization"); + return (Criteria) this; + } + + public Criteria andEmailIsNull() { + addCriterion("email is null"); + return (Criteria) this; + } + + public Criteria andEmailIsNotNull() { + addCriterion("email is not null"); + return (Criteria) this; + } + + public Criteria andEmailEqualTo(String value) { + addCriterion("email =", value, "email"); + return (Criteria) this; + } + + public Criteria andEmailNotEqualTo(String value) { + addCriterion("email <>", value, "email"); + return (Criteria) this; + } + + public Criteria andEmailGreaterThan(String value) { + addCriterion("email >", value, "email"); + return (Criteria) this; + } + + public Criteria andEmailGreaterThanOrEqualTo(String value) { + addCriterion("email >=", value, "email"); + return (Criteria) this; + } + + public Criteria andEmailLessThan(String value) { + addCriterion("email <", value, "email"); + return (Criteria) this; + } + + public Criteria andEmailLessThanOrEqualTo(String value) { + addCriterion("email <=", value, "email"); + return (Criteria) this; + } + + public Criteria andEmailLike(String value) { + addCriterion("email like", value, "email"); + return (Criteria) this; + } + + public Criteria andEmailNotLike(String value) { + addCriterion("email not like", value, "email"); + return (Criteria) this; + } + + public Criteria andEmailIn(List<String> values) { + addCriterion("email in", values, "email"); + return (Criteria) this; + } + + public Criteria andEmailNotIn(List<String> values) { + addCriterion("email not in", values, "email"); + return (Criteria) this; + } + + public Criteria andEmailBetween(String value1, String value2) { + addCriterion("email between", value1, value2, "email"); + return (Criteria) this; + } + + public Criteria andEmailNotBetween(String value1, String value2) { + addCriterion("email not between", value1, value2, "email"); + return (Criteria) this; + } + + public Criteria andMobileIsNull() { + addCriterion("mobile is null"); + return (Criteria) this; + } + + public Criteria andMobileIsNotNull() { + addCriterion("mobile is not null"); + return (Criteria) this; + } + + public Criteria andMobileEqualTo(String value) { + addCriterion("mobile =", value, "mobile"); + return (Criteria) this; + } + + public Criteria andMobileNotEqualTo(String value) { + addCriterion("mobile <>", value, "mobile"); + return (Criteria) this; + } + + public Criteria andMobileGreaterThan(String value) { + addCriterion("mobile >", value, "mobile"); + return (Criteria) this; + } + + public Criteria andMobileGreaterThanOrEqualTo(String value) { + addCriterion("mobile >=", value, "mobile"); + return (Criteria) this; + } + + public Criteria andMobileLessThan(String value) { + addCriterion("mobile <", value, "mobile"); + return (Criteria) this; + } + + public Criteria andMobileLessThanOrEqualTo(String value) { + addCriterion("mobile <=", value, "mobile"); + return (Criteria) this; + } + + public Criteria andMobileLike(String value) { + addCriterion("mobile like", value, "mobile"); + return (Criteria) this; + } + + public Criteria andMobileNotLike(String value) { + addCriterion("mobile not like", value, "mobile"); + return (Criteria) this; + } + + public Criteria andMobileIn(List<String> values) { + addCriterion("mobile in", values, "mobile"); + return (Criteria) this; + } + + public Criteria andMobileNotIn(List<String> values) { + addCriterion("mobile not in", values, "mobile"); + return (Criteria) this; + } + + public Criteria andMobileBetween(String value1, String value2) { + addCriterion("mobile between", value1, value2, "mobile"); + return (Criteria) this; + } + + public Criteria andMobileNotBetween(String value1, String value2) { + addCriterion("mobile not between", value1, value2, "mobile"); + return (Criteria) this; + } + + public Criteria andWeixinIsNull() { + addCriterion("weixin is null"); + return (Criteria) this; + } + + public Criteria andWeixinIsNotNull() { + addCriterion("weixin is not null"); + return (Criteria) this; + } + + public Criteria andWeixinEqualTo(String value) { + addCriterion("weixin =", value, "weixin"); + return (Criteria) this; + } + + public Criteria andWeixinNotEqualTo(String value) { + addCriterion("weixin <>", value, "weixin"); + return (Criteria) this; + } + + public Criteria andWeixinGreaterThan(String value) { + addCriterion("weixin >", value, "weixin"); + return (Criteria) this; + } + + public Criteria andWeixinGreaterThanOrEqualTo(String value) { + addCriterion("weixin >=", value, "weixin"); + return (Criteria) this; + } + + public Criteria andWeixinLessThan(String value) { + addCriterion("weixin <", value, "weixin"); + return (Criteria) this; + } + + public Criteria andWeixinLessThanOrEqualTo(String value) { + addCriterion("weixin <=", value, "weixin"); + return (Criteria) this; + } + + public Criteria andWeixinLike(String value) { + addCriterion("weixin like", value, "weixin"); + return (Criteria) this; + } + + public Criteria andWeixinNotLike(String value) { + addCriterion("weixin not like", value, "weixin"); + return (Criteria) this; + } + + public Criteria andWeixinIn(List<String> values) { + addCriterion("weixin in", values, "weixin"); + return (Criteria) this; + } + + public Criteria andWeixinNotIn(List<String> values) { + addCriterion("weixin not in", values, "weixin"); + return (Criteria) this; + } + + public Criteria andWeixinBetween(String value1, String value2) { + addCriterion("weixin between", value1, value2, "weixin"); + return (Criteria) this; + } + + public Criteria andWeixinNotBetween(String value1, String value2) { + addCriterion("weixin not between", value1, value2, "weixin"); + return (Criteria) this; + } + + public Criteria andTimeIsNull() { + addCriterion("time is null"); + return (Criteria) this; + } + + public Criteria andTimeIsNotNull() { + addCriterion("time is not null"); + return (Criteria) this; + } + + public Criteria andTimeEqualTo(Date value) { + addCriterion("time =", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeNotEqualTo(Date value) { + addCriterion("time <>", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeGreaterThan(Date value) { + addCriterion("time >", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeGreaterThanOrEqualTo(Date value) { + addCriterion("time >=", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeLessThan(Date value) { + addCriterion("time <", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeLessThanOrEqualTo(Date value) { + addCriterion("time <=", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeIn(List<Date> values) { + addCriterion("time in", values, "time"); + return (Criteria) this; + } + + public Criteria andTimeNotIn(List<Date> values) { + addCriterion("time not in", values, "time"); + return (Criteria) this; + } + + public Criteria andTimeBetween(Date value1, Date value2) { + addCriterion("time between", value1, value2, "time"); + return (Criteria) this; + } + + public Criteria andTimeNotBetween(Date value1, Date value2) { + addCriterion("time not between", value1, value2, "time"); + return (Criteria) this; + } + + public Criteria andEnableIsNull() { + addCriterion("enable is null"); + return (Criteria) this; + } + + public Criteria andEnableIsNotNull() { + addCriterion("enable is not null"); + return (Criteria) this; + } + + public Criteria andEnableEqualTo(String value) { + addCriterion("enable =", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableNotEqualTo(String value) { + addCriterion("enable <>", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableGreaterThan(String value) { + addCriterion("enable >", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableGreaterThanOrEqualTo(String value) { + addCriterion("enable >=", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableLessThan(String value) { + addCriterion("enable <", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableLessThanOrEqualTo(String value) { + addCriterion("enable <=", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableLike(String value) { + addCriterion("enable like", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableNotLike(String value) { + addCriterion("enable not like", value, "enable"); + return (Criteria) this; + } + + public Criteria andEnableIn(List<String> values) { + addCriterion("enable in", values, "enable"); + return (Criteria) this; + } + + public Criteria andEnableNotIn(List<String> values) { + addCriterion("enable not in", values, "enable"); + return (Criteria) this; + } + + public Criteria andEnableBetween(String value1, String value2) { + addCriterion("enable between", value1, value2, "enable"); + return (Criteria) this; + } + + public Criteria andEnableNotBetween(String value1, String value2) { + addCriterion("enable not between", value1, value2, "enable"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List<?>) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/moral/monitor/service/ScreenService.java b/src/main/java/com/moral/monitor/service/ScreenService.java new file mode 100644 index 0000000..7e217b7 --- /dev/null +++ b/src/main/java/com/moral/monitor/service/ScreenService.java @@ -0,0 +1,11 @@ +package com.moral.monitor.service; + +import java.util.List; + +import com.moral.monitor.entity.AccountEntity; + +public interface ScreenService { + + List<AccountEntity> getAccountLists(String account, String password); + +} diff --git a/src/main/java/com/moral/monitor/service/impl/ScreenServiceImpl.java b/src/main/java/com/moral/monitor/service/impl/ScreenServiceImpl.java new file mode 100644 index 0000000..080d5ba --- /dev/null +++ b/src/main/java/com/moral/monitor/service/impl/ScreenServiceImpl.java @@ -0,0 +1,25 @@ +package com.moral.monitor.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.moral.monitor.dao.AccountEntityMapper; +import com.moral.monitor.entity.AccountEntity; +import com.moral.monitor.entity.AccountEntityExample; +import com.moral.monitor.service.ScreenService; + +@Service +public class ScreenServiceImpl implements ScreenService { + + @Autowired + private AccountEntityMapper accountDao; + + public List<AccountEntity> getAccountLists(String account, String password) { + AccountEntityExample example = new AccountEntityExample(); + example.or().andAccountEqualTo(account).andPasswordEqualTo(password); + return accountDao.selectByExample(example); + } + +} diff --git a/src/main/resources/mapper/AccountEntityMapper.xml b/src/main/resources/mapper/AccountEntityMapper.xml new file mode 100644 index 0000000..15ad2f3 --- /dev/null +++ b/src/main/resources/mapper/AccountEntityMapper.xml @@ -0,0 +1,305 @@ +<?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.moral.monitor.dao.AccountEntityMapper" > + <resultMap id="BaseResultMap" type="com.moral.monitor.entity.AccountEntity" > + <id column="id" property="id" jdbcType="INTEGER" /> + <result column="account" property="account" jdbcType="VARCHAR" /> + <result column="password" property="password" jdbcType="VARCHAR" /> + <result column="name" property="name" jdbcType="VARCHAR" /> + <result column="sex" property="sex" jdbcType="VARCHAR" /> + <result column="organization" property="organization" jdbcType="VARCHAR" /> + <result column="email" property="email" jdbcType="VARCHAR" /> + <result column="mobile" property="mobile" jdbcType="VARCHAR" /> + <result column="weixin" property="weixin" jdbcType="VARCHAR" /> + <result column="time" property="time" jdbcType="TIMESTAMP" /> + <result column="enable" property="enable" jdbcType="VARCHAR" /> + </resultMap> + <sql id="Example_Where_Clause" > + <where > + <foreach collection="oredCriteria" item="criteria" separator="or" > + <if test="criteria.valid" > + <trim prefix="(" suffix=")" prefixOverrides="and" > + <foreach collection="criteria.criteria" item="criterion" > + <choose > + <when test="criterion.noValue" > + and ${criterion.condition} + </when> + <when test="criterion.singleValue" > + and ${criterion.condition} #{criterion.value} + </when> + <when test="criterion.betweenValue" > + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + </when> + <when test="criterion.listValue" > + and ${criterion.condition} + <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > + #{listItem} + </foreach> + </when> + </choose> + </foreach> + </trim> + </if> + </foreach> + </where> + </sql> + <sql id="Update_By_Example_Where_Clause" > + <where > + <foreach collection="example.oredCriteria" item="criteria" separator="or" > + <if test="criteria.valid" > + <trim prefix="(" suffix=")" prefixOverrides="and" > + <foreach collection="criteria.criteria" item="criterion" > + <choose > + <when test="criterion.noValue" > + and ${criterion.condition} + </when> + <when test="criterion.singleValue" > + and ${criterion.condition} #{criterion.value} + </when> + <when test="criterion.betweenValue" > + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + </when> + <when test="criterion.listValue" > + and ${criterion.condition} + <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," > + #{listItem} + </foreach> + </when> + </choose> + </foreach> + </trim> + </if> + </foreach> + </where> + </sql> + <sql id="Base_Column_List" > + id, account, password, name, sex, organization, email, mobile, weixin, time, enable + </sql> + <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.moral.monitor.entity.AccountEntityExample" > + select + <if test="distinct" > + distinct + </if> + <include refid="Base_Column_List" /> + from account + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + <if test="orderByClause != null" > + order by ${orderByClause} + </if> + </select> + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > + select + <include refid="Base_Column_List" /> + from account + where id = #{id,jdbcType=INTEGER} + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > + delete from account + where id = #{id,jdbcType=INTEGER} + </delete> + <delete id="deleteByExample" parameterType="com.moral.monitor.entity.AccountEntityExample" > + delete from account + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + </delete> + <insert id="insert" parameterType="com.moral.monitor.entity.AccountEntity" > + insert into account (id, account, password, + name, sex, organization, + email, mobile, weixin, + time, enable) + values (#{id,jdbcType=INTEGER}, #{account,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, + #{name,jdbcType=VARCHAR}, #{sex,jdbcType=VARCHAR}, #{organization,jdbcType=VARCHAR}, + #{email,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{weixin,jdbcType=VARCHAR}, + #{time,jdbcType=TIMESTAMP}, #{enable,jdbcType=VARCHAR}) + </insert> + <insert id="insertSelective" parameterType="com.moral.monitor.entity.AccountEntity" > + insert into account + <trim prefix="(" suffix=")" suffixOverrides="," > + <if test="id != null" > + id, + </if> + <if test="account != null" > + account, + </if> + <if test="password != null" > + password, + </if> + <if test="name != null" > + name, + </if> + <if test="sex != null" > + sex, + </if> + <if test="organization != null" > + organization, + </if> + <if test="email != null" > + email, + </if> + <if test="mobile != null" > + mobile, + </if> + <if test="weixin != null" > + weixin, + </if> + <if test="time != null" > + time, + </if> + <if test="enable != null" > + enable, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides="," > + <if test="id != null" > + #{id,jdbcType=INTEGER}, + </if> + <if test="account != null" > + #{account,jdbcType=VARCHAR}, + </if> + <if test="password != null" > + #{password,jdbcType=VARCHAR}, + </if> + <if test="name != null" > + #{name,jdbcType=VARCHAR}, + </if> + <if test="sex != null" > + #{sex,jdbcType=VARCHAR}, + </if> + <if test="organization != null" > + #{organization,jdbcType=VARCHAR}, + </if> + <if test="email != null" > + #{email,jdbcType=VARCHAR}, + </if> + <if test="mobile != null" > + #{mobile,jdbcType=VARCHAR}, + </if> + <if test="weixin != null" > + #{weixin,jdbcType=VARCHAR}, + </if> + <if test="time != null" > + #{time,jdbcType=TIMESTAMP}, + </if> + <if test="enable != null" > + #{enable,jdbcType=VARCHAR}, + </if> + </trim> + </insert> + <select id="countByExample" parameterType="com.moral.monitor.entity.AccountEntityExample" resultType="java.lang.Integer" > + select count(*) from account + <if test="_parameter != null" > + <include refid="Example_Where_Clause" /> + </if> + </select> + <update id="updateByExampleSelective" parameterType="map" > + update account + <set > + <if test="record.id != null" > + id = #{record.id,jdbcType=INTEGER}, + </if> + <if test="record.account != null" > + account = #{record.account,jdbcType=VARCHAR}, + </if> + <if test="record.password != null" > + password = #{record.password,jdbcType=VARCHAR}, + </if> + <if test="record.name != null" > + name = #{record.name,jdbcType=VARCHAR}, + </if> + <if test="record.sex != null" > + sex = #{record.sex,jdbcType=VARCHAR}, + </if> + <if test="record.organization != null" > + organization = #{record.organization,jdbcType=VARCHAR}, + </if> + <if test="record.email != null" > + email = #{record.email,jdbcType=VARCHAR}, + </if> + <if test="record.mobile != null" > + mobile = #{record.mobile,jdbcType=VARCHAR}, + </if> + <if test="record.weixin != null" > + weixin = #{record.weixin,jdbcType=VARCHAR}, + </if> + <if test="record.time != null" > + time = #{record.time,jdbcType=TIMESTAMP}, + </if> + <if test="record.enable != null" > + enable = #{record.enable,jdbcType=VARCHAR}, + </if> + </set> + <if test="_parameter != null" > + <include refid="Update_By_Example_Where_Clause" /> + </if> + </update> + <update id="updateByExample" parameterType="map" > + update account + set id = #{record.id,jdbcType=INTEGER}, + account = #{record.account,jdbcType=VARCHAR}, + password = #{record.password,jdbcType=VARCHAR}, + name = #{record.name,jdbcType=VARCHAR}, + sex = #{record.sex,jdbcType=VARCHAR}, + organization = #{record.organization,jdbcType=VARCHAR}, + email = #{record.email,jdbcType=VARCHAR}, + mobile = #{record.mobile,jdbcType=VARCHAR}, + weixin = #{record.weixin,jdbcType=VARCHAR}, + time = #{record.time,jdbcType=TIMESTAMP}, + enable = #{record.enable,jdbcType=VARCHAR} + <if test="_parameter != null" > + <include refid="Update_By_Example_Where_Clause" /> + </if> + </update> + <update id="updateByPrimaryKeySelective" parameterType="com.moral.monitor.entity.AccountEntity" > + update account + <set > + <if test="account != null" > + account = #{account,jdbcType=VARCHAR}, + </if> + <if test="password != null" > + password = #{password,jdbcType=VARCHAR}, + </if> + <if test="name != null" > + name = #{name,jdbcType=VARCHAR}, + </if> + <if test="sex != null" > + sex = #{sex,jdbcType=VARCHAR}, + </if> + <if test="organization != null" > + organization = #{organization,jdbcType=VARCHAR}, + </if> + <if test="email != null" > + email = #{email,jdbcType=VARCHAR}, + </if> + <if test="mobile != null" > + mobile = #{mobile,jdbcType=VARCHAR}, + </if> + <if test="weixin != null" > + weixin = #{weixin,jdbcType=VARCHAR}, + </if> + <if test="time != null" > + time = #{time,jdbcType=TIMESTAMP}, + </if> + <if test="enable != null" > + enable = #{enable,jdbcType=VARCHAR}, + </if> + </set> + where id = #{id,jdbcType=INTEGER} + </update> + <update id="updateByPrimaryKey" parameterType="com.moral.monitor.entity.AccountEntity" > + update account + set account = #{account,jdbcType=VARCHAR}, + password = #{password,jdbcType=VARCHAR}, + name = #{name,jdbcType=VARCHAR}, + sex = #{sex,jdbcType=VARCHAR}, + organization = #{organization,jdbcType=VARCHAR}, + email = #{email,jdbcType=VARCHAR}, + mobile = #{mobile,jdbcType=VARCHAR}, + weixin = #{weixin,jdbcType=VARCHAR}, + time = #{time,jdbcType=TIMESTAMP}, + enable = #{enable,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + </update> +</mapper> \ No newline at end of file -- Gitblit v1.8.0