初始化操作

parents
/target/
!.mvn/wrapper/maven-wrapper.jar
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/build/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
\ No newline at end of file
<?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>
<groupId>com.cc</groupId>
<artifactId>xzxt-control</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>xzxt-control</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.15.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<httpclient.version>4.3.5</httpclient.version>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!-- 引入web模块 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<!--引入druid-->
<!-- https://mvnrepository.com/artifact/com.alibaba/druid -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.8</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
</dependency>
<!--导入配置文件处理器,配置文件进行绑定就会有提示-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!--lombok包-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.10</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
package com.cc;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(XzxtControlApplication.class);
}
}
package com.cc;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@MapperScan(value = "com.cc.mapper")
@SpringBootApplication
@EnableScheduling
public class XzxtControlApplication {
public static void main(String[] args) {
SpringApplication.run(XzxtControlApplication.class, args);
}
}
package com.cc.bean;
public class Department {
private Integer id;
private String departmentName;
public void setId(Integer id) {
this.id = id;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
public Integer getId() {
return id;
}
public String getDepartmentName() {
return departmentName;
}
}
package com.cc.bean;
public class Employee {
private Integer id;
private String lastName;
private Integer gender;
private String email;
private Integer dId;
public void setId(Integer id) {
this.id = id;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public void setGender(Integer gender) {
this.gender = gender;
}
public void setEmail(String email) {
this.email = email;
}
public void setdId(Integer dId) {
this.dId = dId;
}
public Integer getId() {
return id;
}
public String getLastName() {
return lastName;
}
public Integer getGender() {
return gender;
}
public String getEmail() {
return email;
}
public Integer getdId() {
return dId;
}
}
package com.cc.bean;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.log4j.Log4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* layui数据表格返回数据处理类
* Created by yutons on 2017/9/1
*/
@Data
@Log4j
@NoArgsConstructor
@AllArgsConstructor
public class PageBean {
//当前页
private Integer page;
//页大小
private Integer limit;
}
package com.cc.bean;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.log4j.Log4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.io.Serializable;
@Data
@Log4j
@NoArgsConstructor
@AllArgsConstructor
public class Services extends PageBean implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
private String serviceName;
private String serviceIp;
private Integer sqlType;
private String applyName;
private Integer status;
private String servletPath;
private String port;
private String ipUsername;
private String ipPassword;
}
\ No newline at end of file
package com.cc.bean;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.log4j.Log4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* 监控服务参数
* Created by changchao on 2018/9/9
*/
@Data
@Log4j
@NoArgsConstructor
@AllArgsConstructor
@Component
@ConfigurationProperties(prefix = "service-rest")
public class ServicesRest {
// 监控服务启动
private String startRest;
//监控服务停止
private String stopRest;
//监控服务心跳
private String reportRest;
//调用运行监控微服务shell脚本位置(注意:不建议修改)
private String shellPaht;
// 启动tomcat
private String startTomcatName;
// 停止tomcat
private String stopTomcatName;
// 监控tomcat
private String reportTomcatName;
}
package com.cc.bean;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.extern.log4j.Log4j;
import lombok.extern.slf4j.Slf4j;
import java.io.Serializable;
/**
* @author yutons
* @desc shiro权限控制之用户实体类
* @date 2017/10/25 15:56
*/
@Data
@Log4j
@NoArgsConstructor
@AllArgsConstructor
public class User extends PageBean implements Serializable{
private static final long serialVersionUID = 1L;
/**
* ID
*/
private Integer id;
/**
* 邮箱
*/
private Integer email;
/**
* 性别
*/
private String sex;
/**
* 员工姓名
*/
private String staffname;
/**
* 员工工号
*/
private String username;
/**
* 密码
*/
private String password;
/**
* 状态:1 启用,2 禁用
*/
private Integer status;
}
\ No newline at end of file
package com.cc.common;
/**
* Created by changc on 2018/9/6.
*/
public class ResultMap {
private String msg;
private int code;
private Object data;
private int count;
public ResultMap() {
super();
}
public ResultMap(int code,String message) {
super();
this.code=code;
this.msg=message;
}
public ResultMap(int code,String message,Object data,int count) {
super();
this.code=code;
this.msg=message;
this.data=data;
this.count=count;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}
package com.cc.common;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/**
* Created by changc on 2018/9/11.
*/
@Component
public class ServiceReport {
@Scheduled(cron = "0/2 * * * * *")
public void work() {
//获取当前时间
LocalDateTime localDateTime = LocalDateTime.now();
System.out.println("当前时间为:" + localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
}
}
package com.cc.common;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.List;
/**
* Xzxt-Rest自定义响应结构
*/
public class XzxtRestResult {
// 定义jackson对象
private static final ObjectMapper MAPPER = new ObjectMapper();
// 响应业务状态
private Integer status;
// 响应消息
private String msg;
// 响应中的数据
private Object data;
public static XzxtRestResult build(Integer status, String msg, Object data) {
return new XzxtRestResult(status, msg, data);
}
public static XzxtRestResult ok(Object data) {
return new XzxtRestResult(data);
}
public static XzxtRestResult ok(int i, String count, List<Object> list) {
return new XzxtRestResult(null);
}
public XzxtRestResult() {
}
public static XzxtRestResult build(Integer status, String msg) {
return new XzxtRestResult(status, msg, null);
}
public XzxtRestResult(Integer status, String msg, Object data) {
this.status = status;
this.msg = msg;
this.data = data;
}
public XzxtRestResult(Object data) {
this.status = 200;
this.msg = "OK";
this.data = data;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
/**
* 将json结果集转化为Xzxt-Rest对象
*
* @param jsonData json数据
* @param clazz Xzxt-Rest中的object类型
* @return
*/
public static XzxtRestResult formatToPojo(String jsonData, Class<?> clazz) {
try {
if (clazz == null) {
return MAPPER.readValue(jsonData, XzxtRestResult.class);
}
JsonNode jsonNode = MAPPER.readTree(jsonData);
JsonNode data = jsonNode.get("data");
Object obj = null;
if (clazz != null) {
if (data.isObject()) {
obj = MAPPER.readValue(data.traverse(), clazz);
} else if (data.isTextual()) {
obj = MAPPER.readValue(data.asText(), clazz);
}
}
return build(jsonNode.get("status").intValue(), jsonNode.get("msg").asText(), obj);
} catch (Exception e) {
return null;
}
}
/**
* object对象的转化
*
* @param json
* @return
*/
public static XzxtRestResult format(String json) {
try {
return MAPPER.readValue(json, XzxtRestResult.class);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* Object是集合转化
*
* @param jsonData json数据
* @param clazz 集合中的类型
* @return
*/
public static XzxtRestResult formatToList(String jsonData, Class<?> clazz) {
try {
JsonNode jsonNode = MAPPER.readTree(jsonData);
JsonNode data = jsonNode.get("data");
Object obj = null;
if (data.isArray() && data.size() > 0) {
obj = MAPPER.readValue(data.traverse(),
MAPPER.getTypeFactory().constructCollectionType(List.class, clazz));
}
return build(jsonNode.get("status").intValue(), jsonNode.get("msg").asText(), obj);
} catch (Exception e) {
return null;
}
}
}
package com.cc.common.util;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class HttpClientUtil {
public static String doGet(String url, Map<String, String> param) {
// 创建Httpclient对象
CloseableHttpClient httpclient = HttpClients.createDefault();
String resultString = "";
CloseableHttpResponse response = null;
try {
// 创建uri
URIBuilder builder = new URIBuilder(url);
if (param != null) {
for (String key : param.keySet()) {
builder.addParameter(key, param.get(key));
}
}
URI uri = builder.build();
// 创建http GET请求
HttpGet httpGet = new HttpGet(uri);
// 执行请求
response = httpclient.execute(httpGet);
// 判断返回状态是否为200
if (response.getStatusLine().getStatusCode() == 200) {
resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (response != null) {
response.close();
}
httpclient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return resultString;
}
public static String doGet(String url) {
return doGet(url, null);
}
public static String doPost(String url, Map<String, String> param) {
// 创建Httpclient对象
CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse response = null;
String resultString = "";
try {
// 创建Http Post请求
HttpPost httpPost = new HttpPost(url);
// 创建参数列表
if (param != null) {
List<NameValuePair> paramList = new ArrayList<>();
for (String key : param.keySet()) {
paramList.add(new BasicNameValuePair(key, param.get(key)));
}
// 模拟表单
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(paramList);
httpPost.setEntity(entity);
}
// 执行http请求
response = httpClient.execute(httpPost);
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
response.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return resultString;
}
public static String doPost(String url) {
return doPost(url, null);
}
public static String doPostJson(String url, String json) {
// 创建Httpclient对象
CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse response = null;
String resultString = "";
try {
// 创建Http Post请求
HttpPost httpPost = new HttpPost(url);
// 创建请求内容
StringEntity entity = new StringEntity(json, ContentType.APPLICATION_JSON);
httpPost.setEntity(entity);
// 执行http请求
response = httpClient.execute(httpPost);
resultString = EntityUtils.toString(response.getEntity(), "utf-8");
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
response.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return resultString;
}
}
package com.cc.config;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.http.StatViewServlet;
import com.alibaba.druid.support.http.WebStatFilter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@Configuration
public class DruidConfig {
@ConfigurationProperties(prefix = "spring.datasource")
@Bean
public DataSource druid(){
return new DruidDataSource();
}
//配置Druid的监控
//1、配置一个管理后台的Servlet
@Bean
public ServletRegistrationBean statViewServlet(){
ServletRegistrationBean bean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
Map<String,String> initParams = new HashMap<>();
initParams.put("loginUsername","admin");
initParams.put("loginPassword","123456");
initParams.put("allow","");//默认就是允许所有访问
initParams.put("deny","192.168.15.21");
bean.setInitParameters(initParams);
return bean;
}
//2、配置一个web监控的filter
@Bean
public FilterRegistrationBean webStatFilter(){
FilterRegistrationBean bean = new FilterRegistrationBean();
bean.setFilter(new WebStatFilter());
Map<String,String> initParams = new HashMap<>();
initParams.put("exclusions","*.js,*.css,/druid/*");
bean.setInitParameters(initParams);
bean.setUrlPatterns(Arrays.asList("/*"));
return bean;
}
}
package com.cc.config;
import org.apache.ibatis.session.Configuration;
import org.mybatis.spring.boot.autoconfigure.ConfigurationCustomizer;
import org.springframework.context.annotation.Bean;
@org.springframework.context.annotation.Configuration
public class MyBatisConfig {
@Bean
public ConfigurationCustomizer configurationCustomizer(){
return new ConfigurationCustomizer(){
@Override
public void customize(Configuration configuration) {
configuration.setMapUnderscoreToCamelCase(true);
}
};
}
}
package com.cc.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
//使用WebMvcConfigurerAdapter可以来扩展SpringMVC的功能
//@EnableWebMvc 不要接管SpringMVC
@Configuration
public class MyMvcConfig extends WebMvcConfigurerAdapter {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
// super.addViewControllers(registry);
registry.addViewController("/").setViewName("login");
registry.addViewController("/servicesfenye").setViewName("servicefenye");
registry.addViewController("/serviceform").setViewName("servicefrom");
registry.addViewController("/serviceupdate").setViewName("serviceupdate");
}
}
package com.cc.controller;
import com.cc.bean.Department;
import com.cc.bean.Employee;
import com.cc.mapper.DepartmentMapper;
import com.cc.mapper.EmployeeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class DeptController {
@Autowired
DepartmentMapper departmentMapper;
@Autowired
EmployeeMapper employeeMapper;
//查询指定返回列表页面
@GetMapping("/dept/{id}")
public Department getDepartment(@PathVariable("id") Integer id){
return departmentMapper.getDeptById(id);
}
@GetMapping("/dept")
public Department insertDept(Department department){
departmentMapper.insertDept(department);
return department;
}
@GetMapping("/emp/{id}")
public Employee getEmp(@PathVariable("id") Integer id){
return employeeMapper.getEmpById(id);
}
}
package com.cc.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class HelloController {
@GetMapping("/abc")
public String hello(Model model){
model.addAttribute("msg","你好");
return "login";
}
}
package com.cc.controller;
import com.cc.bean.ServicesRest;
import com.cc.common.XzxtRestResult;
import com.cc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpSession;
import java.util.Map;
/**
* @author liuys
* @desc
* @date 2018-07-12 17:01
*/
@RequestMapping(value = "/")
@Controller
public class LoginController {
@Autowired
private ServicesRest servicesRest;
@Autowired
UserService userService;
/*
初始化
*/
@GetMapping("/")
public String hello(Model model){
model.addAttribute("msg","你好");
return "login";
}
/*
登陆
*/
@PostMapping ("/login")
public String login(@RequestParam("username") String username,
@RequestParam("password") String password,
Map<String,Object> map, HttpSession session) {
String msg = null;
XzxtRestResult xzxtRestResult=userService.login(username,password);
if(xzxtRestResult.getStatus().equals(201)) {
//登陆成功,防止表单重复提交,可以重定向到主页
session.setAttribute("loginUser", username);
//加载ServiceRest服务地址
session.setAttribute("startRest",servicesRest.getStartRest());
session.setAttribute("stopRest",servicesRest.getStopRest());
session.setAttribute("reportRest",servicesRest.getReportRest());
session.setAttribute("shellPaht",servicesRest.getShellPaht());
session.setAttribute("startTomcatName",servicesRest.getStartTomcatName());
session.setAttribute("stopTomcatName",servicesRest.getStopTomcatName());
session.setAttribute("reportTomcatName",servicesRest.getReportTomcatName());
return "redirect:/main";
}
else{
//登陆失败
map.put("msg",xzxtRestResult.getMsg());
return "login";
}
}
/*
首页
*/
@GetMapping("/main")
public String index(Model model){
model.addAttribute("msg","你好");
return "main";
}
}
package com.cc.controller;
import com.cc.bean.PageBean;
import com.cc.bean.User;
import com.cc.common.ResultMap;
import com.cc.common.XzxtRestResult;
import com.cc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;
/**
* @author liuys
* @desc
* @date 2018-07-12 17:01
*/
@Controller
public class MemberController {
@Autowired
UserService userService;
/*
初始化
*/
@GetMapping("/membersfenye")
public String membersfenye(Model model){
model.addAttribute("msg","你好");
return "mebersfenye";
}
/*
获取用户list
*/
@GetMapping("/members")
@ResponseBody
public ResultMap memberlist(Model model, User user){
ResultMap resultMap=new ResultMap();
resultMap =userService.userAll(user);
return resultMap;
}
}
package com.cc.controller;
import com.cc.bean.PageBean;
import com.cc.bean.Services;
import com.cc.common.ResultMap;
import com.cc.common.XzxtRestResult;
import com.cc.service.ServiceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.util.Collection;
/**
* @author liuys
* @desc
* @date 2018-07-12 17:01
*/
@Controller
public class ServiceController {
@Autowired
ServiceService serviceService;
/*
保存服务
*/
@PostMapping("/saveservices")
@ResponseBody
public XzxtRestResult saveservices(Services services){
return serviceService.SaveService(services);
}
/*
获取服务list
*/
@GetMapping("/services")
@ResponseBody
public ResultMap serviceslist(Model model, Services services){
ResultMap resultMap=new ResultMap();
resultMap =serviceService.ServiceAll(services);
return resultMap;
}
/*
修改服务页面
*/
@GetMapping("/services/{id}")
public String getServices(@PathVariable("id") Integer id,Model model){
model.addAttribute("services",serviceService.SelectServices(id).getData());
return "serviceupdate";
}
/*
修改服务状态
*/
@GetMapping("/updateservices/{id}/{status}")
@ResponseBody
public XzxtRestResult updateservices(@PathVariable("id") Integer id,@PathVariable("status") Integer status){
Services services=new Services();
services.setId(id);
services.setStatus(status);
return serviceService.updateService(services);
}
//服务修改
@PutMapping("/services")
@ResponseBody
public XzxtRestResult updateServices(Services services){
return serviceService.updateService(services);
}
//服务删除
@DeleteMapping("/services/{id}")
@ResponseBody
public XzxtRestResult deleteServices(@PathVariable("id") Integer id){
return serviceService.deleteService(id);
}
/*
//服务心跳
@GetMapping("/services/{id}")
@ResponseBody
public XzxtRestResult reportSerives(Model model){
//model.addAttribute("services",serviceService.SelectServices(id).getData());
return null;
}
*/
}
package com.cc.mapper;
import com.cc.bean.Department;
import org.apache.ibatis.annotations.*;
//指定这是一个操作数据库的mapper
//@Mapper
public interface DepartmentMapper {
@Select("select * from department where id=#{id}")
public Department getDeptById(Integer id);
@Delete("delete from department where id=#{id}")
public int deleteDeptById(Integer id);
@Options(useGeneratedKeys = true,keyProperty = "id")
@Insert("insert into department(department_name) values(#{departmentName})")
public int insertDept(Department department);
@Update("update department set department_name=#{departmentName} where id=#{id}")
public int updateDept(Department department);
}
package com.cc.mapper;
import com.cc.bean.Employee;
//@Mapper或者@MapperScan将接口扫描装配到容器中
public interface EmployeeMapper {
public Employee getEmpById(Integer id);
public void insertEmp(Employee employee);
}
package com.cc.mapper;
import com.cc.bean.Services;
import java.util.List;
public interface ServiceMapper {
List<Services> selectPageList(Services service);
int selectPageCount(Services service);
Services selectServices(int id);
int saveService(Services service);
int updateService(Services service);
int updateServiceByid(int id,int status);
int deleteService(int id);
}
\ No newline at end of file
package com.cc.mapper;
import com.cc.bean.PageBean;
import com.cc.bean.User;
import com.cc.common.XzxtRestResult;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface UserMapper {
/**
* 根据用户名获取用户
*
* @param username
* @return
*/
User login(@Param("username") String username);
/**
* 获取所有用户
*
*
* @return
*/
List<User> userAll();
List<User> selectPageList(User user);
int selectPageCount(User user);
}
package com.cc.service;
import com.cc.bean.Services;
import com.cc.common.ResultMap;
import com.cc.common.XzxtRestResult;
/**
* @author yutons
*/
public interface ServiceService {
/**
* 登录逻辑
* 1、先根据用户名查询用户对象
* 2、如果有用户对象,则继续匹配密码
* 如果没有用户对象,则抛出异常
*
* @return
*/
ResultMap ServiceAll(Services service);
XzxtRestResult SelectServices(int id);
XzxtRestResult SaveService(Services service);
XzxtRestResult updateService(Services service);
XzxtRestResult updateServiceByid(int id,int status);
XzxtRestResult deleteService(int id);
XzxtRestResult reportSerives();
}
package com.cc.service;
import com.cc.bean.PageBean;
import com.cc.bean.User;
import com.cc.common.ResultMap;
import com.cc.common.XzxtRestResult;
import java.util.List;
/**
* @author yutons
*/
public interface UserService {
/**
* 登录逻辑
* 1、先根据用户名查询用户对象
* 2、如果有用户对象,则继续匹配密码
* 如果没有用户对象,则抛出异常
*
* @param username
* @param password
* @return
*/
XzxtRestResult login(String username, String password);
ResultMap userAll(User user);
}
package com.cc.service.serviceimpl;
import com.cc.common.ResultMap;
import com.cc.common.XzxtRestResult;
import com.cc.mapper.ServiceMapper;
import com.cc.service.ServiceService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cc.bean.Services;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
@Service
public class ServiceIServiceImpl implements ServiceService {
private static final Logger logger = LoggerFactory.getLogger(ServiceService.class);
@Resource
private ServiceMapper serviceMapper;
@Override
public ResultMap ServiceAll(Services service) {
List<Services> serviceslist=serviceMapper.selectPageList(service);
ResultMap resultMap=new ResultMap();
if (!StringUtils.isEmpty(serviceslist)) {
int totals=serviceMapper.selectPageCount(service);
resultMap.setCount(totals);
resultMap.setData(serviceslist);
return resultMap;
}
return resultMap ;
}
@Override
public XzxtRestResult SaveService(Services service) {
int num=serviceMapper.saveService(service);
if(num==1){
return XzxtRestResult.build(201,"存入成功");
}else{
return XzxtRestResult.build(202,"存入失败");
}
}
@Override
public XzxtRestResult SelectServices(int id) {
Services service=serviceMapper.selectServices(id);
if(!StringUtils.isEmpty(service)){
return XzxtRestResult.build(201,"读取成功",service);
}else{
return XzxtRestResult.build(202,"读取失败","");
}
}
@Override
public XzxtRestResult updateService(Services service) {
int num=serviceMapper.updateService(service);
if(num==1){
return XzxtRestResult.build(201,"更新成功");
}else{
return XzxtRestResult.build(202,"更新失败");
}
}
@Override
public XzxtRestResult updateServiceByid(int id,int status) {
int num = serviceMapper.updateServiceByid(id,status);
if (num == 1) {
return XzxtRestResult.build(201, "更新成功");
} else {
return XzxtRestResult.build(202, "更新失败");
}
}
@Override
public XzxtRestResult deleteService(int id) {
int num=serviceMapper.deleteService(id);
if(num==1){
return XzxtRestResult.build(201,"删除成功");
}else{
return XzxtRestResult.build(202,"删除失败");
}
}
@Override
public XzxtRestResult reportSerives() {
//获取当前时间
LocalDateTime localDateTime = LocalDateTime.now();
System.out.println("当前时间为:" + localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
return null;
}
}
package com.cc.service.serviceimpl;
import com.cc.bean.PageBean;
import com.cc.bean.User;
import com.cc.common.ResultMap;
import com.cc.common.XzxtRestResult;
import com.cc.mapper.UserMapper;
import com.cc.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service
public class UserServiceImpl implements UserService {
private static final Logger logger = LoggerFactory.getLogger(UserServiceImpl.class);
@Resource
private UserMapper userMapper;
/**
* 登录逻辑
* 1、先根据用户名查询用户对象
* 2、如果有用户对象,则继续匹配密码
* 如果没有用户对象,则抛出异常
*
* @param username
* @param password
* @return
*/
@Override
public XzxtRestResult login(String username, String password) {
//XzxtRestResult xzxtRestResult=new XzxtRestResult();
User user=userMapper.login(username);
if (user.getPassword().equals(password)&&user.getStatus() == 0) {
// 因为缓存切面的原因,在这里就抛出用户名不存在的异常
return XzxtRestResult.build(201,"登陆成功");
}
else {
return XzxtRestResult.build(202,"登陆密码错误或者用户被锁定");
}
}
@Override
public ResultMap userAll(User user) {
List<User> userlist=userMapper.selectPageList(user);
ResultMap resultMap=new ResultMap();
if (!StringUtils.isEmpty(userlist)) {
int totals=userMapper.selectPageCount(user);
resultMap.setCount(totals);
resultMap.setData(userlist);
return resultMap;
}
return resultMap ;
}
}
spring.mvc.view.prefix=/WEB-INF/view/
spring.mvc.view.suffix=.jsp
logging.level.com.cc=debug
#spring.profiles.active=dev
#logging.path=
# \u4E0D\u6307\u5B9A\u8DEF\u5F84\u5728\u5F53\u524D\u9879\u76EE\u4E0B\u751F\u6210springboot.log\u65E5\u5FD7
# \u53EF\u4EE5\u6307\u5B9A\u5B8C\u6574\u7684\u8DEF\u5F84\uFF1B
#logging.file=G:/springboot.log
# \u5728\u5F53\u524D\u78C1\u76D8\u7684\u6839\u8DEF\u5F84\u4E0B\u521B\u5EFAspring\u6587\u4EF6\u5939\u548C\u91CC\u9762\u7684log\u6587\u4EF6\u5939\uFF1B\u4F7F\u7528?spring.log \u4F5C\u4E3A\u9ED8\u8BA4\u6587\u4EF6
logging.path=/spring/log.
# \u5728\u63A7\u5236\u53F0\u8F93\u51FA\u7684\u65E5\u5FD7\u7684\u683C\u5F0F
logging.pattern.console=%d{yyyy-MM-dd} ===application===[%thread] %-5level %logger{50} - %msg%n
# \u6307\u5B9A\u6587\u4EF6\u4E2D\u65E5\u5FD7\u8F93\u51FA\u7684\u683C\u5F0F
logging.pattern.file=%d{yyyy-MM-dd} ===>===application=== [%thread] === %-5level === %logger{50} ==== %msg%n
\ No newline at end of file
spring:
datasource:
# 数据源基本配置
username: root
password: 123
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/mybatis
type: com.alibaba.druid.pool.DruidDataSource
# 数据源其他配置
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
filters: stat,wall,log4j
maxPoolPreparedStatementPerConnectionSize: 20
useGlobalDataSourceStat: true
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500
mybatis:
# 指定全局配置文件位置
config-location: classpath:mybatis/mybatis-config.xml
# 指定sql映射文件位置
mapper-locations: classpath:mybatis/mapper/*.xml
#schema:
# - classpath:sql/department.sql
# - classpath:sql/employee.sql
# 调用运行监控微服务url
service-rest:
startRest: "http://127.0.0.1:8081/service-rest/start"
stopRest: "http://127.0.0.1:8081/service-rest/stop"
reportRest: "http://127.0.0.1:8081/service-rest/report"
# 调用运行监控微服务shell脚本位置(注意:不建议修改)
shellPaht: "/usr/local/"
# 调用运行监控微服务shell脚本
startTomcatName: "startTomcat.sh"
stopTomcatName: "shutTomcat.sh"
reportTomcatName: "reportTomcat.sh"
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cc.mapper.EmployeeMapper">
<!-- public Employee getEmpById(Integer id);
public void insertEmp(Employee employee);-->
<select id="getEmpById" resultType="com.cc.bean.Employee">
SELECT * FROM employee WHERE id=#{id}
</select>
<insert id="insertEmp">
INSERT INTO employee(lastName,email,gender,d_id) VALUES (#{lastName},#{email},#{gender},#{dId})
</insert>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.cc.mapper.ServiceMapper" >
<resultMap id="BaseResultMap" type="com.cc.bean.Services" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="service_name" property="serviceName" jdbcType="VARCHAR" />
<result column="service_ip" property="serviceIp" jdbcType="VARCHAR" />
<result column="sql_type" property="sqlType" jdbcType="INTEGER" />
<result column="apply_name" property="applyName" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="servletPath" property="servletPath" jdbcType="VARCHAR" />
<result column="port" property="port" jdbcType="VARCHAR" />
<result column="ipUsername" property="ipUsername" jdbcType="VARCHAR" />
<result column="ipPassword" property="ipPassword" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, service_name, service_ip, sql_type, apply_name, status, ipUsername, ipPassword, servletPath, port
</sql>
<sql id="queryWhere" >
<where>
<if test="id!=null and id !=''">AND id = #{id}</if>
<if test="serviceName!='' and serviceName!=null">
AND username like '%' #{serviceName} '%'
</if>
</where>
</sql>
<!-- 通过条件分页查询,返回数据集 -->
<select id="selectPageList" parameterType="com.cc.bean.Services" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from service
<include refid="queryWhere"/>
order by id
limit ${(page-1)*limit},#{limit}
</select>
<!-- 通过条件分页查询,返回总记录数 -->
<select id="selectPageCount" parameterType="com.cc.bean.Services" resultType="java.lang.Integer">
select count(1) from service
<include refid="queryWhere"/>
</select>
<select id="selectServices" parameterType="java.lang.Integer" resultType="com.cc.bean.Services">
select <include refid="Base_Column_List"/>
from service
where id = #{ id,jdbcType=INTEGER }
</select>
<!-- 保存服务 -->
<insert id="saveService" parameterType="com.cc.bean.Services">
insert into service ( <include refid="Base_Column_List"/>)
values (
#{id,jdbcType=INTEGER},
#{serviceName,jdbcType=VARCHAR},
#{serviceIp,jdbcType=VARCHAR},
#{sqlType,jdbcType=INTEGER},
#{applyName,jdbcType=VARCHAR},
#{status,jdbcType=INTEGER},
#{ipUsername,jdbcType=VARCHAR},
#{ipPassword,jdbcType=VARCHAR},
#{servletPath,jdbcType=VARCHAR},
#{port,jdbcType=VARCHAR})
</insert>
<update id="updateService" parameterType="com.cc.bean.Services" >
update service
<set>
<if test="serviceName != null" >
service_name = #{serviceName,jdbcType=VARCHAR},
</if>
<if test="serviceIp != null" >
service_ip = #{serviceIp,jdbcType=VARCHAR},
</if>
<if test="sqlType != null" >
sql_type = #{sqlType,jdbcType=INTEGER},
</if>
<if test="applyName != null" >
apply_name = #{applyName,jdbcType=VARCHAR},
</if>
<if test="status != null" >
status = #{status,jdbcType=INTEGER},
</if>
<if test="ipUsername != null" >
ipUsername = #{ipUsername,jdbcType=VARCHAR},
</if>
<if test="ipUsername != null" >
ipPassword = #{ipUsername,jdbcType=VARCHAR},
</if>
<if test="servletPath != null" >
servletPath = #{servletPath,jdbcType=VARCHAR},
</if>
<if test="port != null" >
port = #{port,jdbcType=VARCHAR},
</if>
</set>
where id = #{ id,jdbcType=INTEGER }
</update>
<update id="updateServiceByid" parameterType="java.lang.Integer" >
update service
<if test="status != null" >
status = #{status,jdbcType=INTEGER}
</if>
where id = #{ id,jdbcType=INTEGER }
</update>
<delete id="deleteService" parameterType="java.lang.Integer" >
delete from service
where id = #{id,jdbcType=INTEGER}
</delete>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cc.mapper.UserMapper">
<resultMap id="BaseResultMap" type="com.cc.bean.User" >
<id column="id" property="id" jdbcType="VARCHAR" />
<result column="email" property="email" jdbcType="VARCHAR" />
<result column="sex" property="sex" jdbcType="VARCHAR" />
<result column="staffname" property="staffname" jdbcType="VARCHAR" />
<result column="username" property="username" jdbcType="VARCHAR" />
<result column="password" property="password" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="VARCHAR" />
</resultMap>
<!-- public Employee getEmpById(Integer id);
public void insertEmp(Employee employee);-->
<select id="login" resultType="com.cc.bean.User">
SELECT * FROM t_user WHERE username=#{username}
</select>
<select id="userAll" resultType="com.cc.bean.User">
SELECT * FROM t_user
</select>
<sql id="queryWhere" >
<where>
<if test="id!=null and id !=''">AND id = #{id}</if>
<if test="username!='' and username!=null">
AND username like '%' #{username} '%'
</if>
</where>
</sql>
<!-- 通过条件分页查询,返回数据集 -->
<select id="selectPageList" parameterType="com.cc.bean.User" resultMap="BaseResultMap">
select *
from t_user
<include refid="queryWhere"/>
order by id DESC
limit ${(page-1)*limit},#{limit}
</select>
<!-- 通过条件分页查询,返回总记录数 -->
<select id="selectPageCount" parameterType="com.cc.bean.User" resultType="java.lang.Integer">
select count(1) from t_user
<include refid="queryWhere"/>
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<setting name="mapUnderscoreToCamelCase" value="true"/>
</settings>
</configuration>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1>首页</h1>
</body>
</html>
\ No newline at end of file
@font-face {
font-family: 'iconfont';
src: url('../fonts/iconfont.eot');
src: url('../fonts/iconfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/iconfont.woff') format('woff'),
url('../fonts/iconfont.ttf') format('truetype'),
url('../fonts/iconfont.svg#iconfont') format('svg');
}
.iconfont{
color: #fff;
font-family:"iconfont" !important;
font-size:16px;font-style:normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
@charset "utf-8";
@import url(../lib/layui/css/layui.css);
*{
margin: 0px;
padding: 0px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
a{
text-decoration: none;
}
html{
width: 100%;
}
body{
width: 100%;
background-color: #54364a;
background-image: url(../images/a.jpg);
background-repeat: no-repeat;
background-size: cover;
color: #ffffff;
}
/*layer弹出层背景设置*/
.layui-layer{
background-image: url(../images/h.jpg);
background-size: cover;
}
/*背景设置*/
.bg-changer{
position: fixed;
left: 0px;
top: -110px;
width: 100%;
/*height: 100px;*/
}
.bg-changer #changer-set{
position: fixed;
top: 111px;
right: 0px;
width: 33px;
height: 33px;
background: rgba(0,0,0,0.5);
border: 1px solid rgba(255,255,255, 0.3);
border-top: 0px;
color: #fff;
text-align: center;
line-height: 33px;
cursor: pointer;
}
.bg-changer #changer-set i{
display: block;
font-size: 25px;
/* 设置默认样式,开启3d硬件加速 */
-webkit-transform:translate3d(0,0,0);
-moz-transform:translate3d(0,0,0);
transform:translate3d(0,0,0);
/* 设置动画,animation:动画名称 动画播放时长单位秒或微秒 动画播放的速度曲线linear为匀速 动画播放次数infinite为循环播放; */
-webkit-animation:play 3s linear infinite;
-moz-animation:play 3s linear infinite;
animation:play 3s linear infinite;
}
@-webkit-keyframes play{
0% {
-webkit-transform:rotateZ(0deg);
}
100% {
-webkit-transform:rotateZ(360deg);
}
}
@-moz-keyframes play{
0% {
-moz-transform:rotateZ(0deg);
}
100% {
-moz-transform:rotateZ(360deg);
}
}
@keyframes play{
0% {
transform:rotateZ(0deg);
}
100% {
transform:rotateZ(360deg);
}
}
.bg-changer .changer-list{
width: 100%;
height: 100px;
/*display: none;*/
padding-top: 10px;
background: rgba(0,0,0,0.5);
border: 1px solid rgba(255,255,255, 0.3);
}
.bg-changer .changer-list .swiper-slide{
width: 80px;
}
.bg-changer .changer-list img.item{
width: 80px;
height: 80px;
}
.bg-changer .changer-list span{
display: block;
width: 80px;
height: 80px;
color: #fff;
text-align: center;
line-height: 80px;
background: #4390EE url() 0 0 no-repeat;
}
.bg-changer .bg-out{
width: 100%;
height: 900px;
background: red url() 0 0 no-repeat;
opacity: 0;
display: none;
}
/*登录样式*/
.login-logo{
width: 100%;
padding-top: 70px;
height: 50px;
}
.login-logo h1{
color: #fff;
font-size: 25px;
text-align: center;
}
.login-box{
width: 310px;
height: 350px;
padding: 20px 15px 15px;
background-color: rgba(0, 0, 0, 0.25);
border: 1px solid rgba(255,255,255, 0.3);
margin: 0 auto;
}
.login-box h3{
font-weight: 300;
margin-bottom: 25px;
color: #fff;
margin-left: 0;
font-size: 22px;
margin-top: 20px;
}
.layui-form-item{
margin-top: 15px;
}
.layui-form-pane .layui-form-label{
border-radius: 6px;
background-color: rgba(0, 0, 0, 0.25);
border: 1px solid rgba(255, 255, 255, 0.2);
border-right: 0px;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.layui-form-pane .login-form{
width: 25px;
}
.layui-form-pane .layui-form-label i{
color: #fff;
font-size: 18px;
line-height: 14px;
}
.layui-form-item .login-inline{
width: 245px;
/*margin-left: 60px;*/
/*background-color: rgba(0, 0, 0, 0.25);*/
}
@media screen and (max-width: 450px){
.layui-form-item .layui-input-inline {
margin: 0 0 10px 56px;
}
}
.layui-form-label i{
font-size: 14px;
}
.layui-form-pane .layui-input,.layui-form-pane .layui-textarea,.layui-form-pane .layui-select{
background-color: rgba(0, 0, 0, 0.25);
border-radius: 6px;
border: 1px solid rgba(255, 255, 255, 0.2);
border-top-left-radius: 0;
border-bottom-left-radius: 0;
color: #fff;
}
.layui-input:focus, .layui-textarea:focus, .layui-select:focus {
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
}
.layui-input::-webkit-input-placeholder, .layui-textarea::-webkit-input-placeholder, .layui-select::-webkit-input-placeholder { color:#fff; }
.layui-input::-moz-placeholder, .layui-textarea::-moz-placeholder, .layui-select::-moz-placeholder { color:#fff; }
.login-title {
font-weight: bold;
color: #fff;
font-size: 14px;
}
.form-actions {
background-color: rgba(0, 0, 0, 0.25);
margin-left: -15px;
margin-right: -15px;
text-align: center;
margin-top: 20px;
padding: 19px 20px 20px;
}
.forgot {
width: 100%;
padding: 15px 0;
text-align: center;
color: #fff;
}
.forgot:hover {
color: #fff;
}
.btn {
/*display: inline-block;*/
padding: 6px 12px;
margin-bottom: 0;
font-size: 14px;
font-weight: normal;
line-height: 1.428571429;
text-align: center;
white-space: nowrap;
vertical-align: middle;
cursor: pointer;
border: 1px solid transparent;
border-radius: 4px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
color: #ffffff;
background-color: rgba(240, 173, 78, 0.55);
border-color: #eea236;
margin:0 auto;
}
/*头部*/
.container{
width: 100%;
height: 71px;
background-color: rgba(0, 0, 0, 0.25);
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.container .open-nav{
float: left;
line-height: 71px;
padding-left: 10px;
display: none;
cursor: pointer;
}
.container .open-nav i{
cursor: pointer;
}
.container .logo{
float: left;
color: #fff;
font-size: 25px;
padding-left: 20px;
line-height: 71px;
}
.container .right{
float: right;
}
/*主体*/
.wrapper{
display: table;
position: relative;
width: 100%;
}
.wrapper .left-nav{
background-color: rgba(0, 0, 0, 0.20);
color: #FFF;
display: table-cell;
float: none!important;
vertical-align: top;
max-width: 250px;
/*width: 0px;*/
}
.wrapper .left-nav #nav li{
width: 250px;
background-color: rgba(0, 0, 0, 0.1);
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.wrapper .left-nav #nav li:hover{
background-color: rgba(0, 0, 0, 0.3);
}
.wrapper .left-nav #nav .current{
background-color: rgba(0, 0, 0, 0.3);
}
.wrapper .left-nav #nav li a{
width: 230px;
color: #fff;
font-size: 14px;
padding: 15px 15px 15px 20px;
display: block;
}
.wrapper .left-nav #nav li .sub-menu{
display: none;
background-color:rgba(0, 0, 0, 0.3)
}
.wrapper .left-nav #nav li .opened{
display: block;
}
.wrapper .left-nav #nav li .opened{
}
.wrapper .left-nav #nav li .opened .current{
background-color:rgba(0, 0, 0, 0.4)
}
.wrapper .left-nav #nav li .sub-menu li a{
padding: 12px 15px 12px 45px;
font-size: 14px;
}
.wrapper .left-nav #nav li .sub-menu li a i{
font-size: 12px;
}
.wrapper .left-nav #nav li a i{
padding-right: 10px;
line-height: 16px;
}
.wrapper .left-nav #nav li .nav_right{
float: right;
font-size: 12px;
}
.wrapper .page-content{
color: #FFF;
padding: 20px 30px;
display: table-cell;
float: none!important;
word-wrap:break-word;
word-break:break-all;
}
.wrapper .page-content .content{
min-height: 500px;
/*width: 100%;*/
/*height: 300px;*/
/*background: red url() 0 0 no-repeat;*/
}
xblock{
display: block;
margin-bottom: 10px;
padding: 5px;
line-height: 22px;
/* border-left: 5px solid #009688; */
border-radius: 0 2px 2px 0;
background-color: rgba(0,0,0,0.2);
}
.x-right{
float: right;
}
.footer{
width: 100%;
background-color: rgba(0, 0, 0, 0.25);
border-top: 1px solid rgba(255, 255, 255, 0.2);
line-height: 41px;
color: #fff;
/*padding-left: 10px;*/
}
.footer .copyright{
margin-left: 10px;
}
@media screen and (max-width: 1024px){
.wrapper .left-nav{
width: 0px;
}
.wrapper .left-nav #side-nav{
display: none;
}
.container .open-nav{
display: block;
}
}
@media screen and (min-width: 1024px){
.wrapper .left-nav{
width: 250px;
}
.wrapper .left-nav #side-nav{
display: block;
}
.container .open-nav{
display: none;
}
}
@media screen and (max-width: 1024px){
.login-box{
width: 100%;
}
}
@media screen and (max-width: 500px){
.container .right{
display: none;
}
}
@media screen and (max-width: 768px){
.xbs768{
display: none;
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
$(function () {
//加载弹出层
layui.use(['form','element'],
function() {
layer = layui.layer;
//element = layui.element();
});
//初如化背景
function bgint () {
if(localStorage.bglist){
var arr = JSON.parse(localStorage.bglist);//
// console.log(arr);
//全局背景统一
if(arr['bgSrc']){
$('body').css('background-image', 'url('+arr['bgSrc']+')');
//初始化弹出层背景
}
//单个背景逻辑
// if(arr[location.href]){
// $('body').css('background-image', 'url('+arr[location.href]+')');
// }
}
}
bgint();
//背景主题功能
var changerlist = new Swiper('.changer-list', {
initialSlide :5,
effect: 'coverflow',
grabCursor: true,
centeredSlides: true,
slidesPerView: 'auto',
coverflow: {
rotate: 50,
stretch: -10,
depth: 100,
modifier: 1,
slideShadows : false
}
});
//判断是否显示左侧菜单
$(window).resize(function(){
width=$(this).width();
if(width>1024){
$('#side-nav').show();
}
});
//背景主题设置展示
is_show_change=true;
$('#changer-set').click(function(event) {
if(is_show_change){
$('.bg-out').show();
$('.bg-changer').animate({top: '0px'}, 500);
is_show_change=false;
}else{
$('.bg-changer').animate({top: '-110px'}, 500);
is_show_change=true;
}
});
//背景主题切换
$('.bg-changer img.item').click(function(event) {
if(!localStorage.bglist){
arr = {};
}else{
arr = JSON.parse(localStorage.bglist);
}
var src = $(this).attr('src');
$('body').css('background-image', 'url('+src+')');
url = location.href;
// 单个背景逻辑
// arr[url]=src;
// 全局背景统一
arr['bgSrc'] = src;
// console.log(arr);
localStorage.bglist = JSON.stringify(arr);
});
//背景初始化
$('.reset').click(function () {
localStorage.clear();
layer.msg('初如化成功',function(){});
});
//背景切换点击空白区域隐藏
$('.bg-out').click(function () {
$('.bg-changer').animate({top: '-110px'}, 500);
is_show_change=true;
$(this).hide();
})
//窄屏下的左侧菜单隐藏效果
$('.container .open-nav i').click(function(event) {
$('#side-nav').toggle(400);
// $('.wrapper .left-nav').toggle(400)
});
//左侧菜单效果
$('.left-nav #nav li').click(function () {
if($(this).hasClass('open')){
$(this).removeClass('open');
$(this).find('.nav_right').html('&#xe697;');
$(this).children('.sub-menu').slideUp();
// $(this).siblings().children('.sub-menu').slideUp();
}else{
$(this).addClass('open');
$(this).find('.nav_right').html('&#xe6a6;');
$(this).children('.sub-menu').slideDown();
$(this).siblings().children('.sub-menu').slideUp();
$(this).siblings().removeClass('open');
}
})
//初始化菜单展开样式
$('.left-nav #nav li .opened').siblings('a').find('.nav_right').html('&#xe6a6;');
})
/*弹出层*/
/*
参数解释:
title 标题
url 请求的url
id 需要操作的数据id
w 弹出层宽度(缺省调默认值)
h 弹出层高度(缺省调默认值)
*/
function x_admin_show(title,url,w,h){
if (title == null || title == '') {
title=false;
};
if (url == null || url == '') {
url="404.html";
};
if (w == null || w == '') {
w=800;
};
if (h == null || h == '') {
h=($(window).height() - 50);
};
layer.open({
type: 2,
area: [w+'px', h +'px'],
fix: false, //不固定
maxmin: true,
shadeClose: true,
shade:0.4,
title: title,
content: url
});
}
/*关闭弹出框口*/
function x_admin_close(){
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
}
/**
@Name: layui.code
@Author: 贤心
@Site: http://www.layui.com
*/
/* 加载就绪标志 */
html #layuicss-skincodecss{display:none; position: absolute; width:1989px;}
/* 默认风格 */
.layui-code-view{display: block; position: relative; margin: 10px 0; padding: 0; border: 1px solid #ddd; border-left-width: 6px; background-color: #F2F2F2; color: #333; font-family: Courier New; font-size: 12px;}
.layui-code-h3{position: relative; padding: 0 10px; height: 30px; line-height: 30px; border-bottom: 1px solid #ddd; font-size: 12px;}
.layui-code-h3 a{position: absolute; right: 10px; top: 0; color: #999;}
.layui-code-view .layui-code-ol{position: relative; overflow: auto;}
.layui-code-view .layui-code-ol li{position: relative; margin-left: 45px; line-height: 20px; padding: 0 5px; border-left: 1px solid #ddd; list-style-type: decimal-leading-zero; *list-style-type: decimal; background-color: #fff;}
.layui-code-view pre{margin: 0;}
/* notepadd++风格 */
.layui-code-notepad{border: 1px solid #0C0C0C; border-left-color: #3F3F3F; background-color: #0C0C0C; color: #C2BE9E}
.layui-code-notepad .layui-code-h3{border-bottom: none;}
.layui-code-notepad .layui-code-ol li{background-color: #3F3F3F; border-left: none;}
\ No newline at end of file
/**
@Name: laydate 核心样式
@Author:贤心
@Site:http://sentsin.com/layui/laydate
**/
#layuicss-laydatecss{display: none; position: absolute; width: 1989px;}
.laydate_body .laydate_box, .laydate_body .laydate_box *{margin:0; padding:0;box-sizing:content-box;}
.laydate-icon,
.laydate-icon-default,
.laydate-icon-danlan,
.laydate-icon-dahong,
.laydate-icon-molv{height:22px; line-height:22px; padding-right:20px; border:1px solid #C6C6C6; background-repeat:no-repeat; background-position:right center; background-color:#fff; outline:0;}
.laydate-icon-default{ background-image:url(../skins/default/icon.png)}
.laydate-icon-danlan{border:1px solid #B1D2EC; background-image:url(../skins/danlan/icon.png)}
.laydate-icon-dahong{background-image:url(../skins/dahong/icon.png)}
.laydate-icon-molv{background-image:url(../skins/molv/icon.png)}
.laydate_body .laydate_box{width:240px; font:12px '\5B8B\4F53'; z-index:99999999; *margin:-2px 0 0 -2px; *overflow:hidden; _margin:0; _position:absolute!important; background-color:#fff;}
.laydate_body .laydate_box li{list-style:none;}
.laydate_body .laydate_box .laydate_void{cursor:text!important;}
.laydate_body .laydate_box a, .laydate_body .laydate_box a:hover{text-decoration:none; blr:expression(this.onFocus=this.blur()); cursor:pointer;}
.laydate_body .laydate_box a:hover{text-decoration:none;}
.laydate_body .laydate_box cite, .laydate_body .laydate_box label{position:absolute; width:0; height:0; border-width:5px; border-style:dashed; border-color:transparent; overflow:hidden; cursor:pointer;}
.laydate_body .laydate_box .laydate_yms, .laydate_body .laydate_box .laydate_time{display:none;}
.laydate_body .laydate_box .laydate_show{display:block;}
.laydate_body .laydate_box input{outline:0; font-size:14px; background-color:#fff;}
.laydate_body .laydate_top{position:relative; height:26px; padding:5px; *width:100%; z-index:99;}
.laydate_body .laydate_ym{position:relative; float:left; height:24px; cursor:pointer;}
.laydate_body .laydate_ym input{float:left; height:24px; line-height:24px; text-align:center; border:none; cursor:pointer;}
.laydate_body .laydate_ym .laydate_yms{position:absolute; left: -1px; top: 24px; height:181px;}
.laydate_body .laydate_y{width:121px; margin-right:6px;}
.laydate_body .laydate_y input{width:64px; margin-right:15px;}
.laydate_body .laydate_y .laydate_yms{width:121px; text-align:center;}
.laydate_body .laydate_y .laydate_yms a{position:relative; display:block; height:20px;}
.laydate_body .laydate_y .laydate_yms ul{height:139px; padding:0; *overflow:hidden;}
.laydate_body .laydate_y .laydate_yms ul li{float:left; width:60px; height:20px; line-height: 20px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}
.laydate_body .laydate_m{width:99px;}
.laydate_body .laydate_m .laydate_yms{width:99px; padding:0;}
.laydate_body .laydate_m input{width:42px; margin-right:15px;}
.laydate_body .laydate_m .laydate_yms span{display:block; float:left; width:42px; margin: 5px 0 0 5px; line-height:24px; text-align:center; _display:inline;}
.laydate_body .laydate_choose{display:block; float:left; position:relative; width:20px; height:24px;}
.laydate_body .laydate_choose cite, .laydate_body .laydate_tab cite{left:50%; top:50%;}
.laydate_body .laydate_chtop cite{margin:-7px 0 0 -5px; border-bottom-style:solid;}
.laydate_body .laydate_chdown cite, .laydate_body .laydate_ym label{top:50%; margin:-2px 0 0 -5px; border-top-style:solid;}
.laydate_body .laydate_chprev cite{margin:-5px 0 0 -7px;}
.laydate_body .laydate_chnext cite{margin:-5px 0 0 -2px;}
.laydate_body .laydate_ym label{right:28px;}
.laydate_body .laydate_table{ width:230px; margin:0 5px; border-collapse:collapse; border-spacing:0px; }
.laydate_body .laydate_table td{width:31px; height:19px; line-height:19px; text-align: center; cursor:pointer; font-size: 12px;}
.laydate_body .laydate_table thead{height:22px; line-height:22px;}
.laydate_body .laydate_table thead th{font-weight:400; font-size:12px; text-align:center;}
.laydate_body .laydate_bottom{position:relative; height:22px; line-height:20px; padding:5px; font-size:12px;}
.laydate_body .laydate_bottom #laydate_hms{position: relative; z-index: 1; float:left; }
.laydate_body .laydate_time{ position:absolute; left:5px; bottom: 26px; width:129px; height:125px; *overflow:hidden;}
.laydate_body .laydate_time .laydate_hmsno{ padding:5px 0 0 5px;}
.laydate_body .laydate_time .laydate_hmsno span{display:block; float:left; width:24px; height:19px; line-height:19px; text-align:center; cursor:pointer; *margin-bottom:-5px;}
.laydate_body .laydate_time1{width:228px; height:154px;}
.laydate_body .laydate_time1 .laydate_hmsno{padding: 6px 0 0 8px;}
.laydate_body .laydate_time1 .laydate_hmsno span{width:21px; height:20px; line-height:20px;}
.laydate_body .laydate_msg{left:49px; bottom:67px; width:141px; height:auto; overflow: hidden;}
.laydate_body .laydate_msg p{padding:5px 10px;}
.laydate_body .laydate_bottom li{float:left; height:20px; line-height:20px; border-right:none; font-weight:900;}
.laydate_body .laydate_bottom .laydate_sj{width:33px; text-align:center; font-weight:400;}
.laydate_body .laydate_bottom input{float:left; width:21px; height:20px; line-height:20px; border:none; text-align:center; cursor:pointer; font-size:12px; font-weight:400;}
.laydate_body .laydate_bottom .laydte_hsmtex{height:20px; line-height:20px; text-align:center;}
.laydate_body .laydate_bottom .laydte_hsmtex span{position:absolute; width:20px; top:0; right:0px; cursor:pointer;}
.laydate_body .laydate_bottom .laydte_hsmtex span:hover{font-size:14px;}
.laydate_body .laydate_bottom .laydate_btn{position:absolute; right:5px; top:5px;}
.laydate_body .laydate_bottom .laydate_btn a{float:left; height:20px; padding:0 6px; _padding:0 5px;}
.laydate_body .laydate_bottom .laydate_v{position:absolute; left:10px; top:6px; font-family:Courier; z-index:0;}
.laydate-icon{border:1px solid #C6C6C6; background-image:url(icon.png)}
.laydate_body .laydate_box,
.laydate_body .laydate_ym,
.laydate_body .laydate_ym .laydate_yms,
.laydate_body .laydate_table,
.laydate_body .laydate_table td,
.laydate_body .laydate_bottom #laydate_hms,
.laydate_body .laydate_time,
.laydate_body .laydate_bottom .laydate_btn a{border:1px solid #ccc;}
.laydate_body .laydate_y .laydate_yms a,
.laydate_body .laydate_choose,
.laydate_body .laydate_table thead,
.laydate_body .laydate_bottom .laydte_hsmtex{background-color:#F6F6F6;}
.laydate_body .laydate_box,
.laydate_body .laydate_ym .laydate_yms,
.laydate_body .laydate_time{box-shadow: 2px 2px 5px rgba(0,0,0,.1);}
.laydate_body .laydate_box{border-top:none; border-bottom:none; background-color:#fff; color:#333;}
.laydate_body .laydate_box input{color:#333;}
.laydate_body .laydate_box .laydate_void{color:#ccc!important; /*text-decoration:line-through;*/}
.laydate_body .laydate_box .laydate_void:hover{background-color:#fff!important}
.laydate_body .laydate_box a, .laydate_body .laydate_box a:hover{color:#333;}
.laydate_body .laydate_box a:hover{color:#666;}
.laydate_body .laydate_click{background-color:#eee!important;}
.laydate_body .laydate_top{border-top:1px solid #C6C6C6;}
.laydate_body .laydate_ym .laydate_yms{border:1px solid #C6C6C6; background-color:#fff;}
.laydate_body .laydate_y .laydate_yms a{border-bottom:1px solid #C6C6C6;}
.laydate_body .laydate_y .laydate_yms .laydate_chdown{border-top:1px solid #C6C6C6; border-bottom:none;}
.laydate_body .laydate_choose{border-left:1px solid #C6C6C6;}
.laydate_body .laydate_chprev{border-left:none; border-right:1px solid #C6C6C6;}
.laydate_body .laydate_choose:hover,
.laydate_body .laydate_y .laydate_yms a:hover{background-color:#fff;}
.laydate_body .laydate_chtop cite{border-bottom-color:#666;}
.laydate_body .laydate_chdown cite, .laydate_body .laydate_ym label{border-top-color:#666;}
.laydate_body .laydate_chprev cite{border-right-style:solid; border-right-color:#666;}
.laydate_body .laydate_chnext cite{border-left-style:solid; border-left-color:#666;}
.laydate_body .laydate_table td{border:none; height:21px!important; line-height:21px!important; background-color:#fff;}
.laydate_body .laydate_table .laydate_nothis{color:#999;}
.laydate_body .laydate_table thead{height:21px!important; line-height:21px!important;}
.laydate_body .laydate_table thead th{border-bottom:1px solid #ccc;}
.laydate_body .laydate_bottom{border-bottom:1px solid #C6C6C6;}
.laydate_body .laydate_bottom #laydate_hms{background-color:#fff;}
.laydate_body .laydate_time{background-color:#fff;}
.laydate_body .laydate_bottom .laydate_sj{border-right:1px solid #C6C6C6; background-color:#F6F6F6;}
.laydate_body .laydate_bottom input{background-color:#fff;}
.laydate_body .laydate_bottom .laydte_hsmtex{border-bottom:1px solid #C6C6C6;}
.laydate_body .laydate_bottom .laydate_btn{border-right:1px solid #C6C6C6;}
.laydate_body .laydate_bottom .laydate_v{color:#999}
.laydate_body .laydate_bottom .laydate_btn a{border-right:none; background-color:#F6F6F6;}
.laydate_body .laydate_bottom .laydate_btn a:hover{color:#000; background-color:#fff;}
.laydate_body .laydate_m .laydate_yms span:hover,
.laydate_body .laydate_y .laydate_yms ul li:hover,
.laydate_body .laydate_table td:hover,
.laydate_body .laydate_time .laydate_hmsno span:hover{background-color:#F3F3F3}
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment