Commit 80338fca by mobh Committed by chenzg

消息记录

parent 77db372b
...@@ -2,8 +2,11 @@ package cn.timer.api.controller.admin; ...@@ -2,8 +2,11 @@ package cn.timer.api.controller.admin;
import java.util.List; import java.util.List;
import javax.annotation.Resource;
import javax.transaction.Transactional; 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.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -27,24 +30,24 @@ import io.swagger.annotations.ApiOperation; ...@@ -27,24 +30,24 @@ import io.swagger.annotations.ApiOperation;
@Transactional @Transactional
@RequestMapping(value = "/record") @RequestMapping(value = "/record")
public class AdminAssoTxjlbcontroller { public class AdminAssoTxjlbcontroller {
@Resource
private AdminAssoTxjlbMapper txjlbMapper;
@PostMapping("/noreading") @PostMapping("/noreading")
@ApiOperation(value = "未读数量", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "未读数量", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> noreading(@CurrentUser UserBean userBean, @RequestBody QueryNoReadingDto ws) { public Result<Object> noreading(@CurrentUser UserBean userBean, @RequestBody QueryNoReadingDto ws) {
ws.setOrgCode(userBean.getOrgCode()); ws.setOrgCode(userBean.getOrgCode());
Integer wds = AdminAssoTxjlb.builder().build()
List<AdminAssoTxjlb> wds = AdminAssoTxjlb.builder().build() .selectCount(new QueryWrapper<AdminAssoTxjlb>().lambda().eq(AdminAssoTxjlb::getEmpNum, ws.getEmpNum())
.selectList(new QueryWrapper<AdminAssoTxjlb>().lambda().eq(AdminAssoTxjlb::getEmpNum, ws.getEmpNum())
.eq(AdminAssoTxjlb::getOrgCode, ws.getOrgCode()).eq(AdminAssoTxjlb::getTxstate, 0)); .eq(AdminAssoTxjlb::getOrgCode, ws.getOrgCode()).eq(AdminAssoTxjlb::getTxstate, 0));
return ResultUtil.data(wds.size(), "查询成功"); return ResultUtil.data(wds, "查询成功");
} }
@PostMapping("/datanotread") @PostMapping("/datanotread")
@ApiOperation(value = "未读数据", httpMethod = "POST", notes = "接口发布说明") @ApiOperation(value = "未读数据", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> datanotread(@CurrentUser UserBean userBean, @RequestBody QueryNoReadingDto ws) { public Result<Object> datanotread(@CurrentUser UserBean userBean, @RequestBody QueryNoReadingDto ws) {
ws.setOrgCode(userBean.getOrgCode());
List<AdminAssoTxjlb> wds = AdminAssoTxjlb.builder().build() List<AdminAssoTxjlb> wds = AdminAssoTxjlb.builder().build()
.selectList(new QueryWrapper<AdminAssoTxjlb>().lambda().eq(AdminAssoTxjlb::getEmpNum, ws.getEmpNum()) .selectList(new QueryWrapper<AdminAssoTxjlb>().lambda().eq(AdminAssoTxjlb::getEmpNum, ws.getEmpNum())
.eq(AdminAssoTxjlb::getOrgCode, ws.getOrgCode()).eq(AdminAssoTxjlb::getTxstate, 0)); .eq(AdminAssoTxjlb::getOrgCode, ws.getOrgCode()).eq(AdminAssoTxjlb::getTxstate, 0));
...@@ -55,18 +58,30 @@ public class AdminAssoTxjlbcontroller { ...@@ -55,18 +58,30 @@ public class AdminAssoTxjlbcontroller {
@GetMapping("/recorddetails/{id}") @GetMapping("/recorddetails/{id}")
@ApiOperation(value = "记录详情", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "记录详情", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> recorddetails(@CurrentUser UserBean userBean, @PathVariable Integer id) { public Result<Object> recorddetails(@CurrentUser UserBean userBean, @PathVariable Integer id) {
AdminAssoTxjlb jlxq = AdminAssoTxjlb.builder().id(id).build().selectById(); AdminAssoTxjlb jlxq = AdminAssoTxjlb.builder().id(id).build().selectById();
return ResultUtil.data(jlxq, "成功"); return ResultUtil.data(jlxq, "成功");
} }
@GetMapping("/recordmodification/{id}") @GetMapping("/recordmodification/{id}")
@ApiOperation(value = "记录修改", httpMethod = "GET", notes = "接口发布说明") @ApiOperation(value = "未读记录标记已读", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> recordmodification(@CurrentUser UserBean userBean, @PathVariable Integer id) { public Result<Object> recordmodification(@CurrentUser UserBean userBean, @PathVariable Integer id) {
AdminAssoTxjlb.builder().id(id).build()
AdminAssoTxjlb.builder().id(id).build().update(new QueryWrapper<AdminAssoTxjlb>().lambda().eq(AdminAssoTxjlb::getTxstate, 1)); .update(new QueryWrapper<AdminAssoTxjlb>().lambda().eq(AdminAssoTxjlb::getTxstate, 1));
return ResultUtil.success("修改成功"); 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; 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 org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.admin.AdminAssoTxjlb; import cn.timer.api.bean.admin.AdminAssoTxjlb;
import java.util.List;
/** /**
* 系统消息记录 * 系统消息记录
* *
...@@ -13,5 +17,16 @@ import cn.timer.api.bean.admin.AdminAssoTxjlb; ...@@ -13,5 +17,16 @@ import cn.timer.api.bean.admin.AdminAssoTxjlb;
*/ */
@Repository @Repository
public interface AdminAssoTxjlbMapper extends BaseMapper<AdminAssoTxjlb> { 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; ...@@ -7,7 +7,6 @@ import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.admin.AdminMsgTemplate; import cn.timer.api.bean.admin.AdminMsgTemplate;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
......
package cn.timer.api.dto.htzz; package cn.timer.api.dto.htzz;
import cn.timer.api.utils.Page;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data @Data
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class QueryNoReadingDto { public class QueryNoReadingDto extends Page implements Serializable {
private String text;
private Integer empNum; private Integer empNum;
private Integer txType;
private Integer txstate;
private Integer orgCode; private Integer orgCode;
} }
...@@ -25,106 +25,32 @@ ...@@ -25,106 +25,32 @@
txstate txstate
</sql> </sql>
<sql id="Base_Column_List_Alias"> <!-- 分页查询 -->
id AdminAssoTxjlb_id, <sql id="pageTxjlbCondition">
content AdminAssoTxjlb_content, <where>
user_name AdminAssoTxjlb_user_name, <if test="param.text != null and param.text !=''">
emp_num AdminAssoTxjlb_emp_num, and (txjlb.user_name like CONCAT('%',#{param.text},'%') or txjlb.emp_num = #{param.text})
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> </if>
</trim> <if test="param.txType != null">
<trim prefix="values (" suffix=")" suffixOverrides=","> and txjlb.tx_type = #{param.txType}
<if test ='null != content'>
#{content},
</if> </if>
<if test ='null != userName'> <if test="param.txstate != null">
#{userName}, and txjlb.txstate = #{param.txstate}
</if> </if>
<if test ='null != empNum'> <if test="param.orgCode != null">
#{empNum}, and txjlb.org_code = #{param.orgCode}
</if> </if>
<if test ='null != txType'> </where>
#{txType}, </sql>
</if> <select id="pageTxjlbCount" resultType="java.lang.Long">
<if test ='null != orgCode'> SELECT count(*) FROM admin_asso_txjlb txjlb
#{orgCode}, <include refid="pageTxjlbCondition" />
</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}
</select> </select>
<select id="pageTxjlb" resultMap="BaseResultMap">
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" /> SELECT <include refid="Base_Column_List" />
FROM admin_asso_txjlb FROM admin_asso_txjlb txjlb
LIMIT #{offset}, #{pageSize} <include refid="pageTxjlbCondition" />
ORDER BY txjlb.txstate ASC
LIMIT #{param.offset}, #{param.totalPage}
</select> </select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM admin_asso_txjlb
</select>
-->
</mapper> </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