Преглед изворни кода

Merge remote-tracking branch 'origin/master'

Joburgess пре 5 година
родитељ
комит
7b2f18b05e

+ 11 - 0
cms/src/main/java/com/ym/mec/cms/controller/queryinfo/NewsInformationQueryInfo.java

@@ -21,6 +21,9 @@ public class NewsInformationQueryInfo extends QueryInfo {
 	@ApiModelProperty(value = "备注", required = false)
 	private String memo;
 	
+	@ApiModelProperty(value = "租客编号", required = false)
+	private Integer tenantId;
+	
 	private Date date;
 
 	public Integer getType() {
@@ -62,4 +65,12 @@ public class NewsInformationQueryInfo extends QueryInfo {
 	public void setMemo(String memo) {
 		this.memo = memo;
 	}
+
+	public Integer getTenantId() {
+		return tenantId;
+	}
+
+	public void setTenantId(Integer tenantId) {
+		this.tenantId = tenantId;
+	}
 }

+ 12 - 2
cms/src/main/java/com/ym/mec/cms/dal/entity/SysNewsInformation.java

@@ -7,7 +7,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
  * 对应数据库表(sys_news_information):
  */
 public class SysNewsInformation {
-	
+
 	/**  */
 	private Long id;
 
@@ -48,9 +48,11 @@ public class SysNewsInformation {
 
 	@ApiModelProperty(value = "备注", required = false)
 	private String memo;
-	
+
 	private Boolean delFlag;
 
+	private Integer tenantId;
+
 	public String getLinkUrl() {
 		return linkUrl;
 	}
@@ -155,6 +157,14 @@ public class SysNewsInformation {
 		this.delFlag = delFlag;
 	}
 
+	public Integer getTenantId() {
+		return tenantId;
+	}
+
+	public void setTenantId(Integer tenantId) {
+		this.tenantId = tenantId;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 4 - 0
cms/src/main/java/com/ym/mec/cms/service/impl/SysNewsInformationServiceImpl.java

@@ -48,6 +48,10 @@ public class SysNewsInformationServiceImpl extends BaseServiceImpl<Long, SysNews
 		Map<String,PageInfo<SysNewsInformation>> homeList = new HashMap<>();
 		queryInfo.setStatus(NewsStatusEnum.SHOW);
 		
+		if(queryInfo.getTenantId() == null){
+			queryInfo.setTenantId(2);
+		}
+		
 		String memo = queryInfo.getMemo();
 		
 		Map<String, Object> params = new HashMap<String, Object>();

+ 15 - 2
cms/src/main/resources/config/mybatis/SysNewsInformationMapper.xml

@@ -20,6 +20,7 @@
 		<result column="href_target_" property="hrefTarget" />
 		<result column="order_" property="order" />
 		<result column="memo_" property="memo" />
+		<result column="tenant_id_" property="tenantId" />
 	</resultMap>
 	
 	<sql id="queryCondition">
@@ -28,6 +29,9 @@
 			<if test="type != null">
 				and type_ = #{type}
 			</if>
+			<if test="tenantId != null">
+				and tenant_id_ = #{tenantId}
+			</if>
 			<if test="status != null">
 				and status_ = #{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 			</if>
@@ -52,8 +56,8 @@
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.cms.dal.entity.SysNewsInformation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO sys_news_information (id_,title_,content_,cover_image_,type_,status_,create_time_,update_time_,link_url_,href_target_,order_,del_flag_,memo_)
-		VALUES(#{id},#{title},#{content},#{coverImage},#{type},#{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),now(),#{linkUrl},#{hrefTarget},#{order},0,#{memo})
+		INSERT INTO sys_news_information (id_,title_,content_,cover_image_,type_,status_,create_time_,update_time_,link_url_,href_target_,order_,del_flag_,memo_,tenant_id_)
+		VALUES(#{id},#{title},#{content},#{coverImage},#{type},#{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),now(),#{linkUrl},#{hrefTarget},#{order},0,#{memo},#{tenantId})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -66,6 +70,9 @@
 			<if test="title != null">
 				title_ = #{title},
 			</if>
+			<if test="tenantId != null">
+				tenant_id_ = #{tenantId},
+			</if>
 			<if test="updateTime != null">
 				update_time_ = NOW(),
 			</if>
@@ -147,6 +154,9 @@
 		<if test="search != null">
 			and title_ like '%' #{search} '%'
 		</if>
+		<if test="tenantId != null">
+			and tenant_id_ = #{tenantId}
+		</if>
 		<choose>
 			<when test="memo != null and memo != ''">
 				and memo_ = #{memo}
@@ -175,6 +185,9 @@
 		<if test="search != null">
 			and title_ like '%' #{search} '%'
 		</if>
+		<if test="tenantId != null">
+			and tenant_id_ = #{tenantId}
+		</if>
 		<choose>
 			<when test="memo != null and memo != ''">
 				and memo_ = #{memo}