lsw il y a 1 an
Parent
commit
5fa6af0cc3

+ 3 - 2
admin-ui/src/views/work/company/index.vue

@@ -13,7 +13,7 @@
           <el-option value="1" label="停用"></el-option>
         </el-select>
       </el-form-item>
-      <el-form-item label="时间范围">
+      <el-form-item label="创建日期">
         <el-date-picker v-model="dateRange" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
       </el-form-item>
       <el-form-item>
@@ -33,6 +33,7 @@
       <el-table-column label="企业方负责人" align="center" prop="director" width="120" />
       <el-table-column label="手机号" align="center" prop="phone" width="150" />
       <el-table-column label="账户余额(元)" align="center" prop="money" width="120" />
+      <el-table-column label="关联用户" align="center" prop="peoples" width="120" />
       <el-table-column label="创建日期" align="center" prop="createTime" width="180" />
       <el-table-column label="账号状态" align="center" prop="state" width="100">
         <template slot-scope="scope">
@@ -45,7 +46,7 @@
       </el-table-column>
       <el-table-column label="操作" align="center" width="180">
         <template slot-scope="scope">
-          <el-button size="mini" type="text" icon="el-icon-view" @click="op('detail', scope.row)" v-hasPermi="['work:company:list']">查看</el-button>
+          <el-button size="mini" type="text" icon="el-icon-view" @click="op('detail', scope.row)" v-hasPermi="['work:company:list']">详情</el-button>
           <el-button size="mini" type="text" icon="el-icon-edit" @click="op('edit', scope.row)" v-hasPermi="['work:company:edit']">修改</el-button>
           <el-button size="mini" type="text" icon="el-icon-delete" @click="del(scope.row)" v-hasPermi="['work:company:remove']">删除</el-button>
         </template>

+ 9 - 4
admin-ui/src/views/work/user/index.vue

@@ -24,8 +24,8 @@
     <el-table :data="response.rows" border @selection-change="selects" height="calc(100vh - 270px)">
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="姓名" align="center" prop="name" />
-      <el-table-column label="手机号" align="center" prop="phone" />
       <el-table-column label="身份证" align="center" prop="idCard" />
+      <el-table-column label="手机号" align="center" prop="phone" />
       <el-table-column label="实名认证" align="center" prop="isAuthentication" width="130">
         <template slot-scope="scope">
           <el-tag type="danger" v-if="scope.row.isAuthentication == 0">未实名</el-tag>
@@ -39,7 +39,7 @@
           <el-tag type="success" v-if="scope.row.isContract == 1">已签署</el-tag>
         </template>
       </el-table-column>
-      <el-table-column label="注册日期" align="center" prop="createTime" />
+      <el-table-column label="关联企业" align="center" prop="isCompany" width="130" />
       <el-table-column label="账号状态" align="center" prop="state" width="100">
         <template slot-scope="scope">
           <div class="switch">
@@ -49,8 +49,10 @@
           </div>
         </template>
       </el-table-column>
-      <el-table-column label="操作" align="center" fixed="right">
+      <el-table-column label="注册日期" align="center" prop="createTime" />
+      <el-table-column label="操作" align="center">
         <template slot-scope="scope">
+          <el-button size="mini" type="text" icon="el-icon-view" @click="op('detail', scope.row)" v-hasPermi="['work:user:list']">详情</el-button>
           <el-button size="mini" type="text" icon="el-icon-edit" @click="op('edit', scope.row)" v-hasPermi="['work:user:edit']">审核</el-button>
           <el-button size="mini" type="text" icon="el-icon-delete" @click="del(scope.row)" v-hasPermi="['work:user:remove']">删除</el-button>
         </template>
@@ -105,8 +107,11 @@ export default {
       this.ids = rows.map((item) => item.id);
     },
     op(tag, row) {
+      const id = row.id || this.ids[0];
+      if (tag == 'detail') {
+        this.iframe({ obj: audit, param: { id: id, detail: true, companyName: row.companyName }, title: '充值详情', width: '45%', height: '65%' });
+      }
       if (tag == 'edit') {
-        const id = row.id || this.ids[0];
         this.iframe({ obj: edit, param: { id: id }, title: '审核', width: '60%', height: '70%' });
       }
       //账号状态

+ 1 - 6
ruoyi-admin/src/main/java/com/ruoyi/web/work/domain/Company.java

@@ -76,12 +76,7 @@ public class Company extends BaseData {
     @TableField(exist = false)
     private String password;
 
-    //开始日期
     @TableField(exist = false)
-    private String dateBegin;
-
-    //结束日期
-    @TableField(exist = false)
-    private String dateEnd;
+    private Integer peoples;
 
 }

+ 6 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/impl/CompanyServiceImpl.java

@@ -50,7 +50,9 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
         }
         company.setMoney(BigDecimal.ZERO);
         company.setState(0);
-        save(company);
+        if (!save(company)) {
+            throw new ServerException("新增企业失败,请联系管理员");
+        }
         SysUser user = new SysUser();
         user.setUserName(company.getUserName());
         user.setPassword(company.getPassword());
@@ -62,7 +64,9 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
         if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user))) {
             throw new ServerException("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
         }
-        userService.insertUser(user);
+        if (userService.insertUser(user) == 0) {
+            throw new ServerException("新增用户失败,请联系管理员");
+        }
         return AjaxResult.success();
     }
 }

+ 16 - 6
ruoyi-admin/src/main/resources/mapper/work/CompanyMapper.xml

@@ -5,13 +5,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 <mapper namespace="com.ruoyi.web.work.mapper.CompanyMapper">
     
     <select id="selectList" resultType="com.ruoyi.web.work.domain.Company">
-        select * from tb_company
+        SELECT
+        c.id,
+        c.company_name,
+        c.director,
+        c.money,
+        c.phone,
+        c.create_time,
+        c.state,
+        ( SELECT COUNT( r.id ) FROM tb_relate r WHERE r.company_id = c.id ) AS peoples
+        FROM
+        tb_company c
         <where>  
-            <if test="companyName != null  and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
-            <if test="director != null  and director != ''"> and director like concat('%', #{director}, '%')</if>
-            <if test="phone != null  and phone != ''"> and phone = #{phone}</if>
-            <if test="state != null "> and state = #{state}</if>
-            <if test="dateBegin != null  and dateBegin != ''"> AND create_time BETWEEN #{dateBegin} AND #{dateEnd} + INTERVAL 1 DAY</if>
+            <if test="companyName != null  and companyName != ''"> and c.company_name like concat('%', #{companyName}, '%')</if>
+            <if test="director != null  and director != ''"> and c.director like concat('%', #{director}, '%')</if>
+            <if test="phone != null  and phone != ''"> and c.phone = #{phone}</if>
+            <if test="state != null "> and c.state = #{state}</if>
+            <if test="dateBegin != null  and dateBegin != ''"> AND c.create_time BETWEEN #{dateBegin} AND #{dateEnd} + INTERVAL 1 DAY</if>
         </where>
     </select>