5 files deleted
6 files added
27 files modified
| | |
| | | <artifactId>mysql-connector-java</artifactId> |
| | | <version>5.1.44</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-mongodb</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.commons</groupId> |
| | | <artifactId>commons-lang3</artifactId> |
| | |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-aop</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.github.pagehelper</groupId> |
| | | <artifactId>pagehelper</artifactId> |
| | | <version>4.2.1</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>tk.mybatis</groupId> |
| | | <artifactId>mapper</artifactId> |
| | | <version>3.3.9</version> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | package com.moral.common.aop;
|
| | |
|
| | | import java.lang.reflect.Method;
|
| | | import java.lang.reflect.ParameterizedType;
|
| | | import java.lang.reflect.Type;
|
| | | import java.util.HashMap;
|
| | | import java.util.Map;
|
| | |
|
| | | import org.aspectj.lang.ProceedingJoinPoint;
|
| | | import org.aspectj.lang.Signature;
|
| | | import org.aspectj.lang.annotation.Around;
|
| | | import org.aspectj.lang.annotation.Aspect;
|
| | | import org.aspectj.lang.reflect.MethodSignature;
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.moral.common.bean.ResultBean;
|
| | | import com.moral.common.exception.BusinessException;
|
| | | import com.moral.common.exception.ValidateException;
|
| | |
|
| | | import lombok.extern.log4j.Log4j;
|
| | |
|
| | |
| | | public class ControllerAOP {
|
| | |
|
| | | @Around("execution(* com.moral.controller.*Controller.*(..))")
|
| | | public Object handlerControllerMethod(ProceedingJoinPoint pjp) {
|
| | | public Object handlerControllerMethod(ProceedingJoinPoint pjp) throws Exception {
|
| | |
|
| | | long startTime = System.currentTimeMillis();
|
| | | Map<String, Object> result;
|
| | | Object result;
|
| | |
|
| | | try {
|
| | | result = (Map<String, Object>) pjp.proceed();
|
| | | result = pjp.proceed();
|
| | | log.info(pjp.getSignature() + "use time:" + (System.currentTimeMillis() - startTime));
|
| | | } catch (Throwable e) {
|
| | | result = handlerException(pjp, e);
|
| | |
| | | return result;
|
| | | }
|
| | |
|
| | | private Map<String, Object> handlerException(ProceedingJoinPoint pjp, Throwable e) {
|
| | | Map<String, Object> result = new HashMap<String, Object>();
|
| | |
|
| | | // 已知异常
|
| | | @SuppressWarnings("rawtypes")
|
| | | private Object handlerException(ProceedingJoinPoint pjp, Throwable e) throws Exception {
|
| | | Signature sig = pjp.getSignature();
|
| | | MethodSignature msig = null;
|
| | | if (!(sig instanceof MethodSignature)) {
|
| | | throw new IllegalArgumentException("该注解只能用于方法");
|
| | | }
|
| | | msig = (MethodSignature) sig;
|
| | | Object target = pjp.getTarget();
|
| | | Method currentMethod = target.getClass().getMethod(msig.getName(), msig.getParameterTypes());
|
| | | Type type = currentMethod.getGenericReturnType();
|
| | | String message = "";
|
| | | if (e instanceof BusinessException) {
|
| | | result.put("msg", e.getLocalizedMessage());
|
| | | message = e.getLocalizedMessage();
|
| | | } else if (e instanceof ValidateException) {
|
| | | message = e.getLocalizedMessage();
|
| | | } else {
|
| | | log.error(pjp.getSignature() + " error ", e);
|
| | | result.put("msg", e.toString());
|
| | | //TODO 未知的异常,应该格外注意,可以发送邮件通知等
|
| | | message = e.toString();
|
| | | }
|
| | |
|
| | | if (type instanceof ParameterizedType) {
|
| | | Type rawType = ((ParameterizedType) type).getRawType();
|
| | | if (rawType == ResultBean.class) {
|
| | | ResultBean<?> resultBean = new ResultBean(ResultBean.FAIL);
|
| | | resultBean.setMessage(message);
|
| | | return resultBean;
|
| | | } else if (rawType == Map.class) {
|
| | | Map<String, Object> result = new HashMap<String, Object>();
|
| | | result.put("msg",message);
|
| | | return result;
|
| | | }
|
| | | }
|
| | | return null;
|
| | |
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | public static final int FAIL = 0;
|
| | | public static final int SUCCESS = 1;
|
| | | public static final int SUCCESS = 0;
|
| | | public static final int FAIL = 1;
|
| | | public static final int NO_PERMISSION = 2;
|
| | | private String msg = "success";
|
| | | private int code = SUCCESS;
|
| | | private String message = "success";
|
| | | private int errno = SUCCESS;
|
| | | private T data;
|
| | | public ResultBean() {
|
| | | super();
|
| | |
| | |
|
| | | public ResultBean(Throwable e) {
|
| | | super();
|
| | | this.msg = e.toString();
|
| | | this.code = FAIL;
|
| | | this.message = e.toString();
|
| | | this.errno = FAIL;
|
| | | }
|
| | | public ResultBean(String msg, int code) {
|
| | | public ResultBean(String message, int errno) {
|
| | | super();
|
| | | this.msg = msg;
|
| | | this.code = code;
|
| | | this.message = message;
|
| | | this.errno = errno;
|
| | | }
|
| | | public ResultBean(int code) {
|
| | | public ResultBean(int errno) {
|
| | | super();
|
| | | this.code = code;
|
| | | this.errno = errno;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.moral.common.exception; |
| | | |
| | | public class ValidateException extends RuntimeException { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | public ValidateException() { |
| | | } |
| | | |
| | | public ValidateException(String message) { |
| | | super(message); |
| | | } |
| | | |
| | | public ValidateException(Throwable cause) { |
| | | super(cause); |
| | | } |
| | | |
| | | public ValidateException(String message, Throwable cause) { |
| | | super(message, cause); |
| | | } |
| | | |
| | | public ValidateException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { |
| | | super(message, cause, enableSuppression, writableStackTrace); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.moral.common.mapper;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.List;
|
| | | import tk.mybatis.mapper.common.Mapper;
|
| | | import tk.mybatis.mapper.common.MySqlMapper;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | | import org.springframework.dao.DataAccessException;
|
| | | public interface BaseMapper<T> extends Mapper<T>,MySqlMapper<T> {
|
| | |
|
| | | public interface BaseMapper<Entity, Example, PK extends Serializable> extends Serializable {
|
| | | int insert(Entity record) throws DataAccessException;
|
| | |
|
| | | int insertSelective(Entity record) throws DataAccessException;
|
| | |
|
| | | int deleteByPrimaryKey(PK PK) throws DataAccessException;
|
| | |
|
| | | int deleteByExample(Example example) throws DataAccessException;
|
| | |
|
| | | int updateByPrimaryKeySelective(Entity record) throws DataAccessException;
|
| | |
|
| | | int updateByPrimaryKey(Entity record) throws DataAccessException;
|
| | |
|
| | | int updateByExampleSelective(@Param("record") Entity record, @Param("example") Example example)throws DataAccessException;
|
| | |
|
| | | int updateByExample(@Param("record") Entity record, @Param("example") Example example) throws DataAccessException;
|
| | |
|
| | | int countByExample(Example example) throws DataAccessException;
|
| | |
|
| | | Entity selectByPrimaryKey(PK pk) throws DataAccessException;
|
| | |
|
| | | List<Entity> selectByExample(Example example) throws DataAccessException;
|
| | | }
|
New file |
| | |
| | | package com.moral.common.util; |
| | | |
| | | import java.util.Locale; |
| | | |
| | | import org.springframework.context.MessageSource; |
| | | |
| | | import com.moral.common.exception.ValidateException; |
| | | |
| | | public class ValidateUtil { |
| | | private static MessageSource resources; |
| | | |
| | | public static void setResources(MessageSource resources) { |
| | | ValidateUtil.resources = resources; |
| | | } |
| | | |
| | | public static void check(boolean condition, String msgKey, Object... args) { |
| | | if (!condition) { |
| | | fail(msgKey, args); |
| | | } |
| | | } |
| | | |
| | | public static void notEmpty(String str, String msgKey, Object... args) { |
| | | if (str == null || str.trim().isEmpty()) { |
| | | fail(msgKey, args); |
| | | } |
| | | } |
| | | |
| | | public static void notNull(Object obj, String msgKey, Object... args) { |
| | | if (obj == null) { |
| | | fail(msgKey, args); |
| | | } |
| | | } |
| | | |
| | | private static void fail(String msgKey, Object... args) { |
| | | throw new ValidateException(resources.getMessage(msgKey, args, Locale.CHINESE)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.moral.config;
|
| | |
|
| | | import java.util.Properties;
|
| | | import org.springframework.context.annotation.Bean;
|
| | | import org.springframework.context.annotation.Configuration;
|
| | |
|
| | | import com.moral.common.mapper.BaseMapper;
|
| | |
|
| | | import tk.mybatis.spring.mapper.MapperScannerConfigurer;
|
| | |
|
| | | @Configuration
|
| | | public class MapperScannerConfig {
|
| | | @Bean
|
| | | public MapperScannerConfigurer mapperScannerConfigurer() {
|
| | | MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
|
| | | mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactory");
|
| | | mapperScannerConfigurer.setBasePackage("com.moral.mapper");//扫描该路径下的dao
|
| | | Properties properties = new Properties();
|
| | | properties.setProperty("mappers", BaseMapper.class.getName());//通用dao
|
| | | properties.setProperty("notEmpty", "false");
|
| | | properties.setProperty("IDENTITY", "MYSQL");
|
| | | mapperScannerConfigurer.setProperties(properties);
|
| | | return mapperScannerConfigurer;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.moral.config;
|
| | |
|
| | | import java.util.Properties;
|
| | |
|
| | | import org.springframework.cache.annotation.EnableCaching;
|
| | | import org.springframework.context.annotation.Bean;
|
| | | import org.springframework.context.annotation.Configuration;
|
| | |
|
| | | import com.github.pagehelper.PageHelper;
|
| | |
|
| | | @Configuration
|
| | | @EnableCaching
|
| | | public class PageHelperConfig {
|
| | | @Bean
|
| | | public PageHelper pageHelper(){
|
| | | PageHelper pageHelper = new PageHelper(); |
| | | Properties properties = new Properties();
|
| | | properties.setProperty("offsetAsPageNum","true");
|
| | | properties.setProperty("rowBoundsWithCount","true");
|
| | | properties.setProperty("reasonable","true");
|
| | | properties.setProperty("dialect","mysql"); //配置mysql数据库的方言
|
| | | pageHelper.setProperties(properties);
|
| | | return pageHelper;
|
| | | }
|
| | | } |
New file |
| | |
| | | package com.moral.controller;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.web.bind.annotation.CrossOrigin;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | |
|
| | | import com.github.pagehelper.PageHelper;
|
| | | import com.moral.common.bean.PageBean;
|
| | | import com.moral.common.bean.ResultBean;
|
| | | import com.moral.entity.Device;
|
| | | import com.moral.entity.OperateUser;
|
| | | import com.moral.service.DeviceService;
|
| | | import com.moral.service.OperateUserService;
|
| | |
|
| | | @RestController
|
| | | @RequestMapping(value = "mobile")
|
| | | @CrossOrigin(origins = "*", maxAge = 3600)
|
| | | public class MobileController {
|
| | |
|
| | | @Resource
|
| | | private OperateUserService operateUserService;
|
| | |
|
| | | @Resource
|
| | | private DeviceService deviceService;
|
| | |
|
| | | // 1登录
|
| | | @GetMapping(value = "accountlogin")
|
| | | public ResultBean<OperateUser> mobileLogin(String username, String password) {
|
| | | OperateUser operateUser = operateUserService.mobileLogin(username,password);
|
| | | return new ResultBean<OperateUser>(operateUser); |
| | | }
|
| | | |
| | | // 4修改密码
|
| | | @GetMapping(value = "upPassword")
|
| | | public ResultBean<OperateUser> updatePassword(Integer uid, String password, String newpassword) {
|
| | | OperateUser operateUser = operateUserService.updatePassword(uid,password,newpassword);
|
| | | return new ResultBean<OperateUser>(operateUser); |
| | | }
|
| | |
|
| | | // 11终端采集
|
| | | @GetMapping(value = "reportDevice")
|
| | | public ResultBean<String> installDevice(Device device) {
|
| | | deviceService.saveOrUpdateDevice(device);
|
| | | return new ResultBean<String>("");
|
| | | }
|
| | |
|
| | | // 5我安装的设备(分页)
|
| | | @GetMapping(value = "myRelease")
|
| | | public ResultBean<List<Device>> getInstallDevicesByOperateUser(Integer uid, Integer pageIndex, Integer pageSize) {
|
| | | List<Device> devices = deviceService.getInstallDevicesByOperateUser(uid,pageIndex,pageSize);
|
| | | return new ResultBean<List<Device>>(devices);
|
| | | }
|
| | |
|
| | | @GetMapping(value = "getEquInfoByMac")
|
| | | public void getEquInfoByMac(String mac) {
|
| | | }
|
| | |
|
| | | @GetMapping(value = "getMpointsByAreaName")
|
| | | public void getMpointsByAreaName(String areaName) {
|
| | | }
|
| | |
|
| | | @GetMapping(value = "getOrgsByAreaName")
|
| | | public void getOrgsByAreaName(String areaName) {
|
| | |
|
| | | }
|
| | | }
|
| | |
| | | import com.alibaba.fastjson.JSON;
|
| | | import com.alibaba.fastjson.JSONReader;
|
| | | import com.alibaba.fastjson.TypeReference;
|
| | | import com.moral.common.bean.ResultBean;
|
| | | import com.moral.common.exception.BusinessException;
|
| | | import com.moral.entity.Account;
|
| | | import com.moral.common.util.ValidateUtil;
|
| | | import com.moral.service.AccountService;
|
| | | import com.moral.service.DeviceService;
|
| | | import com.moral.service.HistoryService;
|
| | |
|
| | | /**
|
| | | * The Class ScreenController.
|
| | | * The Class ScreenController.大屏接口
|
| | | */
|
| | | @RestController
|
| | | @RequestMapping(value = "screen")
|
| | |
| | | return resultMap;
|
| | | }
|
| | |
|
| | | @GetMapping("login1")
|
| | | public ResultBean<Account> screenLogin1(HttpServletRequest request) {
|
| | | ResultBean<Account> resultBean = new ResultBean<Account>(ResultBean.FAIL);
|
| | | try {
|
| | | Map<String, Object> parameters = getParametersStartingWith(request, null);
|
| | | if (!(parameters.containsKey("account") && parameters.containsKey("password"))) {
|
| | | resultBean.setMsg("用户名及密码不允许为空!");
|
| | | } else {
|
| | | resultBean = accountService.screenLogin1(parameters);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | resultBean = new ResultBean<Account>(e);
|
| | | }
|
| | | return resultBean;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Gets the equipment states. 获取该账号下所有设备的状态
|
| | |
| | | @GetMapping("sensor-standard")
|
| | | public Map<String, Object> getStandardBySensor(@RequestParam("macKey") String macKey) {
|
| | | Map<String, Object> result = new HashMap<String, Object>();
|
| | | if (isEmpty(macKey)) {
|
| | | throw new BusinessException("参数不能为空!");
|
| | | } else {
|
| | | ValidateUtil.notEmpty(macKey, "参数不能为空!");
|
| | | result.put("standard", getValue(macKey + "-standard"));
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | |
| | |
|
| | | import lombok.Data;
|
| | |
|
| | |
|
| | | /**
|
| | | * Instantiates a new device.
|
| | | */
|
| | | @Data
|
| | | public class Device {/**
|
| | | * This field was generated by MyBatis Generator. This field corresponds to the database column device.id
|
| | |
| | | * @mbggenerated Wed Nov 29 16:17:59 CST 2017
|
| | | */
|
| | | private Integer deviceVersionId;
|
| | | |
| | | /**
|
| | | * Sets the uid.
|
| | | *
|
| | | * @param uid the new uid
|
| | | */
|
| | | public void setUid(Integer uid) {
|
| | | this.operateUserId = uid;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Sets the device name.
|
| | | *
|
| | | * @param device_name the new device name
|
| | | */
|
| | | public void setDevice_name(String device_name) {
|
| | | this.name = device_name;
|
| | | }
|
| | | |
| | | /**
|
| | | * Gets the device name.
|
| | | *
|
| | | * @return the device name
|
| | | */
|
| | | public String getDevice_name() {
|
| | | return name;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Sets the monitorpoint.
|
| | | *
|
| | | * @param monitorpoint the new monitorpoint
|
| | | */
|
| | | public void setMonitorpoint(Integer monitorpoint) {
|
| | | this.monitorPointId = monitorpoint;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Gets the status.
|
| | | *
|
| | | * @return the status
|
| | | */
|
| | | public String getStatus() {
|
| | | return state;
|
| | | }
|
| | |
|
| | | |
| | | } |
| | |
| | | private Date createTime;
|
| | |
|
| | | private Date expireTime;
|
| | | |
| | | public Integer getUid() {
|
| | | return id;
|
| | | }
|
| | |
|
| | |
|
| | | } |
| | |
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import org.apache.ibatis.annotations.Mapper;
|
| | |
|
| | | import com.moral.common.mapper.BaseMapper;
|
| | | import com.moral.entity.Account;
|
| | | import com.moral.entity.AccountExample;
|
| | |
|
| | | @Mapper
|
| | | public interface AccountMapper extends BaseMapper<Account, AccountExample, Integer> {
|
| | | public interface AccountMapper extends BaseMapper<Account> {
|
| | |
|
| | | List<Map<String, Object>> getRoleNameByAccountId(Integer accountId);
|
| | | } |
| | |
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import org.apache.ibatis.annotations.Mapper;
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
|
| | | import com.moral.common.mapper.BaseMapper;
|
| | | import com.moral.entity.Device;
|
| | | import com.moral.entity.DeviceExample;
|
| | |
|
| | | @Mapper
|
| | | public interface DeviceMapper extends BaseMapper<Device, DeviceExample, Integer>{
|
| | | public interface DeviceMapper extends BaseMapper<Device>{
|
| | |
|
| | | List<Map<String, Object>> getDeviceStatesByAccount(Map<String, Object> parameters);
|
| | |
|
| | |
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import org.apache.ibatis.annotations.Mapper;
|
| | |
|
| | | @Mapper
|
| | | public interface HistoryMapper{
|
| | |
|
| | | Map<String, Double> getDayAQIByDevice(Map<String, Object> parameters);
|
| | |
| | | package com.moral.mapper;
|
| | |
|
| | | import org.apache.ibatis.annotations.Mapper;
|
| | |
|
| | | import com.moral.common.mapper.BaseMapper;
|
| | | import com.moral.entity.OperateUser;
|
| | | import com.moral.entity.OperateUserExample;
|
| | |
|
| | | @Mapper
|
| | | public interface OperateUserMapper extends BaseMapper<OperateUser, OperateUserExample, Integer> {
|
| | | public interface OperateUserMapper extends BaseMapper<OperateUser> {
|
| | | } |
| | |
| | | package com.moral.mapper;
|
| | |
|
| | | import org.apache.ibatis.annotations.Mapper;
|
| | |
|
| | | import com.moral.common.mapper.BaseMapper;
|
| | | import com.moral.entity.Organization;
|
| | | import com.moral.entity.OrganizationExample;
|
| | |
|
| | | @Mapper
|
| | | public interface OrganizationMapper extends BaseMapper<Organization, OrganizationExample, Integer> {
|
| | | public interface OrganizationMapper extends BaseMapper<Organization> {
|
| | | } |
| | |
| | | package com.moral.mapper;
|
| | |
|
| | | import org.apache.ibatis.annotations.Mapper;
|
| | |
|
| | | import com.moral.common.mapper.BaseMapper;
|
| | | import com.moral.entity.OrganizationRelation;
|
| | | import com.moral.entity.OrganizationRelationExample;
|
| | |
|
| | | @Mapper
|
| | | public interface OrganizationRelationMapper extends BaseMapper<OrganizationRelation, OrganizationRelationExample, Integer> {
|
| | | public interface OrganizationRelationMapper extends BaseMapper<OrganizationRelation> {
|
| | | } |
| | |
| | | package com.moral.mapper; |
| | | |
| | | import com.moral.entity.auth.AuthUser; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | //import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | //@Mapper |
| | |
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import com.moral.entity.Device;
|
| | |
|
| | | public interface DeviceService {
|
| | |
|
| | | Map<String, Object> getDeviceStatesByAccount(Map<String, Object> parameters);
|
| | |
|
| | | List<Map<String, Object>> getSensorsByDevice(String mac);
|
| | |
|
| | | void saveOrUpdateDevice(Device device);
|
| | |
|
| | | List<Device> getInstallDevicesByOperateUser(Integer uid, Integer pageIndex, Integer pageSize);
|
| | | }
|
| | |
| | | public interface OperateUserService {
|
| | |
|
| | | List<OperateUser> getUserList(String mobile);
|
| | |
|
| | | OperateUser mobileLogin(String mobile, String password);
|
| | |
|
| | | OperateUser updatePassword(Integer uid, String password, String newPassword);
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import com.moral.common.exception.BusinessException;
|
| | | import com.moral.entity.Account;
|
| | | import com.moral.entity.AccountExample;
|
| | | import com.moral.mapper.AccountMapper;
|
| | | import com.moral.service.AccountService;
|
| | | import com.moral.service.OrganizationService;
|
| | |
|
| | | import tk.mybatis.mapper.entity.Example;
|
| | |
|
| | | @Service
|
| | | public class AccountServiceImpl implements AccountService {
|
| | |
| | | @Override
|
| | | public Map<String, Object> screenLogin(Map<String, Object> parameters) {
|
| | | Map<String, Object> result = new HashMap<String, Object>();
|
| | | AccountExample example = new AccountExample();
|
| | | Example example = new Example(Account.class);
|
| | | String password = md5((String) parameters.get("account"));
|
| | | example.or().andAccountNameEqualTo((String) parameters.get("account")).andPasswordEqualTo(password);
|
| | | example.or().andEqualTo("accountName",parameters.get("account")).andEqualTo("password",password);
|
| | | List<Account> accounts = accountMapper.selectByExample(example);
|
| | | if (isEmpty(accounts) || accounts.size() != 1) {
|
| | | result.put("msg", "用户名及密码输入错误!");
|
| | |
| | |
|
| | | @Override
|
| | | public List<Account> getAccountLists(String accountName, String password) {
|
| | | AccountExample example = new AccountExample();
|
| | | example.or().andAccountNameEqualTo(accountName).andPasswordEqualTo(password);
|
| | | Example example = new Example(Account.class);
|
| | | example.or().andEqualTo("accountName",accountName).andEqualTo("password",password);
|
| | | return accountMapper.selectByExample(example);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Account> getAccountList(String accountName) {
|
| | | AccountExample example = new AccountExample();
|
| | | example.or().andAccountNameEqualTo(accountName);
|
| | | Example example = new Example(Account.class);
|
| | | example.or().andEqualTo("accountName",accountName);
|
| | | return accountMapper.selectByExample(example);
|
| | | }
|
| | |
|
| | |
| | | package com.moral.service.impl;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.util.ObjectUtils;
|
| | |
|
| | | import com.github.pagehelper.PageHelper;
|
| | | import com.moral.common.exception.BusinessException;
|
| | | import com.moral.common.util.ValidateUtil;
|
| | | import com.moral.entity.Device;
|
| | | import com.moral.mapper.DeviceMapper;
|
| | | import com.moral.service.AccountService;
|
| | | import com.moral.service.DeviceService;
|
| | |
|
| | | import tk.mybatis.mapper.entity.Example;
|
| | |
|
| | | @Service
|
| | | public class DeviceServiceImpl implements DeviceService {
|
| | |
| | | return deviceMapper.getSensorsByDevice(mac);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void saveOrUpdateDevice(Device device) {
|
| | | ValidateUtil.notNull(device, "参数不可为空");
|
| | | ValidateUtil.notEmpty(device.getMac(), "参数不可为空");
|
| | | Example example = new Example(Device.class);
|
| | | example.or().andEqualTo("mac",device.getMac());
|
| | | List<Device> devices = deviceMapper.selectByExample(example);
|
| | | Date operateDate = new Date();
|
| | | device.setInstallTime(operateDate);
|
| | | if (ObjectUtils.isEmpty(devices)) {
|
| | | device.setCreateTime(operateDate);
|
| | | device.setState("4");
|
| | | deviceMapper.insertSelective(device);
|
| | | }else if (devices.size() > 1) {
|
| | | throw new BusinessException("设备信息异常,联系管理员!");
|
| | | }else {
|
| | | device.setId(devices.get(0).getId());
|
| | | deviceMapper.updateByPrimaryKeySelective(device);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Device> getInstallDevicesByOperateUser(Integer uid, Integer pageIndex, Integer pageSize) {
|
| | | Example example = new Example(Device.class);
|
| | | example.or().andEqualTo("operateUserId",uid);
|
| | | PageHelper.startPage(pageIndex, pageSize);
|
| | | List<Device> devices = deviceMapper.selectByExample(example);
|
| | | return devices;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.data.mongodb.core.MongoTemplate;
|
| | | import org.springframework.data.mongodb.core.aggregation.Aggregation;
|
| | | import org.springframework.data.mongodb.core.aggregation.AggregationResults;
|
| | |
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.util.ObjectUtils;
|
| | |
|
| | | import com.moral.common.exception.BusinessException;
|
| | | import com.moral.common.util.Crypto;
|
| | | import com.moral.entity.OperateUser;
|
| | | import com.moral.entity.OperateUserExample;
|
| | | import com.moral.mapper.OperateUserMapper;
|
| | | import com.moral.service.OperateUserService;
|
| | |
|
| | | import tk.mybatis.mapper.entity.Example;
|
| | |
|
| | | @Service
|
| | | public class OperateUserServiceImpl implements OperateUserService {
|
| | |
| | |
|
| | | @Override
|
| | | public List<OperateUser> getUserList(String mobile) {
|
| | | OperateUserExample example = new OperateUserExample();
|
| | | example.or().andMobileEqualTo(mobile);
|
| | | Example example = new Example(OperateUser.class);
|
| | | example.or().andEqualTo("mobile", mobile);
|
| | | return operateUserMapper.selectByExample(example);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public OperateUser mobileLogin(String mobile, String password) {
|
| | | Example example = new Example(OperateUser.class);
|
| | | example.or().andEqualTo("mobile", mobile).andEqualTo("password", Crypto.md5(password));
|
| | | List<OperateUser> operateUsers = operateUserMapper.selectByExample(example);
|
| | | if (ObjectUtils.isEmpty(operateUsers) || operateUsers.size() > 1) {
|
| | | throw new BusinessException("用户名或密码错误,登陆失败!");
|
| | | }else {
|
| | | OperateUser operateUser = operateUsers.get(0);
|
| | | operateUser.setPassword(password);
|
| | | return operateUser;
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public OperateUser updatePassword(Integer uid, String password, String newPassword) {
|
| | | OperateUser operateUser = operateUserMapper.selectByPrimaryKey(uid);
|
| | | if (ObjectUtils.isEmpty(operateUser) || !Crypto.md5(password).equals(operateUser.getPassword())) {
|
| | | throw new BusinessException("旧密码错误,修改密码失败!");
|
| | | }else {
|
| | | operateUser.setPassword(Crypto.md5(newPassword));
|
| | | operateUserMapper.updateByPrimaryKeySelective(operateUser);
|
| | | operateUser.setPassword(newPassword);
|
| | | return operateUser;
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import com.moral.entity.Organization;
|
| | | import com.moral.entity.OrganizationRelation;
|
| | | import com.moral.entity.OrganizationRelationExample;
|
| | | import com.moral.mapper.OrganizationMapper;
|
| | | import com.moral.mapper.OrganizationRelationMapper;
|
| | | import com.moral.service.OrganizationService;
|
| | |
|
| | | import tk.mybatis.mapper.entity.Example;
|
| | |
|
| | | @Service
|
| | | public class OrganizationServiceImpl implements OrganizationService {
|
| | |
| | | public Set<Integer> getChildOrganizationIds(Integer orgId){
|
| | | Set<Integer> orgIds = new HashSet<Integer>();
|
| | | orgIds.add(orgId);
|
| | | OrganizationRelationExample example = new OrganizationRelationExample();
|
| | | example.or().andParentIdEqualTo(orgId);
|
| | | Example example = new Example(OrganizationRelation.class);
|
| | | example.or().andEqualTo("parentId",orgId);
|
| | | Organization organization = organizationMapper.selectByPrimaryKey(orgId);
|
| | | if (IS_DELETE_FALSE.equals(organization.getIsDelete())) {
|
| | | List<OrganizationRelation> organizationRelations = organizationRelationMapper.selectByExample(example);
|
| | |
| | | |
| | | data: |
| | | mongodb: |
| | | uri: mongodb://47.96.26.152:27017/monitor |
| | | uri: mongodb://47.96.171.62:27017/monitor |
| | | |
| | | mybatis: |
| | | mapper-locations: classpath*:/mapper/*Mapper.xml |
| | | type-aliases-package: com.moral.entity |
| | | #mybatis: |
| | | # mapper-locations: classpath*:/mapper/*Mapper.xml |
| | | # type-aliases-package: com.moral.entity |
| | |
| | | <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |
| | | <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime" /> |
| | | </resultMap> |
| | | <sql id="Example_Where_Clause"> |
| | | <where> |
| | | <foreach collection="oredCriteria" item="criteria" separator="or"> |
| | | <if test="criteria.valid"> |
| | | <trim prefix="(" prefixOverrides="and" suffix=")"> |
| | | <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 close=")" collection="criterion.value" item="listItem" open="(" 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="(" prefixOverrides="and" suffix=")"> |
| | | <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 close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
| | | #{listItem} |
| | | </foreach> |
| | | </when> |
| | | </choose> |
| | | </foreach> |
| | | </trim> |
| | | </if> |
| | | </foreach> |
| | | </where> |
| | | </sql> |
| | | <sql id="Base_Column_List"> |
| | | id, account_name, password, organization_id, email, mobile, weixin, is_delete, create_time, |
| | | expire_time |
| | | </sql> |
| | | <select id="selectByExample" parameterType="com.moral.entity.AccountExample" resultMap="BaseResultMap"> |
| | | 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" parameterType="java.lang.Integer" resultMap="BaseResultMap"> |
| | | 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.entity.AccountExample"> |
| | | delete from account |
| | | <if test="_parameter != null"> |
| | | <include refid="Example_Where_Clause" /> |
| | | </if> |
| | | </delete> |
| | | <insert id="insert" parameterType="com.moral.entity.Account"> |
| | | insert into account (id, account_name, password, |
| | | organization_id, email, mobile, |
| | | weixin, is_delete, create_time, |
| | | expire_time) |
| | | values (#{id,jdbcType=INTEGER}, #{accountName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, |
| | | #{organizationId,jdbcType=INTEGER}, #{email,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, |
| | | #{weixin,jdbcType=VARCHAR}, #{isDelete,jdbcType=CHAR}, #{createTime,jdbcType=TIMESTAMP}, |
| | | #{expireTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.moral.entity.Account"> |
| | | insert into account |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="accountName != null"> |
| | | account_name, |
| | | </if> |
| | | <if test="password != null"> |
| | | password, |
| | | </if> |
| | | <if test="organizationId != null"> |
| | | organization_id, |
| | | </if> |
| | | <if test="email != null"> |
| | | email, |
| | | </if> |
| | | <if test="mobile != null"> |
| | | mobile, |
| | | </if> |
| | | <if test="weixin != null"> |
| | | weixin, |
| | | </if> |
| | | <if test="isDelete != null"> |
| | | is_delete, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | create_time, |
| | | </if> |
| | | <if test="expireTime != null"> |
| | | expire_time, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="accountName != null"> |
| | | #{accountName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="password != null"> |
| | | #{password,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="organizationId != null"> |
| | | #{organizationId,jdbcType=INTEGER}, |
| | | </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="isDelete != null"> |
| | | #{isDelete,jdbcType=CHAR}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="expireTime != null"> |
| | | #{expireTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <select id="countByExample" parameterType="com.moral.entity.AccountExample" 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.accountName != null"> |
| | | account_name = #{record.accountName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="record.password != null"> |
| | | password = #{record.password,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="record.organizationId != null"> |
| | | organization_id = #{record.organizationId,jdbcType=INTEGER}, |
| | | </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.isDelete != null"> |
| | | is_delete = #{record.isDelete,jdbcType=CHAR}, |
| | | </if> |
| | | <if test="record.createTime != null"> |
| | | create_time = #{record.createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="record.expireTime != null"> |
| | | expire_time = #{record.expireTime,jdbcType=TIMESTAMP}, |
| | | </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_name = #{record.accountName,jdbcType=VARCHAR}, |
| | | password = #{record.password,jdbcType=VARCHAR}, |
| | | organization_id = #{record.organizationId,jdbcType=INTEGER}, |
| | | email = #{record.email,jdbcType=VARCHAR}, |
| | | mobile = #{record.mobile,jdbcType=VARCHAR}, |
| | | weixin = #{record.weixin,jdbcType=VARCHAR}, |
| | | is_delete = #{record.isDelete,jdbcType=CHAR}, |
| | | create_time = #{record.createTime,jdbcType=TIMESTAMP}, |
| | | expire_time = #{record.expireTime,jdbcType=TIMESTAMP} |
| | | <if test="_parameter != null"> |
| | | <include refid="Update_By_Example_Where_Clause" /> |
| | | </if> |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.moral.entity.Account"> |
| | | update account |
| | | <set> |
| | | <if test="accountName != null"> |
| | | account_name = #{accountName,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="password != null"> |
| | | password = #{password,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="organizationId != null"> |
| | | organization_id = #{organizationId,jdbcType=INTEGER}, |
| | | </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="isDelete != null"> |
| | | is_delete = #{isDelete,jdbcType=CHAR}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="expireTime != null"> |
| | | expire_time = #{expireTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.moral.entity.Account"> |
| | | update account |
| | | set account_name = #{accountName,jdbcType=VARCHAR}, |
| | | password = #{password,jdbcType=VARCHAR}, |
| | | organization_id = #{organizationId,jdbcType=INTEGER}, |
| | | email = #{email,jdbcType=VARCHAR}, |
| | | mobile = #{mobile,jdbcType=VARCHAR}, |
| | | weixin = #{weixin,jdbcType=VARCHAR}, |
| | | is_delete = #{isDelete,jdbcType=CHAR}, |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | expire_time = #{expireTime,jdbcType=TIMESTAMP} |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </update> |
| | |
|
| | | <select id="getRoleNameByAccountId" resultType="map"> |
| | | SELECT |
| | |
| | | <result column="monitor_point_id" jdbcType="INTEGER" property="monitorPointId" /> |
| | | <result column="device_version_id" jdbcType="INTEGER" property="deviceVersionId" /> |
| | | </resultMap> |
| | | <sql id="Example_Where_Clause"> |
| | | <!-- |
| | | WARNING - @mbggenerated |
| | | This element is automatically generated by MyBatis Generator, do not modify. |
| | | This element was generated on Wed Nov 29 16:17:59 CST 2017. |
| | | --> |
| | | <where> |
| | | <foreach collection="oredCriteria" item="criteria" separator="or"> |
| | | <if test="criteria.valid"> |
| | | <trim prefix="(" prefixOverrides="and" suffix=")"> |
| | | <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 close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
| | | #{listItem} |
| | | </foreach> |
| | | </when> |
| | | </choose> |
| | | </foreach> |
| | | </trim> |
| | | </if> |
| | | </foreach> |
| | | </where> |
| | | </sql> |
| | | <sql id="Update_By_Example_Where_Clause"> |
| | | <!-- |
| | | WARNING - @mbggenerated |
| | | This element is automatically generated by MyBatis Generator, do not modify. |
| | | This element was generated on Wed Nov 29 16:17:59 CST 2017. |
| | | --> |
| | | <where> |
| | | <foreach collection="example.oredCriteria" item="criteria" separator="or"> |
| | | <if test="criteria.valid"> |
| | | <trim prefix="(" prefixOverrides="and" suffix=")"> |
| | | <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 close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
| | | #{listItem} |
| | | </foreach> |
| | | </when> |
| | | </choose> |
| | | </foreach> |
| | | </trim> |
| | | </if> |
| | | </foreach> |
| | | </where> |
| | | </sql> |
| | | <sql id="Base_Column_List"> |
| | | <!-- |
| | | WARNING - @mbggenerated |
| | | This element is automatically generated by MyBatis Generator, do not modify. |
| | | This element was generated on Wed Nov 29 16:17:59 CST 2017. |
| | | --> |
| | | id, name, address, longitude, latitude, mac, operate_user_id, state, create_time, |
| | | install_time, monitor_point_id, device_version_id |
| | | </sql> |
| | | <select id="selectByExample" parameterType="com.moral.entity.DeviceExample" resultMap="BaseResultMap"> |
| | | <!-- |
| | | WARNING - @mbggenerated |
| | | This element is automatically generated by MyBatis Generator, do not modify. |
| | | This element was generated on Wed Nov 29 16:17:59 CST 2017. |
| | | --> |
| | | select |
| | | <if test="distinct"> |
| | | distinct |
| | | </if> |
| | | <include refid="Base_Column_List" /> |
| | | from device |
| | | <if test="_parameter != null"> |
| | | <include refid="Example_Where_Clause" /> |
| | | </if> |
| | | <if test="orderByClause != null"> |
| | | order by ${orderByClause} |
| | | </if> |
| | | </select> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> |
| | | <!-- |
| | | WARNING - @mbggenerated |
| | | This element is automatically generated by MyBatis Generator, do not modify. |
| | | This element was generated on Wed Nov 29 16:17:59 CST 2017. |
| | | --> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from device |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> |
| | | <!-- |
| | | WARNING - @mbggenerated |
| | | This element is automatically generated by MyBatis Generator, do not modify. |
| | | This element was generated on Wed Nov 29 16:17:59 CST 2017. |
| | | --> |
| | | delete from device |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </delete> |
| | | <delete id="deleteByExample" parameterType="com.moral.entity.DeviceExample"> |
| | | <!-- |
| | | WARNING - @mbggenerated |
| | | This element is automatically generated by MyBatis Generator, do not modify. |
| | | This element was generated on Wed Nov 29 16:17:59 CST 2017. |
| | | --> |
| | | delete from device |
| | | <if test="_parameter != null"> |
| | | <include refid="Example_Where_Clause" /> |
| | | </if> |
| | | </delete> |
| | | <insert id="insert" parameterType="com.moral.entity.Device"> |
| | | <!-- |
| | | WARNING - @mbggenerated |
| | | This element is automatically generated by MyBatis Generator, do not modify. |
| | | This element was generated on Wed Nov 29 16:17:59 CST 2017. |
| | | --> |
| | | insert into device (id, name, address, |
| | | longitude, latitude, mac, |
| | | operate_user_id, state, create_time, |
| | | install_time, monitor_point_id, device_version_id |
| | | ) |
| | | values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, |
| | | #{longitude,jdbcType=REAL}, #{latitude,jdbcType=REAL}, #{mac,jdbcType=VARCHAR}, |
| | | #{operateUserId,jdbcType=INTEGER}, #{state,jdbcType=CHAR}, #{createTime,jdbcType=TIMESTAMP}, |
| | | #{installTime,jdbcType=TIMESTAMP}, #{monitorPointId,jdbcType=INTEGER}, #{deviceVersionId,jdbcType=INTEGER} |
| | | ) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.moral.entity.Device"> |
| | | <!-- |
| | | WARNING - @mbggenerated |
| | | This element is automatically generated by MyBatis Generator, do not modify. |
| | | This element was generated on Wed Nov 29 16:17:59 CST 2017. |
| | | --> |
| | | insert into device |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | id, |
| | | </if> |
| | | <if test="name != null"> |
| | | name, |
| | | </if> |
| | | <if test="address != null"> |
| | | address, |
| | | </if> |
| | | <if test="longitude != null"> |
| | | longitude, |
| | | </if> |
| | | <if test="latitude != null"> |
| | | latitude, |
| | | </if> |
| | | <if test="mac != null"> |
| | | mac, |
| | | </if> |
| | | <if test="operateUserId != null"> |
| | | operate_user_id, |
| | | </if> |
| | | <if test="state != null"> |
| | | state, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | create_time, |
| | | </if> |
| | | <if test="installTime != null"> |
| | | install_time, |
| | | </if> |
| | | <if test="monitorPointId != null"> |
| | | monitor_point_id, |
| | | </if> |
| | | <if test="deviceVersionId != null"> |
| | | device_version_id, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | | #{id,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="name != null"> |
| | | #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="address != null"> |
| | | #{address,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="longitude != null"> |
| | | #{longitude,jdbcType=REAL}, |
| | | </if> |
| | | <if test="latitude != null"> |
| | | #{latitude,jdbcType=REAL}, |
| | | </if> |
| | | <if test="mac != null"> |
| | | #{mac,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="operateUserId != null"> |
| | | #{operateUserId,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="state != null"> |
| | | #{state,jdbcType=CHAR}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="installTime != null"> |
| | | #{installTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="monitorPointId != null"> |
| | | #{monitorPointId,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="deviceVersionId != null"> |
| | | #{deviceVersionId,jdbcType=INTEGER}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | | <select id="countByExample" parameterType="com.moral.entity.DeviceExample" resultType="java.lang.Integer"> |
| | | <!-- |
| | | WARNING - @mbggenerated |
| | | This element is automatically generated by MyBatis Generator, do not modify. |
| | | This element was generated on Wed Nov 29 16:17:59 CST 2017. |
| | | --> |
| | | select count(*) from device |
| | | <if test="_parameter != null"> |
| | | <include refid="Example_Where_Clause" /> |
| | | </if> |
| | | </select> |
| | | <update id="updateByExampleSelective" parameterType="map"> |
| | | <!-- |
| | | WARNING - @mbggenerated |
| | | This element is automatically generated by MyBatis Generator, do not modify. |
| | | This element was generated on Wed Nov 29 16:17:59 CST 2017. |
| | | --> |
| | | update device |
| | | <set> |
| | | <if test="record.id != null"> |
| | | id = #{record.id,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="record.name != null"> |
| | | name = #{record.name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="record.address != null"> |
| | | address = #{record.address,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="record.longitude != null"> |
| | | longitude = #{record.longitude,jdbcType=REAL}, |
| | | </if> |
| | | <if test="record.latitude != null"> |
| | | latitude = #{record.latitude,jdbcType=REAL}, |
| | | </if> |
| | | <if test="record.mac != null"> |
| | | mac = #{record.mac,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="record.operateUserId != null"> |
| | | operate_user_id = #{record.operateUserId,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="record.state != null"> |
| | | state = #{record.state,jdbcType=CHAR}, |
| | | </if> |
| | | <if test="record.createTime != null"> |
| | | create_time = #{record.createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="record.installTime != null"> |
| | | install_time = #{record.installTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="record.monitorPointId != null"> |
| | | monitor_point_id = #{record.monitorPointId,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="record.deviceVersionId != null"> |
| | | device_version_id = #{record.deviceVersionId,jdbcType=INTEGER}, |
| | | </if> |
| | | </set> |
| | | <if test="_parameter != null"> |
| | | <include refid="Update_By_Example_Where_Clause" /> |
| | | </if> |
| | | </update> |
| | | <update id="updateByExample" parameterType="map"> |
| | | <!-- |
| | | WARNING - @mbggenerated |
| | | This element is automatically generated by MyBatis Generator, do not modify. |
| | | This element was generated on Wed Nov 29 16:17:59 CST 2017. |
| | | --> |
| | | update device |
| | | set id = #{record.id,jdbcType=INTEGER}, |
| | | name = #{record.name,jdbcType=VARCHAR}, |
| | | address = #{record.address,jdbcType=VARCHAR}, |
| | | longitude = #{record.longitude,jdbcType=REAL}, |
| | | latitude = #{record.latitude,jdbcType=REAL}, |
| | | mac = #{record.mac,jdbcType=VARCHAR}, |
| | | operate_user_id = #{record.operateUserId,jdbcType=INTEGER}, |
| | | state = #{record.state,jdbcType=CHAR}, |
| | | create_time = #{record.createTime,jdbcType=TIMESTAMP}, |
| | | install_time = #{record.installTime,jdbcType=TIMESTAMP}, |
| | | monitor_point_id = #{record.monitorPointId,jdbcType=INTEGER}, |
| | | device_version_id = #{record.deviceVersionId,jdbcType=INTEGER} |
| | | <if test="_parameter != null"> |
| | | <include refid="Update_By_Example_Where_Clause" /> |
| | | </if> |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.moral.entity.Device"> |
| | | <!-- |
| | | WARNING - @mbggenerated |
| | | This element is automatically generated by MyBatis Generator, do not modify. |
| | | This element was generated on Wed Nov 29 16:17:59 CST 2017. |
| | | --> |
| | | update device |
| | | <set> |
| | | <if test="name != null"> |
| | | name = #{name,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="address != null"> |
| | | address = #{address,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="longitude != null"> |
| | | longitude = #{longitude,jdbcType=REAL}, |
| | | </if> |
| | | <if test="latitude != null"> |
| | | latitude = #{latitude,jdbcType=REAL}, |
| | | </if> |
| | | <if test="mac != null"> |
| | | mac = #{mac,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="operateUserId != null"> |
| | | operate_user_id = #{operateUserId,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="state != null"> |
| | | state = #{state,jdbcType=CHAR}, |
| | | </if> |
| | | <if test="createTime != null"> |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="installTime != null"> |
| | | install_time = #{installTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="monitorPointId != null"> |
| | | monitor_point_id = #{monitorPointId,jdbcType=INTEGER}, |
| | | </if> |
| | | <if test="deviceVersionId != null"> |
| | | device_version_id = #{deviceVersionId,jdbcType=INTEGER}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </update> |
| | | <update id="updateByPrimaryKey" parameterType="com.moral.entity.Device"> |
| | | <!-- |
| | | WARNING - @mbggenerated |
| | | This element is automatically generated by MyBatis Generator, do not modify. |
| | | This element was generated on Wed Nov 29 16:17:59 CST 2017. |
| | | --> |
| | | update device |
| | | set name = #{name,jdbcType=VARCHAR}, |
| | | address = #{address,jdbcType=VARCHAR}, |
| | | longitude = #{longitude,jdbcType=REAL}, |
| | | latitude = #{latitude,jdbcType=REAL}, |
| | | mac = #{mac,jdbcType=VARCHAR}, |
| | | operate_user_id = #{operateUserId,jdbcType=INTEGER}, |
| | | state = #{state,jdbcType=CHAR}, |
| | | create_time = #{createTime,jdbcType=TIMESTAMP}, |
| | | install_time = #{installTime,jdbcType=TIMESTAMP}, |
| | | monitor_point_id = #{monitorPointId,jdbcType=INTEGER}, |
| | | device_version_id = #{deviceVersionId,jdbcType=INTEGER} |
| | | where id = #{id,jdbcType=INTEGER} |
| | | </update> |
| | | <select id="getDeviceStatesByAccount" resultType="map"> |
| | | SELECT |
| | | COUNT( d.state ) count, |
| | |
| | | <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
|
| | | <result column="expire_time" property="expireTime" jdbcType="TIMESTAMP" />
|
| | | </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, job_number, name, password, organization_id, mobile, email, weixin, is_delete, |
| | | create_time, expire_time
|
| | | </sql>
|
| | | <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.moral.entity.OperateUserExample" >
|
| | | select
|
| | | <if test="distinct" >
|
| | | distinct
|
| | | </if>
|
| | | <include refid="Base_Column_List" />
|
| | | from operate_user
|
| | | <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 operate_user
|
| | | where id = #{id,jdbcType=INTEGER}
|
| | | </select>
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
| | | delete from operate_user
|
| | | where id = #{id,jdbcType=INTEGER}
|
| | | </delete>
|
| | | <delete id="deleteByExample" parameterType="com.moral.entity.OperateUserExample" >
|
| | | delete from operate_user
|
| | | <if test="_parameter != null" >
|
| | | <include refid="Example_Where_Clause" />
|
| | | </if>
|
| | | </delete>
|
| | | <insert id="insert" parameterType="com.moral.entity.OperateUser" >
|
| | | insert into operate_user (id, job_number, name, |
| | | password, organization_id, mobile, |
| | | email, weixin, is_delete, |
| | | create_time, expire_time)
|
| | | values (#{id,jdbcType=INTEGER}, #{jobNumber,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, |
| | | #{password,jdbcType=VARCHAR}, #{organizationId,jdbcType=INTEGER}, #{mobile,jdbcType=VARCHAR}, |
| | | #{email,jdbcType=VARCHAR}, #{weixin,jdbcType=VARCHAR}, #{isDelete,jdbcType=CHAR}, |
| | | #{createTime,jdbcType=TIMESTAMP}, #{expireTime,jdbcType=TIMESTAMP})
|
| | | </insert>
|
| | | <insert id="insertSelective" parameterType="com.moral.entity.OperateUser" >
|
| | | insert into operate_user
|
| | | <trim prefix="(" suffix=")" suffixOverrides="," >
|
| | | <if test="id != null" >
|
| | | id,
|
| | | </if>
|
| | | <if test="jobNumber != null" >
|
| | | job_number,
|
| | | </if>
|
| | | <if test="name != null" >
|
| | | name,
|
| | | </if>
|
| | | <if test="password != null" >
|
| | | password,
|
| | | </if>
|
| | | <if test="organizationId != null" >
|
| | | organization_id,
|
| | | </if>
|
| | | <if test="mobile != null" >
|
| | | mobile,
|
| | | </if>
|
| | | <if test="email != null" >
|
| | | email,
|
| | | </if>
|
| | | <if test="weixin != null" >
|
| | | weixin,
|
| | | </if>
|
| | | <if test="isDelete != null" >
|
| | | is_delete,
|
| | | </if>
|
| | | <if test="createTime != null" >
|
| | | create_time,
|
| | | </if>
|
| | | <if test="expireTime != null" >
|
| | | expire_time,
|
| | | </if>
|
| | | </trim>
|
| | | <trim prefix="values (" suffix=")" suffixOverrides="," >
|
| | | <if test="id != null" >
|
| | | #{id,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="jobNumber != null" >
|
| | | #{jobNumber,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="name != null" >
|
| | | #{name,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="password != null" >
|
| | | #{password,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="organizationId != null" >
|
| | | #{organizationId,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="mobile != null" >
|
| | | #{mobile,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="email != null" >
|
| | | #{email,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="weixin != null" >
|
| | | #{weixin,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="isDelete != null" >
|
| | | #{isDelete,jdbcType=CHAR},
|
| | | </if>
|
| | | <if test="createTime != null" >
|
| | | #{createTime,jdbcType=TIMESTAMP},
|
| | | </if>
|
| | | <if test="expireTime != null" >
|
| | | #{expireTime,jdbcType=TIMESTAMP},
|
| | | </if>
|
| | | </trim>
|
| | | </insert>
|
| | | <select id="countByExample" parameterType="com.moral.entity.OperateUserExample" resultType="java.lang.Integer" >
|
| | | select count(*) from operate_user
|
| | | <if test="_parameter != null" >
|
| | | <include refid="Example_Where_Clause" />
|
| | | </if>
|
| | | </select>
|
| | | <update id="updateByExampleSelective" parameterType="map" >
|
| | | update operate_user
|
| | | <set >
|
| | | <if test="record.id != null" >
|
| | | id = #{record.id,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="record.jobNumber != null" >
|
| | | job_number = #{record.jobNumber,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="record.name != null" >
|
| | | name = #{record.name,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="record.password != null" >
|
| | | password = #{record.password,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="record.organizationId != null" >
|
| | | organization_id = #{record.organizationId,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="record.mobile != null" >
|
| | | mobile = #{record.mobile,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="record.email != null" >
|
| | | email = #{record.email,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="record.weixin != null" >
|
| | | weixin = #{record.weixin,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="record.isDelete != null" >
|
| | | is_delete = #{record.isDelete,jdbcType=CHAR},
|
| | | </if>
|
| | | <if test="record.createTime != null" >
|
| | | create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
| | | </if>
|
| | | <if test="record.expireTime != null" >
|
| | | expire_time = #{record.expireTime,jdbcType=TIMESTAMP},
|
| | | </if>
|
| | | </set>
|
| | | <if test="_parameter != null" >
|
| | | <include refid="Update_By_Example_Where_Clause" />
|
| | | </if>
|
| | | </update>
|
| | | <update id="updateByExample" parameterType="map" >
|
| | | update operate_user
|
| | | set id = #{record.id,jdbcType=INTEGER},
|
| | | job_number = #{record.jobNumber,jdbcType=VARCHAR},
|
| | | name = #{record.name,jdbcType=VARCHAR},
|
| | | password = #{record.password,jdbcType=VARCHAR},
|
| | | organization_id = #{record.organizationId,jdbcType=INTEGER},
|
| | | mobile = #{record.mobile,jdbcType=VARCHAR},
|
| | | email = #{record.email,jdbcType=VARCHAR},
|
| | | weixin = #{record.weixin,jdbcType=VARCHAR},
|
| | | is_delete = #{record.isDelete,jdbcType=CHAR},
|
| | | create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
| | | expire_time = #{record.expireTime,jdbcType=TIMESTAMP}
|
| | | <if test="_parameter != null" >
|
| | | <include refid="Update_By_Example_Where_Clause" />
|
| | | </if>
|
| | | </update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.moral.entity.OperateUser" >
|
| | | update operate_user
|
| | | <set >
|
| | | <if test="jobNumber != null" >
|
| | | job_number = #{jobNumber,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="name != null" >
|
| | | name = #{name,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="password != null" >
|
| | | password = #{password,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="organizationId != null" >
|
| | | organization_id = #{organizationId,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="mobile != null" >
|
| | | mobile = #{mobile,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="email != null" >
|
| | | email = #{email,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="weixin != null" >
|
| | | weixin = #{weixin,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="isDelete != null" >
|
| | | is_delete = #{isDelete,jdbcType=CHAR},
|
| | | </if>
|
| | | <if test="createTime != null" >
|
| | | create_time = #{createTime,jdbcType=TIMESTAMP},
|
| | | </if>
|
| | | <if test="expireTime != null" >
|
| | | expire_time = #{expireTime,jdbcType=TIMESTAMP},
|
| | | </if>
|
| | | </set>
|
| | | where id = #{id,jdbcType=INTEGER}
|
| | | </update>
|
| | | <update id="updateByPrimaryKey" parameterType="com.moral.entity.OperateUser" >
|
| | | update operate_user
|
| | | set job_number = #{jobNumber,jdbcType=VARCHAR},
|
| | | name = #{name,jdbcType=VARCHAR},
|
| | | password = #{password,jdbcType=VARCHAR},
|
| | | organization_id = #{organizationId,jdbcType=INTEGER},
|
| | | mobile = #{mobile,jdbcType=VARCHAR},
|
| | | email = #{email,jdbcType=VARCHAR},
|
| | | weixin = #{weixin,jdbcType=VARCHAR},
|
| | | is_delete = #{isDelete,jdbcType=CHAR},
|
| | | create_time = #{createTime,jdbcType=TIMESTAMP},
|
| | | expire_time = #{expireTime,jdbcType=TIMESTAMP}
|
| | | where id = #{id,jdbcType=INTEGER}
|
| | | </update>
|
| | | </mapper> |
| | |
| | | <result column="expire_time" property="expireTime" jdbcType="TIMESTAMP" />
|
| | | <result column="description" property="description" 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, name, rank, province_code, city_code, area_code, address, telephone, email, is_delete, |
| | | create_time, expire_time, description
|
| | | </sql>
|
| | | <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.moral.entity.OrganizationExample" >
|
| | | select
|
| | | <if test="distinct" >
|
| | | distinct
|
| | | </if>
|
| | | <include refid="Base_Column_List" />
|
| | | from organization
|
| | | <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 organization
|
| | | where id = #{id,jdbcType=INTEGER}
|
| | | </select>
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
| | | delete from organization
|
| | | where id = #{id,jdbcType=INTEGER}
|
| | | </delete>
|
| | | <delete id="deleteByExample" parameterType="com.moral.entity.OrganizationExample" >
|
| | | delete from organization
|
| | | <if test="_parameter != null" >
|
| | | <include refid="Example_Where_Clause" />
|
| | | </if>
|
| | | </delete>
|
| | | <insert id="insert" parameterType="com.moral.entity.Organization" >
|
| | | insert into organization (id, name, rank, |
| | | province_code, city_code, area_code, |
| | | address, telephone, email, |
| | | is_delete, create_time, expire_time, |
| | | description)
|
| | | values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{rank,jdbcType=INTEGER}, |
| | | #{provinceCode,jdbcType=INTEGER}, #{cityCode,jdbcType=INTEGER}, #{areaCode,jdbcType=INTEGER}, |
| | | #{address,jdbcType=VARCHAR}, #{telephone,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, |
| | | #{isDelete,jdbcType=CHAR}, #{createTime,jdbcType=TIMESTAMP}, #{expireTime,jdbcType=TIMESTAMP}, |
| | | #{description,jdbcType=VARCHAR})
|
| | | </insert>
|
| | | <insert id="insertSelective" parameterType="com.moral.entity.Organization" >
|
| | | insert into organization
|
| | | <trim prefix="(" suffix=")" suffixOverrides="," >
|
| | | <if test="id != null" >
|
| | | id,
|
| | | </if>
|
| | | <if test="name != null" >
|
| | | name,
|
| | | </if>
|
| | | <if test="rank != null" >
|
| | | rank,
|
| | | </if>
|
| | | <if test="provinceCode != null" >
|
| | | province_code,
|
| | | </if>
|
| | | <if test="cityCode != null" >
|
| | | city_code,
|
| | | </if>
|
| | | <if test="areaCode != null" >
|
| | | area_code,
|
| | | </if>
|
| | | <if test="address != null" >
|
| | | address,
|
| | | </if>
|
| | | <if test="telephone != null" >
|
| | | telephone,
|
| | | </if>
|
| | | <if test="email != null" >
|
| | | email,
|
| | | </if>
|
| | | <if test="isDelete != null" >
|
| | | is_delete,
|
| | | </if>
|
| | | <if test="createTime != null" >
|
| | | create_time,
|
| | | </if>
|
| | | <if test="expireTime != null" >
|
| | | expire_time,
|
| | | </if>
|
| | | <if test="description != null" >
|
| | | description,
|
| | | </if>
|
| | | </trim>
|
| | | <trim prefix="values (" suffix=")" suffixOverrides="," >
|
| | | <if test="id != null" >
|
| | | #{id,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="name != null" >
|
| | | #{name,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="rank != null" >
|
| | | #{rank,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="provinceCode != null" >
|
| | | #{provinceCode,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="cityCode != null" >
|
| | | #{cityCode,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="areaCode != null" >
|
| | | #{areaCode,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="address != null" >
|
| | | #{address,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="telephone != null" >
|
| | | #{telephone,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="email != null" >
|
| | | #{email,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="isDelete != null" >
|
| | | #{isDelete,jdbcType=CHAR},
|
| | | </if>
|
| | | <if test="createTime != null" >
|
| | | #{createTime,jdbcType=TIMESTAMP},
|
| | | </if>
|
| | | <if test="expireTime != null" >
|
| | | #{expireTime,jdbcType=TIMESTAMP},
|
| | | </if>
|
| | | <if test="description != null" >
|
| | | #{description,jdbcType=VARCHAR},
|
| | | </if>
|
| | | </trim>
|
| | | </insert>
|
| | | <select id="countByExample" parameterType="com.moral.entity.OrganizationExample" resultType="java.lang.Integer" >
|
| | | select count(*) from organization
|
| | | <if test="_parameter != null" >
|
| | | <include refid="Example_Where_Clause" />
|
| | | </if>
|
| | | </select>
|
| | | <update id="updateByExampleSelective" parameterType="map" >
|
| | | update organization
|
| | | <set >
|
| | | <if test="record.id != null" >
|
| | | id = #{record.id,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="record.name != null" >
|
| | | name = #{record.name,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="record.rank != null" >
|
| | | rank = #{record.rank,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="record.provinceCode != null" >
|
| | | province_code = #{record.provinceCode,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="record.cityCode != null" >
|
| | | city_code = #{record.cityCode,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="record.areaCode != null" >
|
| | | area_code = #{record.areaCode,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="record.address != null" >
|
| | | address = #{record.address,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="record.telephone != null" >
|
| | | telephone = #{record.telephone,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="record.email != null" >
|
| | | email = #{record.email,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="record.isDelete != null" >
|
| | | is_delete = #{record.isDelete,jdbcType=CHAR},
|
| | | </if>
|
| | | <if test="record.createTime != null" >
|
| | | create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
| | | </if>
|
| | | <if test="record.expireTime != null" >
|
| | | expire_time = #{record.expireTime,jdbcType=TIMESTAMP},
|
| | | </if>
|
| | | <if test="record.description != null" >
|
| | | description = #{record.description,jdbcType=VARCHAR},
|
| | | </if>
|
| | | </set>
|
| | | <if test="_parameter != null" >
|
| | | <include refid="Update_By_Example_Where_Clause" />
|
| | | </if>
|
| | | </update>
|
| | | <update id="updateByExample" parameterType="map" >
|
| | | update organization
|
| | | set id = #{record.id,jdbcType=INTEGER},
|
| | | name = #{record.name,jdbcType=VARCHAR},
|
| | | rank = #{record.rank,jdbcType=INTEGER},
|
| | | province_code = #{record.provinceCode,jdbcType=INTEGER},
|
| | | city_code = #{record.cityCode,jdbcType=INTEGER},
|
| | | area_code = #{record.areaCode,jdbcType=INTEGER},
|
| | | address = #{record.address,jdbcType=VARCHAR},
|
| | | telephone = #{record.telephone,jdbcType=VARCHAR},
|
| | | email = #{record.email,jdbcType=VARCHAR},
|
| | | is_delete = #{record.isDelete,jdbcType=CHAR},
|
| | | create_time = #{record.createTime,jdbcType=TIMESTAMP},
|
| | | expire_time = #{record.expireTime,jdbcType=TIMESTAMP},
|
| | | description = #{record.description,jdbcType=VARCHAR}
|
| | | <if test="_parameter != null" >
|
| | | <include refid="Update_By_Example_Where_Clause" />
|
| | | </if>
|
| | | </update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.moral.entity.Organization" >
|
| | | update organization
|
| | | <set >
|
| | | <if test="name != null" >
|
| | | name = #{name,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="rank != null" >
|
| | | rank = #{rank,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="provinceCode != null" >
|
| | | province_code = #{provinceCode,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="cityCode != null" >
|
| | | city_code = #{cityCode,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="areaCode != null" >
|
| | | area_code = #{areaCode,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="address != null" >
|
| | | address = #{address,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="telephone != null" >
|
| | | telephone = #{telephone,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="email != null" >
|
| | | email = #{email,jdbcType=VARCHAR},
|
| | | </if>
|
| | | <if test="isDelete != null" >
|
| | | is_delete = #{isDelete,jdbcType=CHAR},
|
| | | </if>
|
| | | <if test="createTime != null" >
|
| | | create_time = #{createTime,jdbcType=TIMESTAMP},
|
| | | </if>
|
| | | <if test="expireTime != null" >
|
| | | expire_time = #{expireTime,jdbcType=TIMESTAMP},
|
| | | </if>
|
| | | <if test="description != null" >
|
| | | description = #{description,jdbcType=VARCHAR},
|
| | | </if>
|
| | | </set>
|
| | | where id = #{id,jdbcType=INTEGER}
|
| | | </update>
|
| | | <update id="updateByPrimaryKey" parameterType="com.moral.entity.Organization" >
|
| | | update organization
|
| | | set name = #{name,jdbcType=VARCHAR},
|
| | | rank = #{rank,jdbcType=INTEGER},
|
| | | province_code = #{provinceCode,jdbcType=INTEGER},
|
| | | city_code = #{cityCode,jdbcType=INTEGER},
|
| | | area_code = #{areaCode,jdbcType=INTEGER},
|
| | | address = #{address,jdbcType=VARCHAR},
|
| | | telephone = #{telephone,jdbcType=VARCHAR},
|
| | | email = #{email,jdbcType=VARCHAR},
|
| | | is_delete = #{isDelete,jdbcType=CHAR},
|
| | | create_time = #{createTime,jdbcType=TIMESTAMP},
|
| | | expire_time = #{expireTime,jdbcType=TIMESTAMP},
|
| | | description = #{description,jdbcType=VARCHAR}
|
| | | where id = #{id,jdbcType=INTEGER}
|
| | | </update>
|
| | |
|
| | | </mapper> |
| | |
| | | <result column="parent_id" property="parentId" jdbcType="INTEGER" />
|
| | | <result column="child_id" property="childId" jdbcType="INTEGER" />
|
| | | </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, parent_id, child_id
|
| | | </sql>
|
| | | <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.moral.entity.OrganizationRelationExample" >
|
| | | select
|
| | | <if test="distinct" >
|
| | | distinct
|
| | | </if>
|
| | | <include refid="Base_Column_List" />
|
| | | from organization_relation
|
| | | <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 organization_relation
|
| | | where id = #{id,jdbcType=INTEGER}
|
| | | </select>
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
| | | delete from organization_relation
|
| | | where id = #{id,jdbcType=INTEGER}
|
| | | </delete>
|
| | | <delete id="deleteByExample" parameterType="com.moral.entity.OrganizationRelationExample" >
|
| | | delete from organization_relation
|
| | | <if test="_parameter != null" >
|
| | | <include refid="Example_Where_Clause" />
|
| | | </if>
|
| | | </delete>
|
| | | <insert id="insert" parameterType="com.moral.entity.OrganizationRelation" >
|
| | | insert into organization_relation (id, parent_id, child_id
|
| | | )
|
| | | values (#{id,jdbcType=INTEGER}, #{parentId,jdbcType=INTEGER}, #{childId,jdbcType=INTEGER}
|
| | | )
|
| | | </insert>
|
| | | <insert id="insertSelective" parameterType="com.moral.entity.OrganizationRelation" >
|
| | | insert into organization_relation
|
| | | <trim prefix="(" suffix=")" suffixOverrides="," >
|
| | | <if test="id != null" >
|
| | | id,
|
| | | </if>
|
| | | <if test="parentId != null" >
|
| | | parent_id,
|
| | | </if>
|
| | | <if test="childId != null" >
|
| | | child_id,
|
| | | </if>
|
| | | </trim>
|
| | | <trim prefix="values (" suffix=")" suffixOverrides="," >
|
| | | <if test="id != null" >
|
| | | #{id,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="parentId != null" >
|
| | | #{parentId,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="childId != null" >
|
| | | #{childId,jdbcType=INTEGER},
|
| | | </if>
|
| | | </trim>
|
| | | </insert>
|
| | | <select id="countByExample" parameterType="com.moral.entity.OrganizationRelationExample" resultType="java.lang.Integer" >
|
| | | select count(*) from organization_relation
|
| | | <if test="_parameter != null" >
|
| | | <include refid="Example_Where_Clause" />
|
| | | </if>
|
| | | </select>
|
| | | <update id="updateByExampleSelective" parameterType="map" >
|
| | | update organization_relation
|
| | | <set >
|
| | | <if test="record.id != null" >
|
| | | id = #{record.id,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="record.parentId != null" >
|
| | | parent_id = #{record.parentId,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="record.childId != null" >
|
| | | child_id = #{record.childId,jdbcType=INTEGER},
|
| | | </if>
|
| | | </set>
|
| | | <if test="_parameter != null" >
|
| | | <include refid="Update_By_Example_Where_Clause" />
|
| | | </if>
|
| | | </update>
|
| | | <update id="updateByExample" parameterType="map" >
|
| | | update organization_relation
|
| | | set id = #{record.id,jdbcType=INTEGER},
|
| | | parent_id = #{record.parentId,jdbcType=INTEGER},
|
| | | child_id = #{record.childId,jdbcType=INTEGER}
|
| | | <if test="_parameter != null" >
|
| | | <include refid="Update_By_Example_Where_Clause" />
|
| | | </if>
|
| | | </update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.moral.entity.OrganizationRelation" >
|
| | | update organization_relation
|
| | | <set >
|
| | | <if test="parentId != null" >
|
| | | parent_id = #{parentId,jdbcType=INTEGER},
|
| | | </if>
|
| | | <if test="childId != null" >
|
| | | child_id = #{childId,jdbcType=INTEGER},
|
| | | </if>
|
| | | </set>
|
| | | where id = #{id,jdbcType=INTEGER}
|
| | | </update>
|
| | | <update id="updateByPrimaryKey" parameterType="com.moral.entity.OrganizationRelation" >
|
| | | update organization_relation
|
| | | set parent_id = #{parentId,jdbcType=INTEGER},
|
| | | child_id = #{childId,jdbcType=INTEGER}
|
| | | where id = #{id,jdbcType=INTEGER}
|
| | | </update>
|
| | | </mapper> |
New file |
| | |
| | | package com.moral;
|
| | |
|
| | | import java.util.Properties;
|
| | |
|
| | | import org.springframework.context.annotation.Bean;
|
| | | import org.springframework.context.annotation.Configuration;
|
| | |
|
| | | import com.github.pagehelper.PageHelper;
|
| | |
|
| | | @Configuration
|
| | | public class MybatisConfig {
|
| | | @Bean
|
| | | public PageHelper pageHelper(){
|
| | | PageHelper pageHelper = new PageHelper(); |
| | | Properties properties = new Properties();
|
| | | properties.setProperty("offsetAsPageNum","true");
|
| | | properties.setProperty("rowBoundsWithCount","true");
|
| | | properties.setProperty("reasonable","true");
|
| | | properties.setProperty("dialect","mysql"); //配置mysql数据库的方言
|
| | | pageHelper.setProperties(properties);
|
| | | return pageHelper;
|
| | | }
|
| | | } |