xiaochen il y a 2 ans
Parent
commit
d6e5779b94

+ 1 - 1
xpyy/src/main/java/com/xpyy/xpyy/controller/UploadController.java

@@ -16,7 +16,7 @@ import java.util.Map;
 import java.util.Random;
 
 /**
- * 上传接口
+ * 图片上传接口
  */
 @Controller
 @RequestMapping("upload")

+ 1 - 4
xpyy/src/main/java/com/xpyy/xpyy/excel/ExcelTemplate.java

@@ -18,10 +18,7 @@ import java.util.stream.Collectors;
 /**
  * 使用一个已经存在的Excel作为模板,可以对当前的模板Excel进行修改操作,
  * 然后重新输出为流,或者存入文件系统当中。
- *
- *
- * @Description: excel模板操作
- *
+ * excel模板操作
  * */
 public class ExcelTemplate {
     private String path;

+ 5 - 22
xpyy/src/main/java/com/xpyy/xpyy/service/impl/UserServiceImpl.java

@@ -26,6 +26,9 @@ public class UserServiceImpl implements UserService {
     @Resource
     private RedisUtil redisUtil;
 
+    //雪花算法
+    private SnowflakeUtil snowflakeUtil = new SnowflakeUtil(1, 1, 1);
+
     @Override
     public Map<String, Object> login(User user, HttpServletRequest request) {
         Map<String, Object> map = new HashMap<>();
@@ -45,19 +48,6 @@ public class UserServiceImpl implements UserService {
                     put("userId", user.getId() + "");
                 }};
                 String token = JWTUtil.getToken(tokenParam); //生成token
-//                String key = RedisPreEnum.JWT_TOKEN_PRE.getPre() + user1.getId();
-//                Set<String> keys = redisUtil.keys(key + "*");
-//                if(CollectionUtils.isEmpty(keys)){
-//                    redisUtil.add(key + ipAddr, user1, RedisPreEnum.JWT_TOKEN_PRE.getExpired());
-//                } else {
-//                    //请空之前的key
-//                    for (String k : keys) {
-//                        redisUtil.delete(k);
-//                    }
-//                    //重新设置key
-//                    redisUtil.add(key + ipAddr, user1, RedisPreEnum.JWT_TOKEN_PRE.getExpired());
-//                }
-//                redisUtil.delete("verifyCode" + ipAddr);//删除指定ip的code
                 user1.setToken(token);
                 map.put("msg", "200");
                 map.put("data", user1);
@@ -76,11 +66,6 @@ public class UserServiceImpl implements UserService {
         Map<String, Object> map = new HashMap<>();
         try{
             PageHelper.startPage(user.getPage(), user.getLimit());
-//            List<User> list = new ArrayList<>();
-//            for(User user1 : userMapper.getAllUser(user)) {
-//                user1.setPassword(DesDecry.decrypt(user1.getPassword()));
-//                list.add(user1);
-//            }
             PageInfo<User> pageInfo = new PageInfo<>(userMapper.getAllUser(user));
             map.put("data", pageInfo);
             map.put("msg", "200");
@@ -229,10 +214,8 @@ public class UserServiceImpl implements UserService {
      */
     public String codeGenerate(String id){
         StringBuilder stringBuilder = new StringBuilder("YH");
-        for(int i = 0; i < 6 - id.length(); i++){
-            stringBuilder.append("0");
-        }
-        stringBuilder.append(id);
+        long l = snowflakeUtil.nextId();
+        stringBuilder.append(l);
         return stringBuilder.toString();
     }
 }

+ 1 - 28
xpyy/src/main/java/com/xpyy/xpyy/util/AuthenticationInterceptor.java

@@ -49,35 +49,8 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
                 httpServletResponse.getWriter().println(jsonStr);
                 throw new RuntimeException("无token,请重新登录");
             }
-//            String userId;
-//            try {
-//                userId = JWT.decode(token).getAudience().get(0);
-//            } catch (JWTDecodeException j) {
-//                map.put("msg", "510");
-//                map.put("errMsg", "token无效");
-//                // 将map转为json,然后将map的json数据返回给前端
-//                String jsonStr = new ObjectMapper().writeValueAsString(map);
-//                httpServletResponse.setContentType("application/json;charset=UTF-8");
-//                httpServletResponse.getWriter().println(jsonStr);
-//                throw new Exception("token无效");
-//            }
-//            User user = null;
-//            String key = RedisPreEnum.JWT_TOKEN_PRE.getPre() + userId + IpUtils.getIpAddr(httpServletRequest);
-//            if (redisUtil.hasKey(key)) {
-//                Object o = redisUtil.get(key);
-//                user = JSONObject.toJavaObject((JSON) JSON.toJSON(o), User.class);
-//            }
-//            if (user == null) {
-//                map.put("msg", "510");
-//                map.put("errMsg", "请重新登录");
-//                // 将map转为json,然后将map的json数据返回给前端
-//                String jsonStr = new ObjectMapper().writeValueAsString(map);
-//                httpServletResponse.setContentType("application/json;charset=UTF-8");
-//                httpServletResponse.getWriter().println(jsonStr);
-//                throw new RuntimeException("请重新登录");
-//            }
             // 验证 token
-            JWTVerifier jwtVerifier = JWT.require(Algorithm.HMAC256("tldtoken")).build();
+            JWTVerifier jwtVerifier = JWT.require(Algorithm.HMAC256("token")).build();
             try {
                 jwtVerifier.verify(token);
             } catch (Exception e) {

+ 136 - 0
xpyy/src/main/java/com/xpyy/xpyy/util/SnowflakeUtil.java

@@ -0,0 +1,136 @@
+package com.xpyy.xpyy.util;
+
+/**
+ * 雪花算法
+ * Twitter_Snowflake<br>
+ * SnowFlake的结构如下(每部分用-分开):<br>
+ * 0 - 0000000000 0000000000 0000000000 0000000000 0 - 00000 - 00000 - 000000000000 <br>
+ * 1位标识,由于long基本类型在Java中是带符号的,最高位是符号位,正数是0,负数是1,所以id一般是正数,最高位是0<br>
+ * 41位时间截(毫秒级),注意,41位时间截不是存储当前时间的时间截,而是存储时间截的差值(当前时间截 - 开始时间截)
+ * 得到的值),这里的的开始时间截,一般是我们的id生成器开始使用的时间,由我们程序来指定的(如下下面程序IdWorker类的startTime属性)。41位的时间截,可以使用69年,年T = (1L << 41) / (1000L * 60 * 60 * 24 * 365) = 69<br>
+ * 10位的数据机器位,可以部署在1024个节点,包括5位datacenterId和5位workerId<br>
+ * 12位序列,毫秒内的计数,12位的计数顺序号支持每个节点每毫秒(同一机器,同一时间截)产生4096个ID序号<br>
+ * 加起来刚好64位,为一个Long型。<br>
+ * SnowFlake的优点是,整体上按照时间自增排序,并且整个分布式系统内不会产生ID碰撞(由数据中心ID和机器ID作区分),并且效率较高,经测试,SnowFlake每秒能够产生26万ID左右。
+ * @author curry
+ */
+public class SnowflakeUtil {
+//因为二进制里第一个 bit 为如果是 1,那么都是负数,但是我们生成的 id 都是正数,所以第一个 bit 统一都是 0。
+
+    //机器ID  2进制5位  32位减掉1位 31个
+    private long workerId;
+    //机房ID 2进制5位  32位减掉1位 31个
+    private long datacenterId;
+    //代表一毫秒内生成的多个id的最新序号  12位 4096 -1 = 4095 个
+    private long sequence;
+    //设置一个时间初始值    2^41 - 1   差不多可以用69年
+    private long twepoch = 1585644268888L;
+    //5位的机器id
+    private long workerIdBits = 5L;
+    //5位的机房id
+    private long datacenterIdBits = 5L;
+    //每毫秒内产生的id数 2 的 12次方
+    private long sequenceBits = 12L;
+    // 这个是二进制运算,就是5 bit最多只能有31个数字,也就是说机器id最多只能是32以内
+    private long maxWorkerId = -1L ^ (-1L << workerIdBits);
+    // 这个是一个意思,就是5 bit最多只能有31个数字,机房id最多只能是32以内
+    private long maxDatacenterId = -1L ^ (-1L << datacenterIdBits);
+
+    private long workerIdShift = sequenceBits;
+    private long datacenterIdShift = sequenceBits + workerIdBits;
+    private long timestampLeftShift = sequenceBits + workerIdBits + datacenterIdBits;
+    private long sequenceMask = -1L ^ (-1L << sequenceBits);
+    //记录产生时间毫秒数,判断是否是同1毫秒
+    private long lastTimestamp = -1L;
+
+    public long getWorkerId(){
+        return workerId;
+    }
+    public long getDatacenterId() {
+        return datacenterId;
+    }
+    public long getTimestamp() {
+        return System.currentTimeMillis();
+    }
+
+
+
+    public SnowflakeUtil(long workerId, long datacenterId, long sequence) {
+
+        // 检查机房id和机器id是否超过31 不能小于0
+        if (workerId > maxWorkerId || workerId < 0) {
+            throw new IllegalArgumentException(
+                    String.format("worker Id can't be greater than %d or less than 0",maxWorkerId));
+        }
+
+        if (datacenterId > maxDatacenterId || datacenterId < 0) {
+
+            throw new IllegalArgumentException(
+                    String.format("datacenter Id can't be greater than %d or less than 0",maxDatacenterId));
+        }
+        this.workerId = workerId;
+        this.datacenterId = datacenterId;
+        this.sequence = sequence;
+    }
+
+    /**
+     * 这个是核心方法,通过调用nextId()方法,让当前这台机器上的snowflake算法程序生成一个全局唯一的id
+      */
+    public synchronized long nextId() {
+        // 这儿就是获取当前时间戳,单位是毫秒
+        long timestamp = timeGen();
+        if (timestamp < lastTimestamp) {
+
+            System.err.printf(
+                    "clock is moving backwards. Rejecting requests until %d.", lastTimestamp);
+            throw new RuntimeException(
+                    String.format("Clock moved backwards. Refusing to generate id for %d milliseconds",
+                            lastTimestamp - timestamp));
+        }
+
+        // 下面是说假设在同一个毫秒内,又发送了一个请求生成一个id
+        // 这个时候就得把seqence序号给递增1,最多就是4096
+        if (lastTimestamp == timestamp) {
+
+            // 这个意思是说一个毫秒内最多只能有4096个数字,无论你传递多少进来,
+            //这个位运算保证始终就是在4096这个范围内,避免你自己传递个sequence超过了4096这个范围
+            sequence = (sequence + 1) & sequenceMask;
+            //当某一毫秒的时间,产生的id数 超过4095,系统会进入等待,直到下一毫秒,系统继续产生ID
+            if (sequence == 0) {
+                timestamp = tilNextMillis(lastTimestamp);
+            }
+
+        } else {
+            sequence = 0;
+        }
+        // 这儿记录一下最近一次生成id的时间戳,单位是毫秒
+        lastTimestamp = timestamp;
+        // 这儿就是最核心的二进制位运算操作,生成一个64bit的id
+        // 先将当前时间戳左移,放到41 bit那儿;将机房id左移放到5 bit那儿;将机器id左移放到5 bit那儿;将序号放最后12 bit
+        // 最后拼接起来成一个64 bit的二进制数字,转换成10进制就是个long型
+        return ((timestamp - twepoch) << timestampLeftShift) |
+                (datacenterId << datacenterIdShift) |
+                (workerId << workerIdShift) | sequence;
+    }
+
+    /**
+     * 当某一毫秒的时间,产生的id数 超过4095,系统会进入等待,直到下一毫秒,系统继续产生ID
+     * @param lastTimestamp
+     * @return
+     */
+    private long tilNextMillis(long lastTimestamp) {
+
+        long timestamp = timeGen();
+
+        while (timestamp <= lastTimestamp) {
+            timestamp = timeGen();
+        }
+        return timestamp;
+    }
+    /**
+     *  获取当前时间戳
+     */
+    private long timeGen(){
+        return System.currentTimeMillis();
+    }
+}

+ 1 - 1
xpyy/src/main/java/com/xpyy/xpyy/util/ossFileUtil.java

@@ -29,7 +29,7 @@ public class ossFileUtil {
         String accessKeyId = "LTAI5tGNYXMJNMWa1pBVqCYt";  //你的acess_key_id
         String accessKeySecret = "M8f45Cysl13t0eAMzyd1vey2FvDaAz"; //你的acess_key_secret
         String bucketName = "lidaotech";       //你的bucket_name
-        String objectName = "tuya/" + fileName;
+        String objectName = "zpyy/" + fileName;
         //外面获取文件输入流,最后方便关闭
         InputStream in = file.getInputStream();
         //2 创建OssClient对象

+ 34 - 34
xpyy/src/main/resources/mapper/MenuMapper.xml

@@ -4,20 +4,20 @@
 <mapper namespace="com.xpyy.xpyy.mapper.MenuMapper">
 
     <sql id="field">
-        id,name,url,p_id,order_by,type,img
+        id,name,url,pId,orderBy,type,img
     </sql>
     <!-- 查询菜单 -->
     <select id="getMenu" resultType="com.xpyy.xpyy.entity.Menu">
         select
         <include refid="field"/>
-        from tld_menu
+        from menu
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="pId != null and pId != ''">
-                and p_id = #{pId}
+                and pId = #{pId}
             </if>
             and type = "PC"
         </trim>
-        order by order_by desc
+        order by orderBy desc
     </select>
     <!-- 查询列表 -->
     <select id="getPage" resultType="com.xpyy.xpyy.entity.Menu">
@@ -25,23 +25,23 @@
             a.id,
             a.name,
             a.url,
-            a.p_id,
-            a.order_by,
+            a.pId,
+            a.orderBy,
             a.type,
             a.img,
-            a.modify_time as modifyTime,
-            b.user_name as modifyUser
-        from tld_menu a
-        left join tld_user b on a.modify_user = b.id
+            a.modifyTime as modifyTime,
+            b.userName as modifyUser
+        from menu a
+        left join user b on a.modify_user = b.id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="pId != null and pId != ''">
-                and a.p_id = #{pId}
+                and a.pId = #{pId}
             </if>
             <if test="name != null and name != ''">
                 and a.name like CONCAT(CONCAT('%', #{name}), '%')
             </if>
             <if test="modifyUser != null and modifyUser != ''">
-                and b.user_name like CONCAT(CONCAT('%', #{modifyUser}), '%')
+                and b.userName like CONCAT(CONCAT('%', #{modifyUser}), '%')
             </if>
             <if test="type != null and type != ''">
                 and a.type = #{type}
@@ -50,15 +50,15 @@
                 and a.id = #{id}
             </if>
         </trim>
-        order by a.order_by
+        order by a.orderBy
     </select>
     <!-- 新增菜单 -->
     <insert id="addMenu">
-        insert into tld_menu(name,url,p_id,order_by,type,img,modify_user,modify_time) values(#{name},#{url},#{pId},#{orderBy},#{type},#{img},#{modifyUser},NOW())
+        insert into menu(name,url,pId,orderBy,type,img,modifyUser,modifyTime) values(#{name},#{url},#{pId},#{orderBy},#{type},#{img},#{modifyUser},NOW())
     </insert>
     <!-- 修改菜单 -->
     <update id="updateMenu">
-        update tld_menu
+        update menu
         <set>
             <trim suffixOverrides=",">
                 <if test="name != null">
@@ -68,10 +68,10 @@
                     url = #{url},
                 </if>
                 <if test="pId != null">
-                    p_id = #{pId},
+                    pId = #{pId},
                 </if>
                 <if test="orderBy != null">
-                    order_by = #{orderBy},
+                    orderBy = #{orderBy},
                 </if>
                 <if test="type != null">
                     type = #{type},
@@ -79,14 +79,14 @@
                 <if test="img != null">
                     img = #{img},
                 </if>
-                modify_user = #{modifyUser},modify_time=now(),
+                modifyUser = #{modifyUser},modifyTime=now(),
             </trim>
         </set>
             where id = #{id}
     </update>
     <!-- 删除菜单 -->
     <delete id="delMenu">
-        delete from tld_menu where id = #{id}
+        delete from menu where id = #{id}
     </delete>
     <!-- 根据角色查询菜单内容 -->
     <select id="getUserMenu" resultType="com.xpyy.xpyy.entity.Menu">
@@ -94,26 +94,26 @@
                a.name,
                a.url,
                a.img,
-               a.p_id,
+               a.pId,
                c.menu
-        FROM tld_menu a
-        JOIN tld_user b ON b.id = #{userId}
-        JOIN tld_role c ON b.role = c.id
+        FROM menu a
+        JOIN user b ON b.id = #{userId}
+        JOIN role c ON b.role = c.id
         WHERE c.menu LIKE CONCAT('%', CONCAT(a.id, ','), '%')
-        ORDER BY a.order_by
+        ORDER BY a.orderBy
     </select>
     <!-- 根据角色查询菜单内容PDA -->
     <select id="getUserMenuPDA" resultType="com.xpyy.xpyy.entity.Menu">
         SELECT a.id,
                a.name,
                a.url,
-               a.p_id,
-               c.menu_pda
-        FROM tld_menu a
-         JOIN tld_user b ON b.id = #{userId}
-         JOIN tld_role c ON b.role = c.id
-        WHERE c.menu_pda LIKE CONCAT('%', CONCAT(a.id, ','), '%')
-        ORDER BY a.order_by
+               a.pId,
+               c.menuPda
+        FROM menu a
+         JOIN user b ON b.id = #{userId}
+         JOIN role c ON b.role = c.id
+        WHERE c.menuPda LIKE CONCAT('%', CONCAT(a.id, ','), '%')
+        ORDER BY a.orderBy
     </select>
     <!--根据用户查询菜单内容PC-->
     <select id="getUserMenuPc" resultType="com.xpyy.xpyy.entity.Menu">
@@ -121,10 +121,10 @@
                a.name,
                a.url,
                a.img,
-               a.p_id,
+               a.pId,
                b.menu
-        FROM tld_menu a
-        JOIN tld_user b on b.id = #{userId}
+        FROM menu a
+        JOIN user b on b.id = #{userId}
         where b.menu like CONCAT('%', CONCAT(a.id, ','), '%')
     </select>
 </mapper>

+ 28 - 28
xpyy/src/main/resources/mapper/RoleMapper.xml

@@ -4,26 +4,26 @@
 <mapper namespace="com.xpyy.xpyy.mapper.RoleMapper">
 
     <sql id="roleField">
-        id,role_code,role_name,create_time,remarks,menu,menu_before,menu_pda
+        id,roleCode,roleName,createTime,remarks,menu,menuBefore,menuPda
     </sql>
     <!-- 新增角色 -->
     <insert id="addRole">
         <selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
             select LAST_INSERT_ID()
         </selectKey>
-        insert into tld_role(role_name,create_time,remarks,modify_user,modify_time)
+        insert into role(roleName,createTime,remarks,modifyUser,modifyTime)
         values(#{roleName},NOW(),#{remarks},#{modifyUser},NOW())
     </insert>
     <!-- 修改角色信息 -->
     <update id="updateRole">
-        update tld_role
+        update role
         <set>
             <trim suffixOverrides=",">
                 <if test="roleCode != null">
-                    role_code = #{roleCode},
+                    roleCode = #{roleCode},
                 </if>
                 <if test="roleName != null">
-                    role_name = #{roleName},
+                    roleName = #{roleName},
                 </if>
                 <if test="remarks != null ">
                     remarks = #{remarks},
@@ -32,12 +32,12 @@
                     menu = #{menu},
                 </if>
                 <if test="menuBefore != null">
-                    menu_before = #{menuBefore},
+                    menuBefore = #{menuBefore},
                 </if>
                 <if test="menuPda != null">
-                    menu_pda = #{menuPda},
+                    menuPda = #{menuPda},
                 </if>
-                modify_user = #{modifyUser},modify_time=now(),
+                modifyUser = #{modifyUser},modifyTime=now(),
             </trim>
         </set>
             where id = #{id}
@@ -46,26 +46,26 @@
     <select id="getRole" resultType="com.xpyy.xpyy.entity.Role">
         select
             a.id,
-            a.role_code,
-            a.role_name,
-            a.create_time,
+            a.roleCode,
+            a.roleName,
+            a.createTime,
             a.remarks,
             a.menu,
-            a.menu_before,
-            a.menu_pda,
-            a.modify_time as modifyTime,
-            b.user_name as modifyUser
-        from tld_role a
-        left join tld_user b on a.modify_user = b.id
+            a.menuBefore,
+            a.menuPda,
+            a.modifyTime as modifyTime,
+            b.userName as modifyUser
+        from role a
+        left join user b on a.modifyUser = b.id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="roleCode != null and roleCode != ''">
-                and a.role_code like CONCAT(CONCAT('%', #{roleCode}), '%')
+                and a.roleCode like CONCAT(CONCAT('%', #{roleCode}), '%')
             </if>
             <if test="roleName != null and roleName != ''">
-                and a.role_name like CONCAT(CONCAT('%', #{roleName}), '%')
+                and a.roleName like CONCAT(CONCAT('%', #{roleName}), '%')
             </if>
             <if test="modifyUser != null and modifyUser != ''">
-                and b.user_name like CONCAT(CONCAT('%', #{modifyUser}), '%')
+                and b.userName like CONCAT(CONCAT('%', #{modifyUser}), '%')
             </if>
             <if test="id != null and id != ''">
                 and a.id = #{id}
@@ -75,25 +75,25 @@
     </select>
     <!-- 删除角色信息 -->
     <delete id="delRole">
-        delete from tld_role where id = #{id}
+        delete from role where id = #{id}
     </delete>
     <!-- 查询导出数据 -->
     <select id="export" resultType="java.util.LinkedHashMap">
         select
-        a.role_code,
-        a.role_name,
+        a.roleCode,
+        a.roleName,
         if(a.remarks = '', null , a.remarks) as remarks
-        from tld_role a
-        left join tld_user b on a.modify_user = b.id
+        from role a
+        left join user b on a.modifyUser = b.id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="roleCode != null and roleCode != ''">
-                and a.role_code like CONCAT(CONCAT('%', #{roleCode}), '%')
+                and a.roleCode like CONCAT(CONCAT('%', #{roleCode}), '%')
             </if>
             <if test="roleName != null and roleName != ''">
-                and a.role_name like CONCAT(CONCAT('%', #{roleName}), '%')
+                and a.roleName like CONCAT(CONCAT('%', #{roleName}), '%')
             </if>
             <if test="modifyUser != null and modifyUser != ''">
-                and b.user_name like CONCAT(CONCAT('%', #{modifyUser}), '%')
+                and b.userName like CONCAT(CONCAT('%', #{modifyUser}), '%')
             </if>
         </trim>
         order by a.id desc

+ 42 - 46
xpyy/src/main/resources/mapper/UserMapper.xml

@@ -2,67 +2,63 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.xpyy.xpyy.mapper.UserMapper">
-
-    <sql id="userField">
-        id,code,user_name,password,real_name,email,landline,phone,department,role
-    </sql>
     <!-- 登录 -->
     <select id="login" resultType="com.xpyy.xpyy.entity.User">
         select
             a.id,
             a.code,
-            a.user_name,
+            a.userName,
             a.password,
-            a.real_name,
+            a.realName,
             a.email,
             a.landline,
             a.phone,
             a.department,
             a.role,
             b.menu
-        from tld_user a
-        left join tld_role b on a.role = b.id
-        where a.user_name = #{userName} and a.password = #{password}
+        from user a
+        left join role b on a.role = b.id
+        where a.userName = #{userName} and a.password = #{password}
     </select>
     <!-- 查询所有用户 -->
     <select id="getAllUser" resultType="com.xpyy.xpyy.entity.User">
         select
             a.id,
             a.code,
-            a.user_name,
+            a.userName,
             a.password,
-            a.real_name,
+            a.realName,
             a.email,
             a.landline,
             a.phone,
-            a.create_time,
+            a.createTime,
             c.name as department,
-            b.role_name as role,
+            b.roleName as role,
             a.role as roleId,
             a.menu,
-            a.menu_before,
+            a.menuBefore,
             a.department as departmentId,
-            a.modify_time as modifyTime,
-            f.user_name as modifyUser
-        from tld_user a
-        left join tld_user f on a.modify_user = f.id
-        left join tld_role b on a.role = b.id
-        left join tld_department c on a.department = c.code
+            a.modifyTime as modifyTime,
+            f.userName as modifyUser
+        from user a
+        left join user f on a.modifyUser = f.id
+        left join role b on a.role = b.id
+        left join department c on a.department = c.code
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="code != null and code != ''">
                 and a.code like CONCAT(CONCAT('%', #{code}), '%')
             </if>
             <if test="userName != null and userName != ''">
-                and a.user_name like CONCAT(CONCAT('%', #{userName}), '%')
+                and a.userName like CONCAT(CONCAT('%', #{userName}), '%')
             </if>
             <if test="realName != null and realName != ''">
-                and a.real_name like CONCAT(CONCAT('%', #{realName}), '%')
+                and a.realName like CONCAT(CONCAT('%', #{realName}), '%')
             </if>
             <if test="modifyUser != null and modifyUser != ''">
-                and f.user_name like CONCAT(CONCAT('%', #{modifyUser}), '%')
+                and f.userName like CONCAT(CONCAT('%', #{modifyUser}), '%')
             </if>
             <if test="role != null and role != ''">
-                and b.role_name like CONCAT(CONCAT('%', #{role}), '%')
+                and b.roleName like CONCAT(CONCAT('%', #{role}), '%')
             </if>
             <if test="email != null and email != ''">
                 and a.email like CONCAT(CONCAT('%', #{email}), '%')
@@ -87,25 +83,25 @@
         <selectKey resultType="java.lang.String" order="AFTER" keyProperty="id">
             select LAST_INSERT_ID()
         </selectKey>
-        insert into tld_user(user_name,password,real_name,email,landline,phone,department,role,create_time,modify_user,modify_time)
+        insert into user(userName,password,realName,email,landline,phone,department,role,createTime,modifyUser,modifyTime)
         values(#{userName},#{password},#{realName},#{email},#{landline},#{phone},#{department},#{role},NOW(),#{modifyUser},now())
     </insert>
     <!-- 修改指定用户信息 -->
     <update id="updateUser">
-        update tld_user
+        update user
         <set>
             <trim suffixOverrides=",">
                 <if test="code != null">
                     code = #{code},
                 </if>
                 <if test="userName != null">
-                    user_name = #{userName},
+                    userName = #{userName},
                 </if>
                 <if test="password != null">
                     password = #{password},
                 </if>
                 <if test="realName != null">
-                    real_name = #{realName},
+                    realName = #{realName},
                 </if>
                 <if test="email != null">
                     email = #{email},
@@ -123,50 +119,50 @@
                     menu = #{menu},
                 </if>
                 <if test="menuBefore != null">
-                    menu_before = #{menuBefore},
+                    menuBefore = #{menuBefore},
                 </if>
                 <if test="role != null">
                     role = #{role},
                 </if>
-                modify_user = #{modifyUser},modify_time=now(),
+                modifyUser = #{modifyUser},modifyTime=now(),
             </trim>
         </set>
             where id = #{id}
     </update>
     <!-- 删除用户 -->
     <delete id="delUser">
-        delete from tld_user where id = #{id}
+        delete from user where id = #{id}
     </delete>
     <!-- 查询用户名是否存在 -->
     <select id="getUserIsNot" resultType="int">
-        select count(*) from tld_user where user_name = #{userName} and id != #{id}
+        select count(*) from user where userName = #{userName} and id != #{id}
     </select>
     <!-- 查询导出数据 -->
     <select id="getUserExportData" resultType="java.util.LinkedHashMap">
         select
         a.code,
-        a.user_name,
-        if(a.real_name = '', null , a.real_name) as real_name,
+        a.userName,
+        if(a.realName = '', null , a.realName) as realName,
         if(a.email = '', null , a.email) as email,
         if(a.phone = '', null , a.phone) as phone,
         c.name as department,
-        b.role_name as role
-        from tld_user a
-        left join tld_role b on a.role = b.id
-        left join tld_department c on a.department = c.code
-        left join tld_user f on a.modify_user = f.id
+        b.roleName as role
+        from user a
+        left join role b on a.role = b.id
+        left join department c on a.department = c.code
+        left join user f on a.modifyUser = f.id
         <trim prefix="WHERE" prefixOverrides="and |or">
             <if test="code != null and code != ''">
                 and a.code like CONCAT(CONCAT('%', #{code}), '%')
             </if>
             <if test="userName != null and userName != ''">
-                and a.user_name like CONCAT(CONCAT('%', #{userName}), '%')
+                and a.userName like CONCAT(CONCAT('%', #{userName}), '%')
             </if>
             <if test="realName != null and realName != ''">
-                and a.real_name like CONCAT(CONCAT('%', #{realName}), '%')
+                and a.realName like CONCAT(CONCAT('%', #{realName}), '%')
             </if>
             <if test="role != null and role != ''">
-                and b.role_name like CONCAT(CONCAT('%', #{role}), '%')
+                and b.roleName like CONCAT(CONCAT('%', #{role}), '%')
             </if>
             <if test="email != null and email != ''">
                 and a.email like CONCAT(CONCAT('%', #{email}), '%')
@@ -178,7 +174,7 @@
                 and a.phone like CONCAT(CONCAT('%', #{phone}), '%')
             </if>
             <if test="modifyUser != null and modifyUser != ''">
-                and f.user_name like CONCAT(CONCAT('%', #{modifyUser}), '%')
+                and f.userName like CONCAT(CONCAT('%', #{modifyUser}), '%')
             </if>
             <if test="department != null and department != ''">
                 and a.department = #{department}
@@ -191,15 +187,15 @@
         select
             id,
             code,
-            user_name,
+            userName,
             password,
-            real_name,
+            realName,
             email,
             landline,
             phone,
             department,
             role
-        from tld_user
+        from user
         where id = #{id}
     </select>
 </mapper>

+ 0 - 22
xpyy/src/main/resources/template/province.xlsx

@@ -1,22 +0,0 @@
-成本跟踪表							
-							
-							
-项目概括	项目名称	${projectName}			项目编号	${projectSn}	
-	客户名称	${keHuName}			中标金额		
-	客户联系人	${ContactName}			付款方式		
-	项目中标日期				预算验收时间		
-							
-名目					业务预测金额	实际发生金额	备注
-销售合同收入							
-采购成本	供应商名称	供应商联系人	采购合同号	付款方式			
-	${}	${}	${}	${}			
-1							
-2							
-3							
-4							
-5							
-6							
-7							
-8							
-9							
-10