Commit 80338fca by mobh Committed by chenzg

消息记录

parent 77db372b
......@@ -2,8 +2,11 @@ package cn.timer.api.controller.admin;
import java.util.List;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import cn.timer.api.dao.admin.AdminAssoTxjlbMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -27,24 +30,24 @@ import io.swagger.annotations.ApiOperation;
@Transactional
@RequestMapping(value = "/record")
public class AdminAssoTxjlbcontroller {
@Resource
private AdminAssoTxjlbMapper txjlbMapper;
@PostMapping("/noreading")
@ApiOperation(value = "未读数量", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> noreading(@CurrentUser UserBean userBean, @RequestBody QueryNoReadingDto ws) {
ws.setOrgCode(userBean.getOrgCode());
List<AdminAssoTxjlb> wds = AdminAssoTxjlb.builder().build()
.selectList(new QueryWrapper<AdminAssoTxjlb>().lambda().eq(AdminAssoTxjlb::getEmpNum, ws.getEmpNum())
Integer wds = AdminAssoTxjlb.builder().build()
.selectCount(new QueryWrapper<AdminAssoTxjlb>().lambda().eq(AdminAssoTxjlb::getEmpNum, ws.getEmpNum())
.eq(AdminAssoTxjlb::getOrgCode, ws.getOrgCode()).eq(AdminAssoTxjlb::getTxstate, 0));
return ResultUtil.data(wds.size(), "查询成功");
return ResultUtil.data(wds, "查询成功");
}
@PostMapping("/datanotread")
@ApiOperation(value = "未读数据", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> datanotread(@CurrentUser UserBean userBean, @RequestBody QueryNoReadingDto ws) {
ws.setOrgCode(userBean.getOrgCode());
List<AdminAssoTxjlb> wds = AdminAssoTxjlb.builder().build()
.selectList(new QueryWrapper<AdminAssoTxjlb>().lambda().eq(AdminAssoTxjlb::getEmpNum, ws.getEmpNum())
.eq(AdminAssoTxjlb::getOrgCode, ws.getOrgCode()).eq(AdminAssoTxjlb::getTxstate, 0));
......@@ -55,18 +58,30 @@ public class AdminAssoTxjlbcontroller {
@GetMapping("/recorddetails/{id}")
@ApiOperation(value = "记录详情", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> recorddetails(@CurrentUser UserBean userBean, @PathVariable Integer id) {
AdminAssoTxjlb jlxq = AdminAssoTxjlb.builder().id(id).build().selectById();
return ResultUtil.data(jlxq, "成功");
}
@GetMapping("/recordmodification/{id}")
@ApiOperation(value = "记录修改", httpMethod = "GET", notes = "接口发布说明")
@ApiOperation(value = "未读记录标记已读", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> recordmodification(@CurrentUser UserBean userBean, @PathVariable Integer id) {
AdminAssoTxjlb.builder().id(id).build().update(new QueryWrapper<AdminAssoTxjlb>().lambda().eq(AdminAssoTxjlb::getTxstate, 1));
AdminAssoTxjlb.builder().id(id).build()
.update(new QueryWrapper<AdminAssoTxjlb>().lambda().eq(AdminAssoTxjlb::getTxstate, 1));
return ResultUtil.success("修改成功");
}
@PostMapping("/pageTxjlb")
@ApiOperation(value = "分页查询消息记录", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> pageTxjlb(@CurrentUser UserBean userBean, @RequestBody QueryNoReadingDto search) {
search.setOrgCode(userBean.getOrgCode());
Page<AdminAssoTxjlb> page = new Page<>(
search.getCurrentPage() == null ? 1 : search.getCurrentPage(),
search.getTotalPage() == null ? 10 : search.getTotalPage());
long total = txjlbMapper.pageTxjlbCount(search);
List<AdminAssoTxjlb> list = txjlbMapper.pageTxjlb(search);
page.setTotal(total);
return ResultUtil.data(page, list, "分页查询消息记录");
}
}
package cn.timer.api.dao.admin;
import cn.timer.api.dto.htzz.QueryNoReadingDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.admin.AdminAssoTxjlb;
import java.util.List;
/**
* 系统消息记录
*
......@@ -13,5 +17,16 @@ import cn.timer.api.bean.admin.AdminAssoTxjlb;
*/
@Repository
public interface AdminAssoTxjlbMapper extends BaseMapper<AdminAssoTxjlb> {
/**
* 分页查询总数
* @param param
* @return
*/
Long pageTxjlbCount(@Param("param") QueryNoReadingDto param);
/**
* 分页查询
* @param param
* @return
*/
List<AdminAssoTxjlb> pageTxjlb(@Param("param") QueryNoReadingDto param);
}
......@@ -7,7 +7,6 @@ import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.admin.AdminMsgTemplate;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
......
package cn.timer.api.dto.htzz;
import cn.timer.api.utils.Page;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class QueryNoReadingDto {
public class QueryNoReadingDto extends Page implements Serializable {
private String text;
private Integer empNum;
private Integer txType;
private Integer txstate;
private Integer orgCode;
}
......@@ -24,107 +24,33 @@
addtime,
txstate
</sql>
<sql id="Base_Column_List_Alias">
id AdminAssoTxjlb_id,
content AdminAssoTxjlb_content,
user_name AdminAssoTxjlb_user_name,
emp_num AdminAssoTxjlb_emp_num,
tx_type AdminAssoTxjlb_tx_type,
org_code AdminAssoTxjlb_org_code,
addtime AdminAssoTxjlb_addtime,
txstate AdminAssoTxjlb_txstate
</sql>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.admin.AdminAssoTxjlb">
INSERT INTO admin_asso_txjlb
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != content'>
content,
</if>
<if test ='null != userName'>
user_name,
</if>
<if test ='null != empNum'>
emp_num,
</if>
<if test ='null != txType'>
tx_type,
</if>
<if test ='null != orgCode'>
org_code,
</if>
<if test ='null != addtime'>
addtime,
</if>
<if test ='null != txstate'>
txstate
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != content'>
#{content},
</if>
<if test ='null != userName'>
#{userName},
</if>
<if test ='null != empNum'>
#{empNum},
</if>
<if test ='null != txType'>
#{txType},
</if>
<if test ='null != orgCode'>
#{orgCode},
</if>
<if test ='null != addtime'>
#{addtime},
</if>
<if test ='null != txstate'>
#{txstate}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM admin_asso_txjlb
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.admin.AdminAssoTxjlb">
UPDATE admin_asso_txjlb
<set>
<if test ='null != content'>content = #{content},</if>
<if test ='null != userName'>user_name = #{userName},</if>
<if test ='null != empNum'>emp_num = #{empNum},</if>
<if test ='null != txType'>tx_type = #{txType},</if>
<if test ='null != orgCode'>org_code = #{orgCode},</if>
<if test ='null != addtime'>addtime = #{addtime},</if>
<if test ='null != txstate'>txstate = #{txstate}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM admin_asso_txjlb
WHERE id = #{id}
<!-- 分页查询 -->
<sql id="pageTxjlbCondition">
<where>
<if test="param.text != null and param.text !=''">
and (txjlb.user_name like CONCAT('%',#{param.text},'%') or txjlb.emp_num = #{param.text})
</if>
<if test="param.txType != null">
and txjlb.tx_type = #{param.txType}
</if>
<if test="param.txstate != null">
and txjlb.txstate = #{param.txstate}
</if>
<if test="param.orgCode != null">
and txjlb.org_code = #{param.orgCode}
</if>
</where>
</sql>
<select id="pageTxjlbCount" resultType="java.lang.Long">
SELECT count(*) FROM admin_asso_txjlb txjlb
<include refid="pageTxjlbCondition" />
</select>
<select id="pageList" resultMap="BaseResultMap">
<select id="pageTxjlb" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM admin_asso_txjlb
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM admin_asso_txjlb
FROM admin_asso_txjlb txjlb
<include refid="pageTxjlbCondition" />
ORDER BY txjlb.txstate ASC
LIMIT #{param.offset}, #{param.totalPage}
</select>
-->
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment