Parcourir la Source

更改需求状态

XMTT 8 ans auparavant
Parent
commit
4ab7242e19

+ 7 - 4
src/main/java/com/ekexiu/console/system/dao/DemandDao.java

1
package com.ekexiu.console.system.dao;
1
package com.ekexiu.console.system.dao;
2
2
3
import com.ekexiu.console.system.po.Demand;
3
import com.ekexiu.console.system.pojo.DemandInfo;
4
import com.ekexiu.console.system.pojo.DemandInfo;
4
import org.jfw.apt.annotation.Nullable;
5
import org.jfw.apt.annotation.Nullable;
5
import org.jfw.apt.orm.annotation.dao.DAO;
6
import org.jfw.apt.orm.annotation.dao.DAO;
7
import org.jfw.apt.orm.annotation.dao.method.From;
6
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
8
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
7
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
9
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
8
import org.jfw.apt.orm.annotation.dao.method.operator.QueryOne;
10
import org.jfw.apt.orm.annotation.dao.method.operator.QueryOne;
9
import org.jfw.apt.orm.annotation.dao.param.Alias;
10
import org.jfw.apt.orm.annotation.dao.param.GtEq;
11
import org.jfw.apt.orm.annotation.dao.param.Like;
12
import org.jfw.apt.orm.annotation.dao.param.LtEq;
11
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
12
import org.jfw.apt.orm.annotation.dao.param.*;
13
import org.jfw.util.PageQueryResult;
13
import org.jfw.util.PageQueryResult;
14
14
15
import java.sql.Connection;
15
import java.sql.Connection;
30
    PageQueryResult<DemandInfo> pageQuery(Connection con, @Nullable @Like String demandTitle, @Nullable @Like String professorName,
30
    PageQueryResult<DemandInfo> pageQuery(Connection con, @Nullable @Like String demandTitle, @Nullable @Like String professorName,
31
                                          @Nullable @Like String demandAim, @Nullable @GtEq @Alias("createTime") String bt, @Nullable @Alias("createTime") @LtEq String et, int pageNo, int pageSize)throws SQLException;
31
                                          @Nullable @Like String demandAim, @Nullable @GtEq @Alias("createTime") String bt, @Nullable @Alias("createTime") @LtEq String et, int pageNo, int pageSize)throws SQLException;
32
32
33
    @UpdateWith
34
    @From(Demand.class)
35
    int updateDemandStatus(Connection con,String demandId,@Set String demandStatus,@Set String closeTime)throws SQLException;
33
}
36
}

+ 12 - 0
src/main/java/com/ekexiu/console/system/service/DemandService.java

13
import org.jfw.apt.orm.annotation.dao.param.LtEq;
13
import org.jfw.apt.orm.annotation.dao.param.LtEq;
14
import org.jfw.apt.web.annotation.Path;
14
import org.jfw.apt.web.annotation.Path;
15
import org.jfw.apt.web.annotation.operate.Get;
15
import org.jfw.apt.web.annotation.operate.Get;
16
import org.jfw.apt.web.annotation.operate.Post;
16
import org.jfw.apt.web.annotation.param.JdbcConn;
17
import org.jfw.apt.web.annotation.param.JdbcConn;
17
import org.jfw.apt.web.annotation.param.PathVar;
18
import org.jfw.apt.web.annotation.param.PathVar;
18
import org.jfw.util.PageQueryResult;
19
import org.jfw.util.PageQueryResult;
19
20
20
import java.sql.Connection;
21
import java.sql.Connection;
21
import java.sql.SQLException;
22
import java.sql.SQLException;
23
import java.text.SimpleDateFormat;
24
import java.util.Date;
22
import java.util.List;
25
import java.util.List;
23
26
24
/**
27
/**
81
        return this.consultDao.queryDemand(con, id);
84
        return this.consultDao.queryDemand(con, id);
82
    }
85
    }
83
86
87
    @Post
88
    @Path("/close")
89
    public void closeDemand(@JdbcConn(true) Connection con,String demandId,String demandStatus)throws SQLException{
90
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
91
        String closeTime = sdf.format(new Date());
92
        int status = Integer.parseInt(demandStatus);
93
        status = (status + 1) % 2;
94
        this.demandDao.updateDemandStatus(con, demandId, String.valueOf(status), closeTime);
95
    }
84
}
96
}