通知公告

master
shaoyong 8 months ago
parent 136e05a4e6
commit f4703186e0

@ -17,7 +17,7 @@ public class SysNoticeGroup extends BaseEntity {
/** /**
* ID * ID
*/ */
private Long id; private String id;
/** /**
* *
@ -46,11 +46,11 @@ public class SysNoticeGroup extends BaseEntity {
private String[] groupNames; private String[] groupNames;
public void setId(Long id) { public void setId(String id) {
this.id = id; this.id = id;
} }
public Long getId() { public String getId() {
return id; return id;
} }

@ -61,10 +61,10 @@ public class SysNoticeGroupController extends BaseController {
/** /**
* - * -
*/ */
@RequiresPermissions("noticeGroup:noticeGroup:query")
@GetMapping(value = "/{id}") @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) { public TableDataInfo getInfo(@PathVariable("id") String id) {
return success(sysNoticeGroupService.selectSysNoticeGroupById(id)); List<SysNoticeGroup> list = sysNoticeGroupService.selectByNoticeId(id);
return getDataTable(list);
} }
/** /**
@ -90,11 +90,10 @@ public class SysNoticeGroupController extends BaseController {
/** /**
* - * -
*/ */
@RequiresPermissions("noticeGroup:noticeGroup:remove")
@Log(title = "通知公告-班组", businessType = BusinessType.DELETE) @PostMapping("/delNoticeGroup")
@DeleteMapping("/{ids}") public AjaxResult delNoticeGroup(@RequestBody SysNoticeGroup sysNoticeGroup) {
public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(sysNoticeGroupService.deleteByNoticeId(sysNoticeGroup));
return toAjax(sysNoticeGroupService.deleteSysNoticeGroupByIds(ids));
} }
@PostMapping("/teamBind") @PostMapping("/teamBind")

@ -19,7 +19,7 @@ public interface SysNoticeGroupMapper {
* @param id - * @param id -
* @return - * @return -
*/ */
public SysNoticeGroup selectSysNoticeGroupById(Long id); public List<SysNoticeGroup> selectByNoticeId(String id);
/** /**
* - * -
@ -62,4 +62,8 @@ public interface SysNoticeGroupMapper {
public int deleteSysNoticeGroupByIds(Long[] ids); public int deleteSysNoticeGroupByIds(Long[] ids);
public int getSerialNumber(); public int getSerialNumber();
public List<SysNoticeGroup> validData(SysNoticeGroup sysNoticeGroup);
public int deleteByNotice(SysNoticeGroup sysNoticeGroup);
} }

@ -17,7 +17,7 @@ public interface ISysNoticeGroupService {
* @param id - * @param id -
* @return - * @return -
*/ */
public SysNoticeGroup selectSysNoticeGroupById(Long id); public List<SysNoticeGroup> selectByNoticeId(String id);
/** /**
* - * -
@ -59,4 +59,7 @@ public interface ISysNoticeGroupService {
*/ */
public int deleteSysNoticeGroupById(Long id); public int deleteSysNoticeGroupById(Long id);
public List<SysNoticeGroup> validData(SysNoticeGroup sysNoticeGroup);
public int deleteByNoticeId(SysNoticeGroup sysNoticeGroup);
} }

@ -4,7 +4,6 @@ import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.security.utils.SecurityUtils; import com.op.common.security.utils.SecurityUtils;
import com.op.system.api.domain.SysNoticeGroup; import com.op.system.api.domain.SysNoticeGroup;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -32,8 +31,9 @@ public class SysNoticeGroupServiceImpl implements ISysNoticeGroupService {
* @return - * @return -
*/ */
@Override @Override
public SysNoticeGroup selectSysNoticeGroupById(Long id) { @DS("#header.poolName")
return sysNoticeGroupMapper.selectSysNoticeGroupById(id); public List<SysNoticeGroup> selectByNoticeId(String id) {
return sysNoticeGroupMapper.selectByNoticeId(id);
} }
/** /**
@ -57,17 +57,19 @@ public class SysNoticeGroupServiceImpl implements ISysNoticeGroupService {
@DS("#header.poolName") @DS("#header.poolName")
public int insertSysNoticeGroup(SysNoticeGroup sysNoticeGroup) { public int insertSysNoticeGroup(SysNoticeGroup sysNoticeGroup) {
String[] groupCodes = sysNoticeGroup.getGroupCodes(); String[] groupCodes = sysNoticeGroup.getGroupCodes();
if (groupCodes == null){ if (groupCodes == null) {
return 0; return 0;
} }
String[] groupNames = sysNoticeGroup.getGroupNames(); String[] groupNames = sysNoticeGroup.getGroupNames();
Long noticeId = sysNoticeGroup.getNoticeId(); Long noticeId = sysNoticeGroup.getNoticeId();
String username = SecurityUtils.getUsername(); String username = SecurityUtils.getUsername();
// 绑定前先清空旧数据
sysNoticeGroupMapper.deleteByNotice(sysNoticeGroup);
Long serialId = getSerialId(); Long serialId = getSerialId();
int count = 0; int count = 0;
for (int i = 0; i < groupCodes.length; i++) { for (int i = 0; i < groupCodes.length; i++) {
sysNoticeGroup.setId(serialId++); sysNoticeGroup.setId(String.valueOf(serialId++));
sysNoticeGroup.setNoticeId(noticeId); sysNoticeGroup.setNoticeId(noticeId);
sysNoticeGroup.setGroupCode(groupCodes[i]); sysNoticeGroup.setGroupCode(groupCodes[i]);
sysNoticeGroup.setGroupName(groupNames[i]); sysNoticeGroup.setGroupName(groupNames[i]);
@ -112,6 +114,17 @@ public class SysNoticeGroupServiceImpl implements ISysNoticeGroupService {
return sysNoticeGroupMapper.deleteSysNoticeGroupById(id); return sysNoticeGroupMapper.deleteSysNoticeGroupById(id);
} }
@Override
public List<SysNoticeGroup> validData(SysNoticeGroup sysNoticeGroup) {
return sysNoticeGroupMapper.validData(sysNoticeGroup);
}
@Override
@DS("#header.poolName")
public int deleteByNoticeId(SysNoticeGroup sysNoticeGroup) {
return sysNoticeGroupMapper.deleteByNotice(sysNoticeGroup);
}
@DS("#header.poolName") @DS("#header.poolName")
private Long getSerialId() { private Long getSerialId() {
String dateToStr = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate()); String dateToStr = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate());

@ -36,10 +36,10 @@
</where> </where>
</select> </select>
<select id="selectSysNoticeGroupById" parameterType="Long" <select id="selectByNoticeId" parameterType="String"
resultMap="SysNoticeGroupResult"> resultMap="SysNoticeGroupResult">
<include refid="selectSysNoticeGroupVo"/> <include refid="selectSysNoticeGroupVo"/>
where id = #{id} where del_flag = '0' and notice_id = #{id}
</select> </select>
<insert id="insertSysNoticeGroup" parameterType="SysNoticeGroup"> <insert id="insertSysNoticeGroup" parameterType="SysNoticeGroup">
@ -125,19 +125,31 @@
</update> </update>
<delete id="deleteSysNoticeGroupById" parameterType="Long"> <delete id="deleteSysNoticeGroupById" parameterType="Long">
delete from sys_notice_group where id = #{id} update sys_notice_group set del_flag = '1' where id = #{id}
</delete> </delete>
<delete id="deleteSysNoticeGroupByIds" parameterType="String"> <delete id="deleteSysNoticeGroupByIds" parameterType="String">
delete from sys_notice_group where id in update sys_notice_group set del_flag = "1" where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<select id="validData" parameterType="SysNoticeGroup" resultMap="SysNoticeGroupResult">
<include refid="selectSysNoticeGroupVo"/>
WHERE del_flag = 0 and notice_id = #{noticeId} and group_code = #{groupCode}
</select>
<select id="getSerialNumber" resultType="java.lang.Integer"> <select id="getSerialNumber" resultType="java.lang.Integer">
select count(0)+1 select count(0)+1
from sys_notice_group from sys_notice_group
where where
CONVERT(varchar(10),create_time, 120) = CONVERT(varchar(10),GETDATE(), 120) CONVERT(varchar(10),create_time, 120) = CONVERT(varchar(10),GETDATE(), 120)
</select> </select>
<delete id="deleteByNotice" parameterType="String">
update sys_notice_group set del_flag = '1' where notice_id = #{noticeId} and group_code in
<foreach item="groupCode" collection="groupCodes" open="(" separator="," close=")">
#{groupCode}
</foreach>
</delete>
</mapper> </mapper>

Loading…
Cancel
Save