| | |
| | | public interface BattmonTestcapMapper extends CustomMapper<BattmonTestcap>{ |
| | | |
| | | //添加标准曲线 |
| | | int add(BattmonTestcap btcp); |
| | | //int add(BattmonTestcap btcp); |
| | | |
| | | //每次增加标准曲线库前要清理曲线库 |
| | | void del(BattmonTestcap btcp); |
| | |
| | | //每次增加标准曲线库前要清理曲线库 |
| | | btcp.setTableName(table_name); |
| | | mapper.del(btcp); |
| | | //增加曲线 |
| | | int flag=mapper.add(btcp); |
| | | //增加曲线 |
| | | //int flag=mapper.add(btcp); |
| | | int flag=subService.add(btcp); |
| | | |
| | | return new Response().set(flag>0?1:0); |
| | | } |
| | |
| | | * @param values |
| | | * @return |
| | | */ |
| | | public boolean executeUpdate(String sql, Object[] values){ |
| | | public int executeUpdate(String sql, Object[] values){ |
| | | PreparedStatement ps = null; |
| | | ResultSet rs = null; |
| | | SqlSession sqlSession = openSession(); |
| | | int flag=0; |
| | | try { |
| | | ps = sqlSession.getConnection().prepareStatement(sql); |
| | | if(values != null){ |
| | |
| | | ps.setObject(i+1, values[i]); |
| | | } |
| | | } |
| | | int flag = ps.executeUpdate(); |
| | | if(flag>0){ |
| | | return true; |
| | | } |
| | | flag = ps.executeUpdate(); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | }finally{ |
| | | closeSession(rs,ps,sqlSession); |
| | | } |
| | | return false; |
| | | return flag; |
| | | } |
| | | //执行sql语句 |
| | | public boolean execute(String sql){ |
| | |
| | | realdata.setRecrodTime1(date2); |
| | | realdata.setMonNum(1); |
| | | List list=subService.serchByCondition(realdata);*/ |
| | | /*52*/ |
| | | subService.createTable4UserLogByYear("2021"); |
| | | return null; |
| | | /*52 |
| | | subService.createTable4UserLogByYear("2021");*/ |
| | | /*56*/ |
| | | BattmonTestcap btcp=new BattmonTestcap(); |
| | | btcp.setTableName("tb_battmon_testcap_2_1000_15"); |
| | | btcp.setMonvolstd(2); |
| | | btcp.setMoncapstd(1000); |
| | | btcp.setBattmodel("TEST"); |
| | | btcp.setBattproducer("理士"); |
| | | btcp.setNote("15"); |
| | | btcp.setBattgroupId(1000121); |
| | | btcp.setMonNum("1"); |
| | | btcp.setTestRecordCount(1); |
| | | int flag=subService.add(btcp); |
| | | List list=new ArrayList(); |
| | | list.add(flag); |
| | | return list; |
| | | } |
| | | } |
| | |
| | | public class SubTablePageInfoService { |
| | | @Autowired |
| | | private MybatisSqlExecuteService sqlExecuteService; |
| | | //2,7,33-SubTablePageInfoUtils.java;201行 |
| | | //2,7,33,55-SubTablePageInfoUtils.java;201行 |
| | | public List<PwrdevAlarmHistory> getList2(PwrdevAlarmHistory data){ |
| | | String sql="select alarm.*,inf.StationName,inf.StationName1,inf.StationName2,inf.StationName3,inf.StationName5 " + |
| | | " from db_pwrdev_alarm."+data.getRecordYear()+" alarm,db_pwrdev_inf.tb_pwrdev_inf inf " + |
| | |
| | | return list; |
| | | } |
| | | |
| | | //3-SubTablePageInfoUtils.java;72行 |
| | | //3,53,54-SubTablePageInfoUtils.java;72行 211行 |
| | | public List<PwrdevAlarmHistory> getListForTX(PwrdevAlarmHistory data){ |
| | | String sql="select alarm.*,inf.StationName,inf.StationName1,inf.StationName2,inf.StationName3,inf.StationName5 " + |
| | | " from db_pwrdev_alarm."+data.getRecordYear()+" alarm,db_pwrdev_inf.tb_pwrdev_inf inf " + |
| | |
| | | " ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8"; |
| | | sqlExecuteService.execute(sql); |
| | | } |
| | | |
| | | //56-BattmonTestcapService.java;44行 |
| | | public int add(BattmonTestcap btcp){ |
| | | String sql="insert into db_battinf."+btcp.getTableName()+" (monvolstd,moncapstd,battproducer,battmodel,test_cap,mon_vol,note) " + |
| | | " SELECT DISTINCT " + |
| | | " "+btcp.getMonvolstd()+","+btcp.getMoncapstd()+",'"+btcp.getBattproducer()+"','"+btcp.getBattmodel()+"',ROUND(test_cap,4),ROUND(mon_vol,3),'"+btcp.getNote()+"' from " + |
| | | " db_batt_testdata.tb_batttestdata_"+btcp.getBattgroupId()+" " + |
| | | " where test_record_count="+btcp.getTestRecordCount()+" " + |
| | | " and mon_num="+btcp.getMonNum()+" "; |
| | | int flag=sqlExecuteService.executeUpdate(sql,new Object[]{}); |
| | | return flag; |
| | | } |
| | | } |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.whyc.mapper.BattmonTestcapMapper"> |
| | | |
| | | <insert id="add"> |
| | | <!--<insert id="add"> |
| | | insert into db_battinf.${tableName}(monvolstd,moncapstd,battproducer,battmodel,test_cap,mon_vol,note) |
| | | SELECT DISTINCT |
| | | #{monvolstd},#{moncapstd},#{battproducer},#{battmodel},ROUND(test_cap,4),ROUND(mon_vol,3),#{note} from |
| | | db_batt_testdata.tb_batttestdata_#{battgroupId} |
| | | where test_record_count=#{testRecordCount} |
| | | and mon_num=#{monNum} |
| | | </insert> |
| | | </insert>--> |
| | | <!-- <update id="create_standard_curve" parameterType="java.lang.String"> |
| | | CREATE TABLE IF NOT EXISTS db_battinf.${tableName} ( |
| | | num int(11) NOT NULL AUTO_INCREMENT, |