Browse Source

其他模块

tags/正式3.2.0
雍文秀 2 years ago
parent
commit
5850516d0e

+ 37
- 0
sapi/src/main/java/com/xhkjedu/sapi/controller/system/MsgController.java View File

@@ -0,0 +1,37 @@
1
+package com.xhkjedu.sapi.controller.system;
2
+
3
+import com.github.pagehelper.PageHelper;
4
+import com.github.pagehelper.PageInfo;
5
+import com.xhkjedu.vo.PageResult;
6
+import com.xhkjedu.sapi.model.system.TMsg;
7
+import com.xhkjedu.sapi.service.system.MsgService;
8
+import com.xhkjedu.utils.PageUtil;
9
+import com.xhkjedu.vo.ResultVo;
10
+import org.springframework.web.bind.annotation.PostMapping;
11
+import org.springframework.web.bind.annotation.RequestBody;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RestController;
14
+
15
+import javax.annotation.Resource;
16
+import java.util.List;
17
+
18
+/**
19
+* @author ywx
20
+* @classname TMsgController
21
+* @description
22
+* @date 2020/10/15 15:23
23
+**/
24
+@RestController
25
+@RequestMapping("/msg")
26
+public class MsgController {
27
+    @Resource
28
+    private MsgService msgService;
29
+
30
+    @PostMapping("/list")
31
+    public ResultVo list(@RequestBody TMsg msg) {
32
+        PageHelper.startPage(msg.getPage(), msg.getPageSize());
33
+        List<TMsg> list = msgService.listAll(msg);
34
+        PageResult pageResult = PageUtil.getPageResult(new PageInfo(list));
35
+        return new ResultVo(0,"获取短信列表成功",pageResult);
36
+    }
37
+}

+ 12
- 0
sapi/src/main/java/com/xhkjedu/sapi/mapper/system/MsgMapper.java View File

@@ -0,0 +1,12 @@
1
+package com.xhkjedu.sapi.mapper.system;
2
+
3
+import com.xhkjedu.sapi.base.TkMapper;
4
+import com.xhkjedu.sapi.model.system.TMsg;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+
9
+public interface MsgMapper extends TkMapper<TMsg> {
10
+    //列表
11
+    List<TMsg> listAll(@Param("msg") TMsg msg);
12
+}

+ 36
- 0
sapi/src/main/java/com/xhkjedu/sapi/model/system/TMsg.java View File

@@ -0,0 +1,36 @@
1
+package com.xhkjedu.sapi.model.system;
2
+
3
+import com.xhkjedu.sapi.model.BaseBean;
4
+import lombok.Data;
5
+
6
+import javax.persistence.Id;
7
+import javax.persistence.Table;
8
+import javax.persistence.Transient;
9
+
10
+@Table(name = "t_msg")
11
+@Data
12
+public class TMsg extends BaseBean {
13
+    @Id
14
+    //短信id
15
+    private Integer msgid;
16
+
17
+    //短信内容
18
+    private String msgtxt;
19
+
20
+    //验证码
21
+    private Integer msgcode;
22
+
23
+    //手机号
24
+    private String userphone;
25
+
26
+    //创建时间
27
+    private Integer createtime;
28
+
29
+    @Transient
30
+    //开始时间
31
+    private Integer starttime;
32
+
33
+    @Transient
34
+    //结束时间
35
+    private Integer stoptime;
36
+}

+ 25
- 0
sapi/src/main/java/com/xhkjedu/sapi/service/system/MsgService.java View File

@@ -0,0 +1,25 @@
1
+package com.xhkjedu.sapi.service.system;
2
+
3
+import com.xhkjedu.sapi.mapper.system.MsgMapper;
4
+import com.xhkjedu.sapi.model.system.TMsg;
5
+import org.springframework.stereotype.Service;
6
+
7
+import javax.annotation.Resource;
8
+import java.util.List;
9
+
10
+/**
11
+ * @author ywx
12
+ * @classname MsgService
13
+ * @description 
14
+ * @date 2020/10/15 15:31
15
+ **/
16
+@Service
17
+public class MsgService {
18
+    @Resource
19
+    private MsgMapper msgMapper;
20
+
21
+    //获取列表
22
+    public List <TMsg> listAll(TMsg msg) {
23
+        return msgMapper.listAll(msg);
24
+    }
25
+}

+ 18
- 0
sapi/src/main/resources/mapper/system/MsgMapper.xml View File

@@ -0,0 +1,18 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.xhkjedu.sapi.mapper.system.MsgMapper">
4
+    <select id="listAll" resultType="com.xhkjedu.sapi.model.system.TMsg">
5
+        select msgid,msgtxt,msgcode,userphone,createtime from t_msg
6
+        <where>
7
+            <if test="msg.userphone!=null and msg.userphone!=''">
8
+                and userphone=#{msg.userphone}
9
+            </if>
10
+            <if test="msg.starttime!=null and msg.starttime!=0">
11
+                and UNIX_TIMESTAMP(FROM_UNIXTIME(createtime,'%Y%m%d'))>=#{msg.starttime}
12
+            </if>
13
+            <if test="msg.stoptime!=null and msg.stoptime!=0">
14
+                and UNIX_TIMESTAMP(FROM_UNIXTIME(createtime,'%Y%m%d'))&lt;=#{msg.stoptime}
15
+            </if>
16
+        </where>
17
+    </select>
18
+</mapper>

Loading…
Cancel
Save