通知公告

master
shaoyong 8 months ago
parent 136e05a4e6
commit f4703186e0

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

@ -61,10 +61,10 @@ public class SysNoticeGroupController extends BaseController {
/**
* -
*/
@RequiresPermissions("noticeGroup:noticeGroup:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(sysNoticeGroupService.selectSysNoticeGroupById(id));
public TableDataInfo getInfo(@PathVariable("id") String 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)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(sysNoticeGroupService.deleteSysNoticeGroupByIds(ids));
@PostMapping("/delNoticeGroup")
public AjaxResult delNoticeGroup(@RequestBody SysNoticeGroup sysNoticeGroup) {
return toAjax(sysNoticeGroupService.deleteByNoticeId(sysNoticeGroup));
}
@PostMapping("/teamBind")

@ -19,7 +19,7 @@ public interface SysNoticeGroupMapper {
* @param id -
* @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 getSerialNumber();
public List<SysNoticeGroup> validData(SysNoticeGroup sysNoticeGroup);
public int deleteByNotice(SysNoticeGroup sysNoticeGroup);
}

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

@ -36,10 +36,10 @@
</where>
</select>
<select id="selectSysNoticeGroupById" parameterType="Long"
<select id="selectByNoticeId" parameterType="String"
resultMap="SysNoticeGroupResult">
<include refid="selectSysNoticeGroupVo"/>
where id = #{id}
where del_flag = '0' and notice_id = #{id}
</select>
<insert id="insertSysNoticeGroup" parameterType="SysNoticeGroup">
@ -125,19 +125,31 @@
</update>
<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 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=")">
#{id}
</foreach>
</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 count(0)+1
from sys_notice_group
where
CONVERT(varchar(10),create_time, 120) = CONVERT(varchar(10),GETDATE(), 120)
</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>

Loading…
Cancel
Save