使用mybatis-flex重构“通知公告”模块代码

This commit is contained in:
dataprince 2023-09-15 11:47:16 +08:00
parent a2ec2b31e0
commit 4edd8fa101
10 changed files with 213 additions and 334 deletions

View File

@ -34,8 +34,7 @@ import com.ruoyi.system.service.ISysConfigService;
@RequiredArgsConstructor
@RestController
@RequestMapping("/system/config")
public class SysConfigController extends BaseController
{
public class SysConfigController extends BaseController {
@Resource
private ISysConfigService configService;
@ -44,8 +43,7 @@ public class SysConfigController extends BaseController
*/
@SaCheckPermission("system:config:list")
@GetMapping("/list")
public TableDataInfo list(SysConfigBo config)
{
public TableDataInfo<SysConfigVo> list(SysConfigBo config) {
return configService.selectConfigPage(config);
}
@ -55,8 +53,7 @@ public class SysConfigController extends BaseController
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
@SaCheckPermission("system:config:export")
@PostMapping("/export")
public void export(HttpServletResponse response, SysConfigBo config)
{
public void export(HttpServletResponse response, SysConfigBo config) {
List<SysConfigVo> list = configService.selectConfigList(config);
ExcelUtil.exportExcel(list, "参数数据", SysConfigVo.class, response);
}
@ -66,8 +63,7 @@ public class SysConfigController extends BaseController
*/
@SaCheckPermission("system:config:query")
@GetMapping(value = "/{configId}")
public R<SysConfigVo> getInfo(@PathVariable Long configId)
{
public R<SysConfigVo> getInfo(@PathVariable Long configId) {
return R.ok(configService.selectConfigById(configId));
}
@ -76,8 +72,7 @@ public class SysConfigController extends BaseController
*/
@SaCheckPermission("system:config:query")
@GetMapping(value = "/configKey/{configKey}")
public R<Void> getConfigKey(@PathVariable String configKey)
{
public R<Void> getConfigKey(@PathVariable String configKey) {
return R.ok(configService.selectConfigByKey(configKey));
}
@ -87,13 +82,14 @@ public class SysConfigController extends BaseController
@SaCheckPermission("system:config:add")
@Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping
public R<Void> add(@Validated @RequestBody SysConfigBo config)
{
if (!configService.checkConfigKeyUnique(config))
{
public R<Void> add(@Validated @RequestBody SysConfigBo config) {
if (!configService.checkConfigKeyUnique(config)) {
return R.fail("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
configService.insertConfig(config);
int insertedRows = configService.insertConfig(config);
if (insertedRows != 1) {
return R.fail("新增参数记录失败!");
}
return R.ok();
}
@ -103,13 +99,14 @@ public class SysConfigController extends BaseController
@SaCheckPermission("system:config:edit")
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PutMapping
public R<Void> edit(@Validated @RequestBody SysConfigBo config)
{
if (!configService.checkConfigKeyUnique(config))
{
public R<Void> edit(@Validated @RequestBody SysConfigBo config) {
if (!configService.checkConfigKeyUnique(config)) {
return R.fail("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
configService.updateConfig(config);
boolean updated = configService.updateConfig(config);
if (!updated) {
R.fail("修改参数'" + config.getConfigName() + "'失败!");
}
return R.ok();
}
@ -119,8 +116,7 @@ public class SysConfigController extends BaseController
@SaCheckPermission("system:config:remove")
@Log(title = "参数管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{configIds}")
public R<Void> remove(@PathVariable Long[] configIds)
{
public R<Void> remove(@PathVariable Long[] configIds) {
configService.deleteConfigByIds(configIds);
return R.ok();
}
@ -131,8 +127,7 @@ public class SysConfigController extends BaseController
@SaCheckPermission("system:config:remove")
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
@DeleteMapping("/refreshCache")
public R<Void> refreshCache()
{
public R<Void> refreshCache() {
configService.resetConfigCache();
return R.ok();
}

View File

@ -1,12 +1,12 @@
package com.ruoyi.system.controller.system;
import java.util.List;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.ruoyi.common.core.core.domain.R;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.orm.core.page.TableDataInfo;
import com.ruoyi.common.security.utils.LoginHelper;
import com.ruoyi.system.domain.bo.SysNoticeBo;
import com.ruoyi.system.domain.vo.SysNoticeVo;
import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
@ -19,8 +19,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.web.core.BaseController;
import com.ruoyi.common.core.core.domain.AjaxResult;
import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.service.ISysNoticeService;
/**
@ -42,11 +40,9 @@ public class SysNoticeController extends BaseController
*/
@SaCheckPermission("system:notice:list")
@GetMapping("/list")
public TableDataInfo list(SysNotice notice)
public TableDataInfo<SysNoticeVo> list(SysNoticeBo noticeBo)
{
startPage();
List<SysNotice> list = noticeService.selectNoticeList(notice);
return getDataTable(list);
return noticeService.selectConfigPage(noticeBo);
}
/**
@ -54,9 +50,9 @@ public class SysNoticeController extends BaseController
*/
@SaCheckPermission("system:notice:query")
@GetMapping(value = "/{noticeId}")
public AjaxResult getInfo(@PathVariable Long noticeId)
public R<SysNoticeVo> getInfo(@PathVariable Long noticeId)
{
return success(noticeService.selectNoticeById(noticeId));
return R.ok(noticeService.selectNoticeById(noticeId));
}
/**
@ -65,10 +61,13 @@ public class SysNoticeController extends BaseController
@SaCheckPermission("system:notice:add")
@Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysNotice notice)
public R<Void> add(@Validated @RequestBody SysNoticeBo noticeBo)
{
notice.setCreateBy(LoginHelper.getUserId());
return toAjax(noticeService.insertNotice(notice));
int insertedRows = noticeService.insertNotice(noticeBo);
if (insertedRows != 1) {
return R.fail("新增通知公告记录失败!");
}
return R.ok();
}
/**
@ -77,10 +76,13 @@ public class SysNoticeController extends BaseController
@SaCheckPermission("system:notice:edit")
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysNotice notice)
public R<Void> edit(@Validated @RequestBody SysNoticeBo noticeBo)
{
notice.setUpdateBy(LoginHelper.getUserId());
return toAjax(noticeService.updateNotice(notice));
Boolean updated = noticeService.updateNotice(noticeBo);
if (!updated) {
R.fail("修改通知公告记录失败!");
}
return R.ok();
}
/**
@ -89,8 +91,12 @@ public class SysNoticeController extends BaseController
@SaCheckPermission("system:notice:remove")
@Log(title = "通知公告", businessType = BusinessType.DELETE)
@DeleteMapping("/{noticeIds}")
public AjaxResult remove(@PathVariable Long[] noticeIds)
public R<Void> remove(@PathVariable Long[] noticeIds)
{
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
boolean deleted = noticeService.deleteNoticeByIds(noticeIds);
if (!deleted) {
R.fail("删除通知公告记录失败!");
}
return R.ok();
}
}

View File

@ -1,25 +1,24 @@
package com.ruoyi.system.domain;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.ruoyi.common.orm.core.domain.BaseEntity;
import com.ruoyi.common.core.xss.Xss;
import java.io.Serial;
/**
* 通知公告表 sys_notice
*
* @author ruoyi
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Table(value = "sys_notice")
public class SysNotice extends BaseEntity
{
@Serial
private static final long serialVersionUID = 1L;
/** 公告ID */
@Id(keyType = KeyType.Auto)
private Long noticeId;
/** 公告标题 */
@ -34,85 +33,6 @@ public class SysNotice extends BaseEntity
/** 公告状态0正常 1关闭 */
private String status;
/**
* 备注
*/
/** 备注 */
private String remark;
public Long getNoticeId()
{
return noticeId;
}
public void setNoticeId(Long noticeId)
{
this.noticeId = noticeId;
}
public void setNoticeTitle(String noticeTitle)
{
this.noticeTitle = noticeTitle;
}
@Xss(message = "公告标题不能包含脚本字符")
@NotBlank(message = "公告标题不能为空")
@Size(min = 0, max = 50, message = "公告标题不能超过50个字符")
public String getNoticeTitle()
{
return noticeTitle;
}
public void setNoticeType(String noticeType)
{
this.noticeType = noticeType;
}
public String getNoticeType()
{
return noticeType;
}
public void setNoticeContent(String noticeContent)
{
this.noticeContent = noticeContent;
}
public String getNoticeContent()
{
return noticeContent;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("noticeId", getNoticeId())
.append("noticeTitle", getNoticeTitle())
.append("noticeType", getNoticeType())
.append("noticeContent", getNoticeContent())
.append("status", getStatus())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}

View File

@ -18,7 +18,6 @@ import java.util.Date;
* @author Michelle.Chung
*/
@Data
@AutoMapper(target = SysNotice.class)
public class SysNoticeVo implements Serializable {
@Serial

View File

@ -1,60 +1,16 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.mybatisflex.core.BaseMapper;
import com.ruoyi.system.domain.SysNotice;
import org.apache.ibatis.annotations.Mapper;
/**
* 通知公告表 数据层
*
* @author ruoyi
* @author 数据小王子
*/
public interface SysNoticeMapper
@Mapper
public interface SysNoticeMapper extends BaseMapper<SysNotice>
{
/**
* 查询公告信息
*
* @param noticeId 公告ID
* @return 公告信息
*/
public SysNotice selectNoticeById(Long noticeId);
/**
* 查询公告列表
*
* @param notice 公告信息
* @return 公告集合
*/
public List<SysNotice> selectNoticeList(SysNotice notice);
/**
* 新增公告
*
* @param notice 公告信息
* @return 结果
*/
public int insertNotice(SysNotice notice);
/**
* 修改公告
*
* @param notice 公告信息
* @return 结果
*/
public int updateNotice(SysNotice notice);
/**
* 批量删除公告
*
* @param noticeId 公告ID
* @return 结果
*/
public int deleteNoticeById(Long noticeId);
/**
* 批量删除公告信息
*
* @param noticeIds 需要删除的公告ID
* @return 结果
*/
public int deleteNoticeByIds(Long[] noticeIds);
}

View File

@ -42,12 +42,18 @@ public interface ISysConfigService extends IService<SysConfig>
/**
* 查询参数配置列表
*
* @param config 参数配置信息
* @param configBo 参数配置信息
* @return 参数配置集合
*/
List<SysConfigVo> selectConfigList(SysConfigBo config);
List<SysConfigVo> selectConfigList(SysConfigBo configBo);
TableDataInfo<SysConfigVo> selectConfigPage(SysConfigBo config);
/**
* 分页查询参数配置列表
*
* @param configBo 参数配置信息
* @return 参数配置集合
*/
TableDataInfo<SysConfigVo> selectConfigPage(SysConfigBo configBo);
/**
* 新增参数配置
@ -60,10 +66,10 @@ public interface ISysConfigService extends IService<SysConfig>
/**
* 修改参数配置
*
* @param config 参数配置信息
* @param configBo 参数配置信息
* @return 结果
*/
boolean updateConfig(SysConfigBo config);
boolean updateConfig(SysConfigBo configBo);
/**
* 批量删除参数信息
@ -80,8 +86,8 @@ public interface ISysConfigService extends IService<SysConfig>
/**
* 校验参数键名是否唯一
*
* @param config 参数信息
* @param configBo 参数信息
* @return 结果
*/
boolean checkConfigKeyUnique(SysConfigBo config);
boolean checkConfigKeyUnique(SysConfigBo configBo);
}

View File

@ -1,14 +1,19 @@
package com.ruoyi.system.service;
import java.util.List;
import com.mybatisflex.core.service.IService;
import com.ruoyi.common.orm.core.page.TableDataInfo;
import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.domain.bo.SysNoticeBo;
import com.ruoyi.system.domain.vo.SysNoticeVo;
/**
* 公告 服务层
*
* @author ruoyi
* @author 数据小王子
*/
public interface ISysNoticeService
public interface ISysNoticeService extends IService<SysNotice>
{
/**
* 查询公告信息
@ -16,45 +21,45 @@ public interface ISysNoticeService
* @param noticeId 公告ID
* @return 公告信息
*/
public SysNotice selectNoticeById(Long noticeId);
SysNoticeVo selectNoticeById(Long noticeId);
/**
* 查询公告列表
*
* @param notice 公告信息
* @param noticeBo 公告信息
* @return 公告集合
*/
public List<SysNotice> selectNoticeList(SysNotice notice);
List<SysNoticeVo> selectNoticeList(SysNoticeBo noticeBo);
/**
* 分页查询公告列表
*
* @param noticeBo 公告信息
* @return 公告集合
*/
TableDataInfo<SysNoticeVo> selectConfigPage(SysNoticeBo noticeBo);
/**
* 新增公告
*
* @param notice 公告信息
* @return 结果
* @param noticeBo 公告信息
* @return 结果:受影响的行数
*/
public int insertNotice(SysNotice notice);
int insertNotice(SysNoticeBo noticeBo);
/**
* 修改公告
*
* @param notice 公告信息
* @return 结果
* @param noticeBo 公告信息
* @return 结果:true 更新成功false 更新失败
*/
public int updateNotice(SysNotice notice);
/**
* 删除公告信息
*
* @param noticeId 公告ID
* @return 结果
*/
public int deleteNoticeById(Long noticeId);
Boolean updateNotice(SysNoticeBo noticeBo);
/**
* 批量删除公告信息
*
* @param noticeIds 需要删除的公告ID
* @return 结果
* @return 结果:true 删除成功false 删除失败
*/
public int deleteNoticeByIds(Long[] noticeIds);
boolean deleteNoticeByIds(Long[] noticeIds);
}

View File

@ -28,6 +28,7 @@ import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.mapper.SysConfigMapper;
import com.ruoyi.system.service.ISysConfigService;
import org.springframework.transaction.annotation.Transactional;
import static com.ruoyi.system.domain.table.SysConfigTableDef.SYS_CONFIG;
@ -156,7 +157,7 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig
* 新增参数配置
*
* @param configBo 参数配置信息
* @return 结果
* @return 插入行数
*/
@CachePut(cacheNames = CacheNames.SYS_CONFIG, key = "#configBo.configKey")
@Override
@ -174,7 +175,7 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig
* 修改参数配置
*
* @param configBo 参数配置信息
* @return 结果
* @return true 更新成功false 更新失败
*/
@CachePut(cacheNames = CacheNames.SYS_CONFIG, key = "#configBo.configKey")
@Override
@ -194,6 +195,7 @@ public class SysConfigServiceImpl extends ServiceImpl<SysConfigMapper, SysConfig
* @param configIds 需要删除的参数ID
*/
@Override
@Transactional
public void deleteConfigByIds(Long[] configIds) {
for (Long configId : configIds) {
SysConfigVo config = selectConfigById(configId);

View File

@ -1,23 +1,43 @@
package com.ruoyi.system.service.impl;
import java.util.Arrays;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.ruoyi.common.core.core.page.PageDomain;
import com.ruoyi.common.core.core.page.TableSupport;
import com.ruoyi.common.core.utils.MapstructUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.core.utils.sql.SqlUtil;
import com.ruoyi.common.orm.core.page.TableDataInfo;
import com.ruoyi.system.domain.bo.SysNoticeBo;
import com.ruoyi.system.domain.vo.SysNoticeVo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.mapper.SysNoticeMapper;
import com.ruoyi.system.service.ISysNoticeService;
import org.springframework.transaction.annotation.Transactional;
import static com.ruoyi.system.domain.table.SysNoticeTableDef.SYS_NOTICE;
/**
* 公告 服务层实现
*
* @author ruoyi
* @author 数据小王子
*/
@Service
public class SysNoticeServiceImpl implements ISysNoticeService
{
@Autowired
public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper, SysNotice> implements ISysNoticeService {
@Resource
private SysNoticeMapper noticeMapper;
@Override
public QueryWrapper query() {
return super.query().from(SYS_NOTICE);
}
/**
* 查询公告信息
*
@ -25,68 +45,100 @@ public class SysNoticeServiceImpl implements ISysNoticeService
* @return 公告信息
*/
@Override
public SysNotice selectNoticeById(Long noticeId)
{
return noticeMapper.selectNoticeById(noticeId);
public SysNoticeVo selectNoticeById(Long noticeId) {
return this.getOneAs(query().where(SYS_NOTICE.NOTICE_ID.eq(noticeId)), SysNoticeVo.class);
}
/**
* 根据noticeBo构建QueryWrapper查询条件
*
* @param noticeBo
* @return
*/
private QueryWrapper buildQueryWrapper(SysNoticeBo noticeBo) {
QueryWrapper queryWrapper = query();
PageDomain pageDomain = TableSupport.buildPageRequest();
if (StringUtils.isNotEmpty(noticeBo.getNoticeTitle())) {
queryWrapper.and(SYS_NOTICE.NOTICE_TITLE.like(noticeBo.getNoticeTitle()));
}
if (StringUtils.isNotEmpty(noticeBo.getNoticeType())) {
queryWrapper.and(SYS_NOTICE.NOTICE_TYPE.eq(noticeBo.getNoticeType()));
}
if (StringUtils.isNotNull(noticeBo.getCreateBy())) {
queryWrapper.and(SYS_NOTICE.CREATE_BY.like(noticeBo.getCreateBy()));
}
if (StringUtils.isNotEmpty(pageDomain.getOrderBy())) {
String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
queryWrapper.orderBy(orderBy);
}
return queryWrapper;
}
/**
* 查询公告列表
*
* @param notice 公告信息
* @param noticeBo 公告信息
* @return 公告集合
*/
@Override
public List<SysNotice> selectNoticeList(SysNotice notice)
{
return noticeMapper.selectNoticeList(notice);
public List<SysNoticeVo> selectNoticeList(SysNoticeBo noticeBo) {
QueryWrapper queryWrapper = buildQueryWrapper(noticeBo);
return this.listAs(queryWrapper, SysNoticeVo.class);
}
/**
* 分页查询公告列表
*
* @param noticeBo 公告信息
* @return 公告集合
*/
@Override
public TableDataInfo<SysNoticeVo> selectConfigPage(SysNoticeBo noticeBo) {
QueryWrapper queryWrapper = buildQueryWrapper(noticeBo);
PageDomain pageDomain = TableSupport.buildPageRequest();
Page<SysNoticeVo> page = this.getMapper().paginateAs(pageDomain.getPageNum(), pageDomain.getPageSize(), queryWrapper, SysNoticeVo.class);
return TableDataInfo.build(page);
}
/**
* 新增公告
*
* @param notice 公告信息
* @return 结果
* @param noticeBo 公告信息
* @return 受影响的行数
*/
@Override
public int insertNotice(SysNotice notice)
{
return noticeMapper.insertNotice(notice);
public int insertNotice(SysNoticeBo noticeBo) {
SysNotice sysNotice = MapstructUtils.convert(noticeBo, SysNotice.class);
int ret = noticeMapper.insert(sysNotice, false);
return ret;
}
/**
* 修改公告
*
* @param notice 公告信息
* @return 结果
* @param noticeBo 公告信息
* @return true 更新成功false 更新失败
*/
@Override
public int updateNotice(SysNotice notice)
{
return noticeMapper.updateNotice(notice);
}
/**
* 删除公告对象
*
* @param noticeId 公告ID
* @return 结果
*/
@Override
public int deleteNoticeById(Long noticeId)
{
return noticeMapper.deleteNoticeById(noticeId);
public Boolean updateNotice(SysNoticeBo noticeBo) {
SysNotice sysNotice = MapstructUtils.convert(noticeBo, SysNotice.class);
return this.updateById(sysNotice);
}
/**
* 批量删除公告信息
*
* @param noticeIds 需要删除的公告ID
* @return 结果
* @return true 删除成功false 删除失败
*/
@Override
public int deleteNoticeByIds(Long[] noticeIds)
{
return noticeMapper.deleteNoticeByIds(noticeIds);
@Transactional
public boolean deleteNoticeByIds(Long[] noticeIds) {
return this.removeByIds(Arrays.asList(noticeIds));
}
}

View File

@ -22,68 +22,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from sys_notice
</sql>
<select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/>
where notice_id = #{noticeId}
</select>
<select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
<include refid="selectNoticeVo"/>
<where>
<if test="noticeTitle != null and noticeTitle != ''">
AND notice_title like concat('%', #{noticeTitle}, '%')
</if>
<if test="noticeType != null and noticeType != ''">
AND notice_type = #{noticeType}
</if>
<if test="createBy != null and createBy != ''">
AND create_by like concat('%', #{createBy}, '%')
</if>
</where>
</select>
<insert id="insertNotice" parameterType="SysNotice">
insert into sys_notice (
<if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
<if test="noticeType != null and noticeType != '' ">notice_type, </if>
<if test="noticeContent != null and noticeContent != '' ">notice_content, </if>
<if test="status != null and status != '' ">status, </if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
<if test="noticeType != null and noticeType != ''">#{noticeType}, </if>
<if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>
<if test="status != null and status != ''">#{status}, </if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updateNotice" parameterType="SysNotice">
update sys_notice
<set>
<if test="noticeTitle != null and noticeTitle != ''">notice_title = #{noticeTitle}, </if>
<if test="noticeType != null and noticeType != ''">notice_type = #{noticeType}, </if>
<if test="noticeContent != null">notice_content = #{noticeContent}, </if>
<if test="status != null and status != ''">status = #{status}, </if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where notice_id = #{noticeId}
</update>
<delete id="deleteNoticeById" parameterType="Long">
delete from sys_notice where notice_id = #{noticeId}
</delete>
<delete id="deleteNoticeByIds" parameterType="Long">
delete from sys_notice where notice_id in
<foreach item="noticeId" collection="array" open="(" separator="," close=")">
#{noticeId}
</foreach>
</delete>
</mapper>