dcs 11 ay önce
ebeveyn
işleme
1503eb7234

+ 6 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/controller/TagController.java

@@ -40,6 +40,12 @@ public class TagController {
         return Response.ok(tagService.getType(type));
     }
 
+    @ApiOperation("根据organizationId和type获取,type 1:项目,2:单位工程,3:房源")
+    @RequestMapping(value = "/{organizationId}/{type}", method = RequestMethod.GET)
+    public Response getOrganizationId(@PathVariable long organizationId, @PathVariable int type) {
+        return Response.ok(tagService.getOrganizationId(organizationId, type));
+    }
+
     @ApiOperation("更新")
     @RequestMapping(value = "/update", method = RequestMethod.PUT)
     public Response update(@RequestBody Tag tag) {

+ 2 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/dao/TagDao.java

@@ -18,6 +18,8 @@ public interface TagDao {
 
     List<Tag> getType(int type);
 
+    List<Tag> getOrganizationId(long organizationId, int type);
+
     int delete(long id);
 
 }

+ 13 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/model/Tag.java

@@ -18,6 +18,11 @@ public class Tag {
      */
     private int type;
 
+    /**
+     * 组织id
+     */
+    private long organizationId;
+
     public long getId() {
         return id;
     }
@@ -41,4 +46,12 @@ public class Tag {
     public void setType(int type) {
         this.type = type;
     }
+
+    public long getOrganizationId() {
+        return organizationId;
+    }
+
+    public void setOrganizationId(long organizationId) {
+        this.organizationId = organizationId;
+    }
 }

+ 4 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/service/TagService.java

@@ -29,6 +29,10 @@ public class TagService {
         return tagDao.getType(type);
     }
 
+    public List<Tag> getOrganizationId(long organizationId, int type) {
+        return tagDao.getOrganizationId(organizationId, type);
+    }
+
     public int delete(long id) {
         return tagDao.delete(id);
     }

+ 10 - 1
virgo.api/src/main/resources/mapper/TagMapper.xml

@@ -8,6 +8,7 @@
         <id column="id" property="id"/>
         <result column="name" property="name"/>
         <result column="type" property="type"/>
+        <result column="organizationId" property="organizationId"/>
     </resultMap>
 
     <select id="get" resultMap="tagResult">
@@ -18,6 +19,10 @@
         select * from tag where type = #{type}
     </select>
 
+    <select id="getOrganizationId" resultMap="tagResult">
+        select * from tag where organizationId = #{organizationId} and type = #{type}
+    </select>
+
     <select id="getList" resultMap="tagResult">
         select * from tag
         <where>
@@ -30,11 +35,14 @@
             <if test="type != 0">
                 and type = #{type}
             </if>
+            <if test="organizationId != 0">
+                and organizationId = #{organizationId}
+            </if>
         </where>
     </select>
 
     <insert id="insert" useGeneratedKeys="true" keyProperty="id">
-        INSERT INTO tag (name, type) VALUES (#{name}, #{type})
+        INSERT INTO tag (name, type, organizationId) VALUES (#{name}, #{type}, #{organizationId})
     </insert>
 
     <delete id="delete">
@@ -46,6 +54,7 @@
         <trim prefix="set" suffixOverrides=",">
             <if test="name!=null">name=#{name},</if>
             <if test="type!=0">type=#{type},</if>
+            <if test="organizationId!=0">organizationId=#{organizationId},</if>
         </trim>
         WHERE id=#{id}
     </update>

+ 1 - 0
virgo.core/src/main/java/com/bosshand/virgo/core/shiro/VirgoAuthenticationFilter.java

@@ -130,6 +130,7 @@ public class VirgoAuthenticationFilter extends AuthenticatingFilter {
 				//注册
 				MgrUser u = new MgrUser();
 				u.setPhone(dto.getPhone());
+				u.setName(CodeCache.DefaultUserName);
 				mgrUserService.register(u);
 				phone = dto.getPhone();
 			}

+ 2 - 0
virgo.core/src/main/java/com/bosshand/virgo/core/utils/CodeCache.java

@@ -16,6 +16,8 @@ public class CodeCache {
 
     public static final String DefaultName = "微信用户";
 
+    public static final String DefaultUserName = "有极用户";
+
     public static final String DefaultPortrait = "https://file-node.oss-cn-shanghai.aliyuncs.com/youji/78063ded24ba44f6b56e0dc812cf94a0";
 
     private static Logger logger = LoggerFactory.getLogger(CodeCache.class);

+ 4 - 0
virgo.manager/src/main/java/com/bosshand/virgo/service/UserService.java

@@ -7,6 +7,7 @@ import com.bosshand.virgo.core.dao.MgrUserRoleDao;
 import com.bosshand.virgo.core.model.Attendance;
 import com.bosshand.virgo.core.model.MgrUser;
 import com.bosshand.virgo.core.model.MgrUserRole;
+import com.bosshand.virgo.core.utils.CodeCache;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -87,6 +88,9 @@ public class UserService {
         if (mgrUser != null) {
             userId = mgrUser.getId();
         } else {
+            if (user.getName() == null) {
+                user.setName(CodeCache.DefaultUserName);
+            }
             mgrUserDao.insert(user);
             userId = user.getId();
         }