政策启用禁用功能开发

This commit is contained in:
冯辉
2026-06-28 02:13:05 +08:00
parent a9cb3adb20
commit 339b0bc8cb
8 changed files with 49 additions and 6 deletions

View File

@@ -107,6 +107,17 @@ public class CmsPolicyInfoController extends BaseController {
return toAjax(policyInfoService.deleteByIds(ids));
}
/**
* 更新政策状态(启用/禁用)
*/
@PreAuthorize("@ss.hasPermi('cms:policyInfo:edit')")
@Log(title = "政策信息", businessType = BusinessType.UPDATE)
@ApiOperation("更新政策状态")
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestParam Long id, @RequestParam String status) {
return toAjax(policyInfoService.updateStatus(id, status));
}
/**
* 上传政策文件
*/

View File

@@ -67,4 +67,7 @@ public class PolicyInfo extends BaseEntity {
//标签
/** 1-大龄人员;2-低保人员;3-残疾人员;4-失地农名或联队职工;5-防止返贫;6-未就业大中专毕业生;7-退役军人;8-长期失业人员;9-城镇零就业家庭成员10.刑满释放人员 **/
private String policyTag;
@ApiModelProperty("状态0启用 1禁用")
private String status;
}

View File

@@ -28,5 +28,8 @@ public class PolicyInfoQuery {
@ApiModelProperty("标签")
private String policyTag;
@ApiModelProperty("状态0启用 1禁用空表示不过滤")
private String status;
private List<String> policyTags;
}

View File

@@ -42,4 +42,9 @@ public interface PolicyInfoMapper {
* 批量删除政策
*/
int deletePolicyInfoByIds(@Param("ids") Long[] ids);
/**
* 更新政策状态(启用/禁用)
*/
int updateStatus(@Param("id") Long id, @Param("status") String status);
}

View File

@@ -54,4 +54,9 @@ public interface IPolicyInfoService {
* 批量删除政策
*/
int deleteByIds(Long[] ids);
/**
* 更新政策状态(启用/禁用)
*/
int updateStatus(Long id, String status);
}

View File

@@ -36,6 +36,8 @@ public class PolicyInfoServiceImpl implements IPolicyInfoService {
List<String> policyTags = Arrays.asList(query.getPolicyTag().split(","));
query.setPolicyTags(policyTags);
}
// 仅返回启用状态的政策给前端
query.setStatus("0");
List<PolicyInfo> list = policyInfoMapper.selectPolicyInfoList(query);
PageInfo<PolicyInfo> pageInfo = new PageInfo<>(list);
@@ -94,4 +96,9 @@ public class PolicyInfoServiceImpl implements IPolicyInfoService {
public int deleteByIds(Long[] ids) {
return policyInfoMapper.deletePolicyInfoByIds(ids);
}
@Override
public int updateStatus(Long id, String status) {
return policyInfoMapper.updateStatus(id, status);
}
}

View File

@@ -24,17 +24,18 @@
<result property="delFlag" column="del_flag"/>
<result property="remark" column="remark"/>
<result property="policyTag" column="policy_tag"/>
<result property="status" column="status"/>
</resultMap>
<sql id="selectPolicyInfoListVo">
select id, zcmc, zclx, zc_level, source_unit, accept_unit, publish_time, view_num, create_time, policy_tag
select id, zcmc, zclx, zc_level, source_unit, accept_unit, publish_time, view_num, create_time, policy_tag, status
from policy_info
</sql>
<sql id="selectPolicyInfoDetailVo">
select id, zcmc, zclx, zc_level, source_unit, accept_unit, publish_time,
zc_content, subsidy_standard, handle_channel, apply_condition,
file_url, file_name, view_num, create_by, create_time, update_by, update_time, remark, policy_tag
file_url, file_name, view_num, create_by, create_time, update_by, update_time, remark, policy_tag, status
from policy_info
</sql>
@@ -53,6 +54,9 @@
</foreach>
]
</if>
<if test="query.status != null and query.status != ''">
and (status IS NULL or status = #{query.status})
</if>
</where>
order by publish_time desc, create_time desc
</select>
@@ -70,11 +74,11 @@
insert into policy_info (
zcmc, zclx, zc_level, source_unit, accept_unit, publish_time,
zc_content, subsidy_standard, handle_channel, apply_condition,
file_url, file_name, view_num, create_by, create_time, del_flag, remark, policy_tag
file_url, file_name, view_num, create_by, create_time, del_flag, remark, policy_tag, status
) values (
#{zcmc}, #{zclx}, #{zcLevel}, #{sourceUnit}, #{acceptUnit}, #{publishTime},
#{zcContent}, #{subsidyStandard}, #{handleChannel}, #{applyCondition},
#{fileUrl}, #{fileName}, #{viewNum}, #{createBy}, now(), '0', #{remark}, #{policyTag}
#{fileUrl}, #{fileName}, #{viewNum}, #{createBy}, now(), '0', #{remark}, #{policyTag}, #{status}
)
</insert>
@@ -95,6 +99,7 @@
<if test="fileName != null">file_name = #{fileName},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="policyTag != null">policy_tag = #{policyTag},</if>
<if test="status != null">status = #{status},</if>
update_by = #{updateBy},
update_time = now()
</set>
@@ -109,4 +114,8 @@
</foreach>
</update>
<update id="updateStatus">
update policy_info set status = #{status} where id = #{id}
</update>
</mapper>

View File

@@ -114,7 +114,7 @@ public class SecurityConfig
requests.antMatchers("/sso/pc/code/login","/sso/pcms/code/login","/sso/token/login","/sso/code/login","/login","/loginoss",
"/register", "/captchaImage","/app/login","/websocket/**","/ws/**","/speech-recognition","/speech-synthesis",
"/cms/company/listPage","/cms/appUser/noTmlist","/getTjmhToken","/getWwTjmhToken","/getWwTjmHlwToken",
"/cms/notice/noticTotal","/cms/jobApply/zphApply","/cms/jobApply/zphApplyAgree","/cms/policyInfo/list",
"/cms/notice/noticTotal","/cms/jobApply/zphApply","/cms/jobApply/zphApplyAgree",
"/cms/policyInfo/detail","/cms/industry/treeselect").permitAll()
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()