dcs 1 рік тому
батько
коміт
f7ae6a52eb

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

@@ -29,10 +29,10 @@ public class TagController {
         return Response.ok();
     }
 
-    @ApiOperation("获取")
-    @RequestMapping(value = "/list", method = RequestMethod.POST)
-    public Response getList(@RequestBody Tag tag) {
-        return Response.ok(tagService.getList(tag));
+    @ApiOperation("根据type获取")
+    @RequestMapping(value = "/{type}", method = RequestMethod.POST)
+    public Response getList(@PathVariable int type) {
+        return Response.ok(tagService.getType(type));
     }
 
     @ApiOperation("更新")

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

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

+ 125 - 125
virgo.api/src/main/java/com/bosshand/virgo/api/model/Project.java

@@ -9,129 +9,129 @@ import java.util.List;
  * 项目
  */
 public class Project {
-	
-	private long id;
-
-	/**
-	 * 创建时间
-	 */
-	@JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy-MM-dd",timezone="GMT+8")
-	private Date createDate;
-
-	/**
-	 * 组织id
-	 */
-	private long organizationId;
-
-	/**
-	 * 名称
-	 */
-	private String name;
-
-	/**
-	 * 位置
-	 */
-	private String address;
-
-	/**
-	 * 照片
-	 */
-	private String picture;
-
-	/**
-	 * 标签id
-	 */
-	private long tagId;
-
-	/**
-	 * 描述
-	 */
-	private String comment;
-
-	/**
-	 * 自定义字段
-	 */
-	private String data;
-
-	private List<ProjectItem> projectItemList;
-
-	public long getId() {
-		return id;
-	}
-
-	public void setId(long id) {
-		this.id = id;
-	}
-
-	public Date getCreateDate() {
-		return createDate;
-	}
-
-	public void setCreateDate(Date createDate) {
-		this.createDate = createDate;
-	}
-
-	public long getOrganizationId() {
-		return organizationId;
-	}
-
-	public void setOrganizationId(long organizationId) {
-		this.organizationId = organizationId;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public String getAddress() {
-		return address;
-	}
-
-	public void setAddress(String address) {
-		this.address = address;
-	}
-
-	public String getPicture() {
-		return picture;
-	}
-
-	public void setPicture(String picture) {
-		this.picture = picture;
-	}
-
-	public long getTagId() {
-		return tagId;
-	}
-
-	public void setTagId(long tagId) {
-		this.tagId = tagId;
-	}
-
-	public String getComment() {
-		return comment;
-	}
-
-	public void setComment(String comment) {
-		this.comment = comment;
-	}
-
-	public String getData() {
-		return data;
-	}
-
-	public void setData(String data) {
-		this.data = data;
-	}
-
-	public List<ProjectItem> getProjectItemList() {
-		return projectItemList;
-	}
-
-	public void setProjectItemList(List<ProjectItem> projectItemList) {
-		this.projectItemList = projectItemList;
-	}
+
+    private long id;
+
+    /**
+     * 创建时间
+     */
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date createDate;
+
+    /**
+     * 组织id
+     */
+    private long organizationId;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 位置
+     */
+    private String address;
+
+    /**
+     * 照片
+     */
+    private String picture;
+
+    /**
+     * 标签ids
+     */
+    private String tagIds;
+
+    /**
+     * 描述
+     */
+    private String comment;
+
+    /**
+     * 自定义字段
+     */
+    private String data;
+
+    private List<ProjectItem> projectItemList;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public Date getCreateDate() {
+        return createDate;
+    }
+
+    public void setCreateDate(Date createDate) {
+        this.createDate = createDate;
+    }
+
+    public long getOrganizationId() {
+        return organizationId;
+    }
+
+    public void setOrganizationId(long organizationId) {
+        this.organizationId = organizationId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+    public String getPicture() {
+        return picture;
+    }
+
+    public void setPicture(String picture) {
+        this.picture = picture;
+    }
+
+    public String getTagIds() {
+        return tagIds;
+    }
+
+    public void setTagIds(String tagIds) {
+        this.tagIds = tagIds;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+
+    public void setComment(String comment) {
+        this.comment = comment;
+    }
+
+    public String getData() {
+        return data;
+    }
+
+    public void setData(String data) {
+        this.data = data;
+    }
+
+    public List<ProjectItem> getProjectItemList() {
+        return projectItemList;
+    }
+
+    public void setProjectItemList(List<ProjectItem> projectItemList) {
+        this.projectItemList = projectItemList;
+    }
 }

+ 6 - 6
virgo.api/src/main/java/com/bosshand/virgo/api/model/ProjectItem.java

@@ -49,9 +49,9 @@ public class ProjectItem {
 	private String propertyCertificateNumber;
 
 	/**
-	 * 标签id
+	 * 标签ids
 	 */
-	private long tagId;
+	private String tagIds;
 
 	/**
 	 * 自定义字段
@@ -124,12 +124,12 @@ public class ProjectItem {
 		this.propertyCertificateNumber = propertyCertificateNumber;
 	}
 
-	public long getTagId() {
-		return tagId;
+	public String getTagIds() {
+		return tagIds;
 	}
 
-	public void setTagId(long tagId) {
-		this.tagId = tagId;
+	public void setTagIds(String tagIds) {
+		this.tagIds = tagIds;
 	}
 
 	public String getData() {

+ 1 - 1
virgo.api/src/main/java/com/bosshand/virgo/api/model/ProjectItemTargetRoom.java

@@ -73,7 +73,7 @@ public class ProjectItemTargetRoom {
     private String video;
 
     /**
-     * 标签id
+     * 标签ids
      */
     private long tagId;
 

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

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

+ 15 - 6
virgo.api/src/main/resources/mapper/ProjectItemMapper.xml

@@ -13,7 +13,7 @@
 			<result column="address" property="address"/>
 			<result column="picture" property="picture"/>
 			<result column="propertyCertificateNumber" property="propertyCertificateNumber"/>
-			<result column="tagId" property="tagId"/>
+			<result column="tagIds" property="tagIds"/>
 			<result column="data" property="data"/>
 	</resultMap>
 
@@ -26,7 +26,7 @@
 		<result column="address" property="address"/>
 		<result column="picture" property="picture"/>
 		<result column="propertyCertificateNumber" property="propertyCertificateNumber"/>
-		<result column="tagId" property="tagId"/>
+		<result column="tagIds" property="tagIds"/>
 		<result column="data" property="data"/>
 		<collection property="projectItemTargetList" ofType="com.bosshand.virgo.api.model.ProjectItemTarget" resultMap="com.bosshand.virgo.api.dao.ProjectItemTargetDao.projectItemTargetResult" columnPrefix="projectItemTarget_"/>
 	</resultMap>
@@ -53,7 +53,11 @@
 		SELECT count(*) FROM project_item
 		<where>
 			<if test="projectId != 0">and projectId = #{projectId}</if>
-			<if test="tagId != 0">and tagId = #{tagId}</if>
+			<if test="tagIds != null">and
+				<foreach item="tagId" collection="tagIds.split(',')" open="(" separator=" and " close=")">
+					FIND_IN_SET (#{tagId}, tagIds)
+				</foreach>
+			</if>
 		</where>
 	</select>
 
@@ -61,14 +65,18 @@
 		SELECT * FROM project_item
 		<where>
 			<if test="p.projectId !=0">and id=#{p.projectId}</if>
-			<if test="p.tagId != 0">and tagId = #{p.tagId}</if>
+			<if test="p.tagIds != null">and
+				<foreach item="tagId" collection="p.tagIds.split(',')" open="(" separator=" and " close=")">
+					FIND_IN_SET (#{tagId}, tagIds)
+				</foreach>
+			</if>
 		</where>
 		limit #{currIndex} , #{pageSize}
 	</select>
 	
 	<insert id="insert" useGeneratedKeys="true" keyProperty="id">
-		INSERT INTO project_item(`projectId`, `name`, `createDate`, `area`, `address`, `picture`, `propertyCertificateNumber`, `tagId`, `data`)
-		VALUES (#{projectId}, #{name}, now(), #{area}, #{address}, #{picture}, #{propertyCertificateNumber}, #{tagId}, #{data})
+		INSERT INTO project_item(`projectId`, `name`, `createDate`, `area`, `address`, `picture`, `propertyCertificateNumber`, `tagIds`, `data`)
+		VALUES (#{projectId}, #{name}, now(), #{area}, #{address}, #{picture}, #{propertyCertificateNumber}, #{tagIds}, #{data})
 	</insert>
 
 	<delete id="delete">
@@ -83,6 +91,7 @@
 		UPDATE project_item
 		<trim prefix="set" suffixOverrides=",">
 			<if test="name!=null">name=#{name},</if>
+			<if test="tagIds!=null">tagIds=#{tagIds},</if>
 		</trim>
 		WHERE id=#{id}
 	</update>

+ 8 - 6
virgo.api/src/main/resources/mapper/ProjectItemTargetRoomMapper.xml

@@ -19,7 +19,7 @@
         <result column="propertyCertificateNumber" property="propertyCertificateNumber"/>
         <result column="picture" property="picture"/>
         <result column="video" property="video"/>
-        <result column="tagId" property="tagId"/>
+        <result column="tagIds" property="tagIds"/>
         <result column="openState" property="openState"/>
         <result column="data" property="data"/>
     </resultMap>
@@ -48,8 +48,10 @@
             <if test="projectItemTargetId != 0">
                 and projectItemTargetId = #{projectItemTargetId}
             </if>
-            <if test="tagId != 0">
-                and tagId = #{tagId}
+            <if test="tagIds != null">and
+                <foreach item="tagId" collection="tagIds.split(',')" open="(" separator=" and " close=")">
+                    FIND_IN_SET (#{tagId}, tagIds)
+                </foreach>
             </if>
             <if test="openState == 0 or openState == 1">
                 and openState = #{openState}
@@ -59,9 +61,9 @@
 
     <insert id="insert" useGeneratedKeys="true" keyProperty="id">
         INSERT INTO project_item_target_room(`projectId`, `projectItemId`, `projectItemTargetId`, `roomTypeId`, `roomNumber`, `area`, `roomState`, `investmentState`,
-                                             `invocationDate`, `decoration`, `propertyCertificateNumber`, `picture`, `video`, `tagId`, `openState`, `data`)
+                                             `invocationDate`, `decoration`, `propertyCertificateNumber`, `picture`, `video`, `tagIds`, `openState`, `data`)
         VALUES (#{projectId}, #{projectItemId}, #{projectItemTargetId}, #{roomTypeId}, #{roomNumber}, #{area}, #{roomState}, #{investmentState},
-                #{invocationDate}, #{decoration}, #{propertyCertificateNumber}, #{picture}, #{video}, #{tagId}, #{openState}, #{data})
+                #{invocationDate}, #{decoration}, #{propertyCertificateNumber}, #{picture}, #{video}, #{tagIds}, #{openState}, #{data})
     </insert>
 
     <delete id="delete">
@@ -88,7 +90,7 @@
             <if test="propertyCertificateNumber!=null">propertyCertificateNumber=#{propertyCertificateNumber},</if>
             <if test="picture!=null">picture=#{picture},</if>
             <if test="video!=null">video=#{video},</if>
-            <if test="tagId!=0">tagId=#{tagId},</if>
+            <if test="tagIds!=null">tagIds=#{tagIds},</if>
             <if test="openState == 0 or openState == 1">openState=#{openState},</if>
             <if test="data!=null">data=#{data},</if>
         </trim>

+ 15 - 7
virgo.api/src/main/resources/mapper/ProjectMapper.xml

@@ -9,7 +9,7 @@
 		<result column="organizationId" property="organizationId"/>
 		<result column="address" property="address"/>
 		<result column="picture" property="picture"/>
-		<result column="tagId" property="tagId"/>
+		<result column="tagIds" property="tagIds"/>
 		<result column="comment" property="comment"/>
 		<result column="data" property="data"/>
 	</resultMap>
@@ -21,7 +21,7 @@
 		<result column="organizationId" property="organizationId"/>
 		<result column="address" property="address"/>
 		<result column="picture" property="picture"/>
-		<result column="tagId" property="tagId"/>
+		<result column="tagIds" property="tagIds"/>
 		<result column="comment" property="comment"/>
 		<result column="data" property="data"/>
 		<collection property="projectItemList" ofType="com.bosshand.virgo.api.model.ProjectItem" resultMap="com.bosshand.virgo.api.dao.ProjectItemDao.projectItemResult" columnPrefix="projectItem_"/>
@@ -53,8 +53,8 @@
 	</select>
 
 	<insert id="insert" parameterType="com.bosshand.virgo.api.model.Project" useGeneratedKeys="true" keyProperty="id">
-		INSERT INTO project(`name`, `createDate`, `organizationId`, `address`, `picture`, `tagId`, `comment`, `data`)
-		VALUES (#{name}, now(), #{organizationId}, #{address}, #{picture}, #{tagId}, #{comment}, #{data})
+		INSERT INTO project(`name`, `createDate`, `organizationId`, `address`, `picture`, `tagIds`, `comment`, `data`)
+		VALUES (#{name}, now(), #{organizationId}, #{address}, #{picture}, #{tagIds}, #{comment}, #{data})
 	</insert>
 
 	<update id="delete">
@@ -69,7 +69,7 @@
 			<if test="organizationId!=0">organizationId=#{organizationId},</if>
 			<if test="address!=null">address=#{address},</if>
 			<if test="picture!=null">picture=#{picture},</if>
-			<if test="tagId!=0">tagId=#{tagId},</if>
+			<if test="tagIds!=null">tagIds=#{tagIds},</if>
 			<if test="comment!=null">comment=#{comment},</if>
 			<if test="data!=null">data=#{data},</if>
 		</trim>
@@ -81,7 +81,11 @@
 		<where>
 			and deleteState = 0
 			<if test="organizationId != 0">and organizationId = #{organizationId}</if>
-			<if test="tagId != 0">and tagId = #{tagId}</if>
+			<if test="tagIds != null">and
+				<foreach item="tagId" collection="tagIds.split(',')" open="(" separator=" and " close=")">
+					FIND_IN_SET (#{tagId}, tagIds)
+				</foreach>
+			</if>
 			<if test="name != null and name !=''">and name = #{name}</if>
 			<if test="createDate != null and createDate !=''">and createDate = #{createDate}</if>
 		</where>
@@ -92,7 +96,11 @@
 		<where>
 			and deleteState = 0
 			<if test="p.organizationId!=0">and organizationId=#{p.organizationId}</if>
-			<if test="p.tagId != 0">and tagId = #{p.tagId}</if>
+			<if test="p.tagIds != null">and
+				<foreach item="tagId" collection="p.tagIds.split(',')" open="(" separator=" and " close=")">
+					FIND_IN_SET (#{tagId}, tagIds)
+				</foreach>
+			</if>
 			<if test="p.name!=null">and name=#{p.name}</if>
 			<if test="p.createDate!=null and p.createDate !=''">and createDate = #{p.createDate}</if>
 		</where>

+ 6 - 0
virgo.api/src/main/resources/mapper/TagMapper.xml

@@ -10,6 +10,12 @@
         <result column="type" property="type"/>
     </resultMap>
 
+
+    <select id="getType" resultMap="tagResult">
+        select * from tag where type = #{type}
+    </select>
+
+
     <select id="getList" resultMap="tagResult">
         select * from tag
         <where>