Просмотр исходного кода

新增功能的增加和修改

chenweida 8 лет назад
Родитель
Сommit
3a7353f93c
23 измененных файлов с 1047 добавлено и 86 удалено
  1. 7 0
      common-lib-parent-pom/pom.xml
  2. 18 1
      common/common-rest-model/pom.xml
  3. 22 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/BaseContants.java
  4. 12 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/common/CommonContants.java
  5. 23 4
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/Envelop.java
  6. 18 2
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/EnvelopRestController.java
  7. 58 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/exception/ApiException.java
  8. 23 0
      common/common-util/pom.xml
  9. 8 0
      common/common-util/src/main/java/com/yihu/jw/util/date/DateUtil.java
  10. 110 0
      common/common-util/src/main/java/com/yihu/jw/util/spring/SpringContext.java
  11. 11 0
      svr-lib-parent-pom/pom.xml
  12. 17 0
      svr/svr-base/pom.xml
  13. 52 0
      svr/svr-base/src/main/java/com/yihu/jw/base/controller/FunctionController.java
  14. 16 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/FunctionDao.java
  15. 177 0
      svr/svr-base/src/main/java/com/yihu/jw/base/model/Function.java
  16. 170 0
      svr/svr-base/src/main/java/com/yihu/jw/base/model/Module.java
  17. 43 0
      svr/svr-base/src/main/java/com/yihu/jw/base/model/ModuleFunction.java
  18. 126 0
      svr/svr-base/src/main/java/com/yihu/jw/base/model/Saas.java
  19. 39 0
      svr/svr-base/src/main/java/com/yihu/jw/base/model/SaasModule.java
  20. 2 34
      svr/svr-base/src/main/java/com/yihu/jw/base/model/SystemDict.java
  21. 3 45
      svr/svr-base/src/main/java/com/yihu/jw/base/model/SystemDictList.java
  22. 38 0
      svr/svr-base/src/main/java/com/yihu/jw/base/model/base/IdEntity.java
  23. 54 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/FunctionService.java

+ 7 - 0
common-lib-parent-pom/pom.xml

@ -3,6 +3,12 @@
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.yihu.jw</groupId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <relativePath>../svr-lib-parent-pom/pom.xml</relativePath>
    </parent>
    <groupId>com.yihu.jw</groupId>
    <artifactId>common-lib-parent-pom</artifactId>
@ -13,6 +19,7 @@
        <module>../common/common-quartz</module>
        <module>../common/common-log</module>
        <module>../common/common-rest-model</module>
        <module>../common/common-util</module>
    </modules>
    <properties>

+ 18 - 1
common/common-rest-model/pom.xml

@ -14,5 +14,22 @@
    <artifactId>common-rest-model</artifactId>
    <version>1.0.0</version>
    <dependencies>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
    </dependencies>
</project>

+ 22 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/BaseContants.java

@ -0,0 +1,22 @@
package com.yihu.jw.restmodel.base;
/**
 * Created by chenweida on 2017/5/19.
 * 基础模块的静态变量
 */
public class BaseContants {
    //功能模块常量
    public static class Function{
        public static final String message_success_create="function create success";
        public static final String message_fail_name_exist="function name exist";
        public static final String message_fail_code_is_null="code is null";
        public static final String message_fail_name_is_null="function is null";
        public static final String message_fail_id_is_null="id is null";
        public static final String common="function";
        public static final String create="create";
        public static final String update="update";
    }
}

+ 12 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/common/CommonContants.java

@ -0,0 +1,12 @@
package com.yihu.jw.restmodel.common;
/**
 * Created by chenweida on 2017/5/19.
 * 公共的常量类
 */
public class CommonContants {
    public static final Integer common_error_code= -10000; //系统异常
    public static final Integer common_error_params_code= -10100; //接口入参异常
}

+ 23 - 4
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/Envelop.java

@ -1,4 +1,4 @@
package com.yihu.jw.restmodel.base;
package com.yihu.jw.restmodel.common;
import java.io.Serializable;
import java.util.List;
@ -10,18 +10,18 @@ import java.util.List;
 * - 错误消息
 * - 错误代码
 * - 对象模型
 *
 * <p>
 * 信封对象的返回场景:
 * - API使用者确实无法访问返回头,即一些语言库无法处理HTTP的响应消息,这时候需要以这种形式提供返回值。
 * - API需要支持交叉域请求(通过JSONP)。
 *
 * @author llh
 */
public class Envelop implements Serializable{
public class Envelop implements Serializable {
    private static final long serialVersionUID = 2076324875575488461L;
    private boolean successFlg;
    private boolean successFlg=true;
    private int pageSize = 10;
@ -125,4 +125,23 @@ public class Envelop implements Serializable{
    public void setSuccessMsg(String successMsg) {
        this.successMsg = successMsg;
    }
    public static Envelop getSuccess(String message) {
        Envelop envelop = new Envelop();
        envelop.setSuccessMsg(message);
        return envelop;
    }
    public static Envelop getSuccess(String message,Object obj) {
        Envelop envelop = new Envelop();
        envelop.setSuccessMsg(message);
        envelop.setObj(obj);
        return envelop;
    }
    public static Envelop getError(String message,int errorCode) {
        Envelop envelop = new Envelop();
        envelop.setSuccessFlg(false);
        envelop.setErrorMsg(message);
        envelop.setErrorCode(errorCode);
        return envelop;
    }
}

+ 18 - 2
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/EnvelopRestController.java

@ -1,6 +1,12 @@
package com.yihu.jw.restmodel.base;
package com.yihu.jw.restmodel.common;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.util.date.DateUtil;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.List;
/**
@ -31,5 +37,15 @@ public class EnvelopRestController {
        return envelop;
    }
    //Json转实体类
    public <T> T toEntity(String json, Class<T> entityCls) {
        try {
            ObjectMapper objectMapper=new ObjectMapper();
            objectMapper.setDateFormat(new SimpleDateFormat(DateUtil.yyyy_MM_dd_HH_mm_ss));
            T entity = objectMapper.readValue(json, entityCls);
            return entity;
        } catch (IOException ex) {
            throw new ApiException( "Unable to parse json, " + ex.getMessage(),CommonContants.common_error_params_code);
        }
    }
}

+ 58 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/exception/ApiException.java

@ -0,0 +1,58 @@
package com.yihu.jw.restmodel.exception;
/**
 * API 异常。使用错误代码初始化,并可接收用于补充错误消息的参数。
 * 用于描述错误代码的信息配置在各服务配置文件中,并由服务配置中心统一管理。
 * <p>
 * 错误描述结构,结构(字段errors对资源而言,REST规范错误不包含此结构):
 * {
 * "message": "Validation Failed",
 * "document_url": "https://ehr.yihu.com/docs/api/somewhere"
 * "errors": [
 * {
 * "resource": "User",
 * "field": "title",
 * "code": "missing_field"
 * }
 * ]
 * }
 *
 * @author Sand
 * @version 1.0
 * @created 2015.12.20 16:05
 */
public class ApiException extends RuntimeException {
    private Integer errorCode = -10000;
    public Integer getErrorCode() {
        return errorCode;
    }
    public void setErrorCode(Integer errorCode) {
        this.errorCode = errorCode;
    }
    public ApiException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }
    public ApiException() {
    }
    public ApiException(String message) {
        super(message);
    }
    public ApiException(String message, Integer errorCode) {
        super(message);
        this.errorCode = errorCode;
    }
    public ApiException(String message, Throwable cause) {
        super(message, cause);
    }
    public ApiException(Throwable cause) {
        super(cause);
    }
}

+ 23 - 0
common/common-util/pom.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.yihu.jw</groupId>
        <artifactId>common-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <relativePath>../../common-lib-parent-pom/pom.xml</relativePath>
    </parent>
    <groupId>com.yihu.jw</groupId>
    <artifactId>common-util</artifactId>
    <version>1.0.0</version>
    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </dependency>
    </dependencies>
</project>

+ 8 - 0
common/common-util/src/main/java/com/yihu/jw/util/date/DateUtil.java

@ -0,0 +1,8 @@
package com.yihu.jw.util.date;
/**
 * Created by chenweida on 2017/5/19.
 */
public class DateUtil {
    public static final String yyyy_MM_dd_HH_mm_ss="yyyy-MM-dd HH:mm:ss";
}

+ 110 - 0
common/common-util/src/main/java/com/yihu/jw/util/spring/SpringContext.java

@ -0,0 +1,110 @@
package com.yihu.jw.util.spring;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
/**
 * Spring上下文管理器。
 *
 * @author Sand
 * @version 1.0
 * @created 12-05-2015 17:47:55
 */
@Component
public class SpringContext implements ApplicationContextAware {
    private static ApplicationContext springContext = null;
    /**
     * 获取Spring应用上下文环境。
     *
     * @return
     */
    public static ApplicationContext getApplicationContext() {
        return springContext;
    }
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        springContext = applicationContext;
    }
    /**
     * 获取服务。
     *
     * @param serviceName
     * @param <T>
     * @return
     */
    public static <T> T getService(String serviceName) {
        return (T) springContext.getBean(serviceName);
    }
    public static <T> T getService(Class<T> beanCls) {
        return (T) springContext.getBean(beanCls);
    }
    /**
     * 获取服务,并用参数初始化对象。
     *
     * @param serviceName
     * @param args
     * @param <T>
     * @return
     */
    public static <T> T getService(String serviceName, Object... args) {
        T ref = (T)springContext.getBean(serviceName, args);
        if (ref == null) return null;
        return ref;
    }
    public static <T> T getService(Class<T> beanCls, Object... args){
        T ref = (T)springContext.getBean(beanCls, args);
        if (ref == null) return null;
        return ref;
    }
    /**
     * 获取平台支持的所有服务名称。
     *
     * @return
     */
    public static String[] getAvailableServiceNames() {
        String[] serviceNames = springContext.getBeanDefinitionNames();
        return serviceNames;
    }
    /**
     * 判断是否支持特定服务。
     *
     * @param serviceName
     * @return
     */
    public static boolean isServiceSupported(String serviceName) {
        return springContext.containsBeanDefinition(serviceName);
    }
    /**
     * 获取服务的实现类。
     *
     * @param serviceName
     * @return
     */
    public static Class getServiceType(String serviceName) {
        return springContext.getType(serviceName);
    }
    /**
     * 判断服务是否为单例模式。
     *
     * @param serviceName
     * @return
     */
    public static boolean isSingleton(String serviceName) {
        return springContext.isSingleton(serviceName);
    }
}

+ 11 - 0
svr-lib-parent-pom/pom.xml

@ -62,6 +62,11 @@
                <artifactId>common-rest-model</artifactId>
                <version>${version.myCommon}</version>
            </dependency>
            <dependency>
                <groupId>com.yihu.jw</groupId>
                <artifactId>common-util</artifactId>
                <version>${version.myCommon}</version>
            </dependency>
            <dependency>
                <groupId>com.yihu.jw</groupId>
                <artifactId>common-log</artifactId>
@ -244,6 +249,12 @@
                <artifactId>spring-webmvc</artifactId>
                <version>${version.spring}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>${version.spring}</version>
            </dependency>
            <!--spring end-->
            <!--数据库驱动 start-->

+ 17 - 0
svr/svr-base/pom.xml

@ -22,6 +22,10 @@
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-log</artifactId>
@ -75,5 +79,18 @@
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
    </dependencies>
</project>

+ 52 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/controller/FunctionController.java

@ -0,0 +1,52 @@
package com.yihu.jw.base.controller;
import com.yihu.jw.base.model.Function;
import com.yihu.jw.base.service.FunctionService;
import com.yihu.jw.restmodel.base.BaseContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.exception.ApiException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
/**
 * Created by chenweida on 2017/5/19.
 */
@RestController
@RequestMapping(BaseContants.Function.common)
@Api(value = "功能模块", description = "功能模块接口管理")
public class FunctionController extends EnvelopRestController {
    @Autowired
    private FunctionService functionService;
    @PostMapping(value = BaseContants.Function.create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建功能", notes = "创建单个功能")
    public Envelop createFunction(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        try {
            Function function = toEntity(jsonData, Function.class);
            return Envelop.getSuccess(BaseContants.Function.message_success_create, functionService.createFunction(function));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @PutMapping(value = BaseContants.Function.update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "修改功能", notes = "修改功能")
    public Envelop updateFunction(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        try {
            Function function = toEntity(jsonData, Function.class);
            return Envelop.getSuccess(BaseContants.Function.message_success_create, functionService.updateFunction(function));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
}

+ 16 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/FunctionDao.java

@ -0,0 +1,16 @@
package com.yihu.jw.base.dao;
import com.yihu.jw.base.model.Function;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by chenweida on 2017/5/19.
 */
public interface FunctionDao  extends PagingAndSortingRepository<Function, Long>, JpaSpecificationExecutor<Function> {
    @Query("from Function f where f.name=?1 and f.status=0")
    public Function findByName(String name);
    @Query("from Function f where f.name=?1 and f.status=0 and f.code != ?2")
    public Function findByNameExcludeCode(String name,String code);
}

+ 177 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/model/Function.java

@ -0,0 +1,177 @@
package com.yihu.jw.base.model;// default package
import com.yihu.jw.base.model.base.IdEntity;
import java.sql.Timestamp;
import java.util.Date;
import javax.persistence.*;
/**
 * WlyyFunction entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "base_function")
public class Function extends IdEntity implements java.io.Serializable {
	// Fields
	private String code;//业务code
	private String name; //功能名称
	private String saasId; // saasid
	private String parentCode; //父功能code
	private Integer status; //状态 -1 已删除 0可用
	private String createUser;
	private String createUserName;
	private Date createTime;
	private String modifyUser;
	private String modifyUserName;
	private Date modifyTime;
	private String remark; //备注
	// Constructors
	/** default constructor */
	public Function() {
	}
	/** minimal constructor */
	public Function(Long id, Timestamp createTime, Timestamp modifyTime) {
		this.id = id;
		this.createTime = createTime;
		this.modifyTime = modifyTime;
	}
	/** full constructor */
	public Function(Long id, String code, String name, String saasId,
			String parentCode, Integer status, String createUser,
			String createUserName, Timestamp createTime, String modifyUser,
			String modifyUserName, Timestamp modifyTime, String remark) {
		this.id = id;
		this.code = code;
		this.name = name;
		this.saasId = saasId;
		this.parentCode = parentCode;
		this.status = status;
		this.createUser = createUser;
		this.createUserName = createUserName;
		this.createTime = createTime;
		this.modifyUser = modifyUser;
		this.modifyUserName = modifyUserName;
		this.modifyTime = modifyTime;
		this.remark = remark;
	}
	public void setId(Long id) {
		this.id = id;
	}
	@Column(name = "code", length = 100)
	public String getCode() {
		return this.code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	@Column(name = "name", length = 200)
	public String getName() {
		return this.name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Column(name = "saas_id", length = 100)
	public String getSaasId() {
		return this.saasId;
	}
	public void setSaasId(String saasId) {
		this.saasId = saasId;
	}
	@Column(name = "parent_code", length = 100)
	public String getParentCode() {
		return this.parentCode;
	}
	public void setParentCode(String parentCode) {
		this.parentCode = parentCode;
	}
	@Column(name = "status", precision = 2, scale = 0)
	public Integer getStatus() {
		return this.status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	@Column(name = "create_user", length = 200)
	public String getCreateUser() {
		return this.createUser;
	}
	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}
	@Column(name = "create_user_name", length = 200)
	public String getCreateUserName() {
		return this.createUserName;
	}
	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}
	@Column(name = "create_time", nullable = false, length = 0)
	public Date getCreateTime() {
		return this.createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	@Column(name = "modify_user", length = 200)
	public String getModifyUser() {
		return this.modifyUser;
	}
	public void setModifyUser(String modifyUser) {
		this.modifyUser = modifyUser;
	}
	@Column(name = "modify_user_name", length = 200)
	public String getModifyUserName() {
		return this.modifyUserName;
	}
	public void setModifyUserName(String modifyUserName) {
		this.modifyUserName = modifyUserName;
	}
	@Column(name = "modify_time", nullable = false, length = 0)
	public Date getModifyTime() {
		return this.modifyTime;
	}
	public void setModifyTime(Date modifyTime) {
		this.modifyTime = modifyTime;
	}
	@Column(name = "remark", length = 1000)
	public String getRemark() {
		return this.remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
}

+ 170 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/model/Module.java

@ -0,0 +1,170 @@
package com.yihu.jw.base.model;// default package
import com.yihu.jw.base.model.base.IdEntity;
import java.sql.Timestamp;
import javax.persistence.*;
/**
 * WlyyModule entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "base_module")
public class Module extends IdEntity implements java.io.Serializable {
	// Fields
	private String code;
	private String name;
	private String saasId;
	private String parentCode;
	private Byte status;
	private String createUser;
	private String createUserName;
	private Timestamp createTime;
	private String modifyUser;
	private String modifyUserName;
	private Timestamp modifyTime;
	private String remark;
	// Constructors
	/** default constructor */
	public Module() {
	}
	/** minimal constructor */
	public Module(Long id, Timestamp createTime, Timestamp modifyTime) {
		this.id = id;
		this.createTime = createTime;
		this.modifyTime = modifyTime;
	}
	/** full constructor */
	public Module(Long id, String code, String name, String saasId,
			String parentCode, Byte status, String createUser,
			String createUserName, Timestamp createTime, String modifyUser,
			String modifyUserName, Timestamp modifyTime, String remark) {
		this.id = id;
		this.code = code;
		this.name = name;
		this.saasId = saasId;
		this.parentCode = parentCode;
		this.status = status;
		this.createUser = createUser;
		this.createUserName = createUserName;
		this.createTime = createTime;
		this.modifyUser = modifyUser;
		this.modifyUserName = modifyUserName;
		this.modifyTime = modifyTime;
		this.remark = remark;
	}
	@Column(name = "code", length = 100)
	public String getCode() {
		return this.code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	@Column(name = "name", length = 200)
	public String getName() {
		return this.name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Column(name = "saas_id", length = 100)
	public String getSaasId() {
		return this.saasId;
	}
	public void setSaasId(String saasId) {
		this.saasId = saasId;
	}
	@Column(name = "parent_code", length = 100)
	public String getParentCode() {
		return this.parentCode;
	}
	public void setParentCode(String parentCode) {
		this.parentCode = parentCode;
	}
	@Column(name = "status", precision = 2, scale = 0)
	public Byte getStatus() {
		return this.status;
	}
	public void setStatus(Byte status) {
		this.status = status;
	}
	@Column(name = "create_user", length = 200)
	public String getCreateUser() {
		return this.createUser;
	}
	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}
	@Column(name = "create_user_name", length = 200)
	public String getCreateUserName() {
		return this.createUserName;
	}
	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time", nullable = false, length = 0)
	public Timestamp getCreateTime() {
		return this.createTime;
	}
	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}
	@Column(name = "modify_user", length = 200)
	public String getModifyUser() {
		return this.modifyUser;
	}
	public void setModifyUser(String modifyUser) {
		this.modifyUser = modifyUser;
	}
	@Column(name = "modify_user_name", length = 200)
	public String getModifyUserName() {
		return this.modifyUserName;
	}
	public void setModifyUserName(String modifyUserName) {
		this.modifyUserName = modifyUserName;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "modify_time", nullable = false, length = 0)
	public Timestamp getModifyTime() {
		return this.modifyTime;
	}
	public void setModifyTime(Timestamp modifyTime) {
		this.modifyTime = modifyTime;
	}
	@Column(name = "remark", length = 1000)
	public String getRemark() {
		return this.remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
}

+ 43 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/model/ModuleFunction.java

@ -0,0 +1,43 @@
package com.yihu.jw.base.model;// default package
import com.yihu.jw.base.model.base.IdEntity;
import javax.persistence.*;
/**
 * WlyyModuleFunction entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "base_module_function")
public class ModuleFunction extends IdEntity implements java.io.Serializable {
	// Fields
	private String functionId;//关联 WlyyFunction    code
	private String moduleId;//关联 WlyyModule code
	// Constructors
	/** default constructor */
	public ModuleFunction() {
	}
	@Column(name = "function_id", length = 100)
	public String getFunctionId() {
		return this.functionId;
	}
	public void setFunctionId(String functionId) {
		this.functionId = functionId;
	}
	@Column(name = "module_id", length = 100)
	public String getModuleId() {
		return this.moduleId;
	}
	public void setModuleId(String moduleId) {
		this.moduleId = moduleId;
	}
}

+ 126 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/model/Saas.java

@ -0,0 +1,126 @@
package com.yihu.jw.base.model;// default package
import com.yihu.jw.base.model.base.IdEntity;
import java.sql.Timestamp;
import java.util.Date;
import javax.persistence.*;
/**
 * WlyySaas entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "base_saas")
public class Saas extends IdEntity implements java.io.Serializable {
	// Fields
	private String code;//业务code、
	private String name;//名称
	private Integer status;//状态 -1 已删除 0待审核 1审核通过 2 审核不通过
	private String createUser; //创建人code
	private String createUserName;//创建人名称
	private Date createTime;//创建时间
	private String modifyUser;//修改人
	private String modifyUserName;//修改人名称
	private Date modifyTime;//修改时间
	private String remark;//备注
	// Constructors
	/** default constructor */
	public Saas() {
	}
	@Column(name = "name", length = 200)
	public String getName() {
		return this.name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Column(name = "status", precision = 2, scale = 0)
	public Integer getStatus() {
		return this.status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	@Column(name = "create_user", length = 200)
	public String getCreateUser() {
		return this.createUser;
	}
	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}
	@Column(name = "create_user_name", length = 200)
	public String getCreateUserName() {
		return this.createUserName;
	}
	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time", nullable = false, length = 0)
	public Date getCreateTime() {
		return this.createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	@Column(name = "modify_user", length = 200)
	public String getModifyUser() {
		return this.modifyUser;
	}
	public void setModifyUser(String modifyUser) {
		this.modifyUser = modifyUser;
	}
	@Column(name = "modify_user_name", length = 200)
	public String getModifyUserName() {
		return this.modifyUserName;
	}
	public void setModifyUserName(String modifyUserName) {
		this.modifyUserName = modifyUserName;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "modify_time", nullable = false, length = 0)
	public Date getModifyTime() {
		return this.modifyTime;
	}
	public void setModifyTime(Date modifyTime) {
		this.modifyTime = modifyTime;
	}
	@Column(name = "remark", length = 1000)
	public String getRemark() {
		return this.remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	@Column(name = "code", length = 100)
	public String getCode() {
		return this.code;
	}
	public void setCode(String code) {
		this.code = code;
	}
}

+ 39 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/model/SaasModule.java

@ -0,0 +1,39 @@
package com.yihu.jw.base.model;// default package
import com.yihu.jw.base.model.base.IdEntity;
import javax.persistence.*;
/**
 * WlyySaasModule entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "base_saas_module")
public class SaasModule extends IdEntity implements java.io.Serializable {
	// Fields
	private String saasId; //关联WlyySaas code
	private String moduleId; //关联 WlyyModule code
	// Constructors
	@Column(name = "saas_id", length = 100)
	public String getSaasId() {
		return this.saasId;
	}
	public void setSaasId(String saasId) {
		this.saasId = saasId;
	}
	@Column(name = "module_id", length = 100)
	public String getModuleId() {
		return this.moduleId;
	}
	public void setModuleId(String moduleId) {
		this.moduleId = moduleId;
	}
}

+ 2 - 34
svr/svr-base/src/main/java/com/yihu/jw/base/model/SystemDict.java

@ -1,5 +1,6 @@
package com.yihu.jw.base.model;// default package
import com.yihu.jw.base.model.base.IdEntity;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
@ -9,11 +10,10 @@ import javax.persistence.*;
 */
@Entity
@Table(name = "system_dict")
public class SystemDict implements java.io.Serializable {
public class SystemDict extends IdEntity implements java.io.Serializable {
	// Fields
	private Integer id;
	private String saasId;
	private String dictName;
	private String code;
@ -27,38 +27,6 @@ public class SystemDict implements java.io.Serializable {
	public SystemDict() {
	}
	/** minimal constructor */
	public SystemDict(Integer id, String dictName, String code, String value) {
		this.id = id;
		this.dictName = dictName;
		this.code = code;
		this.value = value;
	}
	/** full constructor */
	public SystemDict(Integer id, String saasId, String dictName, String code,
			String value, String pyCode, Integer sort) {
		this.id = id;
		this.saasId = saasId;
		this.dictName = dictName;
		this.code = code;
		this.value = value;
		this.pyCode = pyCode;
		this.sort = sort;
	}
	// Property accessors
	@Id
	@Column(name = "id", unique = true, nullable = false)
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Integer getId() {
		return this.id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	@Column(name = "saas_id", length = 100)
	public String getSaasId() {
		return this.saasId;

+ 3 - 45
svr/svr-base/src/main/java/com/yihu/jw/base/model/SystemDictList.java

@ -1,5 +1,7 @@
package com.yihu.jw.base.model;// default package
import com.yihu.jw.base.model.base.IdEntity;
import javax.persistence.*;
/**
@ -7,11 +9,10 @@ import javax.persistence.*;
 */
@Entity
@Table(name = "system_dict_list")
public class SystemDictList implements java.io.Serializable {
public class SystemDictList extends IdEntity implements java.io.Serializable {
	// Fields
	private Integer id;
	private String dictName;
	private String chineseName;
	private String pyCode;
@ -22,49 +23,6 @@ public class SystemDictList implements java.io.Serializable {
	private String relationColValue;
	private String relationColExtend;
	// Constructors
	/** default constructor */
	public SystemDictList() {
	}
	/** minimal constructor */
	public SystemDictList(Integer id, String dictName, String chineseName,
			String pid) {
		this.id = id;
		this.dictName = dictName;
		this.chineseName = chineseName;
		this.pid = pid;
	}
	/** full constructor */
	public SystemDictList(Integer id, String dictName, String chineseName,
			String pyCode, String pid, String remark, String relationTable,
			String relationColCode, String relationColValue,
			String relationColExtend) {
		this.id = id;
		this.dictName = dictName;
		this.chineseName = chineseName;
		this.pyCode = pyCode;
		this.pid = pid;
		this.remark = remark;
		this.relationTable = relationTable;
		this.relationColCode = relationColCode;
		this.relationColValue = relationColValue;
		this.relationColExtend = relationColExtend;
	}
	// Property accessors
	@Id
	@Column(name = "id", unique = true, nullable = false)
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Integer getId() {
		return this.id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	@Column(name = "dict_name", nullable = false, length = 50)
	public String getDictName() {

+ 38 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/model/base/IdEntity.java

@ -0,0 +1,38 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.jw.base.model.base;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
/**
 * 统一定义id的entity基类.
 * 
 * 基类统一定义id的属性名称、数据类型、列名映射及生成策略.
 * Oracle需要每个Entity独立定义id的SEQUCENCE时,不继承于本类而改为实现一个Idable的接口。
 * 
 * @author calvin
 */
// JPA 基类的标识
@MappedSuperclass
public abstract class IdEntity implements Serializable {
	private static final long serialVersionUID = 3673803562328635206L;
	protected Long id;  // 非业务主键
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
}

+ 54 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/FunctionService.java

@ -0,0 +1,54 @@
package com.yihu.jw.base.service;
import com.yihu.jw.base.dao.FunctionDao;
import com.yihu.jw.base.model.Function;
import com.yihu.jw.restmodel.base.BaseContants;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
/**
 * Created by chenweida on 2017/5/19.
 */
@Service
public class FunctionService {
    @Autowired
    private FunctionDao functionDao;
    @Transactional
    public Function createFunction(Function function) throws ApiException {
        if (StringUtils.isEmpty(function.getCode())) {
            throw new ApiException(BaseContants.Function.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(function.getName())) {
            throw new ApiException(BaseContants.Function.message_fail_name_is_null, CommonContants.common_error_params_code);
        }
        Function functionTmp = functionDao.findByName(function.getName());
        if (functionTmp != null) {
            throw new ApiException(BaseContants.Function.message_fail_name_exist, CommonContants.common_error_params_code);
        }
        return functionDao.save(function);
    }
    @Transactional
    public Function updateFunction(Function function) {
        if (StringUtils.isEmpty(function.getCode())) {
            throw new ApiException(BaseContants.Function.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(function.getName())) {
            throw new ApiException(BaseContants.Function.message_fail_name_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(function.getId())) {
            throw new ApiException(BaseContants.Function.message_fail_id_is_null, CommonContants.common_error_params_code);
        }
        Function functionTmp = functionDao.findByNameExcludeCode(function.getName(), function.getCode());
        if (functionTmp != null) {
            throw new ApiException(BaseContants.Function.message_fail_name_exist, CommonContants.common_error_params_code);
        }
        return functionDao.save(function);
    }
}