修改数据库字段,rec_attachment:order->sort,msg:all->broadcast

master
toesbieya 6 years ago
parent 5d8cc0e0db
commit 255b808a9d
  1. 43632
      java/my.sql
  2. 4
      java/src/main/java/com/toesbieya/my/controller/MsgController.java
  3. 2
      java/src/main/java/com/toesbieya/my/model/entity/Msg.java
  4. 2
      java/src/main/java/com/toesbieya/my/model/entity/RecAttachment.java
  5. 2
      java/src/main/java/com/toesbieya/my/service/MsgService.java
  6. 1
      java/src/main/resources/application.yml
  7. 4
      java/src/main/resources/mapper/BizStock.xml
  8. 23
      java/src/main/resources/mapper/Msg.xml
  9. 6
      java/src/main/resources/mapper/RecAttachment.xml
  10. 14
      vue/src/views/message/manage/EditDialog.vue
  11. 2
      vue/src/views/message/manage/index.vue

File diff suppressed because it is too large Load Diff

@ -108,8 +108,8 @@ public class MsgController {
private String validateAdd(Msg msg) { private String validateAdd(Msg msg) {
if (StringUtils.isEmpty(msg.getTitle()) if (StringUtils.isEmpty(msg.getTitle())
|| msg.getType() == null || msg.getType() == null
|| msg.getAll() == null || msg.getBroadcast() == null
|| msg.getAll().equals(MsgConstant.TO_RANGE) && StringUtils.isEmpty(msg.getRecipient()) || msg.getBroadcast().equals(MsgConstant.TO_RANGE) && StringUtils.isEmpty(msg.getRecipient())
) return "参数错误"; ) return "参数错误";
return null; return null;
} }

@ -18,6 +18,6 @@ public class Msg {
private String wname; private String wname;
private Long wtime; private Long wtime;
private Integer status; private Integer status;
private Integer all; private Integer broadcast;
private String recipient; private String recipient;
} }

@ -14,7 +14,7 @@ public class RecAttachment {
private String pid; private String pid;
private String name; private String name;
private Long time; private Long time;
private Integer order; private Integer sort;
private String url; private String url;
private Long size; private Long size;
} }

@ -47,7 +47,7 @@ public class MsgService {
if (result.isSuccess()) { if (result.isSuccess()) {
result.setMsg("提交成功"); result.setMsg("提交成功");
result.setData(msg); result.setData(msg);
if (msg.getAll().equals(MsgConstant.TO_ALL)) { if (msg.getBroadcast().equals(MsgConstant.TO_ALL)) {
SocketModule.broadcast(SocketConstant.EVENT_NEW_MESSAGE); SocketModule.broadcast(SocketConstant.EVENT_NEW_MESSAGE);
} }
else { else {

@ -13,7 +13,6 @@ spring:
redis: redis:
host: localhost host: localhost
port: 6379 port: 6379
password: password
timeout: 3000 timeout: 3000
lettuce: lettuce:
pool: pool:

@ -19,7 +19,7 @@
cname, cname,
sum(num) total_num, sum(num) total_num,
sum(num*price) total_price sum(num*price) total_price
from `biz_stock` from biz_stock
where 1 where 1
<include refid="searchCondition"/> <include refid="searchCondition"/>
and num >0 and num >0
@ -48,7 +48,7 @@
cname, cname,
sum(num) total_num, sum(num) total_num,
sum(num * price) total_price sum(num * price) total_price
from `biz_stock` from biz_stock
where 1 where 1
<include refid="searchCondition"/> <include refid="searchCondition"/>
and num > 0 and num > 0

@ -16,11 +16,18 @@
</if> </if>
</sql> </sql>
<sql id="unreadCondition">
where status = 1
and ptime <![CDATA[ >= ]]> #{ctime}
and (broadcast = 1 or broadcast = 0 and find_in_set(recipient, #{uid}))
and id not in (select mid from msg_state where uid = #{uid})
</sql>
<insert id="insert" parameterType="com.toesbieya.my.model.entity.Msg"> <insert id="insert" parameterType="com.toesbieya.my.model.entity.Msg">
insert into msg (title, content, type, cid, cname, ctime, insert into msg (title, content, type, cid, cname, ctime,
pid, pname, ptime, wid, wname, wtime, status, `all`, recipient) pid, pname, ptime, wid, wname, wtime, status, broadcast, recipient)
values (#{title}, #{content}, #{type}, #{cid}, #{cname}, #{ctime}, #{pid}, values (#{title}, #{content}, #{type}, #{cid}, #{cname}, #{ctime}, #{pid},
#{pname}, #{ptime}, #{wid}, #{wname}, #{wtime}, #{status}, #{all}, #{recipient}) #{pname}, #{ptime}, #{wid}, #{wname}, #{wtime}, #{status}, #{broadcast}, #{recipient})
</insert> </insert>
<insert id="insertState" parameterType="com.toesbieya.my.model.entity.MsgState"> <insert id="insertState" parameterType="com.toesbieya.my.model.entity.MsgState">
@ -55,7 +62,7 @@
wname=#{wname}, wname=#{wname},
wtime=#{wtime}, wtime=#{wtime},
status=#{status}, status=#{status},
`all`=#{all}, broadcast=#{broadcast},
recipient=#{recipient} recipient=#{recipient}
where id = #{id} where id = #{id}
</update> </update>
@ -100,10 +107,7 @@
pname, pname,
ptime ptime
from msg from msg
where status = 1 <include refid="unreadCondition"/>
and ptime <![CDATA[ >= ]]> #{ctime}
and (`all` = 1 or `all` = 0 and find_in_set(recipient, #{uid}))
and id not in (select mid from msg_state where uid = #{uid})
order by id desc order by id desc
</select> </select>
@ -111,9 +115,6 @@
resultType="java.lang.Integer"> resultType="java.lang.Integer">
select count(1) select count(1)
from msg from msg
where status = 1 <include refid="unreadCondition"/>
and ptime <![CDATA[ >= ]]> #{ctime}
and (`all` = 1 or `all` = 0 and find_in_set(recipient, #{uid}))
and id not in (select mid from msg_state where uid = #{uid})
</select> </select>
</mapper> </mapper>

@ -5,7 +5,7 @@
select * select *
from rec_attachment from rec_attachment
where pid = #{pid} where pid = #{pid}
order by `order` desc order by sort desc
</select> </select>
<select id="getUrlByPid" resultType="java.lang.String"> <select id="getUrlByPid" resultType="java.lang.String">
select url select url
@ -14,10 +14,10 @@
</select> </select>
<insert id="add" parameterType="com.toesbieya.my.model.entity.RecAttachment"> <insert id="add" parameterType="com.toesbieya.my.model.entity.RecAttachment">
insert into rec_attachment (pid, name, time, `order`, url,size) insert into rec_attachment (pid, name, time, sort, url,size)
VALUES VALUES
<foreach collection="list" item="i" separator=","> <foreach collection="list" item="i" separator=",">
(#{i.pid}, #{i.name}, #{i.time}, #{i.order}, #{i.url},#{i.size}) (#{i.pid}, #{i.name}, #{i.time}, #{i.sort}, #{i.url},#{i.size})
</foreach> </foreach>
</insert> </insert>

@ -25,13 +25,13 @@
<dialog-form-item v-if="type!=='add'" label="创建时间:" dense> <dialog-form-item v-if="type!=='add'" label="创建时间:" dense>
<el-date-picker :value="form.ctime" format="yyyy-MM-dd HH:mm:ss" readonly type="date"/> <el-date-picker :value="form.ctime" format="yyyy-MM-dd HH:mm:ss" readonly type="date"/>
</dialog-form-item> </dialog-form-item>
<dialog-form-item label="通知对象:" prop="all" dense> <dialog-form-item label="通知对象:" prop="broadcast" dense>
<el-select v-model="form.all" :disabled="!canSave"> <el-select v-model="form.broadcast" :disabled="!canSave">
<el-option :value="0" label="指定用户"/> <el-option :value="0" label="指定用户"/>
<el-option :value="1" label="全体用户"/> <el-option :value="1" label="全体用户"/>
</el-select> </el-select>
</dialog-form-item> </dialog-form-item>
<dialog-form-item v-if="form.all===0" label="选择用户:" prop="recipient" dense> <dialog-form-item v-if="form.broadcast===0" label="选择用户:" prop="recipient" dense>
<user-selector v-model="form.recipient" :disabled="!canSave"/> <user-selector v-model="form.recipient" :disabled="!canSave"/>
</dialog-form-item> </dialog-form-item>
<dialog-form-item v-if="form.pname" label="发布人:" dense> <dialog-form-item v-if="form.pname" label="发布人:" dense>
@ -106,13 +106,13 @@
wname: null, wname: null,
wtime: null, wtime: null,
status: 0, status: 0,
all: 1, broadcast: 1,
recipient: [] recipient: []
}, },
rules: { rules: {
title: [{required: true, message: '请输入标题', trigger: 'change'}], title: [{required: true, message: '请输入标题', trigger: 'change'}],
type: [{required: true, message: '请选择消息类型', trigger: 'change'}], type: [{required: true, message: '请选择消息类型', trigger: 'change'}],
all: [{required: true, message: '请选择通知对象', trigger: 'change'}] broadcast: [{required: true, message: '请选择通知对象', trigger: 'change'}]
} }
} }
}, },
@ -159,7 +159,7 @@
clearForm() { clearForm() {
resetObj(this.form) resetObj(this.form)
this.form.all = 1 this.form.broadcast = 1
this.needSearch = false this.needSearch = false
this.loading = false this.loading = false
this.$nextTick(() => this.$refs.form.clearValidate()) this.$nextTick(() => this.$refs.form.clearValidate())
@ -240,7 +240,7 @@
}, },
transformForm() { transformForm() {
if (this.form.all === 1) return this.form if (this.form.broadcast === 1) return this.form
else return {...this.form, recipient: this.form.recipient.join(',')} else return {...this.form, recipient: this.form.recipient.join(',')}
} }
} }

@ -35,7 +35,7 @@
<template v-slot="{row}">{{row.type===0?'通知提醒':'系统公告'}}</template> <template v-slot="{row}">{{row.type===0?'通知提醒':'系统公告'}}</template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="通知对象" show-overflow-tooltip> <el-table-column align="center" label="通知对象" show-overflow-tooltip>
<template v-slot="{row}">{{row.all===1?'全体用户':'指定用户'}}</template> <template v-slot="{row}">{{row.broadcast===1?'全体用户':'指定用户'}}</template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="状 态" show-overflow-tooltip> <el-table-column align="center" label="状 态" show-overflow-tooltip>
<template v-slot="{row}">{{transformStatus(row.status)}}</template> <template v-slot="{row}">{{transformStatus(row.status)}}</template>

Loading…
Cancel
Save