Browse Source

其他新闻

fllmoyu 4 years ago
parent
commit
147afa134f

+ 2 - 0
common/src/main/java/com/jpsoft/enterprise/modules/base/entity/NewsInfo.java

@@ -45,4 +45,6 @@ public class NewsInfo {
     private Date updateTime;
     private Date updateTime;
     @ApiModelProperty(value = "是否删除")
     @ApiModelProperty(value = "是否删除")
     private Boolean delFlag= false;
     private Boolean delFlag= false;
+    @ApiModelProperty(value = "是否主页展示(轮播图)")
+    private Boolean topFlag = false;
 }
 }

+ 18 - 13
common/src/main/java/com/jpsoft/enterprise/modules/base/entity/NewsType.java

@@ -4,6 +4,7 @@ import java.io.Serializable;
 import java.util.Date;
 import java.util.Date;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
+
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
@@ -11,29 +12,33 @@ import io.swagger.annotations.ApiModel;
 import lombok.Data;
 import lombok.Data;
 
 
 /**
 /**
-  描述:base_news_type的实体类
+ * 描述:base_news_type的实体类
  */
  */
 @Data
 @Data
 @ApiModel(value = "base_news_type的实体类")
 @ApiModel(value = "base_news_type的实体类")
 public class NewsType {
 public class NewsType {
-        @ApiModelProperty(value = "")
+    @ApiModelProperty(value = "")
     private String id;
     private String id;
-        @ApiModelProperty(value = "类型名称")
+    @ApiModelProperty(value = "类型名称")
     private String name;
     private String name;
-        @ApiModelProperty(value = "父id")
+    @ApiModelProperty(value = "父id")
     private String parentId;
     private String parentId;
-        @ApiModelProperty(value = "创建人")
+    @ApiModelProperty(value = "创建人")
     private String createBy;
     private String createBy;
-        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
-	    @ApiModelProperty(value = "创建时间")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "创建时间")
     private Date createTime;
     private Date createTime;
-        @ApiModelProperty(value = "更新人")
+    @ApiModelProperty(value = "更新人")
     private String updateBy;
     private String updateBy;
-        @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone ="GMT+8")
-	    @ApiModelProperty(value = "更新时间")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "更新时间")
     private Date updateTime;
     private Date updateTime;
-        @ApiModelProperty(value = "是否删除")
+    @ApiModelProperty(value = "是否删除")
     private Boolean delFlag;
     private Boolean delFlag;
+    @ApiModelProperty(value = "代码")
+    private String code;
+    @ApiModelProperty(value = "新闻中心是否展示")
+    private Boolean showFlag;
 }
 }

+ 15 - 1
common/src/main/resources/mapper/base/NewsInfo.xml

@@ -16,6 +16,7 @@
 			<result property="updateBy" column="update_by" />
 			<result property="updateBy" column="update_by" />
 			<result property="updateTime" column="update_time" />
 			<result property="updateTime" column="update_time" />
 			<result property="delFlag" column="del_flag" />
 			<result property="delFlag" column="del_flag" />
+			<result property="topFlag" column="top_flag"/>
 			</resultMap>
 			</resultMap>
 	<insert id="insert" parameterType="com.jpsoft.enterprise.modules.base.entity.NewsInfo">
 	<insert id="insert" parameterType="com.jpsoft.enterprise.modules.base.entity.NewsInfo">
 	<!--
 	<!--
@@ -25,7 +26,7 @@
 	-->
 	-->
 	<![CDATA[
 	<![CDATA[
 		insert into base_news_info
 		insert into base_news_info
-	    (id_,news_type_id,company_id,title_,content_,reader_num,pic_url,create_by,create_time,update_by,update_time,del_flag)
+	    (id_,news_type_id,company_id,title_,content_,reader_num,pic_url,create_by,create_time,update_by,update_time,del_flag,top_flag)
 		values
 		values
 		(
 		(
 #{id,jdbcType=VARCHAR}
 #{id,jdbcType=VARCHAR}
@@ -40,6 +41,7 @@
 ,#{updateBy,jdbcType=VARCHAR}
 ,#{updateBy,jdbcType=VARCHAR}
 ,#{updateTime,jdbcType= TIMESTAMP }
 ,#{updateTime,jdbcType= TIMESTAMP }
 ,#{delFlag,jdbcType= NUMERIC }
 ,#{delFlag,jdbcType= NUMERIC }
+,#{topFlag,jdbcType=NUMERIC}
 		)
 		)
 	]]>
 	]]>
 	</insert>
 	</insert>
@@ -82,6 +84,9 @@
 				<if test="delFlag!=null">
 				<if test="delFlag!=null">
 		del_flag=#{delFlag,jdbcType= NUMERIC },
 		del_flag=#{delFlag,jdbcType= NUMERIC },
 		</if>
 		</if>
+			<if test="topFlag!=null">
+				top_flag=#{topFlag,jdbcType=BOOLEAN },
+			</if>
 		</set>
 		</set>
 	where id_=#{id}
 	where id_=#{id}
 	</update>
 	</update>
@@ -117,6 +122,15 @@
 			<if test="searchParams.companyId != null">
 			<if test="searchParams.companyId != null">
 				and a.company_id = #{searchParams.companyId}
 				and a.company_id = #{searchParams.companyId}
 			</if>
 			</if>
+			<if test="searchParams.topFlag != null">
+				and a.top_flag = #{searchParams.topFlag}
+			</if>
+            <if test="searchParams.showFlag != null">
+                and b.show_flag = #{searchParams.showFlag}
+            </if>
+            <if test="searchParams.code != null">
+                and b.code_ = #{searchParams.code}
+            </if>
 		</where>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">
 	        ${sort.name} ${sort.order}
 	        ${sort.name} ${sort.order}

+ 12 - 3
common/src/main/resources/mapper/base/NewsType.xml

@@ -12,6 +12,8 @@
 			<result property="updateBy" column="update_by" />
 			<result property="updateBy" column="update_by" />
 			<result property="updateTime" column="update_time" />
 			<result property="updateTime" column="update_time" />
 			<result property="delFlag" column="del_flag" />
 			<result property="delFlag" column="del_flag" />
+			<result property="code" column="code_"/>
+			<result property="showFlag" column="show_flag"/>
 			</resultMap>
 			</resultMap>
 	<insert id="insert" parameterType="com.jpsoft.enterprise.modules.base.entity.NewsType">
 	<insert id="insert" parameterType="com.jpsoft.enterprise.modules.base.entity.NewsType">
 	<!--
 	<!--
@@ -21,7 +23,7 @@
 	-->
 	-->
 	<![CDATA[
 	<![CDATA[
 		insert into base_news_type
 		insert into base_news_type
-	    (id_,name_,parent_id,create_by,create_time,update_by,update_time,del_flag)
+	    (id_,name_,parent_id,create_by,create_time,update_by,update_time,del_flag,code_,show_flag)
 		values
 		values
 		(
 		(
 #{id,jdbcType=VARCHAR}
 #{id,jdbcType=VARCHAR}
@@ -32,6 +34,8 @@
 ,#{updateBy,jdbcType=VARCHAR}
 ,#{updateBy,jdbcType=VARCHAR}
 ,#{updateTime,jdbcType= TIMESTAMP }
 ,#{updateTime,jdbcType= TIMESTAMP }
 ,#{delFlag,jdbcType= NUMERIC }
 ,#{delFlag,jdbcType= NUMERIC }
+,#{code,jdbcType=VARCHAR}
+,#{showFlag,jdbcType=NUMERIC}
 		)
 		)
 	]]>
 	]]>
 	</insert>
 	</insert>
@@ -62,12 +66,17 @@
 				<if test="delFlag!=null">
 				<if test="delFlag!=null">
 		del_flag=#{delFlag,jdbcType= NUMERIC },
 		del_flag=#{delFlag,jdbcType= NUMERIC },
 		</if>
 		</if>
+			<if test="code!=null">
+				code_=#{code,jdbcType=VARCHAR },
+			</if>
+			<if test="showFlag!=null">
+				show_flag=#{showFlag,jdbcType=NUMERIC },
+			</if>
 		</set>
 		</set>
 	where id_=#{id}
 	where id_=#{id}
 	</update>
 	</update>
 	<select id="get" parameterType="string" resultMap="NewsTypeMap">
 	<select id="get" parameterType="string" resultMap="NewsTypeMap">
-		select
-id_,name_,parent_id,create_by,create_time,update_by,update_time,del_flag		from base_news_type where id_=#{0}
+		select * from base_news_type where id_=#{0}
 	</select>
 	</select>
 	<select id="exist" parameterType="string" resultType="int">
 	<select id="exist" parameterType="string" resultType="int">
 		select count(*) from base_news_type where id_=#{0}
 		select count(*) from base_news_type where id_=#{0}

+ 29 - 5
web/src/main/java/com/jpsoft/enterprise/modules/mobile/controller/NewsInfoApiController.java

@@ -94,9 +94,12 @@ public class NewsInfoApiController {
 
 
             if (newsTypeList.size()>0){
             if (newsTypeList.size()>0){
                 for (NewsType newsType : newsTypeList){
                 for (NewsType newsType : newsTypeList){
-                    NewsTypeDTO newsTypeDTO = new NewsTypeDTO();
-                    BeanUtils.copyProperties(newsType,newsTypeDTO);
-                    list.add(newsTypeDTO);
+                    if (newsType.getShowFlag()){
+                        NewsTypeDTO newsTypeDTO = new NewsTypeDTO();
+                        BeanUtils.copyProperties(newsType,newsTypeDTO);
+                        list.add(newsTypeDTO);
+                    }
+
                 }
                 }
             }
             }
             map.put("list",list);
             map.put("list",list);
@@ -117,9 +120,11 @@ public class NewsInfoApiController {
     @ApiOperation(value = "新闻列表(公开接口)")
     @ApiOperation(value = "新闻列表(公开接口)")
     @ApiImplicitParams({
     @ApiImplicitParams({
             @ApiImplicitParam(name = "id", value = "目录id", required = false, paramType = "form"),
             @ApiImplicitParam(name = "id", value = "目录id", required = false, paramType = "form"),
-            @ApiImplicitParam(name = "companyId", value = "公司id", required = false, paramType = "form")
+            @ApiImplicitParam(name = "companyId", value = "公司id", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "topFlag", value = "是否主页轮播图", required = false, paramType = "form"),
+            @ApiImplicitParam(name = "code",value = "代码",required = false,paramType = "form")
     })
     })
-    public MessageResult<Map> newsList(String id,String companyId,@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,@RequestParam(value="pageSize",defaultValue="10") int pageSize) {
+    public MessageResult<Map> newsList(String id,String companyId,String topFlag,String code,@RequestParam(value="pageIndex",defaultValue="1") int pageIndex,@RequestParam(value="pageSize",defaultValue="10") int pageSize) {
         MessageResult<Map> messageResult = new MessageResult<>();
         MessageResult<Map> messageResult = new MessageResult<>();
 
 
         try {
         try {
@@ -138,6 +143,17 @@ public class NewsInfoApiController {
                 searchParams.put("companyId",companyId);
                 searchParams.put("companyId",companyId);
             }
             }
 
 
+            if (StringUtils.isNotBlank(topFlag)){
+                searchParams.put("topFlag",topFlag);
+            }
+
+            if (StringUtils.isNotBlank(code)){
+                searchParams.put("code",code);
+            }
+            searchParams.put("showFlag",1);
+
+
+
             List<Sort> sortList = new ArrayList<>();
             List<Sort> sortList = new ArrayList<>();
             sortList.add(new Sort("a.create_time","desc"));
             sortList.add(new Sort("a.create_time","desc"));
             Page<NewsInfo> page = newsInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
             Page<NewsInfo> page = newsInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
@@ -150,6 +166,14 @@ public class NewsInfoApiController {
                 if (StringUtils.isNotBlank(companyId)){
                 if (StringUtils.isNotBlank(companyId)){
                     searchParams2.put("companyId",companyId);
                     searchParams2.put("companyId",companyId);
                 }
                 }
+
+                if (StringUtils.isNotBlank(topFlag)){
+                    searchParams2.put("topFlag",topFlag);
+                }
+                if (StringUtils.isNotBlank(code)){
+                    searchParams2.put("code",code);
+                }
+                searchParams2.put("showFlag",1);
                 List<Sort> sortList2 = new ArrayList<>();
                 List<Sort> sortList2 = new ArrayList<>();
                 sortList.add(new Sort("a.create_time","desc"));
                 sortList.add(new Sort("a.create_time","desc"));
                 page = newsInfoService.pageSearch(searchParams2,pageIndex,pageSize,true,sortList2);
                 page = newsInfoService.pageSearch(searchParams2,pageIndex,pageSize,true,sortList2);