This commit is contained in:
linfso 2024-08-31 07:38:09 +08:00
parent 411558d424
commit faadf2e780
13 changed files with 1178 additions and 0 deletions

View File

@ -0,0 +1,104 @@
/**
* @Project: emis
* @Title: EmisArticleController.java
* @author linfso
* @date 2024-08-29 04:47:38
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @Description: <p> 文章管理 控制器 </p>
*/
package com.xdadan.erp.oms.web;
import com.xdadan.erp.oms.common.annotation.Log;
import com.xdadan.erp.oms.common.core.controller.BaseController;
import com.xdadan.erp.oms.common.core.domain.AjaxResult;
import com.xdadan.erp.oms.common.core.page.TableDataInfo;
import com.xdadan.erp.oms.common.enums.BusinessType;
import com.xdadan.erp.oms.domain.EmisArticle;
import com.xdadan.erp.oms.domain.EmisArticleLikeRecord;
import com.xdadan.erp.oms.service.IEmisArticleLikeRecordService;
import com.xdadan.erp.oms.service.IEmisArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 文章管理Controller
*
* @author linfso
* @date 2024-08-29 04:47:38
*/
@RestController
@RequestMapping("/oms2c/emisArticle")
public class Oms2cArticleController extends BaseController
{
@Autowired
private IEmisArticleService emisArticleService;
@Autowired
private IEmisArticleLikeRecordService emisArticleLikeRecordService;
@GetMapping("/listSimple")
public TableDataInfo listSimple(EmisArticle emisArticle)
{
startPage();
List<EmisArticle> list = emisArticleService.selectEmisArticleList(emisArticle);
return getDataTable(list);
}
/**
* 获取文章管理详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(emisArticleService.selectEmisArticleById(id));
}
/**
* 获取文章详细信息
* @param id
* @return
*/
@GetMapping("/getDetail")
public AjaxResult getDetail(Long id)
{
return AjaxResult.success(emisArticleService.selectEmisArticleById(id));
}
@Log(title = "文章点赞", businessType = BusinessType.INSERT)
@PostMapping("/giveLike")
public AjaxResult giveLike(@RequestBody EmisArticleLikeRecord emisArticleLikeRecord)
{
emisArticleLikeRecord.setUserId(getUserId());
EmisArticleLikeRecord old=emisArticleLikeRecordService.selectEmisArticleLikeRecordById(emisArticleLikeRecord.getArticleId());
if(old!=null){
EmisArticleLikeRecord upd = new EmisArticleLikeRecord();
upd.setId(old.getId());
if("1".equals(old.getIsGiveLike())){
upd.setIsGiveLike("0");
}else{
upd.setIsGiveLike("1");
}
return toAjax(emisArticleLikeRecordService.updateEmisArticleLikeRecord(upd));
}else{
EmisArticleLikeRecord ins = new EmisArticleLikeRecord();
ins.setArticleId(emisArticleLikeRecord.getArticleId());
ins.setUserId(getUserId());
return toAjax(emisArticleLikeRecordService.insertEmisArticleLikeRecord(ins));
}
}
}

View File

@ -0,0 +1,61 @@
/**
* @Project: emis
* @Title: EmisArticle.java
* @author linfso
* @date 2024-08-29 04:47:37
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @Description: <p> 文章管理 实体类 </p>
*/
package com.xdadan.erp.oms.domain;
import com.xdadan.erp.oms.common.core.domain.BaseEntity;
import lombok.Data;
/**
* @ClassName EmisArticle
* @Description 文章管理
* @author linfso
* @date 2024-08-29 04:47:37
*/
@Data
public class EmisArticle extends BaseEntity
{
private static final long serialVersionUID = 1L;
/* id */
private Long id;
/* 分类 */
private Integer catId;
/* 标题 */
private String title;
/* 内容 */
private String content;
/* 作者 */
private String author;
/* 作者邮箱 */
private String authorEmail;
/* 关键字 */
private String keywords;
/* 文章类型 */
private Integer articleType;
/* 是否开放 */
private Integer isOpen;
/* 链接 */
private String fileUrl;
/* 开放类型 */
private Integer openType;
/* url link */
private String link;
/* 描述 */
private String description;
/* 点击次数 */
private Integer clickCount;
// -------- 非数据库字段
/* 是否点赞 0-否 1-是 */
private String isGiveLike;
}

View File

@ -0,0 +1,47 @@
/**
* @Project: emis
* @Title: EmisArticleCat.java
* @author linfso
* @date 2024-08-29 04:47:39
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @Description: <p> 文章类型 实体类 </p>
*/
package com.xdadan.erp.oms.domain;
import com.xdadan.erp.oms.common.core.domain.BaseEntity;
import lombok.Data;
/**
* @ClassName EmisArticleCat
* @Description 文章类型
* @author linfso
* @date 2024-08-29 04:47:39
*/
@Data
public class EmisArticleCat extends BaseEntity
{
private static final long serialVersionUID = 1L;
/* cat_id */
private Integer catId;
/* cat_name */
private String catName;
/* cat_type */
private Integer catType;
/* keywords */
private String keywords;
/* cat_desc */
private String catDesc;
/* order_num */
private Integer orderNum;
/* show_in_nav */
private Integer showInNav;
/* parent_id */
private Integer parentId;
/* path_name */
private String pathName;
}

View File

@ -0,0 +1,39 @@
/**
* @Project: emis
* @Title: EmisArticleLikeRecord.java
* @author linfso
* @date 2024-08-29 04:47:42
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @Description: <p> 文章点赞记录 实体类 </p>
*/
package com.xdadan.erp.oms.domain;
import com.xdadan.erp.oms.common.core.domain.BaseEntity;
import lombok.Data;
/**
* @ClassName EmisArticleLikeRecord
* @Description 文章点赞记录
* @author linfso
* @date 2024-08-29 04:47:42
*/
@Data
public class EmisArticleLikeRecord extends BaseEntity
{
private static final long serialVersionUID = 1L;
/* id */
private Long id;
/* 文章id */
private Long articleId;
/* 用户id */
private Long userId;
/* session_id */
private String sessionId;
/* 是否点赞 0-否 1-是 */
private String isGiveLike;
}

View File

@ -0,0 +1,82 @@
/**
* @Project: emis
* @Title: EmisArticleCatMapper.java
* @author linfso
* @date 2024-08-29 04:47:39
* @Copyright: ShangHai Doitinfo 2022 All rights reserved.
* @version v1.0
* @Description: <p> 文章类型 Mapper 接口 </p>
* <span style='color:red'> Warning : This file is generate by ai tools,don't edit!!! </span>
*/
package com.xdadan.erp.oms.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xdadan.erp.oms.domain.EmisArticleCat;
import java.util.List;
/**
* @ClassName EmisArticleCatMapper
* @Description <p> 文章类型 Mapper 接口 </p>
* @author linfso
* @date 2024-08-29 04:47:39
*/
public interface EmisArticleCatMapper extends BaseMapper<EmisArticleCat>
{
/**
* 主键查询
* @param catId
* @return
*/
public EmisArticleCat selectEmisArticleCatByCatId(Integer catId);
/**
* 查询列表
*
* @param emisArticleCat
* @return 集合
*/
public List<EmisArticleCat> selectEmisArticleCatList(EmisArticleCat emisArticleCat);
/**
* 检查是否重复
*
* @param emisArticleCat
* @return 数量
*/
public int checkUnique(EmisArticleCat emisArticleCat);
/**
* 新增
*
* @param emisArticleCat
* @return
*/
public int insertEmisArticleCat(EmisArticleCat emisArticleCat);
/**
* 修改
*
* @param emisArticleCat
* @return
*/
public int updateEmisArticleCat(EmisArticleCat emisArticleCat);
/**
* 删除
*
* @param catId 主键
* @return 结果
*/
public int deleteEmisArticleCatByCatId(Integer catId);
/**
* 批量删除
*
* @param catIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteEmisArticleCatByCatIds(Integer[] catIds);
}

View File

@ -0,0 +1,82 @@
/**
* @Project: emis
* @Title: EmisArticleLikeRecordMapper.java
* @author linfso
* @date 2024-08-29 04:47:42
* @Copyright: ShangHai Doitinfo 2022 All rights reserved.
* @version v1.0
* @Description: <p> 文章点赞记录 Mapper 接口 </p>
* <span style='color:red'> Warning : This file is generate by ai tools,don't edit!!! </span>
*/
package com.xdadan.erp.oms.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xdadan.erp.oms.domain.EmisArticleLikeRecord;
import java.util.List;
/**
* @ClassName EmisArticleLikeRecordMapper
* @Description <p> 文章点赞记录 Mapper 接口 </p>
* @author linfso
* @date 2024-08-29 04:47:42
*/
public interface EmisArticleLikeRecordMapper extends BaseMapper<EmisArticleLikeRecord>
{
/**
* 主键查询
* @param id
* @return
*/
public EmisArticleLikeRecord selectEmisArticleLikeRecordById(Long id);
/**
* 查询列表
*
* @param emisArticleLikeRecord
* @return 集合
*/
public List<EmisArticleLikeRecord> selectEmisArticleLikeRecordList(EmisArticleLikeRecord emisArticleLikeRecord);
/**
* 检查是否重复
*
* @param emisArticleLikeRecord
* @return 数量
*/
public int checkUnique(EmisArticleLikeRecord emisArticleLikeRecord);
/**
* 新增
*
* @param emisArticleLikeRecord
* @return
*/
public int insertEmisArticleLikeRecord(EmisArticleLikeRecord emisArticleLikeRecord);
/**
* 修改
*
* @param emisArticleLikeRecord
* @return
*/
public int updateEmisArticleLikeRecord(EmisArticleLikeRecord emisArticleLikeRecord);
/**
* 删除
*
* @param id 主键
* @return 结果
*/
public int deleteEmisArticleLikeRecordById(Long id);
/**
* 批量删除
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteEmisArticleLikeRecordByIds(Long[] ids);
}

View File

@ -0,0 +1,82 @@
/**
* @Project: emis
* @Title: EmisArticleMapper.java
* @author linfso
* @date 2024-08-29 04:47:37
* @Copyright: ShangHai Doitinfo 2022 All rights reserved.
* @version v1.0
* @Description: <p> 文章管理 Mapper 接口 </p>
* <span style='color:red'> Warning : This file is generate by ai tools,don't edit!!! </span>
*/
package com.xdadan.erp.oms.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xdadan.erp.oms.domain.EmisArticle;
import java.util.List;
/**
* @ClassName EmisArticleMapper
* @Description <p> 文章管理 Mapper 接口 </p>
* @author linfso
* @date 2024-08-29 04:47:37
*/
public interface EmisArticleMapper extends BaseMapper<EmisArticle>
{
/**
* 主键查询
* @param id
* @return
*/
public EmisArticle selectEmisArticleById(Long id);
/**
* 查询列表
*
* @param emisArticle
* @return 集合
*/
public List<EmisArticle> selectEmisArticleList(EmisArticle emisArticle);
/**
* 检查是否重复
*
* @param emisArticle
* @return 数量
*/
public int checkUnique(EmisArticle emisArticle);
/**
* 新增
*
* @param emisArticle
* @return
*/
public int insertEmisArticle(EmisArticle emisArticle);
/**
* 修改
*
* @param emisArticle
* @return
*/
public int updateEmisArticle(EmisArticle emisArticle);
/**
* 删除
*
* @param id 主键
* @return 结果
*/
public int deleteEmisArticleById(Long id);
/**
* 批量删除
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteEmisArticleByIds(Long[] ids);
}

View File

@ -0,0 +1,79 @@
/**
* @Project: emis
* @Title: EmisArticleCatService.java
* @author linfso
* @date 2024-08-29 04:47:40
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @Description: <p> 文章类型 服务类接口 </p>
*/
package com.xdadan.erp.oms.service;
import com.xdadan.erp.emis.domain.EmisArticleCat;
import java.util.List;
/**
* @ClassName EmisArticleCatService
* @Description 文章类型
* @author linfso
* @date 2024-08-29 04:47:40
*/
public interface IEmisArticleCatService
{
/**
* 主键查询
* @param catId
* @return
*/
public EmisArticleCat selectEmisArticleCatByCatId(Integer catId);
/**
* 查询文章类型列表
*
* @param emisArticleCat 文章类型
* @return 文章类型集合
*/
public List<EmisArticleCat> selectEmisArticleCatList(EmisArticleCat emisArticleCat);
/**
* 检查是否重复
*
* @param emisArticleCat
* @return 数量
*/
public int checkUnique(EmisArticleCat emisArticleCat);
/**
* 新增文章类型
*
* @param emisArticleCat 文章类型
* @return 结果
*/
public int insertEmisArticleCat(EmisArticleCat emisArticleCat);
/**
* 修改文章类型
*
* @param emisArticleCat 文章类型
* @return 结果
*/
public int updateEmisArticleCat(EmisArticleCat emisArticleCat);
/**
* 批量删除文章类型
*
* @param catIds 需要删除的文章类型主键集合
* @return 结果
*/
public int deleteEmisArticleCatByCatIds(Integer[] catIds);
/**
* 删除文章类型信息
*
* @param catId 文章类型主键
* @return 结果
*/
public int deleteEmisArticleCatByCatId(Integer catId);
}

View File

@ -0,0 +1,80 @@
/**
* @Project: emis
* @Title: EmisArticleLikeRecordService.java
* @author linfso
* @date 2024-08-29 04:47:43
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @Description: <p> 文章点赞记录 服务类接口 </p>
*/
package com.xdadan.erp.oms.service;
import com.xdadan.erp.oms.domain.EmisArticleLikeRecord;
import java.util.List;
/**
* @ClassName EmisArticleLikeRecordService
* @Description 文章点赞记录
* @author linfso
* @date 2024-08-29 04:47:43
*/
public interface IEmisArticleLikeRecordService
{
/**
* 主键查询
* @param id
* @return
*/
public EmisArticleLikeRecord selectEmisArticleLikeRecordById(Long id);
/**
* 查询文章点赞记录列表
*
* @param emisArticleLikeRecord 文章点赞记录
* @return 文章点赞记录集合
*/
public List<EmisArticleLikeRecord> selectEmisArticleLikeRecordList(EmisArticleLikeRecord emisArticleLikeRecord);
/**
* 检查是否重复
*
* @param emisArticleLikeRecord
* @return 数量
*/
public int checkUnique(EmisArticleLikeRecord emisArticleLikeRecord);
/**
* 新增文章点赞记录
*
* @param emisArticleLikeRecord 文章点赞记录
* @return 结果
*/
public int insertEmisArticleLikeRecord(EmisArticleLikeRecord emisArticleLikeRecord);
/**
* 修改文章点赞记录
*
* @param emisArticleLikeRecord 文章点赞记录
* @return 结果
*/
public int updateEmisArticleLikeRecord(EmisArticleLikeRecord emisArticleLikeRecord);
/**
* 批量删除文章点赞记录
*
* @param ids 需要删除的文章点赞记录主键集合
* @return 结果
*/
public int deleteEmisArticleLikeRecordByIds(Long[] ids);
/**
* 删除文章点赞记录信息
*
* @param id 文章点赞记录主键
* @return 结果
*/
public int deleteEmisArticleLikeRecordById(Long id);
}

View File

@ -0,0 +1,80 @@
/**
* @Project: emis
* @Title: EmisArticleService.java
* @author linfso
* @date 2024-08-29 04:47:37
* @Copyright: ShangHai Duta 2022 All rights reserved.
* @version v1.0
* @Description: <p> 文章管理 服务类接口 </p>
*/
package com.xdadan.erp.oms.service;
import com.xdadan.erp.oms.domain.EmisArticle;
import java.util.List;
/**
* @ClassName EmisArticleService
* @Description 文章管理
* @author linfso
* @date 2024-08-29 04:47:37
*/
public interface IEmisArticleService
{
/**
* 主键查询
* @param id
* @return
*/
public EmisArticle selectEmisArticleById(Long id);
/**
* 查询文章管理列表
*
* @param emisArticle 文章管理
* @return 文章管理集合
*/
public List<EmisArticle> selectEmisArticleList(EmisArticle emisArticle);
/**
* 检查是否重复
*
* @param emisArticle
* @return 数量
*/
public int checkUnique(EmisArticle emisArticle);
/**
* 新增文章管理
*
* @param emisArticle 文章管理
* @return 结果
*/
public int insertEmisArticle(EmisArticle emisArticle);
/**
* 修改文章管理
*
* @param emisArticle 文章管理
* @return 结果
*/
public int updateEmisArticle(EmisArticle emisArticle);
/**
* 批量删除文章管理
*
* @param ids 需要删除的文章管理主键集合
* @return 结果
*/
public int deleteEmisArticleByIds(Long[] ids);
/**
* 删除文章管理信息
*
* @param id 文章管理主键
* @return 结果
*/
public int deleteEmisArticleById(Long id);
}

View File

@ -0,0 +1,157 @@
<?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.xdadan.erp.oms.mapper.EmisArticleCatMapper">
<resultMap type="EmisArticleCat" id="EmisArticleCatResult">
<result property="catId" column="cat_id" />
<result property="catName" column="cat_name" />
<result property="catType" column="cat_type" />
<result property="keywords" column="keywords" />
<result property="catDesc" column="cat_desc" />
<result property="orderNum" column="order_num" />
<result property="showInNav" column="show_in_nav" />
<result property="parentId" column="parent_id" />
<result property="pathName" column="path_name" />
</resultMap>
<sql id="selectEmisArticleCatVo">
select cat_id, cat_name, cat_type, keywords, cat_desc, order_num, show_in_nav, parent_id, path_name, tenant_id, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site from emis_article_cat
</sql>
<select id="selectEmisArticleCatList" parameterType="EmisArticleCat" resultMap="EmisArticleCatResult">
<include refid="selectEmisArticleCatVo"/>
<where>
del_flag='0'
<if test="catId != null "> and cat_id = #{catId}</if>
<if test="catName != null and catName != ''"> and cat_name like concat('%', #{catName}, '%')</if>
<if test="catType != null "> and cat_type = #{catType}</if>
<if test="keywords != null and keywords != ''"> and keywords like concat('%', #{keywords}, '%')</if>
<if test="catDesc != null and catDesc != ''"> and cat_desc like concat('%', #{catDesc}, '%')</if>
<if test="orderNum != null "> and order_num = #{orderNum}</if>
<if test="showInNav != null "> and show_in_nav = #{showInNav}</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="pathName != null and pathName != ''"> and path_name like concat('%', #{pathName}, '%')</if>
<if test="tenantId != null and tenantId != ''"> and tenant_id like concat('%', #{tenantId}, '%')</if>
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
</where>
order by create_time desc
</select>
<select id="checkUnique" parameterType="EmisArticleCat" resultType="int">
select count(1) from emis_article_cat
where del_flag='0'
and cat_id = #{catId}
and cat_name = #{catName}
and cat_type = #{catType}
and keywords = #{keywords}
and cat_desc = #{catDesc}
and order_num = #{orderNum}
and show_in_nav = #{showInNav}
and parent_id = #{parentId}
and path_name = #{pathName}
and tenant_id = #{tenantId}
and del_flag = #{delFlag}
and create_by = #{createBy}
and create_time = #{createTime}
and update_by = #{updateBy}
and update_time = #{updateTime}
and remark = #{remark}
and create_site = #{createSite}
and update_site = #{updateSite}
limit 1
</select>
<select id="selectEmisArticleCatByCatId" parameterType="Integer" resultMap="EmisArticleCatResult">
select cat_id, cat_name, cat_type, keywords, cat_desc, order_num, show_in_nav, parent_id, path_name, tenant_id, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site
from emis_article_cat a
where a.cat_id = #{catId}
</select>
<insert id="insertEmisArticleCat" parameterType="EmisArticleCat" useGeneratedKeys="true" keyProperty="catId">
insert into emis_article_cat
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="catId != null">cat_id,</if>
<if test="catName != null and catName != ''">cat_name,</if>
<if test="catType != null">cat_type,</if>
<if test="keywords != null and keywords != ''">keywords,</if>
<if test="catDesc != null and catDesc != ''">cat_desc,</if>
<if test="orderNum != null">order_num,</if>
<if test="showInNav != null">show_in_nav,</if>
<if test="parentId != null">parent_id,</if>
<if test="pathName != null and pathName != ''">path_name,</if>
<if test="tenantId != null and tenantId != ''">tenant_id,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createSite != null and createSite != ''">create_site,</if>
<if test="updateSite != null and updateSite != ''">update_site,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="catId != null">#{catId},</if>
<if test="catName != null and catName != ''">#{catName},</if>
<if test="catType != null">#{catType},</if>
<if test="keywords != null and keywords != ''">#{keywords},</if>
<if test="catDesc != null and catDesc != ''">#{catDesc},</if>
<if test="orderNum != null">#{orderNum},</if>
<if test="showInNav != null">#{showInNav},</if>
<if test="parentId != null">#{parentId},</if>
<if test="pathName != null and pathName != ''">#{pathName},</if>
<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createSite != null and createSite != ''">#{createSite},</if>
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
</trim>
</insert>
<update id="updateEmisArticleCat" parameterType="EmisArticleCat">
update emis_article_cat
<trim prefix="SET" suffixOverrides=",">
<if test="catName != null and catName != ''">cat_name = #{catName},</if>
<if test="catType != null">cat_type = #{catType},</if>
<if test="keywords != null and keywords != ''">keywords = #{keywords},</if>
<if test="catDesc != null and catDesc != ''">cat_desc = #{catDesc},</if>
<if test="orderNum != null">order_num = #{orderNum},</if>
<if test="showInNav != null">show_in_nav = #{showInNav},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="pathName != null and pathName != ''">path_name = #{pathName},</if>
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
</trim>
where cat_id = #{catId}
</update>
<delete id="deleteEmisArticleCatByCatId" parameterType="Integer">
delete from emis_article_cat where cat_id = #{catId}
</delete>
<delete id="deleteEmisArticleCatByCatIds" parameterType="String">
delete from emis_article_cat where cat_id in
<foreach item="catId" collection="array" open="(" separator="," close=")">
#{catId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,98 @@
<?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.xdadan.erp.oms.mapper.EmisArticleLikeRecordMapper">
<resultMap type="EmisArticleLikeRecord" id="EmisArticleLikeRecordResult">
<result property="id" column="id" />
<result property="articleId" column="article_id" />
<result property="userId" column="user_id" />
<result property="sessionId" column="session_id" />
<result property="isGiveLike" column="is_give_like" />
</resultMap>
<sql id="selectEmisArticleLikeRecordVo">
select id, article_id, user_id, session_id, is_give_like, create_time, update_time from emis_article_like_record
</sql>
<select id="selectEmisArticleLikeRecordList" parameterType="EmisArticleLikeRecord" resultMap="EmisArticleLikeRecordResult">
<include refid="selectEmisArticleLikeRecordVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="articleId != null "> and article_id = #{articleId}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="sessionId != null and sessionId != ''"> and session_id like concat('%', #{sessionId}, '%')</if>
<if test="isGiveLike != null and isGiveLike != ''"> and is_give_like like concat('%', #{isGiveLike}, '%')</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
</where>
order by create_time desc
</select>
<select id="checkUnique" parameterType="EmisArticleLikeRecord" resultType="int">
select count(1) from emis_article_like_record
where del_flag='0'
and id = #{id}
and article_id = #{articleId}
and user_id = #{userId}
and session_id = #{sessionId}
and is_give_like = #{isGiveLike}
and create_time = #{createTime}
and update_time = #{updateTime}
limit 1
</select>
<select id="selectEmisArticleLikeRecordById" parameterType="Long" resultMap="EmisArticleLikeRecordResult">
select id, article_id, user_id, session_id, is_give_like, create_time, update_time
from emis_article_like_record a
where a.id = #{id}
</select>
<insert id="insertEmisArticleLikeRecord" parameterType="EmisArticleLikeRecord" useGeneratedKeys="true" keyProperty="id">
insert into emis_article_like_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="articleId != null">article_id,</if>
<if test="userId != null">user_id,</if>
<if test="sessionId != null and sessionId != ''">session_id,</if>
<if test="isGiveLike != null and isGiveLike != ''">is_give_like,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="articleId != null">#{articleId},</if>
<if test="userId != null">#{userId},</if>
<if test="sessionId != null and sessionId != ''">#{sessionId},</if>
<if test="isGiveLike != null and isGiveLike != ''">#{isGiveLike},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateEmisArticleLikeRecord" parameterType="EmisArticleLikeRecord">
update emis_article_like_record
<trim prefix="SET" suffixOverrides=",">
<if test="articleId != null">article_id = #{articleId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="sessionId != null and sessionId != ''">session_id = #{sessionId},</if>
<if test="isGiveLike != null and isGiveLike != ''">is_give_like = #{isGiveLike},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEmisArticleLikeRecordById" parameterType="Long">
delete from emis_article_like_record where id = #{id}
</delete>
<delete id="deleteEmisArticleLikeRecordByIds" parameterType="String">
delete from emis_article_like_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,187 @@
<?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.xdadan.erp.oms.mapper.EmisArticleMapper">
<resultMap type="EmisArticle" id="EmisArticleResult">
<result property="id" column="id" />
<result property="catId" column="cat_id" />
<result property="title" column="title" />
<result property="content" column="content" />
<result property="author" column="author" />
<result property="authorEmail" column="author_email" />
<result property="keywords" column="keywords" />
<result property="articleType" column="article_type" />
<result property="isOpen" column="is_open" />
<result property="fileUrl" column="file_url" />
<result property="openType" column="open_type" />
<result property="link" column="link" />
<result property="description" column="description" />
<result property="clickCount" column="click_count" />
</resultMap>
<sql id="selectEmisArticleVo">
select id, cat_id, title, content, author, author_email, keywords, article_type, is_open, file_url, open_type, link, description, click_count, tenant_id, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site from emis_article
</sql>
<select id="selectEmisArticleList" parameterType="EmisArticle" resultMap="EmisArticleResult">
<include refid="selectEmisArticleVo"/>
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="catId != null "> and cat_id = #{catId}</if>
<if test="title != null and title != ''"> and title like concat('%', #{title}, '%')</if>
<if test="content != null and content != ''"> and content like concat('%', #{content}, '%')</if>
<if test="author != null and author != ''"> and author like concat('%', #{author}, '%')</if>
<if test="authorEmail != null and authorEmail != ''"> and author_email like concat('%', #{authorEmail}, '%')</if>
<if test="keywords != null and keywords != ''"> and keywords like concat('%', #{keywords}, '%')</if>
<if test="articleType != null "> and article_type = #{articleType}</if>
<if test="isOpen != null "> and is_open = #{isOpen}</if>
<if test="fileUrl != null and fileUrl != ''"> and file_url like concat('%', #{fileUrl}, '%')</if>
<if test="openType != null "> and open_type = #{openType}</if>
<if test="link != null and link != ''"> and link like concat('%', #{link}, '%')</if>
<if test="description != null and description != ''"> and description like concat('%', #{description}, '%')</if>
<if test="clickCount != null "> and click_count = #{clickCount}</if>
<if test="tenantId != null and tenantId != ''"> and tenant_id like concat('%', #{tenantId}, '%')</if>
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
</where>
order by create_time desc
</select>
<select id="checkUnique" parameterType="EmisArticle" resultType="int">
select count(1) from emis_article
where del_flag='0'
and id = #{id}
and cat_id = #{catId}
and title = #{title}
and content = #{content}
and author = #{author}
and author_email = #{authorEmail}
and keywords = #{keywords}
and article_type = #{articleType}
and is_open = #{isOpen}
and file_url = #{fileUrl}
and open_type = #{openType}
and link = #{link}
and description = #{description}
and click_count = #{clickCount}
and tenant_id = #{tenantId}
and del_flag = #{delFlag}
and create_by = #{createBy}
and create_time = #{createTime}
and update_by = #{updateBy}
and update_time = #{updateTime}
and remark = #{remark}
and create_site = #{createSite}
and update_site = #{updateSite}
limit 1
</select>
<select id="selectEmisArticleById" parameterType="Long" resultMap="EmisArticleResult">
select id, cat_id, title, content, author, author_email, keywords, article_type, is_open, file_url, open_type, link, description, click_count, tenant_id, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site
from emis_article a
where a.id = #{id}
</select>
<insert id="insertEmisArticle" parameterType="EmisArticle" useGeneratedKeys="true" keyProperty="id">
insert into emis_article
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="catId != null">cat_id,</if>
<if test="title != null and title != ''">title,</if>
<if test="content != null and content != ''">content,</if>
<if test="author != null and author != ''">author,</if>
<if test="authorEmail != null and authorEmail != ''">author_email,</if>
<if test="keywords != null and keywords != ''">keywords,</if>
<if test="articleType != null">article_type,</if>
<if test="isOpen != null">is_open,</if>
<if test="fileUrl != null and fileUrl != ''">file_url,</if>
<if test="openType != null">open_type,</if>
<if test="link != null and link != ''">link,</if>
<if test="description != null and description != ''">description,</if>
<if test="clickCount != null">click_count,</if>
<if test="tenantId != null and tenantId != ''">tenant_id,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createSite != null and createSite != ''">create_site,</if>
<if test="updateSite != null and updateSite != ''">update_site,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="catId != null">#{catId},</if>
<if test="title != null and title != ''">#{title},</if>
<if test="content != null and content != ''">#{content},</if>
<if test="author != null and author != ''">#{author},</if>
<if test="authorEmail != null and authorEmail != ''">#{authorEmail},</if>
<if test="keywords != null and keywords != ''">#{keywords},</if>
<if test="articleType != null">#{articleType},</if>
<if test="isOpen != null">#{isOpen},</if>
<if test="fileUrl != null and fileUrl != ''">#{fileUrl},</if>
<if test="openType != null">#{openType},</if>
<if test="link != null and link != ''">#{link},</if>
<if test="description != null and description != ''">#{description},</if>
<if test="clickCount != null">#{clickCount},</if>
<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createSite != null and createSite != ''">#{createSite},</if>
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
</trim>
</insert>
<update id="updateEmisArticle" parameterType="EmisArticle">
update emis_article
<trim prefix="SET" suffixOverrides=",">
<if test="catId != null">cat_id = #{catId},</if>
<if test="title != null and title != ''">title = #{title},</if>
<if test="content != null and content != ''">content = #{content},</if>
<if test="author != null and author != ''">author = #{author},</if>
<if test="authorEmail != null and authorEmail != ''">author_email = #{authorEmail},</if>
<if test="keywords != null and keywords != ''">keywords = #{keywords},</if>
<if test="articleType != null">article_type = #{articleType},</if>
<if test="isOpen != null">is_open = #{isOpen},</if>
<if test="fileUrl != null and fileUrl != ''">file_url = #{fileUrl},</if>
<if test="openType != null">open_type = #{openType},</if>
<if test="link != null and link != ''">link = #{link},</if>
<if test="description != null and description != ''">description = #{description},</if>
<if test="clickCount != null">click_count = #{clickCount},</if>
<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEmisArticleById" parameterType="Long">
delete from emis_article where id = #{id}
</delete>
<delete id="deleteEmisArticleByIds" parameterType="String">
delete from emis_article where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>