2024.4.30 添加官网模块

This commit is contained in:
libao 2024-04-30 09:08:16 +08:00
parent c4a6cfdc97
commit c2e4fb6163
12 changed files with 1035 additions and 0 deletions

View File

@ -0,0 +1,104 @@
package com.ruoyi.web.controller.gw;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
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.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.GwArticle;
import com.ruoyi.system.service.IGwArticleService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 官网文章列表Controller
*
* @author libao
* @date 2024-04-28
*/
@RestController
@RequestMapping("/system/article")
public class GwArticleController extends BaseController
{
@Autowired
private IGwArticleService gwArticleService;
/**
* 查询官网文章列表列表
*/
@PreAuthorize("@ss.hasPermi('system:article:list')")
@GetMapping("/list")
public TableDataInfo list(GwArticle gwArticle)
{
startPage();
List<GwArticle> list = gwArticleService.selectGwArticleList(gwArticle);
return getDataTable(list);
}
/**
* 导出官网文章列表列表
*/
@PreAuthorize("@ss.hasPermi('system:article:export')")
@Log(title = "官网文章列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, GwArticle gwArticle)
{
List<GwArticle> list = gwArticleService.selectGwArticleList(gwArticle);
ExcelUtil<GwArticle> util = new ExcelUtil<GwArticle>(GwArticle.class);
util.exportExcel(response, list, "官网文章列表数据");
}
/**
* 获取官网文章列表详细信息
*/
@PreAuthorize("@ss.hasPermi('system:article:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(gwArticleService.selectGwArticleById(id));
}
/**
* 新增官网文章列表
*/
@PreAuthorize("@ss.hasPermi('system:article:add')")
@Log(title = "官网文章列表", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody GwArticle gwArticle)
{
return toAjax(gwArticleService.insertGwArticle(gwArticle));
}
/**
* 修改官网文章列表
*/
@PreAuthorize("@ss.hasPermi('system:article:edit')")
@Log(title = "官网文章列表", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody GwArticle gwArticle)
{
return toAjax(gwArticleService.updateGwArticle(gwArticle));
}
/**
* 删除官网文章列表
*/
@PreAuthorize("@ss.hasPermi('system:article:remove')")
@Log(title = "官网文章列表", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(gwArticleService.deleteGwArticleByIds(ids));
}
}

View File

@ -0,0 +1,104 @@
package com.ruoyi.web.controller.gw;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
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.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.GwCategory;
import com.ruoyi.system.service.IGwCategoryService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 文章分类Controller
*
* @author lb
* @date 2024-04-28
*/
@RestController
@RequestMapping("/system/category")
public class GwCategoryController extends BaseController
{
@Autowired
private IGwCategoryService gwCategoryService;
/**
* 查询文章分类列表
*/
@PreAuthorize("@ss.hasPermi('system:category:list')")
@GetMapping("/list")
public TableDataInfo list(GwCategory gwCategory)
{
startPage();
List<GwCategory> list = gwCategoryService.selectGwCategoryList(gwCategory);
return getDataTable(list);
}
/**
* 导出文章分类列表
*/
@PreAuthorize("@ss.hasPermi('system:category:export')")
@Log(title = "文章分类", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, GwCategory gwCategory)
{
List<GwCategory> list = gwCategoryService.selectGwCategoryList(gwCategory);
ExcelUtil<GwCategory> util = new ExcelUtil<GwCategory>(GwCategory.class);
util.exportExcel(response, list, "文章分类数据");
}
/**
* 获取文章分类详细信息
*/
@PreAuthorize("@ss.hasPermi('system:category:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(gwCategoryService.selectGwCategoryById(id));
}
/**
* 新增文章分类
*/
@PreAuthorize("@ss.hasPermi('system:category:add')")
@Log(title = "文章分类", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody GwCategory gwCategory)
{
return toAjax(gwCategoryService.insertGwCategory(gwCategory));
}
/**
* 修改文章分类
*/
@PreAuthorize("@ss.hasPermi('system:category:edit')")
@Log(title = "文章分类", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody GwCategory gwCategory)
{
return toAjax(gwCategoryService.updateGwCategory(gwCategory));
}
/**
* 删除文章分类
*/
@PreAuthorize("@ss.hasPermi('system:category:remove')")
@Log(title = "文章分类", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(gwCategoryService.deleteGwCategoryByIds(ids));
}
}

View File

@ -0,0 +1,111 @@
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 官网文章列表对象 gw_article
*
* @author libao
* @date 2024-04-28
*/
public class GwArticle extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 官网文章列表 */
private Long id;
/** 文章所属分类 */
@Excel(name = "文章所属分类")
private Long categoryId;
/** 标题 */
@Excel(name = "标题")
private String title;
/** 内容 */
@Excel(name = "内容")
private String content;
/** 封面图片 */
@Excel(name = "封面图片")
private String coverImg;
/** 0否1是 */
private String delFlag;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCategoryId(Long categoryId)
{
this.categoryId = categoryId;
}
public Long getCategoryId()
{
return categoryId;
}
public void setTitle(String title)
{
this.title = title;
}
public String getTitle()
{
return title;
}
public void setContent(String content)
{
this.content = content;
}
public String getContent()
{
return content;
}
public void setCoverImg(String coverImg)
{
this.coverImg = coverImg;
}
public String getCoverImg()
{
return coverImg;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("categoryId", getCategoryId())
.append("title", getTitle())
.append("content", getContent())
.append("coverImg", getCoverImg())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("delFlag", getDelFlag())
.toString();
}
}

View File

@ -0,0 +1,97 @@
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 文章分类对象 gw_category
*
* @author lb
* @date 2024-04-28
*/
public class GwCategory extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 官网文章分类表 */
private Long id;
/** 上级分类 */
@Excel(name = "上级分类")
private Long parentId;
/** 分类名称 */
@Excel(name = "分类名称")
private String categoryName;
/** 排序 */
@Excel(name = "排序")
private Long sort;
/** 0否1是 */
private String delFlag;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setParentId(Long parentId)
{
this.parentId = parentId;
}
public Long getParentId()
{
return parentId;
}
public void setCategoryName(String categoryName)
{
this.categoryName = categoryName;
}
public String getCategoryName()
{
return categoryName;
}
public void setSort(Long sort)
{
this.sort = sort;
}
public Long getSort()
{
return sort;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("parentId", getParentId())
.append("categoryName", getCategoryName())
.append("sort", getSort())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("delFlag", getDelFlag())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.GwArticle;
/**
* 官网文章列表Mapper接口
*
* @author libao
* @date 2024-04-28
*/
public interface GwArticleMapper
{
/**
* 查询官网文章列表
*
* @param id 官网文章列表主键
* @return 官网文章列表
*/
public GwArticle selectGwArticleById(Long id);
/**
* 查询官网文章列表列表
*
* @param gwArticle 官网文章列表
* @return 官网文章列表集合
*/
public List<GwArticle> selectGwArticleList(GwArticle gwArticle);
/**
* 新增官网文章列表
*
* @param gwArticle 官网文章列表
* @return 结果
*/
public int insertGwArticle(GwArticle gwArticle);
/**
* 修改官网文章列表
*
* @param gwArticle 官网文章列表
* @return 结果
*/
public int updateGwArticle(GwArticle gwArticle);
/**
* 删除官网文章列表
*
* @param id 官网文章列表主键
* @return 结果
*/
public int deleteGwArticleById(Long id);
/**
* 批量删除官网文章列表
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteGwArticleByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.GwCategory;
/**
* 文章分类Mapper接口
*
* @author lb
* @date 2024-04-28
*/
public interface GwCategoryMapper
{
/**
* 查询文章分类
*
* @param id 文章分类主键
* @return 文章分类
*/
public GwCategory selectGwCategoryById(Long id);
/**
* 查询文章分类列表
*
* @param gwCategory 文章分类
* @return 文章分类集合
*/
public List<GwCategory> selectGwCategoryList(GwCategory gwCategory);
/**
* 新增文章分类
*
* @param gwCategory 文章分类
* @return 结果
*/
public int insertGwCategory(GwCategory gwCategory);
/**
* 修改文章分类
*
* @param gwCategory 文章分类
* @return 结果
*/
public int updateGwCategory(GwCategory gwCategory);
/**
* 删除文章分类
*
* @param id 文章分类主键
* @return 结果
*/
public int deleteGwCategoryById(Long id);
/**
* 批量删除文章分类
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteGwCategoryByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.GwArticle;
/**
* 官网文章列表Service接口
*
* @author libao
* @date 2024-04-28
*/
public interface IGwArticleService
{
/**
* 查询官网文章列表
*
* @param id 官网文章列表主键
* @return 官网文章列表
*/
public GwArticle selectGwArticleById(Long id);
/**
* 查询官网文章列表列表
*
* @param gwArticle 官网文章列表
* @return 官网文章列表集合
*/
public List<GwArticle> selectGwArticleList(GwArticle gwArticle);
/**
* 新增官网文章列表
*
* @param gwArticle 官网文章列表
* @return 结果
*/
public int insertGwArticle(GwArticle gwArticle);
/**
* 修改官网文章列表
*
* @param gwArticle 官网文章列表
* @return 结果
*/
public int updateGwArticle(GwArticle gwArticle);
/**
* 批量删除官网文章列表
*
* @param ids 需要删除的官网文章列表主键集合
* @return 结果
*/
public int deleteGwArticleByIds(Long[] ids);
/**
* 删除官网文章列表信息
*
* @param id 官网文章列表主键
* @return 结果
*/
public int deleteGwArticleById(Long id);
}

View File

@ -0,0 +1,61 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.GwCategory;
/**
* 文章分类Service接口
*
* @author lb
* @date 2024-04-28
*/
public interface IGwCategoryService
{
/**
* 查询文章分类
*
* @param id 文章分类主键
* @return 文章分类
*/
public GwCategory selectGwCategoryById(Long id);
/**
* 查询文章分类列表
*
* @param gwCategory 文章分类
* @return 文章分类集合
*/
public List<GwCategory> selectGwCategoryList(GwCategory gwCategory);
/**
* 新增文章分类
*
* @param gwCategory 文章分类
* @return 结果
*/
public int insertGwCategory(GwCategory gwCategory);
/**
* 修改文章分类
*
* @param gwCategory 文章分类
* @return 结果
*/
public int updateGwCategory(GwCategory gwCategory);
/**
* 批量删除文章分类
*
* @param ids 需要删除的文章分类主键集合
* @return 结果
*/
public int deleteGwCategoryByIds(Long[] ids);
/**
* 删除文章分类信息
*
* @param id 文章分类主键
* @return 结果
*/
public int deleteGwCategoryById(Long id);
}

View File

@ -0,0 +1,96 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.GwArticleMapper;
import com.ruoyi.system.domain.GwArticle;
import com.ruoyi.system.service.IGwArticleService;
/**
* 官网文章列表Service业务层处理
*
* @author libao
* @date 2024-04-28
*/
@Service
public class GwArticleServiceImpl implements IGwArticleService
{
@Autowired
private GwArticleMapper gwArticleMapper;
/**
* 查询官网文章列表
*
* @param id 官网文章列表主键
* @return 官网文章列表
*/
@Override
public GwArticle selectGwArticleById(Long id)
{
return gwArticleMapper.selectGwArticleById(id);
}
/**
* 查询官网文章列表列表
*
* @param gwArticle 官网文章列表
* @return 官网文章列表
*/
@Override
public List<GwArticle> selectGwArticleList(GwArticle gwArticle)
{
return gwArticleMapper.selectGwArticleList(gwArticle);
}
/**
* 新增官网文章列表
*
* @param gwArticle 官网文章列表
* @return 结果
*/
@Override
public int insertGwArticle(GwArticle gwArticle)
{
gwArticle.setCreateTime(DateUtils.getNowDate());
return gwArticleMapper.insertGwArticle(gwArticle);
}
/**
* 修改官网文章列表
*
* @param gwArticle 官网文章列表
* @return 结果
*/
@Override
public int updateGwArticle(GwArticle gwArticle)
{
gwArticle.setUpdateTime(DateUtils.getNowDate());
return gwArticleMapper.updateGwArticle(gwArticle);
}
/**
* 批量删除官网文章列表
*
* @param ids 需要删除的官网文章列表主键
* @return 结果
*/
@Override
public int deleteGwArticleByIds(Long[] ids)
{
return gwArticleMapper.deleteGwArticleByIds(ids);
}
/**
* 删除官网文章列表信息
*
* @param id 官网文章列表主键
* @return 结果
*/
@Override
public int deleteGwArticleById(Long id)
{
return gwArticleMapper.deleteGwArticleById(id);
}
}

View File

@ -0,0 +1,96 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.GwCategoryMapper;
import com.ruoyi.system.domain.GwCategory;
import com.ruoyi.system.service.IGwCategoryService;
/**
* 文章分类Service业务层处理
*
* @author lb
* @date 2024-04-28
*/
@Service
public class GwCategoryServiceImpl implements IGwCategoryService
{
@Autowired
private GwCategoryMapper gwCategoryMapper;
/**
* 查询文章分类
*
* @param id 文章分类主键
* @return 文章分类
*/
@Override
public GwCategory selectGwCategoryById(Long id)
{
return gwCategoryMapper.selectGwCategoryById(id);
}
/**
* 查询文章分类列表
*
* @param gwCategory 文章分类
* @return 文章分类
*/
@Override
public List<GwCategory> selectGwCategoryList(GwCategory gwCategory)
{
return gwCategoryMapper.selectGwCategoryList(gwCategory);
}
/**
* 新增文章分类
*
* @param gwCategory 文章分类
* @return 结果
*/
@Override
public int insertGwCategory(GwCategory gwCategory)
{
gwCategory.setCreateTime(DateUtils.getNowDate());
return gwCategoryMapper.insertGwCategory(gwCategory);
}
/**
* 修改文章分类
*
* @param gwCategory 文章分类
* @return 结果
*/
@Override
public int updateGwCategory(GwCategory gwCategory)
{
gwCategory.setUpdateTime(DateUtils.getNowDate());
return gwCategoryMapper.updateGwCategory(gwCategory);
}
/**
* 批量删除文章分类
*
* @param ids 需要删除的文章分类主键
* @return 结果
*/
@Override
public int deleteGwCategoryByIds(Long[] ids)
{
return gwCategoryMapper.deleteGwCategoryByIds(ids);
}
/**
* 删除文章分类信息
*
* @param id 文章分类主键
* @return 结果
*/
@Override
public int deleteGwCategoryById(Long id)
{
return gwCategoryMapper.deleteGwCategoryById(id);
}
}

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.GwArticleMapper">
<resultMap type="GwArticle" id="GwArticleResult">
<result property="id" column="id" />
<result property="categoryId" column="category_id" />
<result property="title" column="title" />
<result property="content" column="content" />
<result property="coverImg" column="cover_img" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectGwArticleVo">
select id, category_id, title, content, cover_img, create_by, create_time, update_by, update_time, remark, del_flag from gw_article
</sql>
<select id="selectGwArticleList" parameterType="GwArticle" resultMap="GwArticleResult">
<include refid="selectGwArticleVo"/>
<where>
<if test="categoryId != null "> and category_id = #{categoryId}</if>
<if test="title != null and title != ''"> and title = #{title}</if>
</where>
</select>
<select id="selectGwArticleById" parameterType="Long" resultMap="GwArticleResult">
<include refid="selectGwArticleVo"/>
where id = #{id}
</select>
<insert id="insertGwArticle" parameterType="GwArticle" useGeneratedKeys="true" keyProperty="id">
insert into gw_article
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="categoryId != null">category_id,</if>
<if test="title != null">title,</if>
<if test="content != null">content,</if>
<if test="coverImg != null">cover_img,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="categoryId != null">#{categoryId},</if>
<if test="title != null">#{title},</if>
<if test="content != null">#{content},</if>
<if test="coverImg != null">#{coverImg},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateGwArticle" parameterType="GwArticle">
update gw_article
<trim prefix="SET" suffixOverrides=",">
<if test="categoryId != null">category_id = #{categoryId},</if>
<if test="title != null">title = #{title},</if>
<if test="content != null">content = #{content},</if>
<if test="coverImg != null">cover_img = #{coverImg},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteGwArticleById" parameterType="Long">
delete from gw_article where id = #{id}
</delete>
<delete id="deleteGwArticleByIds" parameterType="String">
delete from gw_article where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.GwCategoryMapper">
<resultMap type="GwCategory" id="GwCategoryResult">
<result property="id" column="id" />
<result property="parentId" column="parent_id" />
<result property="categoryName" column="category_name" />
<result property="sort" column="sort" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectGwCategoryVo">
select id, parent_id, category_name, sort, create_by, create_time, update_by, update_time, remark, del_flag from gw_category
</sql>
<select id="selectGwCategoryList" parameterType="GwCategory" resultMap="GwCategoryResult">
<include refid="selectGwCategoryVo"/>
<where>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="categoryName != null and categoryName != ''"> and category_name like concat('%', #{categoryName}, '%')</if>
<if test="sort != null "> and sort = #{sort}</if>
</where>
</select>
<select id="selectGwCategoryById" parameterType="Long" resultMap="GwCategoryResult">
<include refid="selectGwCategoryVo"/>
where id = #{id}
</select>
<insert id="insertGwCategory" parameterType="GwCategory" useGeneratedKeys="true" keyProperty="id">
insert into gw_category
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">parent_id,</if>
<if test="categoryName != null">category_name,</if>
<if test="sort != null">sort,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="delFlag != null">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">#{parentId},</if>
<if test="categoryName != null">#{categoryName},</if>
<if test="sort != null">#{sort},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="delFlag != null">#{delFlag},</if>
</trim>
</insert>
<update id="updateGwCategory" parameterType="GwCategory">
update gw_category
<trim prefix="SET" suffixOverrides=",">
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="categoryName != null">category_name = #{categoryName},</if>
<if test="sort != null">sort = #{sort},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteGwCategoryById" parameterType="Long">
delete from gw_category where id = #{id}
</delete>
<delete id="deleteGwCategoryByIds" parameterType="String">
delete from gw_category where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>