No Description

ConsultService.java 1.9KB

    package com.ekexiu.console.system.service; import com.ekexiu.console.system.dao.ConsultDao; import com.ekexiu.console.system.pojo.ConsultInfo; import org.jfw.apt.annotation.Autowrie; import org.jfw.apt.annotation.DefaultValue; import org.jfw.apt.annotation.Nullable; import org.jfw.apt.orm.annotation.dao.param.Like; import org.jfw.apt.web.annotation.Path; import org.jfw.apt.web.annotation.operate.Get; import org.jfw.apt.web.annotation.param.JdbcConn; import org.jfw.apt.web.annotation.param.PathVar; import org.jfw.util.PageQueryResult; import java.sql.Connection; import java.sql.SQLException; /** * Created by TT on 2017/5/3. */ @Path("/consult") public class ConsultService { @Autowrie private ConsultDao consultDao; public ConsultDao getConsultDao() { return consultDao; } public void setConsultDao(ConsultDao consultDao) { this.consultDao = consultDao; } @Get @Path("/qa") public PageQueryResult<ConsultInfo> query(@JdbcConn Connection con, @Nullable @Like String consultantName, @Nullable @Like String professorName, @Nullable @Like String consultTitle, @Nullable Integer consultStatus, @DefaultValue("1") int pageSize, @DefaultValue("10") int pageNo) throws SQLException { String cName = null; if(consultantName!=null) { cName="%"+consultantName+"%"; } String pName = null; if(professorName!=null) { pName="%"+professorName+"%"; } String cTitle = null; if(consultTitle!=null) { cTitle="%"+consultTitle+"%"; } return this.consultDao.pageQuery(con,cName,pName,cTitle,consultStatus,pageSize,pageNo); } @Get @Path("/id/{id}") public ConsultInfo query(@JdbcConn Connection con, @PathVar String id)throws SQLException { return this.consultDao.query(con, id); } }