| | |
| | | import org.springframework.stereotype.Component;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import java.text.DecimalFormat;
|
| | | import java.text.Format;
|
| | | import java.text.ParseException;
|
| | |
|
| | | /**
|
| | |
| | | @Transactional
|
| | | public void addTypeSize(FieldSetEntity fs) throws BaseException {
|
| | | String tableName = fs.getTableName();
|
| | | String year = fs.getString("no01");
|
| | | DataTableEntity dataTableEntity = baseDao.listTable("SELECT IFNULL(MAX(no02),0) no02 FROM "+tableName+" where no01=?", new String[]{year});
|
| | | String no02 = String.valueOf(Integer.parseInt(dataTableEntity.getFieldSetEntity(0).getString("no02")) + 1);
|
| | | while (no02.length() < 3){
|
| | | no02 = "0" + no02;
|
| | | }
|
| | | fs.setValue("no02",no02);
|
| | | baseDao.update(fs);
|
| | | String yearNo = fs.getString("no01");
|
| | | |
| | | //æ¥è¯¢ååæ°æ®ä¸æå¤§çå·
|
| | | FieldSetEntity fseMax =baseDao.getFieldSetEntityBySQL("SELECT IFNULL(MAX(no02),0)+1 no02 FROM "+tableName+" WHERE no01=?", new Object[] {yearNo}, false);
|
| | | if (fseMax!=null) {
|
| | | Integer maxNo = fseMax.getInteger("no02");
|
| | | |
| | | //æ ¼å¼åå·
|
| | | Format format = new DecimalFormat("000");
|
| | | String finalNo= format.format(maxNo);
|
| | | |
| | | //ä¿®æ¹æ°æ®
|
| | | baseDao.executeUpdate("UPDATE "+ tableName +" SET no02 =? WHERE uuid=?", new Object[] {finalNo, fs.getUUID()});
|
| | | }
|
| | | }
|
| | | }
|