XMTT лет назад: 8
Родитель
Сommit
4ab7242e19

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

@ -1,15 +1,15 @@
1 1
package com.ekexiu.console.system.dao;
2 2
3
import com.ekexiu.console.system.po.Demand;
3 4
import com.ekexiu.console.system.pojo.DemandInfo;
4 5
import org.jfw.apt.annotation.Nullable;
5 6
import org.jfw.apt.orm.annotation.dao.DAO;
7
import org.jfw.apt.orm.annotation.dao.method.From;
6 8
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
7 9
import org.jfw.apt.orm.annotation.dao.method.operator.PageQuery;
8 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 13
import org.jfw.util.PageQueryResult;
14 14
15 15
import java.sql.Connection;
@ -30,4 +30,7 @@ public interface DemandDao {
30 30
    PageQueryResult<DemandInfo> pageQuery(Connection con, @Nullable @Like String demandTitle, @Nullable @Like String professorName,
31 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,12 +13,15 @@ import org.jfw.apt.orm.annotation.dao.param.Like;
13 13
import org.jfw.apt.orm.annotation.dao.param.LtEq;
14 14
import org.jfw.apt.web.annotation.Path;
15 15
import org.jfw.apt.web.annotation.operate.Get;
16
import org.jfw.apt.web.annotation.operate.Post;
16 17
import org.jfw.apt.web.annotation.param.JdbcConn;
17 18
import org.jfw.apt.web.annotation.param.PathVar;
18 19
import org.jfw.util.PageQueryResult;
19 20
20 21
import java.sql.Connection;
21 22
import java.sql.SQLException;
23
import java.text.SimpleDateFormat;
24
import java.util.Date;
22 25
import java.util.List;
23 26
24 27
/**
@ -81,4 +84,13 @@ public class DemandService {
81 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
}