Quellcode durchsuchen

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	whepi-web/src/main/java/com/bofeng/wx/controller/YeWeiHuiController.java
maoyunfeng vor 5 Jahren
Ursprung
Commit
4e50a648de

+ 17 - 0
whepi-web/src/main/java/com/bofeng/dao/YeweihuiSysOwnerMapper.java

@@ -0,0 +1,17 @@
+package com.bofeng.dao;
+
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.bofeng.entity.SysUserRole;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Repository;
+
+
+@Mapper
+@Repository
+public interface YeweihuiSysOwnerMapper extends BaseMapper<SysUserRole> {
+
+    @Select("select uptown_id from sys_owner where owner_id=#{propertyId}")
+    long queryUptownIdByUserId(@Param("propertyId") Long propertyId);
+}

+ 16 - 0
whepi-web/src/main/java/com/bofeng/dao/YeweihuiUserRoleMapper.java

@@ -0,0 +1,16 @@
+package com.bofeng.dao;
+
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.bofeng.entity.SysUserRole;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.stereotype.Repository;
+
+@Mapper
+@Repository
+public interface YeweihuiUserRoleMapper extends BaseMapper<SysUserRole> {
+
+    @Select("select property_id from sys_user_role where user_id=#{userId} and role_id=2")
+    long queryPropertyIdByUserId(@Param("userId") Long userId);
+}

+ 55 - 0
whepi-web/src/main/java/com/bofeng/entity/SysUserRole.java

@@ -0,0 +1,55 @@
+package com.bofeng.entity;
+
+import lombok.Data;
+import org.joda.time.DateTime;
+
+import java.io.Serializable;
+
+/**
+ * sys_user_role
+ * @author 
+ */
+@Data
+public class SysUserRole implements Serializable {
+    /**
+     * 用户角色关系ID
+     */
+    private Long urId;
+
+    /**
+     * 用户ID
+     */
+    private Long userId;
+
+    /**
+     * 角色ID:1居民,2业委会,3商家
+     */
+    private Integer roleId;
+
+    /**
+     * 属性ID,居民门牌ID,业委会ID
+     */
+    private Long propertyId;
+
+    /**
+     * 新增人
+     */
+    private Long userCreate;
+
+    /**
+     * 新增时间
+     */
+    private DateTime timeCreate;
+
+    /**
+     * 修改人
+     */
+    private Long userUpdate;
+
+    /**
+     * 修改时间
+     */
+    private DateTime timeUpdate;
+
+    private static final long serialVersionUID = 1L;
+}

+ 14 - 1
whepi-web/src/main/java/com/bofeng/service/QzTaskService.java

@@ -2,6 +2,8 @@ package com.bofeng.service;
 
 import com.baomidou.mybatisplus.toolkit.IdWorker;
 import com.bofeng.dao.QzTaskDao;
+import com.bofeng.dao.YeweihuiSysOwnerMapper;
+import com.bofeng.dao.YeweihuiUserRoleMapper;
 import com.bofeng.entity.QzTask;
 import lombok.var;
 import org.joda.time.DateTime;
@@ -19,7 +21,18 @@ public class QzTaskService {
   @Autowired
   private QzTaskDao qzTaskDao;
 
-  public List<QzTask> selectAll(Long uptownId) {
+  @Autowired
+  private YeweihuiUserRoleMapper yeweihuiUserRoleMapper;
+
+  @Autowired
+  private YeweihuiSysOwnerMapper yeweihuiSysOwnerMapper;
+
+  public List<QzTask> selectAll(Long userId) {
+
+    Long propertyId = yeweihuiUserRoleMapper.queryPropertyIdByUserId(userId);
+
+    Long uptownId = yeweihuiSysOwnerMapper.queryUptownIdByUserId(propertyId);
+
     return qzTaskDao.selectAll(uptownId);
   }
 

+ 1 - 1
whepi-web/src/main/java/com/bofeng/wx/controller/UserOpenController.java

@@ -92,7 +92,7 @@ public class UserOpenController {
                 model.put("msReport", new JsonWapper(msReport));
                 return new ModelAndView("/home/home.ftl", model);
             } else if (userType == 2) {
-                List<QzTask> taskList = qzTaskService.selectAll(2L);
+                List<QzTask> taskList = qzTaskService.selectAll(userId);
                 model.put("taskList", YvanUtil.toJsonPretty(taskList));
                 List<sysUptownUnit> rbList = rbService.selectAll(userId);
                 model.put("rbList", YvanUtil.toJsonPretty(rbList));

+ 1 - 1
whepi-web/src/main/java/com/bofeng/wx/controller/WuYeController.java

@@ -37,7 +37,7 @@ public class WuYeController {
         queryParam.put("userId", "12345677");
         queryParam.put("statistics", "M");
 
-        List<QzTask> taskList = qzTaskService.selectAll(2L);
+        List<QzTask> taskList = qzTaskService.selectAll(userId);
 //        List<sysUptownUnit> rbList = rbService.selectAll();
         model.put("taskList", YvanUtil.toJsonPretty(taskList));
 //        model.put("rbList", YvanUtil.toJsonPretty(rbList));

+ 0 - 123
whepi-web/src/main/resources/generator/QzTaskReplyDao.xml

@@ -1,123 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.bofeng.generator.QzTaskReplyDao">
-  <resultMap id="BaseResultMap" type="com.bofeng.generator.QzTaskReply">
-    <id column="reply_id" jdbcType="BIGINT" property="replyId" />
-    <result column="task_id" jdbcType="BIGINT" property="taskId" />
-    <result column="user_id" jdbcType="BIGINT" property="userId" />
-    <result column="reply_content" jdbcType="VARCHAR" property="replyContent" />
-    <result column="user_create" jdbcType="BIGINT" property="userCreate" />
-    <result column="time_create" jdbcType="TIMESTAMP" property="timeCreate" />
-    <result column="user_update" jdbcType="BIGINT" property="userUpdate" />
-    <result column="time_update" jdbcType="TIMESTAMP" property="timeUpdate" />
-  </resultMap>
-  <sql id="Base_Column_List">
-    reply_id, task_id, user_id, reply_content, user_create, time_create, user_update, 
-    time_update
-  </sql>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-    select 
-    <include refid="Base_Column_List" />
-    from qz_task_reply
-    where reply_id = #{replyId,jdbcType=BIGINT}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
-    delete from qz_task_reply
-    where reply_id = #{replyId,jdbcType=BIGINT}
-  </delete>
-  <insert id="insert" keyColumn="reply_id" keyProperty="replyId" parameterType="com.bofeng.generator.QzTaskReply" useGeneratedKeys="true">
-    insert into qz_task_reply (task_id, user_id, reply_content, 
-      user_create, time_create, user_update, 
-      time_update)
-    values (#{taskId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{replyContent,jdbcType=VARCHAR}, 
-      #{userCreate,jdbcType=BIGINT}, #{timeCreate,jdbcType=TIMESTAMP}, #{userUpdate,jdbcType=BIGINT}, 
-      #{timeUpdate,jdbcType=TIMESTAMP})
-  </insert>
-  <insert id="insertSelective" keyColumn="reply_id" keyProperty="replyId" parameterType="com.bofeng.generator.QzTaskReply" useGeneratedKeys="true">
-    insert into qz_task_reply
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="taskId != null">
-        task_id,
-      </if>
-      <if test="userId != null">
-        user_id,
-      </if>
-      <if test="replyContent != null">
-        reply_content,
-      </if>
-      <if test="userCreate != null">
-        user_create,
-      </if>
-      <if test="timeCreate != null">
-        time_create,
-      </if>
-      <if test="userUpdate != null">
-        user_update,
-      </if>
-      <if test="timeUpdate != null">
-        time_update,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="taskId != null">
-        #{taskId,jdbcType=BIGINT},
-      </if>
-      <if test="userId != null">
-        #{userId,jdbcType=BIGINT},
-      </if>
-      <if test="replyContent != null">
-        #{replyContent,jdbcType=VARCHAR},
-      </if>
-      <if test="userCreate != null">
-        #{userCreate,jdbcType=BIGINT},
-      </if>
-      <if test="timeCreate != null">
-        #{timeCreate,jdbcType=TIMESTAMP},
-      </if>
-      <if test="userUpdate != null">
-        #{userUpdate,jdbcType=BIGINT},
-      </if>
-      <if test="timeUpdate != null">
-        #{timeUpdate,jdbcType=TIMESTAMP},
-      </if>
-    </trim>
-  </insert>
-  <update id="updateByPrimaryKeySelective" parameterType="com.bofeng.generator.QzTaskReply">
-    update qz_task_reply
-    <set>
-      <if test="taskId != null">
-        task_id = #{taskId,jdbcType=BIGINT},
-      </if>
-      <if test="userId != null">
-        user_id = #{userId,jdbcType=BIGINT},
-      </if>
-      <if test="replyContent != null">
-        reply_content = #{replyContent,jdbcType=VARCHAR},
-      </if>
-      <if test="userCreate != null">
-        user_create = #{userCreate,jdbcType=BIGINT},
-      </if>
-      <if test="timeCreate != null">
-        time_create = #{timeCreate,jdbcType=TIMESTAMP},
-      </if>
-      <if test="userUpdate != null">
-        user_update = #{userUpdate,jdbcType=BIGINT},
-      </if>
-      <if test="timeUpdate != null">
-        time_update = #{timeUpdate,jdbcType=TIMESTAMP},
-      </if>
-    </set>
-    where reply_id = #{replyId,jdbcType=BIGINT}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.bofeng.generator.QzTaskReply">
-    update qz_task_reply
-    set task_id = #{taskId,jdbcType=BIGINT},
-      user_id = #{userId,jdbcType=BIGINT},
-      reply_content = #{replyContent,jdbcType=VARCHAR},
-      user_create = #{userCreate,jdbcType=BIGINT},
-      time_create = #{timeCreate,jdbcType=TIMESTAMP},
-      user_update = #{userUpdate,jdbcType=BIGINT},
-      time_update = #{timeUpdate,jdbcType=TIMESTAMP}
-    where reply_id = #{replyId,jdbcType=BIGINT}
-  </update>
-</mapper>