Browse Source

add:知识库新增声部

yonge 4 years ago
parent
commit
7b86a13d9f

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

@@ -27,6 +27,9 @@ public class NewsInformationQueryInfo extends QueryInfo {
 	@ApiModelProperty(value = "租客编号", required = false)
 	private Integer tenantId;
 	
+	@ApiModelProperty(value = "声部编号", required = false)
+	private Integer subjectId;
+	
 	private String clientName;
 	
 	private Date date;
@@ -94,4 +97,12 @@ public class NewsInformationQueryInfo extends QueryInfo {
 	public void setClientName(String clientName) {
 		this.clientName = clientName;
 	}
+
+	public Integer getSubjectId() {
+		return subjectId;
+	}
+
+	public void setSubjectId(Integer subjectId) {
+		this.subjectId = subjectId;
+	}
 }

+ 20 - 0
cms/src/main/java/com/ym/mec/cms/dal/entity/SysNewsInformation.java

@@ -72,6 +72,10 @@ public class SysNewsInformation {
 	private String attribute1;
 	
 	private String attribute2;
+	
+	private String subjectIdList;
+	
+	private String subjectName;
 
 	public String getLinkUrl() {
 		return linkUrl;
@@ -233,6 +237,22 @@ public class SysNewsInformation {
 		this.offlineTime = offlineTime;
 	}
 
+	public String getSubjectIdList() {
+		return subjectIdList;
+	}
+
+	public void setSubjectIdList(String subjectIdList) {
+		this.subjectIdList = subjectIdList;
+	}
+
+	public String getSubjectName() {
+		return subjectName;
+	}
+
+	public void setSubjectName(String subjectName) {
+		this.subjectName = subjectName;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 48 - 33
cms/src/main/resources/config/mybatis/SysNewsInformationMapper.xml

@@ -27,36 +27,41 @@
 		<result column="tenant_id_" property="tenantId" />
 		<result column="attribute1_" property="attribute1" />
 		<result column="attribute2_" property="attribute2" />
+		<result column="subject_id_list_" property="subjectIdList" />
+		<result column="subject_name_" property="subjectName" />
 	</resultMap>
 	
 	<sql id="queryCondition">
 		<where>
-			del_flag_=0 
+			sni.del_flag_=0 
 			<if test="type != null">
-				and type_ = #{type}
+				and sni.type_ = #{type}
 			</if>
 			<if test="subType != null">
-				and sub_type_ = #{subType}
+				and sni.sub_type_ = #{subType}
 			</if>
 			<if test="tenantId != null">
-				and tenant_id_ = #{tenantId}
+				and sni.tenant_id_ = #{tenantId}
 			</if>
 			<if test="status != null">
-				and status_ = #{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+				and sni.status_ = #{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 			</if>
 			<if test="title != null">
-				and title_ like '%' #{title} '%'
+				and sni.title_ like '%' #{title} '%'
 			</if>
 			<if test="search != null">
-				and title_ like '%' #{search} '%'
+				and sni.title_ like '%' #{search} '%'
+			</if>
+			<if test="subjectId != null">
+				and find_in_set(#{subjectId},sni.subject_id_list_)
 			</if>
 			<if test="clientName != 'manage'">
 				<choose>
 					<when test="memo != null and memo != ''">
-						and memo_ = #{memo}
+						and sni.memo_ = #{memo}
 					</when>
 					<otherwise>
-						and (memo_ is null or memo_ = '')
+						and (sni.memo_ is null or sni.memo_ = '')
 					</otherwise>
 				</choose>
 			</if>
@@ -75,8 +80,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_,video_cover_image_,type_,online_time_,offline_time_,sub_type_,status_,create_time_,update_time_,link_url_,href_target_,order_,del_flag_,memo_,tenant_id_,attribute1_,attribute2_)
-		VALUES(#{id},#{title},#{content},#{coverImage},#{videoCoverImage},#{type},#{onlineTime},#{offlineTime},#{subType},#{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),now(),#{linkUrl},#{hrefTarget},#{order},0,#{memo},#{tenantId},#{attribute1},#{attribute2})
+		INSERT INTO sys_news_information (id_,title_,content_,cover_image_,video_cover_image_,type_,online_time_,offline_time_,sub_type_,status_,create_time_,update_time_,link_url_,href_target_,order_,del_flag_,memo_,tenant_id_,attribute1_,attribute2_,subject_id_list_)
+		VALUES(#{id},#{title},#{content},#{coverImage},#{videoCoverImage},#{type},#{onlineTime},#{offlineTime},#{subType},#{status, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},now(),now(),#{linkUrl},#{hrefTarget},#{order},0,#{memo},#{tenantId},#{attribute1},#{attribute2},#{subjectIdList})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -137,6 +142,9 @@
 			<if test="attribute2 != null">
 				attribute2_ = #{attribute2},
 			</if>
+			<if test="subjectIdList != null">
+				subject_id_list_ = #{subjectIdList},
+			</if>
 		</set>
 		WHERE id_ = #{id}
 	</update>
@@ -148,15 +156,16 @@
 	
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="SysNewsInformation" parameterType="map">
-		SELECT * FROM sys_news_information
+		SELECT sni.*,GROUP_CONCAT(s.name_) subject_name_ FROM sys_news_information sni left join subject s on find_in_set(s.id_,sni.subject_id_list_)
 		<include refid="queryCondition" />
-		order by status_ desc,order_ desc,update_time_ desc
+		group by sni.id_
+		order by sni.status_ desc,sni.order_ desc,sni.update_time_ desc
 		<include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM sys_news_information
+		SELECT COUNT(sni.id_) FROM sys_news_information sni
 		<include refid="queryCondition" />
 	</select>
 	
@@ -177,69 +186,75 @@
 	<!-- 分页查询 -->
 	<select id="queryHomePage" resultMap="SysNewsInformation"
 		parameterType="map">
-		SELECT * FROM sys_news_information where del_flag_=0
+		SELECT sni.*,GROUP_CONCAT(s.name_) subject_name_ FROM sys_news_information sni where sni.del_flag_=0
 		<if test="type != null">
-			and type_ = #{type}
+			and sni.type_ = #{type}
 		</if>
 		<if test="subType != null">
-			and sub_type_ = #{subType}
+			and sni.sub_type_ = #{subType}
 		</if>
 		<if test="status != null">
-			and status_ = #{status,
+			and sni.status_ = #{status,
 			typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 		</if>
 		<if test="title != null">
-			and title_ like '%' #{title} '%'
+			and sni.title_ like '%' #{title} '%'
 		</if>
 		<if test="search != null">
-			and title_ like '%' #{search} '%'
+			and sni.title_ like '%' #{search} '%'
 		</if>
 		<if test="tenantId != null">
-			and tenant_id_ = #{tenantId}
+			and sni.tenant_id_ = #{tenantId}
 		</if>
+			<if test="subjectId != null">
+				and find_in_set(#{subjectId},sni.subject_id_list_)
+			</if>
 		<if test="clientName != 'manage'">
 			<choose>
 				<when test="memo != null and memo != ''">
-					and memo_ = #{memo}
+					and sni.memo_ = #{memo}
 				</when>
 				<otherwise>
-					and (memo_ is null or memo_ = '')
+					and (sni.memo_ is null or sni.memo_ = '')
 				</otherwise>
 			</choose>
 		</if>
-		order by status_ desc,order_ desc,update_time_ desc
+		order by sni.status_ desc,sni.order_ desc,sni.update_time_ desc
 		<include refid="global.limit" />
 	</select>
 
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryHomeCount" resultType="int">
-		SELECT COUNT(*) FROM sys_news_information where del_flag_=0
+		SELECT COUNT(sni.id_) FROM sys_news_information sni where sni.del_flag_=0
 		<if test="type != null">
-			and type_ = #{type}
+			and sni.type_ = #{type}
 		</if>
 		<if test="subType != null">
-			and sub_type_ = #{subType}
+			and sni.sub_type_ = #{subType}
 		</if>
 		<if test="status != null">
-			and status_ = #{status,
+			and sni.status_ = #{status,
 			typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 		</if>
 		<if test="title != null">
-			and title_ like '%' #{title} '%'
+			and sni.title_ like '%' #{title} '%'
 		</if>
 		<if test="search != null">
-			and title_ like '%' #{search} '%'
+			and sni.title_ like '%' #{search} '%'
 		</if>
 		<if test="tenantId != null">
-			and tenant_id_ = #{tenantId}
+			and sni.tenant_id_ = #{tenantId}
 		</if>
+			<if test="subjectId != null">
+				and find_in_set(#{subjectId},sni.subject_id_list_)
+			</if>
 		<if test="clientName != 'manage'">
 			<choose>
 				<when test="memo != null and memo != ''">
-					and memo_ = #{memo}
+					and sni.memo_ = #{memo}
 				</when>
 				<otherwise>
-					and (memo_ is null or memo_ = '')
+					and (sni.memo_ is null or sni.memo_ = '')
 				</otherwise>
 			</choose>
 		</if>