|
@@ -83,7 +83,8 @@ public class LMBManager
|
|
* 查询栏目下最大的ID
|
|
* 查询栏目下最大的ID
|
|
* 李猛20230202修改,由原count(id)改为max(id)
|
|
* 李猛20230202修改,由原count(id)改为max(id)
|
|
* 并且将返回值类型由int改为long,以适应更长的栏目ID
|
|
* 并且将返回值类型由int改为long,以适应更长的栏目ID
|
|
- */
|
|
|
|
|
|
+ * 下放方法已经弃用,使用新方法 selectMaxId()
|
|
|
|
+
|
|
public Long selectCount(String flmid) {
|
|
public Long selectCount(String flmid) {
|
|
Session session;
|
|
Session session;
|
|
StringBuffer sb;
|
|
StringBuffer sb;
|
|
@@ -101,6 +102,14 @@ public class LMBManager
|
|
}
|
|
}
|
|
return d;
|
|
return d;
|
|
}
|
|
}
|
|
|
|
+ */
|
|
|
|
+ public Long selectMaxId() {
|
|
|
|
+ Session session = getSession();
|
|
|
|
+ Long res = Long.parseLong(session.createSQLQuery("select max(id) as maxid from CETDZ.W_LMB where 1=1").uniqueResult().toString());
|
|
|
|
+ session.close();
|
|
|
|
+ res = res + 1;
|
|
|
|
+ return res;
|
|
|
|
+ }
|
|
|
|
|
|
public List<Map> toJsonByLMB(String zdbs) {
|
|
public List<Map> toJsonByLMB(String zdbs) {
|
|
ActionContext cxt = ActionContext.getContext();
|
|
ActionContext cxt = ActionContext.getContext();
|
|
@@ -623,29 +632,11 @@ public class LMBManager
|
|
return lmb;
|
|
return lmb;
|
|
}
|
|
}
|
|
|
|
|
|
- public int addLMB(LMB lmb, String sjid) {
|
|
|
|
|
|
+ public int addLMB(LMB lmb) {
|
|
int result = 0;
|
|
int result = 0;
|
|
- String sql = null;
|
|
|
|
- String sql2 = null;
|
|
|
|
|
|
+ String sql;
|
|
try {
|
|
try {
|
|
- int maxid = 0;
|
|
|
|
- sql2 = "select count(id) as maxid from CETDZ.W_LMB where flmid='" + sjid +
|
|
|
|
- "' ";
|
|
|
|
-
|
|
|
|
- this.ps = this.dbc.prepareStatement(sql2);
|
|
|
|
- this.rs = this.ps.executeQuery();
|
|
|
|
- if (this.rs.next()) {
|
|
|
|
- maxid = this.rs.getInt("maxid");
|
|
|
|
- }
|
|
|
|
- maxid++;
|
|
|
|
- this.rs.close();
|
|
|
|
- this.ps.close();
|
|
|
|
- sql = "insert into CETDZ.W_LMB(id,lmmc,zxdz,btype,bidx,blink,bpass,glidx,bgltype,lmfp,blm,wzpx,dhlm,xssx,lmlx,lmzt,zdbs,fwcs,lmjs,lmsm,flmid,jtymc,by1,by2,by3) values('" +
|
|
|
|
- sjid +
|
|
|
|
- "'||'00'||" +
|
|
|
|
- maxid +
|
|
|
|
- ",?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";
|
|
|
|
-
|
|
|
|
|
|
+ sql = "insert into CETDZ.W_LMB(id,lmmc,zxdz,btype,bidx,blink,bpass,glidx,bgltype,lmfp,blm,wzpx,dhlm,xssx,lmlx,lmzt,zdbs,fwcs,lmjs,lmsm,flmid,jtymc,by1,by2,by3) values('" +selectMaxId() + ",?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";
|
|
this.ps = this.dbc.prepareStatement(sql);
|
|
this.ps = this.dbc.prepareStatement(sql);
|
|
this.ps.setString(1, lmb.getLmmc());
|
|
this.ps.setString(1, lmb.getLmmc());
|
|
this.ps.setString(2, lmb.getZxdz());
|
|
this.ps.setString(2, lmb.getZxdz());
|