明树Git Lab

Commit fe054255 authored by zfp1's avatar zfp1

update

parent b88b2e7f
......@@ -160,7 +160,7 @@ async function createProject(req, res, next) {
});
let approvers = await userModule.getProjectApprover(req.user.id, 'xmgs_xmspr');
if (!(approvers && approvers.length > 0)) {
return res.sendError({code: '60001', msg: '项目已保存,请联系管理员为本公司添加【项目初审】角色人员'});
return res.sendError({ code: '60001', msg: '项目已保存,请联系管理员为本公司添加【项目初审】角色人员' });
}
await DB.Message.create({
projectId: project.id,
......@@ -646,17 +646,15 @@ async function getOwnProjects(req, res, next) {
let messs = await DB.Message.findAll({
//项目审批信息接收方
where: {
[Op.and]: [
sequelize.where(
sequelize.fn('JSON_CONTAINS',
sequelize.col('receivers'),
sequelize.cast(req.user.id, 'JSON'),
'$'
),
true
[Op.and]: [sequelize.where(
sequelize.fn('JSON_CONTAINS',
sequelize.col('receivers'),
sequelize.cast(req.user.id, 'JSON'), // 直接将数字转换为JSON
sequelize.literal("'$'")
),
,
{ projectId: { [Op.ne]: null } },
true
),
{ projectId: { [Op.ne]: null } },
]
},
attributes: ['projectId']
......@@ -664,16 +662,17 @@ async function getOwnProjects(req, res, next) {
console.log(messs)
let projectIds = messs.map(o => { return o && o.projectId });
//
let cArr = [
{ projectCreator: req.user.id },
{ id: { [Op.in]: projectIds } }
]
if (req.body.projectName) {
cArr.push({ projectName: { [Op.like]: `%${req.body.projectName}%` } });
}
search.where = {
[Op.or]: [
{ projectCreator: req.user.id },
{ id: { [Op.in]: projectIds } }
]
[Op.or]: cArr
};
if (req.body.name) {
search.where[[Op.or]].push({ name: { [Op.like]: `%${req.body.name}%` } });
}
search.limit = limit;
search.offset = offset;
if (req.body.attributes && req.body.attributes.length) {
......
......@@ -26,8 +26,8 @@ const RoleMenu = sequelize.define('RoleMenu', {
// 同步模型到数据库(创建表)
RoleMenu.sync({
// force: false, // force: true 会删除已存在表并重新创建
alter: true
force: false, // force: true 会删除已存在表并重新创建
// alter: true
})
.then(() => {
console.log('RoleMenu 表同步成功');
......
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