jsk BUG问题修正

This commit is contained in:
skjia 2025-06-13 13:26:35 +08:00
parent 7284465c60
commit 57cb2301b7
6 changed files with 56 additions and 3 deletions

View File

@ -44,6 +44,8 @@ public class HealthPopularArticleController extends BaseController {
//@RequiresPermissions("health:article:list")
@GetMapping("/list")
public TableDataInfo list(HealthPopularArticle healthPopularArticle) {
System.out.println("getStartDate===="+healthPopularArticle.getStartDate());
System.out.println("getEndDate===="+healthPopularArticle.getEndDate());
startPage();
List<HealthPopularArticle> list = healthPopularArticleService.selectHealthPopularArticleList(healthPopularArticle);
return getDataTable(list);
@ -116,4 +118,20 @@ public class HealthPopularArticleController extends BaseController {
public AjaxResult remove(@PathVariable Long[] articleIds) {
return toAjax(healthPopularArticleService.deleteHealthPopularArticleByArticleIds(articleIds));
}
/**
* 修改营养科普
*/
@ApiOperation(value = "修改营养科普发布状态")
//@PreventRepeatSubmit
//@RequiresPermissions("health:article:edit")
@SysLog(title = "营养科普", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改营养科普发布状态")
@PostMapping("/editState")
public AjaxResult editState(@RequestBody HealthPopularArticle healthPopularArticle) {
try {
return toAjax(healthPopularArticleService.updateHealthPopularArticleState(healthPopularArticle));
} catch (Exception e) {
return error(e.getMessage());
}
}
}

View File

@ -1,6 +1,8 @@
package com.bonus.canteen.core.health.domain;
import java.util.Date;
import com.bonus.canteen.core.common.utils.FileUrlUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
@ -78,4 +80,9 @@ public class HealthPopularArticle extends BaseEntity {
private String chronicId;
private String chronicName;
private String chronicNames;
private String startDate;
private String endDate;
public String getCoverPhoto() {
return FileUrlUtil.getFileUrl(this.coverPhoto);
}
}

View File

@ -44,7 +44,7 @@ public interface HealthPopularArticleMapper {
* @return 结果
*/
public int updateHealthPopularArticle(HealthPopularArticle healthPopularArticle);
public int updateHealthPopularArticleState(HealthPopularArticle healthPopularArticle);
/**
* 删除营养科普
*

View File

@ -25,7 +25,7 @@ public interface IHealthPopularArticleService {
* @return 营养科普集合
*/
public List<HealthPopularArticle> selectHealthPopularArticleList(HealthPopularArticle healthPopularArticle);
/**
* 新增营养科普
*
@ -42,6 +42,7 @@ public interface IHealthPopularArticleService {
*/
public int updateHealthPopularArticle(HealthPopularArticle healthPopularArticle);
public int updateHealthPopularArticleState(HealthPopularArticle healthPopularArticle);
/**
* 批量删除营养科普
*

View File

@ -102,6 +102,17 @@ public class HealthPopularArticleServiceImpl implements IHealthPopularArticleSer
}
}
@Override
public int updateHealthPopularArticleState(HealthPopularArticle healthPopularArticle) {
healthPopularArticle.setUpdateTime(DateUtils.getNowDate());
healthPopularArticle.setPushTime(DateUtils.getNowDate());
try {
return healthPopularArticleMapper.updateHealthPopularArticleState(healthPopularArticle);
} catch (Exception e) {
throw new ServiceException(e.getMessage());
}
}
/**
* 批量删除营养科普
*

View File

@ -26,6 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select id="selectHealthPopularArticleList" parameterType="com.bonus.canteen.core.health.domain.HealthPopularArticle" resultMap="HealthPopularArticleResult">
select * from (
select
aa.article_id,
aa.article_title,
@ -47,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from health_popular_article aa
left join health_popular_article_chronic bb on aa.article_id=bb.article_id
<where>
<if test="articleTitle != null and articleTitle != ''"> and aa.article_title = #{articleTitle}</if>
<if test="articleTitle != null and articleTitle != ''"> and aa.article_title like concat('%', #{articleTitle}, '%')</if>
<if test="coverPhoto != null and coverPhoto != ''"> and aa.cover_photo = #{coverPhoto}</if>
<if test="articleType != null "> and aa.article_type = #{articleType}</if>
<if test="articleContent != null and articleContent != ''"> and aa.article_content = #{articleContent}</if>
@ -56,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="hits != null "> and aa.hits = #{hits}</if>
<if test="ifPushed != null "> and aa.if_pushed = #{ifPushed}</if>
<if test="pushTime != null "> and aa.push_time = #{pushTime}</if>
<if test="startDate != null "> and substring(aa.create_time,1,10) >= #{startDate} and #{endDate}>= substring(aa.create_time,1,10)</if>
<if test="summary != null and summary != ''"> and aa.summary = #{summary}</if>
</where>
group by aa.article_id,
@ -73,6 +75,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
aa.create_time,
aa.update_by,
aa.update_time
) a
<where>
<if test="chronicIds != null and chronicIds != ''"> and a.chronic_ids like concat('%', #{chronicIds}, '%')</if>
</where>
order by a.create_time desc
</select>
<select id="selectHealthPopularArticleByArticleId" parameterType="Long" resultMap="HealthPopularArticleResult">
@ -157,4 +164,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(#{entity.articleId}, #{entity.chronicId}, #{entity.chronicName})
</foreach>
</insert>
<update id="updateHealthPopularArticleState" parameterType="com.bonus.canteen.core.health.domain.HealthPopularArticle">
update health_popular_article
<trim prefix="SET" suffixOverrides=",">
<if test="ifPushed != null">if_pushed = #{ifPushed},</if>
<if test="pushTime != null">push_time = #{pushTime},</if>
</trim>
where article_id = #{articleId}
</update>
</mapper>