├── image ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png └── 7.png ├── limage ├── 1.png ├── 2.png └── 3.png ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ ├── maven-wrapper.properties │ └── MavenWrapperDownloader.java ├── src ├── main │ ├── resources │ │ ├── mapper │ │ │ ├── ConfigDao.xml │ │ │ ├── UserDao.xml │ │ │ ├── TokenDao.xml │ │ │ ├── ZichanfenleiDao.xml │ │ │ ├── ZichanxinxiDao.xml │ │ │ ├── YonghuDao.xml │ │ │ ├── ZichanweixiuDao.xml │ │ │ ├── CommonDao.xml │ │ │ ├── ZichanguihaiDao.xml │ │ │ └── ZichanjiechuDao.xml │ │ └── application.yml │ └── java │ │ └── com │ │ ├── dao │ │ ├── ConfigDao.java │ │ ├── UserDao.java │ │ ├── TokenDao.java │ │ ├── CommonDao.java │ │ ├── YonghuDao.java │ │ ├── ZichanxinxiDao.java │ │ ├── ZichanfenleiDao.java │ │ ├── ZichanguihaiDao.java │ │ ├── ZichanjiechuDao.java │ │ └── ZichanweixiuDao.java │ │ ├── annotation │ │ ├── IgnoreAuth.java │ │ ├── LoginUser.java │ │ └── APPLoginUser.java │ │ ├── service │ │ ├── ConfigService.java │ │ ├── CommonService.java │ │ ├── UserService.java │ │ ├── TokenService.java │ │ ├── impl │ │ │ ├── ConfigServiceImpl.java │ │ │ ├── CommonServiceImpl.java │ │ │ ├── UserServiceImpl.java │ │ │ ├── YonghuServiceImpl.java │ │ │ ├── ZichanxinxiServiceImpl.java │ │ │ ├── ZichanfenleiServiceImpl.java │ │ │ ├── ZichanguihaiServiceImpl.java │ │ │ ├── ZichanjiechuServiceImpl.java │ │ │ ├── ZichanweixiuServiceImpl.java │ │ │ └── TokenServiceImpl.java │ │ ├── YonghuService.java │ │ ├── ZichanxinxiService.java │ │ ├── ZichanfenleiService.java │ │ ├── ZichanguihaiService.java │ │ ├── ZichanjiechuService.java │ │ └── ZichanweixiuService.java │ │ ├── utils │ │ ├── MD5Util.java │ │ ├── CommonUtil.java │ │ ├── FileUtil.java │ │ ├── JQPageInfo.java │ │ ├── R.java │ │ ├── SQLFilter.java │ │ ├── HttpClientUtils.java │ │ ├── ValidatorUtils.java │ │ ├── SpringContextUtils.java │ │ ├── PageUtils.java │ │ ├── Query.java │ │ ├── BaiduUtil.java │ │ └── MPUtil.java │ │ ├── config │ │ ├── MybatisPlusConfig.java │ │ └── InterceptorConfig.java │ │ ├── entity │ │ ├── vo │ │ │ ├── ZichanfenleiVO.java │ │ │ ├── ZichanweixiuVO.java │ │ │ ├── ZichanxinxiVO.java │ │ │ ├── YonghuVO.java │ │ │ ├── ZichanguihaiVO.java │ │ │ └── ZichanjiechuVO.java │ │ ├── model │ │ │ ├── ZichanfenleiModel.java │ │ │ ├── ZichanweixiuModel.java │ │ │ ├── ZichanxinxiModel.java │ │ │ ├── YonghuModel.java │ │ │ ├── ZichanguihaiModel.java │ │ │ └── ZichanjiechuModel.java │ │ ├── view │ │ │ ├── YonghuView.java │ │ │ ├── ZichanxinxiView.java │ │ │ ├── ZichanfenleiView.java │ │ │ ├── ZichanguihaiView.java │ │ │ ├── ZichanjiechuView.java │ │ │ └── ZichanweixiuView.java │ │ ├── EIException.java │ │ ├── ConfigEntity.java │ │ ├── UserEntity.java │ │ ├── ZichanfenleiEntity.java │ │ ├── TokenEntity.java │ │ ├── ZichanweixiuEntity.java │ │ ├── ZichanxinxiEntity.java │ │ ├── YonghuEntity.java │ │ ├── ZichanguihaiEntity.java │ │ └── ZichanjiechuEntity.java │ │ ├── SpringbootSchemaApplication.java │ │ ├── controller │ │ ├── ConfigController.java │ │ ├── FileController.java │ │ ├── UserController.java │ │ ├── ZichanxinxiController.java │ │ ├── ZichanfenleiController.java │ │ └── ZichanweixiuController.java │ │ └── interceptor │ │ └── AuthorizationInterceptor.java └── test │ └── java │ └── com │ └── SpringbootSchemaApplicationTests.java ├── .gitignore ├── README.md └── pom.xml /image/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No27Enterprise-Asset-Management-System/HEAD/image/1.png -------------------------------------------------------------------------------- /image/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No27Enterprise-Asset-Management-System/HEAD/image/2.png -------------------------------------------------------------------------------- /image/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No27Enterprise-Asset-Management-System/HEAD/image/3.png -------------------------------------------------------------------------------- /image/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No27Enterprise-Asset-Management-System/HEAD/image/4.png -------------------------------------------------------------------------------- /image/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No27Enterprise-Asset-Management-System/HEAD/image/5.png -------------------------------------------------------------------------------- /image/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No27Enterprise-Asset-Management-System/HEAD/image/6.png -------------------------------------------------------------------------------- /image/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No27Enterprise-Asset-Management-System/HEAD/image/7.png -------------------------------------------------------------------------------- /limage/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No27Enterprise-Asset-Management-System/HEAD/limage/1.png -------------------------------------------------------------------------------- /limage/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No27Enterprise-Asset-Management-System/HEAD/limage/2.png -------------------------------------------------------------------------------- /limage/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No27Enterprise-Asset-Management-System/HEAD/limage/3.png -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature924/No27Enterprise-Asset-Management-System/HEAD/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /src/main/resources/mapper/ConfigDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar 3 | -------------------------------------------------------------------------------- /src/main/java/com/dao/ConfigDao.java: -------------------------------------------------------------------------------- 1 | 2 | package com.dao; 3 | 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import com.entity.ConfigEntity; 6 | 7 | /** 8 | * 配置 9 | */ 10 | public interface ConfigDao extends BaseMapper { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/annotation/IgnoreAuth.java: -------------------------------------------------------------------------------- 1 | package com.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * 忽略Token验证 7 | */ 8 | @Target(ElementType.METHOD) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | @Documented 11 | public @interface IgnoreAuth { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/test/java/com/SpringbootSchemaApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringbootSchemaApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/service/ConfigService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service; 3 | 4 | import java.util.Map; 5 | 6 | import com.baomidou.mybatisplus.service.IService; 7 | import com.entity.ConfigEntity; 8 | import com.utils.PageUtils; 9 | 10 | 11 | /** 12 | * 系统用户 13 | */ 14 | public interface ConfigService extends IService { 15 | PageUtils queryPage(Map params); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/utils/MD5Util.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import cn.hutool.crypto.digest.DigestUtil; 4 | 5 | public class MD5Util { 6 | 7 | /** 8 | * @param text明文 9 | * @param key密钥 10 | * @return 密文 11 | */ 12 | // 带秘钥加密 13 | public static String md5(String text) { 14 | // 加密后的字符串 15 | String md5str = DigestUtil.md5Hex(text); 16 | return md5str; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/annotation/LoginUser.java: -------------------------------------------------------------------------------- 1 | package com.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 登录用户信息 10 | */ 11 | @Target(ElementType.PARAMETER) 12 | @Retention(RetentionPolicy.RUNTIME) 13 | public @interface LoginUser { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/annotation/APPLoginUser.java: -------------------------------------------------------------------------------- 1 | package com.annotation; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * 登录用户信息 10 | */ 11 | @Target(ElementType.PARAMETER) 12 | @Retention(RetentionPolicy.RUNTIME) 13 | public @interface APPLoginUser { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/resources/mapper/UserDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/resources/mapper/TokenDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /src/main/java/com/config/MybatisPlusConfig.java: -------------------------------------------------------------------------------- 1 | 2 | package com.config; 3 | 4 | import org.springframework.context.annotation.Bean; 5 | import org.springframework.context.annotation.Configuration; 6 | 7 | import com.baomidou.mybatisplus.mapper.MetaObjectHandler; 8 | import com.baomidou.mybatisplus.plugins.PaginationInterceptor; 9 | 10 | /** 11 | * mybatis-plus配置 12 | */ 13 | @Configuration 14 | public class MybatisPlusConfig { 15 | 16 | /** 17 | * 分页插件 18 | */ 19 | @Bean 20 | public PaginationInterceptor paginationInterceptor() { 21 | return new PaginationInterceptor(); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/service/CommonService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import java.util.List; 4 | import java.util.Map; 5 | 6 | public interface CommonService { 7 | List getOption(Map params); 8 | 9 | Map getFollowByOption(Map params); 10 | 11 | void sh(Map params); 12 | 13 | int remindCount(Map params); 14 | 15 | Map selectCal(Map params); 16 | 17 | List> selectGroup(Map params); 18 | 19 | List> selectValue(Map params); 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | 2 | package com.dao; 3 | 4 | import java.util.List; 5 | 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import com.baomidou.mybatisplus.mapper.BaseMapper; 9 | import com.baomidou.mybatisplus.mapper.Wrapper; 10 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 11 | import com.entity.UserEntity; 12 | 13 | /** 14 | * 用户 15 | */ 16 | public interface UserDao extends BaseMapper { 17 | 18 | List selectListView(@Param("ew") Wrapper wrapper); 19 | 20 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/ZichanfenleiVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.ZichanfenleiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 资产分类 15 | * 手机端接口返回实体辅助类 16 | * (主要作用去除一些不必要的字段) 17 | * @author 18 | * @email 19 | * @date 2021-05-11 09:16:46 20 | */ 21 | public class ZichanfenleiVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/utils/CommonUtil.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.util.Random; 4 | 5 | public class CommonUtil { 6 | /** 7 | * 获取随机字符串 8 | * 9 | * @param num 10 | * @return 11 | */ 12 | public static String getRandomString(Integer num) { 13 | String base = "abcdefghijklmnopqrstuvwxyz0123456789"; 14 | Random random = new Random(); 15 | StringBuffer sb = new StringBuffer(); 16 | for (int i = 0; i < num; i++) { 17 | int number = random.nextInt(base.length()); 18 | sb.append(base.charAt(number)); 19 | } 20 | return sb.toString(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/dao/TokenDao.java: -------------------------------------------------------------------------------- 1 | 2 | package com.dao; 3 | 4 | import java.util.List; 5 | 6 | import org.apache.ibatis.annotations.Param; 7 | 8 | import com.baomidou.mybatisplus.mapper.BaseMapper; 9 | import com.baomidou.mybatisplus.mapper.Wrapper; 10 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 11 | import com.entity.TokenEntity; 12 | 13 | /** 14 | * token 15 | */ 16 | public interface TokenDao extends BaseMapper { 17 | 18 | List selectListView(@Param("ew") Wrapper wrapper); 19 | 20 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/service/UserService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service; 3 | 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import org.apache.ibatis.annotations.Param; 8 | 9 | import com.baomidou.mybatisplus.mapper.Wrapper; 10 | import com.baomidou.mybatisplus.service.IService; 11 | import com.entity.UserEntity; 12 | import com.utils.PageUtils; 13 | 14 | 15 | /** 16 | * 系统用户 17 | */ 18 | public interface UserService extends IService { 19 | PageUtils queryPage(Map params); 20 | 21 | List selectListView(Wrapper wrapper); 22 | 23 | PageUtils queryPage(Map params,Wrapper wrapper); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/ZichanfenleiModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.ZichanfenleiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 资产分类 15 | * 接收传参的实体类 16 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 17 | * 取自ModelAndView 的model名称 18 | * @author 19 | * @email 20 | * @date 2021-05-11 09:16:46 21 | */ 22 | public class ZichanfenleiModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/dao/CommonDao.java: -------------------------------------------------------------------------------- 1 | 2 | package com.dao; 3 | 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | /** 8 | * 通用接口 9 | */ 10 | public interface CommonDao{ 11 | List getOption(Map params); 12 | 13 | Map getFollowByOption(Map params); 14 | 15 | List getFollowByOption2(Map params); 16 | 17 | void sh(Map params); 18 | 19 | int remindCount(Map params); 20 | 21 | Map selectCal(Map params); 22 | 23 | List> selectGroup(Map params); 24 | 25 | List> selectValue(Map params); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/utils/FileUtil.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.io.ByteArrayOutputStream; 4 | import java.io.File; 5 | import java.io.FileInputStream; 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | 9 | /** 10 | * 类说明 : 11 | */ 12 | 13 | public class FileUtil { 14 | public static byte[] FileToByte(File file) throws IOException { 15 | // 将数据转为流 16 | @SuppressWarnings("resource") 17 | InputStream content = new FileInputStream(file); 18 | ByteArrayOutputStream swapStream = new ByteArrayOutputStream(); 19 | byte[] buff = new byte[100]; 20 | int rc = 0; 21 | while ((rc = content.read(buff, 0, 100)) > 0) { 22 | swapStream.write(buff, 0, rc); 23 | } 24 | // 获得二进制数组 25 | return swapStream.toByteArray(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/service/TokenService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service; 3 | 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.service.IService; 9 | import com.entity.TokenEntity; 10 | import com.utils.PageUtils; 11 | 12 | 13 | /** 14 | * token 15 | */ 16 | public interface TokenService extends IService { 17 | PageUtils queryPage(Map params); 18 | 19 | List selectListView(Wrapper wrapper); 20 | 21 | PageUtils queryPage(Map params,Wrapper wrapper); 22 | 23 | String generateToken(Long userid,String username,String tableName, String role); 24 | 25 | TokenEntity getTokenEntity(String token); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/SpringbootSchemaApplication.java: -------------------------------------------------------------------------------- 1 | package com; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.builder.SpringApplicationBuilder; 7 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 8 | 9 | @SpringBootApplication 10 | @MapperScan(basePackages = {"com.dao"}) 11 | public class SpringbootSchemaApplication extends SpringBootServletInitializer{ 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(SpringbootSchemaApplication.class, args); 15 | } 16 | 17 | @Override 18 | protected SpringApplicationBuilder configure(SpringApplicationBuilder applicationBuilder) { 19 | return applicationBuilder.sources(SpringbootSchemaApplication.class); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/YonghuView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.YonghuEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 用户 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2021-05-11 09:16:46 19 | */ 20 | @TableName("yonghu") 21 | public class YonghuView extends YonghuEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public YonghuView(){ 25 | } 26 | 27 | public YonghuView(YonghuEntity yonghuEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, yonghuEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/utils/JQPageInfo.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | public class JQPageInfo{ 4 | private Integer page; 5 | 6 | private Integer limit; 7 | 8 | private String sidx; 9 | 10 | private String order; 11 | 12 | private Integer offset; 13 | 14 | public Integer getPage() { 15 | return page; 16 | } 17 | 18 | public void setPage(Integer page) { 19 | this.page = page; 20 | } 21 | 22 | public Integer getLimit() { 23 | return limit; 24 | } 25 | 26 | public void setLimit(Integer limit) { 27 | this.limit = limit; 28 | } 29 | 30 | public String getSidx() { 31 | return sidx; 32 | } 33 | 34 | public void setSidx(String sidx) { 35 | this.sidx = sidx; 36 | } 37 | 38 | public String getOrder() { 39 | return order; 40 | } 41 | 42 | public void setOrder(String order) { 43 | this.order = order; 44 | } 45 | 46 | public Integer getOffset() { 47 | return offset; 48 | } 49 | 50 | public void setOffset(Integer offset) { 51 | this.offset = offset; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/ZichanxinxiView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.ZichanxinxiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 资产信息 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2021-05-11 09:16:46 19 | */ 20 | @TableName("zichanxinxi") 21 | public class ZichanxinxiView extends ZichanxinxiEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public ZichanxinxiView(){ 25 | } 26 | 27 | public ZichanxinxiView(ZichanxinxiEntity zichanxinxiEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, zichanxinxiEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/ZichanfenleiView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.ZichanfenleiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 资产分类 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2021-05-11 09:16:46 19 | */ 20 | @TableName("zichanfenlei") 21 | public class ZichanfenleiView extends ZichanfenleiEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public ZichanfenleiView(){ 25 | } 26 | 27 | public ZichanfenleiView(ZichanfenleiEntity zichanfenleiEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, zichanfenleiEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/ZichanguihaiView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.ZichanguihaiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 资产归还 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2021-05-11 09:16:46 19 | */ 20 | @TableName("zichanguihai") 21 | public class ZichanguihaiView extends ZichanguihaiEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public ZichanguihaiView(){ 25 | } 26 | 27 | public ZichanguihaiView(ZichanguihaiEntity zichanguihaiEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, zichanguihaiEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/ZichanjiechuView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.ZichanjiechuEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 资产借出 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2021-05-11 09:16:46 19 | */ 20 | @TableName("zichanjiechu") 21 | public class ZichanjiechuView extends ZichanjiechuEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public ZichanjiechuView(){ 25 | } 26 | 27 | public ZichanjiechuView(ZichanjiechuEntity zichanjiechuEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, zichanjiechuEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/entity/view/ZichanweixiuView.java: -------------------------------------------------------------------------------- 1 | package com.entity.view; 2 | 3 | import com.entity.ZichanweixiuEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import org.apache.commons.beanutils.BeanUtils; 7 | import java.lang.reflect.InvocationTargetException; 8 | 9 | import java.io.Serializable; 10 | 11 | 12 | /** 13 | * 资产维修 14 | * 后端返回视图实体辅助类 15 | * (通常后端关联的表或者自定义的字段需要返回使用) 16 | * @author 17 | * @email 18 | * @date 2021-05-11 09:16:46 19 | */ 20 | @TableName("zichanweixiu") 21 | public class ZichanweixiuView extends ZichanweixiuEntity implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | public ZichanweixiuView(){ 25 | } 26 | 27 | public ZichanweixiuView(ZichanweixiuEntity zichanweixiuEntity){ 28 | try { 29 | BeanUtils.copyProperties(this, zichanweixiuEntity); 30 | } catch (IllegalAccessException | InvocationTargetException e) { 31 | // TODO Auto-generated catch block 32 | e.printStackTrace(); 33 | } 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/dao/YonghuDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.YonghuEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import com.baomidou.mybatisplus.mapper.Wrapper; 7 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 8 | 9 | import org.apache.ibatis.annotations.Param; 10 | import com.entity.vo.YonghuVO; 11 | import com.entity.view.YonghuView; 12 | 13 | 14 | /** 15 | * 用户 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-05-11 09:16:46 20 | */ 21 | public interface YonghuDao extends BaseMapper { 22 | 23 | List selectListVO(@Param("ew") Wrapper wrapper); 24 | 25 | YonghuVO selectVO(@Param("ew") Wrapper wrapper); 26 | 27 | List selectListView(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 30 | 31 | YonghuView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/ConfigServiceImpl.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service.impl; 3 | 4 | 5 | import java.util.Map; 6 | 7 | import org.springframework.stereotype.Service; 8 | 9 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 10 | import com.baomidou.mybatisplus.plugins.Page; 11 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 12 | import com.dao.ConfigDao; 13 | import com.entity.ConfigEntity; 14 | import com.entity.UserEntity; 15 | import com.service.ConfigService; 16 | import com.utils.PageUtils; 17 | import com.utils.Query; 18 | 19 | 20 | /** 21 | * 系统用户 22 | */ 23 | @Service("configService") 24 | public class ConfigServiceImpl extends ServiceImpl implements ConfigService { 25 | @Override 26 | public PageUtils queryPage(Map params) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | new EntityWrapper() 30 | ); 31 | return new PageUtils(page); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/entity/EIException.java: -------------------------------------------------------------------------------- 1 | 2 | package com.entity; 3 | 4 | /** 5 | * 自定义异常 6 | */ 7 | public class EIException extends RuntimeException { 8 | private static final long serialVersionUID = 1L; 9 | 10 | private String msg; 11 | private int code = 500; 12 | 13 | public EIException(String msg) { 14 | super(msg); 15 | this.msg = msg; 16 | } 17 | 18 | public EIException(String msg, Throwable e) { 19 | super(msg, e); 20 | this.msg = msg; 21 | } 22 | 23 | public EIException(String msg, int code) { 24 | super(msg); 25 | this.msg = msg; 26 | this.code = code; 27 | } 28 | 29 | public EIException(String msg, int code, Throwable e) { 30 | super(msg, e); 31 | this.msg = msg; 32 | this.code = code; 33 | } 34 | 35 | public String getMsg() { 36 | return msg; 37 | } 38 | 39 | public void setMsg(String msg) { 40 | this.msg = msg; 41 | } 42 | 43 | public int getCode() { 44 | return code; 45 | } 46 | 47 | public void setCode(int code) { 48 | this.code = code; 49 | } 50 | 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/utils/R.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | /** 7 | * 返回数据 8 | */ 9 | public class R extends HashMap { 10 | private static final long serialVersionUID = 1L; 11 | 12 | public R() { 13 | put("code", 0); 14 | } 15 | 16 | public static R error() { 17 | return error(500, "未知异常,请联系管理员"); 18 | } 19 | 20 | public static R error(String msg) { 21 | return error(500, msg); 22 | } 23 | 24 | public static R error(int code, String msg) { 25 | R r = new R(); 26 | r.put("code", code); 27 | r.put("msg", msg); 28 | return r; 29 | } 30 | 31 | public static R ok(String msg) { 32 | R r = new R(); 33 | r.put("msg", msg); 34 | return r; 35 | } 36 | 37 | public static R ok(Map map) { 38 | R r = new R(); 39 | r.putAll(map); 40 | return r; 41 | } 42 | 43 | public static R ok() { 44 | return new R(); 45 | } 46 | 47 | public R put(String key, Object value) { 48 | super.put(key, value); 49 | return this; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/entity/ConfigEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableId; 6 | import com.baomidou.mybatisplus.annotations.TableName; 7 | import com.baomidou.mybatisplus.enums.IdType; 8 | 9 | /** 10 | * 类说明 : 11 | */ 12 | @TableName("config") 13 | public class ConfigEntity implements Serializable{ 14 | private static final long serialVersionUID = 1L; 15 | 16 | @TableId(type = IdType.AUTO) 17 | private Long id; 18 | 19 | /** 20 | * key 21 | */ 22 | private String name; 23 | 24 | /** 25 | * value 26 | */ 27 | private String value; 28 | 29 | public Long getId() { 30 | return id; 31 | } 32 | 33 | public void setId(Long id) { 34 | this.id = id; 35 | } 36 | 37 | public String getName() { 38 | return name; 39 | } 40 | 41 | public void setName(String name) { 42 | this.name = name; 43 | } 44 | 45 | public String getValue() { 46 | return value; 47 | } 48 | 49 | public void setValue(String value) { 50 | this.value = value; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/service/YonghuService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.mapper.Wrapper; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.utils.PageUtils; 6 | import com.entity.YonghuEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.YonghuVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.YonghuView; 12 | 13 | 14 | /** 15 | * 用户 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-05-11 09:16:46 20 | */ 21 | public interface YonghuService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | YonghuVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | YonghuView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/main/java/com/dao/ZichanxinxiDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.ZichanxinxiEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import com.baomidou.mybatisplus.mapper.Wrapper; 7 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 8 | 9 | import org.apache.ibatis.annotations.Param; 10 | import com.entity.vo.ZichanxinxiVO; 11 | import com.entity.view.ZichanxinxiView; 12 | 13 | 14 | /** 15 | * 资产信息 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-05-11 09:16:46 20 | */ 21 | public interface ZichanxinxiDao extends BaseMapper { 22 | 23 | List selectListVO(@Param("ew") Wrapper wrapper); 24 | 25 | ZichanxinxiVO selectVO(@Param("ew") Wrapper wrapper); 26 | 27 | List selectListView(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 30 | 31 | ZichanxinxiView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/dao/ZichanfenleiDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.ZichanfenleiEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import com.baomidou.mybatisplus.mapper.Wrapper; 7 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 8 | 9 | import org.apache.ibatis.annotations.Param; 10 | import com.entity.vo.ZichanfenleiVO; 11 | import com.entity.view.ZichanfenleiView; 12 | 13 | 14 | /** 15 | * 资产分类 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-05-11 09:16:46 20 | */ 21 | public interface ZichanfenleiDao extends BaseMapper { 22 | 23 | List selectListVO(@Param("ew") Wrapper wrapper); 24 | 25 | ZichanfenleiVO selectVO(@Param("ew") Wrapper wrapper); 26 | 27 | List selectListView(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 30 | 31 | ZichanfenleiView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/dao/ZichanguihaiDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.ZichanguihaiEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import com.baomidou.mybatisplus.mapper.Wrapper; 7 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 8 | 9 | import org.apache.ibatis.annotations.Param; 10 | import com.entity.vo.ZichanguihaiVO; 11 | import com.entity.view.ZichanguihaiView; 12 | 13 | 14 | /** 15 | * 资产归还 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-05-11 09:16:46 20 | */ 21 | public interface ZichanguihaiDao extends BaseMapper { 22 | 23 | List selectListVO(@Param("ew") Wrapper wrapper); 24 | 25 | ZichanguihaiVO selectVO(@Param("ew") Wrapper wrapper); 26 | 27 | List selectListView(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 30 | 31 | ZichanguihaiView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/dao/ZichanjiechuDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.ZichanjiechuEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import com.baomidou.mybatisplus.mapper.Wrapper; 7 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 8 | 9 | import org.apache.ibatis.annotations.Param; 10 | import com.entity.vo.ZichanjiechuVO; 11 | import com.entity.view.ZichanjiechuView; 12 | 13 | 14 | /** 15 | * 资产借出 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-05-11 09:16:46 20 | */ 21 | public interface ZichanjiechuDao extends BaseMapper { 22 | 23 | List selectListVO(@Param("ew") Wrapper wrapper); 24 | 25 | ZichanjiechuVO selectVO(@Param("ew") Wrapper wrapper); 26 | 27 | List selectListView(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 30 | 31 | ZichanjiechuView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/dao/ZichanweixiuDao.java: -------------------------------------------------------------------------------- 1 | package com.dao; 2 | 3 | import com.entity.ZichanweixiuEntity; 4 | import com.baomidou.mybatisplus.mapper.BaseMapper; 5 | import java.util.List; 6 | import com.baomidou.mybatisplus.mapper.Wrapper; 7 | import com.baomidou.mybatisplus.plugins.pagination.Pagination; 8 | 9 | import org.apache.ibatis.annotations.Param; 10 | import com.entity.vo.ZichanweixiuVO; 11 | import com.entity.view.ZichanweixiuView; 12 | 13 | 14 | /** 15 | * 资产维修 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-05-11 09:16:46 20 | */ 21 | public interface ZichanweixiuDao extends BaseMapper { 22 | 23 | List selectListVO(@Param("ew") Wrapper wrapper); 24 | 25 | ZichanweixiuVO selectVO(@Param("ew") Wrapper wrapper); 26 | 27 | List selectListView(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Pagination page,@Param("ew") Wrapper wrapper); 30 | 31 | ZichanweixiuView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/utils/SQLFilter.java: -------------------------------------------------------------------------------- 1 | 2 | package com.utils; 3 | 4 | import org.apache.commons.lang3.StringUtils; 5 | 6 | import com.entity.EIException; 7 | 8 | /** 9 | * SQL过滤 10 | */ 11 | public class SQLFilter { 12 | 13 | /** 14 | * SQL注入过滤 15 | * @param str 待验证的字符串 16 | */ 17 | public static String sqlInject(String str){ 18 | if(StringUtils.isBlank(str)){ 19 | return null; 20 | } 21 | //去掉'|"|;|\字符 22 | str = StringUtils.replace(str, "'", ""); 23 | str = StringUtils.replace(str, "\"", ""); 24 | str = StringUtils.replace(str, ";", ""); 25 | str = StringUtils.replace(str, "\\", ""); 26 | 27 | //转换成小写 28 | str = str.toLowerCase(); 29 | 30 | //非法字符 31 | String[] keywords = {"master", "truncate", "insert", "select", "delete", "update", "declare", "alter", "drop"}; 32 | 33 | //判断是否包含非法字符 34 | for(String keyword : keywords){ 35 | if(str.indexOf(keyword) != -1){ 36 | throw new EIException("包含非法字符"); 37 | } 38 | } 39 | 40 | return str; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/service/ZichanxinxiService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.mapper.Wrapper; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.utils.PageUtils; 6 | import com.entity.ZichanxinxiEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.ZichanxinxiVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.ZichanxinxiView; 12 | 13 | 14 | /** 15 | * 资产信息 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-05-11 09:16:46 20 | */ 21 | public interface ZichanxinxiService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | ZichanxinxiVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | ZichanxinxiView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/main/java/com/utils/HttpClientUtils.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.InputStreamReader; 5 | import java.net.HttpURLConnection; 6 | import java.net.URL; 7 | 8 | 9 | /** 10 | * HttpClient工具类 11 | */ 12 | public class HttpClientUtils { 13 | 14 | /** 15 | * @param uri 16 | * @return String 17 | * @description get请求方式 18 | * @author: long.he01 19 | */ 20 | public static String doGet(String uri) { 21 | 22 | StringBuilder result = new StringBuilder(); 23 | try { 24 | String res = ""; 25 | URL url = new URL(uri); 26 | HttpURLConnection conn = (HttpURLConnection) url.openConnection(); 27 | BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); 28 | String line; 29 | while ((line = in.readLine()) != null) { 30 | res += line+"\n"; 31 | } 32 | in.close(); 33 | return res; 34 | }catch (Exception e) { 35 | e.printStackTrace(); 36 | return null; 37 | } 38 | 39 | } 40 | 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/main/java/com/service/ZichanfenleiService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.mapper.Wrapper; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.utils.PageUtils; 6 | import com.entity.ZichanfenleiEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.ZichanfenleiVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.ZichanfenleiView; 12 | 13 | 14 | /** 15 | * 资产分类 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-05-11 09:16:46 20 | */ 21 | public interface ZichanfenleiService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | ZichanfenleiVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | ZichanfenleiView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/main/java/com/service/ZichanguihaiService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.mapper.Wrapper; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.utils.PageUtils; 6 | import com.entity.ZichanguihaiEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.ZichanguihaiVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.ZichanguihaiView; 12 | 13 | 14 | /** 15 | * 资产归还 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-05-11 09:16:46 20 | */ 21 | public interface ZichanguihaiService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | ZichanguihaiVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | ZichanguihaiView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/main/java/com/service/ZichanjiechuService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.mapper.Wrapper; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.utils.PageUtils; 6 | import com.entity.ZichanjiechuEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.ZichanjiechuVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.ZichanjiechuView; 12 | 13 | 14 | /** 15 | * 资产借出 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-05-11 09:16:46 20 | */ 21 | public interface ZichanjiechuService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | ZichanjiechuVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | ZichanjiechuView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/main/java/com/service/ZichanweixiuService.java: -------------------------------------------------------------------------------- 1 | package com.service; 2 | 3 | import com.baomidou.mybatisplus.mapper.Wrapper; 4 | import com.baomidou.mybatisplus.service.IService; 5 | import com.utils.PageUtils; 6 | import com.entity.ZichanweixiuEntity; 7 | import java.util.List; 8 | import java.util.Map; 9 | import com.entity.vo.ZichanweixiuVO; 10 | import org.apache.ibatis.annotations.Param; 11 | import com.entity.view.ZichanweixiuView; 12 | 13 | 14 | /** 15 | * 资产维修 16 | * 17 | * @author 18 | * @email 19 | * @date 2021-05-11 09:16:46 20 | */ 21 | public interface ZichanweixiuService extends IService { 22 | 23 | PageUtils queryPage(Map params); 24 | 25 | List selectListVO(Wrapper wrapper); 26 | 27 | ZichanweixiuVO selectVO(@Param("ew") Wrapper wrapper); 28 | 29 | List selectListView(Wrapper wrapper); 30 | 31 | ZichanweixiuView selectView(@Param("ew") Wrapper wrapper); 32 | 33 | PageUtils queryPage(Map params,Wrapper wrapper); 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /src/main/java/com/utils/ValidatorUtils.java: -------------------------------------------------------------------------------- 1 | 2 | package com.utils; 3 | 4 | 5 | import java.util.Set; 6 | 7 | import javax.validation.ConstraintViolation; 8 | import javax.validation.Validation; 9 | import javax.validation.Validator; 10 | 11 | import com.entity.EIException; 12 | 13 | /** 14 | * hibernate-validator校验工具类 15 | */ 16 | public class ValidatorUtils { 17 | private static Validator validator; 18 | 19 | static { 20 | validator = Validation.buildDefaultValidatorFactory().getValidator(); 21 | } 22 | 23 | /** 24 | * 校验对象 25 | * @param object 待校验对象 26 | * @param groups 待校验的组 27 | * @throws EIException 校验不通过,则报EIException异常 28 | */ 29 | public static void validateEntity(Object object, Class... groups) 30 | throws EIException { 31 | Set> constraintViolations = validator.validate(object, groups); 32 | if (!constraintViolations.isEmpty()) { 33 | ConstraintViolation constraint = (ConstraintViolation)constraintViolations.iterator().next(); 34 | throw new EIException(constraint.getMessage()); 35 | } 36 | } 37 | 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/resources/mapper/ZichanfenleiDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 16 | 17 | 22 | 23 | 29 | 30 | 34 | 35 | -------------------------------------------------------------------------------- /src/main/java/com/utils/SpringContextUtils.java: -------------------------------------------------------------------------------- 1 | 2 | package com.utils; 3 | 4 | import org.springframework.beans.BeansException; 5 | import org.springframework.context.ApplicationContext; 6 | import org.springframework.context.ApplicationContextAware; 7 | import org.springframework.stereotype.Component; 8 | 9 | 10 | /** 11 | * Spring Context 工具类 12 | */ 13 | @Component 14 | public class SpringContextUtils implements ApplicationContextAware { 15 | public static ApplicationContext applicationContext; 16 | 17 | @Override 18 | public void setApplicationContext(ApplicationContext applicationContext) 19 | throws BeansException { 20 | SpringContextUtils.applicationContext = applicationContext; 21 | } 22 | 23 | public static Object getBean(String name) { 24 | return applicationContext.getBean(name); 25 | } 26 | 27 | public static T getBean(String name, Class requiredType) { 28 | return applicationContext.getBean(name, requiredType); 29 | } 30 | 31 | public static boolean containsBean(String name) { 32 | return applicationContext.containsBean(name); 33 | } 34 | 35 | public static boolean isSingleton(String name) { 36 | return applicationContext.isSingleton(name); 37 | } 38 | 39 | public static Class getType(String name) { 40 | return applicationContext.getType(name); 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 基于SpringBoot的企业资产管理系统(程序+论文) 2 | = 3 | - 完整代码获取地址:从戎源码网 ([https://armycodes.com/](https://armycodes.com/)) 4 | - 作者微信:19941326836 QQ:952045282 5 | - 承接计算机毕业设计、Java毕业设计、Python毕业设计、深度学习、机器学习 6 | - 选题+开题报告+任务书+程序定制+安装调试+论文+答辩ppt 一条龙服务 7 | - 所有选题地址https://github.com/nature924/allProject 8 | 9 | 一、项目介绍 10 | --- 11 | 基于Spring Boot框架实现的企业资产管理系统,系统包含两种角色:管理员、用户,系统分为前台和后台两大模块,主要功能如下。 12 | ### 管理员: 13 | 14 | - 个人中心:管理员可以管理个人信息。 15 | - 用户管理:管理员可以管理用户信息, 16 | - 资产分类管理:管理员可以管理资产分类信息, 17 | - 资产信息管理:管理员可以管理资产信息 18 | - 资产借出管理:管理员可以管理资产借出记录, 19 | - 资产归还管理:管理员可以管理资产归还记录, 20 | - 资产维修管理:管理员可以管理资产维修记录, 21 | 22 | ### 用户: 23 | 24 | - 个人中心:用户可以管理个人信息。 25 | - 资产信息管理:用户可以查看、搜索和浏览资产信息。 26 | - 资产借出管理:用户可以申请借出资产,查看借出记录和管理已借出的资产。 27 | - 资产归还管理:用户可以申请归还资产,查看归还记录和管理已归还的资产。 28 | 29 | 30 | 31 | 32 | 33 | 二、项目技术 34 | --- 35 | - 编程语言:Java 36 | - 数据库:MySQL 37 | - 项目管理工具:Maven 38 | - 前端技术:VUE、HTML、Jquery、Bootstrap 39 | - 后端技术:Spring、SpringMVC、MyBatis 40 | 41 | 三、运行环境 42 | --- 43 | - 操作系统:Windows、macOS都可以 44 | - JDK版本:JDK1.8以上都可以 45 | - 开发工具:IDEA、Ecplise、Myecplise都可以 46 | - 数据库: MySQL5.7以上都可以 47 | - Tomcat:任意版本都可以 48 | - Maven:任意版本都可以 49 | 50 | 四、运行截图 51 | --- 52 | ### 论文截图: 53 | ![image/1.png](limage/1.png) 54 | ![image/1.png](limage/2.png) 55 | 56 | ### 程序截图: 57 | ![image/1.png](image/1.png) 58 | ![image/1.png](image/2.png) 59 | ![image/1.png](image/3.png) 60 | ![image/1.png](image/4.png) 61 | ![image/1.png](image/5.png) 62 | ![image/1.png](image/6.png) 63 | ![image/1.png](image/7.png) 64 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/CommonServiceImpl.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service.impl; 3 | 4 | 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Service; 10 | 11 | import com.dao.CommonDao; 12 | import com.service.CommonService; 13 | 14 | 15 | /** 16 | * 系统用户 17 | */ 18 | @Service("commonService") 19 | public class CommonServiceImpl implements CommonService { 20 | 21 | @Autowired 22 | private CommonDao commonDao; 23 | 24 | @Override 25 | public List getOption(Map params) { 26 | return commonDao.getOption(params); 27 | } 28 | 29 | @Override 30 | public Map getFollowByOption(Map params) { 31 | return commonDao.getFollowByOption(params); 32 | } 33 | 34 | @Override 35 | public void sh(Map params) { 36 | commonDao.sh(params); 37 | } 38 | 39 | @Override 40 | public int remindCount(Map params) { 41 | return commonDao.remindCount(params); 42 | } 43 | 44 | @Override 45 | public Map selectCal(Map params) { 46 | return commonDao.selectCal(params); 47 | } 48 | 49 | @Override 50 | public List> selectGroup(Map params) { 51 | return commonDao.selectGroup(params); 52 | } 53 | 54 | @Override 55 | public List> selectValue(Map params) { 56 | return commonDao.selectValue(params); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/entity/UserEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | 6 | import com.baomidou.mybatisplus.annotations.TableId; 7 | import com.baomidou.mybatisplus.annotations.TableName; 8 | import com.baomidou.mybatisplus.enums.IdType; 9 | 10 | /** 11 | * 用户 12 | */ 13 | @TableName("users") 14 | public class UserEntity implements Serializable { 15 | private static final long serialVersionUID = 1L; 16 | 17 | @TableId(type = IdType.AUTO) 18 | private Long id; 19 | 20 | /** 21 | * 用户账号 22 | */ 23 | private String username; 24 | 25 | /** 26 | * 密码 27 | */ 28 | private String password; 29 | 30 | /** 31 | * 用户类型 32 | */ 33 | private String role; 34 | 35 | private Date addtime; 36 | 37 | public String getUsername() { 38 | return username; 39 | } 40 | 41 | public void setUsername(String username) { 42 | this.username = username; 43 | } 44 | 45 | public String getPassword() { 46 | return password; 47 | } 48 | 49 | public void setPassword(String password) { 50 | this.password = password; 51 | } 52 | 53 | public String getRole() { 54 | return role; 55 | } 56 | 57 | public void setRole(String role) { 58 | this.role = role; 59 | } 60 | 61 | public Date getAddtime() { 62 | return addtime; 63 | } 64 | 65 | public void setAddtime(Date addtime) { 66 | this.addtime = addtime; 67 | } 68 | 69 | public Long getId() { 70 | return id; 71 | } 72 | 73 | public void setId(Long id) { 74 | this.id = id; 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service.impl; 3 | 4 | 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import org.springframework.stereotype.Service; 9 | 10 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 11 | import com.baomidou.mybatisplus.mapper.Wrapper; 12 | import com.baomidou.mybatisplus.plugins.Page; 13 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 14 | import com.dao.UserDao; 15 | import com.entity.UserEntity; 16 | import com.service.UserService; 17 | import com.utils.PageUtils; 18 | import com.utils.Query; 19 | 20 | 21 | /** 22 | * 系统用户 23 | */ 24 | @Service("userService") 25 | public class UserServiceImpl extends ServiceImpl implements UserService { 26 | 27 | @Override 28 | public PageUtils queryPage(Map params) { 29 | Page page = this.selectPage( 30 | new Query(params).getPage(), 31 | new EntityWrapper() 32 | ); 33 | return new PageUtils(page); 34 | } 35 | 36 | @Override 37 | public List selectListView(Wrapper wrapper) { 38 | return baseMapper.selectListView(wrapper); 39 | } 40 | 41 | @Override 42 | public PageUtils queryPage(Map params, 43 | Wrapper wrapper) { 44 | Page page =new Query(params).getPage(); 45 | page.setRecords(baseMapper.selectListView(page,wrapper)); 46 | PageUtils pageUtil = new PageUtils(page); 47 | return pageUtil; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/config/InterceptorConfig.java: -------------------------------------------------------------------------------- 1 | package com.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 6 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; 7 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; 8 | 9 | import com.interceptor.AuthorizationInterceptor; 10 | 11 | @Configuration 12 | public class InterceptorConfig extends WebMvcConfigurationSupport{ 13 | 14 | @Bean 15 | public AuthorizationInterceptor getAuthorizationInterceptor() { 16 | return new AuthorizationInterceptor(); 17 | } 18 | 19 | @Override 20 | public void addInterceptors(InterceptorRegistry registry) { 21 | registry.addInterceptor(getAuthorizationInterceptor()).addPathPatterns("/**").excludePathPatterns("/static/**"); 22 | super.addInterceptors(registry); 23 | } 24 | 25 | /** 26 | * springboot 2.0配置WebMvcConfigurationSupport之后,会导致默认配置被覆盖,要访问静态资源需要重写addResourceHandlers方法 27 | */ 28 | @Override 29 | public void addResourceHandlers(ResourceHandlerRegistry registry) { 30 | registry.addResourceHandler("/**") 31 | .addResourceLocations("classpath:/resources/") 32 | .addResourceLocations("classpath:/static/") 33 | .addResourceLocations("classpath:/admin/") 34 | .addResourceLocations("classpath:/front/") 35 | .addResourceLocations("classpath:/public/"); 36 | super.addResourceHandlers(registry); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/resources/mapper/ZichanxinxiDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | 28 | 29 | 35 | 36 | 40 | 41 | -------------------------------------------------------------------------------- /src/main/resources/mapper/YonghuDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 25 | 26 | 31 | 32 | 38 | 39 | 43 | 44 | -------------------------------------------------------------------------------- /src/main/resources/mapper/ZichanweixiuDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | 28 | 29 | 35 | 36 | 40 | 41 | -------------------------------------------------------------------------------- /src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # Tomcat 2 | server: 3 | tomcat: 4 | uri-encoding: UTF-8 5 | port: 8080 6 | servlet: 7 | context-path: /springboot4j9k2 8 | 9 | spring: 10 | datasource: 11 | driverClassName: com.mysql.cj.jdbc.Driver 12 | url: jdbc:mysql://127.0.0.1:3306/springboot4j9k2?useUnicode=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8 13 | username: root 14 | password: 123456 15 | 16 | # driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver 17 | # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=springboot4j9k2 18 | # username: sa 19 | # password: 123456 20 | 21 | servlet: 22 | multipart: 23 | max-file-size: 10MB 24 | max-request-size: 10MB 25 | resources: 26 | static-locations: classpath:static/,file:static/ 27 | 28 | #mybatis 29 | mybatis-plus: 30 | mapper-locations: classpath*:mapper/*.xml 31 | #实体扫描,多个package用逗号或者分号分隔 32 | typeAliasesPackage: com.entity 33 | global-config: 34 | #主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID"; 35 | id-type: 1 36 | #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断" 37 | field-strategy: 2 38 | #驼峰下划线转换 39 | db-column-underline: true 40 | #刷新mapper 调试神器 41 | refresh-mapper: true 42 | #逻辑删除配置 43 | logic-delete-value: -1 44 | logic-not-delete-value: 0 45 | #自定义SQL注入器 46 | sql-injector: com.baomidou.mybatisplus.mapper.LogicSqlInjector 47 | configuration: 48 | map-underscore-to-camel-case: true 49 | cache-enabled: false 50 | call-setters-on-nulls: true 51 | #springboot 项目mybatis plus 设置 jdbcTypeForNull (oracle数据库需配置JdbcType.NULL, 默认是Other) 52 | jdbc-type-for-null: 'null' 53 | -------------------------------------------------------------------------------- /src/main/resources/mapper/CommonDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 19 | 20 | 21 | UPDATE ${table} set sfsh=#{sfsh} where id=#{id} 22 | 23 | 24 | 44 | 45 | 48 | 49 | 52 | 53 | 56 | 57 | -------------------------------------------------------------------------------- /src/main/resources/mapper/ZichanguihaiDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 28 | 29 | 34 | 35 | 41 | 42 | 46 | 47 | -------------------------------------------------------------------------------- /src/main/resources/mapper/ZichanjiechuDao.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 28 | 29 | 34 | 35 | 41 | 42 | 46 | 47 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/YonghuServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | import java.util.Map; 5 | import java.util.List; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 9 | import com.baomidou.mybatisplus.plugins.Page; 10 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 11 | import com.utils.PageUtils; 12 | import com.utils.Query; 13 | 14 | 15 | import com.dao.YonghuDao; 16 | import com.entity.YonghuEntity; 17 | import com.service.YonghuService; 18 | import com.entity.vo.YonghuVO; 19 | import com.entity.view.YonghuView; 20 | 21 | @Service("yonghuService") 22 | public class YonghuServiceImpl extends ServiceImpl implements YonghuService { 23 | 24 | 25 | @Override 26 | public PageUtils queryPage(Map params) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | new EntityWrapper() 30 | ); 31 | return new PageUtils(page); 32 | } 33 | 34 | @Override 35 | public PageUtils queryPage(Map params, Wrapper wrapper) { 36 | Page page =new Query(params).getPage(); 37 | page.setRecords(baseMapper.selectListView(page,wrapper)); 38 | PageUtils pageUtil = new PageUtils(page); 39 | return pageUtil; 40 | } 41 | 42 | @Override 43 | public List selectListVO(Wrapper wrapper) { 44 | return baseMapper.selectListVO(wrapper); 45 | } 46 | 47 | @Override 48 | public YonghuVO selectVO(Wrapper wrapper) { 49 | return baseMapper.selectVO(wrapper); 50 | } 51 | 52 | @Override 53 | public List selectListView(Wrapper wrapper) { 54 | return baseMapper.selectListView(wrapper); 55 | } 56 | 57 | @Override 58 | public YonghuView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/ZichanxinxiServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | import java.util.Map; 5 | import java.util.List; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 9 | import com.baomidou.mybatisplus.plugins.Page; 10 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 11 | import com.utils.PageUtils; 12 | import com.utils.Query; 13 | 14 | 15 | import com.dao.ZichanxinxiDao; 16 | import com.entity.ZichanxinxiEntity; 17 | import com.service.ZichanxinxiService; 18 | import com.entity.vo.ZichanxinxiVO; 19 | import com.entity.view.ZichanxinxiView; 20 | 21 | @Service("zichanxinxiService") 22 | public class ZichanxinxiServiceImpl extends ServiceImpl implements ZichanxinxiService { 23 | 24 | 25 | @Override 26 | public PageUtils queryPage(Map params) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | new EntityWrapper() 30 | ); 31 | return new PageUtils(page); 32 | } 33 | 34 | @Override 35 | public PageUtils queryPage(Map params, Wrapper wrapper) { 36 | Page page =new Query(params).getPage(); 37 | page.setRecords(baseMapper.selectListView(page,wrapper)); 38 | PageUtils pageUtil = new PageUtils(page); 39 | return pageUtil; 40 | } 41 | 42 | @Override 43 | public List selectListVO(Wrapper wrapper) { 44 | return baseMapper.selectListVO(wrapper); 45 | } 46 | 47 | @Override 48 | public ZichanxinxiVO selectVO(Wrapper wrapper) { 49 | return baseMapper.selectVO(wrapper); 50 | } 51 | 52 | @Override 53 | public List selectListView(Wrapper wrapper) { 54 | return baseMapper.selectListView(wrapper); 55 | } 56 | 57 | @Override 58 | public ZichanxinxiView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/ZichanfenleiServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | import java.util.Map; 5 | import java.util.List; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 9 | import com.baomidou.mybatisplus.plugins.Page; 10 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 11 | import com.utils.PageUtils; 12 | import com.utils.Query; 13 | 14 | 15 | import com.dao.ZichanfenleiDao; 16 | import com.entity.ZichanfenleiEntity; 17 | import com.service.ZichanfenleiService; 18 | import com.entity.vo.ZichanfenleiVO; 19 | import com.entity.view.ZichanfenleiView; 20 | 21 | @Service("zichanfenleiService") 22 | public class ZichanfenleiServiceImpl extends ServiceImpl implements ZichanfenleiService { 23 | 24 | 25 | @Override 26 | public PageUtils queryPage(Map params) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | new EntityWrapper() 30 | ); 31 | return new PageUtils(page); 32 | } 33 | 34 | @Override 35 | public PageUtils queryPage(Map params, Wrapper wrapper) { 36 | Page page =new Query(params).getPage(); 37 | page.setRecords(baseMapper.selectListView(page,wrapper)); 38 | PageUtils pageUtil = new PageUtils(page); 39 | return pageUtil; 40 | } 41 | 42 | @Override 43 | public List selectListVO(Wrapper wrapper) { 44 | return baseMapper.selectListVO(wrapper); 45 | } 46 | 47 | @Override 48 | public ZichanfenleiVO selectVO(Wrapper wrapper) { 49 | return baseMapper.selectVO(wrapper); 50 | } 51 | 52 | @Override 53 | public List selectListView(Wrapper wrapper) { 54 | return baseMapper.selectListView(wrapper); 55 | } 56 | 57 | @Override 58 | public ZichanfenleiView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/ZichanguihaiServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | import java.util.Map; 5 | import java.util.List; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 9 | import com.baomidou.mybatisplus.plugins.Page; 10 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 11 | import com.utils.PageUtils; 12 | import com.utils.Query; 13 | 14 | 15 | import com.dao.ZichanguihaiDao; 16 | import com.entity.ZichanguihaiEntity; 17 | import com.service.ZichanguihaiService; 18 | import com.entity.vo.ZichanguihaiVO; 19 | import com.entity.view.ZichanguihaiView; 20 | 21 | @Service("zichanguihaiService") 22 | public class ZichanguihaiServiceImpl extends ServiceImpl implements ZichanguihaiService { 23 | 24 | 25 | @Override 26 | public PageUtils queryPage(Map params) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | new EntityWrapper() 30 | ); 31 | return new PageUtils(page); 32 | } 33 | 34 | @Override 35 | public PageUtils queryPage(Map params, Wrapper wrapper) { 36 | Page page =new Query(params).getPage(); 37 | page.setRecords(baseMapper.selectListView(page,wrapper)); 38 | PageUtils pageUtil = new PageUtils(page); 39 | return pageUtil; 40 | } 41 | 42 | @Override 43 | public List selectListVO(Wrapper wrapper) { 44 | return baseMapper.selectListVO(wrapper); 45 | } 46 | 47 | @Override 48 | public ZichanguihaiVO selectVO(Wrapper wrapper) { 49 | return baseMapper.selectVO(wrapper); 50 | } 51 | 52 | @Override 53 | public List selectListView(Wrapper wrapper) { 54 | return baseMapper.selectListView(wrapper); 55 | } 56 | 57 | @Override 58 | public ZichanguihaiView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/ZichanjiechuServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | import java.util.Map; 5 | import java.util.List; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 9 | import com.baomidou.mybatisplus.plugins.Page; 10 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 11 | import com.utils.PageUtils; 12 | import com.utils.Query; 13 | 14 | 15 | import com.dao.ZichanjiechuDao; 16 | import com.entity.ZichanjiechuEntity; 17 | import com.service.ZichanjiechuService; 18 | import com.entity.vo.ZichanjiechuVO; 19 | import com.entity.view.ZichanjiechuView; 20 | 21 | @Service("zichanjiechuService") 22 | public class ZichanjiechuServiceImpl extends ServiceImpl implements ZichanjiechuService { 23 | 24 | 25 | @Override 26 | public PageUtils queryPage(Map params) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | new EntityWrapper() 30 | ); 31 | return new PageUtils(page); 32 | } 33 | 34 | @Override 35 | public PageUtils queryPage(Map params, Wrapper wrapper) { 36 | Page page =new Query(params).getPage(); 37 | page.setRecords(baseMapper.selectListView(page,wrapper)); 38 | PageUtils pageUtil = new PageUtils(page); 39 | return pageUtil; 40 | } 41 | 42 | @Override 43 | public List selectListVO(Wrapper wrapper) { 44 | return baseMapper.selectListVO(wrapper); 45 | } 46 | 47 | @Override 48 | public ZichanjiechuVO selectVO(Wrapper wrapper) { 49 | return baseMapper.selectVO(wrapper); 50 | } 51 | 52 | @Override 53 | public List selectListView(Wrapper wrapper) { 54 | return baseMapper.selectListView(wrapper); 55 | } 56 | 57 | @Override 58 | public ZichanjiechuView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/ZichanweixiuServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.service.impl; 2 | 3 | import org.springframework.stereotype.Service; 4 | import java.util.Map; 5 | import java.util.List; 6 | 7 | import com.baomidou.mybatisplus.mapper.Wrapper; 8 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 9 | import com.baomidou.mybatisplus.plugins.Page; 10 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 11 | import com.utils.PageUtils; 12 | import com.utils.Query; 13 | 14 | 15 | import com.dao.ZichanweixiuDao; 16 | import com.entity.ZichanweixiuEntity; 17 | import com.service.ZichanweixiuService; 18 | import com.entity.vo.ZichanweixiuVO; 19 | import com.entity.view.ZichanweixiuView; 20 | 21 | @Service("zichanweixiuService") 22 | public class ZichanweixiuServiceImpl extends ServiceImpl implements ZichanweixiuService { 23 | 24 | 25 | @Override 26 | public PageUtils queryPage(Map params) { 27 | Page page = this.selectPage( 28 | new Query(params).getPage(), 29 | new EntityWrapper() 30 | ); 31 | return new PageUtils(page); 32 | } 33 | 34 | @Override 35 | public PageUtils queryPage(Map params, Wrapper wrapper) { 36 | Page page =new Query(params).getPage(); 37 | page.setRecords(baseMapper.selectListView(page,wrapper)); 38 | PageUtils pageUtil = new PageUtils(page); 39 | return pageUtil; 40 | } 41 | 42 | @Override 43 | public List selectListVO(Wrapper wrapper) { 44 | return baseMapper.selectListVO(wrapper); 45 | } 46 | 47 | @Override 48 | public ZichanweixiuVO selectVO(Wrapper wrapper) { 49 | return baseMapper.selectVO(wrapper); 50 | } 51 | 52 | @Override 53 | public List selectListView(Wrapper wrapper) { 54 | return baseMapper.selectListView(wrapper); 55 | } 56 | 57 | @Override 58 | public ZichanweixiuView selectView(Wrapper wrapper) { 59 | return baseMapper.selectView(wrapper); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/main/java/com/entity/ZichanfenleiEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.NotEmpty; 7 | import javax.validation.constraints.NotNull; 8 | 9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 10 | import java.lang.reflect.InvocationTargetException; 11 | 12 | import java.io.Serializable; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | import org.springframework.format.annotation.DateTimeFormat; 17 | import com.fasterxml.jackson.annotation.JsonFormat; 18 | import org.apache.commons.beanutils.BeanUtils; 19 | import com.baomidou.mybatisplus.annotations.TableField; 20 | import com.baomidou.mybatisplus.enums.FieldFill; 21 | import com.baomidou.mybatisplus.enums.IdType; 22 | 23 | 24 | /** 25 | * 资产分类 26 | * 数据库通用操作实体类(普通增删改查) 27 | * @author 28 | * @email 29 | * @date 2021-05-11 09:16:46 30 | */ 31 | @TableName("zichanfenlei") 32 | public class ZichanfenleiEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public ZichanfenleiEntity() { 37 | 38 | } 39 | 40 | public ZichanfenleiEntity(T t) { 41 | try { 42 | BeanUtils.copyProperties(this, t); 43 | } catch (IllegalAccessException | InvocationTargetException e) { 44 | // TODO Auto-generated catch block 45 | e.printStackTrace(); 46 | } 47 | } 48 | 49 | /** 50 | * 主键id 51 | */ 52 | @TableId 53 | private Long id; 54 | /** 55 | * 资产分类 56 | */ 57 | 58 | private String zichanfenlei; 59 | 60 | 61 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 62 | @DateTimeFormat 63 | private Date addtime; 64 | 65 | public Date getAddtime() { 66 | return addtime; 67 | } 68 | public void setAddtime(Date addtime) { 69 | this.addtime = addtime; 70 | } 71 | 72 | public Long getId() { 73 | return id; 74 | } 75 | 76 | public void setId(Long id) { 77 | this.id = id; 78 | } 79 | /** 80 | * 设置:资产分类 81 | */ 82 | public void setZichanfenlei(String zichanfenlei) { 83 | this.zichanfenlei = zichanfenlei; 84 | } 85 | /** 86 | * 获取:资产分类 87 | */ 88 | public String getZichanfenlei() { 89 | return zichanfenlei; 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/com/utils/PageUtils.java: -------------------------------------------------------------------------------- 1 | 2 | package com.utils; 3 | 4 | import java.io.Serializable; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import com.baomidou.mybatisplus.plugins.Page; 9 | 10 | /** 11 | * 分页工具类 12 | */ 13 | public class PageUtils implements Serializable { 14 | private static final long serialVersionUID = 1L; 15 | //总记录数 16 | private long total; 17 | //每页记录数 18 | private int pageSize; 19 | //总页数 20 | private long totalPage; 21 | //当前页数 22 | private int currPage; 23 | //列表数据 24 | private List list; 25 | 26 | /** 27 | * 分页 28 | * @param list 列表数据 29 | * @param totalCount 总记录数 30 | * @param pageSize 每页记录数 31 | * @param currPage 当前页数 32 | */ 33 | public PageUtils(List list, int totalCount, int pageSize, int currPage) { 34 | this.list = list; 35 | this.total = totalCount; 36 | this.pageSize = pageSize; 37 | this.currPage = currPage; 38 | this.totalPage = (int)Math.ceil((double)totalCount/pageSize); 39 | } 40 | 41 | /** 42 | * 分页 43 | */ 44 | public PageUtils(Page page) { 45 | this.list = page.getRecords(); 46 | this.total = page.getTotal(); 47 | this.pageSize = page.getSize(); 48 | this.currPage = page.getCurrent(); 49 | this.totalPage = page.getPages(); 50 | } 51 | 52 | /* 53 | * 空数据的分页 54 | */ 55 | public PageUtils(Map params) { 56 | Page page =new Query(params).getPage(); 57 | new PageUtils(page); 58 | } 59 | 60 | 61 | public int getPageSize() { 62 | return pageSize; 63 | } 64 | 65 | public void setPageSize(int pageSize) { 66 | this.pageSize = pageSize; 67 | } 68 | 69 | public int getCurrPage() { 70 | return currPage; 71 | } 72 | 73 | public void setCurrPage(int currPage) { 74 | this.currPage = currPage; 75 | } 76 | 77 | public List getList() { 78 | return list; 79 | } 80 | 81 | public void setList(List list) { 82 | this.list = list; 83 | } 84 | 85 | public long getTotalPage() { 86 | return totalPage; 87 | } 88 | 89 | public void setTotalPage(long totalPage) { 90 | this.totalPage = totalPage; 91 | } 92 | 93 | public long getTotal() { 94 | return total; 95 | } 96 | 97 | public void setTotal(long total) { 98 | this.total = total; 99 | } 100 | 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/com/service/impl/TokenServiceImpl.java: -------------------------------------------------------------------------------- 1 | 2 | package com.service.impl; 3 | 4 | 5 | import java.util.Calendar; 6 | import java.util.Date; 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | import org.springframework.stereotype.Service; 11 | 12 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 13 | import com.baomidou.mybatisplus.mapper.Wrapper; 14 | import com.baomidou.mybatisplus.plugins.Page; 15 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; 16 | import com.dao.TokenDao; 17 | import com.entity.TokenEntity; 18 | import com.entity.TokenEntity; 19 | import com.service.TokenService; 20 | import com.utils.CommonUtil; 21 | import com.utils.PageUtils; 22 | import com.utils.Query; 23 | 24 | 25 | /** 26 | * token 27 | */ 28 | @Service("tokenService") 29 | public class TokenServiceImpl extends ServiceImpl implements TokenService { 30 | 31 | @Override 32 | public PageUtils queryPage(Map params) { 33 | Page page = this.selectPage( 34 | new Query(params).getPage(), 35 | new EntityWrapper() 36 | ); 37 | return new PageUtils(page); 38 | } 39 | 40 | @Override 41 | public List selectListView(Wrapper wrapper) { 42 | return baseMapper.selectListView(wrapper); 43 | } 44 | 45 | @Override 46 | public PageUtils queryPage(Map params, 47 | Wrapper wrapper) { 48 | Page page =new Query(params).getPage(); 49 | page.setRecords(baseMapper.selectListView(page,wrapper)); 50 | PageUtils pageUtil = new PageUtils(page); 51 | return pageUtil; 52 | } 53 | 54 | @Override 55 | public String generateToken(Long userid,String username, String tableName, String role) { 56 | TokenEntity tokenEntity = this.selectOne(new EntityWrapper().eq("userid", userid).eq("role", role)); 57 | String token = CommonUtil.getRandomString(32); 58 | Calendar cal = Calendar.getInstance(); 59 | cal.setTime(new Date()); 60 | cal.add(Calendar.HOUR_OF_DAY, 1); 61 | if(tokenEntity!=null) { 62 | tokenEntity.setToken(token); 63 | tokenEntity.setExpiratedtime(cal.getTime()); 64 | this.updateById(tokenEntity); 65 | } else { 66 | this.insert(new TokenEntity(userid,username, tableName, role, token, cal.getTime())); 67 | } 68 | return token; 69 | } 70 | 71 | @Override 72 | public TokenEntity getTokenEntity(String token) { 73 | TokenEntity tokenEntity = this.selectOne(new EntityWrapper().eq("token", token)); 74 | if(tokenEntity == null || tokenEntity.getExpiratedtime().getTime() extends LinkedHashMap { 15 | private static final long serialVersionUID = 1L; 16 | /** 17 | * mybatis-plus分页参数 18 | */ 19 | private Page page; 20 | /** 21 | * 当前页码 22 | */ 23 | private int currPage = 1; 24 | /** 25 | * 每页条数 26 | */ 27 | private int limit = 10; 28 | 29 | public Query(JQPageInfo pageInfo) { 30 | //分页参数 31 | if(pageInfo.getPage()!= null){ 32 | currPage = pageInfo.getPage(); 33 | } 34 | if(pageInfo.getLimit()!= null){ 35 | limit = pageInfo.getLimit(); 36 | } 37 | 38 | 39 | //防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险) 40 | String sidx = SQLFilter.sqlInject(pageInfo.getSidx()); 41 | String order = SQLFilter.sqlInject(pageInfo.getOrder()); 42 | 43 | 44 | //mybatis-plus分页 45 | this.page = new Page<>(currPage, limit); 46 | 47 | //排序 48 | if(StringUtils.isNotBlank(sidx) && StringUtils.isNotBlank(order)){ 49 | this.page.setOrderByField(sidx); 50 | this.page.setAsc("ASC".equalsIgnoreCase(order)); 51 | } 52 | } 53 | 54 | 55 | public Query(Map params){ 56 | this.putAll(params); 57 | 58 | //分页参数 59 | if(params.get("page") != null){ 60 | currPage = Integer.parseInt((String)params.get("page")); 61 | } 62 | if(params.get("limit") != null){ 63 | limit = Integer.parseInt((String)params.get("limit")); 64 | } 65 | 66 | this.put("offset", (currPage - 1) * limit); 67 | this.put("page", currPage); 68 | this.put("limit", limit); 69 | 70 | //防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险) 71 | String sidx = SQLFilter.sqlInject((String)params.get("sidx")); 72 | String order = SQLFilter.sqlInject((String)params.get("order")); 73 | this.put("sidx", sidx); 74 | this.put("order", order); 75 | 76 | //mybatis-plus分页 77 | this.page = new Page<>(currPage, limit); 78 | 79 | //排序 80 | if(StringUtils.isNotBlank(sidx) && StringUtils.isNotBlank(order)){ 81 | this.page.setOrderByField(sidx); 82 | this.page.setAsc("ASC".equalsIgnoreCase(order)); 83 | } 84 | 85 | } 86 | 87 | public Page getPage() { 88 | return page; 89 | } 90 | 91 | public int getCurrPage() { 92 | return currPage; 93 | } 94 | 95 | public int getLimit() { 96 | return limit; 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/ZichanweixiuVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.ZichanweixiuEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 资产维修 15 | * 手机端接口返回实体辅助类 16 | * (主要作用去除一些不必要的字段) 17 | * @author 18 | * @email 19 | * @date 2021-05-11 09:16:46 20 | */ 21 | public class ZichanweixiuVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | /** 26 | * 设备名称 27 | */ 28 | 29 | private String shebeimingcheng; 30 | 31 | /** 32 | * 资产分类 33 | */ 34 | 35 | private String zichanfenlei; 36 | 37 | /** 38 | * 数量 39 | */ 40 | 41 | private Integer shuliang; 42 | 43 | /** 44 | * 维修数量 45 | */ 46 | 47 | private Integer weixiushuliang; 48 | 49 | /** 50 | * 维修说明 51 | */ 52 | 53 | private String weixiushuoming; 54 | 55 | /** 56 | * 维修进度 57 | */ 58 | 59 | private String weixiujindu; 60 | 61 | 62 | /** 63 | * 设置:设备名称 64 | */ 65 | 66 | public void setShebeimingcheng(String shebeimingcheng) { 67 | this.shebeimingcheng = shebeimingcheng; 68 | } 69 | 70 | /** 71 | * 获取:设备名称 72 | */ 73 | public String getShebeimingcheng() { 74 | return shebeimingcheng; 75 | } 76 | 77 | 78 | /** 79 | * 设置:资产分类 80 | */ 81 | 82 | public void setZichanfenlei(String zichanfenlei) { 83 | this.zichanfenlei = zichanfenlei; 84 | } 85 | 86 | /** 87 | * 获取:资产分类 88 | */ 89 | public String getZichanfenlei() { 90 | return zichanfenlei; 91 | } 92 | 93 | 94 | /** 95 | * 设置:数量 96 | */ 97 | 98 | public void setShuliang(Integer shuliang) { 99 | this.shuliang = shuliang; 100 | } 101 | 102 | /** 103 | * 获取:数量 104 | */ 105 | public Integer getShuliang() { 106 | return shuliang; 107 | } 108 | 109 | 110 | /** 111 | * 设置:维修数量 112 | */ 113 | 114 | public void setWeixiushuliang(Integer weixiushuliang) { 115 | this.weixiushuliang = weixiushuliang; 116 | } 117 | 118 | /** 119 | * 获取:维修数量 120 | */ 121 | public Integer getWeixiushuliang() { 122 | return weixiushuliang; 123 | } 124 | 125 | 126 | /** 127 | * 设置:维修说明 128 | */ 129 | 130 | public void setWeixiushuoming(String weixiushuoming) { 131 | this.weixiushuoming = weixiushuoming; 132 | } 133 | 134 | /** 135 | * 获取:维修说明 136 | */ 137 | public String getWeixiushuoming() { 138 | return weixiushuoming; 139 | } 140 | 141 | 142 | /** 143 | * 设置:维修进度 144 | */ 145 | 146 | public void setWeixiujindu(String weixiujindu) { 147 | this.weixiujindu = weixiujindu; 148 | } 149 | 150 | /** 151 | * 获取:维修进度 152 | */ 153 | public String getWeixiujindu() { 154 | return weixiujindu; 155 | } 156 | 157 | } 158 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/ZichanxinxiVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.ZichanxinxiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 资产信息 15 | * 手机端接口返回实体辅助类 16 | * (主要作用去除一些不必要的字段) 17 | * @author 18 | * @email 19 | * @date 2021-05-11 09:16:46 20 | */ 21 | public class ZichanxinxiVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | /** 26 | * 设备名称 27 | */ 28 | 29 | private String shebeimingcheng; 30 | 31 | /** 32 | * 资产分类 33 | */ 34 | 35 | private String zichanfenlei; 36 | 37 | /** 38 | * 资产图片 39 | */ 40 | 41 | private String zichantupian; 42 | 43 | /** 44 | * 数量 45 | */ 46 | 47 | private Integer shuliang; 48 | 49 | /** 50 | * 备注说明 51 | */ 52 | 53 | private String beizhushuoming; 54 | 55 | /** 56 | * 当前位置 57 | */ 58 | 59 | private String dangqianweizhi; 60 | 61 | 62 | /** 63 | * 设置:设备名称 64 | */ 65 | 66 | public void setShebeimingcheng(String shebeimingcheng) { 67 | this.shebeimingcheng = shebeimingcheng; 68 | } 69 | 70 | /** 71 | * 获取:设备名称 72 | */ 73 | public String getShebeimingcheng() { 74 | return shebeimingcheng; 75 | } 76 | 77 | 78 | /** 79 | * 设置:资产分类 80 | */ 81 | 82 | public void setZichanfenlei(String zichanfenlei) { 83 | this.zichanfenlei = zichanfenlei; 84 | } 85 | 86 | /** 87 | * 获取:资产分类 88 | */ 89 | public String getZichanfenlei() { 90 | return zichanfenlei; 91 | } 92 | 93 | 94 | /** 95 | * 设置:资产图片 96 | */ 97 | 98 | public void setZichantupian(String zichantupian) { 99 | this.zichantupian = zichantupian; 100 | } 101 | 102 | /** 103 | * 获取:资产图片 104 | */ 105 | public String getZichantupian() { 106 | return zichantupian; 107 | } 108 | 109 | 110 | /** 111 | * 设置:数量 112 | */ 113 | 114 | public void setShuliang(Integer shuliang) { 115 | this.shuliang = shuliang; 116 | } 117 | 118 | /** 119 | * 获取:数量 120 | */ 121 | public Integer getShuliang() { 122 | return shuliang; 123 | } 124 | 125 | 126 | /** 127 | * 设置:备注说明 128 | */ 129 | 130 | public void setBeizhushuoming(String beizhushuoming) { 131 | this.beizhushuoming = beizhushuoming; 132 | } 133 | 134 | /** 135 | * 获取:备注说明 136 | */ 137 | public String getBeizhushuoming() { 138 | return beizhushuoming; 139 | } 140 | 141 | 142 | /** 143 | * 设置:当前位置 144 | */ 145 | 146 | public void setDangqianweizhi(String dangqianweizhi) { 147 | this.dangqianweizhi = dangqianweizhi; 148 | } 149 | 150 | /** 151 | * 获取:当前位置 152 | */ 153 | public String getDangqianweizhi() { 154 | return dangqianweizhi; 155 | } 156 | 157 | } 158 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/ZichanweixiuModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.ZichanweixiuEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 资产维修 15 | * 接收传参的实体类 16 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 17 | * 取自ModelAndView 的model名称 18 | * @author 19 | * @email 20 | * @date 2021-05-11 09:16:46 21 | */ 22 | public class ZichanweixiuModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | /** 27 | * 设备名称 28 | */ 29 | 30 | private String shebeimingcheng; 31 | 32 | /** 33 | * 资产分类 34 | */ 35 | 36 | private String zichanfenlei; 37 | 38 | /** 39 | * 数量 40 | */ 41 | 42 | private Integer shuliang; 43 | 44 | /** 45 | * 维修数量 46 | */ 47 | 48 | private Integer weixiushuliang; 49 | 50 | /** 51 | * 维修说明 52 | */ 53 | 54 | private String weixiushuoming; 55 | 56 | /** 57 | * 维修进度 58 | */ 59 | 60 | private String weixiujindu; 61 | 62 | 63 | /** 64 | * 设置:设备名称 65 | */ 66 | 67 | public void setShebeimingcheng(String shebeimingcheng) { 68 | this.shebeimingcheng = shebeimingcheng; 69 | } 70 | 71 | /** 72 | * 获取:设备名称 73 | */ 74 | public String getShebeimingcheng() { 75 | return shebeimingcheng; 76 | } 77 | 78 | 79 | /** 80 | * 设置:资产分类 81 | */ 82 | 83 | public void setZichanfenlei(String zichanfenlei) { 84 | this.zichanfenlei = zichanfenlei; 85 | } 86 | 87 | /** 88 | * 获取:资产分类 89 | */ 90 | public String getZichanfenlei() { 91 | return zichanfenlei; 92 | } 93 | 94 | 95 | /** 96 | * 设置:数量 97 | */ 98 | 99 | public void setShuliang(Integer shuliang) { 100 | this.shuliang = shuliang; 101 | } 102 | 103 | /** 104 | * 获取:数量 105 | */ 106 | public Integer getShuliang() { 107 | return shuliang; 108 | } 109 | 110 | 111 | /** 112 | * 设置:维修数量 113 | */ 114 | 115 | public void setWeixiushuliang(Integer weixiushuliang) { 116 | this.weixiushuliang = weixiushuliang; 117 | } 118 | 119 | /** 120 | * 获取:维修数量 121 | */ 122 | public Integer getWeixiushuliang() { 123 | return weixiushuliang; 124 | } 125 | 126 | 127 | /** 128 | * 设置:维修说明 129 | */ 130 | 131 | public void setWeixiushuoming(String weixiushuoming) { 132 | this.weixiushuoming = weixiushuoming; 133 | } 134 | 135 | /** 136 | * 获取:维修说明 137 | */ 138 | public String getWeixiushuoming() { 139 | return weixiushuoming; 140 | } 141 | 142 | 143 | /** 144 | * 设置:维修进度 145 | */ 146 | 147 | public void setWeixiujindu(String weixiujindu) { 148 | this.weixiujindu = weixiujindu; 149 | } 150 | 151 | /** 152 | * 获取:维修进度 153 | */ 154 | public String getWeixiujindu() { 155 | return weixiujindu; 156 | } 157 | 158 | } 159 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/ZichanxinxiModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.ZichanxinxiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 资产信息 15 | * 接收传参的实体类 16 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 17 | * 取自ModelAndView 的model名称 18 | * @author 19 | * @email 20 | * @date 2021-05-11 09:16:46 21 | */ 22 | public class ZichanxinxiModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | /** 27 | * 设备名称 28 | */ 29 | 30 | private String shebeimingcheng; 31 | 32 | /** 33 | * 资产分类 34 | */ 35 | 36 | private String zichanfenlei; 37 | 38 | /** 39 | * 资产图片 40 | */ 41 | 42 | private String zichantupian; 43 | 44 | /** 45 | * 数量 46 | */ 47 | 48 | private Integer shuliang; 49 | 50 | /** 51 | * 备注说明 52 | */ 53 | 54 | private String beizhushuoming; 55 | 56 | /** 57 | * 当前位置 58 | */ 59 | 60 | private String dangqianweizhi; 61 | 62 | 63 | /** 64 | * 设置:设备名称 65 | */ 66 | 67 | public void setShebeimingcheng(String shebeimingcheng) { 68 | this.shebeimingcheng = shebeimingcheng; 69 | } 70 | 71 | /** 72 | * 获取:设备名称 73 | */ 74 | public String getShebeimingcheng() { 75 | return shebeimingcheng; 76 | } 77 | 78 | 79 | /** 80 | * 设置:资产分类 81 | */ 82 | 83 | public void setZichanfenlei(String zichanfenlei) { 84 | this.zichanfenlei = zichanfenlei; 85 | } 86 | 87 | /** 88 | * 获取:资产分类 89 | */ 90 | public String getZichanfenlei() { 91 | return zichanfenlei; 92 | } 93 | 94 | 95 | /** 96 | * 设置:资产图片 97 | */ 98 | 99 | public void setZichantupian(String zichantupian) { 100 | this.zichantupian = zichantupian; 101 | } 102 | 103 | /** 104 | * 获取:资产图片 105 | */ 106 | public String getZichantupian() { 107 | return zichantupian; 108 | } 109 | 110 | 111 | /** 112 | * 设置:数量 113 | */ 114 | 115 | public void setShuliang(Integer shuliang) { 116 | this.shuliang = shuliang; 117 | } 118 | 119 | /** 120 | * 获取:数量 121 | */ 122 | public Integer getShuliang() { 123 | return shuliang; 124 | } 125 | 126 | 127 | /** 128 | * 设置:备注说明 129 | */ 130 | 131 | public void setBeizhushuoming(String beizhushuoming) { 132 | this.beizhushuoming = beizhushuoming; 133 | } 134 | 135 | /** 136 | * 获取:备注说明 137 | */ 138 | public String getBeizhushuoming() { 139 | return beizhushuoming; 140 | } 141 | 142 | 143 | /** 144 | * 设置:当前位置 145 | */ 146 | 147 | public void setDangqianweizhi(String dangqianweizhi) { 148 | this.dangqianweizhi = dangqianweizhi; 149 | } 150 | 151 | /** 152 | * 获取:当前位置 153 | */ 154 | public String getDangqianweizhi() { 155 | return dangqianweizhi; 156 | } 157 | 158 | } 159 | -------------------------------------------------------------------------------- /src/main/java/com/controller/ConfigController.java: -------------------------------------------------------------------------------- 1 | 2 | package com.controller; 3 | 4 | 5 | import java.util.Arrays; 6 | import java.util.Map; 7 | 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.web.bind.annotation.PathVariable; 10 | import org.springframework.web.bind.annotation.PostMapping; 11 | import org.springframework.web.bind.annotation.RequestBody; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | import org.springframework.web.bind.annotation.RequestParam; 14 | import org.springframework.web.bind.annotation.RestController; 15 | 16 | import com.annotation.IgnoreAuth; 17 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 18 | import com.entity.ConfigEntity; 19 | import com.service.ConfigService; 20 | import com.utils.PageUtils; 21 | import com.utils.R; 22 | import com.utils.ValidatorUtils; 23 | 24 | /** 25 | * 登录相关 26 | */ 27 | @RequestMapping("config") 28 | @RestController 29 | public class ConfigController{ 30 | 31 | @Autowired 32 | private ConfigService configService; 33 | 34 | /** 35 | * 列表 36 | */ 37 | @RequestMapping("/page") 38 | public R page(@RequestParam Map params,ConfigEntity config){ 39 | EntityWrapper ew = new EntityWrapper(); 40 | PageUtils page = configService.queryPage(params); 41 | return R.ok().put("data", page); 42 | } 43 | 44 | /** 45 | * 列表 46 | */ 47 | @IgnoreAuth 48 | @RequestMapping("/list") 49 | public R list(@RequestParam Map params,ConfigEntity config){ 50 | EntityWrapper ew = new EntityWrapper(); 51 | PageUtils page = configService.queryPage(params); 52 | return R.ok().put("data", page); 53 | } 54 | 55 | /** 56 | * 信息 57 | */ 58 | @RequestMapping("/info/{id}") 59 | public R info(@PathVariable("id") String id){ 60 | ConfigEntity config = configService.selectById(id); 61 | return R.ok().put("data", config); 62 | } 63 | 64 | /** 65 | * 详情 66 | */ 67 | @IgnoreAuth 68 | @RequestMapping("/detail/{id}") 69 | public R detail(@PathVariable("id") String id){ 70 | ConfigEntity config = configService.selectById(id); 71 | return R.ok().put("data", config); 72 | } 73 | 74 | /** 75 | * 根据name获取信息 76 | */ 77 | @RequestMapping("/info") 78 | public R infoByName(@RequestParam String name){ 79 | ConfigEntity config = configService.selectOne(new EntityWrapper().eq("name", "faceFile")); 80 | return R.ok().put("data", config); 81 | } 82 | 83 | /** 84 | * 保存 85 | */ 86 | @PostMapping("/save") 87 | public R save(@RequestBody ConfigEntity config){ 88 | // ValidatorUtils.validateEntity(config); 89 | configService.insert(config); 90 | return R.ok(); 91 | } 92 | 93 | /** 94 | * 修改 95 | */ 96 | @RequestMapping("/update") 97 | public R update(@RequestBody ConfigEntity config){ 98 | // ValidatorUtils.validateEntity(config); 99 | configService.updateById(config);//全部更新 100 | return R.ok(); 101 | } 102 | 103 | /** 104 | * 删除 105 | */ 106 | @RequestMapping("/delete") 107 | public R delete(@RequestBody Long[] ids){ 108 | configService.deleteBatchIds(Arrays.asList(ids)); 109 | return R.ok(); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/main/java/com/interceptor/AuthorizationInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.interceptor; 2 | 3 | import java.io.IOException; 4 | import java.io.PrintWriter; 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | import com.alibaba.fastjson.JSONObject; 8 | import javax.servlet.http.HttpServletRequest; 9 | import javax.servlet.http.HttpServletResponse; 10 | 11 | import org.apache.commons.lang3.StringUtils; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.stereotype.Component; 14 | import org.springframework.web.method.HandlerMethod; 15 | import org.springframework.web.servlet.HandlerInterceptor; 16 | import org.springframework.web.bind.annotation.RequestMethod; 17 | import org.springframework.http.HttpStatus; 18 | 19 | import com.annotation.IgnoreAuth; 20 | import com.entity.EIException; 21 | import com.entity.TokenEntity; 22 | import com.service.TokenService; 23 | import com.utils.R; 24 | 25 | /** 26 | * 权限(Token)验证 27 | */ 28 | @Component 29 | public class AuthorizationInterceptor implements HandlerInterceptor { 30 | 31 | public static final String LOGIN_TOKEN_KEY = "Token"; 32 | 33 | @Autowired 34 | private TokenService tokenService; 35 | 36 | @Override 37 | public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 38 | 39 | //支持跨域请求 40 | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); 41 | response.setHeader("Access-Control-Max-Age", "3600"); 42 | response.setHeader("Access-Control-Allow-Credentials", "true"); 43 | response.setHeader("Access-Control-Allow-Headers", "x-requested-with,request-source,Token, Origin,imgType, Content-Type, cache-control,postman-token,Cookie, Accept,authorization"); 44 | response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin")); 45 | // 跨域时会首先发送一个OPTIONS请求,这里我们给OPTIONS请求直接返回正常状态 46 | if (request.getMethod().equals(RequestMethod.OPTIONS.name())) { 47 | response.setStatus(HttpStatus.OK.value()); 48 | return false; 49 | } 50 | 51 | IgnoreAuth annotation; 52 | if (handler instanceof HandlerMethod) { 53 | annotation = ((HandlerMethod) handler).getMethodAnnotation(IgnoreAuth.class); 54 | } else { 55 | return true; 56 | } 57 | 58 | //从header中获取token 59 | String token = request.getHeader(LOGIN_TOKEN_KEY); 60 | 61 | /** 62 | * 不需要验证权限的方法直接放过 63 | */ 64 | if(annotation!=null) { 65 | return true; 66 | } 67 | 68 | TokenEntity tokenEntity = null; 69 | if(StringUtils.isNotBlank(token)) { 70 | tokenEntity = tokenService.getTokenEntity(token); 71 | } 72 | 73 | if(tokenEntity != null) { 74 | request.getSession().setAttribute("userId", tokenEntity.getUserid()); 75 | request.getSession().setAttribute("role", tokenEntity.getRole()); 76 | request.getSession().setAttribute("tableName", tokenEntity.getTablename()); 77 | request.getSession().setAttribute("username", tokenEntity.getUsername()); 78 | return true; 79 | } 80 | 81 | PrintWriter writer = null; 82 | response.setCharacterEncoding("UTF-8"); 83 | response.setContentType("application/json; charset=utf-8"); 84 | try { 85 | writer = response.getWriter(); 86 | writer.print(JSONObject.toJSONString(R.error(401, "请先登录"))); 87 | } finally { 88 | if(writer != null){ 89 | writer.close(); 90 | } 91 | } 92 | // throw new EIException("请先登录", 401); 93 | return false; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/com/utils/BaiduUtil.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.InputStreamReader; 5 | import java.net.HttpURLConnection; 6 | import java.net.URL; 7 | import java.util.HashMap; 8 | import java.util.List; 9 | import java.util.Map; 10 | 11 | import org.json.JSONObject; 12 | 13 | 14 | /** 15 | * 类说明 : 16 | */ 17 | 18 | public class BaiduUtil { 19 | 20 | /** 21 | * 根据经纬度获得省市区信息 22 | * @param lon 纬度 23 | * @param lat 经度 24 | * @param coordtype 经纬度坐标系 25 | * @return 26 | */ 27 | public static Map getCityByLonLat(String key, String lng, String lat) { 28 | String location = lat + "," + lng; 29 | try { 30 | //拼装url 31 | String url = "http://api.map.baidu.com/reverse_geocoding/v3/?ak="+key+"&output=json&coordtype=wgs84ll&location="+location; 32 | String result = HttpClientUtils.doGet(url); 33 | JSONObject o = new JSONObject(result); 34 | Map area = new HashMap<>(); 35 | area.put("province", o.getJSONObject("result").getJSONObject("addressComponent").getString("province")); 36 | area.put("city", o.getJSONObject("result").getJSONObject("addressComponent").getString("city")); 37 | area.put("district", o.getJSONObject("result").getJSONObject("addressComponent").getString("district")); 38 | area.put("street", o.getJSONObject("result").getJSONObject("addressComponent").getString("street")); 39 | return area; 40 | }catch (Exception e) { 41 | e.printStackTrace(); 42 | } 43 | return null; 44 | } 45 | 46 | /** 47 | * 获取API访问token 48 | * 该token有一定的有效期,需要自行管理,当失效时需重新获取. 49 | * @param ak - 百度云官网获取的 API Key 50 | * @param sk - 百度云官网获取的 Securet Key 51 | * @return assess_token 52 | */ 53 | public static String getAuth(String ak, String sk) { 54 | // 获取token地址 55 | String authHost = "https://aip.baidubce.com/oauth/2.0/token?"; 56 | String getAccessTokenUrl = authHost 57 | // 1. grant_type为固定参数 58 | + "grant_type=client_credentials" 59 | // 2. 官网获取的 API Key 60 | + "&client_id=" + ak 61 | // 3. 官网获取的 Secret Key 62 | + "&client_secret=" + sk; 63 | try { 64 | URL realUrl = new URL(getAccessTokenUrl); 65 | // 打开和URL之间的连接 66 | HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection(); 67 | connection.setRequestMethod("GET"); 68 | connection.connect(); 69 | // 获取所有响应头字段 70 | Map> map = connection.getHeaderFields(); 71 | // 遍历所有的响应头字段 72 | for (String key : map.keySet()) { 73 | System.err.println(key + "--->" + map.get(key)); 74 | } 75 | // 定义 BufferedReader输入流来读取URL的响应 76 | BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); 77 | String result = ""; 78 | String line; 79 | while ((line = in.readLine()) != null) { 80 | result += line; 81 | } 82 | /** 83 | * 返回结果示例 84 | */ 85 | System.err.println("result:" + result); 86 | org.json.JSONObject jsonObject = new org.json.JSONObject(result); 87 | String access_token = jsonObject.getString("access_token"); 88 | return access_token; 89 | } catch (Exception e) { 90 | System.err.printf("获取token失败!"); 91 | e.printStackTrace(System.err); 92 | } 93 | return null; 94 | } 95 | 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/YonghuVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.YonghuEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 用户 15 | * 手机端接口返回实体辅助类 16 | * (主要作用去除一些不必要的字段) 17 | * @author 18 | * @email 19 | * @date 2021-05-11 09:16:46 20 | */ 21 | public class YonghuVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | /** 26 | * 密码 27 | */ 28 | 29 | private String mima; 30 | 31 | /** 32 | * 姓名 33 | */ 34 | 35 | private String xingming; 36 | 37 | /** 38 | * 性别 39 | */ 40 | 41 | private String xingbie; 42 | 43 | /** 44 | * 头像 45 | */ 46 | 47 | private String touxiang; 48 | 49 | /** 50 | * 手机 51 | */ 52 | 53 | private String shouji; 54 | 55 | /** 56 | * 邮箱 57 | */ 58 | 59 | private String youxiang; 60 | 61 | /** 62 | * 身份证 63 | */ 64 | 65 | private String shenfenzheng; 66 | 67 | /** 68 | * 是否审核 69 | */ 70 | 71 | private String sfsh; 72 | 73 | /** 74 | * 审核回复 75 | */ 76 | 77 | private String shhf; 78 | 79 | 80 | /** 81 | * 设置:密码 82 | */ 83 | 84 | public void setMima(String mima) { 85 | this.mima = mima; 86 | } 87 | 88 | /** 89 | * 获取:密码 90 | */ 91 | public String getMima() { 92 | return mima; 93 | } 94 | 95 | 96 | /** 97 | * 设置:姓名 98 | */ 99 | 100 | public void setXingming(String xingming) { 101 | this.xingming = xingming; 102 | } 103 | 104 | /** 105 | * 获取:姓名 106 | */ 107 | public String getXingming() { 108 | return xingming; 109 | } 110 | 111 | 112 | /** 113 | * 设置:性别 114 | */ 115 | 116 | public void setXingbie(String xingbie) { 117 | this.xingbie = xingbie; 118 | } 119 | 120 | /** 121 | * 获取:性别 122 | */ 123 | public String getXingbie() { 124 | return xingbie; 125 | } 126 | 127 | 128 | /** 129 | * 设置:头像 130 | */ 131 | 132 | public void setTouxiang(String touxiang) { 133 | this.touxiang = touxiang; 134 | } 135 | 136 | /** 137 | * 获取:头像 138 | */ 139 | public String getTouxiang() { 140 | return touxiang; 141 | } 142 | 143 | 144 | /** 145 | * 设置:手机 146 | */ 147 | 148 | public void setShouji(String shouji) { 149 | this.shouji = shouji; 150 | } 151 | 152 | /** 153 | * 获取:手机 154 | */ 155 | public String getShouji() { 156 | return shouji; 157 | } 158 | 159 | 160 | /** 161 | * 设置:邮箱 162 | */ 163 | 164 | public void setYouxiang(String youxiang) { 165 | this.youxiang = youxiang; 166 | } 167 | 168 | /** 169 | * 获取:邮箱 170 | */ 171 | public String getYouxiang() { 172 | return youxiang; 173 | } 174 | 175 | 176 | /** 177 | * 设置:身份证 178 | */ 179 | 180 | public void setShenfenzheng(String shenfenzheng) { 181 | this.shenfenzheng = shenfenzheng; 182 | } 183 | 184 | /** 185 | * 获取:身份证 186 | */ 187 | public String getShenfenzheng() { 188 | return shenfenzheng; 189 | } 190 | 191 | 192 | /** 193 | * 设置:是否审核 194 | */ 195 | 196 | public void setSfsh(String sfsh) { 197 | this.sfsh = sfsh; 198 | } 199 | 200 | /** 201 | * 获取:是否审核 202 | */ 203 | public String getSfsh() { 204 | return sfsh; 205 | } 206 | 207 | 208 | /** 209 | * 设置:审核回复 210 | */ 211 | 212 | public void setShhf(String shhf) { 213 | this.shhf = shhf; 214 | } 215 | 216 | /** 217 | * 获取:审核回复 218 | */ 219 | public String getShhf() { 220 | return shhf; 221 | } 222 | 223 | } 224 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/YonghuModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.YonghuEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 用户 15 | * 接收传参的实体类 16 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 17 | * 取自ModelAndView 的model名称 18 | * @author 19 | * @email 20 | * @date 2021-05-11 09:16:46 21 | */ 22 | public class YonghuModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | /** 27 | * 密码 28 | */ 29 | 30 | private String mima; 31 | 32 | /** 33 | * 姓名 34 | */ 35 | 36 | private String xingming; 37 | 38 | /** 39 | * 性别 40 | */ 41 | 42 | private String xingbie; 43 | 44 | /** 45 | * 头像 46 | */ 47 | 48 | private String touxiang; 49 | 50 | /** 51 | * 手机 52 | */ 53 | 54 | private String shouji; 55 | 56 | /** 57 | * 邮箱 58 | */ 59 | 60 | private String youxiang; 61 | 62 | /** 63 | * 身份证 64 | */ 65 | 66 | private String shenfenzheng; 67 | 68 | /** 69 | * 是否审核 70 | */ 71 | 72 | private String sfsh; 73 | 74 | /** 75 | * 审核回复 76 | */ 77 | 78 | private String shhf; 79 | 80 | 81 | /** 82 | * 设置:密码 83 | */ 84 | 85 | public void setMima(String mima) { 86 | this.mima = mima; 87 | } 88 | 89 | /** 90 | * 获取:密码 91 | */ 92 | public String getMima() { 93 | return mima; 94 | } 95 | 96 | 97 | /** 98 | * 设置:姓名 99 | */ 100 | 101 | public void setXingming(String xingming) { 102 | this.xingming = xingming; 103 | } 104 | 105 | /** 106 | * 获取:姓名 107 | */ 108 | public String getXingming() { 109 | return xingming; 110 | } 111 | 112 | 113 | /** 114 | * 设置:性别 115 | */ 116 | 117 | public void setXingbie(String xingbie) { 118 | this.xingbie = xingbie; 119 | } 120 | 121 | /** 122 | * 获取:性别 123 | */ 124 | public String getXingbie() { 125 | return xingbie; 126 | } 127 | 128 | 129 | /** 130 | * 设置:头像 131 | */ 132 | 133 | public void setTouxiang(String touxiang) { 134 | this.touxiang = touxiang; 135 | } 136 | 137 | /** 138 | * 获取:头像 139 | */ 140 | public String getTouxiang() { 141 | return touxiang; 142 | } 143 | 144 | 145 | /** 146 | * 设置:手机 147 | */ 148 | 149 | public void setShouji(String shouji) { 150 | this.shouji = shouji; 151 | } 152 | 153 | /** 154 | * 获取:手机 155 | */ 156 | public String getShouji() { 157 | return shouji; 158 | } 159 | 160 | 161 | /** 162 | * 设置:邮箱 163 | */ 164 | 165 | public void setYouxiang(String youxiang) { 166 | this.youxiang = youxiang; 167 | } 168 | 169 | /** 170 | * 获取:邮箱 171 | */ 172 | public String getYouxiang() { 173 | return youxiang; 174 | } 175 | 176 | 177 | /** 178 | * 设置:身份证 179 | */ 180 | 181 | public void setShenfenzheng(String shenfenzheng) { 182 | this.shenfenzheng = shenfenzheng; 183 | } 184 | 185 | /** 186 | * 获取:身份证 187 | */ 188 | public String getShenfenzheng() { 189 | return shenfenzheng; 190 | } 191 | 192 | 193 | /** 194 | * 设置:是否审核 195 | */ 196 | 197 | public void setSfsh(String sfsh) { 198 | this.sfsh = sfsh; 199 | } 200 | 201 | /** 202 | * 获取:是否审核 203 | */ 204 | public String getSfsh() { 205 | return sfsh; 206 | } 207 | 208 | 209 | /** 210 | * 设置:审核回复 211 | */ 212 | 213 | public void setShhf(String shhf) { 214 | this.shhf = shhf; 215 | } 216 | 217 | /** 218 | * 获取:审核回复 219 | */ 220 | public String getShhf() { 221 | return shhf; 222 | } 223 | 224 | } 225 | -------------------------------------------------------------------------------- /src/main/java/com/controller/FileController.java: -------------------------------------------------------------------------------- 1 | package com.controller; 2 | 3 | import java.io.File; 4 | import java.io.FileNotFoundException; 5 | import java.io.IOException; 6 | import java.util.Arrays; 7 | import java.util.Date; 8 | import java.util.HashMap; 9 | import java.util.List; 10 | import java.util.Map; 11 | import java.util.Random; 12 | import java.util.UUID; 13 | 14 | import org.apache.commons.io.FileUtils; 15 | import org.apache.commons.lang3.StringUtils; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.http.HttpHeaders; 18 | import org.springframework.http.HttpStatus; 19 | import org.springframework.http.MediaType; 20 | import org.springframework.http.ResponseEntity; 21 | import org.springframework.util.ResourceUtils; 22 | import org.springframework.web.bind.annotation.PathVariable; 23 | import org.springframework.web.bind.annotation.RequestBody; 24 | import org.springframework.web.bind.annotation.RequestMapping; 25 | import org.springframework.web.bind.annotation.RequestParam; 26 | import org.springframework.web.bind.annotation.RestController; 27 | import org.springframework.web.multipart.MultipartFile; 28 | 29 | import com.annotation.IgnoreAuth; 30 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 31 | import com.entity.ConfigEntity; 32 | import com.entity.EIException; 33 | import com.service.ConfigService; 34 | import com.utils.R; 35 | 36 | /** 37 | * 上传文件映射表 38 | */ 39 | @RestController 40 | @RequestMapping("file") 41 | @SuppressWarnings({"unchecked","rawtypes"}) 42 | public class FileController{ 43 | @Autowired 44 | private ConfigService configService; 45 | /** 46 | * 上传文件 47 | */ 48 | @RequestMapping("/upload") 49 | public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception { 50 | if (file.isEmpty()) { 51 | throw new EIException("上传文件不能为空"); 52 | } 53 | String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1); 54 | File path = new File(ResourceUtils.getURL("classpath:static").getPath()); 55 | if(!path.exists()) { 56 | path = new File(""); 57 | } 58 | File upload = new File(path.getAbsolutePath(),"/upload/"); 59 | if(!upload.exists()) { 60 | upload.mkdirs(); 61 | } 62 | String fileName = new Date().getTime()+"."+fileExt; 63 | File dest = new File(upload.getAbsolutePath()+"/"+fileName); 64 | file.transferTo(dest); 65 | if(StringUtils.isNotBlank(type) && type.equals("1")) { 66 | ConfigEntity configEntity = configService.selectOne(new EntityWrapper().eq("name", "faceFile")); 67 | if(configEntity==null) { 68 | configEntity = new ConfigEntity(); 69 | configEntity.setName("faceFile"); 70 | configEntity.setValue(fileName); 71 | } else { 72 | configEntity.setValue(fileName); 73 | } 74 | configService.insertOrUpdate(configEntity); 75 | } 76 | return R.ok().put("file", fileName); 77 | } 78 | 79 | /** 80 | * 下载文件 81 | */ 82 | @IgnoreAuth 83 | @RequestMapping("/download") 84 | public ResponseEntity download(@RequestParam String fileName) { 85 | try { 86 | File path = new File(ResourceUtils.getURL("classpath:static").getPath()); 87 | if(!path.exists()) { 88 | path = new File(""); 89 | } 90 | File upload = new File(path.getAbsolutePath(),"/upload/"); 91 | if(!upload.exists()) { 92 | upload.mkdirs(); 93 | } 94 | File file = new File(upload.getAbsolutePath()+"/"+fileName); 95 | if(file.exists()){ 96 | /*if(!fileService.canRead(file, SessionManager.getSessionUser())){ 97 | getResponse().sendError(403); 98 | }*/ 99 | HttpHeaders headers = new HttpHeaders(); 100 | headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); 101 | headers.setContentDispositionFormData("attachment", fileName); 102 | return new ResponseEntity(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED); 103 | } 104 | } catch (IOException e) { 105 | e.printStackTrace(); 106 | } 107 | return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR); 108 | } 109 | 110 | } 111 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.2.2.RELEASE 9 | 10 | 11 | com.jlwl 12 | 13 | springboot4j9k2 14 | 0.0.1-SNAPSHOT 15 | springboot-schema 16 | springboot学习框架 17 | 18 | 19 | 1.8 20 | 1.2.8 21 | 3.1.1 22 | 23 | 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-web 28 | 29 | 30 | org.mybatis.spring.boot 31 | mybatis-spring-boot-starter 32 | 2.1.1 33 | 34 | 35 | org.springframework.boot 36 | spring-boot-starter-jdbc 37 | 38 | 39 | 40 | mysql 41 | mysql-connector-java 42 | 43 | 44 | org.apache.shiro 45 | shiro-spring 46 | 1.3.2 47 | 48 | 49 | 50 | com.baomidou 51 | mybatis-plus 52 | 2.3 53 | 54 | 55 | com.baomidou 56 | mybatisplus-spring-boot-starter 57 | 1.0.5 58 | 59 | 60 | com.google.protobuf 61 | protobuf-java 62 | 3.10.0 63 | 64 | 65 | 66 | org.apache.commons 67 | commons-lang3 68 | 3.0 69 | 70 | 71 | 72 | javax.validation 73 | validation-api 74 | 2.0.1.Final 75 | 76 | 77 | 78 | commons-io 79 | commons-io 80 | 2.5 81 | 82 | 83 | 84 | 85 | cn.hutool 86 | hutool-all 87 | 4.0.12 88 | 89 | 90 | 91 | 92 | com.alibaba 93 | fastjson 94 | ${fastjson.version} 95 | 96 | 97 | com.microsoft.sqlserver 98 | sqljdbc4 99 | 4.0 100 | 4.0 101 | 102 | 103 | 104 | com.microsoft.sqlserver 105 | mssql-jdbc 106 | 6.2.0.jre8 107 | runtime 108 | 109 | 110 | 111 | com.baidu.aip 112 | java-sdk 113 | 4.4.1 114 | 115 | 116 | 117 | org.springframework.boot 118 | spring-boot-starter-test 119 | test 120 | 121 | 122 | org.junit.vintage 123 | junit-vintage-engine 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | org.springframework.boot 133 | spring-boot-maven-plugin 134 | 135 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /src/main/java/com/entity/ZichanweixiuEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.NotEmpty; 7 | import javax.validation.constraints.NotNull; 8 | 9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 10 | import java.lang.reflect.InvocationTargetException; 11 | 12 | import java.io.Serializable; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | import org.springframework.format.annotation.DateTimeFormat; 17 | import com.fasterxml.jackson.annotation.JsonFormat; 18 | import org.apache.commons.beanutils.BeanUtils; 19 | import com.baomidou.mybatisplus.annotations.TableField; 20 | import com.baomidou.mybatisplus.enums.FieldFill; 21 | import com.baomidou.mybatisplus.enums.IdType; 22 | 23 | 24 | /** 25 | * 资产维修 26 | * 数据库通用操作实体类(普通增删改查) 27 | * @author 28 | * @email 29 | * @date 2021-05-11 09:16:46 30 | */ 31 | @TableName("zichanweixiu") 32 | public class ZichanweixiuEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public ZichanweixiuEntity() { 37 | 38 | } 39 | 40 | public ZichanweixiuEntity(T t) { 41 | try { 42 | BeanUtils.copyProperties(this, t); 43 | } catch (IllegalAccessException | InvocationTargetException e) { 44 | // TODO Auto-generated catch block 45 | e.printStackTrace(); 46 | } 47 | } 48 | 49 | /** 50 | * 主键id 51 | */ 52 | @TableId 53 | private Long id; 54 | /** 55 | * 资产编号 56 | */ 57 | 58 | private String zichanbianhao; 59 | 60 | /** 61 | * 设备名称 62 | */ 63 | 64 | private String shebeimingcheng; 65 | 66 | /** 67 | * 资产分类 68 | */ 69 | 70 | private String zichanfenlei; 71 | 72 | /** 73 | * 数量 74 | */ 75 | 76 | private Integer shuliang; 77 | 78 | /** 79 | * 维修数量 80 | */ 81 | 82 | private Integer weixiushuliang; 83 | 84 | /** 85 | * 维修说明 86 | */ 87 | 88 | private String weixiushuoming; 89 | 90 | /** 91 | * 维修进度 92 | */ 93 | 94 | private String weixiujindu; 95 | 96 | 97 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 98 | @DateTimeFormat 99 | private Date addtime; 100 | 101 | public Date getAddtime() { 102 | return addtime; 103 | } 104 | public void setAddtime(Date addtime) { 105 | this.addtime = addtime; 106 | } 107 | 108 | public Long getId() { 109 | return id; 110 | } 111 | 112 | public void setId(Long id) { 113 | this.id = id; 114 | } 115 | /** 116 | * 设置:资产编号 117 | */ 118 | public void setZichanbianhao(String zichanbianhao) { 119 | this.zichanbianhao = zichanbianhao; 120 | } 121 | /** 122 | * 获取:资产编号 123 | */ 124 | public String getZichanbianhao() { 125 | return zichanbianhao; 126 | } 127 | /** 128 | * 设置:设备名称 129 | */ 130 | public void setShebeimingcheng(String shebeimingcheng) { 131 | this.shebeimingcheng = shebeimingcheng; 132 | } 133 | /** 134 | * 获取:设备名称 135 | */ 136 | public String getShebeimingcheng() { 137 | return shebeimingcheng; 138 | } 139 | /** 140 | * 设置:资产分类 141 | */ 142 | public void setZichanfenlei(String zichanfenlei) { 143 | this.zichanfenlei = zichanfenlei; 144 | } 145 | /** 146 | * 获取:资产分类 147 | */ 148 | public String getZichanfenlei() { 149 | return zichanfenlei; 150 | } 151 | /** 152 | * 设置:数量 153 | */ 154 | public void setShuliang(Integer shuliang) { 155 | this.shuliang = shuliang; 156 | } 157 | /** 158 | * 获取:数量 159 | */ 160 | public Integer getShuliang() { 161 | return shuliang; 162 | } 163 | /** 164 | * 设置:维修数量 165 | */ 166 | public void setWeixiushuliang(Integer weixiushuliang) { 167 | this.weixiushuliang = weixiushuliang; 168 | } 169 | /** 170 | * 获取:维修数量 171 | */ 172 | public Integer getWeixiushuliang() { 173 | return weixiushuliang; 174 | } 175 | /** 176 | * 设置:维修说明 177 | */ 178 | public void setWeixiushuoming(String weixiushuoming) { 179 | this.weixiushuoming = weixiushuoming; 180 | } 181 | /** 182 | * 获取:维修说明 183 | */ 184 | public String getWeixiushuoming() { 185 | return weixiushuoming; 186 | } 187 | /** 188 | * 设置:维修进度 189 | */ 190 | public void setWeixiujindu(String weixiujindu) { 191 | this.weixiujindu = weixiujindu; 192 | } 193 | /** 194 | * 获取:维修进度 195 | */ 196 | public String getWeixiujindu() { 197 | return weixiujindu; 198 | } 199 | 200 | } 201 | -------------------------------------------------------------------------------- /src/main/java/com/entity/ZichanxinxiEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.NotEmpty; 7 | import javax.validation.constraints.NotNull; 8 | 9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 10 | import java.lang.reflect.InvocationTargetException; 11 | 12 | import java.io.Serializable; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | import org.springframework.format.annotation.DateTimeFormat; 17 | import com.fasterxml.jackson.annotation.JsonFormat; 18 | import org.apache.commons.beanutils.BeanUtils; 19 | import com.baomidou.mybatisplus.annotations.TableField; 20 | import com.baomidou.mybatisplus.enums.FieldFill; 21 | import com.baomidou.mybatisplus.enums.IdType; 22 | 23 | 24 | /** 25 | * 资产信息 26 | * 数据库通用操作实体类(普通增删改查) 27 | * @author 28 | * @email 29 | * @date 2021-05-11 09:16:46 30 | */ 31 | @TableName("zichanxinxi") 32 | public class ZichanxinxiEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public ZichanxinxiEntity() { 37 | 38 | } 39 | 40 | public ZichanxinxiEntity(T t) { 41 | try { 42 | BeanUtils.copyProperties(this, t); 43 | } catch (IllegalAccessException | InvocationTargetException e) { 44 | // TODO Auto-generated catch block 45 | e.printStackTrace(); 46 | } 47 | } 48 | 49 | /** 50 | * 主键id 51 | */ 52 | @TableId 53 | private Long id; 54 | /** 55 | * 资产编号 56 | */ 57 | 58 | private String zichanbianhao; 59 | 60 | /** 61 | * 设备名称 62 | */ 63 | 64 | private String shebeimingcheng; 65 | 66 | /** 67 | * 资产分类 68 | */ 69 | 70 | private String zichanfenlei; 71 | 72 | /** 73 | * 资产图片 74 | */ 75 | 76 | private String zichantupian; 77 | 78 | /** 79 | * 数量 80 | */ 81 | 82 | private Integer shuliang; 83 | 84 | /** 85 | * 备注说明 86 | */ 87 | 88 | private String beizhushuoming; 89 | 90 | /** 91 | * 当前位置 92 | */ 93 | 94 | private String dangqianweizhi; 95 | 96 | 97 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 98 | @DateTimeFormat 99 | private Date addtime; 100 | 101 | public Date getAddtime() { 102 | return addtime; 103 | } 104 | public void setAddtime(Date addtime) { 105 | this.addtime = addtime; 106 | } 107 | 108 | public Long getId() { 109 | return id; 110 | } 111 | 112 | public void setId(Long id) { 113 | this.id = id; 114 | } 115 | /** 116 | * 设置:资产编号 117 | */ 118 | public void setZichanbianhao(String zichanbianhao) { 119 | this.zichanbianhao = zichanbianhao; 120 | } 121 | /** 122 | * 获取:资产编号 123 | */ 124 | public String getZichanbianhao() { 125 | return zichanbianhao; 126 | } 127 | /** 128 | * 设置:设备名称 129 | */ 130 | public void setShebeimingcheng(String shebeimingcheng) { 131 | this.shebeimingcheng = shebeimingcheng; 132 | } 133 | /** 134 | * 获取:设备名称 135 | */ 136 | public String getShebeimingcheng() { 137 | return shebeimingcheng; 138 | } 139 | /** 140 | * 设置:资产分类 141 | */ 142 | public void setZichanfenlei(String zichanfenlei) { 143 | this.zichanfenlei = zichanfenlei; 144 | } 145 | /** 146 | * 获取:资产分类 147 | */ 148 | public String getZichanfenlei() { 149 | return zichanfenlei; 150 | } 151 | /** 152 | * 设置:资产图片 153 | */ 154 | public void setZichantupian(String zichantupian) { 155 | this.zichantupian = zichantupian; 156 | } 157 | /** 158 | * 获取:资产图片 159 | */ 160 | public String getZichantupian() { 161 | return zichantupian; 162 | } 163 | /** 164 | * 设置:数量 165 | */ 166 | public void setShuliang(Integer shuliang) { 167 | this.shuliang = shuliang; 168 | } 169 | /** 170 | * 获取:数量 171 | */ 172 | public Integer getShuliang() { 173 | return shuliang; 174 | } 175 | /** 176 | * 设置:备注说明 177 | */ 178 | public void setBeizhushuoming(String beizhushuoming) { 179 | this.beizhushuoming = beizhushuoming; 180 | } 181 | /** 182 | * 获取:备注说明 183 | */ 184 | public String getBeizhushuoming() { 185 | return beizhushuoming; 186 | } 187 | /** 188 | * 设置:当前位置 189 | */ 190 | public void setDangqianweizhi(String dangqianweizhi) { 191 | this.dangqianweizhi = dangqianweizhi; 192 | } 193 | /** 194 | * 获取:当前位置 195 | */ 196 | public String getDangqianweizhi() { 197 | return dangqianweizhi; 198 | } 199 | 200 | } 201 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/ZichanguihaiVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.ZichanguihaiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 资产归还 15 | * 手机端接口返回实体辅助类 16 | * (主要作用去除一些不必要的字段) 17 | * @author 18 | * @email 19 | * @date 2021-05-11 09:16:46 20 | */ 21 | public class ZichanguihaiVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | /** 26 | * 设备名称 27 | */ 28 | 29 | private String shebeimingcheng; 30 | 31 | /** 32 | * 资产分类 33 | */ 34 | 35 | private String zichanfenlei; 36 | 37 | /** 38 | * 资产图片 39 | */ 40 | 41 | private String zichantupian; 42 | 43 | /** 44 | * 数量 45 | */ 46 | 47 | private Integer shuliang; 48 | 49 | /** 50 | * 归还日期 51 | */ 52 | 53 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 54 | @DateTimeFormat 55 | private Date guihairiqi; 56 | 57 | /** 58 | * 归还备注 59 | */ 60 | 61 | private String guihaibeizhu; 62 | 63 | /** 64 | * 用户名 65 | */ 66 | 67 | private String yonghuming; 68 | 69 | /** 70 | * 姓名 71 | */ 72 | 73 | private String xingming; 74 | 75 | /** 76 | * 手机 77 | */ 78 | 79 | private String shouji; 80 | 81 | /** 82 | * 身份证 83 | */ 84 | 85 | private String shenfenzheng; 86 | 87 | /** 88 | * 是否审核 89 | */ 90 | 91 | private String sfsh; 92 | 93 | /** 94 | * 审核回复 95 | */ 96 | 97 | private String shhf; 98 | 99 | 100 | /** 101 | * 设置:设备名称 102 | */ 103 | 104 | public void setShebeimingcheng(String shebeimingcheng) { 105 | this.shebeimingcheng = shebeimingcheng; 106 | } 107 | 108 | /** 109 | * 获取:设备名称 110 | */ 111 | public String getShebeimingcheng() { 112 | return shebeimingcheng; 113 | } 114 | 115 | 116 | /** 117 | * 设置:资产分类 118 | */ 119 | 120 | public void setZichanfenlei(String zichanfenlei) { 121 | this.zichanfenlei = zichanfenlei; 122 | } 123 | 124 | /** 125 | * 获取:资产分类 126 | */ 127 | public String getZichanfenlei() { 128 | return zichanfenlei; 129 | } 130 | 131 | 132 | /** 133 | * 设置:资产图片 134 | */ 135 | 136 | public void setZichantupian(String zichantupian) { 137 | this.zichantupian = zichantupian; 138 | } 139 | 140 | /** 141 | * 获取:资产图片 142 | */ 143 | public String getZichantupian() { 144 | return zichantupian; 145 | } 146 | 147 | 148 | /** 149 | * 设置:数量 150 | */ 151 | 152 | public void setShuliang(Integer shuliang) { 153 | this.shuliang = shuliang; 154 | } 155 | 156 | /** 157 | * 获取:数量 158 | */ 159 | public Integer getShuliang() { 160 | return shuliang; 161 | } 162 | 163 | 164 | /** 165 | * 设置:归还日期 166 | */ 167 | 168 | public void setGuihairiqi(Date guihairiqi) { 169 | this.guihairiqi = guihairiqi; 170 | } 171 | 172 | /** 173 | * 获取:归还日期 174 | */ 175 | public Date getGuihairiqi() { 176 | return guihairiqi; 177 | } 178 | 179 | 180 | /** 181 | * 设置:归还备注 182 | */ 183 | 184 | public void setGuihaibeizhu(String guihaibeizhu) { 185 | this.guihaibeizhu = guihaibeizhu; 186 | } 187 | 188 | /** 189 | * 获取:归还备注 190 | */ 191 | public String getGuihaibeizhu() { 192 | return guihaibeizhu; 193 | } 194 | 195 | 196 | /** 197 | * 设置:用户名 198 | */ 199 | 200 | public void setYonghuming(String yonghuming) { 201 | this.yonghuming = yonghuming; 202 | } 203 | 204 | /** 205 | * 获取:用户名 206 | */ 207 | public String getYonghuming() { 208 | return yonghuming; 209 | } 210 | 211 | 212 | /** 213 | * 设置:姓名 214 | */ 215 | 216 | public void setXingming(String xingming) { 217 | this.xingming = xingming; 218 | } 219 | 220 | /** 221 | * 获取:姓名 222 | */ 223 | public String getXingming() { 224 | return xingming; 225 | } 226 | 227 | 228 | /** 229 | * 设置:手机 230 | */ 231 | 232 | public void setShouji(String shouji) { 233 | this.shouji = shouji; 234 | } 235 | 236 | /** 237 | * 获取:手机 238 | */ 239 | public String getShouji() { 240 | return shouji; 241 | } 242 | 243 | 244 | /** 245 | * 设置:身份证 246 | */ 247 | 248 | public void setShenfenzheng(String shenfenzheng) { 249 | this.shenfenzheng = shenfenzheng; 250 | } 251 | 252 | /** 253 | * 获取:身份证 254 | */ 255 | public String getShenfenzheng() { 256 | return shenfenzheng; 257 | } 258 | 259 | 260 | /** 261 | * 设置:是否审核 262 | */ 263 | 264 | public void setSfsh(String sfsh) { 265 | this.sfsh = sfsh; 266 | } 267 | 268 | /** 269 | * 获取:是否审核 270 | */ 271 | public String getSfsh() { 272 | return sfsh; 273 | } 274 | 275 | 276 | /** 277 | * 设置:审核回复 278 | */ 279 | 280 | public void setShhf(String shhf) { 281 | this.shhf = shhf; 282 | } 283 | 284 | /** 285 | * 获取:审核回复 286 | */ 287 | public String getShhf() { 288 | return shhf; 289 | } 290 | 291 | } 292 | -------------------------------------------------------------------------------- /src/main/java/com/entity/vo/ZichanjiechuVO.java: -------------------------------------------------------------------------------- 1 | package com.entity.vo; 2 | 3 | import com.entity.ZichanjiechuEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 资产借出 15 | * 手机端接口返回实体辅助类 16 | * (主要作用去除一些不必要的字段) 17 | * @author 18 | * @email 19 | * @date 2021-05-11 09:16:46 20 | */ 21 | public class ZichanjiechuVO implements Serializable { 22 | private static final long serialVersionUID = 1L; 23 | 24 | 25 | /** 26 | * 设备名称 27 | */ 28 | 29 | private String shebeimingcheng; 30 | 31 | /** 32 | * 资产分类 33 | */ 34 | 35 | private String zichanfenlei; 36 | 37 | /** 38 | * 资产图片 39 | */ 40 | 41 | private String zichantupian; 42 | 43 | /** 44 | * 数量 45 | */ 46 | 47 | private Integer shuliang; 48 | 49 | /** 50 | * 借出日期 51 | */ 52 | 53 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 54 | @DateTimeFormat 55 | private Date jiechuriqi; 56 | 57 | /** 58 | * 借出备注 59 | */ 60 | 61 | private String jiechubeizhu; 62 | 63 | /** 64 | * 用户名 65 | */ 66 | 67 | private String yonghuming; 68 | 69 | /** 70 | * 姓名 71 | */ 72 | 73 | private String xingming; 74 | 75 | /** 76 | * 手机 77 | */ 78 | 79 | private String shouji; 80 | 81 | /** 82 | * 身份证 83 | */ 84 | 85 | private String shenfenzheng; 86 | 87 | /** 88 | * 是否审核 89 | */ 90 | 91 | private String sfsh; 92 | 93 | /** 94 | * 审核回复 95 | */ 96 | 97 | private String shhf; 98 | 99 | 100 | /** 101 | * 设置:设备名称 102 | */ 103 | 104 | public void setShebeimingcheng(String shebeimingcheng) { 105 | this.shebeimingcheng = shebeimingcheng; 106 | } 107 | 108 | /** 109 | * 获取:设备名称 110 | */ 111 | public String getShebeimingcheng() { 112 | return shebeimingcheng; 113 | } 114 | 115 | 116 | /** 117 | * 设置:资产分类 118 | */ 119 | 120 | public void setZichanfenlei(String zichanfenlei) { 121 | this.zichanfenlei = zichanfenlei; 122 | } 123 | 124 | /** 125 | * 获取:资产分类 126 | */ 127 | public String getZichanfenlei() { 128 | return zichanfenlei; 129 | } 130 | 131 | 132 | /** 133 | * 设置:资产图片 134 | */ 135 | 136 | public void setZichantupian(String zichantupian) { 137 | this.zichantupian = zichantupian; 138 | } 139 | 140 | /** 141 | * 获取:资产图片 142 | */ 143 | public String getZichantupian() { 144 | return zichantupian; 145 | } 146 | 147 | 148 | /** 149 | * 设置:数量 150 | */ 151 | 152 | public void setShuliang(Integer shuliang) { 153 | this.shuliang = shuliang; 154 | } 155 | 156 | /** 157 | * 获取:数量 158 | */ 159 | public Integer getShuliang() { 160 | return shuliang; 161 | } 162 | 163 | 164 | /** 165 | * 设置:借出日期 166 | */ 167 | 168 | public void setJiechuriqi(Date jiechuriqi) { 169 | this.jiechuriqi = jiechuriqi; 170 | } 171 | 172 | /** 173 | * 获取:借出日期 174 | */ 175 | public Date getJiechuriqi() { 176 | return jiechuriqi; 177 | } 178 | 179 | 180 | /** 181 | * 设置:借出备注 182 | */ 183 | 184 | public void setJiechubeizhu(String jiechubeizhu) { 185 | this.jiechubeizhu = jiechubeizhu; 186 | } 187 | 188 | /** 189 | * 获取:借出备注 190 | */ 191 | public String getJiechubeizhu() { 192 | return jiechubeizhu; 193 | } 194 | 195 | 196 | /** 197 | * 设置:用户名 198 | */ 199 | 200 | public void setYonghuming(String yonghuming) { 201 | this.yonghuming = yonghuming; 202 | } 203 | 204 | /** 205 | * 获取:用户名 206 | */ 207 | public String getYonghuming() { 208 | return yonghuming; 209 | } 210 | 211 | 212 | /** 213 | * 设置:姓名 214 | */ 215 | 216 | public void setXingming(String xingming) { 217 | this.xingming = xingming; 218 | } 219 | 220 | /** 221 | * 获取:姓名 222 | */ 223 | public String getXingming() { 224 | return xingming; 225 | } 226 | 227 | 228 | /** 229 | * 设置:手机 230 | */ 231 | 232 | public void setShouji(String shouji) { 233 | this.shouji = shouji; 234 | } 235 | 236 | /** 237 | * 获取:手机 238 | */ 239 | public String getShouji() { 240 | return shouji; 241 | } 242 | 243 | 244 | /** 245 | * 设置:身份证 246 | */ 247 | 248 | public void setShenfenzheng(String shenfenzheng) { 249 | this.shenfenzheng = shenfenzheng; 250 | } 251 | 252 | /** 253 | * 获取:身份证 254 | */ 255 | public String getShenfenzheng() { 256 | return shenfenzheng; 257 | } 258 | 259 | 260 | /** 261 | * 设置:是否审核 262 | */ 263 | 264 | public void setSfsh(String sfsh) { 265 | this.sfsh = sfsh; 266 | } 267 | 268 | /** 269 | * 获取:是否审核 270 | */ 271 | public String getSfsh() { 272 | return sfsh; 273 | } 274 | 275 | 276 | /** 277 | * 设置:审核回复 278 | */ 279 | 280 | public void setShhf(String shhf) { 281 | this.shhf = shhf; 282 | } 283 | 284 | /** 285 | * 获取:审核回复 286 | */ 287 | public String getShhf() { 288 | return shhf; 289 | } 290 | 291 | } 292 | -------------------------------------------------------------------------------- /src/main/java/com/entity/YonghuEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.NotEmpty; 7 | import javax.validation.constraints.NotNull; 8 | 9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 10 | import java.lang.reflect.InvocationTargetException; 11 | 12 | import java.io.Serializable; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | import org.springframework.format.annotation.DateTimeFormat; 17 | import com.fasterxml.jackson.annotation.JsonFormat; 18 | import org.apache.commons.beanutils.BeanUtils; 19 | import com.baomidou.mybatisplus.annotations.TableField; 20 | import com.baomidou.mybatisplus.enums.FieldFill; 21 | import com.baomidou.mybatisplus.enums.IdType; 22 | 23 | 24 | /** 25 | * 用户 26 | * 数据库通用操作实体类(普通增删改查) 27 | * @author 28 | * @email 29 | * @date 2021-05-11 09:16:46 30 | */ 31 | @TableName("yonghu") 32 | public class YonghuEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public YonghuEntity() { 37 | 38 | } 39 | 40 | public YonghuEntity(T t) { 41 | try { 42 | BeanUtils.copyProperties(this, t); 43 | } catch (IllegalAccessException | InvocationTargetException e) { 44 | // TODO Auto-generated catch block 45 | e.printStackTrace(); 46 | } 47 | } 48 | 49 | /** 50 | * 主键id 51 | */ 52 | @TableId 53 | private Long id; 54 | /** 55 | * 用户名 56 | */ 57 | 58 | private String yonghuming; 59 | 60 | /** 61 | * 密码 62 | */ 63 | 64 | private String mima; 65 | 66 | /** 67 | * 姓名 68 | */ 69 | 70 | private String xingming; 71 | 72 | /** 73 | * 性别 74 | */ 75 | 76 | private String xingbie; 77 | 78 | /** 79 | * 头像 80 | */ 81 | 82 | private String touxiang; 83 | 84 | /** 85 | * 手机 86 | */ 87 | 88 | private String shouji; 89 | 90 | /** 91 | * 邮箱 92 | */ 93 | 94 | private String youxiang; 95 | 96 | /** 97 | * 身份证 98 | */ 99 | 100 | private String shenfenzheng; 101 | 102 | /** 103 | * 是否审核 104 | */ 105 | 106 | private String sfsh; 107 | 108 | /** 109 | * 审核回复 110 | */ 111 | 112 | private String shhf; 113 | 114 | 115 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 116 | @DateTimeFormat 117 | private Date addtime; 118 | 119 | public Date getAddtime() { 120 | return addtime; 121 | } 122 | public void setAddtime(Date addtime) { 123 | this.addtime = addtime; 124 | } 125 | 126 | public Long getId() { 127 | return id; 128 | } 129 | 130 | public void setId(Long id) { 131 | this.id = id; 132 | } 133 | /** 134 | * 设置:用户名 135 | */ 136 | public void setYonghuming(String yonghuming) { 137 | this.yonghuming = yonghuming; 138 | } 139 | /** 140 | * 获取:用户名 141 | */ 142 | public String getYonghuming() { 143 | return yonghuming; 144 | } 145 | /** 146 | * 设置:密码 147 | */ 148 | public void setMima(String mima) { 149 | this.mima = mima; 150 | } 151 | /** 152 | * 获取:密码 153 | */ 154 | public String getMima() { 155 | return mima; 156 | } 157 | /** 158 | * 设置:姓名 159 | */ 160 | public void setXingming(String xingming) { 161 | this.xingming = xingming; 162 | } 163 | /** 164 | * 获取:姓名 165 | */ 166 | public String getXingming() { 167 | return xingming; 168 | } 169 | /** 170 | * 设置:性别 171 | */ 172 | public void setXingbie(String xingbie) { 173 | this.xingbie = xingbie; 174 | } 175 | /** 176 | * 获取:性别 177 | */ 178 | public String getXingbie() { 179 | return xingbie; 180 | } 181 | /** 182 | * 设置:头像 183 | */ 184 | public void setTouxiang(String touxiang) { 185 | this.touxiang = touxiang; 186 | } 187 | /** 188 | * 获取:头像 189 | */ 190 | public String getTouxiang() { 191 | return touxiang; 192 | } 193 | /** 194 | * 设置:手机 195 | */ 196 | public void setShouji(String shouji) { 197 | this.shouji = shouji; 198 | } 199 | /** 200 | * 获取:手机 201 | */ 202 | public String getShouji() { 203 | return shouji; 204 | } 205 | /** 206 | * 设置:邮箱 207 | */ 208 | public void setYouxiang(String youxiang) { 209 | this.youxiang = youxiang; 210 | } 211 | /** 212 | * 获取:邮箱 213 | */ 214 | public String getYouxiang() { 215 | return youxiang; 216 | } 217 | /** 218 | * 设置:身份证 219 | */ 220 | public void setShenfenzheng(String shenfenzheng) { 221 | this.shenfenzheng = shenfenzheng; 222 | } 223 | /** 224 | * 获取:身份证 225 | */ 226 | public String getShenfenzheng() { 227 | return shenfenzheng; 228 | } 229 | /** 230 | * 设置:是否审核 231 | */ 232 | public void setSfsh(String sfsh) { 233 | this.sfsh = sfsh; 234 | } 235 | /** 236 | * 获取:是否审核 237 | */ 238 | public String getSfsh() { 239 | return sfsh; 240 | } 241 | /** 242 | * 设置:审核回复 243 | */ 244 | public void setShhf(String shhf) { 245 | this.shhf = shhf; 246 | } 247 | /** 248 | * 获取:审核回复 249 | */ 250 | public String getShhf() { 251 | return shhf; 252 | } 253 | 254 | } 255 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/ZichanguihaiModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.ZichanguihaiEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 资产归还 15 | * 接收传参的实体类 16 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 17 | * 取自ModelAndView 的model名称 18 | * @author 19 | * @email 20 | * @date 2021-05-11 09:16:46 21 | */ 22 | public class ZichanguihaiModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | /** 27 | * 设备名称 28 | */ 29 | 30 | private String shebeimingcheng; 31 | 32 | /** 33 | * 资产分类 34 | */ 35 | 36 | private String zichanfenlei; 37 | 38 | /** 39 | * 资产图片 40 | */ 41 | 42 | private String zichantupian; 43 | 44 | /** 45 | * 数量 46 | */ 47 | 48 | private Integer shuliang; 49 | 50 | /** 51 | * 归还日期 52 | */ 53 | 54 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 55 | @DateTimeFormat 56 | private Date guihairiqi; 57 | 58 | /** 59 | * 归还备注 60 | */ 61 | 62 | private String guihaibeizhu; 63 | 64 | /** 65 | * 用户名 66 | */ 67 | 68 | private String yonghuming; 69 | 70 | /** 71 | * 姓名 72 | */ 73 | 74 | private String xingming; 75 | 76 | /** 77 | * 手机 78 | */ 79 | 80 | private String shouji; 81 | 82 | /** 83 | * 身份证 84 | */ 85 | 86 | private String shenfenzheng; 87 | 88 | /** 89 | * 是否审核 90 | */ 91 | 92 | private String sfsh; 93 | 94 | /** 95 | * 审核回复 96 | */ 97 | 98 | private String shhf; 99 | 100 | 101 | /** 102 | * 设置:设备名称 103 | */ 104 | 105 | public void setShebeimingcheng(String shebeimingcheng) { 106 | this.shebeimingcheng = shebeimingcheng; 107 | } 108 | 109 | /** 110 | * 获取:设备名称 111 | */ 112 | public String getShebeimingcheng() { 113 | return shebeimingcheng; 114 | } 115 | 116 | 117 | /** 118 | * 设置:资产分类 119 | */ 120 | 121 | public void setZichanfenlei(String zichanfenlei) { 122 | this.zichanfenlei = zichanfenlei; 123 | } 124 | 125 | /** 126 | * 获取:资产分类 127 | */ 128 | public String getZichanfenlei() { 129 | return zichanfenlei; 130 | } 131 | 132 | 133 | /** 134 | * 设置:资产图片 135 | */ 136 | 137 | public void setZichantupian(String zichantupian) { 138 | this.zichantupian = zichantupian; 139 | } 140 | 141 | /** 142 | * 获取:资产图片 143 | */ 144 | public String getZichantupian() { 145 | return zichantupian; 146 | } 147 | 148 | 149 | /** 150 | * 设置:数量 151 | */ 152 | 153 | public void setShuliang(Integer shuliang) { 154 | this.shuliang = shuliang; 155 | } 156 | 157 | /** 158 | * 获取:数量 159 | */ 160 | public Integer getShuliang() { 161 | return shuliang; 162 | } 163 | 164 | 165 | /** 166 | * 设置:归还日期 167 | */ 168 | 169 | public void setGuihairiqi(Date guihairiqi) { 170 | this.guihairiqi = guihairiqi; 171 | } 172 | 173 | /** 174 | * 获取:归还日期 175 | */ 176 | public Date getGuihairiqi() { 177 | return guihairiqi; 178 | } 179 | 180 | 181 | /** 182 | * 设置:归还备注 183 | */ 184 | 185 | public void setGuihaibeizhu(String guihaibeizhu) { 186 | this.guihaibeizhu = guihaibeizhu; 187 | } 188 | 189 | /** 190 | * 获取:归还备注 191 | */ 192 | public String getGuihaibeizhu() { 193 | return guihaibeizhu; 194 | } 195 | 196 | 197 | /** 198 | * 设置:用户名 199 | */ 200 | 201 | public void setYonghuming(String yonghuming) { 202 | this.yonghuming = yonghuming; 203 | } 204 | 205 | /** 206 | * 获取:用户名 207 | */ 208 | public String getYonghuming() { 209 | return yonghuming; 210 | } 211 | 212 | 213 | /** 214 | * 设置:姓名 215 | */ 216 | 217 | public void setXingming(String xingming) { 218 | this.xingming = xingming; 219 | } 220 | 221 | /** 222 | * 获取:姓名 223 | */ 224 | public String getXingming() { 225 | return xingming; 226 | } 227 | 228 | 229 | /** 230 | * 设置:手机 231 | */ 232 | 233 | public void setShouji(String shouji) { 234 | this.shouji = shouji; 235 | } 236 | 237 | /** 238 | * 获取:手机 239 | */ 240 | public String getShouji() { 241 | return shouji; 242 | } 243 | 244 | 245 | /** 246 | * 设置:身份证 247 | */ 248 | 249 | public void setShenfenzheng(String shenfenzheng) { 250 | this.shenfenzheng = shenfenzheng; 251 | } 252 | 253 | /** 254 | * 获取:身份证 255 | */ 256 | public String getShenfenzheng() { 257 | return shenfenzheng; 258 | } 259 | 260 | 261 | /** 262 | * 设置:是否审核 263 | */ 264 | 265 | public void setSfsh(String sfsh) { 266 | this.sfsh = sfsh; 267 | } 268 | 269 | /** 270 | * 获取:是否审核 271 | */ 272 | public String getSfsh() { 273 | return sfsh; 274 | } 275 | 276 | 277 | /** 278 | * 设置:审核回复 279 | */ 280 | 281 | public void setShhf(String shhf) { 282 | this.shhf = shhf; 283 | } 284 | 285 | /** 286 | * 获取:审核回复 287 | */ 288 | public String getShhf() { 289 | return shhf; 290 | } 291 | 292 | } 293 | -------------------------------------------------------------------------------- /src/main/java/com/entity/model/ZichanjiechuModel.java: -------------------------------------------------------------------------------- 1 | package com.entity.model; 2 | 3 | import com.entity.ZichanjiechuEntity; 4 | 5 | import com.baomidou.mybatisplus.annotations.TableName; 6 | import java.util.Date; 7 | import org.springframework.format.annotation.DateTimeFormat; 8 | 9 | import com.fasterxml.jackson.annotation.JsonFormat; 10 | import java.io.Serializable; 11 | 12 | 13 | /** 14 | * 资产借出 15 | * 接收传参的实体类 16 | *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) 17 | * 取自ModelAndView 的model名称 18 | * @author 19 | * @email 20 | * @date 2021-05-11 09:16:46 21 | */ 22 | public class ZichanjiechuModel implements Serializable { 23 | private static final long serialVersionUID = 1L; 24 | 25 | 26 | /** 27 | * 设备名称 28 | */ 29 | 30 | private String shebeimingcheng; 31 | 32 | /** 33 | * 资产分类 34 | */ 35 | 36 | private String zichanfenlei; 37 | 38 | /** 39 | * 资产图片 40 | */ 41 | 42 | private String zichantupian; 43 | 44 | /** 45 | * 数量 46 | */ 47 | 48 | private Integer shuliang; 49 | 50 | /** 51 | * 借出日期 52 | */ 53 | 54 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 55 | @DateTimeFormat 56 | private Date jiechuriqi; 57 | 58 | /** 59 | * 借出备注 60 | */ 61 | 62 | private String jiechubeizhu; 63 | 64 | /** 65 | * 用户名 66 | */ 67 | 68 | private String yonghuming; 69 | 70 | /** 71 | * 姓名 72 | */ 73 | 74 | private String xingming; 75 | 76 | /** 77 | * 手机 78 | */ 79 | 80 | private String shouji; 81 | 82 | /** 83 | * 身份证 84 | */ 85 | 86 | private String shenfenzheng; 87 | 88 | /** 89 | * 是否审核 90 | */ 91 | 92 | private String sfsh; 93 | 94 | /** 95 | * 审核回复 96 | */ 97 | 98 | private String shhf; 99 | 100 | 101 | /** 102 | * 设置:设备名称 103 | */ 104 | 105 | public void setShebeimingcheng(String shebeimingcheng) { 106 | this.shebeimingcheng = shebeimingcheng; 107 | } 108 | 109 | /** 110 | * 获取:设备名称 111 | */ 112 | public String getShebeimingcheng() { 113 | return shebeimingcheng; 114 | } 115 | 116 | 117 | /** 118 | * 设置:资产分类 119 | */ 120 | 121 | public void setZichanfenlei(String zichanfenlei) { 122 | this.zichanfenlei = zichanfenlei; 123 | } 124 | 125 | /** 126 | * 获取:资产分类 127 | */ 128 | public String getZichanfenlei() { 129 | return zichanfenlei; 130 | } 131 | 132 | 133 | /** 134 | * 设置:资产图片 135 | */ 136 | 137 | public void setZichantupian(String zichantupian) { 138 | this.zichantupian = zichantupian; 139 | } 140 | 141 | /** 142 | * 获取:资产图片 143 | */ 144 | public String getZichantupian() { 145 | return zichantupian; 146 | } 147 | 148 | 149 | /** 150 | * 设置:数量 151 | */ 152 | 153 | public void setShuliang(Integer shuliang) { 154 | this.shuliang = shuliang; 155 | } 156 | 157 | /** 158 | * 获取:数量 159 | */ 160 | public Integer getShuliang() { 161 | return shuliang; 162 | } 163 | 164 | 165 | /** 166 | * 设置:借出日期 167 | */ 168 | 169 | public void setJiechuriqi(Date jiechuriqi) { 170 | this.jiechuriqi = jiechuriqi; 171 | } 172 | 173 | /** 174 | * 获取:借出日期 175 | */ 176 | public Date getJiechuriqi() { 177 | return jiechuriqi; 178 | } 179 | 180 | 181 | /** 182 | * 设置:借出备注 183 | */ 184 | 185 | public void setJiechubeizhu(String jiechubeizhu) { 186 | this.jiechubeizhu = jiechubeizhu; 187 | } 188 | 189 | /** 190 | * 获取:借出备注 191 | */ 192 | public String getJiechubeizhu() { 193 | return jiechubeizhu; 194 | } 195 | 196 | 197 | /** 198 | * 设置:用户名 199 | */ 200 | 201 | public void setYonghuming(String yonghuming) { 202 | this.yonghuming = yonghuming; 203 | } 204 | 205 | /** 206 | * 获取:用户名 207 | */ 208 | public String getYonghuming() { 209 | return yonghuming; 210 | } 211 | 212 | 213 | /** 214 | * 设置:姓名 215 | */ 216 | 217 | public void setXingming(String xingming) { 218 | this.xingming = xingming; 219 | } 220 | 221 | /** 222 | * 获取:姓名 223 | */ 224 | public String getXingming() { 225 | return xingming; 226 | } 227 | 228 | 229 | /** 230 | * 设置:手机 231 | */ 232 | 233 | public void setShouji(String shouji) { 234 | this.shouji = shouji; 235 | } 236 | 237 | /** 238 | * 获取:手机 239 | */ 240 | public String getShouji() { 241 | return shouji; 242 | } 243 | 244 | 245 | /** 246 | * 设置:身份证 247 | */ 248 | 249 | public void setShenfenzheng(String shenfenzheng) { 250 | this.shenfenzheng = shenfenzheng; 251 | } 252 | 253 | /** 254 | * 获取:身份证 255 | */ 256 | public String getShenfenzheng() { 257 | return shenfenzheng; 258 | } 259 | 260 | 261 | /** 262 | * 设置:是否审核 263 | */ 264 | 265 | public void setSfsh(String sfsh) { 266 | this.sfsh = sfsh; 267 | } 268 | 269 | /** 270 | * 获取:是否审核 271 | */ 272 | public String getSfsh() { 273 | return sfsh; 274 | } 275 | 276 | 277 | /** 278 | * 设置:审核回复 279 | */ 280 | 281 | public void setShhf(String shhf) { 282 | this.shhf = shhf; 283 | } 284 | 285 | /** 286 | * 获取:审核回复 287 | */ 288 | public String getShhf() { 289 | return shhf; 290 | } 291 | 292 | } 293 | -------------------------------------------------------------------------------- /.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012-2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import java.net.*; 17 | import java.io.*; 18 | import java.nio.channels.*; 19 | import java.util.Properties; 20 | 21 | public class MavenWrapperDownloader { 22 | 23 | private static final String WRAPPER_VERSION = "0.5.5"; 24 | /** 25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 26 | */ 27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" 28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; 29 | 30 | /** 31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 32 | * use instead of the default one. 33 | */ 34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 35 | ".mvn/wrapper/maven-wrapper.properties"; 36 | 37 | /** 38 | * Path where the maven-wrapper.jar will be saved to. 39 | */ 40 | private static final String MAVEN_WRAPPER_JAR_PATH = 41 | ".mvn/wrapper/maven-wrapper.jar"; 42 | 43 | /** 44 | * Name of the property which should be used to override the default download url for the wrapper. 45 | */ 46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 47 | 48 | public static void main(String args[]) { 49 | System.out.println("- Downloader started"); 50 | File baseDirectory = new File(args[0]); 51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 52 | 53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 54 | // wrapperUrl parameter. 55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 56 | String url = DEFAULT_DOWNLOAD_URL; 57 | if(mavenWrapperPropertyFile.exists()) { 58 | FileInputStream mavenWrapperPropertyFileInputStream = null; 59 | try { 60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 61 | Properties mavenWrapperProperties = new Properties(); 62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 64 | } catch (IOException e) { 65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 66 | } finally { 67 | try { 68 | if(mavenWrapperPropertyFileInputStream != null) { 69 | mavenWrapperPropertyFileInputStream.close(); 70 | } 71 | } catch (IOException e) { 72 | // Ignore ... 73 | } 74 | } 75 | } 76 | System.out.println("- Downloading from: " + url); 77 | 78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 79 | if(!outputFile.getParentFile().exists()) { 80 | if(!outputFile.getParentFile().mkdirs()) { 81 | System.out.println( 82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 83 | } 84 | } 85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 86 | try { 87 | downloadFileFromURL(url, outputFile); 88 | System.out.println("Done"); 89 | System.exit(0); 90 | } catch (Throwable e) { 91 | System.out.println("- Error downloading"); 92 | e.printStackTrace(); 93 | System.exit(1); 94 | } 95 | } 96 | 97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { 99 | String username = System.getenv("MVNW_USERNAME"); 100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); 101 | Authenticator.setDefault(new Authenticator() { 102 | @Override 103 | protected PasswordAuthentication getPasswordAuthentication() { 104 | return new PasswordAuthentication(username, password); 105 | } 106 | }); 107 | } 108 | URL website = new URL(urlString); 109 | ReadableByteChannel rbc; 110 | rbc = Channels.newChannel(website.openStream()); 111 | FileOutputStream fos = new FileOutputStream(destination); 112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 113 | fos.close(); 114 | rbc.close(); 115 | } 116 | 117 | } 118 | -------------------------------------------------------------------------------- /src/main/java/com/controller/UserController.java: -------------------------------------------------------------------------------- 1 | 2 | package com.controller; 3 | 4 | 5 | import java.util.Arrays; 6 | import java.util.Calendar; 7 | import java.util.Date; 8 | import java.util.Map; 9 | 10 | import javax.servlet.http.HttpServletRequest; 11 | 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.stereotype.Controller; 14 | import org.springframework.web.bind.annotation.GetMapping; 15 | import org.springframework.web.bind.annotation.PathVariable; 16 | import org.springframework.web.bind.annotation.PostMapping; 17 | import org.springframework.web.bind.annotation.RequestBody; 18 | import org.springframework.web.bind.annotation.RequestMapping; 19 | import org.springframework.web.bind.annotation.RequestParam; 20 | import org.springframework.web.bind.annotation.ResponseBody; 21 | import org.springframework.web.bind.annotation.RestController; 22 | 23 | import com.annotation.IgnoreAuth; 24 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 25 | import com.entity.TokenEntity; 26 | import com.entity.UserEntity; 27 | import com.service.TokenService; 28 | import com.service.UserService; 29 | import com.utils.CommonUtil; 30 | import com.utils.MPUtil; 31 | import com.utils.PageUtils; 32 | import com.utils.R; 33 | import com.utils.ValidatorUtils; 34 | 35 | /** 36 | * 登录相关 37 | */ 38 | @RequestMapping("users") 39 | @RestController 40 | public class UserController{ 41 | 42 | @Autowired 43 | private UserService userService; 44 | 45 | @Autowired 46 | private TokenService tokenService; 47 | 48 | /** 49 | * 登录 50 | */ 51 | @IgnoreAuth 52 | @PostMapping(value = "/login") 53 | public R login(String username, String password, String captcha, HttpServletRequest request) { 54 | UserEntity user = userService.selectOne(new EntityWrapper().eq("username", username)); 55 | if(user==null || !user.getPassword().equals(password)) { 56 | return R.error("账号或密码不正确"); 57 | } 58 | String token = tokenService.generateToken(user.getId(),username, "users", user.getRole()); 59 | return R.ok().put("token", token); 60 | } 61 | 62 | /** 63 | * 注册 64 | */ 65 | @IgnoreAuth 66 | @PostMapping(value = "/register") 67 | public R register(@RequestBody UserEntity user){ 68 | // ValidatorUtils.validateEntity(user); 69 | if(userService.selectOne(new EntityWrapper().eq("username", user.getUsername())) !=null) { 70 | return R.error("用户已存在"); 71 | } 72 | userService.insert(user); 73 | return R.ok(); 74 | } 75 | 76 | /** 77 | * 退出 78 | */ 79 | @GetMapping(value = "logout") 80 | public R logout(HttpServletRequest request) { 81 | request.getSession().invalidate(); 82 | return R.ok("退出成功"); 83 | } 84 | 85 | /** 86 | * 密码重置 87 | */ 88 | @IgnoreAuth 89 | @RequestMapping(value = "/resetPass") 90 | public R resetPass(String username, HttpServletRequest request){ 91 | UserEntity user = userService.selectOne(new EntityWrapper().eq("username", username)); 92 | if(user==null) { 93 | return R.error("账号不存在"); 94 | } 95 | user.setPassword("123456"); 96 | userService.update(user,null); 97 | return R.ok("密码已重置为:123456"); 98 | } 99 | 100 | /** 101 | * 列表 102 | */ 103 | @RequestMapping("/page") 104 | public R page(@RequestParam Map params,UserEntity user){ 105 | EntityWrapper ew = new EntityWrapper(); 106 | PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params)); 107 | return R.ok().put("data", page); 108 | } 109 | 110 | /** 111 | * 列表 112 | */ 113 | @RequestMapping("/list") 114 | public R list( UserEntity user){ 115 | EntityWrapper ew = new EntityWrapper(); 116 | ew.allEq(MPUtil.allEQMapPre( user, "user")); 117 | return R.ok().put("data", userService.selectListView(ew)); 118 | } 119 | 120 | /** 121 | * 信息 122 | */ 123 | @RequestMapping("/info/{id}") 124 | public R info(@PathVariable("id") String id){ 125 | UserEntity user = userService.selectById(id); 126 | return R.ok().put("data", user); 127 | } 128 | 129 | /** 130 | * 获取用户的session用户信息 131 | */ 132 | @RequestMapping("/session") 133 | public R getCurrUser(HttpServletRequest request){ 134 | Long id = (Long)request.getSession().getAttribute("userId"); 135 | UserEntity user = userService.selectById(id); 136 | return R.ok().put("data", user); 137 | } 138 | 139 | /** 140 | * 保存 141 | */ 142 | @PostMapping("/save") 143 | public R save(@RequestBody UserEntity user){ 144 | // ValidatorUtils.validateEntity(user); 145 | if(userService.selectOne(new EntityWrapper().eq("username", user.getUsername())) !=null) { 146 | return R.error("用户已存在"); 147 | } 148 | userService.insert(user); 149 | return R.ok(); 150 | } 151 | 152 | /** 153 | * 修改 154 | */ 155 | @RequestMapping("/update") 156 | public R update(@RequestBody UserEntity user){ 157 | // ValidatorUtils.validateEntity(user); 158 | UserEntity u = userService.selectOne(new EntityWrapper().eq("username", user.getUsername())); 159 | if(u!=null && u.getId()!=user.getId() && u.getUsername().equals(user.getUsername())) { 160 | return R.error("用户名已存在。"); 161 | } 162 | userService.updateById(user);//全部更新 163 | return R.ok(); 164 | } 165 | 166 | /** 167 | * 删除 168 | */ 169 | @RequestMapping("/delete") 170 | public R delete(@RequestBody Long[] ids){ 171 | userService.deleteBatchIds(Arrays.asList(ids)); 172 | return R.ok(); 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /src/main/java/com/utils/MPUtil.java: -------------------------------------------------------------------------------- 1 | package com.utils; 2 | 3 | import java.util.Arrays; 4 | import java.util.HashMap; 5 | import java.util.Iterator; 6 | import java.util.Map; 7 | 8 | import org.apache.commons.lang3.StringUtils; 9 | 10 | import cn.hutool.core.bean.BeanUtil; 11 | 12 | import com.baomidou.mybatisplus.mapper.Wrapper; 13 | 14 | /** 15 | * Mybatis-Plus工具类 16 | */ 17 | public class MPUtil { 18 | public static final char UNDERLINE = '_'; 19 | 20 | 21 | //mybatis plus allEQ 表达式转换 22 | public static Map allEQMapPre(Object bean,String pre) { 23 | Map map =BeanUtil.beanToMap(bean); 24 | return camelToUnderlineMap(map,pre); 25 | } 26 | 27 | //mybatis plus allEQ 表达式转换 28 | public static Map allEQMap(Object bean) { 29 | Map map =BeanUtil.beanToMap(bean); 30 | return camelToUnderlineMap(map,""); 31 | } 32 | 33 | public static Wrapper allLikePre(Wrapper wrapper,Object bean,String pre) { 34 | Map map =BeanUtil.beanToMap(bean); 35 | Map result = camelToUnderlineMap(map,pre); 36 | 37 | return genLike(wrapper,result); 38 | } 39 | 40 | public static Wrapper allLike(Wrapper wrapper,Object bean) { 41 | Map result = BeanUtil.beanToMap(bean, true, true); 42 | return genLike(wrapper,result); 43 | } 44 | 45 | 46 | public static Wrapper genLike( Wrapper wrapper,Map param) { 47 | Iterator> it = param.entrySet().iterator(); 48 | int i=0; 49 | while (it.hasNext()) { 50 | if(i>0) wrapper.and(); 51 | Map.Entry entry = it.next(); 52 | String key = entry.getKey(); 53 | String value = (String) entry.getValue(); 54 | wrapper.like(key, value); 55 | i++; 56 | } 57 | return wrapper; 58 | } 59 | 60 | public static Wrapper likeOrEq(Wrapper wrapper,Object bean) { 61 | Map result = BeanUtil.beanToMap(bean, true, true); 62 | return genLikeOrEq(wrapper,result); 63 | } 64 | 65 | public static Wrapper genLikeOrEq( Wrapper wrapper,Map param) { 66 | Iterator> it = param.entrySet().iterator(); 67 | int i=0; 68 | while (it.hasNext()) { 69 | if(i>0) wrapper.and(); 70 | Map.Entry entry = it.next(); 71 | String key = entry.getKey(); 72 | if(entry.getValue().toString().contains("%")) { 73 | wrapper.like(key, entry.getValue().toString().replace("%", "")); 74 | } else { 75 | wrapper.eq(key, entry.getValue()); 76 | } 77 | i++; 78 | } 79 | return wrapper; 80 | } 81 | 82 | public static Wrapper allEq(Wrapper wrapper,Object bean) { 83 | Map result = BeanUtil.beanToMap(bean, true, true); 84 | return genEq(wrapper,result); 85 | } 86 | 87 | 88 | public static Wrapper genEq( Wrapper wrapper,Map param) { 89 | Iterator> it = param.entrySet().iterator(); 90 | int i=0; 91 | while (it.hasNext()) { 92 | if(i>0) wrapper.and(); 93 | Map.Entry entry = it.next(); 94 | String key = entry.getKey(); 95 | wrapper.eq(key, entry.getValue()); 96 | i++; 97 | } 98 | return wrapper; 99 | } 100 | 101 | 102 | public static Wrapper between(Wrapper wrapper,Map params) { 103 | for(String key : params.keySet()) { 104 | String columnName = ""; 105 | if(key.endsWith("_start")) { 106 | columnName = key.substring(0, key.indexOf("_start")); 107 | if(StringUtils.isNotBlank(params.get(key).toString())) { 108 | wrapper.ge(columnName, params.get(key)); 109 | } 110 | } 111 | if(key.endsWith("_end")) { 112 | columnName = key.substring(0, key.indexOf("_end")); 113 | if(StringUtils.isNotBlank(params.get(key).toString())) { 114 | wrapper.le(columnName, params.get(key)); 115 | } 116 | } 117 | } 118 | return wrapper; 119 | } 120 | 121 | public static Wrapper sort(Wrapper wrapper,Map params) { 122 | String order = ""; 123 | if(params.get("order") != null && StringUtils.isNotBlank(params.get("order").toString())) { 124 | order = params.get("order").toString(); 125 | } 126 | if(params.get("sort") != null && StringUtils.isNotBlank(params.get("sort").toString())) { 127 | if(order.equalsIgnoreCase("desc")) { 128 | wrapper.orderDesc(Arrays.asList(params.get("sort"))); 129 | } else { 130 | wrapper.orderAsc(Arrays.asList(params.get("sort"))); 131 | } 132 | } 133 | return wrapper; 134 | } 135 | 136 | 137 | /** 138 | * 驼峰格式字符串转换为下划线格式字符串 139 | * 140 | * @param param 141 | * @return 142 | */ 143 | public static String camelToUnderline(String param) { 144 | if (param == null || "".equals(param.trim())) { 145 | return ""; 146 | } 147 | int len = param.length(); 148 | StringBuilder sb = new StringBuilder(len); 149 | for (int i = 0; i < len; i++) { 150 | char c = param.charAt(i); 151 | if (Character.isUpperCase(c)) { 152 | sb.append(UNDERLINE); 153 | sb.append(Character.toLowerCase(c)); 154 | } else { 155 | sb.append(c); 156 | } 157 | } 158 | return sb.toString(); 159 | } 160 | 161 | public static void main(String[] ages) { 162 | System.out.println(camelToUnderline("ABCddfANM")); 163 | } 164 | 165 | public static Map camelToUnderlineMap(Map param, String pre) { 166 | 167 | Map newMap = new HashMap(); 168 | Iterator> it = param.entrySet().iterator(); 169 | while (it.hasNext()) { 170 | Map.Entry entry = it.next(); 171 | String key = entry.getKey(); 172 | String newKey = camelToUnderline(key); 173 | if (pre.endsWith(".")) { 174 | newMap.put(pre + newKey, entry.getValue()); 175 | } else if (StringUtils.isEmpty(pre)) { 176 | newMap.put(newKey, entry.getValue()); 177 | } else { 178 | 179 | newMap.put(pre + "." + newKey, entry.getValue()); 180 | } 181 | } 182 | return newMap; 183 | } 184 | } 185 | -------------------------------------------------------------------------------- /src/main/java/com/entity/ZichanguihaiEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.NotEmpty; 7 | import javax.validation.constraints.NotNull; 8 | 9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 10 | import java.lang.reflect.InvocationTargetException; 11 | 12 | import java.io.Serializable; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | import org.springframework.format.annotation.DateTimeFormat; 17 | import com.fasterxml.jackson.annotation.JsonFormat; 18 | import org.apache.commons.beanutils.BeanUtils; 19 | import com.baomidou.mybatisplus.annotations.TableField; 20 | import com.baomidou.mybatisplus.enums.FieldFill; 21 | import com.baomidou.mybatisplus.enums.IdType; 22 | 23 | 24 | /** 25 | * 资产归还 26 | * 数据库通用操作实体类(普通增删改查) 27 | * @author 28 | * @email 29 | * @date 2021-05-11 09:16:46 30 | */ 31 | @TableName("zichanguihai") 32 | public class ZichanguihaiEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public ZichanguihaiEntity() { 37 | 38 | } 39 | 40 | public ZichanguihaiEntity(T t) { 41 | try { 42 | BeanUtils.copyProperties(this, t); 43 | } catch (IllegalAccessException | InvocationTargetException e) { 44 | // TODO Auto-generated catch block 45 | e.printStackTrace(); 46 | } 47 | } 48 | 49 | /** 50 | * 主键id 51 | */ 52 | @TableId 53 | private Long id; 54 | /** 55 | * 资产编号 56 | */ 57 | 58 | private String zichanbianhao; 59 | 60 | /** 61 | * 设备名称 62 | */ 63 | 64 | private String shebeimingcheng; 65 | 66 | /** 67 | * 资产分类 68 | */ 69 | 70 | private String zichanfenlei; 71 | 72 | /** 73 | * 资产图片 74 | */ 75 | 76 | private String zichantupian; 77 | 78 | /** 79 | * 数量 80 | */ 81 | 82 | private Integer shuliang; 83 | 84 | /** 85 | * 归还日期 86 | */ 87 | 88 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") 89 | @DateTimeFormat 90 | private Date guihairiqi; 91 | 92 | /** 93 | * 归还备注 94 | */ 95 | 96 | private String guihaibeizhu; 97 | 98 | /** 99 | * 用户名 100 | */ 101 | 102 | private String yonghuming; 103 | 104 | /** 105 | * 姓名 106 | */ 107 | 108 | private String xingming; 109 | 110 | /** 111 | * 手机 112 | */ 113 | 114 | private String shouji; 115 | 116 | /** 117 | * 身份证 118 | */ 119 | 120 | private String shenfenzheng; 121 | 122 | /** 123 | * 是否审核 124 | */ 125 | 126 | private String sfsh; 127 | 128 | /** 129 | * 审核回复 130 | */ 131 | 132 | private String shhf; 133 | 134 | 135 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 136 | @DateTimeFormat 137 | private Date addtime; 138 | 139 | public Date getAddtime() { 140 | return addtime; 141 | } 142 | public void setAddtime(Date addtime) { 143 | this.addtime = addtime; 144 | } 145 | 146 | public Long getId() { 147 | return id; 148 | } 149 | 150 | public void setId(Long id) { 151 | this.id = id; 152 | } 153 | /** 154 | * 设置:资产编号 155 | */ 156 | public void setZichanbianhao(String zichanbianhao) { 157 | this.zichanbianhao = zichanbianhao; 158 | } 159 | /** 160 | * 获取:资产编号 161 | */ 162 | public String getZichanbianhao() { 163 | return zichanbianhao; 164 | } 165 | /** 166 | * 设置:设备名称 167 | */ 168 | public void setShebeimingcheng(String shebeimingcheng) { 169 | this.shebeimingcheng = shebeimingcheng; 170 | } 171 | /** 172 | * 获取:设备名称 173 | */ 174 | public String getShebeimingcheng() { 175 | return shebeimingcheng; 176 | } 177 | /** 178 | * 设置:资产分类 179 | */ 180 | public void setZichanfenlei(String zichanfenlei) { 181 | this.zichanfenlei = zichanfenlei; 182 | } 183 | /** 184 | * 获取:资产分类 185 | */ 186 | public String getZichanfenlei() { 187 | return zichanfenlei; 188 | } 189 | /** 190 | * 设置:资产图片 191 | */ 192 | public void setZichantupian(String zichantupian) { 193 | this.zichantupian = zichantupian; 194 | } 195 | /** 196 | * 获取:资产图片 197 | */ 198 | public String getZichantupian() { 199 | return zichantupian; 200 | } 201 | /** 202 | * 设置:数量 203 | */ 204 | public void setShuliang(Integer shuliang) { 205 | this.shuliang = shuliang; 206 | } 207 | /** 208 | * 获取:数量 209 | */ 210 | public Integer getShuliang() { 211 | return shuliang; 212 | } 213 | /** 214 | * 设置:归还日期 215 | */ 216 | public void setGuihairiqi(Date guihairiqi) { 217 | this.guihairiqi = guihairiqi; 218 | } 219 | /** 220 | * 获取:归还日期 221 | */ 222 | public Date getGuihairiqi() { 223 | return guihairiqi; 224 | } 225 | /** 226 | * 设置:归还备注 227 | */ 228 | public void setGuihaibeizhu(String guihaibeizhu) { 229 | this.guihaibeizhu = guihaibeizhu; 230 | } 231 | /** 232 | * 获取:归还备注 233 | */ 234 | public String getGuihaibeizhu() { 235 | return guihaibeizhu; 236 | } 237 | /** 238 | * 设置:用户名 239 | */ 240 | public void setYonghuming(String yonghuming) { 241 | this.yonghuming = yonghuming; 242 | } 243 | /** 244 | * 获取:用户名 245 | */ 246 | public String getYonghuming() { 247 | return yonghuming; 248 | } 249 | /** 250 | * 设置:姓名 251 | */ 252 | public void setXingming(String xingming) { 253 | this.xingming = xingming; 254 | } 255 | /** 256 | * 获取:姓名 257 | */ 258 | public String getXingming() { 259 | return xingming; 260 | } 261 | /** 262 | * 设置:手机 263 | */ 264 | public void setShouji(String shouji) { 265 | this.shouji = shouji; 266 | } 267 | /** 268 | * 获取:手机 269 | */ 270 | public String getShouji() { 271 | return shouji; 272 | } 273 | /** 274 | * 设置:身份证 275 | */ 276 | public void setShenfenzheng(String shenfenzheng) { 277 | this.shenfenzheng = shenfenzheng; 278 | } 279 | /** 280 | * 获取:身份证 281 | */ 282 | public String getShenfenzheng() { 283 | return shenfenzheng; 284 | } 285 | /** 286 | * 设置:是否审核 287 | */ 288 | public void setSfsh(String sfsh) { 289 | this.sfsh = sfsh; 290 | } 291 | /** 292 | * 获取:是否审核 293 | */ 294 | public String getSfsh() { 295 | return sfsh; 296 | } 297 | /** 298 | * 设置:审核回复 299 | */ 300 | public void setShhf(String shhf) { 301 | this.shhf = shhf; 302 | } 303 | /** 304 | * 获取:审核回复 305 | */ 306 | public String getShhf() { 307 | return shhf; 308 | } 309 | 310 | } 311 | -------------------------------------------------------------------------------- /src/main/java/com/entity/ZichanjiechuEntity.java: -------------------------------------------------------------------------------- 1 | package com.entity; 2 | 3 | import com.baomidou.mybatisplus.annotations.TableId; 4 | import com.baomidou.mybatisplus.annotations.TableName; 5 | import javax.validation.constraints.NotBlank; 6 | import javax.validation.constraints.NotEmpty; 7 | import javax.validation.constraints.NotNull; 8 | 9 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 10 | import java.lang.reflect.InvocationTargetException; 11 | 12 | import java.io.Serializable; 13 | import java.util.Date; 14 | import java.util.List; 15 | 16 | import org.springframework.format.annotation.DateTimeFormat; 17 | import com.fasterxml.jackson.annotation.JsonFormat; 18 | import org.apache.commons.beanutils.BeanUtils; 19 | import com.baomidou.mybatisplus.annotations.TableField; 20 | import com.baomidou.mybatisplus.enums.FieldFill; 21 | import com.baomidou.mybatisplus.enums.IdType; 22 | 23 | 24 | /** 25 | * 资产借出 26 | * 数据库通用操作实体类(普通增删改查) 27 | * @author 28 | * @email 29 | * @date 2021-05-11 09:16:46 30 | */ 31 | @TableName("zichanjiechu") 32 | public class ZichanjiechuEntity implements Serializable { 33 | private static final long serialVersionUID = 1L; 34 | 35 | 36 | public ZichanjiechuEntity() { 37 | 38 | } 39 | 40 | public ZichanjiechuEntity(T t) { 41 | try { 42 | BeanUtils.copyProperties(this, t); 43 | } catch (IllegalAccessException | InvocationTargetException e) { 44 | // TODO Auto-generated catch block 45 | e.printStackTrace(); 46 | } 47 | } 48 | 49 | /** 50 | * 主键id 51 | */ 52 | @TableId 53 | private Long id; 54 | /** 55 | * 资产编号 56 | */ 57 | 58 | private String zichanbianhao; 59 | 60 | /** 61 | * 设备名称 62 | */ 63 | 64 | private String shebeimingcheng; 65 | 66 | /** 67 | * 资产分类 68 | */ 69 | 70 | private String zichanfenlei; 71 | 72 | /** 73 | * 资产图片 74 | */ 75 | 76 | private String zichantupian; 77 | 78 | /** 79 | * 数量 80 | */ 81 | 82 | private Integer shuliang; 83 | 84 | /** 85 | * 借出日期 86 | */ 87 | 88 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd") 89 | @DateTimeFormat 90 | private Date jiechuriqi; 91 | 92 | /** 93 | * 借出备注 94 | */ 95 | 96 | private String jiechubeizhu; 97 | 98 | /** 99 | * 用户名 100 | */ 101 | 102 | private String yonghuming; 103 | 104 | /** 105 | * 姓名 106 | */ 107 | 108 | private String xingming; 109 | 110 | /** 111 | * 手机 112 | */ 113 | 114 | private String shouji; 115 | 116 | /** 117 | * 身份证 118 | */ 119 | 120 | private String shenfenzheng; 121 | 122 | /** 123 | * 是否审核 124 | */ 125 | 126 | private String sfsh; 127 | 128 | /** 129 | * 审核回复 130 | */ 131 | 132 | private String shhf; 133 | 134 | 135 | @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") 136 | @DateTimeFormat 137 | private Date addtime; 138 | 139 | public Date getAddtime() { 140 | return addtime; 141 | } 142 | public void setAddtime(Date addtime) { 143 | this.addtime = addtime; 144 | } 145 | 146 | public Long getId() { 147 | return id; 148 | } 149 | 150 | public void setId(Long id) { 151 | this.id = id; 152 | } 153 | /** 154 | * 设置:资产编号 155 | */ 156 | public void setZichanbianhao(String zichanbianhao) { 157 | this.zichanbianhao = zichanbianhao; 158 | } 159 | /** 160 | * 获取:资产编号 161 | */ 162 | public String getZichanbianhao() { 163 | return zichanbianhao; 164 | } 165 | /** 166 | * 设置:设备名称 167 | */ 168 | public void setShebeimingcheng(String shebeimingcheng) { 169 | this.shebeimingcheng = shebeimingcheng; 170 | } 171 | /** 172 | * 获取:设备名称 173 | */ 174 | public String getShebeimingcheng() { 175 | return shebeimingcheng; 176 | } 177 | /** 178 | * 设置:资产分类 179 | */ 180 | public void setZichanfenlei(String zichanfenlei) { 181 | this.zichanfenlei = zichanfenlei; 182 | } 183 | /** 184 | * 获取:资产分类 185 | */ 186 | public String getZichanfenlei() { 187 | return zichanfenlei; 188 | } 189 | /** 190 | * 设置:资产图片 191 | */ 192 | public void setZichantupian(String zichantupian) { 193 | this.zichantupian = zichantupian; 194 | } 195 | /** 196 | * 获取:资产图片 197 | */ 198 | public String getZichantupian() { 199 | return zichantupian; 200 | } 201 | /** 202 | * 设置:数量 203 | */ 204 | public void setShuliang(Integer shuliang) { 205 | this.shuliang = shuliang; 206 | } 207 | /** 208 | * 获取:数量 209 | */ 210 | public Integer getShuliang() { 211 | return shuliang; 212 | } 213 | /** 214 | * 设置:借出日期 215 | */ 216 | public void setJiechuriqi(Date jiechuriqi) { 217 | this.jiechuriqi = jiechuriqi; 218 | } 219 | /** 220 | * 获取:借出日期 221 | */ 222 | public Date getJiechuriqi() { 223 | return jiechuriqi; 224 | } 225 | /** 226 | * 设置:借出备注 227 | */ 228 | public void setJiechubeizhu(String jiechubeizhu) { 229 | this.jiechubeizhu = jiechubeizhu; 230 | } 231 | /** 232 | * 获取:借出备注 233 | */ 234 | public String getJiechubeizhu() { 235 | return jiechubeizhu; 236 | } 237 | /** 238 | * 设置:用户名 239 | */ 240 | public void setYonghuming(String yonghuming) { 241 | this.yonghuming = yonghuming; 242 | } 243 | /** 244 | * 获取:用户名 245 | */ 246 | public String getYonghuming() { 247 | return yonghuming; 248 | } 249 | /** 250 | * 设置:姓名 251 | */ 252 | public void setXingming(String xingming) { 253 | this.xingming = xingming; 254 | } 255 | /** 256 | * 获取:姓名 257 | */ 258 | public String getXingming() { 259 | return xingming; 260 | } 261 | /** 262 | * 设置:手机 263 | */ 264 | public void setShouji(String shouji) { 265 | this.shouji = shouji; 266 | } 267 | /** 268 | * 获取:手机 269 | */ 270 | public String getShouji() { 271 | return shouji; 272 | } 273 | /** 274 | * 设置:身份证 275 | */ 276 | public void setShenfenzheng(String shenfenzheng) { 277 | this.shenfenzheng = shenfenzheng; 278 | } 279 | /** 280 | * 获取:身份证 281 | */ 282 | public String getShenfenzheng() { 283 | return shenfenzheng; 284 | } 285 | /** 286 | * 设置:是否审核 287 | */ 288 | public void setSfsh(String sfsh) { 289 | this.sfsh = sfsh; 290 | } 291 | /** 292 | * 获取:是否审核 293 | */ 294 | public String getSfsh() { 295 | return sfsh; 296 | } 297 | /** 298 | * 设置:审核回复 299 | */ 300 | public void setShhf(String shhf) { 301 | this.shhf = shhf; 302 | } 303 | /** 304 | * 获取:审核回复 305 | */ 306 | public String getShhf() { 307 | return shhf; 308 | } 309 | 310 | } 311 | -------------------------------------------------------------------------------- /src/main/java/com/controller/ZichanxinxiController.java: -------------------------------------------------------------------------------- 1 | package com.controller; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.ArrayList; 5 | import java.util.Arrays; 6 | import java.util.Calendar; 7 | import java.util.Map; 8 | import java.util.HashMap; 9 | import java.util.Iterator; 10 | import java.util.Date; 11 | import java.util.List; 12 | import javax.servlet.http.HttpServletRequest; 13 | 14 | import com.utils.ValidatorUtils; 15 | import org.apache.commons.lang3.StringUtils; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.format.annotation.DateTimeFormat; 18 | import org.springframework.web.bind.annotation.PathVariable; 19 | import org.springframework.web.bind.annotation.RequestBody; 20 | import org.springframework.web.bind.annotation.RequestMapping; 21 | import org.springframework.web.bind.annotation.RequestParam; 22 | import org.springframework.web.bind.annotation.RestController; 23 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 24 | import com.baomidou.mybatisplus.mapper.Wrapper; 25 | import com.annotation.IgnoreAuth; 26 | 27 | import com.entity.ZichanxinxiEntity; 28 | import com.entity.view.ZichanxinxiView; 29 | 30 | import com.service.ZichanxinxiService; 31 | import com.service.TokenService; 32 | import com.utils.PageUtils; 33 | import com.utils.R; 34 | import com.utils.MD5Util; 35 | import com.utils.MPUtil; 36 | import com.utils.CommonUtil; 37 | 38 | 39 | /** 40 | * 资产信息 41 | * 后端接口 42 | * @author 43 | * @email 44 | * @date 2021-05-11 09:16:46 45 | */ 46 | @RestController 47 | @RequestMapping("/zichanxinxi") 48 | public class ZichanxinxiController { 49 | @Autowired 50 | private ZichanxinxiService zichanxinxiService; 51 | 52 | 53 | 54 | /** 55 | * 后端列表 56 | */ 57 | @RequestMapping("/page") 58 | public R page(@RequestParam Map params,ZichanxinxiEntity zichanxinxi, 59 | HttpServletRequest request){ 60 | EntityWrapper ew = new EntityWrapper(); 61 | PageUtils page = zichanxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zichanxinxi), params), params)); 62 | 63 | return R.ok().put("data", page); 64 | } 65 | 66 | /** 67 | * 前端列表 68 | */ 69 | @RequestMapping("/list") 70 | public R list(@RequestParam Map params,ZichanxinxiEntity zichanxinxi, 71 | HttpServletRequest request){ 72 | EntityWrapper ew = new EntityWrapper(); 73 | PageUtils page = zichanxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zichanxinxi), params), params)); 74 | return R.ok().put("data", page); 75 | } 76 | 77 | /** 78 | * 列表 79 | */ 80 | @RequestMapping("/lists") 81 | public R list( ZichanxinxiEntity zichanxinxi){ 82 | EntityWrapper ew = new EntityWrapper(); 83 | ew.allEq(MPUtil.allEQMapPre( zichanxinxi, "zichanxinxi")); 84 | return R.ok().put("data", zichanxinxiService.selectListView(ew)); 85 | } 86 | 87 | /** 88 | * 查询 89 | */ 90 | @RequestMapping("/query") 91 | public R query(ZichanxinxiEntity zichanxinxi){ 92 | EntityWrapper< ZichanxinxiEntity> ew = new EntityWrapper< ZichanxinxiEntity>(); 93 | ew.allEq(MPUtil.allEQMapPre( zichanxinxi, "zichanxinxi")); 94 | ZichanxinxiView zichanxinxiView = zichanxinxiService.selectView(ew); 95 | return R.ok("查询资产信息成功").put("data", zichanxinxiView); 96 | } 97 | 98 | /** 99 | * 后端详情 100 | */ 101 | @RequestMapping("/info/{id}") 102 | public R info(@PathVariable("id") Long id){ 103 | ZichanxinxiEntity zichanxinxi = zichanxinxiService.selectById(id); 104 | return R.ok().put("data", zichanxinxi); 105 | } 106 | 107 | /** 108 | * 前端详情 109 | */ 110 | @RequestMapping("/detail/{id}") 111 | public R detail(@PathVariable("id") Long id){ 112 | ZichanxinxiEntity zichanxinxi = zichanxinxiService.selectById(id); 113 | return R.ok().put("data", zichanxinxi); 114 | } 115 | 116 | 117 | 118 | 119 | /** 120 | * 后端保存 121 | */ 122 | @RequestMapping("/save") 123 | public R save(@RequestBody ZichanxinxiEntity zichanxinxi, HttpServletRequest request){ 124 | zichanxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); 125 | //ValidatorUtils.validateEntity(zichanxinxi); 126 | zichanxinxiService.insert(zichanxinxi); 127 | return R.ok(); 128 | } 129 | 130 | /** 131 | * 前端保存 132 | */ 133 | @RequestMapping("/add") 134 | public R add(@RequestBody ZichanxinxiEntity zichanxinxi, HttpServletRequest request){ 135 | zichanxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); 136 | //ValidatorUtils.validateEntity(zichanxinxi); 137 | zichanxinxiService.insert(zichanxinxi); 138 | return R.ok(); 139 | } 140 | 141 | /** 142 | * 修改 143 | */ 144 | @RequestMapping("/update") 145 | public R update(@RequestBody ZichanxinxiEntity zichanxinxi, HttpServletRequest request){ 146 | //ValidatorUtils.validateEntity(zichanxinxi); 147 | zichanxinxiService.updateById(zichanxinxi);//全部更新 148 | return R.ok(); 149 | } 150 | 151 | 152 | /** 153 | * 删除 154 | */ 155 | @RequestMapping("/delete") 156 | public R delete(@RequestBody Long[] ids){ 157 | zichanxinxiService.deleteBatchIds(Arrays.asList(ids)); 158 | return R.ok(); 159 | } 160 | 161 | /** 162 | * 提醒接口 163 | */ 164 | @RequestMapping("/remind/{columnName}/{type}") 165 | public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, 166 | @PathVariable("type") String type,@RequestParam Map map) { 167 | map.put("column", columnName); 168 | map.put("type", type); 169 | 170 | if(type.equals("2")) { 171 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 172 | Calendar c = Calendar.getInstance(); 173 | Date remindStartDate = null; 174 | Date remindEndDate = null; 175 | if(map.get("remindstart")!=null) { 176 | Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); 177 | c.setTime(new Date()); 178 | c.add(Calendar.DAY_OF_MONTH,remindStart); 179 | remindStartDate = c.getTime(); 180 | map.put("remindstart", sdf.format(remindStartDate)); 181 | } 182 | if(map.get("remindend")!=null) { 183 | Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); 184 | c.setTime(new Date()); 185 | c.add(Calendar.DAY_OF_MONTH,remindEnd); 186 | remindEndDate = c.getTime(); 187 | map.put("remindend", sdf.format(remindEndDate)); 188 | } 189 | } 190 | 191 | Wrapper wrapper = new EntityWrapper(); 192 | if(map.get("remindstart")!=null) { 193 | wrapper.ge(columnName, map.get("remindstart")); 194 | } 195 | if(map.get("remindend")!=null) { 196 | wrapper.le(columnName, map.get("remindend")); 197 | } 198 | 199 | 200 | int count = zichanxinxiService.selectCount(wrapper); 201 | return R.ok().put("count", count); 202 | } 203 | 204 | 205 | 206 | } 207 | -------------------------------------------------------------------------------- /src/main/java/com/controller/ZichanfenleiController.java: -------------------------------------------------------------------------------- 1 | package com.controller; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.ArrayList; 5 | import java.util.Arrays; 6 | import java.util.Calendar; 7 | import java.util.Map; 8 | import java.util.HashMap; 9 | import java.util.Iterator; 10 | import java.util.Date; 11 | import java.util.List; 12 | import javax.servlet.http.HttpServletRequest; 13 | 14 | import com.utils.ValidatorUtils; 15 | import org.apache.commons.lang3.StringUtils; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.format.annotation.DateTimeFormat; 18 | import org.springframework.web.bind.annotation.PathVariable; 19 | import org.springframework.web.bind.annotation.RequestBody; 20 | import org.springframework.web.bind.annotation.RequestMapping; 21 | import org.springframework.web.bind.annotation.RequestParam; 22 | import org.springframework.web.bind.annotation.RestController; 23 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 24 | import com.baomidou.mybatisplus.mapper.Wrapper; 25 | import com.annotation.IgnoreAuth; 26 | 27 | import com.entity.ZichanfenleiEntity; 28 | import com.entity.view.ZichanfenleiView; 29 | 30 | import com.service.ZichanfenleiService; 31 | import com.service.TokenService; 32 | import com.utils.PageUtils; 33 | import com.utils.R; 34 | import com.utils.MD5Util; 35 | import com.utils.MPUtil; 36 | import com.utils.CommonUtil; 37 | 38 | 39 | /** 40 | * 资产分类 41 | * 后端接口 42 | * @author 43 | * @email 44 | * @date 2021-05-11 09:16:46 45 | */ 46 | @RestController 47 | @RequestMapping("/zichanfenlei") 48 | public class ZichanfenleiController { 49 | @Autowired 50 | private ZichanfenleiService zichanfenleiService; 51 | 52 | 53 | 54 | /** 55 | * 后端列表 56 | */ 57 | @RequestMapping("/page") 58 | public R page(@RequestParam Map params,ZichanfenleiEntity zichanfenlei, 59 | HttpServletRequest request){ 60 | EntityWrapper ew = new EntityWrapper(); 61 | PageUtils page = zichanfenleiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zichanfenlei), params), params)); 62 | 63 | return R.ok().put("data", page); 64 | } 65 | 66 | /** 67 | * 前端列表 68 | */ 69 | @RequestMapping("/list") 70 | public R list(@RequestParam Map params,ZichanfenleiEntity zichanfenlei, 71 | HttpServletRequest request){ 72 | EntityWrapper ew = new EntityWrapper(); 73 | PageUtils page = zichanfenleiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zichanfenlei), params), params)); 74 | return R.ok().put("data", page); 75 | } 76 | 77 | /** 78 | * 列表 79 | */ 80 | @RequestMapping("/lists") 81 | public R list( ZichanfenleiEntity zichanfenlei){ 82 | EntityWrapper ew = new EntityWrapper(); 83 | ew.allEq(MPUtil.allEQMapPre( zichanfenlei, "zichanfenlei")); 84 | return R.ok().put("data", zichanfenleiService.selectListView(ew)); 85 | } 86 | 87 | /** 88 | * 查询 89 | */ 90 | @RequestMapping("/query") 91 | public R query(ZichanfenleiEntity zichanfenlei){ 92 | EntityWrapper< ZichanfenleiEntity> ew = new EntityWrapper< ZichanfenleiEntity>(); 93 | ew.allEq(MPUtil.allEQMapPre( zichanfenlei, "zichanfenlei")); 94 | ZichanfenleiView zichanfenleiView = zichanfenleiService.selectView(ew); 95 | return R.ok("查询资产分类成功").put("data", zichanfenleiView); 96 | } 97 | 98 | /** 99 | * 后端详情 100 | */ 101 | @RequestMapping("/info/{id}") 102 | public R info(@PathVariable("id") Long id){ 103 | ZichanfenleiEntity zichanfenlei = zichanfenleiService.selectById(id); 104 | return R.ok().put("data", zichanfenlei); 105 | } 106 | 107 | /** 108 | * 前端详情 109 | */ 110 | @RequestMapping("/detail/{id}") 111 | public R detail(@PathVariable("id") Long id){ 112 | ZichanfenleiEntity zichanfenlei = zichanfenleiService.selectById(id); 113 | return R.ok().put("data", zichanfenlei); 114 | } 115 | 116 | 117 | 118 | 119 | /** 120 | * 后端保存 121 | */ 122 | @RequestMapping("/save") 123 | public R save(@RequestBody ZichanfenleiEntity zichanfenlei, HttpServletRequest request){ 124 | zichanfenlei.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); 125 | //ValidatorUtils.validateEntity(zichanfenlei); 126 | zichanfenleiService.insert(zichanfenlei); 127 | return R.ok(); 128 | } 129 | 130 | /** 131 | * 前端保存 132 | */ 133 | @RequestMapping("/add") 134 | public R add(@RequestBody ZichanfenleiEntity zichanfenlei, HttpServletRequest request){ 135 | zichanfenlei.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); 136 | //ValidatorUtils.validateEntity(zichanfenlei); 137 | zichanfenleiService.insert(zichanfenlei); 138 | return R.ok(); 139 | } 140 | 141 | /** 142 | * 修改 143 | */ 144 | @RequestMapping("/update") 145 | public R update(@RequestBody ZichanfenleiEntity zichanfenlei, HttpServletRequest request){ 146 | //ValidatorUtils.validateEntity(zichanfenlei); 147 | zichanfenleiService.updateById(zichanfenlei);//全部更新 148 | return R.ok(); 149 | } 150 | 151 | 152 | /** 153 | * 删除 154 | */ 155 | @RequestMapping("/delete") 156 | public R delete(@RequestBody Long[] ids){ 157 | zichanfenleiService.deleteBatchIds(Arrays.asList(ids)); 158 | return R.ok(); 159 | } 160 | 161 | /** 162 | * 提醒接口 163 | */ 164 | @RequestMapping("/remind/{columnName}/{type}") 165 | public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, 166 | @PathVariable("type") String type,@RequestParam Map map) { 167 | map.put("column", columnName); 168 | map.put("type", type); 169 | 170 | if(type.equals("2")) { 171 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 172 | Calendar c = Calendar.getInstance(); 173 | Date remindStartDate = null; 174 | Date remindEndDate = null; 175 | if(map.get("remindstart")!=null) { 176 | Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); 177 | c.setTime(new Date()); 178 | c.add(Calendar.DAY_OF_MONTH,remindStart); 179 | remindStartDate = c.getTime(); 180 | map.put("remindstart", sdf.format(remindStartDate)); 181 | } 182 | if(map.get("remindend")!=null) { 183 | Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); 184 | c.setTime(new Date()); 185 | c.add(Calendar.DAY_OF_MONTH,remindEnd); 186 | remindEndDate = c.getTime(); 187 | map.put("remindend", sdf.format(remindEndDate)); 188 | } 189 | } 190 | 191 | Wrapper wrapper = new EntityWrapper(); 192 | if(map.get("remindstart")!=null) { 193 | wrapper.ge(columnName, map.get("remindstart")); 194 | } 195 | if(map.get("remindend")!=null) { 196 | wrapper.le(columnName, map.get("remindend")); 197 | } 198 | 199 | 200 | int count = zichanfenleiService.selectCount(wrapper); 201 | return R.ok().put("count", count); 202 | } 203 | 204 | 205 | 206 | } 207 | -------------------------------------------------------------------------------- /src/main/java/com/controller/ZichanweixiuController.java: -------------------------------------------------------------------------------- 1 | package com.controller; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.ArrayList; 5 | import java.util.Arrays; 6 | import java.util.Calendar; 7 | import java.util.Map; 8 | import java.util.HashMap; 9 | import java.util.Iterator; 10 | import java.util.Date; 11 | import java.util.List; 12 | import javax.servlet.http.HttpServletRequest; 13 | 14 | import com.utils.ValidatorUtils; 15 | import org.apache.commons.lang3.StringUtils; 16 | import org.springframework.beans.factory.annotation.Autowired; 17 | import org.springframework.format.annotation.DateTimeFormat; 18 | import org.springframework.web.bind.annotation.PathVariable; 19 | import org.springframework.web.bind.annotation.RequestBody; 20 | import org.springframework.web.bind.annotation.RequestMapping; 21 | import org.springframework.web.bind.annotation.RequestParam; 22 | import org.springframework.web.bind.annotation.RestController; 23 | import com.baomidou.mybatisplus.mapper.EntityWrapper; 24 | import com.baomidou.mybatisplus.mapper.Wrapper; 25 | import com.annotation.IgnoreAuth; 26 | 27 | import com.entity.ZichanweixiuEntity; 28 | import com.entity.view.ZichanweixiuView; 29 | 30 | import com.service.ZichanweixiuService; 31 | import com.service.TokenService; 32 | import com.utils.PageUtils; 33 | import com.utils.R; 34 | import com.utils.MD5Util; 35 | import com.utils.MPUtil; 36 | import com.utils.CommonUtil; 37 | 38 | 39 | /** 40 | * 资产维修 41 | * 后端接口 42 | * @author 43 | * @email 44 | * @date 2021-05-11 09:16:46 45 | */ 46 | @RestController 47 | @RequestMapping("/zichanweixiu") 48 | public class ZichanweixiuController { 49 | @Autowired 50 | private ZichanweixiuService zichanweixiuService; 51 | 52 | 53 | 54 | /** 55 | * 后端列表 56 | */ 57 | @RequestMapping("/page") 58 | public R page(@RequestParam Map params,ZichanweixiuEntity zichanweixiu, 59 | HttpServletRequest request){ 60 | EntityWrapper ew = new EntityWrapper(); 61 | PageUtils page = zichanweixiuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zichanweixiu), params), params)); 62 | 63 | return R.ok().put("data", page); 64 | } 65 | 66 | /** 67 | * 前端列表 68 | */ 69 | @RequestMapping("/list") 70 | public R list(@RequestParam Map params,ZichanweixiuEntity zichanweixiu, 71 | HttpServletRequest request){ 72 | EntityWrapper ew = new EntityWrapper(); 73 | PageUtils page = zichanweixiuService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, zichanweixiu), params), params)); 74 | return R.ok().put("data", page); 75 | } 76 | 77 | /** 78 | * 列表 79 | */ 80 | @RequestMapping("/lists") 81 | public R list( ZichanweixiuEntity zichanweixiu){ 82 | EntityWrapper ew = new EntityWrapper(); 83 | ew.allEq(MPUtil.allEQMapPre( zichanweixiu, "zichanweixiu")); 84 | return R.ok().put("data", zichanweixiuService.selectListView(ew)); 85 | } 86 | 87 | /** 88 | * 查询 89 | */ 90 | @RequestMapping("/query") 91 | public R query(ZichanweixiuEntity zichanweixiu){ 92 | EntityWrapper< ZichanweixiuEntity> ew = new EntityWrapper< ZichanweixiuEntity>(); 93 | ew.allEq(MPUtil.allEQMapPre( zichanweixiu, "zichanweixiu")); 94 | ZichanweixiuView zichanweixiuView = zichanweixiuService.selectView(ew); 95 | return R.ok("查询资产维修成功").put("data", zichanweixiuView); 96 | } 97 | 98 | /** 99 | * 后端详情 100 | */ 101 | @RequestMapping("/info/{id}") 102 | public R info(@PathVariable("id") Long id){ 103 | ZichanweixiuEntity zichanweixiu = zichanweixiuService.selectById(id); 104 | return R.ok().put("data", zichanweixiu); 105 | } 106 | 107 | /** 108 | * 前端详情 109 | */ 110 | @RequestMapping("/detail/{id}") 111 | public R detail(@PathVariable("id") Long id){ 112 | ZichanweixiuEntity zichanweixiu = zichanweixiuService.selectById(id); 113 | return R.ok().put("data", zichanweixiu); 114 | } 115 | 116 | 117 | 118 | 119 | /** 120 | * 后端保存 121 | */ 122 | @RequestMapping("/save") 123 | public R save(@RequestBody ZichanweixiuEntity zichanweixiu, HttpServletRequest request){ 124 | zichanweixiu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); 125 | //ValidatorUtils.validateEntity(zichanweixiu); 126 | zichanweixiuService.insert(zichanweixiu); 127 | return R.ok(); 128 | } 129 | 130 | /** 131 | * 前端保存 132 | */ 133 | @RequestMapping("/add") 134 | public R add(@RequestBody ZichanweixiuEntity zichanweixiu, HttpServletRequest request){ 135 | zichanweixiu.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue()); 136 | //ValidatorUtils.validateEntity(zichanweixiu); 137 | zichanweixiuService.insert(zichanweixiu); 138 | return R.ok(); 139 | } 140 | 141 | /** 142 | * 修改 143 | */ 144 | @RequestMapping("/update") 145 | public R update(@RequestBody ZichanweixiuEntity zichanweixiu, HttpServletRequest request){ 146 | //ValidatorUtils.validateEntity(zichanweixiu); 147 | zichanweixiuService.updateById(zichanweixiu);//全部更新 148 | return R.ok(); 149 | } 150 | 151 | 152 | /** 153 | * 删除 154 | */ 155 | @RequestMapping("/delete") 156 | public R delete(@RequestBody Long[] ids){ 157 | zichanweixiuService.deleteBatchIds(Arrays.asList(ids)); 158 | return R.ok(); 159 | } 160 | 161 | /** 162 | * 提醒接口 163 | */ 164 | @RequestMapping("/remind/{columnName}/{type}") 165 | public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, 166 | @PathVariable("type") String type,@RequestParam Map map) { 167 | map.put("column", columnName); 168 | map.put("type", type); 169 | 170 | if(type.equals("2")) { 171 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 172 | Calendar c = Calendar.getInstance(); 173 | Date remindStartDate = null; 174 | Date remindEndDate = null; 175 | if(map.get("remindstart")!=null) { 176 | Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); 177 | c.setTime(new Date()); 178 | c.add(Calendar.DAY_OF_MONTH,remindStart); 179 | remindStartDate = c.getTime(); 180 | map.put("remindstart", sdf.format(remindStartDate)); 181 | } 182 | if(map.get("remindend")!=null) { 183 | Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); 184 | c.setTime(new Date()); 185 | c.add(Calendar.DAY_OF_MONTH,remindEnd); 186 | remindEndDate = c.getTime(); 187 | map.put("remindend", sdf.format(remindEndDate)); 188 | } 189 | } 190 | 191 | Wrapper wrapper = new EntityWrapper(); 192 | if(map.get("remindstart")!=null) { 193 | wrapper.ge(columnName, map.get("remindstart")); 194 | } 195 | if(map.get("remindend")!=null) { 196 | wrapper.le(columnName, map.get("remindend")); 197 | } 198 | 199 | 200 | int count = zichanweixiuService.selectCount(wrapper); 201 | return R.ok().put("count", count); 202 | } 203 | 204 | 205 | 206 | } 207 | --------------------------------------------------------------------------------